@things-factory/figure-ui 10.1.44 → 10.1.46

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 (129) hide show
  1. package/client/modeller/figure-v3-links.ts +394 -0
  2. package/client/modeller/modeller-route.ts +6 -21
  3. package/client/modeller/v3-editor.ts +47 -5
  4. package/client/modeller/v3-gizmo.ts +13 -2
  5. package/client/modeller/v3-links.ts +170 -0
  6. package/client/pages/figure-v3-modeller-page.ts +2 -5
  7. package/client/route.ts +2 -6
  8. package/dist-client/modeller/figure-v3-links.d.ts +47 -0
  9. package/dist-client/modeller/figure-v3-links.js +379 -0
  10. package/dist-client/modeller/figure-v3-links.js.map +1 -0
  11. package/dist-client/modeller/modeller-route.d.ts +4 -11
  12. package/dist-client/modeller/modeller-route.js +5 -22
  13. package/dist-client/modeller/modeller-route.js.map +1 -1
  14. package/dist-client/modeller/v3-editor.d.ts +5 -0
  15. package/dist-client/modeller/v3-editor.js +49 -4
  16. package/dist-client/modeller/v3-editor.js.map +1 -1
  17. package/dist-client/modeller/v3-gizmo.js +11 -1
  18. package/dist-client/modeller/v3-gizmo.js.map +1 -1
  19. package/dist-client/modeller/v3-links.d.ts +67 -0
  20. package/dist-client/modeller/v3-links.js +141 -0
  21. package/dist-client/modeller/v3-links.js.map +1 -0
  22. package/dist-client/pages/figure-v3-modeller-page.d.ts +2 -5
  23. package/dist-client/pages/figure-v3-modeller-page.js +2 -5
  24. package/dist-client/pages/figure-v3-modeller-page.js.map +1 -1
  25. package/dist-client/route.d.ts +1 -1
  26. package/dist-client/route.js +2 -5
  27. package/dist-client/route.js.map +1 -1
  28. package/dist-client/tsconfig.scratch-fm.tsbuildinfo +1 -0
  29. package/dist-client/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +4 -4
  31. package/test/ai-proposal-contract.test.ts +0 -88
  32. package/test/figure-source.test.ts +0 -102
  33. package/test/i18n-prefix-guard.test.ts +0 -24
  34. package/test/modeller-route.test.ts +14 -25
  35. package/test/part-edits.test.ts +0 -7
  36. package/test/scene-budget.test.ts +0 -7
  37. package/test/v3-gizmo.test.ts +10 -0
  38. package/test/v3-links.test.ts +163 -0
  39. package/things-factory.config.js +2 -5
  40. package/translations/en.json +21 -1
  41. package/translations/ja.json +21 -1
  42. package/translations/ko.json +21 -1
  43. package/translations/ms.json +21 -1
  44. package/translations/zh.json +21 -1
  45. package/client/modeller/angle-dial.ts +0 -70
  46. package/client/modeller/base-box.ts +0 -175
  47. package/client/modeller/figure-animations.ts +0 -1249
  48. package/client/modeller/figure-canvas.ts +0 -567
  49. package/client/modeller/figure-capabilities.ts +0 -379
  50. package/client/modeller/figure-inspector.ts +0 -2208
  51. package/client/modeller/figure-parts.ts +0 -479
  52. package/client/modeller/figure-preview.ts +0 -598
  53. package/client/modeller/figure-report.ts +0 -966
  54. package/client/modeller/figure-settings.ts +0 -328
  55. package/client/modeller/figure-side.ts +0 -272
  56. package/client/modeller/figure-thumbnail.ts +0 -123
  57. package/client/modeller/figure-view.ts +0 -152
  58. package/client/modeller/joint-edits.ts +0 -262
  59. package/client/modeller/joint-gizmo.ts +0 -180
  60. package/client/modeller/maturity.ts +0 -288
  61. package/client/modeller/new-figure-entry.ts +0 -4
  62. package/client/modeller/pose-defaults.ts +0 -67
  63. package/client/pages/figure-modeller-page.ts +0 -2082
  64. package/dist-client/modeller/angle-dial.d.ts +0 -32
  65. package/dist-client/modeller/angle-dial.js +0 -41
  66. package/dist-client/modeller/angle-dial.js.map +0 -1
  67. package/dist-client/modeller/base-box.d.ts +0 -71
  68. package/dist-client/modeller/base-box.js +0 -110
  69. package/dist-client/modeller/base-box.js.map +0 -1
  70. package/dist-client/modeller/figure-animations.d.ts +0 -159
  71. package/dist-client/modeller/figure-animations.js +0 -1132
  72. package/dist-client/modeller/figure-animations.js.map +0 -1
  73. package/dist-client/modeller/figure-canvas.d.ts +0 -150
  74. package/dist-client/modeller/figure-canvas.js +0 -506
  75. package/dist-client/modeller/figure-canvas.js.map +0 -1
  76. package/dist-client/modeller/figure-capabilities.d.ts +0 -42
  77. package/dist-client/modeller/figure-capabilities.js +0 -349
  78. package/dist-client/modeller/figure-capabilities.js.map +0 -1
  79. package/dist-client/modeller/figure-inspector.d.ts +0 -329
  80. package/dist-client/modeller/figure-inspector.js +0 -2095
  81. package/dist-client/modeller/figure-inspector.js.map +0 -1
  82. package/dist-client/modeller/figure-parts.d.ts +0 -64
  83. package/dist-client/modeller/figure-parts.js +0 -478
  84. package/dist-client/modeller/figure-parts.js.map +0 -1
  85. package/dist-client/modeller/figure-preview.d.ts +0 -138
  86. package/dist-client/modeller/figure-preview.js +0 -549
  87. package/dist-client/modeller/figure-preview.js.map +0 -1
  88. package/dist-client/modeller/figure-report.d.ts +0 -165
  89. package/dist-client/modeller/figure-report.js +0 -952
  90. package/dist-client/modeller/figure-report.js.map +0 -1
  91. package/dist-client/modeller/figure-settings.d.ts +0 -39
  92. package/dist-client/modeller/figure-settings.js +0 -317
  93. package/dist-client/modeller/figure-settings.js.map +0 -1
  94. package/dist-client/modeller/figure-side.d.ts +0 -78
  95. package/dist-client/modeller/figure-side.js +0 -317
  96. package/dist-client/modeller/figure-side.js.map +0 -1
  97. package/dist-client/modeller/figure-thumbnail.d.ts +0 -3
  98. package/dist-client/modeller/figure-thumbnail.js +0 -95
  99. package/dist-client/modeller/figure-thumbnail.js.map +0 -1
  100. package/dist-client/modeller/figure-view.d.ts +0 -118
  101. package/dist-client/modeller/figure-view.js +0 -78
  102. package/dist-client/modeller/figure-view.js.map +0 -1
  103. package/dist-client/modeller/joint-edits.d.ts +0 -49
  104. package/dist-client/modeller/joint-edits.js +0 -223
  105. package/dist-client/modeller/joint-edits.js.map +0 -1
  106. package/dist-client/modeller/joint-gizmo.d.ts +0 -34
  107. package/dist-client/modeller/joint-gizmo.js +0 -158
  108. package/dist-client/modeller/joint-gizmo.js.map +0 -1
  109. package/dist-client/modeller/maturity.d.ts +0 -55
  110. package/dist-client/modeller/maturity.js +0 -212
  111. package/dist-client/modeller/maturity.js.map +0 -1
  112. package/dist-client/modeller/new-figure-entry.d.ts +0 -2
  113. package/dist-client/modeller/new-figure-entry.js +0 -5
  114. package/dist-client/modeller/new-figure-entry.js.map +0 -1
  115. package/dist-client/modeller/pose-defaults.d.ts +0 -9
  116. package/dist-client/modeller/pose-defaults.js +0 -35
  117. package/dist-client/modeller/pose-defaults.js.map +0 -1
  118. package/dist-client/pages/figure-modeller-page.d.ts +0 -419
  119. package/dist-client/pages/figure-modeller-page.js +0 -2060
  120. package/dist-client/pages/figure-modeller-page.js.map +0 -1
  121. package/test/angle-dial.test.ts +0 -78
  122. package/test/base-box.test.ts +0 -235
  123. package/test/joint-edits.test.ts +0 -165
  124. package/test/joint-gizmo.test.ts +0 -174
  125. package/test/joint-needle.test.ts +0 -162
  126. package/test/modeller-undo-redo.test.ts +0 -33
  127. package/test/new-figure-entry.test.ts +0 -15
  128. package/test/pose-defaults.test.ts +0 -71
  129. package/test/preview-board-depth.test.ts +0 -27
