@things-factory/figure-ui 10.1.71 → 10.1.73

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 (44) hide show
  1. package/client/modeller/figure-v3-links.ts +12 -5
  2. package/client/modeller/figure-v3-parts.ts +1 -0
  3. package/client/modeller/figure-v3-properties.ts +3 -2
  4. package/client/modeller/figure-v3-recipe-catalog.ts +22 -4
  5. package/client/modeller/v3-editor.ts +1 -1
  6. package/client/modeller/v3-figure-facts.ts +26 -2
  7. package/client/modeller/v3-links.ts +50 -0
  8. package/client/modeller/v3-recipes.ts +16 -1
  9. package/dist-client/modeller/figure-v3-links.js +9 -3
  10. package/dist-client/modeller/figure-v3-links.js.map +1 -1
  11. package/dist-client/modeller/figure-v3-parts.js +1 -0
  12. package/dist-client/modeller/figure-v3-parts.js.map +1 -1
  13. package/dist-client/modeller/figure-v3-properties.js +3 -2
  14. package/dist-client/modeller/figure-v3-properties.js.map +1 -1
  15. package/dist-client/modeller/figure-v3-recipe-catalog.d.ts +2 -0
  16. package/dist-client/modeller/figure-v3-recipe-catalog.js +21 -4
  17. package/dist-client/modeller/figure-v3-recipe-catalog.js.map +1 -1
  18. package/dist-client/modeller/v3-editor.js +1 -1
  19. package/dist-client/modeller/v3-editor.js.map +1 -1
  20. package/dist-client/modeller/v3-figure-facts.d.ts +9 -0
  21. package/dist-client/modeller/v3-figure-facts.js +23 -2
  22. package/dist-client/modeller/v3-figure-facts.js.map +1 -1
  23. package/dist-client/modeller/v3-links.d.ts +17 -0
  24. package/dist-client/modeller/v3-links.js +38 -0
  25. package/dist-client/modeller/v3-links.js.map +1 -1
  26. package/dist-client/modeller/v3-recipes.js +21 -1
  27. package/dist-client/modeller/v3-recipes.js.map +1 -1
  28. package/dist-client/route.d.ts +1 -1
  29. package/dist-client/tsconfig.fui.tsbuildinfo +1 -1
  30. package/dist-client/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +4 -4
  32. package/test/browser/build.mjs +12 -0
  33. package/test/browser/modeller-page.js +28 -2
  34. package/test/browser/modeller.check.mjs +47 -5
  35. package/test/browser/serve.mjs +7 -1
  36. package/test/v3-fields.test.ts +2 -1
  37. package/test/v3-links.test.ts +25 -0
  38. package/test/v3-properties.test.ts +13 -0
  39. package/test/v3-recipes.test.ts +13 -1
  40. package/translations/en.json +5 -2
  41. package/translations/ja.json +4 -1
  42. package/translations/ko.json +5 -2
  43. package/translations/ms.json +4 -1
  44. package/translations/zh.json +4 -1
