Fossil

Check-in [ae8f2ebe4b]
Login

Check-in [ae8f2ebe4b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Consolidated some CSS. Minor pikchrshow layout tweaks.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | pikchrshow-wasm
Files: files | file ages | folders
SHA3-256: ae8f2ebe4b61fb0e190de416aba03009bfbf397ad1e78d1e285d30d52db41425
User & Date: stephan 2022-06-06 20:54:10.569
Context
2022-06-06
21:56
darkmode skin: replace on-focus color change of buttons with a light border, else the text has illegibly little contrast. ... (check-in: 63d510764e user: stephan tags: pikchrshow-wasm)
20:54
Consolidated some CSS. Minor pikchrshow layout tweaks. ... (check-in: ae8f2ebe4b user: stephan tags: pikchrshow-wasm)
20:13
pikchrshow layout tweaks. ... (check-in: 32526f32e7 user: stephan tags: pikchrshow-wasm)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/default.css.
1005
1006
1007
1008
1009
1010
1011



1012
1013
1014
1015
1016
1017
1018
}
.capsumWrite {
  background-color: #ffb;
}
label {
  white-space: nowrap;
}



.copy-button {
  display: inline-block;
  width: 14px;
  height: 14px;
/*Note: .24em is slightly smaller than the average width of a normal space.*/
  margin: -2px .24em 0 0;
  padding: 0;







>
>
>







1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
}
.capsumWrite {
  background-color: #ffb;
}
label {
  white-space: nowrap;
}
label[for] {
  cursor: pointer;
}
.copy-button {
  display: inline-block;
  width: 14px;
  height: 14px;
/*Note: .24em is slightly smaller than the average width of a normal space.*/
  margin: -2px .24em 0 0;
  padding: 0;
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084





1085
1086
1087
1088
1089
1090
1091
1092
  color: darkred;
  background: yellow;
}
.warning {
  color: black;
  background: yellow;
}
.hidden {
  /* The framework-wide way of hiding elements is to assign them this
     CSS class. To make them visible again, remove it. The !important
     qualifiers are unfortunate but sometimes necessary when hidden
     element has other classes which specify visibility-related





     options. */
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important;
}
input {
  max-width: 95%;







|
|
|
|
|
>
>
>
>
>
|







1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
  color: darkred;
  background: yellow;
}
.warning {
  color: black;
  background: yellow;
}
.hidden, .initially-hidden {
  /* The framework-wide way of hiding elements is to assign them th
     .hidden class. To make them visible again, remove it. The
     !important qualifiers are unfortunate but sometimes necessary
     when hidden element has other classes which specify
     visibility-related options. The .initially-hidden class is for
     pages which need to show, e.g., a progress widget while a large
     WASM blob loads. Elements aside from that load-time widget can be
     made .initially-hidden and then have that class removed once the
     long-running startup process is done. See /pikchrshow for an
     example. */
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important;
}
input {
  max-width: 95%;
Changes to src/pikchrshow.c.
228
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
    blob_appendf(pOut, "%s\n", zNonce);
  }
  blob_reset(&bIn);
  return isErr;
}

/*
** WEBPAGE: pikchrshowcs*

**
** A pikchr code editor and previewer, allowing users to experiment
** with pikchr code or prototype it for use in copy/pasting into forum
** posts, wiki pages, or embedded docs. This version of pikchrshow
** uses JavaScript to send pikchr code to the server for
** processing. The newer /pikchrshow applications runs pikchr on the
** client machine, without the need for back-and-forth network
** traffic.
**
** It optionally accepts a p=pikchr-script-code URL parameter or POST
** value to pre-populate the editor with that code.
*/
void pikchrshowcs_page(void){
  const char *zContent = 0;
  int isDark;              /* true if the current skin is "dark" */
  int pikFlags =
    PIKCHR_PROCESS_DIV
    | PIKCHR_PROCESS_SRC







|
>








<
<
<







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244



245
246
247
248
249
250
251
    blob_appendf(pOut, "%s\n", zNonce);
  }
  blob_reset(&bIn);
  return isErr;
}