@@ -0,0 +1,141 @@
1
+ import { v3AttachmentsOf, v3BindingsOf } from '@hatiolab/figure-model';
2
+ export const AXES = ['x', 'y', 'z'];
3
+ const modelOf = (asset) => asset.document.model;
4
+ /**
5
+ * `link-dimension` routes a part's dimension through `<part>.dimension.<axis>` and points its first argument at the
6
+ * source, directly or through the nodes that scale it. Walking back through those nodes finds the source: the
7
+ * instance size (`size.<axis>`), another part's dimension (`<part>.dimension.<axis>.value`) or a declared input.
8
+ */
9
+ export function followOf(asset, part, axis) {
10
+ const m = modelOf(asset);
11
+ const node = m.nodes.find(n => n.id === `${part}.dimension.${axis}`);
12
+ if (!node)
13
+ return { of: 'own' };
14
+ const writerOf = (ref) => m.nodes.find(n => Object.values(n.outputs).includes(ref));
15
+ const seen = new Set();
16
+ const walk = (ref) => {
17
+ if (seen.has(ref))
18
+ return { of: 'expression' };
19
+ seen.add(ref);
20
+ const instance = /^size\.([xyz])$/.exec(ref);
21
+ if (instance)
22
+ return { of: 'instance', axis: instance[1] };
23
+ const other = /^(.+)\.dimension\.([xyz])\.value$/.exec(ref);
24
+ if (other)
25
+ return { of: 'part', part: other[1], axis: other[2] };
26
+ const input = m.inputs.find(i => i.id === ref);
27
+ if (input)
28
+ return ref.startsWith(`${part}.`) ? { of: 'own' } : { of: 'input', input: ref };
29
+ const writer = writerOf(ref);
30
+ if (!writer)
31
+ return { of: 'expression' };
32
+ /* Follow the one argument that is not a constant factor. */
33
+ const onward = writer.args.filter(arg => !m.constants.some(c => c.id === arg));
34
+ return onward.length === 1 ? walk(onward[0]) : { of: 'expression' };
35
+ };
36
+ return walk(node.args[0]);
37
+ }
38
+ /** Whether the asset declares an instance size on an axis — only then can a dimension follow it. */
39
+ export const hasInstanceSize = (asset, axis) => modelOf(asset).inputs.some(i => i.id === `size.${axis}` && i.role === 'design');
40
+ /** The part this one is fastened to, or `null`. The mounting plane counts as fastened (the model names no part). */
41
+ export function fastenedTo(asset, part) {
42
+ return v3AttachmentsOf(asset)[part] ?? null;
43
+ }
44
+ /** Whether a dimension of this part can follow something — box-shaped, whose three sizes are X, Y and Z. */
45
+ export function canFollow(asset, part) {
46
+ const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`);
47
+ return !!shape && (shape.op === 'box-shape@1' || shape.op === 'rounded-box@1');
48
+ }
49
+ /** Whether `attach` can take this part: a box, or a cylinder (figure-model measures its faces since 0.1.47). */
50
+ export function canFasten(asset, part) {
51
+ const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`);
52
+ return canFollow(asset, part) || shape?.op === 'cylinder-shape@1';
53
+ }
54
+ /**
55
+ * The axes on which the part's position is worked out from other values rather than being its own number — the
56
+ * converter writes V2's anchor rules that way. `fix-position` makes one its own number where it is now.
57
+ */
58
+ export function positionsWorkedOut(asset, part) {
59
+ const m = modelOf(asset);
60
+ const pose = m.nodes.find(n => n.id === `${part}.pose`);
61
+ if (!pose || pose.op !== 'rigid@1' || fastenedTo(asset, part))
62
+ return [];
63
+ const own = (ref) => ref.startsWith(`${part}.`) && m.inputs.some(i => i.id === ref && i.role === 'design');
64
+ const constant = (ref) => m.constants.some(c => c.id === ref);
65
+ return AXES.filter((_axis, i) => !own(pose.args[i]) && !constant(pose.args[i]));
66
+ }
67
+ export function motionOf(asset, part) {
68
+ const m = modelOf(asset);
69
+ const node = m.nodes.find(n => n.id === `${part}.motion`);
70
+ if (!node)
71
+ return undefined;
72
+ const kind = node.op === 'axis-turn@1' ? 'turn' : 'slide';
73
+ const unit = node.args.slice(0, 3).map(ref => m.constants.find(c => c.id === ref)?.value);
74
+ const axis = AXES[unit.findIndex(v => v !== undefined && v !== 0)] ?? '?';
75
+ /* The quantity is the fourth argument, a state input directly or through the nodes that scale it. */
76
+ const quantity = node.args[3];
77
+ const seen = new Set();
78
+ const control = (ref) => {
79
+ if (!ref || seen.has(ref))
80
+ return undefined;
81
+ seen.add(ref);
82
+ const input = m.inputs.find(i => i.id === ref && i.role === 'state');
83
+ if (input)
84
+ return { id: input.id, unit: input.unit, min: input.min, max: input.max };
85
+ const writer = m.nodes.find(n => Object.values(n.outputs).includes(ref));
86
+ for (const arg of writer?.args ?? []) {
87
+ const found = control(arg);
88
+ if (found)
89
+ return found;
90
+ }
91
+ return undefined;
92
+ };
93
+ return { kind, axis, control: control(quantity) };
94
+ }
95
+ /** The select's value for what a dimension follows now. */
96
+ export function choiceOf(follow) {
97
+ switch (follow.of) {
98
+ case 'own':
99
+ return 'own';
100
+ case 'instance':
101
+ return `instance:${follow.axis}`;
102
+ case 'part':
103
+ return `part:${follow.part}:${follow.axis}`;
104
+ case 'input':
105
+ return `input:${follow.input}`;
106
+ case 'expression':
107
+ return 'expression';
108
+ }
109
+ }
110
+ /** 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. */
111
+ export function placeFacesOf(asset, part) {
112
+ const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`);
113
+ if (shape?.op === 'box-shape@1')
114
+ return ['left', 'right', 'bottom', 'top', 'back', 'front'];
115
+ if (shape?.op === 'rounded-box@1')
116
+ return ['bottom', 'top'];
117
+ return [];
118
+ }
119
+ /** The places things are held that sit on this part. */
120
+ export function placesOn(asset, part) {
121
+ return v3BindingsOf(asset).filter(one => one.part === part);
122
+ }
123
+ /** An id for a new place on this part, not yet taken: `<part>-<role>`, then `-2`, `-3`. */
124
+ export function placeIdFor(asset, part, role) {
125
+ const taken = new Set(asset.document.capabilities.bindings.map(b => b.id));
126
+ const base = `${part}-${role}`;
127
+ if (!taken.has(base))
128
+ return base;
129
+ let n = 2;
130
+ while (taken.has(`${base}-${n}`))
131
+ n++;
132
+ return `${base}-${n}`;
133
+ }
134
+ /**
135
+ * Whether a board will hand this figure anything: a place is a slot only on a figure that declares it holds things
136
+ * (`Capacity`, or `FlowNode`, which includes it). Without it the places are declared and nothing arrives.
137
+ */
138
+ export const holdsThings = (asset) => (asset.document.capabilities.names ?? []).some(n => n === 'Capacity' || n === 'FlowNode');
139
+ /** What `accepts` a person typed: names split on commas, trimmed, blanks and repeats dropped. */
140
+ export const acceptsOf = (typed) => [...new Set(typed.split(',').map(one => one.trim()).filter(Boolean))];
141
+ //# sourceMappingURL=v3-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3-links.js","sourceRoot":"","sources":["../../client/modeller/v3-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAStE,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;AAWhM;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc,EAAE,IAAY,EAAE,IAAU;IAC/D,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IACxB,MAAM,IAAI,GAAG,CAAC,CAAC,K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AAA;IAC1E,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,IAAI,EAAE,CAAA;IAC9B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACjC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;QAAE,CAAC,EAAE,CAAA;IACrC,OAAO,GAAG,IAAI,IAAI,CAAC,EAAE,CAAA;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,UAAU,CAAC,CAAA;AAExI,iGAAiG;AACjG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { v3AttachmentsOf, v3BindingsOf } from '@hatiolab/figure-model'\nimport type { V3Asset, V3BindingPlace, V3Face } 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 | { of: 'instance'; axis: Axis }\n | { of: 'part'; part: string; axis: Axis }\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 const node = m.nodes.find(n => n.id === `${part}.dimension.${axis}`)\n if (!node) 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 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 { of: 'instance', axis: instance[1] as Axis }\n const other = /^(.+)\\.dimension\\.([xyz])\\.value$/.exec(ref)\n if (other) return { of: 'part', part: other[1]!, axis: other[2] as Axis }\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 => !m.constants.some(c => c.id === arg))\n return onward.length === 1 ? walk(onward[0]!) : { of: 'expression' }\n }\n return walk(node.args[0]!)\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/** 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 const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n return !!shape && (shape.op === 'box-shape@1' || shape.op === 'rounded-box@1')\n}\n\n/** Whether `attach` can take this part: a box, or a cylinder (figure-model measures its faces since 0.1.47). */\nexport function canFasten(asset: V3Asset, part: string): boolean {\n const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)\n return canFollow(asset, part) || shape?.op === 'cylinder-shape@1'\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/** How a part moves, if it does: slide or turn, along which axis, driven by which control. */\nexport interface Motion {\n kind: 'slide' | 'turn'\n axis: Axis | '?'\n control?: { id: string; unit?: string; min?: number; max?: 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 kind = 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 return { kind, axis, control: control(quantity) }\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 `instance:${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"]}
@@ -7,11 +7,8 @@ import '../modeller/figure-v3-properties.js';
7
7
  /**
8
8
  * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.
9
9
  *
10
- * It answers to `figure-v3-modeller` while the catalogue's assets are still V2. The designer's order switches
11
- * the production data and the consuming paths together (ADR-0087, step 5): until the assets are converted, a
12
- * `figure-modeller` that opened this page would fail on every figure in the catalogue. Having its own route
13
- * is what makes steps 3 and 4 — the conversion on a recoverable copy, and the canvas check — possible at all.
14
- * At step 5 the V2 page goes, and this one takes the `figure-modeller` name and route.
10
+ * The one modeller since ADR-0087 step 5 (2026-09-24): it answers to `figure-modeller`, and to `figure-v3-modeller`
11
+ * as an alias for links made before the switch.
15
12
  */
16
13
  export declare class FigureV3ModellerPage extends PageView {
17
14
  static styles: import("lit").CSSResult;
@@ -15,11 +15,8 @@ import '../modeller/figure-v3-properties.js';
15
15
  /**
16
16
  * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.
17
17
  *
18
- * It answers to `figure-v3-modeller` while the catalogue's assets are still V2. The designer's order switches
19
- * the production data and the consuming paths together (ADR-0087, step 5): until the assets are converted, a
20
- * `figure-modeller` that opened this page would fail on every figure in the catalogue. Having its own route
21
- * is what makes steps 3 and 4 — the conversion on a recoverable copy, and the canvas check — possible at all.
22
- * At step 5 the V2 page goes, and this one takes the `figure-modeller` name and route.
18
+ * The one modeller since ADR-0087 step 5 (2026-09-24): it answers to `figure-modeller`, and to `figure-v3-modeller`
19
+ * as an alias for links made before the switch.
23
20
  */
24
21
  let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
25
22
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"figure-v3-modeller-page.js","sourceRoot":"","sources":["../../client/pages/figure-v3-modeller-page.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,E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;uDAAuB;AAEd;IAAhB,KAAK,EAAE;;0DAA0B;AAKjB;IAAhB,KAAK,EAAE;;iDAA8D;AACrD;IAAhB,KAAK,EAAE;;uDAA2B;AAtIxB,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAsZhC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { createV3ProductSession } from '../modeller/v3-product-session.js'\nimport { v3ProductStore } from '../graphql/v3-store.js'\nimport { i18next } from '@operato/i18n'\nimport { fetchFigure, updateFigure } from '../graphql/index.js'\nimport { occupancyFromParts } from '../modeller/v3-occupancy.js'\nimport type { V3AuthoringAction } from '@hatiolab/figure-model'\nimport '../modeller/v3-editor.js'\nimport '@material/web/icon/icon.js'\nimport '../modeller/figure-history-panel.js'\nimport '../modeller/figure-v3-verdict.js'\nimport '../modeller/figure-v3-properties.js'\n\n/**\n * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.\n *\n * It answers to `figure-v3-modeller` while the catalogue's assets are still V2. The designer's order switches\n * the production data and the consuming paths together (ADR-0087, step 5): until the assets are converted, a\n * `figure-modeller` that opened this page would fail on every figure in the catalogue. Having its own route\n * is what makes steps 3 and 4 — the conversion on a recoverable copy, and the canvas check — possible at all.\n * At step 5 the V2 page goes, and this one takes the `figure-modeller` name and route.\n */\n@customElement('figure-v3-modeller-page')\nexport class FigureV3ModellerPage extends PageView {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n height: 100%;\n min-height: 0;\n /*\n The page must fit the width it is given. Without this the shell sizes it to its content — the editor's\n 660 plus the 320 release panel — and the panel runs off the right edge (seen at 945 px, 2026-09-24). The\n V2 page does the same.\n */\n overflow: hidden;\n }\n figure-v3-editor {\n flex: 1;\n min-width: 0;\n min-height: 0;\n }\n aside {\n width: 320px;\n flex: none;\n min-height: 0;\n overflow: auto;\n display: flex;\n flex-direction: column;\n border-left: 1px solid var(--md-sys-color-outline-variant);\n }\n label[type-field] {\n display: grid;\n gap: 4px;\n padding: 12px 12px 8px;\n font-size: 12px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n label[type-field] input,\n label[type-field] code {\n font: inherit;\n font-family: monospace;\n padding: 6px 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 4px;\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n label[type-field] small {\n color: var(--md-sys-color-on-surface-variant);\n }\n p[fit-error] {\n margin: 0;\n padding: 8px 12px;\n font-size: 12px;\n color: var(--md-sys-color-error);\n }\n label[type-field] small[role='alert'] {\n color: var(--md-sys-color-error);\n }\n /* The V2 side panel's tabs, drawn the same way: one icon per tab, the name in title and aria-label. */\n div[tabs] {\n display: flex;\n flex: none;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n button[tab] {\n flex: 1;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 7px 6px;\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n cursor: pointer;\n }\n button[tab]:hover:not([on]) {\n background-color: var(--md-sys-color-surface-container);\n }\n button[tab][on] {\n color: var(--md-sys-color-primary);\n border-bottom-color: var(--md-sys-color-primary);\n }\n button[tab] md-icon {\n font-size: 20px;\n width: 20px;\n height: 20px;\n }\n span[badge] {\n position: absolute;\n top: 5px;\n right: 2px;\n padding: 0 5px;\n font-size: 0.62rem;\n font-weight: 700;\n line-height: 1.5;\n color: var(--md-sys-color-on-primary-container);\n background-color: var(--md-sys-color-primary-container);\n border-radius: 999em;\n pointer-events: none;\n }\n /* Hidden, not removed: the verdict keeps its last answer and the panel its list while the other tab is open. */\n [off] {\n display: none;\n }\n .error {\n padding: 16px;\n color: #922716;\n }\n `\n private readonly session = createV3ProductSession(v3ProductStore)\n private routeId: string | undefined\n private discardApproved = false\n @state() private revision = 0\n @state() private error = ''\n /**\n * 발행 패널이 읽는 행의 사실 — 상태와 발행 판 번호. 원본은 세션이 들고, 이 둘은 행에 있다.\n *\n * 이 화면에는 발행 패널이 없었다. 저장은 되고 발행 · 판본 · 복원 · 판정을 볼 자리가 없어서, ADR-0087 5단계에서\n * `figure-modeller` 가 이 화면으로 바뀌면 저작자는 발행을 할 수 없었다. 새 V3 도형은 공간을 선언하기 전에는 전부\n * 발행 판정에 막히는데 그 선언을 할 단추도 없었다(2026-09-24 확인). 서버의 문 하나가 두 형식을 다 읽으므로\n * V2 화면의 패널을 그대로 건다.\n */\n @state() private row: { state?: 'draft' | 'released'; version: number; type?: string; category?: string; tags?: string[] } = {\n version: 0\n }\n @state() private typeError = ''\n /** Why a command from the side did nothing. Shown beside the tabs — the editor stays, since nothing in it was lost. */\n @state() private commandError = ''\n /**\n * Which tab the side shows. The verdict comes first: it is what the author needs while editing, and the count on\n * its tab stays in sight while the history is open — as on the V2 page.\n */\n @state() private tab: 'properties' | 'verdict' | 'history' = 'verdict'\n @state() private instances?: number\n /**\n * The source the verdict judges. The session refuses to export while it loads or saves, so the last one read is\n * kept rather than blanked — the verdict would otherwise flicker to 「waiting」 on every save.\n */\n private draft?: string\n private draftSource(): string | undefined {\n try {\n this.draft = this.session.source()\n } catch {\n /* loading or saving — keep the last source */\n }\n return this.draft\n }\n private wasDirty = false\n private titled?: string | null\n private announce = () => {\n const view = this.session.read()\n if (!this.active || view.loading || view.saving || view.error || !view.context) return\n window.dispatchEvent(\n new CustomEvent('figure-ai-context', {\n detail: {\n figureId: view.id,\n source: JSON.parse(this.session.source()),\n context: view.context,\n revision: view.revision,\n format: 'v3'\n }\n })\n )\n }\n private changed = () => {\n this.revision++\n /* Any edit after a failed command makes the message stale — the author has done something about it. */\n this.commandError = ''\n const view = this.session.read()\n /* The title bar reads the name through `context`, which the shell asks for only when told — a rename left it stale. */\n if (view.name !== this.titled) {\n this.titled = view.name\n this.updateContext()\n }\n if (!view.saving) this.announce()\n /* 저장이 끝난 순간 행을 다시 읽는다 — 발행된 도형을 고쳐 저장하면 서버가 초안으로 내린다. */\n if (this.wasDirty && !view.dirty && !view.saving && view.id) this.readRow(view.id)\n this.wasDirty = !!view.dirty\n }\n private async readRow(id: string) {\n try {\n const figure = await fetchFigure(id)\n if (this.session.read().id === id)\n this.row = {\n state: figure.state as 'draft' | 'released',\n version: figure.version ?? 0,\n type: figure.type,\n category: figure.category ?? undefined,\n tags: figure.tags ?? undefined\n }\n } catch {\n /* 행을 못 읽으면 패널은 판 번호 0 으로 보인다 — 발행 문이 서버에서 다시 판단하므로 여기서 지어내지 않는다. */\n }\n }\n /**\n * 타입을 정한다 — 보드가 도형을 부르는 이름이고, 발행하면 굳는다(ADR-0063 결정 4).\n *\n * 새 V3 도형은 저장할 때 임시 타입을 받는데, 이 화면에는 그것을 바꿀 칸이 없어서 임시 타입 그대로 발행됐다.\n * 행만 바뀐다 — V3 자산은 타입을 원본에 적지 않으므로(적으면 형식이 거절한다) 편집 중인 원본과 부딪히지 않는다.\n * 서버의 거절(이미 쓰는 타입 · 발행 뒤)은 그 문장 그대로 칸 아래에 둔다.\n */\n private renameType = async (event: Event) => {\n const input = event.target as HTMLInputElement\n const id = this.session.read().id\n const wanted = input.value.trim().replace(/[^A-Za-z0-9_]/g, '_').toUpperCase()\n input.value = wanted\n if (!id || !wanted || wanted === this.row.type) return\n try {\n const result = await updateFigure(id, { type: wanted })\n this.typeError = ''\n this.row = { ...this.row, type: result.figure.type }\n } catch (error) {\n this.typeError = error instanceof Error ? error.message : String(error)\n input.value = this.row.type ?? ''\n }\n }\n /** 「부품에 맞추기」 — 공간을 지금 부품에서 다시 선언한다. 저장은 저작자가 따로 한다. */\n private fitToParts = () => {\n this.runCommand(() => occupancyFromParts(this.session.source()))\n }\n /** A command from the properties tab — rename, declare the room, the mounting face. */\n private onCommand = (event: Event) => {\n const action = (event as CustomEvent).detail?.action as V3AuthoringAction | undefined\n if (action) this.runCommand(() => action)\n }\n /**\n * One step of the session's history, whichever part of the side asked for it — so undo takes it back like any\n * other edit, and it is saved with the figure.\n */\n private runCommand(actionOf: () => V3AuthoringAction) {\n try {\n this.session.command(actionOf())\n this.commandError = ''\n this.changed()\n } catch (error) {\n /*\n This used to set the page error, which replaces the whole editor with one raw line — for a figure with no\n parts that line was 「OCCUPANCY_NO_PARTS: occupancy: no part could be measured」 (2026-09-24).\n */\n this.commandError =\n (error as { code?: string })?.code === 'OCCUPANCY_NO_PARTS'\n ? i18next.t('figure.text.fit-needs-parts')\n : error instanceof Error\n ? error.message\n : String(error)\n }\n }\n /**\n * Category and tags — the catalogue's, kept on the row, not in the asset. Written at once, as the V2 page does;\n * the server's refusal is shown as it gave it.\n */\n private onCatalog = async (event: Event) => {\n const patch = (event as CustomEvent).detail as { category?: string; tags?: string[] }\n const id = this.session.read().id\n if (!id || !patch) return\n try {\n const result = await updateFigure(id, patch)\n this.commandError = ''\n this.row = { ...this.row, category: result.figure.category ?? undefined, tags: result.figure.tags ?? undefined }\n } catch (error) {\n this.commandError = error instanceof Error ? error.message : String(error)\n }\n }\n private released = (event: Event) => {\n const figure = (event as CustomEvent).detail?.figure\n /* Keep the rest of the row: rebuilding it from these two dropped the type, and the locked type field went blank. */\n if (figure?.id && figure.id === this.session.read().id) this.row = { ...this.row, state: figure.state, version: figure.version ?? 0 }\n }\n /** 과거 판으로 되돌렸으면 서버의 원본이 바뀐 것이다 — 다시 연다. 패널은 저장 안 된 것이 있으면 되돌리기를 막는다. */\n private reverted = async () => {\n const id = this.session.read().id\n if (!id) return\n await this.session.open(id, { discard: true })\n this.changed()\n this.readRow(id)\n }\n /** The dock must explicitly use this checked transaction contract, never an unversioned overwrite. */\n private applyAI = (event: Event) => {\n const detail = (event as CustomEvent).detail\n if (!this.active || !detail) return\n try {\n this.session.apply(detail.changes, 'ai', detail.revision, detail.context)\n detail.applied = true\n this.changed()\n } catch (error) {\n detail.applied = false\n detail.error = error instanceof Error ? error.message : String(error)\n }\n }\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener('figure-ai-context-request', this.announce)\n window.addEventListener('figure-v3-apply', this.applyAI)\n }\n disconnectedCallback() {\n window.removeEventListener('figure-ai-context-request', this.announce)\n window.removeEventListener('figure-v3-apply', this.applyAI)\n super.disconnectedCallback()\n }\n async canDeactivate() {\n const view = this.session.read()\n if (view.saving) return false\n if (!view.dirty) return true\n // The shell invokes this while the edited model is still visible, before navigating away.\n this.discardApproved = window.confirm('저장하지 않은 변경을 버리고 이동하시겠습니까?')\n return this.discardApproved\n }\n async pageUpdated(changes: Record<string, unknown>, lifecycle: { resourceId?: string }) {\n if (!this.active) {\n if (this.session.read().loading) this.session.close()\n window.dispatchEvent(new CustomEvent('figure-ai-context', { detail: undefined }))\n return\n }\n const id = lifecycle?.resourceId\n if (this.session.read().context && id === this.routeId && !changes.active) return\n try {\n const discard = this.discardApproved\n this.discardApproved = false\n if (id) {\n this.draft = undefined\n const opening = this.session.open(id, { discard })\n this.changed()\n await opening\n this.readRow(id)\n } else {\n this.session.startNew({ discard })\n this.draft = undefined\n this.row = { version: 0 }\n this.typeError = ''\n }\n this.routeId = id\n this.error = ''\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n get context() {\n return { title: this.session.read().name ?? 'Figure', actions: [] }\n }\n render() {\n if (this.error) return html`<p role=\"alert\" class=\"error\">${this.error}</p>`\n const view = this.session.read()\n return html`<figure-v3-editor\n .session=${this.session}\n .revision=${this.revision}\n @v3-changed=${this.changed}\n ></figure-v3-editor>\n <aside>\n <label type-field>\n <span>${i18next.t('figure.label.figure-type')}</span>\n ${this.row.version > 0\n ? html`<code>${this.row.type}</code><small>${i18next.t('figure.text.type-name-cannot-change')}</small>`\n : html`<input\n .value=${this.row.type ?? ''}\n placeholder=${i18next.t('figure.text.figure-type-placeholder')}\n ?disabled=${!view.id}\n @change=${this.renameType}\n />`}\n ${this.typeError ? html`<small role=\"alert\">${this.typeError}</small>` : ''}\n </label>\n ${this.commandError ? html`<p fit-error role=\"alert\">${this.commandError}</p>` : ''}\n <div tabs>\n ${this.renderTab('properties', 'tune', i18next.t('figure.label.properties'))}\n ${this.renderTab('verdict', 'insights', i18next.t('figure.label.maturity'), this.instances)}\n ${this.renderTab('history', 'history', i18next.t('figure.label.history'))}\n </div>\n <figure-v3-properties\n ?off=${this.tab !== 'properties'}\n .source=${this.draftSource()}\n .figureId=${view.id}\n .figureCategory=${this.row.category}\n .figureTags=${this.row.tags}\n @v3-command=${this.onCommand}\n @v3-catalog=${this.onCatalog}\n ></figure-v3-properties>\n <figure-v3-verdict\n ?off=${this.tab !== 'verdict'}\n .source=${this.draftSource()}\n .figureId=${view.id}\n .figureType=${this.row.type}\n @capacity-changed=${(event: CustomEvent) => (this.instances = event.detail.instances)}\n @fit-base-to-parts=${this.fitToParts}\n ></figure-v3-verdict>\n <figure-history-panel\n ?off=${this.tab !== 'history'}\n format=\"v3\"\n .figureId=${view.id}\n .figureState=${this.row.state}\n .figureVersion=${this.row.version}\n .figureType=${this.row.type}\n .dirty=${!!view.dirty}\n @fit-base-to-parts=${this.fitToParts}\n @figure-released=${this.released}\n @figure-reverted=${this.reverted}\n ></figure-history-panel>\n </aside>`\n }\n private renderTab(tab: 'properties' | 'verdict' | 'history', icon: string, label: string, badge?: number) {\n return html`\n <button tab ?on=${this.tab === tab} title=${label} aria-label=${label} @click=${() => (this.tab = tab)}>\n <md-icon>${icon}</md-icon>${badge == null ? '' : html`<span badge>${badge.toLocaleString()}</span>`}\n </button>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"figure-v3-modeller-page.js","sourceRoot":"","sources":["../../client/pages/figure-v3-modeller-page.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AA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C,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAsZhC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { createV3ProductSession } from '../modeller/v3-product-session.js'\nimport { v3ProductStore } from '../graphql/v3-store.js'\nimport { i18next } from '@operato/i18n'\nimport { fetchFigure, updateFigure } from '../graphql/index.js'\nimport { occupancyFromParts } from '../modeller/v3-occupancy.js'\nimport type { V3AuthoringAction } from '@hatiolab/figure-model'\nimport '../modeller/v3-editor.js'\nimport '@material/web/icon/icon.js'\nimport '../modeller/figure-history-panel.js'\nimport '../modeller/figure-v3-verdict.js'\nimport '../modeller/figure-v3-properties.js'\n\n/**\n * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.\n *\n * The one modeller since ADR-0087 step 5 (2026-09-24): it answers to `figure-modeller`, and to `figure-v3-modeller`\n * as an alias for links made before the switch.\n */\n@customElement('figure-v3-modeller-page')\nexport class FigureV3ModellerPage extends PageView {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n height: 100%;\n min-height: 0;\n /*\n The page must fit the width it is given. Without this the shell sizes it to its content — the editor's\n 660 plus the 320 release panel — and the panel runs off the right edge (seen at 945 px, 2026-09-24). The\n V2 page does the same.\n */\n overflow: hidden;\n }\n figure-v3-editor {\n flex: 1;\n min-width: 0;\n min-height: 0;\n }\n aside {\n width: 320px;\n flex: none;\n min-height: 0;\n overflow: auto;\n display: flex;\n flex-direction: column;\n border-left: 1px solid var(--md-sys-color-outline-variant);\n }\n label[type-field] {\n display: grid;\n gap: 4px;\n padding: 12px 12px 8px;\n font-size: 12px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n label[type-field] input,\n label[type-field] code {\n font: inherit;\n font-family: monospace;\n padding: 6px 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 4px;\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n label[type-field] small {\n color: var(--md-sys-color-on-surface-variant);\n }\n p[fit-error] {\n margin: 0;\n padding: 8px 12px;\n font-size: 12px;\n color: var(--md-sys-color-error);\n }\n label[type-field] small[role='alert'] {\n color: var(--md-sys-color-error);\n }\n /* The V2 side panel's tabs, drawn the same way: one icon per tab, the name in title and aria-label. */\n div[tabs] {\n display: flex;\n flex: none;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n button[tab] {\n flex: 1;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 7px 6px;\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n cursor: pointer;\n }\n button[tab]:hover:not([on]) {\n background-color: var(--md-sys-color-surface-container);\n }\n button[tab][on] {\n color: var(--md-sys-color-primary);\n border-bottom-color: var(--md-sys-color-primary);\n }\n button[tab] md-icon {\n font-size: 20px;\n width: 20px;\n height: 20px;\n }\n span[badge] {\n position: absolute;\n top: 5px;\n right: 2px;\n padding: 0 5px;\n font-size: 0.62rem;\n font-weight: 700;\n line-height: 1.5;\n color: var(--md-sys-color-on-primary-container);\n background-color: var(--md-sys-color-primary-container);\n border-radius: 999em;\n pointer-events: none;\n }\n /* Hidden, not removed: the verdict keeps its last answer and the panel its list while the other tab is open. */\n [off] {\n display: none;\n }\n .error {\n padding: 16px;\n color: #922716;\n }\n `\n private readonly session = createV3ProductSession(v3ProductStore)\n private routeId: string | undefined\n private discardApproved = false\n @state() private revision = 0\n @state() private error = ''\n /**\n * 발행 패널이 읽는 행의 사실 — 상태와 발행 판 번호. 원본은 세션이 들고, 이 둘은 행에 있다.\n *\n * 이 화면에는 발행 패널이 없었다. 저장은 되고 발행 · 판본 · 복원 · 판정을 볼 자리가 없어서, ADR-0087 5단계에서\n * `figure-modeller` 가 이 화면으로 바뀌면 저작자는 발행을 할 수 없었다. 새 V3 도형은 공간을 선언하기 전에는 전부\n * 발행 판정에 막히는데 그 선언을 할 단추도 없었다(2026-09-24 확인). 서버의 문 하나가 두 형식을 다 읽으므로\n * V2 화면의 패널을 그대로 건다.\n */\n @state() private row: { state?: 'draft' | 'released'; version: number; type?: string; category?: string; tags?: string[] } = {\n version: 0\n }\n @state() private typeError = ''\n /** Why a command from the side did nothing. Shown beside the tabs — the editor stays, since nothing in it was lost. */\n @state() private commandError = ''\n /**\n * Which tab the side shows. The verdict comes first: it is what the author needs while editing, and the count on\n * its tab stays in sight while the history is open — as on the V2 page.\n */\n @state() private tab: 'properties' | 'verdict' | 'history' = 'verdict'\n @state() private instances?: number\n /**\n * The source the verdict judges. The session refuses to export while it loads or saves, so the last one read is\n * kept rather than blanked — the verdict would otherwise flicker to 「waiting」 on every save.\n */\n private draft?: string\n private draftSource(): string | undefined {\n try {\n this.draft = this.session.source()\n } catch {\n /* loading or saving — keep the last source */\n }\n return this.draft\n }\n private wasDirty = false\n private titled?: string | null\n private announce = () => {\n const view = this.session.read()\n if (!this.active || view.loading || view.saving || view.error || !view.context) return\n window.dispatchEvent(\n new CustomEvent('figure-ai-context', {\n detail: {\n figureId: view.id,\n source: JSON.parse(this.session.source()),\n context: view.context,\n revision: view.revision,\n format: 'v3'\n }\n })\n )\n }\n private changed = () => {\n this.revision++\n /* Any edit after a failed command makes the message stale — the author has done something about it. */\n this.commandError = ''\n const view = this.session.read()\n /* The title bar reads the name through `context`, which the shell asks for only when told — a rename left it stale. */\n if (view.name !== this.titled) {\n this.titled = view.name\n this.updateContext()\n }\n if (!view.saving) this.announce()\n /* 저장이 끝난 순간 행을 다시 읽는다 — 발행된 도형을 고쳐 저장하면 서버가 초안으로 내린다. */\n if (this.wasDirty && !view.dirty && !view.saving && view.id) this.readRow(view.id)\n this.wasDirty = !!view.dirty\n }\n private async readRow(id: string) {\n try {\n const figure = await fetchFigure(id)\n if (this.session.read().id === id)\n this.row = {\n state: figure.state as 'draft' | 'released',\n version: figure.version ?? 0,\n type: figure.type,\n category: figure.category ?? undefined,\n tags: figure.tags ?? undefined\n }\n } catch {\n /* 행을 못 읽으면 패널은 판 번호 0 으로 보인다 — 발행 문이 서버에서 다시 판단하므로 여기서 지어내지 않는다. */\n }\n }\n /**\n * 타입을 정한다 — 보드가 도형을 부르는 이름이고, 발행하면 굳는다(ADR-0063 결정 4).\n *\n * 새 V3 도형은 저장할 때 임시 타입을 받는데, 이 화면에는 그것을 바꿀 칸이 없어서 임시 타입 그대로 발행됐다.\n * 행만 바뀐다 — V3 자산은 타입을 원본에 적지 않으므로(적으면 형식이 거절한다) 편집 중인 원본과 부딪히지 않는다.\n * 서버의 거절(이미 쓰는 타입 · 발행 뒤)은 그 문장 그대로 칸 아래에 둔다.\n */\n private renameType = async (event: Event) => {\n const input = event.target as HTMLInputElement\n const id = this.session.read().id\n const wanted = input.value.trim().replace(/[^A-Za-z0-9_]/g, '_').toUpperCase()\n input.value = wanted\n if (!id || !wanted || wanted === this.row.type) return\n try {\n const result = await updateFigure(id, { type: wanted })\n this.typeError = ''\n this.row = { ...this.row, type: result.figure.type }\n } catch (error) {\n this.typeError = error instanceof Error ? error.message : String(error)\n input.value = this.row.type ?? ''\n }\n }\n /** 「부품에 맞추기」 — 공간을 지금 부품에서 다시 선언한다. 저장은 저작자가 따로 한다. */\n private fitToParts = () => {\n this.runCommand(() => occupancyFromParts(this.session.source()))\n }\n /** A command from the properties tab — rename, declare the room, the mounting face. */\n private onCommand = (event: Event) => {\n const action = (event as CustomEvent).detail?.action as V3AuthoringAction | undefined\n if (action) this.runCommand(() => action)\n }\n /**\n * One step of the session's history, whichever part of the side asked for it — so undo takes it back like any\n * other edit, and it is saved with the figure.\n */\n private runCommand(actionOf: () => V3AuthoringAction) {\n try {\n this.session.command(actionOf())\n this.commandError = ''\n this.changed()\n } catch (error) {\n /*\n This used to set the page error, which replaces the whole editor with one raw line — for a figure with no\n parts that line was 「OCCUPANCY_NO_PARTS: occupancy: no part could be measured」 (2026-09-24).\n */\n this.commandError =\n (error as { code?: string })?.code === 'OCCUPANCY_NO_PARTS'\n ? i18next.t('figure.text.fit-needs-parts')\n : error instanceof Error\n ? error.message\n : String(error)\n }\n }\n /**\n * Category and tags — the catalogue's, kept on the row, not in the asset. Written at once, as the V2 page does;\n * the server's refusal is shown as it gave it.\n */\n private onCatalog = async (event: Event) => {\n const patch = (event as CustomEvent).detail as { category?: string; tags?: string[] }\n const id = this.session.read().id\n if (!id || !patch) return\n try {\n const result = await updateFigure(id, patch)\n this.commandError = ''\n this.row = { ...this.row, category: result.figure.category ?? undefined, tags: result.figure.tags ?? undefined }\n } catch (error) {\n this.commandError = error instanceof Error ? error.message : String(error)\n }\n }\n private released = (event: Event) => {\n const figure = (event as CustomEvent).detail?.figure\n /* Keep the rest of the row: rebuilding it from these two dropped the type, and the locked type field went blank. */\n if (figure?.id && figure.id === this.session.read().id) this.row = { ...this.row, state: figure.state, version: figure.version ?? 0 }\n }\n /** 과거 판으로 되돌렸으면 서버의 원본이 바뀐 것이다 — 다시 연다. 패널은 저장 안 된 것이 있으면 되돌리기를 막는다. */\n private reverted = async () => {\n const id = this.session.read().id\n if (!id) return\n await this.session.open(id, { discard: true })\n this.changed()\n this.readRow(id)\n }\n /** The dock must explicitly use this checked transaction contract, never an unversioned overwrite. */\n private applyAI = (event: Event) => {\n const detail = (event as CustomEvent).detail\n if (!this.active || !detail) return\n try {\n this.session.apply(detail.changes, 'ai', detail.revision, detail.context)\n detail.applied = true\n this.changed()\n } catch (error) {\n detail.applied = false\n detail.error = error instanceof Error ? error.message : String(error)\n }\n }\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener('figure-ai-context-request', this.announce)\n window.addEventListener('figure-v3-apply', this.applyAI)\n }\n disconnectedCallback() {\n window.removeEventListener('figure-ai-context-request', this.announce)\n window.removeEventListener('figure-v3-apply', this.applyAI)\n super.disconnectedCallback()\n }\n async canDeactivate() {\n const view = this.session.read()\n if (view.saving) return false\n if (!view.dirty) return true\n // The shell invokes this while the edited model is still visible, before navigating away.\n this.discardApproved = window.confirm('저장하지 않은 변경을 버리고 이동하시겠습니까?')\n return this.discardApproved\n }\n async pageUpdated(changes: Record<string, unknown>, lifecycle: { resourceId?: string }) {\n if (!this.active) {\n if (this.session.read().loading) this.session.close()\n window.dispatchEvent(new CustomEvent('figure-ai-context', { detail: undefined }))\n return\n }\n const id = lifecycle?.resourceId\n if (this.session.read().context && id === this.routeId && !changes.active) return\n try {\n const discard = this.discardApproved\n this.discardApproved = false\n if (id) {\n this.draft = undefined\n const opening = this.session.open(id, { discard })\n this.changed()\n await opening\n this.readRow(id)\n } else {\n this.session.startNew({ discard })\n this.draft = undefined\n this.row = { version: 0 }\n this.typeError = ''\n }\n this.routeId = id\n this.error = ''\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n get context() {\n return { title: this.session.read().name ?? 'Figure', actions: [] }\n }\n render() {\n if (this.error) return html`<p role=\"alert\" class=\"error\">${this.error}</p>`\n const view = this.session.read()\n return html`<figure-v3-editor\n .session=${this.session}\n .revision=${this.revision}\n @v3-changed=${this.changed}\n ></figure-v3-editor>\n <aside>\n <label type-field>\n <span>${i18next.t('figure.label.figure-type')}</span>\n ${this.row.version > 0\n ? html`<code>${this.row.type}</code><small>${i18next.t('figure.text.type-name-cannot-change')}</small>`\n : html`<input\n .value=${this.row.type ?? ''}\n placeholder=${i18next.t('figure.text.figure-type-placeholder')}\n ?disabled=${!view.id}\n @change=${this.renameType}\n />`}\n ${this.typeError ? html`<small role=\"alert\">${this.typeError}</small>` : ''}\n </label>\n ${this.commandError ? html`<p fit-error role=\"alert\">${this.commandError}</p>` : ''}\n <div tabs>\n ${this.renderTab('properties', 'tune', i18next.t('figure.label.properties'))}\n ${this.renderTab('verdict', 'insights', i18next.t('figure.label.maturity'), this.instances)}\n ${this.renderTab('history', 'history', i18next.t('figure.label.history'))}\n </div>\n <figure-v3-properties\n ?off=${this.tab !== 'properties'}\n .source=${this.draftSource()}\n .figureId=${view.id}\n .figureCategory=${this.row.category}\n .figureTags=${this.row.tags}\n @v3-command=${this.onCommand}\n @v3-catalog=${this.onCatalog}\n ></figure-v3-properties>\n <figure-v3-verdict\n ?off=${this.tab !== 'verdict'}\n .source=${this.draftSource()}\n .figureId=${view.id}\n .figureType=${this.row.type}\n @capacity-changed=${(event: CustomEvent) => (this.instances = event.detail.instances)}\n @fit-base-to-parts=${this.fitToParts}\n ></figure-v3-verdict>\n <figure-history-panel\n ?off=${this.tab !== 'history'}\n format=\"v3\"\n .figureId=${view.id}\n .figureState=${this.row.state}\n .figureVersion=${this.row.version}\n .figureType=${this.row.type}\n .dirty=${!!view.dirty}\n @fit-base-to-parts=${this.fitToParts}\n @figure-released=${this.released}\n @figure-reverted=${this.reverted}\n ></figure-history-panel>\n </aside>`\n }\n private renderTab(tab: 'properties' | 'verdict' | 'history', icon: string, label: string, badge?: number) {\n return html`\n <button tab ?on=${this.tab === tab} title=${label} aria-label=${label} @click=${() => (this.tab = tab)}>\n <md-icon>${icon}</md-icon>${badge == null ? '' : html`<span badge>${badge.toLocaleString()}</span>`}\n </button>\n `\n }\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "figure-v3-modeller" | "figure-modeller" | "figure-list" | undefined;
1
+ export default function route(page: string): "figure-list" | "figure-modeller" | "figure-v3-modeller" | undefined;
@@ -3,13 +3,10 @@ export default function route(page) {
3
3
  case 'figure-list':
4
4
  import('./pages/figure-list-page');
5
5
  return page;
6
- case 'figure-modeller':
7
- import('./pages/figure-modeller-page');
8
- return page;
9
6
  /*
10
- The V3 modeller, under its own name until the catalogue's assets are V3 (ADR-0087, step 5). Both pages
11
- define a custom element, and an element name may be registered once, so they cannot share one.
7
+ One modeller since ADR-0087 step 5. `figure-v3-modeller` is kept as an alias for links made before the switch.
12
8
  */
9
+ case 'figure-modeller':
13
10
  case 'figure-v3-modeller':
14
11
  import('./pages/figure-v3-modeller-page');
15
12
  return page;
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,aAAa;YAChB,MAAM,CAAC,0BAA0B,CAAC,CAAA;YAClC,OAAO,IAAI,CAAA;QAEb,KAAK,iBAAiB;YACpB,MAAM,CAAC,8BAA8B,CAAC,CAAA;YACtC,OAAO,IAAI,CAAA;QAEb;;;UAGE;QACF,KAAK,oBAAoB;YACvB,MAAM,CAAC,iCAAiC,CAAC,CAAA;YACzC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'figure-list':\n import('./pages/figure-list-page')\n return page\n\n case 'figure-modeller':\n import('./pages/figure-modeller-page')\n return page\n\n /*\n The V3 modeller, under its own name until the catalogue's assets are V3 (ADR-0087, step 5). Both pages\n define a custom element, and an element name may be registered once, so they cannot share one.\n */\n case 'figure-v3-modeller':\n import('./pages/figure-v3-modeller-page')\n return page\n }\n}\n"]}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,aAAa;YAChB,MAAM,CAAC,0BAA0B,CAAC,CAAA;YAClC,OAAO,IAAI,CAAA;QAEb;;UAEE;QACF,KAAK,iBAAiB,CAAC;QACvB,KAAK,oBAAoB;YACvB,MAAM,CAAC,iCAAiC,CAAC,CAAA;YACzC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'figure-list':\n import('./pages/figure-list-page')\n return page\n\n /*\n One modeller since ADR-0087 step 5. `figure-v3-modeller` is kept as an alias for links made before the switch.\n */\n case 'figure-modeller':\n case 'figure-v3-modeller':\n import('./pages/figure-v3-modeller-page')\n return page\n }\n}\n"]}