@kupcad/playground 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,8 +24,8 @@ the PWA) embeds; it keeps nothing of the page's.
24
24
  (`.kc-control` gives them its look). It keeps no draft: a page loaded again shows `source`.
25
25
  * **For a host that gives it other scripts** (examples to choose from): `load(script)` (the
26
26
  component's, by `bind:this`) puts one in the editor in place of the person's, which the
27
- editor's undo takes back, and runs it at once on its own values; the core, the console and the
28
- layout stay as they are.
27
+ editor's undo takes back, and runs it at once on its own values, its model framed whole (an
28
+ edit's keeps the camera); the core, the console and the layout stay as they are.
29
29
  * **When it runs** (`runner.js`, `Runner`): once the script stays as it is for a moment after an
30
30
  edit (`DELAY_MS`, 300), at once when a parameter's value changes or it starts. A run under
31
31
  way when the next starts is stopped (the worker drops or ends its call), so what is shown is
@@ -44,8 +44,10 @@ the PWA) embeds; it keeps nothing of the page's.
44
44
  resize them (`@kupcad/ui`'s `Splitter`), and the toolbar's Parameters button hides the
45
45
  parameters for the model's width; the sizes, and what is hidden or folded, are kept in
46
46
  `settings`, by default the page's localStorage (`localSettings`, the `playground.*` keys), and
47
- how the view looks too (the pane's `view.*` keys), all followed as they are set; a narrow page
48
- stacks the panes.
47
+ how the view looks too (the pane's `view.*` keys), all followed as they are set. A page 800px
48
+ wide or less stacks the panes, each at a height of its own (the script a few lines, the model
49
+ 4:3 of its width, at most 32em, the console and the parameters as tall as their lines), and
50
+ the playground scrolls; on a phone the view's panel is under the model (`ViewerPane`'s).
49
51
  * **The console** (`@kupcad/ui`'s `ConsolePanel`, under the model): each run, what it printed
50
52
  (`puts`, `print`, `inspect`), its warnings and its error, a line naming a place taking the
51
53
  editor there, and the core's log (the worker module's stdout and stderr).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kupcad/playground",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "KupCAD in the browser: a script's editor, its model and its parameters, running on the core compiled to WebAssembly in a worker. One Svelte component a page embeds.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -24,10 +24,10 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@kupcad/editor": "0.1.2",
28
- "@kupcad/protocol": "0.1.2",
29
- "@kupcad/ui": "0.1.2",
30
- "@kupcad/wasm": "0.1.2"
27
+ "@kupcad/editor": "0.1.4",
28
+ "@kupcad/protocol": "0.1.4",
29
+ "@kupcad/ui": "0.1.4",
30
+ "@kupcad/wasm": "0.1.4"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@codemirror/lint": "^6.9.7",
@@ -104,7 +104,10 @@
104
104
 
105
105
  /** The script as the editor has it: the user's, from the one the page gave last. */
106
106
  let value = $state(untrack(() => source));
107
- /** How many scripts the page loaded: the parameters' fields are made again for each. */
107
+ /**
108
+ * How many scripts the page loaded: the parameters' fields are made again for each, and the
109
+ * view frames each one's model whole (another subject), where an edit's keeps the camera.
110
+ */
108
111
  let loads = $state(0);
109
112
  let editor = $state(/** @type {EditorClass | null} */ (null));
110
113
  /** `check`'s findings of the script as it is, none while it changed since. */
@@ -153,7 +156,8 @@
153
156
 
154
157
  /**
155
158
  * Puts `script` in the editor in place of the one there (the editor's undo takes that back),
156
- * and runs it at once on its own values: none the panel set for the last.
159
+ * and runs it at once on its own values (none the panel set for the last), its model framed
160
+ * whole.
157
161
  * @param {string} script another the page gives: an example, a script it opened
158
162
  */
159
163
  export function load(script) {
@@ -225,6 +229,7 @@
225
229
  <div class="model">
226
230
  <ViewerPane
227
231
  model={ran?.preview.model ?? null}
232
+ subject="script {loads}"
228
233
  options={viewerOptions}
229
234
  bind:panel={() => panelOpen, (open) => settings.set(KEYS.panelOpen, open)}
230
235
  {status}
@@ -348,26 +353,35 @@
348
353
  background: var(--kc-bg);
349
354
  }
350
355
  /* A narrow page: the script over the model, the parameters under it */
356
+ /* Narrow, the panes stacked, each at a height of its own, and the playground scrolled: the
357
+ script a few lines, the model 4:3 of its width (at most 32em), the console and the
358
+ parameters as tall as their lines */
351
359
  @media (max-width: 800px) {
352
360
  .kc-playground {
353
361
  flex-direction: column;
362
+ overflow-y: auto;
354
363
  }
355
364
  /* Stacked, each the page's width: the columns' bars have nothing to resize */
356
365
  .kc-playground > :global(.kc-splitter.columns) {
357
366
  display: none;
358
367
  }
359
368
  .code {
360
- flex-basis: 40%;
369
+ flex: none;
361
370
  width: auto;
371
+ height: 20em;
362
372
  border-right: none;
363
373
  border-bottom: 1px solid var(--kc-border);
364
374
  }
365
- .view {
366
- flex-basis: 60%;
367
- min-height: 20em;
375
+ .view,
376
+ .model {
377
+ flex: none;
378
+ }
379
+ .model {
380
+ --kc-model-min-height: min(75cqw, 32em);
368
381
  }
369
382
  .params {
370
383
  width: auto;
384
+ overflow: visible;
371
385
  border-left: none;
372
386
  border-top: 1px solid var(--kc-border);
373
387
  }