@hatiolab/figure-model 0.1.76 → 0.1.77
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 +11 -0
- package/README.md +60 -138
- package/dist/index.d.ts +1 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -26
- package/dist/index.js.map +1 -1
- package/dist/v3-asset-types.d.ts +1 -2
- package/dist/v3-asset-types.d.ts.map +1 -1
- package/dist/v3-asset.js +1 -1
- package/dist/v3-asset.js.map +1 -1
- package/dist/v3-authoring-actions.d.ts +9 -12
- package/dist/v3-authoring-actions.d.ts.map +1 -1
- package/dist/v3-authoring-actions.js +4 -5
- package/dist/v3-authoring-actions.js.map +1 -1
- package/dist/v3-capabilities.js +4 -1
- package/dist/v3-capabilities.js.map +1 -1
- package/dist/v3-cost.d.ts.map +1 -1
- package/dist/v3-cost.js +3 -5
- package/dist/v3-cost.js.map +1 -1
- package/dist/v3-create.d.ts +1 -1
- package/dist/v3-create.d.ts.map +1 -1
- package/dist/v3-examples.js +1 -1
- package/dist/v3-gate.d.ts +7 -8
- package/dist/v3-gate.d.ts.map +1 -1
- package/dist/v3-gate.js +11 -14
- package/dist/v3-gate.js.map +1 -1
- package/dist/v3-graph.d.ts +1 -2
- package/dist/v3-graph.d.ts.map +1 -1
- package/dist/v3-graph.js +5 -7
- package/dist/v3-graph.js.map +1 -1
- package/dist/v3-instance-size.d.ts +3 -5
- package/dist/v3-instance-size.d.ts.map +1 -1
- package/dist/v3-instance-size.js +2 -4
- package/dist/v3-instance-size.js.map +1 -1
- package/dist/v3-kernel-version.d.ts +1 -1
- package/dist/v3-kernel-version.js +1 -1
- package/dist/v3-part-edit.d.ts +4 -5
- package/dist/v3-part-edit.d.ts.map +1 -1
- package/dist/v3-part-edit.js +2 -2
- package/dist/v3-part-edit.js.map +1 -1
- package/dist/v3-proposal.js +1 -1
- package/dist/v3-proposal.js.map +1 -1
- package/dist/v3-release-contract.js +1 -1
- package/dist/v3-release-contract.js.map +1 -1
- package/dist/v3-score.d.ts +4 -5
- package/dist/v3-score.d.ts.map +1 -1
- package/dist/v3-score.js +7 -8
- package/dist/v3-score.js.map +1 -1
- package/dist/v3-words.d.ts +87 -0
- package/dist/v3-words.d.ts.map +1 -0
- package/dist/v3-words.js +87 -0
- package/dist/v3-words.js.map +1 -0
- package/docs/assembly-constraints-v3.md +13 -23
- package/docs/v3-asset-persistence.md +4 -4
- package/docs/v3-common-kernel-experiment.md +1 -1
- package/docs/v3-core-semantics.md +3 -3
- package/docs/v3-cutover.md +5 -3
- package/docs/v3-design.md +13 -26
- package/docs/v3-editor-integration.md +2 -2
- package/docs/v3-full-conveyor-validation.md +3 -3
- package/docs/v3-layout-system.md +1 -1
- package/docs/v3-minimal-model.md +0 -1
- package/docs/v3-motion-contract.md +21 -56
- package/docs/v3-runtime-extraction.md +7 -7
- package/docs/v3-sample-validation-expanded.md +1 -1
- package/docs/v3-sample-validation.md +1 -1
- package/docs/v3-shape-dimension-contract.md +23 -57
- package/docs/v3-status.md +5 -5
- package/docs/v3-storage-integration.md +4 -4
- package/package.json +2 -20
- package/dist/blueprint-shape.d.ts +0 -10
- package/dist/blueprint-shape.d.ts.map +0 -1
- package/dist/blueprint-shape.js +0 -194
- package/dist/blueprint-shape.js.map +0 -1
- package/dist/blueprint.d.ts +0 -73
- package/dist/blueprint.d.ts.map +0 -1
- package/dist/blueprint.js +0 -388
- package/dist/blueprint.js.map +0 -1
- package/dist/cost-chart.d.ts +0 -35
- package/dist/cost-chart.d.ts.map +0 -1
- package/dist/cost-chart.js +0 -150
- package/dist/cost-chart.js.map +0 -1
- package/dist/cost.d.ts +0 -162
- package/dist/cost.d.ts.map +0 -1
- package/dist/cost.js +0 -194
- package/dist/cost.js.map +0 -1
- package/dist/gate.d.ts +0 -65
- package/dist/gate.d.ts.map +0 -1
- package/dist/gate.js +0 -284
- package/dist/gate.js.map +0 -1
- package/dist/grouping.d.ts +0 -121
- package/dist/grouping.d.ts.map +0 -1
- package/dist/grouping.js +0 -224
- package/dist/grouping.js.map +0 -1
- package/dist/keys.d.ts +0 -45
- package/dist/keys.d.ts.map +0 -1
- package/dist/keys.js +0 -84
- package/dist/keys.js.map +0 -1
- package/dist/origin.d.ts +0 -33
- package/dist/origin.d.ts.map +0 -1
- package/dist/origin.js +0 -46
- package/dist/origin.js.map +0 -1
- package/dist/release-contract.d.ts +0 -38
- package/dist/release-contract.d.ts.map +0 -1
- package/dist/release-contract.js +0 -246
- package/dist/release-contract.js.map +0 -1
- package/dist/sizing.d.ts +0 -231
- package/dist/sizing.d.ts.map +0 -1
- package/dist/sizing.js +0 -550
- package/dist/sizing.js.map +0 -1
- package/dist/types.d.ts +0 -1233
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -547
- package/dist/types.js.map +0 -1
- package/dist/v3-from-v2.d.ts +0 -203
- package/dist/v3-from-v2.d.ts.map +0 -1
- package/dist/v3-from-v2.js +0 -2053
- package/dist/v3-from-v2.js.map +0 -1
- package/dist/v3-mesh-compare.d.ts +0 -24
- package/dist/v3-mesh-compare.d.ts.map +0 -1
- package/dist/v3-mesh-compare.js +0 -55
- package/dist/v3-mesh-compare.js.map +0 -1
- package/dist/validate.d.ts +0 -7
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js +0 -1119
- package/dist/validate.js.map +0 -1
- package/dist/visual-evidence.d.ts +0 -21
- package/dist/visual-evidence.d.ts.map +0 -1
- package/dist/visual-evidence.js +0 -52
- package/dist/visual-evidence.js.map +0 -1
- package/docs/design.md +0 -193
- package/docs/format-survey.md +0 -108
- package/docs/format.md +0 -704
- package/docs/sizing.md +0 -183
- package/docs/validation.md +0 -357
package/dist/grouping.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How parts turn into draw calls. **One answer, used by compile and by the
|
|
3
|
-
* policy check.**
|
|
4
|
-
*
|
|
5
|
-
* ## Why this file exists
|
|
6
|
-
*
|
|
7
|
-
* The policy counted `groupKeyOf` -- distinct colour and slot combinations --
|
|
8
|
-
* while `compile` split further and the runtime split further still. Three
|
|
9
|
-
* places had three answers, and the one shown to the author was the smallest.
|
|
10
|
-
*
|
|
11
|
-
* conveyor policy said 3 compile made 17 the screen drew 17
|
|
12
|
-
* cell tray policy said 2 compile made 2 the screen drew 9
|
|
13
|
-
*
|
|
14
|
-
* A cell tray that draws nine times passed a limit of three with room to
|
|
15
|
-
* spare. Raising the limit would not have touched that -- the number being
|
|
16
|
-
* compared was the wrong one.
|
|
17
|
-
*
|
|
18
|
-
* ## The three splits
|
|
19
|
-
*
|
|
20
|
-
* animation a part some clip moves goes on its own, since it cannot share a
|
|
21
|
-
* merged geometry with parts that stay put
|
|
22
|
-
* sizing a part that does not scale with the instance takes its own
|
|
23
|
-
* transform, and a merged geometry only takes one
|
|
24
|
-
* curvature a cylinder or sphere takes its own transform too, or the one
|
|
25
|
-
* transform a merged geometry gets turns it oval
|
|
26
|
-
* repeat one authored part, many meshes -- each copy is a draw call
|
|
27
|
-
*
|
|
28
|
-
* The first two make groups. The third multiplies inside a group, which is why
|
|
29
|
-
* `drawCallsOf` is not simply `groupsOf().length`.
|
|
30
|
-
*
|
|
31
|
-
* Before any of that, a part that is not drawn at all -- a capability anchor --
|
|
32
|
-
* drops out. See `isDrawn`.
|
|
33
|
-
*/
|
|
34
|
-
import { groupKeyOf } from "./keys.js";
|
|
35
|
-
import { CURVED_PRIMITIVES, DEFAULT_SIZING, REPEAT_LIMIT } from "./types.js";
|
|
36
|
-
/**
|
|
37
|
-
* The parts any clip moves.
|
|
38
|
-
*
|
|
39
|
-
* Merging is decided per part, and a clip names its parts from the outside, so
|
|
40
|
-
* the two have to be brought together before grouping can answer anything.
|
|
41
|
-
*
|
|
42
|
-
* It takes anything with channels, not an `AnimationClip`, because a parameter's clip is the
|
|
43
|
-
* same shape without the name — and what decides merging is being transformed on its own, not
|
|
44
|
-
* what does the transforming (ADR-0051 decision ③).
|
|
45
|
-
*/
|
|
46
|
-
export function animatedNames(clips) {
|
|
47
|
-
const names = new Set();
|
|
48
|
-
for (const clip of clips ?? []) {
|
|
49
|
-
for (const channel of clip.channels ?? []) {
|
|
50
|
-
if (typeof channel?.target === 'string')
|
|
51
|
-
names.add(channel.target);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return names;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* The parts a source moves, by a clip or by a parameter.
|
|
58
|
-
*
|
|
59
|
-
* compile and the release gate both need this set, and they must read it the same way: the gate
|
|
60
|
-
* once read `animations` only, so a figure driven by parameters showed fewer moving parts and
|
|
61
|
-
* fewer draw calls to the gate than compile produced (FORKLIFT: 13 moving parts and 18 draw calls
|
|
62
|
-
* in the blueprint, 0 and 10 at the gate).
|
|
63
|
-
*/
|
|
64
|
-
export function movingNames(source) {
|
|
65
|
-
return new Set([
|
|
66
|
-
...animatedNames(source.animations),
|
|
67
|
-
...animatedNames((source.parameters ?? []).map(parameter => parameter.clip ?? {}))
|
|
68
|
-
]);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Which joint's frame each part moves in: the nearest joint on its parent chain, the part itself included.
|
|
72
|
-
*
|
|
73
|
-
* A part missing from the map hangs from the figure frame. Parts in different frames cannot merge, since
|
|
74
|
-
* one merged geometry takes one transform (ADR-0066 decision 4).
|
|
75
|
-
*
|
|
76
|
-
* The walk stops at a name it has already seen, so a cycle (which validate reports) does not loop.
|
|
77
|
-
*/
|
|
78
|
-
export function jointFrames(source) {
|
|
79
|
-
const parentOf = new Map();
|
|
80
|
-
for (const part of source.parts)
|
|
81
|
-
if (typeof part.parent === 'string')
|
|
82
|
-
parentOf.set(part.name, part.parent);
|
|
83
|
-
const jointOfChild = new Map();
|
|
84
|
-
for (const joint of source.joints ?? [])
|
|
85
|
-
if (!jointOfChild.has(joint.child))
|
|
86
|
-
jointOfChild.set(joint.child, joint.name);
|
|
87
|
-
const frames = new Map();
|
|
88
|
-
for (const part of source.parts) {
|
|
89
|
-
const seen = new Set();
|
|
90
|
-
let at = part.name;
|
|
91
|
-
while (at !== undefined && !seen.has(at)) {
|
|
92
|
-
seen.add(at);
|
|
93
|
-
const joint = jointOfChild.get(at);
|
|
94
|
-
if (joint !== undefined) {
|
|
95
|
-
frames.set(part.name, joint);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
at = parentOf.get(at);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return frames;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* A part draws on its own when it cannot be merged with its neighbours.
|
|
105
|
-
*
|
|
106
|
-
* A curved part stands alone whatever its sizing. A merged geometry takes one
|
|
107
|
-
* transform, and an instance scaled differently on each axis turns a cylinder
|
|
108
|
-
* merged into it into an elliptical one -- declared round, drawn oval. Keeping
|
|
109
|
-
* it round means keeping its own transform.
|
|
110
|
-
*
|
|
111
|
-
* `needsOwnMesh` in things-scene must answer the same. When the two disagree,
|
|
112
|
-
* the number the report shows and the number the screen draws come apart, which
|
|
113
|
-
* is the fault this whole file was written to close.
|
|
114
|
-
*/
|
|
115
|
-
export function standsAlone(part, animated = EMPTY) {
|
|
116
|
-
if (animated.has(part.name))
|
|
117
|
-
return true;
|
|
118
|
-
if ((part.sizing ?? DEFAULT_SIZING) !== 'scale')
|
|
119
|
-
return true;
|
|
120
|
-
return keepsRound(part);
|
|
121
|
-
}
|
|
122
|
-
const EMPTY = new Set();
|
|
123
|
-
const NO_FRAMES = new Map();
|
|
124
|
-
/**
|
|
125
|
-
* What a part merges by: its material and slot, within one joint frame. compile and the gate share it so
|
|
126
|
-
* the groups compile builds and the draw calls the gate counts stay the same number.
|
|
127
|
-
*/
|
|
128
|
-
export function mergeKeyOf(part, frames = NO_FRAMES) {
|
|
129
|
-
const frame = frames.get(part.name);
|
|
130
|
-
return frame === undefined ? groupKeyOf(part) : `${groupKeyOf(part)}@${frame}`;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Does this part get drawn?
|
|
134
|
-
*
|
|
135
|
-
* A part carrying a `capability` spec is a **place** -- a slot something sits
|
|
136
|
-
* in, a port something enters by. It has no material and no geometry, and
|
|
137
|
-
* `compile` routes it to `anchors` rather than to a group.
|
|
138
|
-
*
|
|
139
|
-
* Every count of what drawing costs has to skip it. Left in, it does not merely
|
|
140
|
-
* inflate a number: `groupKeyOf` reads a material that is not there and throws
|
|
141
|
-
* on a source the format calls valid.
|
|
142
|
-
*/
|
|
143
|
-
export function isDrawn(part) {
|
|
144
|
-
return part.capability === undefined;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* The merge groups a set of parts produces.
|
|
148
|
-
*
|
|
149
|
-
* Each entry is the parts that end up in one merged geometry. Parts that stand
|
|
150
|
-
* alone get an entry of their own. Parts that are not drawn make no entry.
|
|
151
|
-
*/
|
|
152
|
-
export function groupsOf(parts, animated = EMPTY, frames = NO_FRAMES) {
|
|
153
|
-
const groups = [];
|
|
154
|
-
const byKey = new Map();
|
|
155
|
-
for (const part of parts) {
|
|
156
|
-
if (!isDrawn(part))
|
|
157
|
-
continue;
|
|
158
|
-
if (standsAlone(part, animated)) {
|
|
159
|
-
groups.push([part]);
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
const key = mergeKeyOf(part, frames);
|
|
163
|
-
const merged = byKey.get(key);
|
|
164
|
-
if (merged) {
|
|
165
|
-
merged.push(part);
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
const started = [part];
|
|
169
|
-
byKey.set(key, started);
|
|
170
|
-
groups.push(started);
|
|
171
|
-
}
|
|
172
|
-
return groups;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Does this part hold its section circular under a lopsided instance?
|
|
176
|
-
*
|
|
177
|
-
* Only curved primitives can, and they do unless the author turns it off. A
|
|
178
|
-
* bolt head nobody looks at is worth merging; a wheel is not.
|
|
179
|
-
*/
|
|
180
|
-
export function keepsRound(part) {
|
|
181
|
-
if (!CURVED_PRIMITIVES.includes(part.primitive))
|
|
182
|
-
return false;
|
|
183
|
-
return part.keepRound !== false;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* How many meshes one repeat part draws **as authored**.
|
|
187
|
-
*
|
|
188
|
-
* The count grows with the instance, since the row fills the box it is given.
|
|
189
|
-
* This is the count at scale 1 -- the asset's own size, which is what the
|
|
190
|
-
* author is looking at and the only number that does not depend on where it
|
|
191
|
-
* ends up.
|
|
192
|
-
*
|
|
193
|
-
* Must match `repeatPlan` in things-scene. If they drift, the screen and the
|
|
194
|
-
* report disagree about the same tray.
|
|
195
|
-
*/
|
|
196
|
-
export function repeatCountOf(part, base) {
|
|
197
|
-
if (part.sizing !== 'repeat' || !part.repeat)
|
|
198
|
-
return 1;
|
|
199
|
-
const { axis, pitch } = part.repeat;
|
|
200
|
-
if (!(Number.isFinite(pitch) && pitch > 0))
|
|
201
|
-
return 1;
|
|
202
|
-
const room = Number.isFinite(base[axis]) && base[axis] > 0 ? base[axis] : pitch;
|
|
203
|
-
return Math.max(1, Math.min(REPEAT_LIMIT, Math.floor(room / pitch)));
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Draw calls one instance costs. **This is what the limit is about.**
|
|
207
|
-
*
|
|
208
|
-
* A merged group is one call. A repeat part is one call per copy.
|
|
209
|
-
*/
|
|
210
|
-
export function drawCallsOf(parts, base, animated = EMPTY, frames = NO_FRAMES) {
|
|
211
|
-
return groupsOf(parts, animated, frames).reduce((total, group) => total + callsForGroup(group, base), 0);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Draw calls for one merged group.
|
|
215
|
-
*
|
|
216
|
-
* **A merged group is one call however many parts went into it** -- that is
|
|
217
|
-
* what merging is for. Only repeat multiplies, and a repeat part always stands
|
|
218
|
-
* alone, so a group either holds one repeat part or is a single call.
|
|
219
|
-
*/
|
|
220
|
-
export function callsForGroup(group, base) {
|
|
221
|
-
const only = group.length === 1 ? group[0] : undefined;
|
|
222
|
-
return only ? repeatCountOf(only, base) : 1;
|
|
223
|
-
}
|
|
224
|
-
//# sourceMappingURL=grouping.js.map
|
package/dist/grouping.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grouping.js","sourceRoot":"","sources":["../src/grouping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG5E;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,KAA+D;IAC3F,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;QAC/B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YAC1C,IAAI,OAAO,OAAO,EAAE,MAAM,KAAK,QAAQ;gBAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACpE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAG3B;IACC,OAAO,IAAI,GAAG,CAAC;QACb,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;QACnC,GAAG,aAAa,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;KACnF,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAG3B;IACC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;IAC1C,KAAK,MAAM,IAAI,I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A;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,KAA4B,EAC5B,IAAU,EACV,WAAgC,KAAK,EACrC,SAAsC,SAAS;IAE/C,OAAO,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1G,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAA4B,EAAE,IAAU;IACpE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAEtD,OAAO,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7C,CAAC"}
|
package/dist/keys.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 키 — 무엇을 무엇과 나눠 쓰는지, 무엇을 무엇과 합치는지를 정하는 식.
|
|
3
|
-
*
|
|
4
|
-
* **이 파일이 유일한 기준이다.** 검사(`validate.ts`)와 컴파일(`blueprint.ts`)이 같은
|
|
5
|
-
* 식을 써야 한다. 다르면 「묶음 수 한도를 지켰다」고 검사가 말한 것과 실제로 만들어지는
|
|
6
|
-
* 묶음 수가 어긋나고, 그 어긋남은 오류 없이 성능으로만 나타난다.
|
|
7
|
-
*
|
|
8
|
-
* 여기 있는 이유는 순환 참조 때문이기도 하다 — `blueprint.ts` 가 `validate.ts` 를
|
|
9
|
-
* 부르므로 반대 방향으로 부를 수 없다.
|
|
10
|
-
*/
|
|
11
|
-
import type { FigurePart, PrimitiveKind } from './types.ts';
|
|
12
|
-
/** 부동소수 오차로 키가 갈리지 않게 자릿수를 맞춘다. */
|
|
13
|
-
export declare function q(n: number): number;
|
|
14
|
-
/** 이 프리미티브가 분할 수를 쓰는가 — 곡면이 있는 것만. */
|
|
15
|
-
export declare function usesSegments(primitive: PrimitiveKind): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* GeometryBank 키.
|
|
18
|
-
*
|
|
19
|
-
* **치수가 키에 들어 있다.** 경로에서 오는 형상(rect·polygon)은 단위로 정규화하면
|
|
20
|
-
* 모서리 반경 비율이 망가지므로 치수를 굽고, 대신 같은 치수끼리만 공유한다.
|
|
21
|
-
*/
|
|
22
|
-
export declare function geometryKeyOf(part: FigurePart): string;
|
|
23
|
-
/**
|
|
24
|
-
* MaterialBank 키. 색은 토큰 이름으로 둔다 — 값을 구우면 테마를 바꿔도 안 따라온다.
|
|
25
|
-
*
|
|
26
|
-
* `transparent` 가 키에 들어간다. 투명 재질은 별도 정렬 경로를 타므로 불투명과 합칠 수 없다.
|
|
27
|
-
*/
|
|
28
|
-
export declare function materialKeyOf(part: FigurePart): string;
|
|
29
|
-
/**
|
|
30
|
-
* 병합 단위 키 — 이 키가 같은 부품끼리 한 묶음(= draw call 하나)이 된다.
|
|
31
|
-
*
|
|
32
|
-
* 재질에 슬롯을 더한 것이다. 슬롯이 다르면 재질 인덱스가 달라 합칠 수 없다.
|
|
33
|
-
*
|
|
34
|
-
* **검사와 컴파일이 반드시 이 함수를 쓴다.** 정책이 세는 묶음 수와 실제로 만들어지는
|
|
35
|
-
* 묶음 수가 같아야 「한도를 지켰다」는 말이 뜻을 갖는다.
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* 켜진 재질의 창고 열쇠 — 꺼진 것 뒤에 표시 하나를 붙인다.
|
|
39
|
-
*
|
|
40
|
-
* 램프가 아니면 `null`. 두 재질이 창고에 생기지만 **동시에 그려지지 않으므로** 부품
|
|
41
|
-
* 하나는 어느 쪽을 입든 묶음 하나다.
|
|
42
|
-
*/
|
|
43
|
-
export declare function emissiveKeyOf(part: FigurePart): string | null;
|
|
44
|
-
export declare function groupKeyOf(part: FigurePart): string;
|
|
45
|
-
//# sourceMappingURL=keys.d.ts.map
|
package/dist/keys.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG3D,mCAAmC;AACnC,wBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnC;AAED,sCAAsC;AACtC,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAUtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAqBtD;AAED;;;;;;;GAOG;AACH;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAE7D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD"}
|
package/dist/keys.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 키 — 무엇을 무엇과 나눠 쓰는지, 무엇을 무엇과 합치는지를 정하는 식.
|
|
3
|
-
*
|
|
4
|
-
* **이 파일이 유일한 기준이다.** 검사(`validate.ts`)와 컴파일(`blueprint.ts`)이 같은
|
|
5
|
-
* 식을 써야 한다. 다르면 「묶음 수 한도를 지켰다」고 검사가 말한 것과 실제로 만들어지는
|
|
6
|
-
* 묶음 수가 어긋나고, 그 어긋남은 오류 없이 성능으로만 나타난다.
|
|
7
|
-
*
|
|
8
|
-
* 여기 있는 이유는 순환 참조 때문이기도 하다 — `blueprint.ts` 가 `validate.ts` 를
|
|
9
|
-
* 부르므로 반대 방향으로 부를 수 없다.
|
|
10
|
-
*/
|
|
11
|
-
import { SEGMENTED_PRIMITIVES } from "./types.js";
|
|
12
|
-
/** 부동소수 오차로 키가 갈리지 않게 자릿수를 맞춘다. */
|
|
13
|
-
export function q(n) {
|
|
14
|
-
return Math.round(n * 1000) / 1000;
|
|
15
|
-
}
|
|
16
|
-
/** 이 프리미티브가 분할 수를 쓰는가 — 곡면이 있는 것만. */
|
|
17
|
-
export function usesSegments(primitive) {
|
|
18
|
-
return SEGMENTED_PRIMITIVES.includes(primitive);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* GeometryBank 키.
|
|
22
|
-
*
|
|
23
|
-
* **치수가 키에 들어 있다.** 경로에서 오는 형상(rect·polygon)은 단위로 정규화하면
|
|
24
|
-
* 모서리 반경 비율이 망가지므로 치수를 굽고, 대신 같은 치수끼리만 공유한다.
|
|
25
|
-
*/
|
|
26
|
-
export function geometryKeyOf(part) {
|
|
27
|
-
const { size } = part.transform;
|
|
28
|
-
const dims = `${q(size.x)}x${q(size.y)}x${q(size.z)}`;
|
|
29
|
-
const seg = part.segments === undefined ? '' : `|s${part.segments}`;
|
|
30
|
-
const round = part.shape?.round ? `|r${q(part.shape.round)}` : '';
|
|
31
|
-
const pathLen = part.primitive === 'polygon' ? `|p${part.shape?.path?.length ?? 0}` : '';
|
|
32
|
-
// 두께가 형상을 정한다 — 빼면 두께만 고친 통이 옛 형상을 그대로 받는다.
|
|
33
|
-
const h = part.shape?.hollow;
|
|
34
|
-
const hollow = h ? `|h${q(h.wall)},${q(h.floor ?? h.wall)}` : '';
|
|
35
|
-
return `${part.primitive}|${dims}${seg}${round}${pathLen}${hollow}`;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* MaterialBank 키. 색은 토큰 이름으로 둔다 — 값을 구우면 테마를 바꿔도 안 따라온다.
|
|
39
|
-
*
|
|
40
|
-
* `transparent` 가 키에 들어간다. 투명 재질은 별도 정렬 경로를 타므로 불투명과 합칠 수 없다.
|
|
41
|
-
*/
|
|
42
|
-
export function materialKeyOf(part) {
|
|
43
|
-
const m = part.material;
|
|
44
|
-
// 표면이 키에 들어간다. 같은 색이라도 표면이 다르면 다른 재질이다. 같은 표면끼리는
|
|
45
|
-
// 한 재질을 나눠 쓴다(이름으로 가리키는 고정 자산이라 인스턴스와 무관하다).
|
|
46
|
-
const surface = m.surface ? `s${m.surface.kind}:${m.surface.ref}` : '-';
|
|
47
|
-
/*
|
|
48
|
-
켜진 모습도 키에 들어간다.
|
|
49
|
-
|
|
50
|
-
꺼진 모습이 같아도 켜진 모습이 다르면 **다른 부품**이다. 안 넣으면 둘이 한 묶음으로
|
|
51
|
-
합쳐지고, 그 묶음은 켜진 재질을 하나만 가질 수 있으므로 램프 하나를 켤 때 다른 램프가
|
|
52
|
-
엉뚱한 색으로 따라 켜진다.
|
|
53
|
-
*/
|
|
54
|
-
const spec = m.emissive ? `e${m.emissive.token ?? '='}:${m.emissive.intensity}${m.emissive.on ? ':on' : ''}` : '-';
|
|
55
|
-
return [
|
|
56
|
-
m.token ?? '-',
|
|
57
|
-
m.preset ?? '-',
|
|
58
|
-
m.flatShading ? 'f' : '-',
|
|
59
|
-
m.transparent ? 't' : '-',
|
|
60
|
-
surface,
|
|
61
|
-
spec
|
|
62
|
-
].join('|');
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 병합 단위 키 — 이 키가 같은 부품끼리 한 묶음(= draw call 하나)이 된다.
|
|
66
|
-
*
|
|
67
|
-
* 재질에 슬롯을 더한 것이다. 슬롯이 다르면 재질 인덱스가 달라 합칠 수 없다.
|
|
68
|
-
*
|
|
69
|
-
* **검사와 컴파일이 반드시 이 함수를 쓴다.** 정책이 세는 묶음 수와 실제로 만들어지는
|
|
70
|
-
* 묶음 수가 같아야 「한도를 지켰다」는 말이 뜻을 갖는다.
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* 켜진 재질의 창고 열쇠 — 꺼진 것 뒤에 표시 하나를 붙인다.
|
|
74
|
-
*
|
|
75
|
-
* 램프가 아니면 `null`. 두 재질이 창고에 생기지만 **동시에 그려지지 않으므로** 부품
|
|
76
|
-
* 하나는 어느 쪽을 입든 묶음 하나다.
|
|
77
|
-
*/
|
|
78
|
-
export function emissiveKeyOf(part) {
|
|
79
|
-
return part.material.emissive ? `${materialKeyOf(part)}||emissive` : null;
|
|
80
|
-
}
|
|
81
|
-
export function groupKeyOf(part) {
|
|
82
|
-
return `${materialKeyOf(part)}||${part.materialSlot ?? '-'}`;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=keys.js.map
|
package/dist/keys.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,mCAAmC;AACnC,MAAM,UAAU,CAAC,CAAC,CAAS;IACzB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;AACpC,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,YAAY,CAAC,SAAwB;IACnD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAA;IAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IACrD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAA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AQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;IAClH,OAAO;QACL,CAAC,CAAC,KAAK,IAAI,GAAG;QACd,CAAC,CAAC,MAAM,IAAI,GAAG;QACf,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;QACzB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;QACzB,OAAO;QACP,IAAI;KACL,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACb,CAAC;AAED;;;;;;;GAOG;AACH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAA;AAC3E,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAA;AAC9D,CAAC"}
|
package/dist/origin.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Centred, CentredSource, FigureSource, PartTransform, Vec3 } from './types.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Where a source's coordinates start, and the one place they become the coordinates the rules use.
|
|
4
|
-
*
|
|
5
|
-
* A source measures a part's `position.y` from the bottom face of the base box, and `x` and `z` from
|
|
6
|
-
* its centre (ADR-0065). Moving the bottom face then leaves every part's numbers alone, which is what
|
|
7
|
-
* an author editing a figure's height expects.
|
|
8
|
-
*
|
|
9
|
-
* Everything past the entry points works in box-centred coordinates: compile, the policy checks,
|
|
10
|
-
* sizing and the release gate, exactly as the blueprint and the scene runtime always have. The rules
|
|
11
|
-
* that read which face a part is nearest to depend on that — the automatic anchor is the sign of a
|
|
12
|
-
* centred position. So only the functions that accept a source, or a part taken from one, call into
|
|
13
|
-
* this file, and nothing below them changes.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Rounds away the floating-point residue of shifting by half the box height.
|
|
17
|
-
*
|
|
18
|
-
* `0.1445 + 150 - 150` is `0.14449999999999363`, so a source moved to edition 2 and centred again would
|
|
19
|
-
* not reproduce the number it started from. A millionth of a millimetre is finer than anything the
|
|
20
|
-
* modeller writes (four decimals), so it removes the residue without changing an authored value.
|
|
21
|
-
*/
|
|
22
|
-
export declare function roundShift(value: number): number;
|
|
23
|
-
/** A part in box-centred coordinates. */
|
|
24
|
-
export declare function centredPart<P extends {
|
|
25
|
-
transform: PartTransform;
|
|
26
|
-
}>(part: P, base: Vec3): Centred<P>;
|
|
27
|
-
/** A joint whose origin is in box-centred coordinates. */
|
|
28
|
-
export declare function centredJoint<J extends {
|
|
29
|
-
origin: Vec3;
|
|
30
|
-
}>(joint: J, base: Vec3): Centred<J>;
|
|
31
|
-
/** A source whose parts and joint origins are in box-centred coordinates. Nothing else in it carries a box position. */
|
|
32
|
-
export declare function centredSource(source: FigureSource): CentredSource;
|
|
33
|
-
//# sourceMappingURL=origin.d.ts.map
|
package/dist/origin.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAE3F;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,yCAAyC;AACzC,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAMnG;AAED,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzF;AAED,wHAAwH;AACxH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAIjE"}
|
package/dist/origin.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Where a source's coordinates start, and the one place they become the coordinates the rules use.
|
|
6
|
-
*
|
|
7
|
-
* A source measures a part's `position.y` from the bottom face of the base box, and `x` and `z` from
|
|
8
|
-
* its centre (ADR-0065). Moving the bottom face then leaves every part's numbers alone, which is what
|
|
9
|
-
* an author editing a figure's height expects.
|
|
10
|
-
*
|
|
11
|
-
* Everything past the entry points works in box-centred coordinates: compile, the policy checks,
|
|
12
|
-
* sizing and the release gate, exactly as the blueprint and the scene runtime always have. The rules
|
|
13
|
-
* that read which face a part is nearest to depend on that — the automatic anchor is the sign of a
|
|
14
|
-
* centred position. So only the functions that accept a source, or a part taken from one, call into
|
|
15
|
-
* this file, and nothing below them changes.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Rounds away the floating-point residue of shifting by half the box height.
|
|
19
|
-
*
|
|
20
|
-
* `0.1445 + 150 - 150` is `0.14449999999999363`, so a source moved to edition 2 and centred again would
|
|
21
|
-
* not reproduce the number it started from. A millionth of a millimetre is finer than anything the
|
|
22
|
-
* modeller writes (four decimals), so it removes the residue without changing an authored value.
|
|
23
|
-
*/
|
|
24
|
-
export function roundShift(value) {
|
|
25
|
-
return Math.round(value * 1e6) / 1e6;
|
|
26
|
-
}
|
|
27
|
-
/** A part in box-centred coordinates. */
|
|
28
|
-
export function centredPart(part, base) {
|
|
29
|
-
const { position } = part.transform;
|
|
30
|
-
return {
|
|
31
|
-
...part,
|
|
32
|
-
transform: { ...part.transform, position: { ...position, y: roundShift(position.y - base.y / 2) } }
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/** A joint whose origin is in box-centred coordinates. */
|
|
36
|
-
export function centredJoint(joint, base) {
|
|
37
|
-
return { ...joint, origin: { ...joint.origin, y: roundShift(joint.origin.y - base.y / 2) } };
|
|
38
|
-
}
|
|
39
|
-
/** A source whose parts and joint origins are in box-centred coordinates. Nothing else in it carries a box position. */
|
|
40
|
-
export function centredSource(source) {
|
|
41
|
-
const centred = { ...source, parts: source.parts.map(part => centredPart(part, source.base)) };
|
|
42
|
-
if (source.joints !== undefined)
|
|
43
|
-
centred.joints = source.joints.map(joint => centredJoint(joint, source.base));
|
|
44
|
-
return centred;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=origin.js.map
|
package/dist/origin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AACtC,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,WAAW,CAAyC,IAAO,EAAE,IAAU;IACrF,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAA;IACnC,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE;KACtF,CAAA;AACjB,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,YAAY,CAA6B,KAAQ,EAAE,IAAU;IAC3E,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAgB,CAAA;AAC5G,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,aAAa,CAAC,MAAoB;IAChD,MAAM,OAAO,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAA;IAC9F,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9G,OAAO,OAAwB,CAAA;AACjC,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { FigureSource } from './types.ts';
|
|
2
|
-
/** 무엇이 달라졌나. 소비처의 식별자·의미를 없애는 일만 막고, 외형 변화는 알린다. */
|
|
3
|
-
export type ContractChangeCode =
|
|
4
|
-
/** 기준 상자의 x:z 비율이 달라졌다 — 이미 놓인 인스턴스의 외형이 달라질 수 있다. */
|
|
5
|
-
'base-ratio-changed'
|
|
6
|
-
/** 배치 기준(floor · ceiling · center)이 달라졌다. */
|
|
7
|
-
| 'placement-changed'
|
|
8
|
-
/** 자리·문·파라미터·능력이 사라졌거나 뜻이 바뀌었다. */
|
|
9
|
-
| 'interface-gone'
|
|
10
|
-
/** 배율 1 에서 센 칸 수가 달라졌다. */
|
|
11
|
-
| 'slot-count-changed'
|
|
12
|
-
/** 기준 상자의 절대 크기가 달라졌다 — 비율은 그대로다. */
|
|
13
|
-
| 'base-size-changed'
|
|
14
|
-
/** 자리·문·파라미터·능력이 새로 생겼다. */
|
|
15
|
-
| 'interface-added'
|
|
16
|
-
/** 자리가 받아 주는 타입이 좁아졌다 — 이미 든 것은 그대로다. */
|
|
17
|
-
| 'accepts-narrowed';
|
|
18
|
-
export interface ContractChange {
|
|
19
|
-
code: ContractChangeCode;
|
|
20
|
-
/** 참이면 발행을 막는다. */
|
|
21
|
-
blocking: boolean;
|
|
22
|
-
/** 무엇의 이야기인가 — 자리·문·파라미터·능력의 이름. 도형 전체의 일이면 없다. */
|
|
23
|
-
subject?: string;
|
|
24
|
-
/** 무엇이 달라졌나. 잰 값으로. */
|
|
25
|
-
message: string;
|
|
26
|
-
/** **왜 그것이 문제인가.** 달라진 것만 말하면 읽는 사람은 「그래서?」에서 멈춘다. */
|
|
27
|
-
why: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 직전 발행판과 견준다. **둘 다 컴파일되는 정본이어야 한다** — 부르는 쪽이 새 정본을 먼저
|
|
31
|
-
* 검사하고, 앞의 것은 발행될 때 이미 통과한 것이다.
|
|
32
|
-
*
|
|
33
|
-
* 낸 목록이 비어 있으면 이 발행은 놓인 것을 건드리지 않는다.
|
|
34
|
-
*/
|
|
35
|
-
export declare function contractChanges(before: FigureSource, after: FigureSource): ContractChange[];
|
|
36
|
-
/** 이 발행이 놓인 것을 깨나. `contractChanges` 를 부르는 쪽의 편의. */
|
|
37
|
-
export declare function breaksContract(changes: readonly ContractChange[]): boolean;
|
|
38
|
-
//# sourceMappingURL=release-contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"release-contract.d.ts","sourceRoot":"","sources":["../src/release-contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmB,YAAY,EAAQ,MAAM,YAAY,CAAA;AAsCrE,oDAAoD;AACpD,MAAM,MAAM,kBAAkB;AAC5B,sDAAsD;AACpD,oBAAoB;AACtB,6CAA6C;GAC3C,mBAAmB;AACrB,mCAAmC;GACjC,gBAAgB;AAClB,2BAA2B;GACzB,oBAAoB;AACtB,qCAAqC;GACnC,mBAAmB;AACrB,4BAA4B;GAC1B,iBAAiB;AACnB,yCAAyC;GACvC,kBAAkB,CAAA;AAEtB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAA;IACxB,mBAAmB;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAA;CACZ;AA4ED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,cAAc,EAAE,CA+K3F;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAE1E"}
|