@field/cascade 0.5.2 → 0.7.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/dist/assets/{CodeEditor-BHej8kM9.js → CodeEditor-DkpxJFRs.js} +7 -7
  3. package/dist/assets/{CodePanel-CT3eirK8.js → CodePanel-O31InnQg.js} +2 -2
  4. package/dist/assets/{CustomNodeDialog-BG0m7_Rv.js → CustomNodeDialog-Cn3sT-M2.js} +1 -1
  5. package/dist/assets/{ProjectSettings-BxoLWJG6.js → ProjectSettings-BzEmtsYc.js} +2 -2
  6. package/dist/assets/{SettingsDialog-r9PzZ22z.js → SettingsDialog-zWct7T8j.js} +1 -1
  7. package/dist/assets/{VersionHistoryDialog-B6zUV6Dy.js → VersionHistoryDialog-DCe6XQcO.js} +1 -1
  8. package/dist/assets/{core-wwx5881P.js → core-DwPLRUzm.js} +2 -2
  9. package/dist/assets/{cssMode-DY5T2Or0.js → cssMode-C1bjAPYj.js} +1 -1
  10. package/dist/assets/definitions-Dh-oZAA5.js +1 -0
  11. package/dist/assets/{editor.api-mkORHEMm.js → editor.api-wr5lElMs.js} +1 -1
  12. package/dist/assets/{freemarker2-CIWlk0sw.js → freemarker2-DQHTaSDb.js} +1 -1
  13. package/dist/assets/geo-DLRNQg57.js +1 -0
  14. package/dist/assets/{handlebars-t4jbj3Br.js → handlebars-DOiZYGbp.js} +1 -1
  15. package/dist/assets/{html-Ctx7UOlY.js → html-B1u4CWMY.js} +1 -1
  16. package/dist/assets/{htmlMode-BKNZxVw7.js → htmlMode-YNKJ8Hq1.js} +1 -1
  17. package/dist/assets/{image-BCBFz0gD.js → image-DmeeS7Tl.js} +3 -3
  18. package/dist/assets/{index-CeqTfMbr.js → index-C35beBgj.js} +36 -36
  19. package/dist/assets/{javascript-Da_TJBzH.js → javascript-DVujl3OI.js} +1 -1
  20. package/dist/assets/{jsonMode-Ftt5d1nV.js → jsonMode-Bp_Ujoae.js} +1 -1
  21. package/dist/assets/{liquid-D5kWYG57.js → liquid-C0wcDX3X.js} +1 -1
  22. package/dist/assets/{lspLanguageFeatures-B-93LC_L.js → lspLanguageFeatures-C2XtKL_c.js} +1 -1
  23. package/dist/assets/math-D0hLbnR2.js +1 -0
  24. package/dist/assets/{mdx-DGT3C_qs.js → mdx-Dz4Hb1ZN.js} +1 -1
  25. package/dist/assets/pop-OaOoEUwk.js +1 -0
  26. package/dist/assets/{python-Bz3Eew5S.js → python-Y4eTKlAp.js} +1 -1
  27. package/dist/assets/{razor-CFDdKpKI.js → razor-BmpH_QN_.js} +1 -1
  28. package/dist/assets/{tsMode-BaCINWBI.js → tsMode-mOQwydYU.js} +1 -1
  29. package/dist/assets/{typescript-BoOWspVs.js → typescript-8ItD7azm.js} +1 -1
  30. package/dist/assets/{workers-dSWyDxsQ.js → workers-xhda_-L2.js} +1 -1
  31. package/dist/assets/{xml-eFi1_vYt.js → xml-ydyZSquM.js} +1 -1
  32. package/dist/assets/{yaml-a7xrJHxm.js → yaml-BQjpTmW5.js} +1 -1
  33. package/dist/cli/index.js +11259 -19155
  34. package/dist/index.html +1 -1
  35. package/dist/runtime/builtins/geo/definitions.d.ts +153 -0
  36. package/dist/runtime/builtins/geo/definitions.js +75 -0
  37. package/dist/runtime/builtins/geo/index.d.ts +3 -1
  38. package/dist/runtime/builtins/geo/index.js +4 -1
  39. package/dist/runtime/builtins/index.js +2 -0
  40. package/dist/runtime/builtins/math/definitions.d.ts +845 -0
  41. package/dist/runtime/builtins/math/definitions.js +285 -0
  42. package/dist/runtime/builtins/math/index.d.ts +2 -0
  43. package/dist/runtime/builtins/math/index.js +2 -0
  44. package/dist/runtime/geometry/index.d.ts +1 -0
  45. package/dist/runtime/geometry/index.js +1 -0
  46. package/dist/runtime/geometry/rects.d.ts +88 -0
  47. package/dist/runtime/geometry/rects.js +68 -0
  48. package/doc/NODE_REFERENCE.md +141 -1
  49. package/package.json +1 -1
  50. package/dist/assets/definitions-BgCvRHyR.js +0 -1
  51. package/dist/assets/geo-CIxgs0oE.js +0 -1
  52. package/dist/assets/pop-BJGN5Ac4.js +0 -1
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Cascade</title>
7
- <script type="module" crossorigin src="/assets/index-CeqTfMbr.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-C35beBgj.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/legacy-CAj2_7QE.js">
9
9
  <link rel="modulepreload" crossorigin href="/assets/index-client-BoJgsN9M.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/nodeTypeUtils-BDJsc2Ks.js">