/*
** Legacy impl of /pikchrshow. pikchrshow_page() will delegate to
** this one if the "legacy" or "ajax" request arguments are set.
**
** A pikchr code editor and previewer, allowing users to experiment
** with pikchr code or prototype it for use in copy/pasting into forum
** posts, wiki pages, or embedded docs. This version of pikchrshow
** uses JavaScript to send pikchr code to the server for
** processing. The newer /pikchrshow applications runs pikchr on the
** client machine, without the need for back-and-forth network
** traffic.



*/
void pikchrshowcs_page(void){
  const char *zContent = 0;
  int isDark;              /* true if the current skin is "dark" */
  int pikFlags =
    PIKCHR_PROCESS_DIV
    | PIKCHR_PROCESS_SRC
391
392
393
394
395
396
397
398


399


400
401
402
403
404
405
406
** WEBPAGE: pikchrshow
**
** A pikchr code editor and previewer, allowing users to experiment
** with pikchr code or prototype it for use in copy/pasting into forum
** posts, wiki pages, or embedded docs. This version of pikchrshow
** uses WebAssembly to run entirely in the client browser, without a
** need for back-and-forth client/server traffic to perform the
** rendering. The "legacy" version of this application can be found at


** /pikchrshowcs.


*/
void pikchrshow_page(void){
  const char *zContent = 0;

  if(P("legacy") || P("ajax")){
    pikchrshowcs_page();
    return;







|
>
>
|
>
>







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
** WEBPAGE: pikchrshow
**
** A pikchr code editor and previewer, allowing users to experiment
** with pikchr code or prototype it for use in copy/pasting into forum
** posts, wiki pages, or embedded docs. This version of pikchrshow
** uses WebAssembly to run entirely in the client browser, without a
** need for back-and-forth client/server traffic to perform the
** rendering. The "legacy" version of this application, which sends
** all input to the server for rendering, can be accessed by adding
** the "legacy" URL argument.
**
** It optionally accepts a p=pikchr-script-code URL parameter or POST
** value to pre-populate the editor with that code.
*/
void pikchrshow_page(void){
  const char *zContent = 0;

  if(P("legacy") || P("ajax")){
    pikchrshowcs_page();
    return;
415
416
417
418
419
420
421

422
423
424
425
426
427
428
429
430
431
432
433
434
435
436

437
438
439
440
441
442
443
  if(!zContent){
    zContent = "arrow right 200% \"Markdown\" \"Source\"\n"
      "box rad 10px \"Markdown\" \"Formatter\" \"(markdown.c)\" fit\n"
      "arrow right 200% \"HTML+SVG\" \"Output\"\n"
      "arrow <-> down from last box.s\n"
      "box same \"Pikchr\" \"Formatter\" \"(pikchr.c)\" fit\n";
  }

  CX("<div class='emscripten'>"); {
    CX("<figure id='module-spinner'>");
      CX("<div class='spinner'></div>");
      CX("<div class='center'><strong>Initializing app...</strong></div>");
      CX("<div class='center'>");
        CX("On a slow internet connection this may take a moment.  If this ");
        CX("message displays for \"a long time\", intialization may have ");
        CX("failed and the JavaScript console may contain clues as to why. ");
      CX("</div>");
      CX("<div><a href='?legacy'>Switch to legacy mode</a></div>");
    CX("</figure>");
    CX("<div class='emscripten' id='module-status'>Downloading...</div>");
    CX("<progress value='0' max='100' id='module-progress' hidden='1'>"
       "</progress>");
  } CX("</div><!-- .emscripten -->");

  CX("<div id='view-split' class='app-view initially-hidden'>"); {
    CX("<div class='fieldset options collapsible'>"); {
      CX("<span class='legend'><span>Options</span></span>");
      CX("<div>");
      CX("<span class='labeled-input'>");
        CX("<input type='checkbox' id='opt-cb-sbs' ");
        CX("data-csstgt='#main-wrapper' ");







>















>







417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
  if(!zContent){
    zContent = "arrow right 200% \"Markdown\" \"Source\"\n"
      "box rad 10px \"Markdown\" \"Formatter\" \"(markdown.c)\" fit\n"
      "arrow right 200% \"HTML+SVG\" \"Output\"\n"
      "arrow <-> down from last box.s\n"
      "box same \"Pikchr\" \"Formatter\" \"(pikchr.c)\" fit\n";
  }
  /* Wasm load/init progress widget... */
  CX("<div class='emscripten'>"); {
    CX("<figure id='module-spinner'>");
      CX("<div class='spinner'></div>");
      CX("<div class='center'><strong>Initializing app...</strong></div>");
      CX("<div class='center'>");
        CX("On a slow internet connection this may take a moment.  If this ");
        CX("message displays for \"a long time\", intialization may have ");
        CX("failed and the JavaScript console may contain clues as to why. ");
      CX("</div>");
      CX("<div><a href='?legacy'>Switch to legacy mode</a></div>");
    CX("</figure>");
    CX("<div class='emscripten' id='module-status'>Downloading...</div>");
    CX("<progress value='0' max='100' id='module-progress' hidden='1'>"
       "</progress>");
  } CX("</div><!-- .emscripten -->");
  /* Main view... */
  CX("<div id='view-split' class='app-view initially-hidden'>"); {
    CX("<div class='fieldset options collapsible'>"); {
      CX("<span class='legend'><span>Options</span></span>");
      CX("<div>");
      CX("<span class='labeled-input'>");
        CX("<input type='checkbox' id='opt-cb-sbs' ");
        CX("data-csstgt='#main-wrapper' ");
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
        CX("<a href='?legacy'>Legacy mode</a>");
      CX("</span>");
      CX("</div><!-- options wrapper -->");
    } CX("</div><!-- .fieldset -->");
    CX("<div id='main-wrapper' class=''>"); {
      CX("<div class='zone-wrapper input'>"); {
        CX("<textarea id='input'");
          CX("placeholder='Shell input. Ctrl-enter/shift-enter runs it.'>");
          CX("/**\n");
          CX("  Use ctrl-enter or shift-enter to execute\n");
          CX("  pikchr code. If only a subset is currently\n");
          CX("  selected, only that part is evaluated.\n*/\n");
        CX("%s</textarea>",zContent/*safe-for-%s*/);
        CX("<div class='button-bar'>");
          CX("<button id='btn-render'>Render</button>");







|







472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
        CX("<a href='?legacy'>Legacy mode</a>");
      CX("</span>");
      CX("</div><!-- options wrapper -->");
    } CX("</div><!-- .fieldset -->");
    CX("<div id='main-wrapper' class=''>"); {
      CX("<div class='zone-wrapper input'>"); {
        CX("<textarea id='input'");
          CX("placeholder='Pikchr input. Ctrl-enter/shift-enter runs it.'>");
          CX("/**\n");
          CX("  Use ctrl-enter or shift-enter to execute\n");
          CX("  pikchr code. If only a subset is currently\n");
          CX("  selected, only that part is evaluated.\n*/\n");
        CX("%s</textarea>",zContent/*safe-for-%s*/);
        CX("<div class='button-bar'>");
          CX("<button id='btn-render'>Render</button>");
Changes to src/style.pikchrshow.css.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  display: flex;
  flex-direction: column-reverse;
  flex: 1 1 auto;
  margin: 0.5em 0;
  overflow: hidden;
}
#main-wrapper.side-by-side {
  flex-direction: row-reverse;
}
#main-wrapper.swapio {
  flex-direction: column;
}
#main-wrapper.side-by-side.swapio {
  flex-direction: row;
}
#main-wrapper .splitter-handle {
  border: 1px outset;
  border-radius: 0.25em;
}
#main-wrapper.side-by-side .splitter-handle {
  width: 2px;







|





|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  display: flex;
  flex-direction: column-reverse;
  flex: 1 1 auto;
  margin: 0.5em 0;
  overflow: hidden;
}
#main-wrapper.side-by-side {
  flex-direction: row;
}
#main-wrapper.swapio {
  flex-direction: column;
}
#main-wrapper.side-by-side.swapio {
  flex-direction: row-reverse;
}
#main-wrapper .splitter-handle {
  border: 1px outset;
  border-radius: 0.25em;
}
#main-wrapper.side-by-side .splitter-handle {
  width: 2px;
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
  align-items: stretch;
  flex: 1 1 auto;
}
#pikchr-output-wrapper.text > #pikchr-output > textarea {
  flex: 1 1 auto;
}
.zone-wrapper textarea {
  flex: 10 1 auto;
}
.zone-wrapper.input {
  /*min-height: 10em;*/
  /*width: 50%;*/
  min-width: 20em;
}
.zone-wrapper.output {
  overflow: auto;
  justify-content: space-between;
}
.button-bar {
  display: flex;
  justify-content: center;
  flex: 0 1 auto;
  flex-wrap: wrap;
}
.button-bar button {
  margin: 0.25em 1em;
}
label[for] {
  cursor: pointer;
}
.error {
  color: red;
  background-color: yellow;
}
.hidden, .initially-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important;
}
/* Safari supports neither styling of nor event handling on a
         fieldset legend, so we emulate a fieldset-like widget. */
