@things-factory/figure-ui 10.1.62 → 10.1.63

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 (37) hide show
  1. package/client/modeller/figure-v3-links.ts +4 -1
  2. package/client/modeller/figure-v3-properties.ts +3 -1
  3. package/client/modeller/figure-view.ts +1 -1
  4. package/client/modeller/v3-editor.ts +4 -2
  5. package/client/modeller/v3-figure-facts.ts +1 -1
  6. package/client/modeller/v3-links.ts +12 -1
  7. package/client/modeller/v3-occupancy.ts +1 -1
  8. package/client/modeller/v3-refusals.ts +12 -0
  9. package/dist-client/modeller/figure-v3-links.js +4 -2
  10. package/dist-client/modeller/figure-v3-links.js.map +1 -1
  11. package/dist-client/modeller/figure-v3-properties.js +3 -1
  12. package/dist-client/modeller/figure-v3-properties.js.map +1 -1
  13. package/dist-client/modeller/figure-view.d.ts +1 -1
  14. package/dist-client/modeller/figure-view.js.map +1 -1
  15. package/dist-client/modeller/v3-clips.d.ts +1 -1
  16. package/dist-client/modeller/v3-editor.js +4 -2
  17. package/dist-client/modeller/v3-editor.js.map +1 -1
  18. package/dist-client/modeller/v3-figure-facts.d.ts +1 -1
  19. package/dist-client/modeller/v3-figure-facts.js.map +1 -1
  20. package/dist-client/modeller/v3-links.d.ts +8 -0
  21. package/dist-client/modeller/v3-links.js +11 -2
  22. package/dist-client/modeller/v3-links.js.map +1 -1
  23. package/dist-client/modeller/v3-occupancy.d.ts +1 -1
  24. package/dist-client/modeller/v3-occupancy.js.map +1 -1
  25. package/dist-client/modeller/v3-refusals.d.ts +5 -0
  26. package/dist-client/modeller/v3-refusals.js +13 -0
  27. package/dist-client/modeller/v3-refusals.js.map +1 -1
  28. package/dist-client/tsconfig.fui.tsbuildinfo +1 -0
  29. package/dist-client/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +5 -5
  31. package/test/v3-links.test.ts +11 -0
  32. package/test/v3-refusals.test.ts +16 -0
  33. package/translations/en.json +4 -2
  34. package/translations/ja.json +4 -2
  35. package/translations/ko.json +4 -2
  36. package/translations/ms.json +4 -2
  37. package/translations/zh.json +4 -2
@@ -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'\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 — the V2 inspector's rule: 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-fac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AAG,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 — the V2 inspector's rule: 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"]}
@@ -85,6 +85,14 @@ export type Alignment = 'centre' | 'min' | 'max' | 'mm' | 'share';
85
85
  * are offered where both parts have their two outer faces on that axis; the plane the figure is mounted on has none,
86
86
  * so on it (X and Z) only centred or a distance is offered.
87
87
  */