@@ -1,3 +1,4 @@
1
+ import type { NodeExecutionContext } from "@field/cascade/contracts";
1
2
  export declare const rectangleDefinition: {
2
3
  readonly apiVersion: 1;
3
4
  readonly label: "Rectangle";
@@ -387,6 +388,116 @@ export declare const renderDefinition: {
387
388
  };
388
389
  };
389
390
  };
391
+ /**
392
+ * `cascade.geo.FromRects` — the conversion, as a node.
393
+ *
394
+ * Named for what it does rather than for Houdini, which has no equivalent:
395
+ * `Rects` would read as a node that *produces* them, and `Convert` would be a
396
+ * general node with one mode in it.
397
+ *
398
+ * The whole point is that this is the only place `rects` is understood.
399
+ * `SvgExport`, `Render` and the viewport keep taking `geometry` and learn
400
+ * nothing — which is the argument MW-OBSERVATORY-ART made as owner of the
401
+ * consuming code, against adding a second input to the exporter.
402
+ *
403
+ * There is deliberately **no implicit `rects` → `geometry` conversion** in the
404
+ * type table. It would let a rects output wire straight into a geometry input,
405
+ * and the flip below would then happen invisibly or not at all — a picture
406
+ * silently mirrored is exactly the failure this node's `origin` prop exists to
407
+ * make a decision.
408
+ */
409
+ export declare const fromRectsDefinition: {
410
+ readonly apiVersion: 1;
411
+ readonly label: "From Rects";
412
+ readonly description: "Convert rects into geometry, one closed polygon each, keeping the tag.";
413
+ readonly icon: "Frame";
414
+ readonly runsOn: "portable";
415
+ readonly inputs: {
416
+ readonly rects: {
417
+ readonly kind: "data";
418
+ readonly type: "rects";
419
+ };
420
+ /** The frame the rects were measured against, for the flip. */
421
+ readonly height: {
422
+ readonly kind: "data";
423
+ readonly type: "float";
424
+ readonly default: 0;
425
+ readonly min: 0;
426
+ readonly description: "Image height, for Top Left. Zero means no flip.";
427
+ };
428
+ };
429
+ readonly outputs: {
430
+ readonly geometry: {
431
+ readonly kind: "data";
432
+ readonly type: "geometry";
433
+ };
434
+ };
435
+ readonly props: {
436
+ readonly origin: {
437
+ readonly type: "string";
438
+ readonly default: "top-left";
439
+ readonly control: "select";
440
+ readonly options: readonly [{
441
+ readonly value: "top-left";
442
+ readonly label: "Top Left - raster, needs a height";
443
+ }, {
444
+ readonly value: "bottom-left";
445
+ readonly label: "Bottom Left - already +Y up";
446
+ }];
447
+ readonly label: "Origin";
448
+ readonly description: "Where y is measured from. Raster rects need flipping or the SVG comes out mirrored.";
449
+ };
450
+ };
451
+ };
452
+ export declare function executeFromRects(context: NodeExecutionContext<typeof fromRectsDefinition>): void;
453
+ export declare const fromRectsRegistration: {
454
+ kind: "definition-v1";
455
+ moduleId: string;
456
+ definition: {
457
+ readonly apiVersion: 1;
458
+ readonly label: "From Rects";
459
+ readonly description: "Convert rects into geometry, one closed polygon each, keeping the tag.";
460
+ readonly icon: "Frame";
461
+ readonly runsOn: "portable";
462
+ readonly inputs: {
463
+ readonly rects: {
464
+ readonly kind: "data";
465
+ readonly type: "rects";
466
+ };
467
+ /** The frame the rects were measured against, for the flip. */
468
+ readonly height: {
469
+ readonly kind: "data";
470
+ readonly type: "float";
471
+ readonly default: 0;
472
+ readonly min: 0;
473
+ readonly description: "Image height, for Top Left. Zero means no flip.";
474
+ };
475
+ };
476
+ readonly outputs: {
477
+ readonly geometry: {
478
+ readonly kind: "data";
479
+ readonly type: "geometry";
480
+ };
481
+ };
482
+ readonly props: {
483
+ readonly origin: {
484
+ readonly type: "string";
485
+ readonly default: "top-left";
486
+ readonly control: "select";
487
+ readonly options: readonly [{
488
+ readonly value: "top-left";
489
+ readonly label: "Top Left - raster, needs a height";
490
+ }, {
491
+ readonly value: "bottom-left";
492
+ readonly label: "Bottom Left - already +Y up";
493
+ }];
494
+ readonly label: "Origin";
495
+ readonly description: "Where y is measured from. Raster rects need flipping or the SVG comes out mirrored.";
496
+ };
497
+ };
498
+ };
499
+ loadExecute: () => Promise<typeof executeFromRects>;
500
+ };
390
501
  export declare const geoNodeDefinitions: readonly [readonly ["cascade.geo.Rectangle", {
391
502
  readonly apiVersion: 1;
392
503
  readonly label: "Rectangle";
@@ -769,5 +880,47 @@ export declare const geoNodeDefinitions: readonly [readonly ["cascade.geo.Rectan
769
880
  readonly step: 0.1;
770
881
  };
771
882
  };
883
+ }], readonly ["cascade.geo.FromRects", {
884
+ readonly apiVersion: 1;
885
+ readonly label: "From Rects";
886
+ readonly description: "Convert rects into geometry, one closed polygon each, keeping the tag.";
887
+ readonly icon: "Frame";
888
+ readonly runsOn: "portable";
889
+ readonly inputs: {
890
+ readonly rects: {
891
+ readonly kind: "data";
892
+ readonly type: "rects";
893
+ };
894
+ /** The frame the rects were measured against, for the flip. */
895
+ readonly height: {
896
+ readonly kind: "data";
897
+ readonly type: "float";
898
+ readonly default: 0;
899
+ readonly min: 0;
900
+ readonly description: "Image height, for Top Left. Zero means no flip.";
901
+ };
902
+ };
903
+ readonly outputs: {
904
+ readonly geometry: {
905
+ readonly kind: "data";
906
+ readonly type: "geometry";
907
+ };
908
+ };
909
+ readonly props: {
910
+ readonly origin: {
911
+ readonly type: "string";
912
+ readonly default: "top-left";
913
+ readonly control: "select";
914
+ readonly options: readonly [{
915
+ readonly value: "top-left";
916
+ readonly label: "Top Left - raster, needs a height";
917
+ }, {
918
+ readonly value: "bottom-left";
919
+ readonly label: "Bottom Left - already +Y up";
920
+ }];
921
+ readonly label: "Origin";
922
+ readonly description: "Where y is measured from. Raster rects need flipping or the SVG comes out mirrored.";
923
+ };
924
+ };
772
925
  }]];