.fieldset {
  border-radius: 0.5em;
  border: 1px inset;
  border-top: none;
  display: flex;
  flex-direction: column;
}







|


|
















<
<
<
<
<
<
<
<
<
<
<
<
<

|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116













117
118
119
120
121
122
123
124
125
  align-items: stretch;
  flex: 1 1 auto;
}
#pikchr-output-wrapper.text > #pikchr-output > textarea {
  flex: 1 1 auto;
}
.zone-wrapper textarea {
  flex: 1 1 auto;
}
.zone-wrapper.input {
  min-height: 10em;
  /*width: 50%;*/
  min-width: 20em;
}
.zone-wrapper.output {
  overflow: auto;
  justify-content: space-between;
}
.button-bar {
  display: flex;
  justify-content: center;
  flex: 0 1 auto;
  flex-wrap: wrap;
}
.button-bar button {
  margin: 0.25em 1em;
}













/* Safari supports neither styling of nor event handling on a
   fieldset legend, so we emulate a fieldset-like widget. */
.fieldset {
  border-radius: 0.5em;
  border: 1px inset;
  border-top: none;
  display: flex;
  flex-direction: column;
}
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
  border-radius: 0.25em;
  white-space: nowrap;
  background: #0002;
  display: flex;
  align-items: center;
}
span.labeled-input > *:nth-child(2) {
  margin-left: 0.5em;
}
.center { text-align: center; }
.app-view {
  flex: 20 1 auto;
}
#titlebar {
  display: flex;







|







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
  border-radius: 0.25em;
  white-space: nowrap;
  background: #0002;
  display: flex;
  align-items: center;
}
span.labeled-input > *:nth-child(2) {
  margin-left: 0.3em;
}
.center { text-align: center; }
.app-view {
  flex: 20 1 auto;
}
#titlebar {
  display: flex;