@things-factory/figure-ui 10.1.76 → 10.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/modeller/editor.ts +42 -23
- package/dist-client/modeller/editor.d.ts +9 -0
- package/dist-client/modeller/editor.js +50 -24
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/browser/modeller.check.mjs +18 -12
- package/test/links.test.ts +1 -1
- package/test/parts-wiring.test.ts +13 -0
- package/test/refusals.test.ts +6 -3
- package/test/theme.test.ts +2 -4
- package/translations/en.json +2 -2
- package/translations/ja.json +2 -2
- package/translations/ko.json +2 -2
- package/translations/ms.json +2 -2
- package/translations/zh.json +2 -2
- package/dist-client/graphql/v3-store.d.ts +0 -3
- package/dist-client/graphql/v3-store.js +0 -39
- package/dist-client/graphql/v3-store.js.map +0 -1
- package/dist-client/modeller/figure-v3-capability.d.ts +0 -22
- package/dist-client/modeller/figure-v3-capability.js +0 -141
- package/dist-client/modeller/figure-v3-capability.js.map +0 -1
- package/dist-client/modeller/figure-v3-clips.d.ts +0 -31
- package/dist-client/modeller/figure-v3-clips.js +0 -268
- package/dist-client/modeller/figure-v3-clips.js.map +0 -1
- package/dist-client/modeller/figure-v3-controls.d.ts +0 -36
- package/dist-client/modeller/figure-v3-controls.js +0 -226
- package/dist-client/modeller/figure-v3-controls.js.map +0 -1
- package/dist-client/modeller/figure-v3-first-save.d.ts +0 -20
- package/dist-client/modeller/figure-v3-first-save.js +0 -118
- package/dist-client/modeller/figure-v3-first-save.js.map +0 -1
- package/dist-client/modeller/figure-v3-links.d.ts +0 -77
- package/dist-client/modeller/figure-v3-links.js +0 -649
- package/dist-client/modeller/figure-v3-links.js.map +0 -1
- package/dist-client/modeller/figure-v3-material.d.ts +0 -39
- package/dist-client/modeller/figure-v3-material.js +0 -323
- package/dist-client/modeller/figure-v3-material.js.map +0 -1
- package/dist-client/modeller/figure-v3-parts.d.ts +0 -69
- package/dist-client/modeller/figure-v3-parts.js +0 -559
- package/dist-client/modeller/figure-v3-parts.js.map +0 -1
- package/dist-client/modeller/figure-v3-preview.d.ts +0 -34
- package/dist-client/modeller/figure-v3-preview.js +0 -346
- package/dist-client/modeller/figure-v3-preview.js.map +0 -1
- package/dist-client/modeller/figure-v3-properties.d.ts +0 -45
- package/dist-client/modeller/figure-v3-properties.js +0 -239
- package/dist-client/modeller/figure-v3-properties.js.map +0 -1
- package/dist-client/modeller/figure-v3-recipe-catalog.d.ts +0 -38
- package/dist-client/modeller/figure-v3-recipe-catalog.js +0 -399
- package/dist-client/modeller/figure-v3-recipe-catalog.js.map +0 -1
- package/dist-client/modeller/figure-v3-verdict.d.ts +0 -64
- package/dist-client/modeller/figure-v3-verdict.js +0 -787
- package/dist-client/modeller/figure-v3-verdict.js.map +0 -1
- package/dist-client/modeller/v3-ai-proposal.d.ts +0 -51
- package/dist-client/modeller/v3-ai-proposal.js +0 -64
- package/dist-client/modeller/v3-ai-proposal.js.map +0 -1
- package/dist-client/modeller/v3-align.d.ts +0 -30
- package/dist-client/modeller/v3-align.js +0 -75
- package/dist-client/modeller/v3-align.js.map +0 -1
- package/dist-client/modeller/v3-canvas.d.ts +0 -72
- package/dist-client/modeller/v3-canvas.js +0 -379
- package/dist-client/modeller/v3-canvas.js.map +0 -1
- package/dist-client/modeller/v3-clips.d.ts +0 -39
- package/dist-client/modeller/v3-clips.js +0 -58
- package/dist-client/modeller/v3-clips.js.map +0 -1
- package/dist-client/modeller/v3-controls.d.ts +0 -28
- package/dist-client/modeller/v3-controls.js +0 -28
- package/dist-client/modeller/v3-controls.js.map +0 -1
- package/dist-client/modeller/v3-editor.d.ts +0 -203
- package/dist-client/modeller/v3-editor.js +0 -1526
- package/dist-client/modeller/v3-editor.js.map +0 -1
- package/dist-client/modeller/v3-fields.d.ts +0 -45
- package/dist-client/modeller/v3-fields.js +0 -83
- package/dist-client/modeller/v3-fields.js.map +0 -1
- package/dist-client/modeller/v3-figure-facts.d.ts +0 -35
- package/dist-client/modeller/v3-figure-facts.js +0 -55
- package/dist-client/modeller/v3-figure-facts.js.map +0 -1
- package/dist-client/modeller/v3-first-save.d.ts +0 -17
- package/dist-client/modeller/v3-first-save.js +0 -26
- package/dist-client/modeller/v3-first-save.js.map +0 -1
- package/dist-client/modeller/v3-gizmo.d.ts +0 -72
- package/dist-client/modeller/v3-gizmo.js +0 -111
- package/dist-client/modeller/v3-gizmo.js.map +0 -1
- package/dist-client/modeller/v3-help.d.ts +0 -18
- package/dist-client/modeller/v3-help.js +0 -37
- package/dist-client/modeller/v3-help.js.map +0 -1
- package/dist-client/modeller/v3-joint-drag.d.ts +0 -19
- package/dist-client/modeller/v3-joint-drag.js +0 -97
- package/dist-client/modeller/v3-joint-drag.js.map +0 -1
- package/dist-client/modeller/v3-joint-fan.d.ts +0 -9
- package/dist-client/modeller/v3-joint-fan.js +0 -276
- package/dist-client/modeller/v3-joint-fan.js.map +0 -1
- package/dist-client/modeller/v3-keys.d.ts +0 -22
- package/dist-client/modeller/v3-keys.js +0 -26
- package/dist-client/modeller/v3-keys.js.map +0 -1
- package/dist-client/modeller/v3-links.d.ts +0 -267
- package/dist-client/modeller/v3-links.js +0 -480
- package/dist-client/modeller/v3-links.js.map +0 -1
- package/dist-client/modeller/v3-live.d.ts +0 -37
- package/dist-client/modeller/v3-live.js +0 -68
- package/dist-client/modeller/v3-live.js.map +0 -1
- package/dist-client/modeller/v3-maturity.d.ts +0 -120
- package/dist-client/modeller/v3-maturity.js +0 -313
- package/dist-client/modeller/v3-maturity.js.map +0 -1
- package/dist-client/modeller/v3-occupancy.d.ts +0 -18
- package/dist-client/modeller/v3-occupancy.js +0 -24
- package/dist-client/modeller/v3-occupancy.js.map +0 -1
- package/dist-client/modeller/v3-palette.d.ts +0 -7
- package/dist-client/modeller/v3-palette.js +0 -46
- package/dist-client/modeller/v3-palette.js.map +0 -1
- package/dist-client/modeller/v3-preview-model.d.ts +0 -47
- package/dist-client/modeller/v3-preview-model.js +0 -68
- package/dist-client/modeller/v3-preview-model.js.map +0 -1
- package/dist-client/modeller/v3-product-session.d.ts +0 -510
- package/dist-client/modeller/v3-product-session.js +0 -157
- package/dist-client/modeller/v3-product-session.js.map +0 -1
- package/dist-client/modeller/v3-recipe-source.d.ts +0 -8
- package/dist-client/modeller/v3-recipe-source.js +0 -14
- package/dist-client/modeller/v3-recipe-source.js.map +0 -1
- package/dist-client/modeller/v3-recipes.d.ts +0 -37
- package/dist-client/modeller/v3-recipes.js +0 -103
- package/dist-client/modeller/v3-recipes.js.map +0 -1
- package/dist-client/modeller/v3-refusals.d.ts +0 -68
- package/dist-client/modeller/v3-refusals.js +0 -142
- package/dist-client/modeller/v3-refusals.js.map +0 -1
- package/dist-client/modeller/v3-renderer.d.ts +0 -40
- package/dist-client/modeller/v3-renderer.js +0 -73
- package/dist-client/modeller/v3-renderer.js.map +0 -1
- package/dist-client/modeller/v3-stage-model.d.ts +0 -39
- package/dist-client/modeller/v3-stage-model.js +0 -147
- package/dist-client/modeller/v3-stage-model.js.map +0 -1
- package/dist-client/modeller/v3-thumbnail.d.ts +0 -3
- package/dist-client/modeller/v3-thumbnail.js +0 -75
- package/dist-client/modeller/v3-thumbnail.js.map +0 -1
- package/dist-client/pages/figure-v3-modeller-page.d.ts +0 -102
- package/dist-client/pages/figure-v3-modeller-page.js +0 -548
- package/dist-client/pages/figure-v3-modeller-page.js.map +0 -1
- package/dist-client/tsconfig.chk.tsbuildinfo +0 -1
- package/dist-client/tsconfig.fui.tsbuildinfo +0 -1
- package/dist-client/tsconfig.scratch-fm.tsbuildinfo +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { compileV3Asset, editV3Part } from '@hatiolab/figure-model';
|
|
2
|
-
import { drawableV3Parts } from './v3-renderer.js';
|
|
3
|
-
export const NOTHING_LIVE = { values: {} };
|
|
4
|
-
/** Known inputs with a number, split by what they are. An id the figure does not declare is dropped. */
|
|
5
|
-
export function liveOverridesOf(asset, values) {
|
|
6
|
-
const roles = new Map(asset.document.model.inputs.map(i => [i.id, i.role]));
|
|
7
|
-
const design = {}, state = {};
|
|
8
|
-
for (const [id, value] of Object.entries(values)) {
|
|
9
|
-
if (!Number.isFinite(value))
|
|
10
|
-
continue;
|
|
11
|
-
const role = roles.get(id);
|
|
12
|
-
if (role === 'state')
|
|
13
|
-
state[id] = value;
|
|
14
|
-
else if (role !== undefined)
|
|
15
|
-
design[id] = value;
|
|
16
|
-
}
|
|
17
|
-
return { design, state };
|
|
18
|
-
}
|
|
19
|
-
export function isLive(live) {
|
|
20
|
-
return !!live.edit || Object.keys(live.values).length > 0;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The bodies to draw with what is in hand, or null when nothing is -- then the evaluation as it stands is drawn.
|
|
24
|
-
*
|
|
25
|
-
* Also null when the figure cannot take the value in hand (a size of 0 on the way to typing 0.5, a glow the material
|
|
26
|
-
* refuses): the canvas keeps the figure as it stands until the release, and the release reports why through the same
|
|
27
|
-
* refusal every committed edit gets. A preview never invents a figure the commit would not make.
|
|
28
|
-
*/
|
|
29
|
-
export function livePartsOf(asset, live) {
|
|
30
|
-
if (!isLive(live))
|
|
31
|
-
return null;
|
|
32
|
-
const { design, state } = liveOverridesOf(asset, live.values);
|
|
33
|
-
try {
|
|
34
|
-
let next = live.edit ? editV3Part(asset, live.edit) : asset;
|
|
35
|
-
if (Object.keys(design).length)
|
|
36
|
-
next = { ...next, designInputs: { ...next.designInputs, ...design } };
|
|
37
|
-
return drawableV3Parts(compileV3Asset(next).evaluate(state).geometry);
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* How much one pixel of a label drag moves a value: a degree for an angle, a hundredth for a ratio, and for a length a
|
|
45
|
-
* step that suits its size -- a millimetre under 100, ten over 1,000 -- so a 12 m wall and a 5 mm pin both scrub at a
|
|
46
|
-
* usable pace. Shift makes it ten times finer.
|
|
47
|
-
*/
|
|
48
|
-
export function scrubStep(unit, value, fine = false) {
|
|
49
|
-
const base = unit === 'deg' ? 1 : unit === 'ratio' ? 0.01 : Math.max(1, Math.pow(10, Math.floor(Math.log10(Math.max(1, Math.abs(value)))) - 2));
|
|
50
|
-
return fine ? base / 10 : base;
|
|
51
|
-
}
|
|
52
|
-
/** A scrubbed value on the step's grid, so a drag does not leave 1203.0000000002 behind. */
|
|
53
|
-
export function scrubbed(start, pixels, step) {
|
|
54
|
-
const value = start + pixels * step;
|
|
55
|
-
const digits = Math.max(0, -Math.floor(Math.log10(step)));
|
|
56
|
-
return Number(value.toFixed(digits));
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* The bodies to draw while a value is in hand, over every input as the session holds it now (`current`): the pose the
|
|
60
|
-
* author has already set with the other controls, and the design values. Drawing over the asset's saved defaults put
|
|
61
|
-
* every other joint back to its saved angle while one slider moved (user, 2026-09-24: the arm jumped on release).
|
|
62
|
-
*/
|
|
63
|
-
export function liveOverSession(asset, current, live) {
|
|
64
|
-
if (!isLive(live))
|
|
65
|
-
return null;
|
|
66
|
-
return livePartsOf(asset, { ...live, values: { ...current, ...live.values } });
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=v3-live.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v3-live.js","sourceRoot":"","sources":["../../client/modeller/v3-live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAGnE,OAAO,EAAE,eAAe,EAAqB,MAAM,kBAAkB,CAAA;AAoBrE,MAAM,CAAC,MAAM,YAAY,GAAe,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAEtD,wGAAwG;AACxG,MAAM,UAAU,eAAe,CAAC,KAAc,EAAE,MAA8B;IAC5E,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,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AC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AACtC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc,EAAE,OAA+B,EAAE,IAAgB;IAC/F,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9B,OAAO,WAAW,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAChF,CAAC","sourcesContent":["import { compileV3Asset, editV3Part } from '@hatiolab/figure-model'\nimport type { V3Asset, V3PartEdit } from '@hatiolab/figure-model'\n\nimport { drawableV3Parts, type V3RenderPart } from './v3-renderer.js'\n\n/*\n * The figure while a value is in hand: evaluated with the values being typed or dragged, drawn at once and written\n * nowhere. The panels committed on release only, so the canvas stood still while a number was typed, a spinner held,\n * a label scrubbed, a slider or the glow dragged (user, 2026-09-24: \"make the editor move naturally while the value\n * changes\"). The value in hand shows here; the release is the one step of the history.\n *\n * What is in hand is either input values -- a design value (a size, a position) or a pose -- or one part edit (the\n * glow of a material). A design value is a change of the figure's design, so it is shown by evaluating a copy with\n * that value; a pose is a state override, as the preview gives it.\n */\n\nexport interface LiveValues {\n /** Input values in hand, design or state, by input id. */\n values: Record<string, number>\n /** A part edit in hand, not yet committed. */\n edit?: V3PartEdit\n}\n\nexport const NOTHING_LIVE: LiveValues = { values: {} }\n\n/** Known inputs with a number, split by what they are. An id the figure does not declare is dropped. */\nexport function liveOverridesOf(asset: V3Asset, values: Record<string, number>): { design: Record<string, number>; state: Record<string, number> } {\n const roles = new Map(asset.document.model.inputs.map(i => [i.id, i.role]))\n const design: Record<string, number> = {},\n state: Record<string, number> = {}\n for (const [id, value] of Object.entries(values)) {\n if (!Number.isFinite(value)) continue\n const role = roles.get(id)\n if (role === 'state') state[id] = value\n else if (role !== undefined) design[id] = value\n }\n return { design, state }\n}\n\nexport function isLive(live: LiveValues): boolean {\n return !!live.edit || Object.keys(live.values).length > 0\n}\n\n/**\n * The bodies to draw with what is in hand, or null when nothing is -- then the evaluation as it stands is drawn.\n *\n * Also null when the figure cannot take the value in hand (a size of 0 on the way to typing 0.5, a glow the material\n * refuses): the canvas keeps the figure as it stands until the release, and the release reports why through the same\n * refusal every committed edit gets. A preview never invents a figure the commit would not make.\n */\nexport function livePartsOf(asset: V3Asset, live: LiveValues): V3RenderPart[] | null {\n if (!isLive(live)) return null\n const { design, state } = liveOverridesOf(asset, live.values)\n try {\n let next = live.edit ? editV3Part(asset, live.edit) : asset\n if (Object.keys(design).length) next = { ...next, designInputs: { ...next.designInputs, ...design } }\n return drawableV3Parts(compileV3Asset(next).evaluate(state).geometry)\n } catch {\n return null\n }\n}\n\n/**\n * How much one pixel of a label drag moves a value: a degree for an angle, a hundredth for a ratio, and for a length a\n * step that suits its size -- a millimetre under 100, ten over 1,000 -- so a 12 m wall and a 5 mm pin both scrub at a\n * usable pace. Shift makes it ten times finer.\n */\nexport function scrubStep(unit: string, value: number, fine = false): number {\n const base =\n unit === 'deg' ? 1 : unit === 'ratio' ? 0.01 : Math.max(1, Math.pow(10, Math.floor(Math.log10(Math.max(1, Math.abs(value)))) - 2))\n return fine ? base / 10 : base\n}\n\n/** A scrubbed value on the step's grid, so a drag does not leave 1203.0000000002 behind. */\nexport function scrubbed(start: number, pixels: number, step: number): number {\n const value = start + pixels * step\n const digits = Math.max(0, -Math.floor(Math.log10(step)))\n return Number(value.toFixed(digits))\n}\n\n/**\n * The bodies to draw while a value is in hand, over every input as the session holds it now (`current`): the pose the\n * author has already set with the other controls, and the design values. Drawing over the asset's saved defaults put\n * every other joint back to its saved angle while one slider moved (user, 2026-09-24: the arm jumped on release).\n */\nexport function liveOverSession(asset: V3Asset, current: Record<string, number>, live: LiveValues): V3RenderPart[] | null {\n if (!isLive(live)) return null\n return livePartsOf(asset, { ...live, values: { ...current, ...live.values } })\n}\n\n"]}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { V3_BUDGET_KEYS, V3_GRADE_SCALE, v3GradeOf } from '@hatiolab/figure-model';
|
|
2
|
-
import type { V3Asset, V3AssetGeometry, V3BudgetKey, V3BudgetUse, V3Cost, V3Geometry, V3Score } from '@hatiolab/figure-model';
|
|
3
|
-
import type { FigureCapacity } from './scene-budget.js';
|
|
4
|
-
export { V3_BUDGET_KEYS, V3_GRADE_SCALE as GRADE_SCALE, v3GradeOf as gradeOf };
|
|
5
|
-
export type { V3BudgetKey, V3BudgetUse, V3Score };
|
|
6
|
-
export type V3AxisKey = 'scale' | 'consistency' | 'reuse' | 'detail' | 'reactive' | 'readable';
|
|
7
|
-
/** One maturity axis. */
|
|
8
|
-
export interface V3MaturityAxis {
|
|
9
|
-
key: V3AxisKey;
|
|
10
|
-
/** 0–1. Absent when the axis cannot be measured. */
|
|
11
|
-
ratio?: number;
|
|
12
|
-
reading?: string;
|
|
13
|
-
/** A reading that is words, not a number. */
|
|
14
|
-
readingKey?: string;
|
|
15
|
-
because?: string;
|
|
16
|
-
/** Why the axis is not measured. When present there is no ratio — an unmeasured axis is not a zero. */
|
|
17
|
-
blocked?: string;
|
|
18
|
-
}
|
|
19
|
-
/** Instances on one screen, and what each series costs at that count. */
|
|
20
|
-
export interface V3CurvePoint {
|
|
21
|
-
instances: number;
|
|
22
|
-
triangles: number;
|
|
23
|
-
drawCalls: number;
|
|
24
|
-
/** Vertex buffers: one per distinct shape, shared by every instance of the same size. */
|
|
25
|
-
geometries: number;
|
|
26
|
-
materials: number;
|
|
27
|
-
}
|
|
28
|
-
export interface V3Report {
|
|
29
|
-
cost: V3Cost;
|
|
30
|
-
capacity: FigureCapacity;
|
|
31
|
-
score: V3Score;
|
|
32
|
-
/** Distinct shapes and materials among the drawn bodies — the 「그리는 비용」 rows. */
|
|
33
|
-
distinctShapes: number;
|
|
34
|
-
distinctMaterials: number;
|
|
35
|
-
reuse: {
|
|
36
|
-
distinct: number;
|
|
37
|
-
parts: number;
|
|
38
|
-
saved: number;
|
|
39
|
-
};
|
|
40
|
-
axes: V3MaturityAxis[];
|
|
41
|
-
curve: V3CurvePoint[];
|
|
42
|
-
}
|
|
43
|
-
/** The board target for the scale axis: 500 assets on one drawing (design document §4.15). */
|
|
44
|
-
export declare const BOARD_ASSETS = 500;
|
|
45
|
-
/**
|
|
46
|
-
* The report for one asset, or nothing when no body is drawn — then there is nothing to measure, and the screen
|
|
47
|
-
* says so rather than drawing zeros.
|
|
48
|
-
*
|
|
49
|
-
* Evaluated at the asset's own design and state defaults, as `v3CostOf` is.
|
|
50
|
-
*/
|
|
51
|
-
export declare function v3ReportOf(asset: V3Asset): V3Report | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* The key things-scene shares a body's geometry by (`figure-v3-geometry.ts` `keyOf`): provider, dimensions to a
|
|
54
|
-
* micrometre, segments (12 when unset), and a polygon's corners.
|
|
55
|
-
*/
|
|
56
|
-
export declare function shapeKeyOf(body: V3AssetGeometry | V3Geometry): string;
|
|
57
|
-
/**
|
|
58
|
-
* The key things-scene shares a material by (`figure-v3-rig.ts` `materialFor`), within one asset: token, preset,
|
|
59
|
-
* transparency, and the light when it is on. The colour follows from the token, so it is not a second key.
|
|
60
|
-
*/
|
|
61
|
-
export declare function materialKeyOf(body: V3AssetGeometry): string;
|
|
62
|
-
/** 1 · 2 · 5 per decade: even steps on a log axis. */
|
|
63
|
-
export declare function decadeSteps(from: number, to: number): number[];
|
|
64
|
-
export type V3CurveSeries = 'triangles' | 'drawCalls' | 'geometries' | 'materials';
|
|
65
|
-
/**
|
|
66
|
-
* The four lines: two that grow with the instance count and two that stay flat — the flat ones are what the
|
|
67
|
-
* instances share. Materials are dashed and drawn last, so a line under them still shows where the two meet.
|
|
68
|
-
*/
|
|
69
|
-
export declare const CURVE_SERIES: readonly {
|
|
70
|
-
key: V3CurveSeries;
|
|
71
|
-
flat: boolean;
|
|
72
|
-
dashed?: boolean;
|
|
73
|
-
}[];
|
|
74
|
-
/** The chart's size. The chart is shown at this size in a sheet; shrunk into the side, its words are unreadable. */
|
|
75
|
-
export declare const CURVE_SIZE: {
|
|
76
|
-
readonly width: 680;
|
|
77
|
-
readonly height: 380;
|
|
78
|
-
readonly pad: {
|
|
79
|
-
readonly top: 52;
|
|
80
|
-
readonly right: 208;
|
|
81
|
-
readonly bottom: 44;
|
|
82
|
-
readonly left: 62;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
export interface V3CurveLayout {
|
|
86
|
-
xTicks: {
|
|
87
|
-
x: number;
|
|
88
|
-
label: string;
|
|
89
|
-
}[];
|
|
90
|
-
yTicks: {
|
|
91
|
-
y: number;
|
|
92
|
-
label: string;
|
|
93
|
-
}[];
|
|
94
|
-
lines: {
|
|
95
|
-
key: V3CurveSeries;
|
|
96
|
-
d: string;
|
|
97
|
-
flat: boolean;
|
|
98
|
-
dashed: boolean;
|
|
99
|
-
last: number;
|
|
100
|
-
}[];
|
|
101
|
-
/** The value the flat lines share when they lie on one another, so the screen can say why one line is missing. */
|
|
102
|
-
overlap?: number;
|
|
103
|
-
}
|
|
104
|
-
/** 1, 10, 100 … written short. */
|
|
105
|
-
export declare function shortNumber(v: number): string;
|
|
106
|
-
/** Where the chart puts each line and tick. Both axes are logarithmic. */
|
|
107
|
-
export declare function curveLayout(points: V3CurvePoint[]): V3CurveLayout | undefined;
|
|
108
|
-
/** What the parts list shows under its title: the cost, how many fit, the grade and what decides it. */
|
|
109
|
-
export interface V3BudgetLine {
|
|
110
|
-
triangles: number;
|
|
111
|
-
groups: number;
|
|
112
|
-
instances: number;
|
|
113
|
-
grade: string;
|
|
114
|
-
tightest: {
|
|
115
|
-
key: string;
|
|
116
|
-
used: number;
|
|
117
|
-
limit: number;
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
export declare function budgetOf(report: V3Report | undefined): V3BudgetLine | undefined;
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { compileV3Asset, compileV3Document, LIMITS, SEGMENT_PRESETS, V3_BUDGET_KEYS, V3_GRADE_SCALE, v3CostOf, v3GradeOf, v3MaterialKeyOf, v3ScoreOf, v3WorldBoxesOf, v3WritersOf } from '@hatiolab/figure-model';
|
|
2
|
-
import { capacityFrom } from './scene-budget.js';
|
|
3
|
-
/*
|
|
4
|
-
* The modeller's maturity report, read off the evaluated asset (user, 2026-09-24: the tab showed a count and nothing
|
|
5
|
-
* else — 「왜 이렇게 너프되었는지」):
|
|
6
|
-
*
|
|
7
|
-
* grade A–D and its scale figure-model's `v3ScoreOf`: one screen's target shared per instance (groups,
|
|
8
|
-
* triangles) and the declared rule limits (independent, transparent)
|
|
9
|
-
* radar · axes six axes; reactive is not measured, and detail has no V3 field
|
|
10
|
-
* drawing cost triangles, distinct shapes, distinct materials
|
|
11
|
-
* trend what grows with the instance count and what the instances share
|
|
12
|
-
*
|
|
13
|
-
* Kept apart from the element so it can be tested without a browser.
|
|
14
|
-
*
|
|
15
|
-
* ## What the V3 renderer shares, which is what the numbers count
|
|
16
|
-
*
|
|
17
|
-
* things-scene draws one mesh per drawn body (`figure-v3-rig.ts`) — no merging by material — so a body is
|
|
18
|
-
* a draw call. It shares geometry by provider, dimensions, segments and profile (`figure-v3-geometry.ts`, `keyOf`)
|
|
19
|
-
* and materials by token, preset, transparency and light (`materialFor`). The keys below are those keys; a
|
|
20
|
-
* distinct-shape count that used another key would describe a renderer that does not exist.
|
|
21
|
-
*
|
|
22
|
-
* ## Budgets V3 does not have
|
|
23
|
-
*
|
|
24
|
-
* Two budgets are not measured here, and are not shown as zero:
|
|
25
|
-
* - off-palette surfaces: the V3 material has no surface field, so there is nothing to count;
|
|
26
|
-
* - part count by detail level: V3 does not carry the detail level (chief architect, 2026-09-24, ADR-0087).
|
|
27
|
-
*/
|
|
28
|
-
/*
|
|
29
|
-
The grade, its budgets and its bounds are figure-model's (`v3ScoreOf`), so the catalogue grades a figure as this tab
|
|
30
|
-
does. The grade is the headroom against one screen's target (`LIMITS.screenInstances`), not a draw-call limit.
|
|
31
|
-
*/
|
|
32
|
-
export { V3_BUDGET_KEYS, V3_GRADE_SCALE as GRADE_SCALE, v3GradeOf as gradeOf };
|
|
33
|
-
/** The board target for the scale axis: 500 assets on one drawing (design document §4.15). */
|
|
34
|
-
export const BOARD_ASSETS = 500;
|
|
35
|
-
/**
|
|
36
|
-
* The report for one asset, or nothing when no body is drawn — then there is nothing to measure, and the screen
|
|
37
|
-
* says so rather than drawing zeros.
|
|
38
|
-
*
|
|
39
|
-
* Evaluated at the asset's own design and state defaults, as `v3CostOf` is.
|
|
40
|
-
*/
|
|
41
|
-
export function v3ReportOf(asset) {
|
|
42
|
-
const cost = v3CostOf(asset);
|
|
43
|
-
const capacity = capacityFrom(cost.groups, cost.triangles);
|
|
44
|
-
if (!capacity)
|
|
45
|
-
return undefined;
|
|
46
|
-
const drawn = compileV3Asset(asset)
|
|
47
|
-
.evaluate()
|
|
48
|
-
.geometry.filter(body => body.visible !== false);
|
|
49
|
-
const plan = compileV3Document(asset.document);
|
|
50
|
-
const writers = v3WritersOf(asset);
|
|
51
|
-
const shapes = new Set(drawn.map(shapeKeyOf));
|
|
52
|
-
const materials = new Set(drawn.map(materialKeyOf));
|
|
53
|
-
const score = v3ScoreOf(asset);
|
|
54
|
-
const reuse = { distinct: shapes.size, parts: drawn.length, saved: drawn.length - shapes.size };
|
|
55
|
-
const axes = [
|
|
56
|
-
{
|
|
57
|
-
key: 'scale',
|
|
58
|
-
// The board target filled is 1; room beyond it is better spent on the other axes, so it does not count more.
|
|
59
|
-
ratio: Math.min(1, capacity.instances / BOARD_ASSETS),
|
|
60
|
-
reading: String(capacity.instances),
|
|
61
|
-
because: 'figure.text.maturity-scale-because'
|
|
62
|
-
},
|
|
63
|
-
consistency(asset, materials.size),
|
|
64
|
-
{
|
|
65
|
-
key: 'reuse',
|
|
66
|
-
// A low distinct-to-parts ratio is much reuse; turned over so that more is higher.
|
|
67
|
-
ratio: reuse.parts === 0 ? 0 : 1 - reuse.distinct / reuse.parts,
|
|
68
|
-
reading: String(reuse.saved),
|
|
69
|
-
because: 'figure.text.maturity-reuse-because'
|
|
70
|
-
},
|
|
71
|
-
{ key: 'detail', blocked: 'figure.text.maturity-blocked-no-detail-level' },
|
|
72
|
-
{ key: 'reactive', blocked: 'figure.text.maturity-blocked-no-binding' },
|
|
73
|
-
readable(asset, plan, drawn, writers)
|
|
74
|
-
];
|
|
75
|
-
return {
|
|
76
|
-
cost,
|
|
77
|
-
capacity,
|
|
78
|
-
score,
|
|
79
|
-
distinctShapes: shapes.size,
|
|
80
|
-
distinctMaterials: materials.size,
|
|
81
|
-
reuse,
|
|
82
|
-
axes,
|
|
83
|
-
curve: decadeSteps(1, 10000).map(instances => ({
|
|
84
|
-
instances,
|
|
85
|
-
triangles: cost.triangles * instances,
|
|
86
|
-
drawCalls: cost.groups * instances,
|
|
87
|
-
geometries: shapes.size,
|
|
88
|
-
materials: materials.size
|
|
89
|
-
}))
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The key things-scene shares a body's geometry by (`figure-v3-geometry.ts` `keyOf`): provider, dimensions to a
|
|
94
|
-
* micrometre, segments (12 when unset), and a polygon's corners.
|
|
95
|
-
*/
|
|
96
|
-
export function shapeKeyOf(body) {
|
|
97
|
-
if (!('shape' in body)) {
|
|
98
|
-
// A scalar body has no mesh of its own; it is still one drawn body, told apart by what it declares.
|
|
99
|
-
const dims = Object.keys(body.dimensions).sort().map(k => `${k}=${body.dimensions[k]}`).join(',');
|
|
100
|
-
return `${body.provider}|${dims}`;
|
|
101
|
-
}
|
|
102
|
-
const shape = body.shape;
|
|
103
|
-
const round = (v) => Math.round(v * 1e6) / 1e6;
|
|
104
|
-
const dims = Object.keys(shape.dimensions)
|
|
105
|
-
.sort()
|
|
106
|
-
.map(k => `${k}=${round(shape.dimensions[k])}`)
|
|
107
|
-
.join(',');
|
|
108
|
-
const profile = shape.profile ? '|' + shape.profile.map(p => `${round(p.x)}:${round(p.y)}`).join(';') : '';
|
|
109
|
-
const segments = body.segments ?? 12;
|
|
110
|
-
return `${shape.provider}|${dims}|s${segments}${profile}`;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* The key things-scene shares a material by (`figure-v3-rig.ts` `materialFor`), within one asset: token, preset,
|
|
114
|
-
* transparency, and the light when it is on. The colour follows from the token, so it is not a second key.
|
|
115
|
-
*/
|
|
116
|
-
export function materialKeyOf(body) {
|
|
117
|
-
return v3MaterialKeyOf(body);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Does it look like one set — baselines 3 and 4, three checks.
|
|
121
|
-
*
|
|
122
|
-
* Two of them hold by construction in V3: the material has no surface field, so there is no texture, and the
|
|
123
|
-
* format refuses a segment count outside the presets (`compileV3Asset`, `QUALITY`). They are still counted, so
|
|
124
|
-
* the ratio stays one fault in three.
|
|
125
|
-
*/
|
|
126
|
-
function consistency(asset, distinctMaterials) {
|
|
127
|
-
const textures = 0;
|
|
128
|
-
const offPreset = asset.appearance.filter(look => look.segments !== undefined && !SEGMENT_PRESETS.includes(look.segments)).length;
|
|
129
|
-
const faults = (textures > 0 ? 1 : 0) + (offPreset > 0 ? 1 : 0) + (distinctMaterials > LIMITS.distinctMaterials ? 1 : 0);
|
|
130
|
-
return {
|
|
131
|
-
key: 'consistency',
|
|
132
|
-
ratio: (3 - faults) / 3,
|
|
133
|
-
readingKey: faults === 0 ? 'figure.text.maturity-consistency-clean' : 'figure.text.maturity-consistency-faults',
|
|
134
|
-
because: 'figure.text.maturity-consistency-because'
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/** Seen from above, these do not fill their footprint box, by V3 provider name. */
|
|
138
|
-
const ROUND_FOOTPRINT = ['cylinder', 'ellipticCylinder', 'frustum', 'sphere'];
|
|
139
|
-
/**
|
|
140
|
-
* Can it be told apart from above — baseline 1.
|
|
141
|
-
*
|
|
142
|
-
* Viewpoint entropy (Vázquez et al.) over the top view, counted by colour region rather than by face so that a
|
|
143
|
-
* finer segment count does not raise it: H = −Σ p·log p over each material's share of the footprint plus the
|
|
144
|
-
* background, divided by log(`LIMITS.distinctMaterials` + 1), the most this measure can reach.
|
|
145
|
-
*
|
|
146
|
-
* The footprint is the base box: the space the asset declares when it declares one (ADR-0044's box is V3's
|
|
147
|
-
* occupancy), otherwise the drawn bodies' own extent. Bodies are their axis-aligned world boxes
|
|
148
|
-
* (`v3WorldBoxesOf`, the gate's reading); the higher one covers the lower.
|
|
149
|
-
*/
|
|
150
|
-
function readable(asset, plan, drawn, writers) {
|
|
151
|
-
const placed = drawn
|
|
152
|
-
.filter(body => 'pose' in body)
|
|
153
|
-
// One placed, drawn body gives exactly one box; boxes are taken one by one to keep each with its material.
|
|
154
|
-
.map(body => ({ body, box: v3WorldBoxesOf([body], writers)[0] }));
|
|
155
|
-
if (placed.length === 0)
|
|
156
|
-
return { key: 'readable', blocked: 'figure.text.maturity-blocked-no-parts' };
|
|
157
|
-
let frame;
|
|
158
|
-
if (asset.occupancy) {
|
|
159
|
-
const values = plan.evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values;
|
|
160
|
-
const at = (ref) => values[ref];
|
|
161
|
-
const b = asset.occupancy.bounds;
|
|
162
|
-
frame = { x0: at(b.x.min), x1: at(b.x.max), z0: at(b.z.min), z1: at(b.z.max) };
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
frame = { x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity };
|
|
166
|
-
for (const { box } of placed) {
|
|
167
|
-
frame.x0 = Math.min(frame.x0, box.centre.x - box.extent.x / 2);
|
|
168
|
-
frame.x1 = Math.max(frame.x1, box.centre.x + box.extent.x / 2);
|
|
169
|
-
frame.z0 = Math.min(frame.z0, box.centre.z - box.extent.z / 2);
|
|
170
|
-
frame.z1 = Math.max(frame.z1, box.centre.z + box.extent.z / 2);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
const regions = topViewRegions(placed, frame);
|
|
174
|
-
if (regions.total === 0)
|
|
175
|
-
return { key: 'readable', blocked: 'figure.text.maturity-blocked-no-parts' };
|
|
176
|
-
const shares = [...regions.byMaterial.values(), regions.background].map(area => area / regions.footprint).filter(share => share > 0);
|
|
177
|
-
const entropy = -shares.reduce((sum, p) => sum + p * Math.log(p), 0);
|
|
178
|
-
const ceiling = Math.log(LIMITS.distinctMaterials + 1);
|
|
179
|
-
return {
|
|
180
|
-
key: 'readable',
|
|
181
|
-
// Clamped both ways: one region alone gives −0, which is not a reading anyone should see.
|
|
182
|
-
ratio: Math.max(0, Math.min(1, entropy / ceiling)),
|
|
183
|
-
reading: String(regions.byMaterial.size),
|
|
184
|
-
because: 'figure.text.maturity-readable-because'
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
/** Which material shows from above, on a 64 × 64 grid over the footprint, over world boxes. */
|
|
188
|
-
function topViewRegions(placed, frame) {
|
|
189
|
-
const GRID = 64;
|
|
190
|
-
const cells = new Array(GRID * GRID).fill(null);
|
|
191
|
-
const height = new Float64Array(GRID * GRID);
|
|
192
|
-
const sx = GRID / Math.max(frame.x1 - frame.x0, 1e-6);
|
|
193
|
-
const sz = GRID / Math.max(frame.z1 - frame.z0, 1e-6);
|
|
194
|
-
for (const { body, box } of placed) {
|
|
195
|
-
const top = box.centre.y + box.extent.y / 2;
|
|
196
|
-
const key = materialKeyOf(body);
|
|
197
|
-
const x0 = Math.max(0, Math.floor((box.centre.x - box.extent.x / 2 - frame.x0) * sx));
|
|
198
|
-
const x1 = Math.min(GRID, Math.ceil((box.centre.x + box.extent.x / 2 - frame.x0) * sx));
|
|
199
|
-
const y0 = Math.max(0, Math.floor((box.centre.z - box.extent.z / 2 - frame.z0) * sz));
|
|
200
|
-
const y1 = Math.min(GRID, Math.ceil((box.centre.z + box.extent.z / 2 - frame.z0) * sz));
|
|
201
|
-
const round = 'shape' in body && ROUND_FOOTPRINT.includes(body.shape.provider);
|
|
202
|
-
for (let y = y0; y < y1; y++) {
|
|
203
|
-
for (let x = x0; x < x1; x++) {
|
|
204
|
-
// A round body does not fill its box; the corners are cut.
|
|
205
|
-
if (round) {
|
|
206
|
-
const cx = (x + 0.5 - (x0 + x1) / 2) / ((x1 - x0) / 2 || 1);
|
|
207
|
-
const cy = (y + 0.5 - (y0 + y1) / 2) / ((y1 - y0) / 2 || 1);
|
|
208
|
-
if (cx * cx + cy * cy > 1)
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
const i = y * GRID + x;
|
|
212
|
-
if (cells[i] === null || top > height[i]) {
|
|
213
|
-
cells[i] = key;
|
|
214
|
-
height[i] = top;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const byMaterial = new Map();
|
|
220
|
-
let covered = 0;
|
|
221
|
-
for (const key of cells) {
|
|
222
|
-
if (key === null)
|
|
223
|
-
continue;
|
|
224
|
-
covered++;
|
|
225
|
-
byMaterial.set(key, (byMaterial.get(key) ?? 0) + 1);
|
|
226
|
-
}
|
|
227
|
-
return { byMaterial, total: covered, background: GRID * GRID - covered, footprint: GRID * GRID };
|
|
228
|
-
}
|
|
229
|
-
/** 1 · 2 · 5 per decade: even steps on a log axis. */
|
|
230
|
-
export function decadeSteps(from, to) {
|
|
231
|
-
const out = [];
|
|
232
|
-
for (let decade = 1; decade <= to; decade *= 10) {
|
|
233
|
-
for (const m of [1, 2, 5]) {
|
|
234
|
-
const v = decade * m;
|
|
235
|
-
if (v >= from && v <= to)
|
|
236
|
-
out.push(v);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
if (out.length === 0 || out[out.length - 1] !== to)
|
|
240
|
-
out.push(to);
|
|
241
|
-
return [...new Set(out)].sort((a, b) => a - b);
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* The four lines: two that grow with the instance count and two that stay flat — the flat ones are what the
|
|
245
|
-
* instances share. Materials are dashed and drawn last, so a line under them still shows where the two meet.
|
|
246
|
-
*/
|
|
247
|
-
export const CURVE_SERIES = [
|
|
248
|
-
{ key: 'triangles', flat: false },
|
|
249
|
-
{ key: 'drawCalls', flat: false },
|
|
250
|
-
{ key: 'geometries', flat: true },
|
|
251
|
-
{ key: 'materials', flat: true, dashed: true }
|
|
252
|
-
];
|
|
253
|
-
/** The chart's size. The chart is shown at this size in a sheet; shrunk into the side, its words are unreadable. */
|
|
254
|
-
export const CURVE_SIZE = { width: 680, height: 380, pad: { top: 52, right: 208, bottom: 44, left: 62 } };
|
|
255
|
-
const log10 = (v) => Math.log(Math.max(v, 1)) / Math.LN10;
|
|
256
|
-
/** 1, 10, 100 … written short. */
|
|
257
|
-
export function shortNumber(v) {
|
|
258
|
-
if (v >= 1_000_000)
|
|
259
|
-
return `${v / 1_000_000}M`;
|
|
260
|
-
if (v >= 1_000)
|
|
261
|
-
return `${v / 1_000}k`;
|
|
262
|
-
return String(v);
|
|
263
|
-
}
|
|
264
|
-
/** Where the chart puts each line and tick. Both axes are logarithmic. */
|
|
265
|
-
export function curveLayout(points) {
|
|
266
|
-
if (points.length === 0)
|
|
267
|
-
return undefined;
|
|
268
|
-
const { width, height, pad } = CURVE_SIZE;
|
|
269
|
-
const minX = points[0].instances;
|
|
270
|
-
const maxX = points[points.length - 1].instances;
|
|
271
|
-
let maxY = 1;
|
|
272
|
-
for (const p of points)
|
|
273
|
-
for (const s of CURVE_SERIES)
|
|
274
|
-
maxY = Math.max(maxY, p[s.key]);
|
|
275
|
-
const plotW = width - pad.left - pad.right;
|
|
276
|
-
const plotH = height - pad.top - pad.bottom;
|
|
277
|
-
const spanX = Math.max(log10(maxX) - log10(minX), 1e-9);
|
|
278
|
-
const spanY = Math.max(log10(maxY), 1e-9);
|
|
279
|
-
const px = (v) => pad.left + ((log10(v) - log10(minX)) / spanX) * plotW;
|
|
280
|
-
const py = (v) => pad.top + plotH - (log10(v) / spanY) * plotH;
|
|
281
|
-
const yTicks = [];
|
|
282
|
-
for (let e = 0; Math.pow(10, e) <= maxY * 1.001; e++)
|
|
283
|
-
yTicks.push({ y: py(Math.pow(10, e)), label: shortNumber(Math.pow(10, e)) });
|
|
284
|
-
const xTicks = [];
|
|
285
|
-
for (let e = 0; Math.pow(10, e) <= maxX * 1.001; e++) {
|
|
286
|
-
const v = Math.pow(10, e);
|
|
287
|
-
if (v >= minX)
|
|
288
|
-
xTicks.push({ x: px(v), label: shortNumber(v) });
|
|
289
|
-
}
|
|
290
|
-
const last = points[points.length - 1];
|
|
291
|
-
const lines = CURVE_SERIES.map(s => ({
|
|
292
|
-
key: s.key,
|
|
293
|
-
d: points.map((p, i) => `${i === 0 ? 'M' : 'L'}${px(p.instances).toFixed(1)},${py(p[s.key]).toFixed(1)}`).join(' '),
|
|
294
|
-
flat: s.flat,
|
|
295
|
-
dashed: !!s.dashed,
|
|
296
|
-
last: last[s.key]
|
|
297
|
-
}));
|
|
298
|
-
const flat = new Set(CURVE_SERIES.filter(s => s.flat).map(s => last[s.key]));
|
|
299
|
-
return { xTicks, yTicks, lines, overlap: flat.size === 1 ? [...flat][0] : undefined };
|
|
300
|
-
}
|
|
301
|
-
export function budgetOf(report) {
|
|
302
|
-
if (!report)
|
|
303
|
-
return undefined;
|
|
304
|
-
const { tightest } = report.score;
|
|
305
|
-
return {
|
|
306
|
-
triangles: report.cost.triangles,
|
|
307
|
-
groups: report.cost.groups,
|
|
308
|
-
instances: report.capacity.instances,
|
|
309
|
-
grade: report.score.grade,
|
|
310
|
-
tightest: { key: tightest.key, used: tightest.used, limit: Math.floor(tightest.limit) }
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
//# sourceMappingURL=v3-maturity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v3-maturity.js","sourceRoot":"","sources":["../../client/modeller/v3-maturity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,eAAe,EACf,SAAS,EACT,cA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,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;AACvF,CAAC;AAWD,MAAM,UAAU,QAAQ,CAAC,MAA4B;IACnD,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAA;IAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,KAAK,CAAA;IACjC,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS;QAChC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;QAC1B,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS;QACpC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK;QACzB,QAAQ,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;KACxF,CAAA;AACH,CAAC","sourcesContent":["import {\n compileV3Asset,\n compileV3Document,\n LIMITS,\n SEGMENT_PRESETS,\n V3_BUDGET_KEYS,\n V3_GRADE_SCALE,\n v3CostOf,\n v3GradeOf,\n v3MaterialKeyOf,\n v3ScoreOf,\n v3WorldBoxesOf,\n v3WritersOf\n} from '@hatiolab/figure-model'\nimport type { V3Asset, V3AssetGeometry, V3BudgetKey, V3BudgetUse, V3Cost, V3Geometry, V3Score } from '@hatiolab/figure-model'\n\nimport { capacityFrom } from './scene-budget.js'\nimport type { FigureCapacity } from './scene-budget.js'\n\n/*\n * The modeller's maturity report, read off the evaluated asset (user, 2026-09-24: the tab showed a count and nothing\n * else — 「왜 이렇게 너프되었는지」):\n *\n * grade A–D and its scale figure-model's `v3ScoreOf`: one screen's target shared per instance (groups,\n * triangles) and the declared rule limits (independent, transparent)\n * radar · axes six axes; reactive is not measured, and detail has no V3 field\n * drawing cost triangles, distinct shapes, distinct materials\n * trend what grows with the instance count and what the instances share\n *\n * Kept apart from the element so it can be tested without a browser.\n *\n * ## What the V3 renderer shares, which is what the numbers count\n *\n * things-scene draws one mesh per drawn body (`figure-v3-rig.ts`) — no merging by material — so a body is\n * a draw call. It shares geometry by provider, dimensions, segments and profile (`figure-v3-geometry.ts`, `keyOf`)\n * and materials by token, preset, transparency and light (`materialFor`). The keys below are those keys; a\n * distinct-shape count that used another key would describe a renderer that does not exist.\n *\n * ## Budgets V3 does not have\n *\n * Two budgets are not measured here, and are not shown as zero:\n * - off-palette surfaces: the V3 material has no surface field, so there is nothing to count;\n * - part count by detail level: V3 does not carry the detail level (chief architect, 2026-09-24, ADR-0087).\n */\n\n/*\n The grade, its budgets and its bounds are figure-model's (`v3ScoreOf`), so the catalogue grades a figure as this tab\n does. The grade is the headroom against one screen's target (`LIMITS.screenInstances`), not a draw-call limit.\n*/\nexport { V3_BUDGET_KEYS, V3_GRADE_SCALE as GRADE_SCALE, v3GradeOf as gradeOf }\nexport type { V3BudgetKey, V3BudgetUse, V3Score }\n\nexport type V3AxisKey = 'scale' | 'consistency' | 'reuse' | 'detail' | 'reactive' | 'readable'\n\n/** One maturity axis. */\nexport interface V3MaturityAxis {\n key: V3AxisKey\n /** 0–1. Absent when the axis cannot be measured. */\n ratio?: number\n reading?: string\n /** A reading that is words, not a number. */\n readingKey?: string\n because?: string\n /** Why the axis is not measured. When present there is no ratio — an unmeasured axis is not a zero. */\n blocked?: string\n}\n\n/** Instances on one screen, and what each series costs at that count. */\nexport interface V3CurvePoint {\n instances: number\n triangles: number\n drawCalls: number\n /** Vertex buffers: one per distinct shape, shared by every instance of the same size. */\n geometries: number\n materials: number\n}\n\nexport interface V3Report {\n cost: V3Cost\n capacity: FigureCapacity\n score: V3Score\n /** Distinct shapes and materials among the drawn bodies — the 「그리는 비용」 rows. */\n distinctShapes: number\n distinctMaterials: number\n reuse: { distinct: number; parts: number; saved: number }\n axes: V3MaturityAxis[]\n curve: V3CurvePoint[]\n}\n\n/** The board target for the scale axis: 500 assets on one drawing (design document §4.15). */\nexport const BOARD_ASSETS = 500\n\n/**\n * The report for one asset, or nothing when no body is drawn — then there is nothing to measure, and the screen\n * says so rather than drawing zeros.\n *\n * Evaluated at the asset's own design and state defaults, as `v3CostOf` is.\n */\nexport function v3ReportOf(asset: V3Asset): V3Report | undefined {\n const cost = v3CostOf(asset)\n const capacity = capacityFrom(cost.groups, cost.triangles)\n if (!capacity) return undefined\n\n const drawn = compileV3Asset(asset)\n .evaluate()\n .geometry.filter(body => body.visible !== false)\n const plan = compileV3Document(asset.document)\n const writers = v3WritersOf(asset)\n\n const shapes = new Set(drawn.map(shapeKeyOf))\n const materials = new Set(drawn.map(materialKeyOf))\n\n const score = v3ScoreOf(asset)!\n\n const reuse = { distinct: shapes.size, parts: drawn.length, saved: drawn.length - shapes.size }\n\n const axes: V3MaturityAxis[] = [\n {\n key: 'scale',\n // The board target filled is 1; room beyond it is better spent on the other axes, so it does not count more.\n ratio: Math.min(1, capacity.instances / BOARD_ASSETS),\n reading: String(capacity.instances),\n because: 'figure.text.maturity-scale-because'\n },\n consistency(asset, materials.size),\n {\n key: 'reuse',\n // A low distinct-to-parts ratio is much reuse; turned over so that more is higher.\n ratio: reuse.parts === 0 ? 0 : 1 - reuse.distinct / reuse.parts,\n reading: String(reuse.saved),\n because: 'figure.text.maturity-reuse-because'\n },\n { key: 'detail', blocked: 'figure.text.maturity-blocked-no-detail-level' },\n { key: 'reactive', blocked: 'figure.text.maturity-blocked-no-binding' },\n readable(asset, plan, drawn, writers)\n ]\n\n return {\n cost,\n capacity,\n score,\n distinctShapes: shapes.size,\n distinctMaterials: materials.size,\n reuse,\n axes,\n curve: decadeSteps(1, 10000).map(instances => ({\n instances,\n triangles: cost.triangles * instances,\n drawCalls: cost.groups * instances,\n geometries: shapes.size,\n materials: materials.size\n }))\n }\n}\n\n/**\n * The key things-scene shares a body's geometry by (`figure-v3-geometry.ts` `keyOf`): provider, dimensions to a\n * micrometre, segments (12 when unset), and a polygon's corners.\n */\nexport function shapeKeyOf(body: V3AssetGeometry | V3Geometry): string {\n if (!('shape' in body)) {\n // A scalar body has no mesh of its own; it is still one drawn body, told apart by what it declares.\n const dims = Object.keys(body.dimensions).sort().map(k => `${k}=${body.dimensions[k]}`).join(',')\n return `${body.provider}|${dims}`\n }\n const shape = body.shape\n const round = (v: number) => Math.round(v * 1e6) / 1e6\n const dims = Object.keys(shape.dimensions)\n .sort()\n .map(k => `${k}=${round(shape.dimensions[k]!)}`)\n .join(',')\n const profile = shape.profile ? '|' + shape.profile.map(p => `${round(p.x)}:${round(p.y)}`).join(';') : ''\n const segments = (body as { segments?: number }).segments ?? 12\n return `${shape.provider}|${dims}|s${segments}${profile}`\n}\n\n/**\n * The key things-scene shares a material by (`figure-v3-rig.ts` `materialFor`), within one asset: token, preset,\n * transparency, and the light when it is on. The colour follows from the token, so it is not a second key.\n */\nexport function materialKeyOf(body: V3AssetGeometry): string {\n return v3MaterialKeyOf(body)\n}\n\n/**\n * Does it look like one set — baselines 3 and 4, three checks.\n *\n * Two of them hold by construction in V3: the material has no surface field, so there is no texture, and the\n * format refuses a segment count outside the presets (`compileV3Asset`, `QUALITY`). They are still counted, so\n * the ratio stays one fault in three.\n */\nfunction consistency(asset: V3Asset, distinctMaterials: number): V3MaturityAxis {\n const textures = 0\n const offPreset = asset.appearance.filter(look => look.segments !== undefined && !SEGMENT_PRESETS.includes(look.segments)).length\n const faults = (textures > 0 ? 1 : 0) + (offPreset > 0 ? 1 : 0) + (distinctMaterials > LIMITS.distinctMaterials ? 1 : 0)\n return {\n key: 'consistency',\n ratio: (3 - faults) / 3,\n readingKey: faults === 0 ? 'figure.text.maturity-consistency-clean' : 'figure.text.maturity-consistency-faults',\n because: 'figure.text.maturity-consistency-because'\n }\n}\n\n/** Seen from above, these do not fill their footprint box, by V3 provider name. */\nconst ROUND_FOOTPRINT: readonly string[] = ['cylinder', 'ellipticCylinder', 'frustum', 'sphere']\n\n/**\n * Can it be told apart from above — baseline 1.\n *\n * Viewpoint entropy (Vázquez et al.) over the top view, counted by colour region rather than by face so that a\n * finer segment count does not raise it: H = −Σ p·log p over each material's share of the footprint plus the\n * background, divided by log(`LIMITS.distinctMaterials` + 1), the most this measure can reach.\n *\n * The footprint is the base box: the space the asset declares when it declares one (ADR-0044's box is V3's\n * occupancy), otherwise the drawn bodies' own extent. Bodies are their axis-aligned world boxes\n * (`v3WorldBoxesOf`, the gate's reading); the higher one covers the lower.\n */\nfunction readable(\n asset: V3Asset,\n plan: ReturnType<typeof compileV3Document>,\n drawn: V3AssetGeometry[],\n writers: Map<string, string>\n): V3MaturityAxis {\n const placed = drawn\n .filter(body => 'pose' in body)\n // One placed, drawn body gives exactly one box; boxes are taken one by one to keep each with its material.\n .map(body => ({ body, box: v3WorldBoxesOf([body], writers)[0]! }))\n if (placed.length === 0) return { key: 'readable', blocked: 'figure.text.maturity-blocked-no-parts' }\n\n let frame: { x0: number; x1: number; z0: number; z1: number }\n if (asset.occupancy) {\n const values = plan.evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values\n const at = (ref: string) => values[ref] as number\n const b = asset.occupancy.bounds\n frame = { x0: at(b.x.min), x1: at(b.x.max), z0: at(b.z.min), z1: at(b.z.max) }\n } else {\n frame = { x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }\n for (const { box } of placed) {\n frame.x0 = Math.min(frame.x0, box.centre.x - box.extent.x / 2)\n frame.x1 = Math.max(frame.x1, box.centre.x + box.extent.x / 2)\n frame.z0 = Math.min(frame.z0, box.centre.z - box.extent.z / 2)\n frame.z1 = Math.max(frame.z1, box.centre.z + box.extent.z / 2)\n }\n }\n\n const regions = topViewRegions(placed, frame)\n if (regions.total === 0) return { key: 'readable', blocked: 'figure.text.maturity-blocked-no-parts' }\n\n const shares = [...regions.byMaterial.values(), regions.background].map(area => area / regions.footprint).filter(share => share > 0)\n const entropy = -shares.reduce((sum, p) => sum + p * Math.log(p), 0)\n const ceiling = Math.log(LIMITS.distinctMaterials + 1)\n return {\n key: 'readable',\n // Clamped both ways: one region alone gives −0, which is not a reading anyone should see.\n ratio: Math.max(0, Math.min(1, entropy / ceiling)),\n reading: String(regions.byMaterial.size),\n because: 'figure.text.maturity-readable-because'\n }\n}\n\n/** Which material shows from above, on a 64 × 64 grid over the footprint, over world boxes. */\nfunction topViewRegions(\n placed: { body: V3AssetGeometry; box: ReturnType<typeof v3WorldBoxesOf>[number] }[],\n frame: { x0: number; x1: number; z0: number; z1: number }\n) {\n const GRID = 64\n const cells = new Array<string | null>(GRID * GRID).fill(null)\n const height = new Float64Array(GRID * GRID)\n const sx = GRID / Math.max(frame.x1 - frame.x0, 1e-6)\n const sz = GRID / Math.max(frame.z1 - frame.z0, 1e-6)\n\n for (const { body, box } of placed) {\n const top = box.centre.y + box.extent.y / 2\n const key = materialKeyOf(body)\n const x0 = Math.max(0, Math.floor((box.centre.x - box.extent.x / 2 - frame.x0) * sx))\n const x1 = Math.min(GRID, Math.ceil((box.centre.x + box.extent.x / 2 - frame.x0) * sx))\n const y0 = Math.max(0, Math.floor((box.centre.z - box.extent.z / 2 - frame.z0) * sz))\n const y1 = Math.min(GRID, Math.ceil((box.centre.z + box.extent.z / 2 - frame.z0) * sz))\n const round = 'shape' in body && ROUND_FOOTPRINT.includes(body.shape.provider)\n\n for (let y = y0; y < y1; y++) {\n for (let x = x0; x < x1; x++) {\n // A round body does not fill its box; the corners are cut.\n if (round) {\n const cx = (x + 0.5 - (x0 + x1) / 2) / ((x1 - x0) / 2 || 1)\n const cy = (y + 0.5 - (y0 + y1) / 2) / ((y1 - y0) / 2 || 1)\n if (cx * cx + cy * cy > 1) continue\n }\n const i = y * GRID + x\n if (cells[i] === null || top > height[i]!) {\n cells[i] = key\n height[i] = top\n }\n }\n }\n }\n\n const byMaterial = new Map<string, number>()\n let covered = 0\n for (const key of cells) {\n if (key === null) continue\n covered++\n byMaterial.set(key, (byMaterial.get(key) ?? 0) + 1)\n }\n return { byMaterial, total: covered, background: GRID * GRID - covered, footprint: GRID * GRID }\n}\n\n/** 1 · 2 · 5 per decade: even steps on a log axis. */\nexport function decadeSteps(from: number, to: number): number[] {\n const out: number[] = []\n for (let decade = 1; decade <= to; decade *= 10) {\n for (const m of [1, 2, 5]) {\n const v = decade * m\n if (v >= from && v <= to) out.push(v)\n }\n }\n if (out.length === 0 || out[out.length - 1] !== to) out.push(to)\n return [...new Set(out)].sort((a, b) => a - b)\n}\n\n// ─── The trend chart ─────────────────────────────────────────────────────────\n\nexport type V3CurveSeries = 'triangles' | 'drawCalls' | 'geometries' | 'materials'\n\n/**\n * The four lines: two that grow with the instance count and two that stay flat — the flat ones are what the\n * instances share. Materials are dashed and drawn last, so a line under them still shows where the two meet.\n */\nexport const CURVE_SERIES: readonly { key: V3CurveSeries; flat: boolean; dashed?: boolean }[] = [\n { key: 'triangles', flat: false },\n { key: 'drawCalls', flat: false },\n { key: 'geometries', flat: true },\n { key: 'materials', flat: true, dashed: true }\n]\n\n/** The chart's size. The chart is shown at this size in a sheet; shrunk into the side, its words are unreadable. */\nexport const CURVE_SIZE = { width: 680, height: 380, pad: { top: 52, right: 208, bottom: 44, left: 62 } } as const\n\nexport interface V3CurveLayout {\n xTicks: { x: number; label: string }[]\n yTicks: { y: number; label: string }[]\n lines: { key: V3CurveSeries; d: string; flat: boolean; dashed: boolean; last: number }[]\n /** The value the flat lines share when they lie on one another, so the screen can say why one line is missing. */\n overlap?: number\n}\n\nconst log10 = (v: number) => Math.log(Math.max(v, 1)) / Math.LN10\n\n/** 1, 10, 100 … written short. */\nexport function shortNumber(v: number): string {\n if (v >= 1_000_000) return `${v / 1_000_000}M`\n if (v >= 1_000) return `${v / 1_000}k`\n return String(v)\n}\n\n/** Where the chart puts each line and tick. Both axes are logarithmic. */\nexport function curveLayout(points: V3CurvePoint[]): V3CurveLayout | undefined {\n if (points.length === 0) return undefined\n const { width, height, pad } = CURVE_SIZE\n const minX = points[0]!.instances\n const maxX = points[points.length - 1]!.instances\n let maxY = 1\n for (const p of points) for (const s of CURVE_SERIES) maxY = Math.max(maxY, p[s.key])\n\n const plotW = width - pad.left - pad.right\n const plotH = height - pad.top - pad.bottom\n const spanX = Math.max(log10(maxX) - log10(minX), 1e-9)\n const spanY = Math.max(log10(maxY), 1e-9)\n const px = (v: number) => pad.left + ((log10(v) - log10(minX)) / spanX) * plotW\n const py = (v: number) => pad.top + plotH - (log10(v) / spanY) * plotH\n\n const yTicks: V3CurveLayout['yTicks'] = []\n for (let e = 0; Math.pow(10, e) <= maxY * 1.001; e++) yTicks.push({ y: py(Math.pow(10, e)), label: shortNumber(Math.pow(10, e)) })\n const xTicks: V3CurveLayout['xTicks'] = []\n for (let e = 0; Math.pow(10, e) <= maxX * 1.001; e++) {\n const v = Math.pow(10, e)\n if (v >= minX) xTicks.push({ x: px(v), label: shortNumber(v) })\n }\n\n const last = points[points.length - 1]!\n const lines = CURVE_SERIES.map(s => ({\n key: s.key,\n d: points.map((p, i) => `${i === 0 ? 'M' : 'L'}${px(p.instances).toFixed(1)},${py(p[s.key]).toFixed(1)}`).join(' '),\n flat: s.flat,\n dashed: !!s.dashed,\n last: last[s.key]\n }))\n const flat = new Set(CURVE_SERIES.filter(s => s.flat).map(s => last[s.key]))\n return { xTicks, yTicks, lines, overlap: flat.size === 1 ? [...flat][0] : undefined }\n}\n\n/** What the parts list shows under its title: the cost, how many fit, the grade and what decides it. */\nexport interface V3BudgetLine {\n triangles: number\n groups: number\n instances: number\n grade: string\n tightest: { key: string; used: number; limit: number }\n}\n\nexport function budgetOf(report: V3Report | undefined): V3BudgetLine | undefined {\n if (!report) return undefined\n const { tightest } = report.score\n return {\n triangles: report.cost.triangles,\n groups: report.cost.groups,\n instances: report.capacity.instances,\n grade: report.score.grade,\n tightest: { key: tightest.key, used: tightest.used, limit: Math.floor(tightest.limit) }\n }\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type V3AuthoringAction } from '@hatiolab/figure-model';
|
|
2
|
-
/**
|
|
3
|
-
* 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.
|
|
4
|
-
*
|
|
5
|
-
* figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인
|
|
6
|
-
* (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인
|
|
7
|
-
* 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한
|
|
8
|
-
* 번에 만든다.
|
|
9
|
-
*
|
|
10
|
-
* 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시
|
|
11
|
-
* 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의
|
|
12
|
-
* 모델러 기본이 바닥이다.
|
|
13
|
-
*/
|
|
14
|
-
export declare function occupancyFromParts(source: string,
|
|
15
|
-
/** A different face to place it by — the properties tab's choice. Absent keeps the declared one. */
|
|
16
|
-
placement?: 'floor' | 'ceiling' | 'center' | 'wall'): Extract<V3AuthoringAction, {
|
|
17
|
-
kind: 'declare-occupancy';
|
|
18
|
-
}>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { parseV3Asset, proposeV3Occupancy } from '@hatiolab/figure-model';
|
|
2
|
-
/**
|
|
3
|
-
* 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.
|
|
4
|
-
*
|
|
5
|
-
* figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인
|
|
6
|
-
* (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인
|
|
7
|
-
* 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한
|
|
8
|
-
* 번에 만든다.
|
|
9
|
-
*
|
|
10
|
-
* 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시
|
|
11
|
-
* 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의
|
|
12
|
-
* 모델러 기본이 바닥이다.
|
|
13
|
-
*/
|
|
14
|
-
export function occupancyFromParts(source,
|
|
15
|
-
/** A different face to place it by — the properties tab's choice. Absent keeps the declared one. */
|
|
16
|
-
placement) {
|
|
17
|
-
const asset = parseV3Asset(source);
|
|
18
|
-
return {
|
|
19
|
-
kind: 'declare-occupancy',
|
|
20
|
-
proposal: proposeV3Occupancy(asset, { over: 'range' }),
|
|
21
|
-
placement: placement ?? asset.occupancy?.placement ?? 'floor'
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=v3-occupancy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { V3PrimitiveCreation } from '@hatiolab/figure-model';
|
|
2
|
-
import type { V3PaletteKind } from './figure-v3-parts.js';
|
|
3
|
-
/**
|
|
4
|
-
* What a palette button makes: the part at a starting size a person then changes. Standing on the floor (its lowest
|
|
5
|
-
* point at y 0) where the provider's frame is centred; a portal's frame already rises from its bottom.
|
|
6
|
-
*/
|
|
7
|
-
export declare function paletteRecipe(kind: V3PaletteKind, id: string): V3PrimitiveCreation;
|