88
+ /**
89
+ * The mounting plane of this figure, by its placement (ADR-0093): the floor or the ceiling is Y = 0 and a part stands
90
+ * 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.
91
+ */
92
+ export declare function mountingPlaneOf(asset: V3Asset): {
93
+ normal: Axis;
94
+ faces: V3Face[];
95
+ };
88
96
  export declare function alignAxesOf(asset: V3Asset, part: string, target: {
89
97
  part: string;
90
98
  face: string;
@@ -163,10 +163,19 @@ export const rowOf = (asset, part) => asset.joints?.find(o => o.body1.part === p
163
163
  * are offered where both parts have their two outer faces on that axis; the plane the figure is mounted on has none,
164
164
  * so on it (X and Z) only centred or a distance is offered.
165
165
  */
166
+ /**
167
+ * The mounting plane of this figure, by its placement (ADR-0093): the floor or the ceiling is Y = 0 and a part stands
168
+ * 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.
169
+ */
170
+ export function mountingPlaneOf(asset) {
171
+ return asset.occupancy?.placement === 'wall' ? { normal: 'z', faces: ['back'] } : { normal: 'y', faces: ['bottom', 'top'] };
172
+ }
166
173
  export function alignAxesOf(asset, part, target, twisted = false) {
167
174
  /* The plane has no edges, but a figure that declares its size has sides on it (figure-model 0.1.64). */
168
- if (target === 'plane')
169
- return ['x', 'z'].map(axis => ({ axis, edges: !twisted && hasInstanceSize(asset, axis) }));
175
+ if (target === 'plane') {
176
+ const { normal } = mountingPlaneOf(asset);
177
+ return AXES.filter(axis => axis !== normal).map(axis => ({ axis, edges: !twisted && hasInstanceSize(asset, axis) }));
178
+ }
170
179
  const along = faceAxisOf(asset, target.part, target.face);
171
180
  if (!along)
172
181
  return [];
@@ -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,mBAAmB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,eAAe,EAAE,YA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ion, defaultInstanceSizeRange, foldInstanceSizeRange, v3AttachmentsOf, v3BindingsOf, v3InstanceSizeLimitsOf } from '@hatiolab/figure-model'\nimport type { 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 (parity rows\n * ④ ⑤ ⑥). 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. */\nexport type Follow =\n | { of: 'own' }\n /** `times` 1 is the instance size itself; any other is a share of it -- V2's proportional rule. */\n | { of: 'instance'; axis: Axis; times: number; plus?: number }\n | { of: 'part'; part: string; axis: Axis; times?: number; plus?: number }\n | { of: 'input'; input: string }\n /** Worked out some other way (the converter writes expressions) — shown, not offered as a choice. */\n | { of: 'expression' }\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 */\nexport function followOf(asset: V3Asset, part: string, axis: Axis): Follow {\n const m = modelOf(asset)\n /*\n A link routes the dimension through `<part>.dimension.<axis>`; before any link the shape reads its measure directly,\n and that may already be worked out -- the converter writes V2's rules there (ROBOT_ARM's flange filled what was left).\n */\n const node = m.nodes.find(n => n.id === `${part}.dimension.${axis}`)\n const start = node ? node.args[0] : m.nodes.find(n => n.id === `${part}.shape`)?.args[AXES.indexOf(axis)]\n if (!start || m.constants.some(c => c.id === start)) return { of: 'own' }\n const writerOf = (ref: string) => m.nodes.find(n => Object.values(n.outputs).includes(ref))\n const seen = new Set<string>()\n const constant = (ref: string) => m.constants.find(c => c.id === ref)\n /* The constant factors met on the way back: a share of the instance size is `size × share`. */\n let times = 1\n /*\n A link the author made is `source × times + plus` (link-dimension): its outermost sum with a number is the plus --\n a leaf the opening's width less its gaps. Deeper sums, or a measure no link routes, read as worked out elsewhere.\n */\n let plus = 0\n let at = start\n const outer = node && writerOf(start)\n if (outer?.op === 'add@1') {\n const numbers = outer.args.filter(arg => constant(arg))\n const onward = outer.args.filter(arg => !constant(arg))\n if (numbers.length === 1 && onward.length === 1) {\n plus = constant(numbers[0]!)!.value\n at = onward[0]!\n }\n }\n const withPlus = <T extends object>(f: T) => (plus ? { ...f, plus } : f)\n const walk = (ref: string): Follow => {\n if (seen.has(ref)) return { of: 'expression' }\n seen.add(ref)\n const instance = /^size\\.([xyz])$/.exec(ref)\n if (instance) return withPlus({ of: 'instance' as const, axis: instance[1] as Axis, times: Math.round(times * 1e6) / 1e6 })\n const other = /^(.+)\\.dimension\\.([xyz])\\.value$/.exec(ref)\n if (other) return withPlus({ of: 'part' as const, part: other[1]!, axis: other[2] as Axis, ...(times !== 1 ? { times: Math.round(times * 1e6) / 1e6 } : {}) })\n const input = m.inputs.find(i => i.id === ref)\n if (input) return ref.startsWith(`${part}.`) ? { of: 'own' } : { of: 'input', input: ref }\n const writer = writerOf(ref)\n if (!writer) return { of: 'expression' }\n /* Follow the one argument that is not a constant factor. */\n const onward = writer.args.filter(arg => !constant(arg))\n if (onward.length !== 1) return { of: 'expression' }\n /*\n Only a product is a share of its source. A sum with a number is not (V2's 「fill what is left」 is the size plus a\n negative gap -- ROBOT_ARM's tool flange), nor anything else; those read as worked out some other way.\n */\n const factors = writer.args.filter(arg => constant(arg)).map(arg => constant(arg)!.value)\n if (writer.op === 'mul@1') times *= factors.reduce((a, b) => a * b, 1)\n else if (writer.op === 'div@1' && writer.args[0] === onward[0] && factors.length === 1 && factors[0] !== 0) times /= factors[0]!\n else if (factors.some(v => v !== 0) || !['mul@1', 'div@1', 'add@1', 'sub@1'].includes(writer.op)) return { of: 'expression' }\n return walk(onward[0]!)\n }\n return walk(at)\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 (V2's sizing cards had the cylinder's\n * two as well).\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 if (shape.op === 'box-shape@1' || shape.op === 'rounded-box@1') 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 */\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') return (['x', 'z'] as Axis[]).map(axis => ({ axis, edges: !twisted && hasInstanceSize(asset, axis) }))\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 `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 — the\n * converter writes V2's anchor rules that way. `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 the converter'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,mBAAmB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAU7N,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;AAYhM;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc,EAAE,IAAY,EAAE,IA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C,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import { V3_FACES, v3ShapeFaces, v3PartsExtentOf, compileV3Graph, proposeV3Proportion, defaultInstanceSizeRange, foldInstanceSizeRange, v3AttachmentsOf, v3BindingsOf, v3InstanceSizeLimitsOf } from '@hatiolab/figure-model'\nimport type { 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 (parity rows\n * ④ ⑤ ⑥). 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. */\nexport type Follow =\n | { of: 'own' }\n /** `times` 1 is the instance size itself; any other is a share of it -- V2's proportional rule. */\n | { of: 'instance'; axis: Axis; times: number; plus?: number }\n | { of: 'part'; part: string; axis: Axis; times?: number; plus?: number }\n | { of: 'input'; input: string }\n /** Worked out some other way (the converter writes expressions) — shown, not offered as a choice. */\n | { of: 'expression' }\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 */\nexport function followOf(asset: V3Asset, part: string, axis: Axis): Follow {\n const m = modelOf(asset)\n /*\n A link routes the dimension through `<part>.dimension.<axis>`; before any link the shape reads its measure directly,\n and that may already be worked out -- the converter writes V2's rules there (ROBOT_ARM's flange filled what was left).\n */\n const node = m.nodes.find(n => n.id === `${part}.dimension.${axis}`)\n const start = node ? node.args[0] : m.nodes.find(n => n.id === `${part}.shape`)?.args[AXES.indexOf(axis)]\n if (!start || m.constants.some(c => c.id === start)) return { of: 'own' }\n const writerOf = (ref: string) => m.nodes.find(n => Object.values(n.outputs).includes(ref))\n const seen = new Set<string>()\n const constant = (ref: string) => m.constants.find(c => c.id === ref)\n /* The constant factors met on the way back: a share of the instance size is `size × share`. */\n let times = 1\n /*\n A link the author made is `source × times + plus` (link-dimension): its outermost sum with a number is the plus --\n a leaf the opening's width less its gaps. Deeper sums, or a measure no link routes, read as worked out elsewhere.\n */\n let plus = 0\n let at = start\n const outer = node && writerOf(start)\n if (outer?.op === 'add@1') {\n const numbers = outer.args.filter(arg => constant(arg))\n const onward = outer.args.filter(arg => !constant(arg))\n if (numbers.length === 1 && onward.length === 1) {\n plus = constant(numbers[0]!)!.value\n at = onward[0]!\n }\n }\n const withPlus = <T extends object>(f: T) => (plus ? { ...f, plus } : f)\n const walk = (ref: string): Follow => {\n if (seen.has(ref)) return { of: 'expression' }\n seen.add(ref)\n const instance = /^size\\.([xyz])$/.exec(ref)\n if (instance) return withPlus({ of: 'instance' as const, axis: instance[1] as Axis, times: Math.round(times * 1e6) / 1e6 })\n const other = /^(.+)\\.dimension\\.([xyz])\\.value$/.exec(ref)\n if (other) return withPlus({ of: 'part' as const, part: other[1]!, axis: other[2] as Axis, ...(times !== 1 ? { times: Math.round(times * 1e6) / 1e6 } : {}) })\n const input = m.inputs.find(i => i.id === ref)\n if (input) return ref.startsWith(`${part}.`) ? { of: 'own' } : { of: 'input', input: ref }\n const writer = writerOf(ref)\n if (!writer) return { of: 'expression' }\n /* Follow the one argument that is not a constant factor. */\n const onward = writer.args.filter(arg => !constant(arg))\n if (onward.length !== 1) return { of: 'expression' }\n /*\n Only a product is a share of its source. A sum with a number is not (V2's 「fill what is left」 is the size plus a\n negative gap -- ROBOT_ARM's tool flange), nor anything else; those read as worked out some other way.\n */\n const factors = writer.args.filter(arg => constant(arg)).map(arg => constant(arg)!.value)\n if (writer.op === 'mul@1') times *= factors.reduce((a, b) => a * b, 1)\n else if (writer.op === 'div@1' && writer.args[0] === onward[0] && factors.length === 1 && factors[0] !== 0) times /= factors[0]!\n else if (factors.some(v => v !== 0) || !['mul@1', 'div@1', 'add@1', 'sub@1'].includes(writer.op)) return { of: 'expression' }\n return walk(onward[0]!)\n }\n return walk(at)\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 (V2's sizing cards had the cylinder's\n * two as well).\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 if (shape.op === 'box-shape@1' || shape.op === 'rounded-box@1') 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 `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 — the\n * converter writes V2's anchor rules that way. `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 the converter'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"]}
@@ -13,6 +13,6 @@ import { type V3AuthoringAction } from '@hatiolab/figure-model';
13
13
  */
14
14
  export declare function occupancyFromParts(source: string,
15
15
  /** A different face to place it by — the properties tab's choice. Absent keeps the declared one. */
16
- placement?: 'floor' | 'ceiling' | 'center'): Extract<V3AuthoringAction, {
16
+ placement?: 'floor' | 'ceiling' | 'center' | 'wall'): Extract<V3AuthoringAction, {
17
17
  kind: 'declare-occupancy';
18
18
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"v3-occupancy.js","sourceRoot":"","sources":["../../client/modeller/v3-occupancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAA0B,MAAM,wBAAwB,CAAA;AAEjG;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc;AACd,oGAAoG;AACpG,SAA0C;IAE1C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAA;IAClC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,kBAAkB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACtD,SAAS,EAAE,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,OAAO;KAC9D,CAAA;AACH,CAAC","sourcesContent":["import { parseV3Asset, proposeV3Occupancy, type V3AuthoringAction } from '@hatiolab/figure-model'\n\n/**\n * 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.\n *\n * figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인\n * (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인\n * 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한\n * 번에 만든다.\n *\n * 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시\n * 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의\n * 모델러 기본이 바닥이다.\n */\nexport function occupancyFromParts(\n source: string,\n /** A different face to place it by — the properties tab's choice. Absent keeps the declared one. */\n placement?: 'floor' | 'ceiling' | 'center'\n): Extract<V3AuthoringAction, { kind: 'declare-occupancy' }> {\n const asset = parseV3Asset(source)\n return {\n kind: 'declare-occupancy',\n proposal: proposeV3Occupancy(asset, { over: 'range' }),\n placement: placement ?? asset.occupancy?.placement ?? 'floor'\n }\n}\n"]}
1
+ {"version":3,"file":"v3-occupancy.js","sourceRoot":"","sources":["../../client/modeller/v3-occupancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAA0B,MAAM,wBAAwB,CAAA;AAEjG;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc;AACd,oGAAoG;AACpG,SAAmD;IAEnD,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAA;IAClC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,kBAAkB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACtD,SAAS,EAAE,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,OAAO;KAC9D,CAAA;AACH,CAAC","sourcesContent":["import { parseV3Asset, proposeV3Occupancy, type V3AuthoringAction } from '@hatiolab/figure-model'\n\n/**\n * 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.\n *\n * figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인\n * (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인\n * 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한\n * 번에 만든다.\n *\n * 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시\n * 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의\n * 모델러 기본이 바닥이다.\n */\nexport function occupancyFromParts(\n source: string,\n /** A different face to place it by — the properties tab's choice. Absent keeps the declared one. */\n placement?: 'floor' | 'ceiling' | 'center' | 'wall'\n): Extract<V3AuthoringAction, { kind: 'declare-occupancy' }> {\n const asset = parseV3Asset(source)\n return {\n kind: 'declare-occupancy',\n proposal: proposeV3Occupancy(asset, { over: 'range' }),\n placement: placement ?? asset.occupancy?.placement ?? 'floor'\n }\n}\n"]}
@@ -19,6 +19,11 @@ export declare function narrowingRetryOf<A extends {
19
19
  * from it, the declared space holds it, another part follows its size or place, or a joint moves with its joint. One
20
20
  * sentence for all of them told the author to undo a link that was not there (the architect's workbench, 2026-09-25).
21
21
  */
22
+ /**
23
+ * A placement refused because a part is fastened to the mounting plane by a face the new plane does not take (a bottom
24
+ * on the floor, when the figure is to hang on a wall), said in the author's words with the parts it names.
25
+ */
26
+ export declare function placementRefusalOf(error: unknown, say: Say): string | null;
22
27
  /** A part refused because the declared room reads it -- the one refusal deleting it with the room refitted answers. */
23
28
  export declare function inDeclaredRoom(error: unknown): boolean;
24
29
  export declare function partRefusalOf(error: unknown, part: string, say: Say): string | null;
@@ -43,6 +43,19 @@ export function narrowingRetryOf(action, error, say) {
43
43
  * from it, the declared space holds it, another part follows its size or place, or a joint moves with its joint. One
44
44
  * sentence for all of them told the author to undo a link that was not there (the architect's workbench, 2026-09-25).
45
45
  */
46
+ /**
47
+ * A placement refused because a part is fastened to the mounting plane by a face the new plane does not take (a bottom
48
+ * on the floor, when the figure is to hang on a wall), said in the author's words with the parts it names.
49
+ */
50
+ export function placementRefusalOf(error, say) {
51
+ if (error?.code !== 'PLACEMENT_PLANE')
52
+ return null;
53
+ const message = error instanceof Error ? error.message : String(error);
54
+ const found = /: (.+?) (?:is|are) fastened to the mounting plane by a face an? (\w+) does not take \(([^)]+)\)/.exec(message);
55
+ if (!found)
56
+ return null;
57
+ return say('figure.text.placement-plane-refused', { parts: found[1], placement: say('figure.label.placement-' + found[2], {}), faces: found[3] });
58
+ }
46
59
  /** A part refused because the declared room reads it -- the one refusal deleting it with the room refitted answers. */
47
60
  export function inDeclaredRoom(error) {
48
61
  return error?.code === 'PART_REFERENCED' && /is in the space the figure declares/.test(error instanceof Error ? error.message : String(error));
@@ -1 +1 @@
1
- {"version":3,"file":"v3-refusals.js","sourceRoot":"","sources":["../../client/modeller/v3-refusals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,KAAc,EAAE,GAAQ;IACzD,IAAK,KAA2B,EAAE,IAAI,KAAK,qBAAqB;QAAE,OAAO,IAAI,CAAA;IAC7E,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtE,MAAM,KAAK,GAAG,oEAAoE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAChG,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,KAAK,CAAA;IACtC,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,kCAAkC,EAAE;QACrG,IAAI,EAAE,IAAK,CAAC,WAAW,EAAE;QACzB,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC;QACtE,IAAI,EAAE,IAAI,IAAI,EAAE;KACjB,CAAC,CAAA;AACJ,CAAC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,EAAE,CAAC,CAAA;AACxD,CAAC","sourcesContent":["/*\n * A command refused because the figure could not be drawn at an end of its declared size range, in the author's words\n * with the numbers and where to put it right -- not the kernel's English (user, 2026-09-24: 「what is this warning\n * message means?」). Kept apart from the element so it is tested without a browser.\n */\n\ntype Say = (key: string, params: Record<string, string>) => string\n\n/** The refusal in words, or nothing for any other refusal. */\nexport function sizeRangeRefusalOf(error: unknown, say: Say): string | null {\n if ((error as { code?: string })?.code !== 'INSTANCE_SIZE_RANGE') return null\n const message = error instanceof Error ? error.message : String(error)\n const found = /size\\.([xyz]):\\s*(below|above) ([\\d.]+) mm [^(;]*(?:\\(([^)]+)\\))?;/.exec(message)\n if (!found) return null\n const [, axis, side, mm, part] = found\n return say(side === 'below' ? 'figure.text.size-range-too-small' : 'figure.text.size-range-too-large', {\n axis: axis!.toUpperCase(),\n mm: Number(mm).toLocaleString(undefined, { maximumFractionDigits: 1 }),\n part: part ?? ''\n })\n}\n\n/**\n * A link refused because the size range it would leave cannot hold: measuring again cannot help (the link is not there\n * to measure), so the author is offered the same link that narrows the range to what the figure then allows.\n */\nexport function narrowingRetryOf<A extends { kind: string }>(action: A, error: unknown, say: Say): { message: string; label: string; retry: A & { narrowRange: true } } | null {\n if (action.kind !== 'link-dimension' || (error as { code?: string })?.code !== 'INSTANCE_SIZE_RANGE') return null\n const message = error instanceof Error ? error.message : String(error)\n const found = /size\\.([xyz]):\\s*(below|above) ([\\d.]+) mm [^(;]*(?:\\(([^)]+)\\))?;/.exec(message)\n if (!found) return null\n const [, axis, side, raw, part] = found\n const mm = Number(raw).toLocaleString(undefined, { maximumFractionDigits: 1 })\n const words = { axis: axis!.toUpperCase(), mm, part: part ?? '' }\n return {\n message: say(side === 'below' ? 'figure.text.link-needs-smaller-range' : 'figure.text.link-needs-larger-range', words),\n label: say(side === 'below' ? 'figure.button.narrow-range-from' : 'figure.button.narrow-range-to', words),\n retry: { ...action, narrowRange: true }\n }\n}\n\n/**\n * Why a part cannot be deleted, in the author's words -- figure-model names four reasons (PART_REFERENCED): parts hang\n * from it, the declared space holds it, another part follows its size or place, or a joint moves with its joint. One\n * sentence for all of them told the author to undo a link that was not there (the architect's workbench, 2026-09-25).\n */\n/** A part refused because the declared room reads it -- the one refusal deleting it with the room refitted answers. */\nexport function inDeclaredRoom(error: unknown): boolean {\n return (error as { code?: string })?.code === 'PART_REFERENCED' && /is in the space the figure declares/.test(error instanceof Error ? error.message : String(error))\n}\n\nexport function partRefusalOf(error: unknown, part: string, say: Say): string | null {\n if ((error as { code?: string })?.code !== 'PART_REFERENCED') return null\n /* figure-model's sentence after its code and path: 「PART_REFERENCED: top: top holds leg-2, lamp; …」. */\n const message = (error instanceof Error ? error.message : String(error)).replace(/^[A-Z_]+: [^:]+: /, '')\n const holds = / holds (.+?); take (?:them|it) off first/.exec(message)\n if (holds) return say('figure.text.part-holds-others', { part, others: holds[1]! })\n if (/is in the space the figure declares/.test(message)) return say('figure.text.part-in-declared-space', { part })\n const moves = /^(.+?) (?:moves|move) with /.exec(message)\n if (moves) return say('figure.text.part-is-led', { part, others: moves[1]! })\n const follows = /^(.+?) (?:follows|follow) .+'s size or place/.exec(message)\n if (follows) return say('figure.text.part-is-followed', { part, others: follows[1]! })\n return say('figure.text.part-is-referenced', { part })\n}\n"]}
1
+ {"version":3,"file":"v3-refusals.js","sourceRoot":"","sources":["../../client/modeller/v3-refusals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,KAAc,EAAE,GAAQ;IACzD,IAAK,KAA2B,EAAE,IAAI,KAAK,qBAAqB;QAAE,OAAO,IAAI,CAAA;IAC7E,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtE,MAAM,KAAK,GAAG,oEAAoE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAChG,IAA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AAC,KAAc,EAAE,IAAY,EAAE,GAAQ;IAClE,IAAK,KAA2B,EAAE,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAA;IACzE,wGAAwG;IACxG,MAAM,OAAO,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAA;IACzG,MAAM,KAAK,GAAG,0CAA0C,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACtE,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC,+BAA+B,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,CAAC,CAAA;IACnF,IAAI,qCAAqC,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,GAAG,CAAC,oCAAoC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACnH,MAAM,KAAK,GAAG,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACzD,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,CAAC,CAAA;IAC7E,MAAM,OAAO,GAAG,8CAA8C,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC5E,IAAI,OAAO;QAAE,OAAO,GAAG,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAE,EAAE,CAAC,CAAA;IACtF,OAAO,GAAG,CAAC,gCAAgC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AACxD,CAAC","sourcesContent":["/*\n * A command refused because the figure could not be drawn at an end of its declared size range, in the author's words\n * with the numbers and where to put it right -- not the kernel's English (user, 2026-09-24: 「what is this warning\n * message means?」). Kept apart from the element so it is tested without a browser.\n */\n\ntype Say = (key: string, params: Record<string, string>) => string\n\n/** The refusal in words, or nothing for any other refusal. */\nexport function sizeRangeRefusalOf(error: unknown, say: Say): string | null {\n if ((error as { code?: string })?.code !== 'INSTANCE_SIZE_RANGE') return null\n const message = error instanceof Error ? error.message : String(error)\n const found = /size\\.([xyz]):\\s*(below|above) ([\\d.]+) mm [^(;]*(?:\\(([^)]+)\\))?;/.exec(message)\n if (!found) return null\n const [, axis, side, mm, part] = found\n return say(side === 'below' ? 'figure.text.size-range-too-small' : 'figure.text.size-range-too-large', {\n axis: axis!.toUpperCase(),\n mm: Number(mm).toLocaleString(undefined, { maximumFractionDigits: 1 }),\n part: part ?? ''\n })\n}\n\n/**\n * A link refused because the size range it would leave cannot hold: measuring again cannot help (the link is not there\n * to measure), so the author is offered the same link that narrows the range to what the figure then allows.\n */\nexport function narrowingRetryOf<A extends { kind: string }>(action: A, error: unknown, say: Say): { message: string; label: string; retry: A & { narrowRange: true } } | null {\n if (action.kind !== 'link-dimension' || (error as { code?: string })?.code !== 'INSTANCE_SIZE_RANGE') return null\n const message = error instanceof Error ? error.message : String(error)\n const found = /size\\.([xyz]):\\s*(below|above) ([\\d.]+) mm [^(;]*(?:\\(([^)]+)\\))?;/.exec(message)\n if (!found) return null\n const [, axis, side, raw, part] = found\n const mm = Number(raw).toLocaleString(undefined, { maximumFractionDigits: 1 })\n const words = { axis: axis!.toUpperCase(), mm, part: part ?? '' }\n return {\n message: say(side === 'below' ? 'figure.text.link-needs-smaller-range' : 'figure.text.link-needs-larger-range', words),\n label: say(side === 'below' ? 'figure.button.narrow-range-from' : 'figure.button.narrow-range-to', words),\n retry: { ...action, narrowRange: true }\n }\n}\n\n/**\n * Why a part cannot be deleted, in the author's words -- figure-model names four reasons (PART_REFERENCED): parts hang\n * from it, the declared space holds it, another part follows its size or place, or a joint moves with its joint. One\n * sentence for all of them told the author to undo a link that was not there (the architect's workbench, 2026-09-25).\n */\n/**\n * A placement refused because a part is fastened to the mounting plane by a face the new plane does not take (a bottom\n * on the floor, when the figure is to hang on a wall), said in the author's words with the parts it names.\n */\nexport function placementRefusalOf(error: unknown, say: Say): string | null {\n if ((error as { code?: string })?.code !== 'PLACEMENT_PLANE') return null\n const message = error instanceof Error ? error.message : String(error)\n const found = /: (.+?) (?:is|are) fastened to the mounting plane by a face an? (\\w+) does not take \\(([^)]+)\\)/.exec(message)\n if (!found) return null\n return say('figure.text.placement-plane-refused', { parts: found[1]!, placement: say('figure.label.placement-' + found[2]!, {}), faces: found[3]! })\n}\n\n/** A part refused because the declared room reads it -- the one refusal deleting it with the room refitted answers. */\nexport function inDeclaredRoom(error: unknown): boolean {\n return (error as { code?: string })?.code === 'PART_REFERENCED' && /is in the space the figure declares/.test(error instanceof Error ? error.message : String(error))\n}\n\nexport function partRefusalOf(error: unknown, part: string, say: Say): string | null {\n if ((error as { code?: string })?.code !== 'PART_REFERENCED') return null\n /* figure-model's sentence after its code and path: 「PART_REFERENCED: top: top holds leg-2, lamp; …」. */\n const message = (error instanceof Error ? error.message : String(error)).replace(/^[A-Z_]+: [^:]+: /, '')\n const holds = / holds (.+?); take (?:them|it) off first/.exec(message)\n if (holds) return say('figure.text.part-holds-others', { part, others: holds[1]! })\n if (/is in the space the figure declares/.test(message)) return say('figure.text.part-in-declared-space', { part })\n const moves = /^(.+?) (?:moves|move) with /.exec(message)\n if (moves) return say('figure.text.part-is-led', { part, others: moves[1]! })\n const follows = /^(.+?) (?:follows|follow) .+'s size or place/.exec(message)\n if (follows) return say('figure.text.part-is-followed', { part, others: follows[1]! })\n return say('figure.text.part-is-referenced', { part })\n}\n"]}