@glissade/scene 0.24.0 → 0.25.0-pre.0

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/dist/describe.js CHANGED
@@ -22,7 +22,7 @@ import { easings, listValueTypes } from "@glissade/core";
22
22
  * never pulled onto the base embed path — a scene that never calls `describe()`
23
23
  * pays zero bytes for it.
24
24
  */
25
- const RAW_VERSION = "0.24.0";
25
+ const RAW_VERSION = "0.25.0-pre.0";
26
26
  const PACKAGE_VERSION = RAW_VERSION.includes("GLISSADE_".concat("VERSION")) ? "0.0.0-dev" : RAW_VERSION;
27
27
  /** Arity of a value type's numeric repr: vec2/vec2-arc → 2, number → 1; others (color/paint/path/string/boolean) carry no scalar arity. */
28
28
  function arityOf(type) {
@@ -30,9 +30,21 @@ interface ApiExample {
30
30
  run: () => void;
31
31
  }
32
32
  declare const EXAMPLES: readonly ApiExample[];
33
- /** Group the corpus by describe-key → the surfaced code snippets. */
34
- declare function examplesByKey(): {
33
+ /**
34
+ * Rewrite an npm `import`-form snippet to the no-build IIFE form: every export is
35
+ * `window.glissade.<name>`, so `import { Rect, timeline } from '@glissade/scene'`
36
+ * becomes `const { Rect, timeline } = window.glissade`. The body is unchanged, so
37
+ * the snippet runs verbatim in a no-build `<script src>` page (§0.24 follow-up,
38
+ * card 7eC7Pb4wTbHj). Derived from the single npm-form source — no duplicate to
39
+ * maintain.
40
+ */
41
+ declare function toIifeForm(code: string): string;
42
+ /** Group the corpus by describe-key → the surfaced code snippets. `iife: true`
43
+ * rewrites each snippet to the no-build `window.glissade` form. */
44
+ declare function examplesByKey(opts?: {
45
+ iife?: boolean;
46
+ }): {
35
47
  readonly [key: string]: readonly string[];
36
48
  };
37
49
  //#endregion
38
- export { ApiExample, EXAMPLES, examplesByKey };
50
+ export { ApiExample, EXAMPLES, examplesByKey, toIifeForm };
package/dist/examples.js CHANGED
@@ -206,12 +206,24 @@ const EXAMPLES = [
206
206
  run: () => void motionPath(pathFromSvg("M0 0 C50 0 50 100 100 100")).atProgress(.5)
207
207
  }
208
208
  ];
209
- /** Group the corpus by describe-key → the surfaced code snippets. */
210
- function examplesByKey() {
209
+ /**
210
+ * Rewrite an npm `import`-form snippet to the no-build IIFE form: every export is
211
+ * `window.glissade.<name>`, so `import { Rect, timeline } from '@glissade/scene'`
212
+ * becomes `const { Rect, timeline } = window.glissade`. The body is unchanged, so
213
+ * the snippet runs verbatim in a no-build `<script src>` page (§0.24 follow-up,
214
+ * card 7eC7Pb4wTbHj). Derived from the single npm-form source — no duplicate to
215
+ * maintain.
216
+ */
217
+ function toIifeForm(code) {
218
+ return code.replace(/import\s+\{([^}]*)\}\s+from\s+'[^']*';?/g, (_m, names) => `const {${names}} = window.glissade;`);
219
+ }
220
+ /** Group the corpus by describe-key → the surfaced code snippets. `iife: true`
221
+ * rewrites each snippet to the no-build `window.glissade` form. */
222
+ function examplesByKey(opts = {}) {
211
223
  const byKey = {};
212
- for (const ex of EXAMPLES) (byKey[ex.key] ??= []).push(ex.code);
224
+ for (const ex of EXAMPLES) (byKey[ex.key] ??= []).push(opts.iife ? toIifeForm(ex.code) : ex.code);
213
225
  return byKey;
214
226
  }
215
227
  registerExamples(examplesByKey());
216
228
  //#endregion
217
- export { EXAMPLES, examplesByKey };
229
+ export { EXAMPLES, examplesByKey, toIifeForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/scene",
3
- "version": "0.24.0",
3
+ "version": "0.25.0-pre.0",
4
4
  "description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -65,7 +65,7 @@
65
65
  ],
66
66
  "dependencies": {
67
67
  "yoga-layout": "^3.2.1",
68
- "@glissade/core": "0.24.0"
68
+ "@glissade/core": "0.25.0-pre.0"
69
69
  },
70
70
  "repository": {
71
71
  "type": "git",