@@ -1,4 +1,4 @@
1
- import { parseV3Asset } from '@hatiolab/figure-model';
1
+ import { compileV3Asset, parseV3Asset, v3OccupiedBoxesOf, v3WritersOf } from '@hatiolab/figure-model';
2
2
  /**
3
3
  * The asset's own facts, as the properties tab shows them.
4
4
  *
@@ -16,9 +16,30 @@ export function v3FigureFacts(source) {
16
16
  parts,
17
17
  declared: !!asset.occupancy,
18
18
  placement: asset.occupancy?.placement,
19
- mounting: found ? { part: found[1], face: found[2] } : undefined
19
+ mounting: found ? { part: found[1], face: found[2] } : undefined,
20
+ suggested: suggestedMountOf(asset, parts)
20
21
  };
21
22
  }
23
+ function suggestedMountOf(asset, parts) {
24
+ const placement = (asset.occupancy?.placement ?? 'floor');
25
+ if (placement === 'center' || !parts.length)
26
+ return undefined;
27
+ let boxes;
28
+ try {
29
+ boxes = v3OccupiedBoxesOf(compileV3Asset(asset).evaluate().geometry, v3WritersOf(asset)).filter(b => parts.includes(b.part));
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ const [axis, face, sign] = placement === 'wall' ? ['z', 'back', -1] : placement === 'ceiling' ? ['y', 'top', 1] : ['y', 'bottom', -1];
35
+ /* The side of each box that faces the plane; the one furthest toward it, the first in the list among equals. */
36
+ const reach = (b) => sign * (b.centre[axis] + (sign * b.extent[axis]) / 2);
37
+ let best;
38
+ for (const b of boxes)
39
+ if (!best || reach(b) > reach(best) + 1e-6)
40
+ best = b;
41
+ return best ? { part: best.part, face } : undefined;
42
+ }
22
43
  /**
23
44
  * A tag line as a list: split on commas, drop a leading `#`, keep each once. An empty
24
45
  * line is an empty list, so an author can clear every tag.
@@ -1 +1 @@
1
- {"version":3,"file":"v3-figure-facts.js","sourceRoot":"","sources":["../../client/modeller/v3-figure-facts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAkBrD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAoF,CAAA;IACrH,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACnG,MAAM,OAAO,GAAI,KAAK,CAAC,SAAS,EAAE,OAA0D,EAAE,OAAO,EAAE,OAAO,CAAA;IAC9G,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC,0DAA0D,CAAC,CAAA;IACxF,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK;QACL,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS;QAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAkC;QAC9D,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAW,EAAE,CAAC,CAAC,CAAC,SAAS;KAC3E,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO;QACL,GAAG,IAAI,GAAG,CACR,GAAG;aACA,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;aAChD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CACjC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { parseV3Asset } from '@hatiolab/figure-model'\nimport type { V3Asset, V3Face } from '@hatiolab/figure-model'\n\n/*\n * What the V3 properties tab reads, kept apart from the element so it can be tested without a browser.\n */\n\nexport type Placement = 'floor' | 'ceiling' | 'center' | 'wall'\n\n/** What the properties tab reads off the asset. Absent parts of the asset read as absent, never as a default. */\nexport interface V3FigureFacts {\n name: string\n parts: string[]\n declared: boolean\n placement?: Placement\n mounting?: { part: string; face: V3Face }\n}\n\n/**\n * The asset's own facts, as the properties tab shows them.\n *\n * The mounting face is read back from the feature `set-mounting-face` writes (`<part>.mount.<face>`): the asset\n * records the face only as that node, so this is where the screen learns which one is chosen. Parts are the placed\n * bodies (`place@1`), in the order the model lists them.\n */\nexport function v3FigureFacts(source: string): V3FigureFacts {\n const asset = parseV3Asset(source) as V3Asset & { document: { model: { nodes: Array<{ id: string; op: string }> } } }\n const parts = asset.document.model.nodes.filter(node => node.op === 'place@1').map(node => node.id)\n const feature = (asset.occupancy?.contact as { surface?: { feature?: string } } | undefined)?.surface?.feature\n const found = feature?.match(/^(.+)\\.mount\\.(left|right|bottom|top|back|front)\\.value$/)\n return {\n name: asset.name,\n parts,\n declared: !!asset.occupancy,\n placement: asset.occupancy?.placement as Placement | undefined,\n mounting: found ? { part: found[1], face: found[2] as V3Face } : undefined\n }\n}\n\n/**\n * A tag line as a list: split on commas, drop a leading `#`, keep each once. An empty\n * line is an empty list, so an author can clear every tag.\n */\nexport function tagsOf(raw: string): string[] {\n return [\n ...new Set(\n raw\n .split(',')\n .map(one => one.trim().replace(/^#+/, '').trim())\n .filter(one => one.length > 0)\n )\n ]\n}\n"]}
1
+ {"version":3,"file":"v3-figure-facts.js","sour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GAAW;IAChC,OAAO;QACL,GAAG,IAAI,GAAG,CACR,GAAG;aACA,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;aAChD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CACjC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { compileV3Asset, parseV3Asset, v3OccupiedBoxesOf, v3WritersOf } from '@hatiolab/figure-model'\nimport type { V3Asset, V3Face } from '@hatiolab/figure-model'\n\n/*\n * What the V3 properties tab reads, kept apart from the element so it can be tested without a browser.\n */\n\nexport type Placement = 'floor' | 'ceiling' | 'center' | 'wall'\n\n/** What the properties tab reads off the asset. Absent parts of the asset read as absent, never as a default. */\nexport interface V3FigureFacts {\n name: string\n parts: string[]\n declared: boolean\n placement?: Placement\n mounting?: { part: string; face: V3Face }\n /**\n * Where the figure meets its plane, as its parts stand: the part whose bottom is lowest for a floor, whose top is\n * highest for a ceiling, whose back is furthest back for a wall. What the mounting face is offered as before one is\n * chosen -- the first part in the list offered a conveyor's bed, 700 mm up on its legs (walk 1, 2026-09-26).\n */\n suggested?: { part: string; face: V3Face }\n}\n\n/**\n * The asset's own facts, as the properties tab shows them.\n *\n * The mounting face is read back from the feature `set-mounting-face` writes (`<part>.mount.<face>`): the asset\n * records the face only as that node, so this is where the screen learns which one is chosen. Parts are the placed\n * bodies (`place@1`), in the order the model lists them.\n */\nexport function v3FigureFacts(source: string): V3FigureFacts {\n const asset = parseV3Asset(source) as V3Asset & { document: { model: { nodes: Array<{ id: string; op: string }> } } }\n const parts = asset.document.model.nodes.filter(node => node.op === 'place@1').map(node => node.id)\n const feature = (asset.occupancy?.contact as { surface?: { feature?: string } } | undefined)?.surface?.feature\n const found = feature?.match(/^(.+)\\.mount\\.(left|right|bottom|top|back|front)\\.value$/)\n return {\n name: asset.name,\n parts,\n declared: !!asset.occupancy,\n placement: asset.occupancy?.placement as Placement | undefined,\n mounting: found ? { part: found[1], face: found[2] as V3Face } : undefined,\n suggested: suggestedMountOf(asset, parts)\n }\n}\n\nfunction suggestedMountOf(asset: V3Asset, parts: string[]): { part: string; face: V3Face } | undefined {\n const placement = (asset.occupancy?.placement ?? 'floor') as Placement\n if (placement === 'center' || !parts.length) return undefined\n let boxes\n try {\n boxes = v3OccupiedBoxesOf(compileV3Asset(asset).evaluate().geometry, v3WritersOf(asset)).filter(b => parts.includes(b.part))\n } catch {\n return undefined\n }\n const [axis, face, sign] = placement === 'wall' ? (['z', 'back', -1] as const) : placement === 'ceiling' ? (['y', 'top', 1] as const) : (['y', 'bottom', -1] as const)\n /* The side of each box that faces the plane; the one furthest toward it, the first in the list among equals. */\n const reach = (b: (typeof boxes)[number]) => sign * (b.centre[axis] + (sign * b.extent[axis]) / 2)\n let best: (typeof boxes)[number] | undefined\n for (const b of boxes) if (!best || reach(b) > reach(best) + 1e-6) best = b\n return best ? { part: best.part, face } : undefined\n}\n\n/**\n * A tag line as a list: split on commas, drop a leading `#`, keep each once. An empty\n * line is an empty list, so an author can clear every tag.\n */\nexport function tagsOf(raw: string): string[] {\n return [\n ...new Set(\n raw\n .split(',')\n .map(one => one.trim().replace(/^#+/, '').trim())\n .filter(one => one.length > 0)\n )\n ]\n}\n"]}
@@ -97,6 +97,23 @@ export declare function shownWhenOf(asset: V3Asset, part: string): {
97
97
  } | null;
98
98
  /** Whether `part` hangs from `from`, through any number of fastenings. */
99
99
  export declare function hangsFrom(asset: V3Asset, part: string, from: string): boolean;
100
+ /**
101
+ * The fastening a part has, as the fastening form holds it -- so the form opens on what is there (the face, including
102
+ * \`centre\`, the target and its face, the gap, the twist and where across the face) and a change is a change to that.
103
+ * Opening it on the defaults showed a roller fastened by its centre as fastened by its bottom, and fastening again
104
+ * from there broke its turning in place (walk 1, 2026-09-26). Null for a part fastened to nothing.
105
+ */
106
+ export declare function fasteningOf(asset: V3Asset, part: string): {
107
+ face: string;
108
+ toPlane: boolean;
109
+ target: string;
110
+ targetFace: string;
111
+ facing: 'meet' | 'flush';
112
+ gap: number;
113
+ twist: number;
114
+ align: Partial<Record<Axis, Alignment>>;
115
+ alignMm: Partial<Record<Axis, number>>;
116
+ } | null;
100
117
  /**
101
118
  * The alignment that keeps the part where it stands when it is fastened: on each axis across the face, its distance
102
119
  * from the target's centre (the plane's is the origin). Fastening used to centre it -- a door set 100 mm in front of
@@ -150,6 +150,44 @@ export function hangsFrom(asset, part, from) {
150
150
  }
151
151
  return false;
152
152
  }
153
+ /**
154
+ * The fastening a part has, as the fastening form holds it -- so the form opens on what is there (the face, including
155
+ * \`centre\`, the target and its face, the gap, the twist and where across the face) and a change is a change to that.
156
+ * Opening it on the defaults showed a roller fastened by its centre as fastened by its bottom, and fastening again
157
+ * from there broke its turning in place (walk 1, 2026-09-26). Null for a part fastened to nothing.
158
+ */
159
+ export function fasteningOf(asset, part) {
160
+ const record = asset.joints?.find(j => j.body1.part === part);
161
+ if (!record)
162
+ return null;
163
+ const toPlane = 'plane' in record.body0;
164
+ const target = 'part' in record.body0 ? record.body0.part : '';
165
+ const targetFace = 'part' in record.body0 ? record.body0.face : 'top';
166
+ const twist = record.origin?.twist ?? 0;
167
+ /* Where across the face: as the record says it, and where it says nothing, where the part stands now. */
168
+ const kept = placeKeptOf(asset, part, toPlane ? 'plane' : { part: target, face: targetFace }, !!twist);
169
+ for (const [axis, how] of Object.entries(record.origin?.align ?? {})) {
170
+ if (how === 'min' || how === 'max' || how === 'centre') {
171
+ kept.align[axis] = how;
172
+ delete kept.alignMm[axis];
173
+ }
174
+ else if (how && typeof how === 'object' && typeof how.mm === 'number') {
175
+ kept.align[axis] = 'mm';
176
+ kept.alignMm[axis] = how.mm;
177
+ }
178
+ }
179
+ const gap = record.origin?.gap;
180
+ return {
181
+ face: record.body1.face,
182
+ toPlane,
183
+ target,
184
+ targetFace,
185
+ facing: record.origin?.facing ?? 'meet',
186
+ gap: typeof gap === 'number' ? gap : 0,
187
+ twist,
188
+ ...kept
189
+ };
190
+ }
153
191
  /**
154
192
  * The alignment that keeps the part where it stands when it is fastened: on each axis across the face, its distance
155
193
  * from the target's centre (the plane's is the origin). Fastening used to centre it -- a door set 100 mm in front of
@@ -1 +1 @@
1
- {"version":3,"file":"v3-links.js","sourceRoot":"","sources":["../../client/modeller/v3-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AASzP,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAQpD,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CACjC,KAAK,CAAC,QAAQ,CAAC,KAA+K,CAAA;AAKhM;;;;GAIG;AACH,iHAAiH;AACjH,MAAM,UAAU,QAAQ,CAAC,KAAc,EAAE,IAAY,EAAE,IAAU;IAC/D,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACtC,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAAE,IAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;AAE9I,oHAAoH;AACpH,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,IAAY;IACrD,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAA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C,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;AACpH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import { V3_FACES, v3ShapeFaces, v3PartsExtentOf, compileV3Asset, compileV3Graph, v3FollowOf, proposeV3Proportion, defaultInstanceSizeRange, foldInstanceSizeRange, v3AttachmentsOf, v3BindingsOf, v3InstanceSizeLimitsOf } from '@hatiolab/figure-model'\nimport type { V3Follow, V3SizeRange } from '@hatiolab/figure-model'\nimport type { V3Asset, V3BindingPlace, V3Face, V3Joint } from '@hatiolab/figure-model'\n\n/*\n * What a V3 part is tied to — the readers behind the parts' size response, fastening and motion sections. Kept apart from the element so they can be tested without a browser.\n */\n\nexport type Axis = 'x' | 'y' | 'z'\nexport const AXES: readonly Axis[] = ['x', 'y', 'z']\n\ninterface Node {\n id: string\n op: string\n args: string[]\n outputs: Record<string, string>\n}\nconst modelOf = (asset: V3Asset) =>\n asset.document.model as unknown as { nodes: Node[]; inputs: Array<{ id: string; role?: string; unit?: string; min?: number; max?: number }>; constants: Array<{ id: string; value: number }> }\n\n/** What one dimension of a part is worked out from (figure-model's `V3Follow`). */\nexport type Follow = V3Follow\n\n/**\n * `link-dimension` routes a part's dimension through `<part>.dimension.<axis>` and points its first argument at the\n * source, directly or through the nodes that scale it. Walking back through those nodes finds the source: the\n * instance size (`size.<axis>`), another part's dimension (`<part>.dimension.<axis>.value`) or a declared input.\n */\n/** What one measure of a part is worked out from, read back from the graph (figure-model's reader, one copy). */\nexport function followOf(asset: V3Asset, part: string, axis: Axis): Follow {\n return v3FollowOf(asset, part, axis)\n}\n\n/** Whether the asset declares an instance size on an axis — only then can a dimension follow it. */\nexport const hasInstanceSize = (asset: V3Asset, axis: Axis) => modelOf(asset).inputs.some(i => i.id === `size.${axis}` && i.role === 'design')\n\n/** The part this one is fastened to, or `null`. The mounting plane counts as fastened (the model names no part). */\nexport function fastenedTo(asset: V3Asset, part: string): string | null {\n return v3AttachmentsOf(asset)[part] ?? null\n}\n\n/**\n * What holds a part: the part it is fastened to, the plane the figure is mounted on, or nothing. The joint record says\n * it; a part standing on the plane had read as fastened to nothing, so the form offered no way to move it and sent\n * no replace -- the fastening was refused as already made (the door's post, 2026-09-25).\n */\nexport function heldBy(asset: V3Asset, part: string): { part: string } | { plane: true } | null {\n const record = asset.joints?.find(j => j.body1.part === part)\n if (record) return 'plane' in record.body0 ? { plane: true } : { part: record.body0.part }\n const to = fastenedTo(asset, part)\n return to ? { part: to } : null\n}\n\n/** Whether a dimension of this part can follow something — box-shaped, whose three sizes are X, Y and Z. */\nexport function canFollow(asset: V3Asset, part: string): boolean {\n return followableAxes(asset, part).length > 0\n}\n\n/**\n * The axes whose size can follow something, by the shape's own measures: a box's X · Y · Z; a cylinder's radius (read\n * as X) and length (Y) -- its shape takes those two, so it has no Z of its own.\n */\nexport function followableAxes(asset: V3Asset, part: string): Axis[] {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n if (!shape) return []\n /* A door frame's first three measures are its width, height and depth, as a box's (figure-model portal-profile@2). */\n if (shape.op === 'box-shape@1' || shape.op === 'rounded-box@1' || shape.op === 'portal-profile@2' || shape.op === 'hollow-box@2') return [...AXES]\n if (shape.op === 'cylinder-shape@1') return ['x', 'y']\n return []\n}\n\n/** What a part's own measure on an axis is now (a box's side, a cylinder's radius or length), at the design as it stands. */\nexport function dimensionNow(asset: V3Asset, part: string, axis: Axis): number | undefined {\n const m = modelOf(asset)\n const ref = m.nodes.find(n => n.id === `${part}.shape`)?.args[AXES.indexOf(axis)]\n if (!ref) return undefined\n try {\n const values = compileV3Graph(asset.document.model as never).evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values as Record<string, number>\n const value = values[ref]\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * The flat faces a part's shape declares, by name -- figure-model's shape definitions are the one place they are\n * written (a portal's opening sides as well as its outer faces). A sphere has none.\n */\nexport function facesOf(asset: V3Asset, part: string): string[] {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n return Object.keys((shape && v3ShapeFaces(shape.op)) ?? {})\n}\n\n/** The axis a face of a part faces along, from the same definitions. */\nexport function faceAxisOf(asset: V3Asset, part: string, face: string): Axis | undefined {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n return (shape && v3ShapeFaces(shape.op)?.[face]?.axis) as Axis | undefined\n}\n\n/** Whether `attach` can take this part: any part whose shape has a flat face. */\nexport function canFasten(asset: V3Asset, part: string): boolean {\n return facesOf(asset, part).length > 0\n}\n\nconst OUTER: Record<Axis, [string, string]> = { x: ['left', 'right'], y: ['bottom', 'top'], z: ['back', 'front'] }\n\n/**\n * The axes a part can be made a row along (r3 §8, figure-model `make-repeat`): across the face it is fastened by, when\n * it is fastened fixed to another part and holds nothing. None for a part that is loose, moves, stands on the floor or\n * already repeats -- the command would refuse those, so they are not offered.\n */\nexport function rowAxesOf(asset: V3Asset, part: string): Axis[] {\n const joints = asset.joints ?? []\n const j = joints.find(o => o.body1.part === part)\n if (!j || j.type !== 'fixed' || j.repeat || !('part' in j.body0)) return []\n if (joints.some(o => 'part' in o.body0 && o.body0.part === part)) return []\n return AXES.filter(axis => axis !== V3_FACES[j.body1.face])\n}\n\n/** The row a part is made into, as its fastening's record keeps it. */\nexport const rowOf = (asset: V3Asset, part: string) => asset.joints?.find(o => o.body1.part === part)?.repeat\n\n/** Where a part sits across the face it is fastened to, on one axis: centred, level with an edge, or a distance off centre. */\n/** `share`: the distance as a share of the figure's size on that axis, so it keeps its place when the figure is resized. */\nexport type Alignment = 'centre' | 'min' | 'max' | 'mm' | 'share'\n\n/**\n * The axes across the face a part is fastened to — the two a fastening does not set by itself. Edges to line up with\n * are offered where both parts have their two outer faces on that axis; the plane the figure is mounted on has none,\n * so on it (X and Z) only centred or a distance is offered.\n */\n/**\n * The mounting plane of this figure, by its placement (ADR-0093): the floor or the ceiling is Y = 0 and a part stands\n * on it by its bottom or hangs from it by its top; a wall is Z = 0 and a part is fastened to it by its back.\n */\nexport function mountingPlaneOf(asset: V3Asset): { normal: Axis; faces: V3Face[] } {\n return asset.occupancy?.placement === 'wall' ? { normal: 'z', faces: ['back'] } : { normal: 'y', faces: ['bottom', 'top'] }\n}\n\nexport function alignAxesOf(asset: V3Asset, part: string, target: { part: string; face: string } | 'plane', twisted = false): { axis: Axis; edges: boolean }[] {\n /* The plane has no edges, but a figure that declares its size has sides on it (figure-model 0.1.64). */\n if (target === 'plane') {\n const { normal } = mountingPlaneOf(asset)\n return AXES.filter(axis => axis !== normal).map(axis => ({ axis, edges: !twisted && hasInstanceSize(asset, axis) }))\n }\n const along = faceAxisOf(asset, target.part, target.face)\n if (!along) return []\n const theirs = new Set(facesOf(asset, target.part)),\n mine = new Set(facesOf(asset, part))\n /* A part twisted about the face's normal has no side level with the target's edges. */\n return AXES.filter(axis => axis !== along).map(axis => ({ axis, edges: !twisted && OUTER[axis].every(f => theirs.has(f) && mine.has(f)) }))\n}\n\n/** The controls a part's showing can follow: the figure's state inputs, with their range and label. */\nexport function visibilityControlsOf(asset: V3Asset): Array<{ id: string; unit: string; min: number; max: number; label: string }> {\n const labels = (asset as unknown as { stateInputs?: Record<string, { label?: string }> }).stateInputs ?? {}\n return modelOf(asset)\n .inputs.filter(input => input.role === 'state')\n .map(input => ({ id: input.id, unit: input.unit ?? '', min: input.min ?? 0, max: input.max ?? 1, label: labels[input.id]?.label || input.id }))\n}\n\n/** When the part is drawn (figure-model `set-visibility`): always (null), or while a control is at least a value. */\nexport function shownWhenOf(asset: V3Asset, part: string): { input: string; atLeast: number } | null {\n const look = asset.appearance.find(one => one.target === part) as { visibility?: string } | undefined\n if (!look?.visibility) return null\n const m = modelOf(asset)\n const node = m.nodes.find(n => n.op === 'at-least@1' && Object.values(n.outputs).includes(look.visibility!))\n const at = node && m.constants.find(c => c.id === node.args[1])\n return node && at ? { input: node.args[0]!, atLeast: at.value } : null\n}\n\n/** Whether `part` hangs from `from`, through any number of fastenings. */\nexport function hangsFrom(asset: V3Asset, part: string, from: string): boolean {\n const seen = new Set<string>()\n for (let at: string | undefined = part; at && !seen.has(at); ) {\n seen.add(at)\n const j = ((asset.joints ?? []) as V3Joint[]).find(o => o.body1.part === at)\n at = j && 'part' in j.body0 ? (j.body0 as { part: string }).part : undefined\n if (at === from) return true\n }\n return false\n}\n\n/**\n * The alignment that keeps the part where it stands when it is fastened: on each axis across the face, its distance\n * from the target's centre (the plane's is the origin). Fastening used to centre it -- a door set 100 mm in front of\n * its frame slid into it (2026-09-26). Left centred where it already is, and where the target stands turned.\n */\nexport function placeKeptOf(\n asset: V3Asset,\n part: string,\n target: { part: string; face: string } | 'plane',\n twisted = false\n): { align: Partial<Record<Axis, Alignment>>; alignMm: Partial<Record<Axis, number>> } {\n const kept = { align: {} as Partial<Record<Axis, Alignment>>, alignMm: {} as Partial<Record<Axis, number>> }\n let geometry\n try {\n geometry = compileV3Asset(asset).evaluate().geometry as unknown as Array<{ id: string; pose?: { r: number[][]; t: number[] } }>\n } catch {\n return kept\n }\n const poseOf = (id: string) => geometry.find(g => g.id === id)?.pose\n const mine = poseOf(part)\n if (!mine) return kept\n let centre = [0, 0, 0]\n if (target !== 'plane') {\n const theirs = poseOf(target.part)\n const upright = theirs?.r.every((row, i) => row.every((v, j) => Math.abs(v - (i === j ? 1 : 0)) < 1e-9))\n if (!theirs || !upright) return kept\n centre = theirs.t\n }\n for (const { axis } of alignAxesOf(asset, part, target, twisted)) {\n const k = AXES.indexOf(axis)\n const off = Math.round((mine.t[k]! - centre[k]!) * 10) / 10\n if (Math.abs(off) < 0.5) continue\n kept.align[axis] = 'mm'\n kept.alignMm[axis] = off\n }\n return kept\n}\n\n/** The `align` of an attach command from the form's choices: only the axes across that face, and centred ones left out. */\nexport function alignOf(\n asset: V3Asset,\n part: string,\n target: { part: string; face: string } | 'plane',\n how: Partial<Record<Axis, Alignment>>,\n mm: Partial<Record<Axis, number>>,\n twisted = false\n) {\n const align: Partial<Record<Axis, 'min' | 'max' | { mm: number | { from: { of: 'instance'; axis: Axis }; times: number } }>> = {}\n for (const { axis, edges } of alignAxesOf(asset, part, target, twisted)) {\n const one = how[axis] ?? 'centre'\n const size = asset.designInputs[`size.${axis}`]\n if (one === 'share' && mm[axis] && hasInstanceSize(asset, axis) && size)\n align[axis] = { mm: { from: { of: 'instance', axis }, times: Math.round((mm[axis]! / size) * 1e6) / 1e6 } }\n else if (one === 'mm' && mm[axis]) align[axis] = { mm: mm[axis]! }\n else if ((one === 'min' || one === 'max') && edges) align[axis] = one\n }\n return Object.keys(align).length ? align : undefined\n}\n\n/**\n * The axes on which the part's position is worked out from other values rather than being its own number. `fix-position` makes one its own number where it is now.\n */\nexport function positionsWorkedOut(asset: V3Asset, part: string): Axis[] {\n const m = modelOf(asset)\n const pose = m.nodes.find(n => n.id === `${part}.pose`)\n if (!pose || pose.op !== 'rigid@1' || fastenedTo(asset, part)) return []\n const own = (ref: string) => ref.startsWith(`${part}.`) && m.inputs.some(i => i.id === ref && i.role === 'design')\n const constant = (ref: string) => m.constants.some(c => c.id === ref)\n return AXES.filter((_axis, i) => !own(pose.args[i]!) && !constant(pose.args[i]!))\n}\n\n/**\n * Whether the part's position on an axis is a share of the instance size (`scale-position`): `size.<axis> × share`.\n * Such a position is worked out too, but it already grows with the figure, so it is not offered again.\n */\nexport function positionIsShare(asset: V3Asset, part: string, axis: Axis): boolean {\n const m = modelOf(asset)\n const ref = m.nodes.find(n => n.id === `${part}.pose`)?.args[AXES.indexOf(axis)]\n const writer = ref ? m.nodes.find(n => Object.values(n.outputs).includes(ref)) : undefined\n return !!writer && writer.op === 'mul@1' && writer.args[0] === `size.${axis}` && m.constants.some(c => c.id === writer.args[1])\n}\n\n/** How a part moves, if it does: slide or turn, along which axis, driven by which control. */\nexport interface Motion {\n kind: 'slide' | 'turn' | 'continuous'\n axis: Axis | '?'\n control?: { id: string; unit?: string; min?: number; max?: number }\n /** A joint that moves with another (URDF's mimic): the leader's value times `multiplier`, plus `offset`. */\n follows?: { joint: string; multiplier: number; offset?: number }\n /** A slide whose distance is a part's length (plus a difference): the control is its share. */\n travel?: { part: string; axis: string; plus?: number }\n}\n\nexport function motionOf(asset: V3Asset, part: string): Motion | undefined {\n const m = modelOf(asset)\n const node = m.nodes.find(n => n.id === `${part}.motion`)\n if (!node) return undefined\n const record = asset.joints?.find(j => j.body1.part === part)\n const endless = record?.type === 'revolute' && record.lowerLimit === undefined && record.upperLimit === undefined\n const kind = endless ? 'continuous' : node.op === 'axis-turn@1' ? 'turn' : 'slide'\n const unit = node.args.slice(0, 3).map(ref => m.constants.find(c => c.id === ref)?.value)\n const axis = AXES[unit.findIndex(v => v !== undefined && v !== 0)] ?? '?'\n /* The quantity is the fourth argument, a state input directly or through the nodes that scale it. */\n const quantity = node.args[3]\n const seen = new Set<string>()\n const control = (ref?: string): Motion['control'] => {\n if (!ref || seen.has(ref)) return undefined\n seen.add(ref)\n const input = m.inputs.find(i => i.id === ref && i.role === 'state')\n if (input) return { id: input.id, unit: input.unit, min: input.min, max: input.max }\n const writer = m.nodes.find(n => Object.values(n.outputs).includes(ref))\n for (const arg of writer?.args ?? []) {\n const found = control(arg)\n if (found) return found\n }\n return undefined\n }\n const travel = record?.travel?.source && 'part' in record.travel.source ? { part: record.travel.source.part, axis: record.travel.source.axis, ...(record.travel.plus ? { plus: record.travel.plus } : {}) } : undefined\n return { kind, axis, control: control(quantity), ...(record?.mimic ? { follows: record.mimic } : {}), ...(travel ? { travel } : {}) }\n}\n\n/** What the motion form holds: how the part moves, and either its own control or the joint it moves with. */\nexport interface MotionForm {\n kind: 'slide' | 'turn' | 'continuous'\n axis: Axis\n id: string\n min: number\n max: number\n /** The joint this one moves with; empty for a joint with its own control. */\n follow: string\n multiplier: number\n offset: number\n /**\n * A slide whose distance follows a part's length (figure-model `travel`): `<part>:<axis>`, empty for a distance in\n * millimetres. The control is then the share of that length, 0..1, and the stroke grows when the part does.\n */\n travel?: string\n travelPlus?: number\n}\n\n/**\n * The motion form filled from a joint as it is, so a motion can be changed where it is -- its range, the length it\n * travels by, what it follows -- rather than taken away and made again. Taking it away is refused while another joint\n * follows it, which left a leader's stroke fixed for good (the telescopic conveyor, 2026-09-25).\n */\nexport function motionFormOf(joint: V3Joint): MotionForm {\n const kind: MotionForm['kind'] = joint.type === 'prismatic' ? 'slide' : joint.lowerLimit === undefined && joint.upperLimit === undefined && !joint.mimic ? 'continuous' : 'turn'\n const travel = joint.travel?.source && 'part' in joint.travel.source ? `${joint.travel.source.part}:${joint.travel.source.axis}` : ''\n return {\n kind,\n axis: (joint.axis ?? 'X').toLowerCase() as Axis,\n id: joint.state?.id ?? '',\n min: travel ? 0 : (joint.lowerLimit ?? (kind === 'slide' ? 0 : -90)),\n max: travel ? 500 : (joint.upperLimit ?? (kind === 'slide' ? 500 : 90)),\n follow: joint.mimic?.joint ?? '',\n multiplier: joint.mimic?.multiplier ?? 1,\n offset: joint.mimic?.offset ?? 0,\n travel,\n travelPlus: joint.travel?.plus ?? 0\n }\n}\n\n/**\n * The joints a part's joint can move with (URDF's mimic): a joint that moves the same way — a slide follows a slide, a\n * turn a turn — and has a control of its own, since a follower follows the joint that is driven.\n */\nexport function leadersFor(asset: V3Asset, part: string, kind: MotionForm['kind']): V3Joint[] {\n return (asset.joints ?? []).filter(j => j.body1.part !== part && j.type !== 'fixed' && !j.mimic && (j.type === 'prismatic') === (kind === 'slide'))\n}\n\n/**\n * The joint record the motion form writes for a part fastened by `joint`. A joint of its own gets its limits (none for\n * a turn without end, as in USD) and a control; a follower gets the leader, the multiplier and the offset, and no\n * control or limits of its own — its range is the leader's times the multiplier.\n */\nexport function motionJoint(joint: V3Joint, m: MotionForm, part: string): V3Joint {\n const moving = {\n id: joint.id,\n body0: joint.body0,\n body1: joint.body1,\n ...(joint.origin ? { origin: joint.origin } : {}),\n type: m.kind === 'slide' ? ('prismatic' as const) : ('revolute' as const),\n axis: m.axis.toUpperCase() as 'X' | 'Y' | 'Z'\n }\n if (m.follow) return { ...moving, mimic: { joint: m.follow, multiplier: m.multiplier, ...(m.offset ? { offset: m.offset } : {}) } }\n if (m.kind === 'slide' && m.travel) {\n const [of, axis] = m.travel.split(':')\n return { ...moving, travel: { source: { of: 'part', part: of!, axis: axis as Axis }, ...(m.travelPlus ? { plus: m.travelPlus } : {}) }, state: { id: m.id || `${part}-${m.kind}` } }\n }\n return { ...moving, ...(m.kind === 'continuous' ? {} : { lowerLimit: m.min, upperLimit: m.max }), state: { id: m.id || `${part}-${m.kind}` } }\n}\n\n/** The select's value for what a dimension follows now. */\nexport function choiceOf(follow: Follow): string {\n switch (follow.of) {\n case 'own':\n return 'own'\n case 'instance':\n return follow.times === 1 ? `instance:${follow.axis}` : `share:${follow.axis}`\n case 'part':\n return `part:${follow.part}:${follow.axis}`\n case 'input':\n return `input:${follow.input}`\n case 'expression':\n return 'expression'\n }\n}\n\n/** The faces a place can sit on for this part: a box's six, a rounded box's top and bottom, none for a round body. */\nexport function placeFacesOf(asset: V3Asset, part: string): V3Face[] {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n if (shape?.op === 'box-shape@1') return ['left', 'right', 'bottom', 'top', 'back', 'front']\n if (shape?.op === 'rounded-box@1') return ['bottom', 'top']\n return []\n}\n\n/** The places things are held that sit on this part. */\nexport function placesOn(asset: V3Asset, part: string): V3BindingPlace[] {\n return v3BindingsOf(asset).filter(one => one.part === part)\n}\n\n/** An id for a new place on this part, not yet taken: `<part>-<role>`, then `-2`, `-3`. */\nexport function placeIdFor(asset: V3Asset, part: string, role: 'seat' | 'grip'): string {\n const taken = new Set(asset.document.capabilities.bindings.map(b => b.id))\n const base = `${part}-${role}`\n if (!taken.has(base)) return base\n let n = 2\n while (taken.has(`${base}-${n}`)) n++\n return `${base}-${n}`\n}\n\n/**\n * Whether a board will hand this figure anything: a place is a slot only on a figure that declares it holds things\n * (`Capacity`, or `FlowNode`, which includes it). Without it the places are declared and nothing arrives.\n */\nexport const holdsThings = (asset: V3Asset) => (asset.document.capabilities.names ?? []).some(n => n === 'Capacity' || n === 'FlowNode')\n\n/** What `accepts` a person typed: names split on commas, trimmed, blanks and repeats dropped. */\nexport const acceptsOf = (typed: string) => [...new Set(typed.split(',').map(one => one.trim()).filter(Boolean))]\n\n/**\n * The sizes a board may give this figure: the range it declares now, and the range measured afresh -- the default\n * (1 mm to ten times the authored size) narrowed only where the figure cannot follow, by figure-model's own functions.\n * A range measured when a part filled what the others left (ROBOT_ARM: Y from 1,854 mm) stays narrow after the part is\n * made to grow with the figure; measuring again gives the figure its whole range back. Nothing when no size is declared.\n */\nexport function instanceRangeOf(asset: V3Asset): { declared: V3SizeRange; measured: V3SizeRange } | undefined {\n const inputs = modelOf(asset).inputs\n const declared = {} as V3SizeRange\n const authored = {} as Record<Axis, number>\n for (const axis of AXES) {\n const input = inputs.find(i => i.id === `size.${axis}` && i.role === 'design')\n const at = asset.designInputs[`size.${axis}`]\n if (!input || typeof at !== 'number') return undefined\n declared[axis] = { min: input.min ?? 0, max: input.max ?? Infinity }\n authored[axis] = at\n }\n const start = defaultInstanceSizeRange(authored)\n const measured = foldInstanceSizeRange(start, v3InstanceSizeLimitsOf(asset, start)).range\n return { declared, measured }\n}\n\n/**\n * The size range to declare for a figure that has none yet: its parts' extent now as the size it is authored at, and\n * as wide as its parts allow around it (the same measure 「다시 재기」 uses). Undefined when the figure already has a\n * size or has nothing to measure. Without a declared size a board cannot resize the figure, and no part is offered\n * to follow its size -- every figure made in the modeller was left there (user, 2026-09-25).\n */\nexport function instanceRangeToDeclare(asset: V3Asset): { range: V3SizeRange; at: Record<Axis, number> } | undefined {\n if (instanceRangeOf(asset) || !asset.appearance.length) return undefined\n /* The parts as they rest -- not the room their joints swing them through, which declared a door 8208 mm every way. */\n const at = v3PartsExtentOf(asset) as Record<Axis, number>\n if (AXES.some(axis => !(at[axis] > 0))) return undefined\n const start = defaultInstanceSizeRange(at)\n return { range: foldInstanceSizeRange(start, v3InstanceSizeLimitsOf(asset, start)).range, at }\n}\n\n/** Whether measuring again would change the declared range (to a micrometre). */\n/**\n * The declared range with one end typed by the author: the sizes a figure may be placed at are a claim about the\n * product (a gantry spans metres, not 30 cm to 29 m), and measuring only ever widens them. Nothing when the typed\n * value is not a number; whether the figure holds there is the command's to say.\n */\nexport function rangeWith(declared: V3SizeRange, axis: Axis, bound: 'min' | 'max', value: number): V3SizeRange | undefined {\n if (!Number.isFinite(value)) return undefined\n const next = structuredClone(declared)\n next[axis][bound] = value\n return next\n}\n\n/**\n * For a figure that grows by one ratio: how many of its lengths would follow the ratio, and which it leaves with their\n * own number (not those that follow another length -- they grow with it). Nothing for a figure of another sizing.\n */\nexport function proportionToFollow(asset: V3Asset): { count: number; kept: string[] } | undefined {\n if (asset.sizing !== 'uniform') return undefined\n try {\n const plan = proposeV3Proportion(asset)\n return { count: plan.dimensions.length + plan.lengths.length, kept: plan.skipped.filter(s => !s.follows).map(s => s.what) }\n } catch {\n return undefined\n }\n}\n\n/** A value of the figure as it stands, by its graph reference. */\nexport function valueNow(asset: V3Asset, ref: string | undefined): number | undefined {\n if (!ref) return undefined\n try {\n const values = compileV3Graph(asset.document.model as never).evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values as Record<string, number>\n const value = values[ref]\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n } catch {\n return undefined\n }\n}\n\nexport function rangeDiffers(a: V3SizeRange, b: V3SizeRange): boolean {\n return AXES.some(axis => Math.abs(a[axis].min - b[axis].min) > 1e-3 || Math.abs(a[axis].max - b[axis].max) > 1e-3)\n}\n\n/**\n * Whether the figure is a mechanism -- a part turns about a joint. Such a figure should grow by one ratio (chief\n * architect's ruling 2026-09-24); the modeller proposes it, the author declares it.\n */\nexport function turnsAboutAJoint(asset: V3Asset): boolean {\n return modelOf(asset).nodes.some(n => n.op === 'axis-turn@1')\n}\n\n"]}
1
+ {"version":3,"file":"v3-links.js","sourceRoot":"","sources":["../../client/modeller/v3-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AASzP,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAQpD,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CACjC,KAAK,CAAC,QAAQ,CAAC,KAA+K,CAAA;AAKhM;;;;GAIG;AACH,iHAAiH;AACjH,MAAM,UAAU,QAAQ,CAAC,KAAc,EAAE,IAAY,EAAE,IAAU;IAC/D,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACtC,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAAE,IAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;AAE9I,oHAAoH;AACpH,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,IAAY;IACrD,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,CAA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AAA;IAC1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAc,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,MAAgC,CAAA;QACzJ,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IAChF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAc,EAAE,CAAc;IACzD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;AACpH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import { V3_FACES, v3ShapeFaces, v3PartsExtentOf, compileV3Asset, compileV3Graph, v3FollowOf, proposeV3Proportion, defaultInstanceSizeRange, foldInstanceSizeRange, v3AttachmentsOf, v3BindingsOf, v3InstanceSizeLimitsOf } from '@hatiolab/figure-model'\nimport type { V3Follow, V3SizeRange } from '@hatiolab/figure-model'\nimport type { V3Asset, V3BindingPlace, V3Face, V3Joint } from '@hatiolab/figure-model'\n\n/*\n * What a V3 part is tied to — the readers behind the parts' size response, fastening and motion sections. Kept apart from the element so they can be tested without a browser.\n */\n\nexport type Axis = 'x' | 'y' | 'z'\nexport const AXES: readonly Axis[] = ['x', 'y', 'z']\n\ninterface Node {\n id: string\n op: string\n args: string[]\n outputs: Record<string, string>\n}\nconst modelOf = (asset: V3Asset) =>\n asset.document.model as unknown as { nodes: Node[]; inputs: Array<{ id: string; role?: string; unit?: string; min?: number; max?: number }>; constants: Array<{ id: string; value: number }> }\n\n/** What one dimension of a part is worked out from (figure-model's `V3Follow`). */\nexport type Follow = V3Follow\n\n/**\n * `link-dimension` routes a part's dimension through `<part>.dimension.<axis>` and points its first argument at the\n * source, directly or through the nodes that scale it. Walking back through those nodes finds the source: the\n * instance size (`size.<axis>`), another part's dimension (`<part>.dimension.<axis>.value`) or a declared input.\n */\n/** What one measure of a part is worked out from, read back from the graph (figure-model's reader, one copy). */\nexport function followOf(asset: V3Asset, part: string, axis: Axis): Follow {\n return v3FollowOf(asset, part, axis)\n}\n\n/** Whether the asset declares an instance size on an axis — only then can a dimension follow it. */\nexport const hasInstanceSize = (asset: V3Asset, axis: Axis) => modelOf(asset).inputs.some(i => i.id === `size.${axis}` && i.role === 'design')\n\n/** The part this one is fastened to, or `null`. The mounting plane counts as fastened (the model names no part). */\nexport function fastenedTo(asset: V3Asset, part: string): string | null {\n return v3AttachmentsOf(asset)[part] ?? null\n}\n\n/**\n * What holds a part: the part it is fastened to, the plane the figure is mounted on, or nothing. The joint record says\n * it; a part standing on the plane had read as fastened to nothing, so the form offered no way to move it and sent\n * no replace -- the fastening was refused as already made (the door's post, 2026-09-25).\n */\nexport function heldBy(asset: V3Asset, part: string): { part: string } | { plane: true } | null {\n const record = asset.joints?.find(j => j.body1.part === part)\n if (record) return 'plane' in record.body0 ? { plane: true } : { part: record.body0.part }\n const to = fastenedTo(asset, part)\n return to ? { part: to } : null\n}\n\n/** Whether a dimension of this part can follow something — box-shaped, whose three sizes are X, Y and Z. */\nexport function canFollow(asset: V3Asset, part: string): boolean {\n return followableAxes(asset, part).length > 0\n}\n\n/**\n * The axes whose size can follow something, by the shape's own measures: a box's X · Y · Z; a cylinder's radius (read\n * as X) and length (Y) -- its shape takes those two, so it has no Z of its own.\n */\nexport function followableAxes(asset: V3Asset, part: string): Axis[] {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n if (!shape) return []\n /* A door frame's first three measures are its width, height and depth, as a box's (figure-model portal-profile@2). */\n if (shape.op === 'box-shape@1' || shape.op === 'rounded-box@1' || shape.op === 'portal-profile@2' || shape.op === 'hollow-box@2') return [...AXES]\n if (shape.op === 'cylinder-shape@1') return ['x', 'y']\n return []\n}\n\n/** What a part's own measure on an axis is now (a box's side, a cylinder's radius or length), at the design as it stands. */\nexport function dimensionNow(asset: V3Asset, part: string, axis: Axis): number | undefined {\n const m = modelOf(asset)\n const ref = m.nodes.find(n => n.id === `${part}.shape`)?.args[AXES.indexOf(axis)]\n if (!ref) return undefined\n try {\n const values = compileV3Graph(asset.document.model as never).evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values as Record<string, number>\n const value = values[ref]\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * The flat faces a part's shape declares, by name -- figure-model's shape definitions are the one place they are\n * written (a portal's opening sides as well as its outer faces). A sphere has none.\n */\nexport function facesOf(asset: V3Asset, part: string): string[] {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n return Object.keys((shape && v3ShapeFaces(shape.op)) ?? {})\n}\n\n/** The axis a face of a part faces along, from the same definitions. */\nexport function faceAxisOf(asset: V3Asset, part: string, face: string): Axis | undefined {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n return (shape && v3ShapeFaces(shape.op)?.[face]?.axis) as Axis | undefined\n}\n\n/** Whether `attach` can take this part: any part whose shape has a flat face. */\nexport function canFasten(asset: V3Asset, part: string): boolean {\n return facesOf(asset, part).length > 0\n}\n\nconst OUTER: Record<Axis, [string, string]> = { x: ['left', 'right'], y: ['bottom', 'top'], z: ['back', 'front'] }\n\n/**\n * The axes a part can be made a row along (r3 §8, figure-model `make-repeat`): across the face it is fastened by, when\n * it is fastened fixed to another part and holds nothing. None for a part that is loose, moves, stands on the floor or\n * already repeats -- the command would refuse those, so they are not offered.\n */\nexport function rowAxesOf(asset: V3Asset, part: string): Axis[] {\n const joints = asset.joints ?? []\n const j = joints.find(o => o.body1.part === part)\n if (!j || j.type !== 'fixed' || j.repeat || !('part' in j.body0)) return []\n if (joints.some(o => 'part' in o.body0 && o.body0.part === part)) return []\n return AXES.filter(axis => axis !== V3_FACES[j.body1.face])\n}\n\n/** The row a part is made into, as its fastening's record keeps it. */\nexport const rowOf = (asset: V3Asset, part: string) => asset.joints?.find(o => o.body1.part === part)?.repeat\n\n/** Where a part sits across the face it is fastened to, on one axis: centred, level with an edge, or a distance off centre. */\n/** `share`: the distance as a share of the figure's size on that axis, so it keeps its place when the figure is resized. */\nexport type Alignment = 'centre' | 'min' | 'max' | 'mm' | 'share'\n\n/**\n * The axes across the face a part is fastened to — the two a fastening does not set by itself. Edges to line up with\n * are offered where both parts have their two outer faces on that axis; the plane the figure is mounted on has none,\n * so on it (X and Z) only centred or a distance is offered.\n */\n/**\n * The mounting plane of this figure, by its placement (ADR-0093): the floor or the ceiling is Y = 0 and a part stands\n * on it by its bottom or hangs from it by its top; a wall is Z = 0 and a part is fastened to it by its back.\n */\nexport function mountingPlaneOf(asset: V3Asset): { normal: Axis; faces: V3Face[] } {\n return asset.occupancy?.placement === 'wall' ? { normal: 'z', faces: ['back'] } : { normal: 'y', faces: ['bottom', 'top'] }\n}\n\nexport function alignAxesOf(asset: V3Asset, part: string, target: { part: string; face: string } | 'plane', twisted = false): { axis: Axis; edges: boolean }[] {\n /* The plane has no edges, but a figure that declares its size has sides on it (figure-model 0.1.64). */\n if (target === 'plane') {\n const { normal } = mountingPlaneOf(asset)\n return AXES.filter(axis => axis !== normal).map(axis => ({ axis, edges: !twisted && hasInstanceSize(asset, axis) }))\n }\n const along = faceAxisOf(asset, target.part, target.face)\n if (!along) return []\n const theirs = new Set(facesOf(asset, target.part)),\n mine = new Set(facesOf(asset, part))\n /* A part twisted about the face's normal has no side level with the target's edges. */\n return AXES.filter(axis => axis !== along).map(axis => ({ axis, edges: !twisted && OUTER[axis].every(f => theirs.has(f) && mine.has(f)) }))\n}\n\n/** The controls a part's showing can follow: the figure's state inputs, with their range and label. */\nexport function visibilityControlsOf(asset: V3Asset): Array<{ id: string; unit: string; min: number; max: number; label: string }> {\n const labels = (asset as unknown as { stateInputs?: Record<string, { label?: string }> }).stateInputs ?? {}\n return modelOf(asset)\n .inputs.filter(input => input.role === 'state')\n .map(input => ({ id: input.id, unit: input.unit ?? '', min: input.min ?? 0, max: input.max ?? 1, label: labels[input.id]?.label || input.id }))\n}\n\n/** When the part is drawn (figure-model `set-visibility`): always (null), or while a control is at least a value. */\nexport function shownWhenOf(asset: V3Asset, part: string): { input: string; atLeast: number } | null {\n const look = asset.appearance.find(one => one.target === part) as { visibility?: string } | undefined\n if (!look?.visibility) return null\n const m = modelOf(asset)\n const node = m.nodes.find(n => n.op === 'at-least@1' && Object.values(n.outputs).includes(look.visibility!))\n const at = node && m.constants.find(c => c.id === node.args[1])\n return node && at ? { input: node.args[0]!, atLeast: at.value } : null\n}\n\n/** Whether `part` hangs from `from`, through any number of fastenings. */\nexport function hangsFrom(asset: V3Asset, part: string, from: string): boolean {\n const seen = new Set<string>()\n for (let at: string | undefined = part; at && !seen.has(at); ) {\n seen.add(at)\n const j = ((asset.joints ?? []) as V3Joint[]).find(o => o.body1.part === at)\n at = j && 'part' in j.body0 ? (j.body0 as { part: string }).part : undefined\n if (at === from) return true\n }\n return false\n}\n\n/**\n * The fastening a part has, as the fastening form holds it -- so the form opens on what is there (the face, including\n * \\`centre\\`, the target and its face, the gap, the twist and where across the face) and a change is a change to that.\n * Opening it on the defaults showed a roller fastened by its centre as fastened by its bottom, and fastening again\n * from there broke its turning in place (walk 1, 2026-09-26). Null for a part fastened to nothing.\n */\nexport function fasteningOf(\n asset: V3Asset,\n part: string\n): {\n face: string\n toPlane: boolean\n target: string\n targetFace: string\n facing: 'meet' | 'flush'\n gap: number\n twist: number\n align: Partial<Record<Axis, Alignment>>\n alignMm: Partial<Record<Axis, number>>\n} | null {\n const record = asset.joints?.find(j => j.body1.part === part)\n if (!record) return null\n const toPlane = 'plane' in record.body0\n const target = 'part' in record.body0 ? record.body0.part : ''\n const targetFace = 'part' in record.body0 ? record.body0.face : 'top'\n const twist = record.origin?.twist ?? 0\n /* Where across the face: as the record says it, and where it says nothing, where the part stands now. */\n const kept = placeKeptOf(asset, part, toPlane ? 'plane' : { part: target, face: targetFace }, !!twist)\n for (const [axis, how] of Object.entries(record.origin?.align ?? {}) as Array<[Axis, unknown]>) {\n if (how === 'min' || how === 'max' || how === 'centre') {\n kept.align[axis] = how\n delete kept.alignMm[axis]\n } else if (how && typeof how === 'object' && typeof (how as { mm?: unknown }).mm === 'number') {\n kept.align[axis] = 'mm'\n kept.alignMm[axis] = (how as { mm: number }).mm\n }\n }\n const gap = record.origin?.gap\n return {\n face: record.body1.face,\n toPlane,\n target,\n targetFace,\n facing: record.origin?.facing ?? 'meet',\n gap: typeof gap === 'number' ? gap : 0,\n twist,\n ...kept\n }\n}\n\n/**\n * The alignment that keeps the part where it stands when it is fastened: on each axis across the face, its distance\n * from the target's centre (the plane's is the origin). Fastening used to centre it -- a door set 100 mm in front of\n * its frame slid into it (2026-09-26). Left centred where it already is, and where the target stands turned.\n */\nexport function placeKeptOf(\n asset: V3Asset,\n part: string,\n target: { part: string; face: string } | 'plane',\n twisted = false\n): { align: Partial<Record<Axis, Alignment>>; alignMm: Partial<Record<Axis, number>> } {\n const kept = { align: {} as Partial<Record<Axis, Alignment>>, alignMm: {} as Partial<Record<Axis, number>> }\n let geometry\n try {\n geometry = compileV3Asset(asset).evaluate().geometry as unknown as Array<{ id: string; pose?: { r: number[][]; t: number[] } }>\n } catch {\n return kept\n }\n const poseOf = (id: string) => geometry.find(g => g.id === id)?.pose\n const mine = poseOf(part)\n if (!mine) return kept\n let centre = [0, 0, 0]\n if (target !== 'plane') {\n const theirs = poseOf(target.part)\n const upright = theirs?.r.every((row, i) => row.every((v, j) => Math.abs(v - (i === j ? 1 : 0)) < 1e-9))\n if (!theirs || !upright) return kept\n centre = theirs.t\n }\n for (const { axis } of alignAxesOf(asset, part, target, twisted)) {\n const k = AXES.indexOf(axis)\n const off = Math.round((mine.t[k]! - centre[k]!) * 10) / 10\n if (Math.abs(off) < 0.5) continue\n kept.align[axis] = 'mm'\n kept.alignMm[axis] = off\n }\n return kept\n}\n\n/** The `align` of an attach command from the form's choices: only the axes across that face, and centred ones left out. */\nexport function alignOf(\n asset: V3Asset,\n part: string,\n target: { part: string; face: string } | 'plane',\n how: Partial<Record<Axis, Alignment>>,\n mm: Partial<Record<Axis, number>>,\n twisted = false\n) {\n const align: Partial<Record<Axis, 'min' | 'max' | { mm: number | { from: { of: 'instance'; axis: Axis }; times: number } }>> = {}\n for (const { axis, edges } of alignAxesOf(asset, part, target, twisted)) {\n const one = how[axis] ?? 'centre'\n const size = asset.designInputs[`size.${axis}`]\n if (one === 'share' && mm[axis] && hasInstanceSize(asset, axis) && size)\n align[axis] = { mm: { from: { of: 'instance', axis }, times: Math.round((mm[axis]! / size) * 1e6) / 1e6 } }\n else if (one === 'mm' && mm[axis]) align[axis] = { mm: mm[axis]! }\n else if ((one === 'min' || one === 'max') && edges) align[axis] = one\n }\n return Object.keys(align).length ? align : undefined\n}\n\n/**\n * The axes on which the part's position is worked out from other values rather than being its own number. `fix-position` makes one its own number where it is now.\n */\nexport function positionsWorkedOut(asset: V3Asset, part: string): Axis[] {\n const m = modelOf(asset)\n const pose = m.nodes.find(n => n.id === `${part}.pose`)\n if (!pose || pose.op !== 'rigid@1' || fastenedTo(asset, part)) return []\n const own = (ref: string) => ref.startsWith(`${part}.`) && m.inputs.some(i => i.id === ref && i.role === 'design')\n const constant = (ref: string) => m.constants.some(c => c.id === ref)\n return AXES.filter((_axis, i) => !own(pose.args[i]!) && !constant(pose.args[i]!))\n}\n\n/**\n * Whether the part's position on an axis is a share of the instance size (`scale-position`): `size.<axis> × share`.\n * Such a position is worked out too, but it already grows with the figure, so it is not offered again.\n */\nexport function positionIsShare(asset: V3Asset, part: string, axis: Axis): boolean {\n const m = modelOf(asset)\n const ref = m.nodes.find(n => n.id === `${part}.pose`)?.args[AXES.indexOf(axis)]\n const writer = ref ? m.nodes.find(n => Object.values(n.outputs).includes(ref)) : undefined\n return !!writer && writer.op === 'mul@1' && writer.args[0] === `size.${axis}` && m.constants.some(c => c.id === writer.args[1])\n}\n\n/** How a part moves, if it does: slide or turn, along which axis, driven by which control. */\nexport interface Motion {\n kind: 'slide' | 'turn' | 'continuous'\n axis: Axis | '?'\n control?: { id: string; unit?: string; min?: number; max?: number }\n /** A joint that moves with another (URDF's mimic): the leader's value times `multiplier`, plus `offset`. */\n follows?: { joint: string; multiplier: number; offset?: number }\n /** A slide whose distance is a part's length (plus a difference): the control is its share. */\n travel?: { part: string; axis: string; plus?: number }\n}\n\nexport function motionOf(asset: V3Asset, part: string): Motion | undefined {\n const m = modelOf(asset)\n const node = m.nodes.find(n => n.id === `${part}.motion`)\n if (!node) return undefined\n const record = asset.joints?.find(j => j.body1.part === part)\n const endless = record?.type === 'revolute' && record.lowerLimit === undefined && record.upperLimit === undefined\n const kind = endless ? 'continuous' : node.op === 'axis-turn@1' ? 'turn' : 'slide'\n const unit = node.args.slice(0, 3).map(ref => m.constants.find(c => c.id === ref)?.value)\n const axis = AXES[unit.findIndex(v => v !== undefined && v !== 0)] ?? '?'\n /* The quantity is the fourth argument, a state input directly or through the nodes that scale it. */\n const quantity = node.args[3]\n const seen = new Set<string>()\n const control = (ref?: string): Motion['control'] => {\n if (!ref || seen.has(ref)) return undefined\n seen.add(ref)\n const input = m.inputs.find(i => i.id === ref && i.role === 'state')\n if (input) return { id: input.id, unit: input.unit, min: input.min, max: input.max }\n const writer = m.nodes.find(n => Object.values(n.outputs).includes(ref))\n for (const arg of writer?.args ?? []) {\n const found = control(arg)\n if (found) return found\n }\n return undefined\n }\n const travel = record?.travel?.source && 'part' in record.travel.source ? { part: record.travel.source.part, axis: record.travel.source.axis, ...(record.travel.plus ? { plus: record.travel.plus } : {}) } : undefined\n return { kind, axis, control: control(quantity), ...(record?.mimic ? { follows: record.mimic } : {}), ...(travel ? { travel } : {}) }\n}\n\n/** What the motion form holds: how the part moves, and either its own control or the joint it moves with. */\nexport interface MotionForm {\n kind: 'slide' | 'turn' | 'continuous'\n axis: Axis\n id: string\n min: number\n max: number\n /** The joint this one moves with; empty for a joint with its own control. */\n follow: string\n multiplier: number\n offset: number\n /**\n * A slide whose distance follows a part's length (figure-model `travel`): `<part>:<axis>`, empty for a distance in\n * millimetres. The control is then the share of that length, 0..1, and the stroke grows when the part does.\n */\n travel?: string\n travelPlus?: number\n}\n\n/**\n * The motion form filled from a joint as it is, so a motion can be changed where it is -- its range, the length it\n * travels by, what it follows -- rather than taken away and made again. Taking it away is refused while another joint\n * follows it, which left a leader's stroke fixed for good (the telescopic conveyor, 2026-09-25).\n */\nexport function motionFormOf(joint: V3Joint): MotionForm {\n const kind: MotionForm['kind'] = joint.type === 'prismatic' ? 'slide' : joint.lowerLimit === undefined && joint.upperLimit === undefined && !joint.mimic ? 'continuous' : 'turn'\n const travel = joint.travel?.source && 'part' in joint.travel.source ? `${joint.travel.source.part}:${joint.travel.source.axis}` : ''\n return {\n kind,\n axis: (joint.axis ?? 'X').toLowerCase() as Axis,\n id: joint.state?.id ?? '',\n min: travel ? 0 : (joint.lowerLimit ?? (kind === 'slide' ? 0 : -90)),\n max: travel ? 500 : (joint.upperLimit ?? (kind === 'slide' ? 500 : 90)),\n follow: joint.mimic?.joint ?? '',\n multiplier: joint.mimic?.multiplier ?? 1,\n offset: joint.mimic?.offset ?? 0,\n travel,\n travelPlus: joint.travel?.plus ?? 0\n }\n}\n\n/**\n * The joints a part's joint can move with (URDF's mimic): a joint that moves the same way — a slide follows a slide, a\n * turn a turn — and has a control of its own, since a follower follows the joint that is driven.\n */\nexport function leadersFor(asset: V3Asset, part: string, kind: MotionForm['kind']): V3Joint[] {\n return (asset.joints ?? []).filter(j => j.body1.part !== part && j.type !== 'fixed' && !j.mimic && (j.type === 'prismatic') === (kind === 'slide'))\n}\n\n/**\n * The joint record the motion form writes for a part fastened by `joint`. A joint of its own gets its limits (none for\n * a turn without end, as in USD) and a control; a follower gets the leader, the multiplier and the offset, and no\n * control or limits of its own — its range is the leader's times the multiplier.\n */\nexport function motionJoint(joint: V3Joint, m: MotionForm, part: string): V3Joint {\n const moving = {\n id: joint.id,\n body0: joint.body0,\n body1: joint.body1,\n ...(joint.origin ? { origin: joint.origin } : {}),\n type: m.kind === 'slide' ? ('prismatic' as const) : ('revolute' as const),\n axis: m.axis.toUpperCase() as 'X' | 'Y' | 'Z'\n }\n if (m.follow) return { ...moving, mimic: { joint: m.follow, multiplier: m.multiplier, ...(m.offset ? { offset: m.offset } : {}) } }\n if (m.kind === 'slide' && m.travel) {\n const [of, axis] = m.travel.split(':')\n return { ...moving, travel: { source: { of: 'part', part: of!, axis: axis as Axis }, ...(m.travelPlus ? { plus: m.travelPlus } : {}) }, state: { id: m.id || `${part}-${m.kind}` } }\n }\n return { ...moving, ...(m.kind === 'continuous' ? {} : { lowerLimit: m.min, upperLimit: m.max }), state: { id: m.id || `${part}-${m.kind}` } }\n}\n\n/** The select's value for what a dimension follows now. */\nexport function choiceOf(follow: Follow): string {\n switch (follow.of) {\n case 'own':\n return 'own'\n case 'instance':\n return follow.times === 1 ? `instance:${follow.axis}` : `share:${follow.axis}`\n case 'part':\n return `part:${follow.part}:${follow.axis}`\n case 'input':\n return `input:${follow.input}`\n case 'expression':\n return 'expression'\n }\n}\n\n/** The faces a place can sit on for this part: a box's six, a rounded box's top and bottom, none for a round body. */\nexport function placeFacesOf(asset: V3Asset, part: string): V3Face[] {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n if (shape?.op === 'box-shape@1') return ['left', 'right', 'bottom', 'top', 'back', 'front']\n if (shape?.op === 'rounded-box@1') return ['bottom', 'top']\n return []\n}\n\n/** The places things are held that sit on this part. */\nexport function placesOn(asset: V3Asset, part: string): V3BindingPlace[] {\n return v3BindingsOf(asset).filter(one => one.part === part)\n}\n\n/** An id for a new place on this part, not yet taken: `<part>-<role>`, then `-2`, `-3`. */\nexport function placeIdFor(asset: V3Asset, part: string, role: 'seat' | 'grip'): string {\n const taken = new Set(asset.document.capabilities.bindings.map(b => b.id))\n const base = `${part}-${role}`\n if (!taken.has(base)) return base\n let n = 2\n while (taken.has(`${base}-${n}`)) n++\n return `${base}-${n}`\n}\n\n/**\n * Whether a board will hand this figure anything: a place is a slot only on a figure that declares it holds things\n * (`Capacity`, or `FlowNode`, which includes it). Without it the places are declared and nothing arrives.\n */\nexport const holdsThings = (asset: V3Asset) => (asset.document.capabilities.names ?? []).some(n => n === 'Capacity' || n === 'FlowNode')\n\n/** What `accepts` a person typed: names split on commas, trimmed, blanks and repeats dropped. */\nexport const acceptsOf = (typed: string) => [...new Set(typed.split(',').map(one => one.trim()).filter(Boolean))]\n\n/**\n * The sizes a board may give this figure: the range it declares now, and the range measured afresh -- the default\n * (1 mm to ten times the authored size) narrowed only where the figure cannot follow, by figure-model's own functions.\n * A range measured when a part filled what the others left (ROBOT_ARM: Y from 1,854 mm) stays narrow after the part is\n * made to grow with the figure; measuring again gives the figure its whole range back. Nothing when no size is declared.\n */\nexport function instanceRangeOf(asset: V3Asset): { declared: V3SizeRange; measured: V3SizeRange } | undefined {\n const inputs = modelOf(asset).inputs\n const declared = {} as V3SizeRange\n const authored = {} as Record<Axis, number>\n for (const axis of AXES) {\n const input = inputs.find(i => i.id === `size.${axis}` && i.role === 'design')\n const at = asset.designInputs[`size.${axis}`]\n if (!input || typeof at !== 'number') return undefined\n declared[axis] = { min: input.min ?? 0, max: input.max ?? Infinity }\n authored[axis] = at\n }\n const start = defaultInstanceSizeRange(authored)\n const measured = foldInstanceSizeRange(start, v3InstanceSizeLimitsOf(asset, start)).range\n return { declared, measured }\n}\n\n/**\n * The size range to declare for a figure that has none yet: its parts' extent now as the size it is authored at, and\n * as wide as its parts allow around it (the same measure 「다시 재기」 uses). Undefined when the figure already has a\n * size or has nothing to measure. Without a declared size a board cannot resize the figure, and no part is offered\n * to follow its size -- every figure made in the modeller was left there (user, 2026-09-25).\n */\nexport function instanceRangeToDeclare(asset: V3Asset): { range: V3SizeRange; at: Record<Axis, number> } | undefined {\n if (instanceRangeOf(asset) || !asset.appearance.length) return undefined\n /* The parts as they rest -- not the room their joints swing them through, which declared a door 8208 mm every way. */\n const at = v3PartsExtentOf(asset) as Record<Axis, number>\n if (AXES.some(axis => !(at[axis] > 0))) return undefined\n const start = defaultInstanceSizeRange(at)\n return { range: foldInstanceSizeRange(start, v3InstanceSizeLimitsOf(asset, start)).range, at }\n}\n\n/** Whether measuring again would change the declared range (to a micrometre). */\n/**\n * The declared range with one end typed by the author: the sizes a figure may be placed at are a claim about the\n * product (a gantry spans metres, not 30 cm to 29 m), and measuring only ever widens them. Nothing when the typed\n * value is not a number; whether the figure holds there is the command's to say.\n */\nexport function rangeWith(declared: V3SizeRange, axis: Axis, bound: 'min' | 'max', value: number): V3SizeRange | undefined {\n if (!Number.isFinite(value)) return undefined\n const next = structuredClone(declared)\n next[axis][bound] = value\n return next\n}\n\n/**\n * For a figure that grows by one ratio: how many of its lengths would follow the ratio, and which it leaves with their\n * own number (not those that follow another length -- they grow with it). Nothing for a figure of another sizing.\n */\nexport function proportionToFollow(asset: V3Asset): { count: number; kept: string[] } | undefined {\n if (asset.sizing !== 'uniform') return undefined\n try {\n const plan = proposeV3Proportion(asset)\n return { count: plan.dimensions.length + plan.lengths.length, kept: plan.skipped.filter(s => !s.follows).map(s => s.what) }\n } catch {\n return undefined\n }\n}\n\n/** A value of the figure as it stands, by its graph reference. */\nexport function valueNow(asset: V3Asset, ref: string | undefined): number | undefined {\n if (!ref) return undefined\n try {\n const values = compileV3Graph(asset.document.model as never).evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values as Record<string, number>\n const value = values[ref]\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n } catch {\n return undefined\n }\n}\n\nexport function rangeDiffers(a: V3SizeRange, b: V3SizeRange): boolean {\n return AXES.some(axis => Math.abs(a[axis].min - b[axis].min) > 1e-3 || Math.abs(a[axis].max - b[axis].max) > 1e-3)\n}\n\n/**\n * Whether the figure is a mechanism -- a part turns about a joint. Such a figure should grow by one ratio (chief\n * architect's ruling 2026-09-24); the modeller proposes it, the author declares it.\n */\nexport function turnsAboutAJoint(asset: V3Asset): boolean {\n return modelOf(asset).nodes.some(n => n.op === 'axis-turn@1')\n}\n\n"]}
@@ -73,11 +73,31 @@ export function recipeFieldOf(param, value) {
73
73
  /** The templates a category and words find: a word matches the title, the description, the name or a tag. */
74
74
  export function recipesMatching(templates, category, query) {
75
75
  const words = query.trim().toLowerCase().split(/\s+/).filter(Boolean);
76
- return templates.filter(t => {
76
+ const found = templates.filter(t => {
77
77
  if (category && t.category !== category)
78
78
  return false;
79
79
  const text = [t.title, t.description, t.name, ...t.tags].join(' ').toLowerCase();
80
80
  return words.every(w => text.includes(w));
81
81
  });
82
+ if (!words.length)
83
+ return found;
84
+ /*
85
+ What the search names comes first: a title that is the words, then one that starts with them, then a title word that
86
+ does, then the rest in their order. 「다리」 listed 사다리 before 다리 넷 (walk 1, 2026-09-26).
87
+ */
88
+ const rank = (t) => {
89
+ const title = t.title.toLowerCase();
90
+ const query = words.join(' ');
91
+ if (title === query)
92
+ return 0;
93
+ if (title.startsWith(query))
94
+ return 1;
95
+ if (words.every(w => title.split(/\s+/).some(part => part.startsWith(w))))
96
+ return 2;
97
+ if (words.every(w => title.includes(w)))
98
+ return 3;
99
+ return 4;
100
+ };
101
+ return found.map((t, i) => ({ t, i, r: rank(t) })).sort((a, b) => a.r - b.r || a.i - b.i).map(x => x.t);
82
102
  }
83
103
  //# sourceMappingURL=v3-recipes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"v3-recipes.js","sourceRoot":"","sources":["../../client/modeller/v3-recipes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAUzD;;GAEG;AAEH,+GAA+G;AAC/G,MAAM,UAAU,WAAW,CAAC,IAAsC;IAChE,MAAM,GAAG,GAAqB,EAAE,CAAA;IAChC,KAAK,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YACjC,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;QAC5G,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAE5E;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAgB;IAC7C,MAAM,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAClC,MAAM,KAAK,GAAmE,EAAE,CAAA;IAChF,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK;QACrB,KAAK,CAAC,IAAI,CACR,CAAC,CAAC,OAAO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DAA+D;AAC/D,MAAM,UAAU,aAAa,CAAC,KAAoB,EAAE,KAAoB;IACtE,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;IACrG,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC;AAGD,6GAA6G;AAC7G,MAAM,UAAU,eAAe,CAAmG,SAAuB,EAAE,QAAgB,EAAE,KAAa;IACxL,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACrE,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC1B,IAAI,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACrD,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;QAChF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { describeV3Recipe } from '@hatiolab/figure-model'\nimport type { V3Recipe, V3RecipeParam, V3RecipeValue } from '@hatiolab/figure-model'\n\nimport type { RecipeTemplateRow } from '../graphql/index.js'\n\n/** A template in the catalog: the server's row, its recipe parsed. */\nexport interface RecipeTemplate extends Omit<RecipeTemplateRow, 'source'> {\n recipe: V3Recipe\n}\n\n/*\n * The recipe section's rules (ADR-0095), kept apart from the element so they can be tested without a browser.\n */\n\n/** The server's rows as templates. A row that is not a recipe is left out rather than breaking the catalog. */\nexport function templatesOf(rows: ReadonlyArray<RecipeTemplateRow>): RecipeTemplate[] {\n const out: RecipeTemplate[] = []\n for (const { source, ...row } of rows) {\n try {\n const recipe = JSON.parse(source)\n if (recipe && typeof recipe.name === 'string' && Array.isArray(recipe.steps)) out.push({ ...row, recipe })\n } catch {\n /* not a recipe */\n }\n }\n return out\n}\n\n/** A part the recipe makes, as the catalog names it: its own name, the placeholder left off. */\nexport const recipePartName = (part: string) => part.replace(/^\\{id\\}-/, '')\n\n/**\n * How a template works, in lines the catalog shows -- worked out from its steps (figure-model `describeV3Recipe`), each\n * a translation key and its words.\n */\nexport function recipeWorkings(recipe: V3Recipe): Array<{ key: string; words: Record<string, string | number> }> {\n const d = describeV3Recipe(recipe)\n const lines: Array<{ key: string; words: Record<string, string | number> }> = []\n for (const m of d.moves)\n lines.push(\n m.follows\n ? { key: 'figure.text.recipe-moves-with', words: { part: recipePartName(m.part), leader: recipePartName(m.follows) } }\n : { key: m.kind === 'slide' ? 'figure.text.recipe-slides' : 'figure.text.recipe-turns', words: { part: recipePartName(m.part) } }\n )\n if (d.controls.length) lines.push({ key: 'figure.text.recipe-controls', words: { count: d.controls.length } })\n if (d.shownByControl.length) lines.push({ key: 'figure.text.recipe-shown-by-control', words: { parts: d.shownByControl.map(recipePartName).join(', ') } })\n for (const row of d.rows) lines.push({ key: 'figure.text.recipe-row', words: { part: recipePartName(row) } })\n return lines\n}\n\n/** A recipe's words in the language on screen: that language, else English, else the first it has. */\nexport function recipeWord(words: Record<string, string> | undefined, language: string): string {\n if (!words) return ''\n return words[language] ?? words[language.split('-')[0]!] ?? words.en ?? Object.values(words)[0] ?? ''\n}\n\n/** Whether a recipe can be put in now: one for a part needs a part chosen. */\nexport function recipeReady(recipe: Pick<V3Recipe, 'target'>, selected: string): boolean {\n return recipe.target === 'figure' || !!selected\n}\n\n/**\n * A field's value as the recipe takes it. A ratio is shown and typed as a percentage (35 for 0.35), since that is how a\n * person says a share; the rest are taken as they are. A number field left empty or not a number keeps the default.\n */\nexport function recipeValueOf(param: V3RecipeParam, typed: string | boolean): V3RecipeValue {\n if (param.kind === 'flag') return typed === true || typed === 'true'\n if (param.kind === 'ratio' || param.kind === 'mm') {\n const n = typeof typed === 'string' && typed.trim() !== '' ? Number(typed) : NaN\n if (!Number.isFinite(n)) return param.default\n return param.kind === 'ratio' ? Math.round(n * 1e4) / 1e6 : n\n }\n const option = (param.options ?? []).find(o => String(o) === String(typed))\n return option ?? param.default\n}\n\n/** What a field shows for a value: a ratio as a percentage. */\nexport function recipeFieldOf(param: V3RecipeParam, value: V3RecipeValue): string {\n if (param.kind === 'ratio' && typeof value === 'number') return String(Math.round(value * 1e6) / 1e4)\n return String(value)\n}\n\n\n/** The templates a category and words find: a word matches the title, the description, the name or a tag. */\nexport function recipesMatching<T extends { category: string; title: string; description: string; name: string; tags: string[] }>(templates: readonly T[], category: string, query: string): T[] {\n const words = query.trim().toLowerCase().split(/\\s+/).filter(Boolean)\n return templates.filter(t => {\n if (category && t.category !== category) return false\n const text = [t.title, t.description, t.name, ...t.tags].join(' ').toLowerCase()\n return words.every(w => text.includes(w))\n })\n}\n"]}
1
+ {"version":3,"file":"v3-recipes.js","sourceRoot":"","sources":["../../client/modeller/v3-recipes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAUzD;;GAEG;AAEH,+GAA+G;AAC/G,MAAM,UAAU,WAAW,CAAC,IAAsC;IAChE,MAAM,GAAG,GAAqB,EAAE,CAAA;IAChC,KAAK,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YACjC,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,K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,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACzG,CAAC","sourcesContent":["import { describeV3Recipe } from '@hatiolab/figure-model'\nimport type { V3Recipe, V3RecipeParam, V3RecipeValue } from '@hatiolab/figure-model'\n\nimport type { RecipeTemplateRow } from '../graphql/index.js'\n\n/** A template in the catalog: the server's row, its recipe parsed. */\nexport interface RecipeTemplate extends Omit<RecipeTemplateRow, 'source'> {\n recipe: V3Recipe\n}\n\n/*\n * The recipe section's rules (ADR-0095), kept apart from the element so they can be tested without a browser.\n */\n\n/** The server's rows as templates. A row that is not a recipe is left out rather than breaking the catalog. */\nexport function templatesOf(rows: ReadonlyArray<RecipeTemplateRow>): RecipeTemplate[] {\n const out: RecipeTemplate[] = []\n for (const { source, ...row } of rows) {\n try {\n const recipe = JSON.parse(source)\n if (recipe && typeof recipe.name === 'string' && Array.isArray(recipe.steps)) out.push({ ...row, recipe })\n } catch {\n /* not a recipe */\n }\n }\n return out\n}\n\n/** A part the recipe makes, as the catalog names it: its own name, the placeholder left off. */\nexport const recipePartName = (part: string) => part.replace(/^\\{id\\}-/, '')\n\n/**\n * How a template works, in lines the catalog shows -- worked out from its steps (figure-model `describeV3Recipe`), each\n * a translation key and its words.\n */\nexport function recipeWorkings(recipe: V3Recipe): Array<{ key: string; words: Record<string, string | number> }> {\n const d = describeV3Recipe(recipe)\n const lines: Array<{ key: string; words: Record<string, string | number> }> = []\n for (const m of d.moves)\n lines.push(\n m.follows\n ? { key: 'figure.text.recipe-moves-with', words: { part: recipePartName(m.part), leader: recipePartName(m.follows) } }\n : { key: m.kind === 'slide' ? 'figure.text.recipe-slides' : 'figure.text.recipe-turns', words: { part: recipePartName(m.part) } }\n )\n if (d.controls.length) lines.push({ key: 'figure.text.recipe-controls', words: { count: d.controls.length } })\n if (d.shownByControl.length) lines.push({ key: 'figure.text.recipe-shown-by-control', words: { parts: d.shownByControl.map(recipePartName).join(', ') } })\n for (const row of d.rows) lines.push({ key: 'figure.text.recipe-row', words: { part: recipePartName(row) } })\n return lines\n}\n\n/** A recipe's words in the language on screen: that language, else English, else the first it has. */\nexport function recipeWord(words: Record<string, string> | undefined, language: string): string {\n if (!words) return ''\n return words[language] ?? words[language.split('-')[0]!] ?? words.en ?? Object.values(words)[0] ?? ''\n}\n\n/** Whether a recipe can be put in now: one for a part needs a part chosen. */\nexport function recipeReady(recipe: Pick<V3Recipe, 'target'>, selected: string): boolean {\n return recipe.target === 'figure' || !!selected\n}\n\n/**\n * A field's value as the recipe takes it. A ratio is shown and typed as a percentage (35 for 0.35), since that is how a\n * person says a share; the rest are taken as they are. A number field left empty or not a number keeps the default.\n */\nexport function recipeValueOf(param: V3RecipeParam, typed: string | boolean): V3RecipeValue {\n if (param.kind === 'flag') return typed === true || typed === 'true'\n if (param.kind === 'ratio' || param.kind === 'mm') {\n const n = typeof typed === 'string' && typed.trim() !== '' ? Number(typed) : NaN\n if (!Number.isFinite(n)) return param.default\n return param.kind === 'ratio' ? Math.round(n * 1e4) / 1e6 : n\n }\n const option = (param.options ?? []).find(o => String(o) === String(typed))\n return option ?? param.default\n}\n\n/** What a field shows for a value: a ratio as a percentage. */\nexport function recipeFieldOf(param: V3RecipeParam, value: V3RecipeValue): string {\n if (param.kind === 'ratio' && typeof value === 'number') return String(Math.round(value * 1e6) / 1e4)\n return String(value)\n}\n\n\n/** The templates a category and words find: a word matches the title, the description, the name or a tag. */\nexport function recipesMatching<T extends { category: string; title: string; description: string; name: string; tags: string[] }>(templates: readonly T[], category: string, query: string): T[] {\n const words = query.trim().toLowerCase().split(/\\s+/).filter(Boolean)\n const found = templates.filter(t => {\n if (category && t.category !== category) return false\n const text = [t.title, t.description, t.name, ...t.tags].join(' ').toLowerCase()\n return words.every(w => text.includes(w))\n })\n if (!words.length) return found\n /*\n What the search names comes first: a title that is the words, then one that starts with them, then a title word that\n does, then the rest in their order. 「다리」 listed 사다리 before 다리 넷 (walk 1, 2026-09-26).\n */\n const rank = (t: T) => {\n const title = t.title.toLowerCase()\n const query = words.join(' ')\n if (title === query) return 0\n if (title.startsWith(query)) return 1\n if (words.every(w => title.split(/\\s+/).some(part => part.startsWith(w)))) return 2\n if (words.every(w => title.includes(w))) return 3\n return 4\n }\n return found.map((t, i) => ({ t, i, r: rank(t) })).sort((a, b) => a.r - b.r || a.i - b.i).map(x => x.t)\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "figure-list" | "figure-modeller" | "figure-v3-modeller" | undefined;
1
+ export default function route(page: string): "figure-modeller" | "figure-list" | "figure-v3-modeller" | undefined;