773
926
  //# sourceMappingURL=definitions.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { rectsToGeometry } from "../../geometry/rects.js";
1
2
  export const rectangleDefinition = {
2
3
  apiVersion: 1,
3
4
  label: "Rectangle",
@@ -240,6 +241,79 @@ export const renderDefinition = {
240
241
  pointRadius: { type: "float", default: 1.5, min: 0, max: 50, step: 0.1 },
241
242
  },
242
243
  };
244
+ /**
245
+ * `cascade.geo.FromRects` — the conversion, as a node.
246
+ *
247
+ * Named for what it does rather than for Houdini, which has no equivalent:
248
+ * `Rects` would read as a node that *produces* them, and `Convert` would be a
249
+ * general node with one mode in it.
250
+ *
251
+ * The whole point is that this is the only place `rects` is understood.
252
+ * `SvgExport`, `Render` and the viewport keep taking `geometry` and learn
253
+ * nothing — which is the argument MW-OBSERVATORY-ART made as owner of the
254
+ * consuming code, against adding a second input to the exporter.
255
+ *
256
+ * There is deliberately **no implicit `rects` → `geometry` conversion** in the
257
+ * type table. It would let a rects output wire straight into a geometry input,
258
+ * and the flip below would then happen invisibly or not at all — a picture
259
+ * silently mirrored is exactly the failure this node's `origin` prop exists to
260
+ * make a decision.
261
+ */
262
+ export const fromRectsDefinition = {
263
+ apiVersion: 1,
264
+ label: "From Rects",
265
+ description: "Convert rects into geometry, one closed polygon each, keeping the tag.",
266
+ icon: "Frame",
267
+ runsOn: "portable",
268
+ inputs: {
269
+ rects: { kind: "data", type: "rects" },
270
+ /** The frame the rects were measured against, for the flip. */
271
+ height: {
272
+ kind: "data",
273
+ type: "float",
274
+ default: 0,
275
+ min: 0,
276
+ description: "Image height, for Top Left. Zero means no flip.",
277
+ },
278
+ },
279
+ outputs: { geometry: { kind: "data", type: "geometry" } },
280
+ props: {
281
+ origin: {
282
+ type: "string",
283
+ default: "top-left",
284
+ control: "select",
285
+ options: [
286
+ { value: "top-left", label: "Top Left - raster, needs a height" },
287
+ { value: "bottom-left", label: "Bottom Left - already +Y up" },
288
+ ],
289
+ label: "Origin",
290
+ description: "Where y is measured from. Raster rects need flipping or the SVG comes out mirrored.",
291
+ },
292
+ },
293
+ };
294
+ export function executeFromRects(context) {
295
+ const incoming = context.inputs.rects;
296
+ const origin = context.props.origin === "bottom-left" ? "bottom-left" : "top-left";
297
+ const height = context.inputs.height ?? 0;
298
+ // A raster conversion with no height is the one mistake worth refusing: it
299
+ // produces a mirrored picture that looks plausible, and a silently upside
300
+ // down poster is harder to notice than a red node.
301
+ if (origin === "top-left" && height <= 0 && rectCount(incoming) > 0)
302
+ throw new Error("cascade.geo.FromRects needs the image height to flip raster rects — wire it, or set Origin to Bottom Left if the rects are already +Y up");
303
+ context.outputs.geometry.set(rectsToGeometry(incoming, { origin, height }));
304
+ }
305
+ function rectCount(value) {
306
+ if (Array.isArray(value))
307
+ return value.length;
308
+ const rects = value?.rects;
309
+ return Array.isArray(rects) ? rects.length : 0;
310
+ }
311
+ export const fromRectsRegistration = {
312
+ kind: "definition-v1",
313
+ moduleId: "cascade.geo.FromRects",
314
+ definition: fromRectsDefinition,
315
+ loadExecute: async () => executeFromRects,
316
+ };
243
317
  export const geoNodeDefinitions = Object.freeze([
244
318
  ["cascade.geo.Rectangle", rectangleDefinition],
245
319
  ["cascade.geo.Circle", circleDefinition],
@@ -248,5 +322,6 @@ export const geoNodeDefinitions = Object.freeze([
248
322
  ["cascade.geo.CopyToPoints", copyToPointsDefinition],
249
323
  ["cascade.geo.SvgExport", svgExportDefinition],
250
324
  ["cascade.geo.Render", renderDefinition],
325
+ ["cascade.geo.FromRects", fromRectsDefinition],
251
326
  ]);
252
327
  //# sourceMappingURL=definitions.js.map
@@ -1,5 +1,7 @@
1
1
  import type { DefinitionNodeRegistration } from "../../types.js";
2
2
  import { copyToPointsRegistration } from "./copyToPoints.js";
3
+ import { fromRectsRegistration } from "./definitions.js";
4
+ export { executeFromRects, fromRectsDefinition } from "./definitions.js";
3
5
  import { circleRegistration, rectangleRegistration } from "./generators.js";
4
6
  import { mergeRegistration } from "./merge.js";
5
7
  import { renderRegistration } from "./render.js";
@@ -17,7 +19,7 @@ import { transformRegistration } from "./transform.js";
17
19
  *
18
20
  * The namespace lives in `namespace.ts`, once.
19
21
  */
20
- export { circleRegistration, copyToPointsRegistration, mergeRegistration, rectangleRegistration, renderRegistration, svgExportRegistration, transformRegistration, };
22
+ export { circleRegistration, fromRectsRegistration, copyToPointsRegistration, mergeRegistration, rectangleRegistration, renderRegistration, svgExportRegistration, transformRegistration, };
21
23
  export { GEO_NAMESPACE, geoModuleId } from "./namespace.js";
22
24
  export declare const geoNodeRegistrations: readonly DefinitionNodeRegistration[];
23
25
  export declare function geoNodeRegistration(moduleId: string): DefinitionNodeRegistration | undefined;
@@ -1,4 +1,6 @@
1
1
  import { copyToPointsRegistration } from "./copyToPoints.js";
2
+ import { fromRectsRegistration } from "./definitions.js";
3
+ export { executeFromRects, fromRectsDefinition } from "./definitions.js";
2
4
  import { circleRegistration, rectangleRegistration } from "./generators.js";
3
5
  import { mergeRegistration } from "./merge.js";
4
6
  import { renderRegistration } from "./render.js";
@@ -16,7 +18,7 @@ import { transformRegistration } from "./transform.js";
16
18
  *
17
19
  * The namespace lives in `namespace.ts`, once.
18
20
  */
19
- export { circleRegistration, copyToPointsRegistration, mergeRegistration, rectangleRegistration, renderRegistration, svgExportRegistration, transformRegistration, };
21
+ export { circleRegistration, fromRectsRegistration, copyToPointsRegistration, mergeRegistration, rectangleRegistration, renderRegistration, svgExportRegistration, transformRegistration, };
20
22
  export { GEO_NAMESPACE, geoModuleId } from "./namespace.js";
21
23
  export const geoNodeRegistrations = Object.freeze([
22
24
  rectangleRegistration,
@@ -26,6 +28,7 @@ export const geoNodeRegistrations = Object.freeze([
26
28
  copyToPointsRegistration,
27
29
  renderRegistration,
28
30
  svgExportRegistration,
31
+ fromRectsRegistration,
29
32
  ]);
30
33
  const registrationsById = new Map(geoNodeRegistrations.map((registration) => [
31
34
  registration.moduleId,
@@ -1,5 +1,6 @@
1
1
  import { coreNodeRegistrations } from "./core/index.js";
2
2
  import { geoNodeRegistrations } from "./geo/index.js";
3
+ import { mathNodeRegistrations } from "./math/index.js";
3
4
  import { popNodeRegistrations } from "./pop/index.js";
4
5
  import { sceneNodeRegistrations } from "./scene/index.js";
5
6
  /**
@@ -13,6 +14,7 @@ import { sceneNodeRegistrations } from "./scene/index.js";
13
14
  export const builtinNodeRegistrations = Object.freeze([
14
15
  ...coreNodeRegistrations,
15
16
  ...geoNodeRegistrations,
17
+ ...mathNodeRegistrations,
16
18
  ...popNodeRegistrations,
17
19
  ...sceneNodeRegistrations,
18
20
  ]);