@hatiolab/figure-model 0.1.81 → 0.1.83
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/CHANGELOG.md +29 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/v3-authoring-actions.d.ts +8 -0
- package/dist/v3-authoring-actions.d.ts.map +1 -1
- package/dist/v3-authoring-actions.js +6 -3
- package/dist/v3-authoring-actions.js.map +1 -1
- package/dist/v3-create.d.ts +14 -0
- package/dist/v3-create.d.ts.map +1 -1
- package/dist/v3-create.js +2 -1
- package/dist/v3-create.js.map +1 -1
- package/dist/v3-follow.d.ts +28 -0
- package/dist/v3-follow.d.ts.map +1 -0
- package/dist/v3-follow.js +68 -0
- package/dist/v3-follow.js.map +1 -0
- package/dist/v3-graph.d.ts.map +1 -1
- package/dist/v3-graph.js +12 -1
- package/dist/v3-graph.js.map +1 -1
- package/dist/v3-kernel-version.d.ts +1 -1
- package/dist/v3-kernel-version.js +1 -1
- package/dist/v3-proposal.js +3 -3
- package/dist/v3-proposal.js.map +1 -1
- package/dist/v3-recipe-build.d.ts +27 -0
- package/dist/v3-recipe-build.d.ts.map +1 -0
- package/dist/v3-recipe-build.js +118 -0
- package/dist/v3-recipe-build.js.map +1 -0
- package/dist/v3-recipe-from-parts.d.ts +8 -0
- package/dist/v3-recipe-from-parts.d.ts.map +1 -0
- package/dist/v3-recipe-from-parts.js +178 -0
- package/dist/v3-recipe-from-parts.js.map +1 -0
- package/dist/v3-recipe.d.ts +81 -0
- package/dist/v3-recipe.d.ts.map +1 -0
- package/dist/v3-recipe.js +237 -0
- package/dist/v3-recipe.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type V3Recipe, type V3RecipeParam, type V3RecipeValue } from './v3-recipe.ts';
|
|
2
|
+
import type { V3Asset } from './v3-asset-types.ts';
|
|
3
|
+
/** Where a numeric parameter lands: the steps that match `step` (every key given, equal), at `path` (dot separated). */
|
|
4
|
+
export interface V3RecipeBinding {
|
|
5
|
+
step: Record<string, unknown>;
|
|
6
|
+
path: string;
|
|
7
|
+
}
|
|
8
|
+
export interface V3RecipeSpec {
|
|
9
|
+
name: string;
|
|
10
|
+
title: Record<string, string>;
|
|
11
|
+
description?: Record<string, string>;
|
|
12
|
+
category?: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
params: Array<V3RecipeParam & {
|
|
15
|
+
bind?: V3RecipeBinding[];
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface V3RecipeModel {
|
|
19
|
+
/** The choices this model shows: a value for every choice and flag parameter. */
|
|
20
|
+
values: Record<string, V3RecipeValue>;
|
|
21
|
+
asset: V3Asset;
|
|
22
|
+
}
|
|
23
|
+
export declare function buildV3Recipe(spec: V3RecipeSpec, models: readonly V3RecipeModel[], host?: string): V3Recipe & {
|
|
24
|
+
category?: string;
|
|
25
|
+
tags?: string[];
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=v3-recipe-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3-recipe-build.d.ts","sourceRoot":"","sources":["../src/v3-recipe-build.ts"],"names":[],"mappings":"AAaA,OAAO,EAAiB,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACrG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,wHAAwH;AACxH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,EAAE,KAAK,CAAC,aAAa,GAAG;QAAE,IAAI,CAAC,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC,CAAA;CAC5D;AAED,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACrC,KAAK,EAAE,OAAO,CAAA;CACf;AAaD,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,EAAE,IAAI,SAAS,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAiFpJ"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A recipe built from models (ADR-0095, as amended 2026-09-26: model first, verified, then the recipe).
|
|
3
|
+
*
|
|
4
|
+
* A template is authored as figures -- a `host` box and the template's parts fastened to it -- one figure for each
|
|
5
|
+
* combination of its choices (one leaf or two, a lamp or none). Each model is written as a command list
|
|
6
|
+
* (`v3RecipeFromParts`, the host becoming `{target}`), and the lists are merged into one recipe: a command in every model
|
|
7
|
+
* stays as it is; a command in some is kept with the one `when` that says which. The numbers a person sets are then
|
|
8
|
+
* bound: the spec names the command and the value, and the value becomes `{ param, times }` against its default.
|
|
9
|
+
*
|
|
10
|
+
* So what the recipe does is exactly what the models did -- the build refuses a model set it cannot say that way.
|
|
11
|
+
*/
|
|
12
|
+
import { V3ContractError } from "./v3-contract.js";
|
|
13
|
+
import { v3RecipeFromParts } from "./v3-recipe-from-parts.js";
|
|
14
|
+
import { parseV3Recipe } from "./v3-recipe.js";
|
|
15
|
+
const fail = (path, message) => {
|
|
16
|
+
throw new V3ContractError('RECIPE_BUILD', path, message);
|
|
17
|
+
};
|
|
18
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
19
|
+
/** Whether a value carries every key the pattern gives, all the way down; anything else equal. */
|
|
20
|
+
const matches = (value, pattern) => pattern && typeof pattern === 'object' && !Array.isArray(pattern)
|
|
21
|
+
? !!value && typeof value === 'object' && Object.entries(pattern).every(([k, v]) => matches(value[k], v))
|
|
22
|
+
: same(value, pattern);
|
|
23
|
+
export function buildV3Recipe(spec, models, host = 'host') {
|
|
24
|
+
if (!models.length)
|
|
25
|
+
fail('models', 'one model or more');
|
|
26
|
+
const choosers = spec.params.filter(p => p.kind === 'choice' || p.kind === 'flag');
|
|
27
|
+
/* The models are every combination of the choices, once each. */
|
|
28
|
+
let combos = [{}];
|
|
29
|
+
for (const p of choosers) {
|
|
30
|
+
const values = p.kind === 'flag' ? [true, false] : [...(p.options ?? [])];
|
|
31
|
+
combos = combos.flatMap(c => values.map(v => ({ ...c, [p.name]: v })));
|
|
32
|
+
}
|
|
33
|
+
const key = (values) => JSON.stringify(choosers.map(p => values[p.name]));
|
|
34
|
+
const byCombo = new Map(models.map(m => [key(m.values), m]));
|
|
35
|
+
if (byCombo.size !== models.length)
|
|
36
|
+
fail('models', 'two models show the same choices');
|
|
37
|
+
for (const c of combos)
|
|
38
|
+
if (!byCombo.has(key(c)))
|
|
39
|
+
fail('models', `no model shows ${JSON.stringify(c)}; one model is needed for each combination of the choices`);
|
|
40
|
+
if (models.length !== combos.length)
|
|
41
|
+
fail('models', `${models.length} models for ${combos.length} combinations of the choices`);
|
|
42
|
+
/* Each model as commands: every part but the host, the host being what it is put onto. */
|
|
43
|
+
const lists = combos.map(values => {
|
|
44
|
+
const m = byCombo.get(key(values));
|
|
45
|
+
if (!m.asset.appearance.some(a => a.target === host))
|
|
46
|
+
fail(`models.${key(values)}`, `the model has no ${host} part to stand for the part it is put onto`);
|
|
47
|
+
const parts = m.asset.appearance.map(a => a.target).filter(t => t !== host);
|
|
48
|
+
const recipe = v3RecipeFromParts(m.asset, parts, { name: spec.name, title: spec.title });
|
|
49
|
+
if (recipe.target !== 'part')
|
|
50
|
+
fail(`models.${key(values)}`, `the template's parts are not fastened to ${host}`);
|
|
51
|
+
return { values, steps: recipe.steps };
|
|
52
|
+
});
|
|
53
|
+
/* One list of every step, in an order each model keeps: the longest model's, the others' inserted after their predecessor. */
|
|
54
|
+
const merged = [];
|
|
55
|
+
for (const { steps } of [...lists].sort((a, b) => b.steps.length - a.steps.length)) {
|
|
56
|
+
let at = -1;
|
|
57
|
+
for (const step of steps) {
|
|
58
|
+
const found = merged.findIndex(s => same(s, step));
|
|
59
|
+
if (found >= 0)
|
|
60
|
+
at = found;
|
|
61
|
+
else
|
|
62
|
+
merged.splice(++at, 0, step);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const steps = merged.map(step => {
|
|
66
|
+
const where = lists.filter(l => l.steps.some(s => same(s, step))).map(l => l.values);
|
|
67
|
+
if (where.length === lists.length)
|
|
68
|
+
return step;
|
|
69
|
+
/* The one choice whose value is exactly where this step is. */
|
|
70
|
+
for (const p of choosers) {
|
|
71
|
+
const value = where[0][p.name];
|
|
72
|
+
const those = lists.filter(l => l.values[p.name] === value);
|
|
73
|
+
if (where.every(w => w[p.name] === value) && those.length === where.length)
|
|
74
|
+
return { when: { param: p.name, is: value }, ...step };
|
|
75
|
+
}
|
|
76
|
+
return fail(`steps.${step.kind}`, `${JSON.stringify(step).slice(0, 120)} is in the models of ${JSON.stringify(where)}, which no one choice says`);
|
|
77
|
+
});
|
|
78
|
+
/* Numbers a person sets: the value in the models becomes the parameter times its share. */
|
|
79
|
+
for (const p of spec.params) {
|
|
80
|
+
for (const b of p.bind ?? []) {
|
|
81
|
+
const found = steps.filter(s => matches(s, b.step));
|
|
82
|
+
if (!found.length)
|
|
83
|
+
fail(`params.${p.name}.bind`, `no step matches ${JSON.stringify(b.step)}`);
|
|
84
|
+
for (const s of found) {
|
|
85
|
+
const path = b.path.split('.');
|
|
86
|
+
let at = s;
|
|
87
|
+
for (const k of path.slice(0, -1))
|
|
88
|
+
at = (at?.[k] ?? fail(`params.${p.name}.bind`, `${b.path} is not in the step`));
|
|
89
|
+
const last = path[path.length - 1];
|
|
90
|
+
const v = at[last];
|
|
91
|
+
if (typeof v !== 'number')
|
|
92
|
+
fail(`params.${p.name}.bind`, `${b.path} is not a number in the step`);
|
|
93
|
+
if (p.kind !== 'ratio' && p.kind !== 'mm')
|
|
94
|
+
fail(`params.${p.name}`, `${p.name} is a ${p.kind}; only a ratio or a length is bound to a number`);
|
|
95
|
+
const d = p.default;
|
|
96
|
+
/* A share whose default is none (a position at the middle) is the number itself: the model's must be none too. */
|
|
97
|
+
if (d === 0 && v !== 0)
|
|
98
|
+
fail(`params.${p.name}.bind`, `${p.name} is 0 by default, so ${b.path} must be 0 in the models; it is ${String(v)}`);
|
|
99
|
+
const times = d === 0 ? 1 : Math.round((v / d) * 1e9) / 1e9;
|
|
100
|
+
at[last] = times === 1 ? { param: p.name } : { param: p.name, times };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const params = spec.params.map(({ bind: _bind, ...p }) => p);
|
|
105
|
+
const recipe = {
|
|
106
|
+
name: spec.name,
|
|
107
|
+
title: spec.title,
|
|
108
|
+
...(spec.description ? { description: spec.description } : {}),
|
|
109
|
+
...(spec.category ? { category: spec.category } : {}),
|
|
110
|
+
...(spec.tags ? { tags: spec.tags } : {}),
|
|
111
|
+
target: 'part',
|
|
112
|
+
params,
|
|
113
|
+
steps
|
|
114
|
+
};
|
|
115
|
+
parseV3Recipe(recipe);
|
|
116
|
+
return recipe;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=v3-recipe-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3-recipe-build.js","sourceRoot":"","sources":["../src/v3-recipe-build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;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E,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAA;YACvE,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,MAAM,EAAE,MAAe;QACvB,MAAM;QACN,KAAK;KACN,CAAA;IACD,aAAa,CAAC,MAAM,CAAC,CAAA;IACrB,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { V3Asset } from './v3-asset-types.ts';
|
|
2
|
+
import type { V3Recipe } from './v3-recipe.ts';
|
|
3
|
+
export declare function v3RecipeFromParts(asset: V3Asset, parts: readonly string[], meta: {
|
|
4
|
+
name: string;
|
|
5
|
+
title: Record<string, string>;
|
|
6
|
+
description?: Record<string, string>;
|
|
7
|
+
}): V3Recipe;
|
|
8
|
+
//# sourceMappingURL=v3-recipe-from-parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3-recipe-from-parts.d.ts","sourceRoot":"","sources":["../src/v3-recipe-from-parts.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAqC9C,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC1F,QAAQ,CA4GV"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A recipe made from parts already in a figure (ADR-0095): the person builds a door once, chooses its parts, and keeps
|
|
3
|
+
* them as a recipe -- no command list typed by hand.
|
|
4
|
+
*
|
|
5
|
+
* What is written is what the kernel already holds as canon: each part's shape at its measures now, its fastening and
|
|
6
|
+
* motion as the joint record says (ADR-0093), each measure that follows something as the link it is (`v3FollowOf`), its
|
|
7
|
+
* material and when it is shown. Names are the recipe's own: a chosen part becomes `{id}-<its name>`, the one part they
|
|
8
|
+
* hang from outside the choice becomes `{target}`, and a control of theirs `{id}-<its name>`. The common beginning of
|
|
9
|
+
* the chosen names (`sliding-door-1-`) is left off, so a recipe made of a recipe's parts does not stack names.
|
|
10
|
+
*
|
|
11
|
+
* It has no parameters: which numbers are left open is the person's to say afterwards, in the source.
|
|
12
|
+
*/
|
|
13
|
+
import { V3ContractError } from "./v3-contract.js";
|
|
14
|
+
import { compileV3Graph } from "./v3-graph.js";
|
|
15
|
+
import { v3FollowOf } from "./v3-follow.js";
|
|
16
|
+
const AXES = ['x', 'y', 'z'];
|
|
17
|
+
/** A shape the recipe can make again: its create kind, its measures in order, and the axes they lie along. */
|
|
18
|
+
const SHAPES = {
|
|
19
|
+
'box-shape@1': { kind: 'box', keys: ['width', 'height', 'depth'], along: ['x', 'y', 'z'] },
|
|
20
|
+
'rounded-box@1': { kind: 'rounded-box', keys: ['width', 'height', 'depth', 'round'], along: ['x', 'y', 'z'] },
|
|
21
|
+
'portal-profile@2': { kind: 'portal', keys: ['width', 'height', 'depth', 'jamb', 'head'], along: ['x', 'y', 'z'] },
|
|
22
|
+
'hollow-box@2': { kind: 'hollow-box', keys: ['width', 'height', 'depth', 'roundX', 'roundZ', 'wallX', 'wallZ', 'floor'], along: ['x', 'y', 'z'] },
|
|
23
|
+
'cylinder-shape@1': { kind: 'cylinder', keys: ['radius', 'length'], along: ['x', 'y'] },
|
|
24
|
+
'sphere-shape@1': { kind: 'sphere', keys: ['radiusX', 'radiusY', 'radiusZ'], along: [] },
|
|
25
|
+
'frustum-shape@1': { kind: 'frustum', keys: ['radiusTop', 'radiusBottom', 'height'], along: [] }
|
|
26
|
+
};
|
|
27
|
+
const fail = (path, message) => {
|
|
28
|
+
throw new V3ContractError('RECIPE_FROM_PARTS', path, message);
|
|
29
|
+
};
|
|
30
|
+
/** The keys whose value is a name: a part's, a joint's, a control's. A face or an axis is a word, never renamed. */
|
|
31
|
+
const NAMED = new Set(['part', 'id', 'joint', 'input']);
|
|
32
|
+
/**
|
|
33
|
+
* The names in a value renamed, where they stand as names. A part called `left` and the face `left` are the same
|
|
34
|
+
* string; renaming every such string turned a leaf's face into `{id}-left` (a double door's model, 2026-09-26).
|
|
35
|
+
*/
|
|
36
|
+
function renamed(value, names) {
|
|
37
|
+
const walk = (v, key) => {
|
|
38
|
+
if (typeof v === 'string')
|
|
39
|
+
return key && NAMED.has(key) ? (names.get(v) ?? v) : v;
|
|
40
|
+
if (Array.isArray(v))
|
|
41
|
+
return v.map(x => walk(x, key));
|
|
42
|
+
if (v && typeof v === 'object')
|
|
43
|
+
return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, walk(x, k)]));
|
|
44
|
+
return v;
|
|
45
|
+
};
|
|
46
|
+
return walk(value);
|
|
47
|
+
}
|
|
48
|
+
export function v3RecipeFromParts(asset, parts, meta) {
|
|
49
|
+
const chosen = new Set(parts);
|
|
50
|
+
if (!chosen.size)
|
|
51
|
+
fail('parts', 'choose the parts to keep as a recipe');
|
|
52
|
+
const model = asset.document.model;
|
|
53
|
+
const joints = (asset.joints ?? []);
|
|
54
|
+
for (const p of chosen)
|
|
55
|
+
if (!asset.appearance.some(a => a.target === p))
|
|
56
|
+
fail(`parts.${p}`, `${p} is not a part`);
|
|
57
|
+
/* Each chosen part is fastened: to the plane, to another chosen part, or to the one part outside they hang from. */
|
|
58
|
+
const jointOf = new Map();
|
|
59
|
+
const outside = new Set();
|
|
60
|
+
for (const p of chosen) {
|
|
61
|
+
const j = joints.find(o => o.body1.part === p);
|
|
62
|
+
if (!j)
|
|
63
|
+
fail(`parts.${p}`, `${p} is not fastened to anything; a recipe puts in parts where they are fastened -- fasten it first`);
|
|
64
|
+
jointOf.set(p, j);
|
|
65
|
+
if ('part' in j.body0 && !chosen.has(j.body0.part))
|
|
66
|
+
outside.add(j.body0.part);
|
|
67
|
+
}
|
|
68
|
+
if (outside.size > 1)
|
|
69
|
+
fail('parts', `the parts hang from ${[...outside].join(' and ')}; a recipe is put onto one part -- choose parts that hang from one`);
|
|
70
|
+
const target = [...outside][0];
|
|
71
|
+
/* A chosen part's measure following a part outside the choice other than the target has nothing to follow when put in. */
|
|
72
|
+
const values = compileV3Graph(asset.document.model).evaluate({ ...asset.designInputs, ...asset.stateDefaults }).values;
|
|
73
|
+
/* The names: the chosen parts' common beginning left off. */
|
|
74
|
+
const list = [...chosen];
|
|
75
|
+
let common = list.length > 1 ? list.reduce((a, b) => {
|
|
76
|
+
let i = 0;
|
|
77
|
+
while (i < a.length && a[i] === b[i])
|
|
78
|
+
i++;
|
|
79
|
+
return a.slice(0, i);
|
|
80
|
+
}) : '';
|
|
81
|
+
common = common.slice(0, common.lastIndexOf('-') + 1);
|
|
82
|
+
/* Only a name a recipe gave (`sliding-door-1-`): parts that merely share a word (`leg-1`, `leg-2`) keep their names. */
|
|
83
|
+
if (!/-\d+-$/.test(common))
|
|
84
|
+
common = '';
|
|
85
|
+
const local = (name) => (common && name.startsWith(common) ? name.slice(common.length) : name) || name;
|
|
86
|
+
const names = new Map();
|
|
87
|
+
for (const p of chosen)
|
|
88
|
+
names.set(p, `{id}-${local(p)}`);
|
|
89
|
+
for (const j of jointOf.values()) {
|
|
90
|
+
names.set(j.id, names.get(j.id) ?? `{id}-${local(j.id)}`);
|
|
91
|
+
if (j.state?.id)
|
|
92
|
+
names.set(j.state.id, `{id}-${local(j.state.id)}`);
|
|
93
|
+
}
|
|
94
|
+
if (target)
|
|
95
|
+
names.set(target, '{target}');
|
|
96
|
+
/* Parents first: a part is fastened after what it hangs from is there. */
|
|
97
|
+
const order = [];
|
|
98
|
+
const visit = (p, path) => {
|
|
99
|
+
if (order.includes(p))
|
|
100
|
+
return;
|
|
101
|
+
if (path.has(p))
|
|
102
|
+
fail(`parts.${p}`, 'the fastenings go round in a loop');
|
|
103
|
+
const j = jointOf.get(p);
|
|
104
|
+
if ('part' in j.body0 && chosen.has(j.body0.part))
|
|
105
|
+
visit(j.body0.part, new Set([...path, p]));
|
|
106
|
+
order.push(p);
|
|
107
|
+
};
|
|
108
|
+
for (const p of list)
|
|
109
|
+
visit(p, new Set());
|
|
110
|
+
const steps = [];
|
|
111
|
+
for (const p of order) {
|
|
112
|
+
const shape = model.nodes.find(n => n.id === `${p}.shape`);
|
|
113
|
+
const how = shape && SHAPES[shape.op];
|
|
114
|
+
if (!how)
|
|
115
|
+
fail(`parts.${p}`, `${p} is a ${shape?.op ?? 'shape'} a recipe cannot make again yet`);
|
|
116
|
+
const dimensions = Object.fromEntries(how.keys.map((key, i) => [key, Math.round((values[shape.args[i]] ?? NaN) * 1000) / 1000]));
|
|
117
|
+
if (Object.values(dimensions).some(v => !Number.isFinite(v)))
|
|
118
|
+
fail(`parts.${p}`, `${p}'s measures could not be read`);
|
|
119
|
+
steps.push({ kind: 'add-part', part: { id: names.get(p), kind: how.kind, dimensions } });
|
|
120
|
+
}
|
|
121
|
+
for (const p of order) {
|
|
122
|
+
const shape = model.nodes.find(n => n.id === `${p}.shape`);
|
|
123
|
+
for (const axis of SHAPES[shape.op].along) {
|
|
124
|
+
const f = v3FollowOf(asset, p, axis);
|
|
125
|
+
if (f.of === 'own' || f.of === 'expression' || f.of === 'input')
|
|
126
|
+
continue;
|
|
127
|
+
const scale = { ...(f.times !== undefined && f.times !== 1 ? { times: f.times } : {}), ...(f.plus ? { plus: f.plus } : {}) };
|
|
128
|
+
if (f.of === 'part') {
|
|
129
|
+
if (f.part !== target && !chosen.has(f.part))
|
|
130
|
+
fail(`parts.${p}.${axis}`, `${p}'s ${axis} follows ${f.part}, which is not in the recipe nor what it is put onto`);
|
|
131
|
+
steps.push({ kind: 'link-dimension', part: names.get(p), axis, source: { of: 'part', part: names.get(f.part), axis: f.axis }, ...scale, narrowRange: true });
|
|
132
|
+
}
|
|
133
|
+
else if (target) {
|
|
134
|
+
/* The figure's size is not the one it goes into: it follows the part it is put onto, in the proportion it has now. */
|
|
135
|
+
const targetShape = model.nodes.find(n => n.id === `${target}.shape`);
|
|
136
|
+
const along = targetShape && SHAPES[targetShape.op]?.along.includes(f.axis);
|
|
137
|
+
const targetMeasure = along ? values[targetShape.args[AXES.indexOf(f.axis)]] : undefined;
|
|
138
|
+
const size = asset.designInputs[`size.${f.axis}`];
|
|
139
|
+
if (!targetMeasure || !size)
|
|
140
|
+
fail(`parts.${p}.${axis}`, `${p}'s ${axis} follows the figure's size, and ${target} has no ${f.axis} measure to follow instead`);
|
|
141
|
+
const times = Math.round(((f.times * size) / targetMeasure) * 1e6) / 1e6;
|
|
142
|
+
steps.push({ kind: 'link-dimension', part: names.get(p), axis, source: { of: 'part', part: '{target}', axis: f.axis }, ...(times !== 1 ? { times } : {}), ...(f.plus ? { plus: f.plus } : {}), narrowRange: true });
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
steps.push({ kind: 'link-dimension', part: names.get(p), axis, source: { of: 'instance', axis: f.axis }, ...scale, narrowRange: true });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/* A joint that rows its part makes the largest size finite where it goes: narrowed there, as make-repeat is. */
|
|
150
|
+
for (const p of order)
|
|
151
|
+
steps.push({ kind: 'set-joint', joint: renamed(jointOf.get(p), names), ...(jointOf.get(p).repeat ? { narrowRange: true } : {}) });
|
|
152
|
+
for (const p of order) {
|
|
153
|
+
const look = asset.appearance.find(a => a.target === p);
|
|
154
|
+
/* The colours this part uses, and only those: the same part is written the same way whatever else is chosen. */
|
|
155
|
+
const palette = {};
|
|
156
|
+
for (const token of [look.material.token, look.material.emissive?.token].filter(Boolean))
|
|
157
|
+
if (asset.palette[token])
|
|
158
|
+
palette[token] = asset.palette[token];
|
|
159
|
+
steps.push({ kind: 'set-material', target: names.get(p), material: look.material, ...(Object.keys(palette).length ? { palette } : {}) });
|
|
160
|
+
if (look.segments)
|
|
161
|
+
steps.push({ kind: 'set-segments', target: names.get(p), segments: look.segments });
|
|
162
|
+
if (look.visibility) {
|
|
163
|
+
const node = model.nodes.find(n => n.op === 'at-least@1' && Object.values(n.outputs).includes(look.visibility));
|
|
164
|
+
const at = node && model.constants.find(c => c.id === node.args[1]);
|
|
165
|
+
if (node && at)
|
|
166
|
+
steps.push({ kind: 'set-visibility', target: names.get(p), shownWhen: { input: names.get(node.args[0]) ?? node.args[0], atLeast: at.value } });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
name: meta.name,
|
|
171
|
+
title: meta.title,
|
|
172
|
+
...(meta.description ? { description: meta.description } : {}),
|
|
173
|
+
target: target ? 'part' : 'figure',
|
|
174
|
+
params: [],
|
|
175
|
+
steps
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=v3-recipe-from-parts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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ACV,KAAK;KACN,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type V3ProposalStep } from './v3-proposal.ts';
|
|
2
|
+
import type { V3Asset } from './v3-asset-types.ts';
|
|
3
|
+
export type V3RecipeParamKind = 'face' | 'ratio' | 'mm' | 'choice' | 'flag';
|
|
4
|
+
export type V3RecipeValue = number | string | boolean;
|
|
5
|
+
export interface V3RecipeParam {
|
|
6
|
+
name: string;
|
|
7
|
+
kind: V3RecipeParamKind;
|
|
8
|
+
default: V3RecipeValue;
|
|
9
|
+
/** `ratio` and `mm`: the values it takes. */
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
/** `face` and `choice`: the values it takes. */
|
|
13
|
+
options?: V3RecipeValue[];
|
|
14
|
+
label?: Record<string, string>;
|
|
15
|
+
/** What the value does, in a few words per language: shown beside the field and in the catalog. */
|
|
16
|
+
hint?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export interface V3Recipe {
|
|
19
|
+
name: string;
|
|
20
|
+
title: Record<string, string>;
|
|
21
|
+
description?: Record<string, string>;
|
|
22
|
+
/** `part`: inserted onto a part the person has chosen (`{target}`); `figure`: onto the figure as a whole. */
|
|
23
|
+
target: 'part' | 'figure';
|
|
24
|
+
params: V3RecipeParam[];
|
|
25
|
+
/** Proposal steps, each with an optional `when`. */
|
|
26
|
+
steps: Array<Record<string, unknown>>;
|
|
27
|
+
}
|
|
28
|
+
/** A recipe as stored, checked for its own form: its parameters, its steps' `when`, its placeholders' names. */
|
|
29
|
+
export declare function parseV3Recipe(value: unknown): V3Recipe;
|
|
30
|
+
/** The name a recipe's parts take in this figure: the recipe's name and the first number no part or input uses. */
|
|
31
|
+
export declare function v3RecipeIdFor(asset: V3Asset, recipe: Pick<V3Recipe, 'name'>): string;
|
|
32
|
+
/**
|
|
33
|
+
* The proposal a recipe makes with these values: the defaults filled in, the values checked (ADR-0095 condition 3),
|
|
34
|
+
* the steps whose `when` does not hold left out, and the placeholders and linear forms resolved. A string that is only
|
|
35
|
+
* `{<param>}` takes the value itself (a number stays a number); inside a longer string it is written in.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveV3Recipe(recipe: V3Recipe, use: {
|
|
38
|
+
id: string;
|
|
39
|
+
target?: string;
|
|
40
|
+
values?: Record<string, V3RecipeValue>;
|
|
41
|
+
}): V3ProposalStep[];
|
|
42
|
+
/** A recipe put into a figure: resolved, then applied as one proposal (ADR-0094). The parts it made are named `id`. */
|
|
43
|
+
export declare function applyV3Recipe(asset: V3Asset, recipe: V3Recipe, use?: {
|
|
44
|
+
target?: string;
|
|
45
|
+
values?: Record<string, V3RecipeValue>;
|
|
46
|
+
}): {
|
|
47
|
+
asset: V3Asset;
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
/** The room a recipe is tried in when it is saved: a 4 x 3 x 6 m box on the floor that follows the figure's size. */
|
|
51
|
+
export declare function v3RecipeTestRoom(): {
|
|
52
|
+
asset: V3Asset;
|
|
53
|
+
target: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A recipe's test (ADR-0095): parsed, put into the test room with its defaults, and the result, with its room declared,
|
|
57
|
+
* passing the release gate. Throws the kernel's refusal, or `RECIPE_GATE` with the gate's findings.
|
|
58
|
+
*/
|
|
59
|
+
export declare function checkV3Recipe(value: unknown): V3Recipe;
|
|
60
|
+
/** What a recipe adds, worked out from its steps: for a catalog, so what it says is what the recipe does. */
|
|
61
|
+
export interface V3RecipeDescription {
|
|
62
|
+
/** How many parts it adds: fewest and most over its choices. */
|
|
63
|
+
parts: {
|
|
64
|
+
min: number;
|
|
65
|
+
max: number;
|
|
66
|
+
};
|
|
67
|
+
/** Each part that moves on a joint: sliding or turning, and whose motion it follows. */
|
|
68
|
+
moves: Array<{
|
|
69
|
+
part: string;
|
|
70
|
+
kind: 'slide' | 'turn';
|
|
71
|
+
follows?: string;
|
|
72
|
+
}>;
|
|
73
|
+
/** The controls it adds. */
|
|
74
|
+
controls: string[];
|
|
75
|
+
/** The parts shown only while a control is at least a value. */
|
|
76
|
+
shownByControl: string[];
|
|
77
|
+
/** The parts laid as a row of copies. */
|
|
78
|
+
rows: string[];
|
|
79
|
+
}
|
|
80
|
+
export declare function describeV3Recipe(recipe: V3Recipe): V3RecipeDescription;
|
|
81
|
+
//# sourceMappingURL=v3-recipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3-recipe.d.ts","sourceRoot":"","sources":["../src/v3-recipe.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAA;AAC3E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAErD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,iBAAiB,CAAA;IACvB,OAAO,EAAE,aAAa,CAAA;IACtB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gDAAgD;IAChD,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,mGAAmG;IACnG,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,6G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