@metamesh/generator-sdk 0.7.0 → 0.9.0
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 +23 -0
- package/README.md +67 -1
- package/dist/contracts.d.ts +11 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/cross-sections.d.ts +41 -0
- package/dist/cross-sections.d.ts.map +1 -0
- package/dist/cross-sections.js +192 -0
- package/dist/cross-sections.js.map +1 -0
- package/dist/generator-package/constants.d.ts +1 -1
- package/dist/generator-package/constants.js +1 -1
- package/dist/generator-package/errors.js +1 -1
- package/dist/generator-package/errors.js.map +1 -1
- package/dist/generator-package/schemas/definition.schema.d.ts +17 -0
- package/dist/generator-package/schemas/definition.schema.d.ts.map +1 -1
- package/dist/generator-package/schemas/manifest.schema.d.ts +17 -0
- package/dist/generator-package/schemas/manifest.schema.d.ts.map +1 -1
- package/dist/generator-package/schemas/parameter.schema.d.ts +38 -0
- package/dist/generator-package/schemas/parameter.schema.d.ts.map +1 -1
- package/dist/generator-package/schemas/parameter.schema.js +11 -0
- package/dist/generator-package/schemas/parameter.schema.js.map +1 -1
- package/dist/generator-package/schemas/preset.schema.d.ts.map +1 -1
- package/dist/generator-package/schemas/preset.schema.js +7 -2
- package/dist/generator-package/schemas/preset.schema.js.map +1 -1
- package/dist/generator-package/validate-definition.d.ts.map +1 -1
- package/dist/generator-package/validate-definition.js +23 -9
- package/dist/generator-package/validate-definition.js.map +1 -1
- package/dist/generator-package/validate-manifest.d.ts +2 -2
- package/dist/generator-package/validate-manifest.d.ts.map +1 -1
- package/dist/generator-package/validate-manifest.js +22 -6
- package/dist/generator-package/validate-manifest.js.map +1 -1
- package/dist/generator-services.d.ts +12 -0
- package/dist/generator-services.d.ts.map +1 -1
- package/dist/generator-services.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/parameter-contracts.d.ts +10 -1
- package/dist/parameter-contracts.d.ts.map +1 -1
- package/dist/parameters/issues.d.ts.map +1 -1
- package/dist/parameters/issues.js +104 -40
- package/dist/parameters/issues.js.map +1 -1
- package/dist/parameters/preparation.d.ts.map +1 -1
- package/dist/parameters/preparation.js +1 -0
- package/dist/parameters/preparation.js.map +1 -1
- package/dist/parameters/recovery.d.ts.map +1 -1
- package/dist/parameters/recovery.js +6 -1
- package/dist/parameters/recovery.js.map +1 -1
- package/dist/parameters/strict.d.ts +2 -2
- package/dist/parameters/strict.d.ts.map +1 -1
- package/dist/parameters/strict.js +10 -3
- package/dist/parameters/strict.js.map +1 -1
- package/dist/parameters/values.d.ts.map +1 -1
- package/dist/parameters/values.js +4 -0
- package/dist/parameters/values.js.map +1 -1
- package/dist/profiles.d.ts +8 -0
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +85 -47
- package/dist/profiles.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @metamesh/generator-sdk
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e405876: Add a bounded closed XY cross-section parameter with immutable values, strict validation,
|
|
8
|
+
normalization, presets, and runtime compatibility checks. Add `sampleCrossSection` for physical
|
|
9
|
+
curve sampling and validated closed-loop geometry. Existing side-profile values remain compatible.
|
|
10
|
+
|
|
11
|
+
## 0.8.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- bf1abe4: Add circular baselines to prepared vector text and Generator text services. Shaped glyphs and attached marks rotate rigidly around a millimetre radius, preserving kerning, ligatures, exact curve bounds and logical advances. Circular text is limited to one line, baseline vertical alignment, less than one revolution, and outlines that stay clear of the circle's center axis.
|
|
16
|
+
- bf1abe4: Complete solid splitting, plane clipping, Section hull/component/simplification operations, minimum-distance
|
|
17
|
+
queries and inspection facts. Add optional bounded geometric solid
|
|
18
|
+
validation at build/export boundaries and a pure uniform-density volume centroid helper.
|
|
19
|
+
Reuse immutable native inspection facts within a build and fresh owned topology analysis during
|
|
20
|
+
solid validation; share checks for identical buffer ranges without trusting mutable external facts.
|
|
21
|
+
|
|
22
|
+
Unify SVG default/preset limits and strict preset metadata checks. Preserve structured validation
|
|
23
|
+
codes and nested paths, add physical mesh assertions, and require runtime 2.1 for the current host
|
|
24
|
+
surface and issue metadata.
|
|
25
|
+
|
|
3
26
|
## 0.7.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Studio owns persistence and the Modeling engine owns modeling and manufacturing
|
|
|
29
29
|
## Parameter definitions
|
|
30
30
|
|
|
31
31
|
Parameters use a `type` discriminant: `number`, `slider`, `boolean`, `select`, `choice-set`, `color`,
|
|
32
|
-
`text`, `font`, `svg`, `profile`, or homogeneous `array`. Sliders require `min`, `max`, and `step`;
|
|
32
|
+
`text`, `font`, `svg`, `profile`, `cross-section`, or homogeneous `array`. Sliders require `min`, `max`, and `step`;
|
|
33
33
|
numbers may omit them. Visibility uses serializable `ConditionExpression` values with `all`, `any`,
|
|
34
34
|
`not`, equality/inequality, numeric comparisons, and choice-set membership (`contains`).
|
|
35
35
|
|
|
@@ -63,6 +63,9 @@ noncanonical values and return cloned frozen structured values. `prepareParamete
|
|
|
63
63
|
once and returns the map with schema issues. Execution aggregates Generator preparation issues
|
|
64
64
|
separately. Definitions accept only
|
|
65
65
|
canonical types. SVG values are strings limited to 256 KiB each and 512 KiB per normalized Project.
|
|
66
|
+
The same byte limits apply to defaults and presets. Definition parsing rejects defaults that exceed
|
|
67
|
+
the aggregate Project budget; preset parsing uses each declared control's limits, so an SVG value
|
|
68
|
+
may exceed the separate 64 Ki-character text limit.
|
|
66
69
|
|
|
67
70
|
```ts
|
|
68
71
|
import { EMPTY_SVG_PARAMETER_DEFAULT } from "@metamesh/generator-sdk/parameters";
|
|
@@ -110,6 +113,8 @@ unavailable references survive codecs, presets, and persistence. Studio prepares
|
|
|
110
113
|
millimetres. Keep that layout in the preparation value when checks and construction both need it.
|
|
111
114
|
Imported `textSection(layout)` consumes it during build. No ambient font provider is bound.
|
|
112
115
|
|
|
116
|
+
Text layout can use `baseline: { kind: "arc", radius, centerAngleDegrees, direction }` for a single circular line. Radius is in millimetres, the angle is counterclockwise from +X (default 90°), and direction defaults to clockwise. Alignment defaults to center for arcs; use clockwise at 90° for upright top text or counterclockwise at 270° for upright bottom text. Glyphs and attached marks rotate without distortion. Arc layout requires baseline vertical alignment and less than one full revolution; Generator preparation owns lettering size and face-fit checks. Packages using circular text require runtime `2.1.0` or newer.
|
|
117
|
+
|
|
113
118
|
### Validation and bounds
|
|
114
119
|
|
|
115
120
|
`GeneratorDefinition` is callback-free, JSON-safe metadata for forms, manifests, persistence, and
|
|
@@ -133,10 +138,24 @@ callback-free. Preparation receives normalized, frozen parameters; malformed iss
|
|
|
133
138
|
runtime error. Combined validation retains at most 100 issues, prioritizing errors over warnings
|
|
134
139
|
and preserving retained order. The reporting limit cannot hide a blocking error.
|
|
135
140
|
|
|
141
|
+
Issues may include an optional stable `code` and `path` relative to the parameter value, such as
|
|
142
|
+
`{ code: "minimum", path: [2] }` for an array item or
|
|
143
|
+
`{ code: "invalid", path: ["segments", 0, "control1", "height"] }` for a profile control.
|
|
144
|
+
`ParameterIssueCode` defines the supported categories: `invalid`, `missing`, `type`, `unknown`,
|
|
145
|
+
`minimum`, `maximum`, `integer`, `choice`, `duplicate`, `length`, `bytes`, and `structure`.
|
|
146
|
+
Schema validation supplies codes and nested locations; strict decoder paths start with the
|
|
147
|
+
parameter ID. Authored issues retain their optional metadata through preparation and transfer.
|
|
148
|
+
Issue parsing clones and freezes paths, bounds them to 32 segments, accepts non-negative safe
|
|
149
|
+
integer indices and non-empty field names of at most 120 characters, and never evaluates accessors.
|
|
150
|
+
Both fields are optional; issues always retain their required severity and message.
|
|
151
|
+
|
|
136
152
|
Use `getDefaultParameters(definition)` for a fresh frozen defaults map. IDs are bounded safe keys.
|
|
137
153
|
Package manifests, definitions, descriptors, conditions, and nested parameter objects reject unknown fields.
|
|
138
154
|
Definitions are bounded to 64 groups and 256 parameters, arrays to 1,024 items, options to 512,
|
|
139
155
|
presets to 256, and condition composition to 8 levels with 32 children per node.
|
|
156
|
+
`validateGeneratorPresets()` from `/packages` applies the same strict metadata and list bounds as
|
|
157
|
+
manifest parsing before checking complete canonical parameter maps. Testkit and bundled registries
|
|
158
|
+
use that shared validator.
|
|
140
159
|
|
|
141
160
|
### Editable side profiles
|
|
142
161
|
|
|
@@ -185,6 +204,49 @@ shape and editing intent. Normalization, strict codecs, defaults, and presets cl
|
|
|
185
204
|
profile object. Invalid saved profiles recover to the declared default; strict boundaries reject
|
|
186
205
|
them. Profiles cannot be condition operands. All executable packages use format `2` and runtime major `2`.
|
|
187
206
|
|
|
207
|
+
### Editable cross sections
|
|
208
|
+
|
|
209
|
+
A `cross-section` declares one closed planar contour as a versioned `CrossSectionValue`.
|
|
210
|
+
It uses normalized `x` and upward `y` coordinates in `[0, 1]`, with `corner` or `smooth` anchor
|
|
211
|
+
modes and explicit `line` or `cubic` segments. Cubic controls retain the authored geometry;
|
|
212
|
+
editing modes never change it during execution. The final segment's end repeats the start's
|
|
213
|
+
coordinates and mode so the seam is one editable point.
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
const crossSection = {
|
|
217
|
+
id: "crossSection",
|
|
218
|
+
label: "Cross section",
|
|
219
|
+
type: "cross-section",
|
|
220
|
+
widthScale: { parameterId: "width", factor: 1 },
|
|
221
|
+
heightScale: { parameterId: "height", factor: 1 },
|
|
222
|
+
default: {
|
|
223
|
+
version: 1,
|
|
224
|
+
start: { x: 0, y: 0, mode: "corner" },
|
|
225
|
+
segments: [
|
|
226
|
+
{ type: "line", end: { x: 1, y: 0, mode: "corner" } },
|
|
227
|
+
{ type: "line", end: { x: 1, y: 1, mode: "corner" } },
|
|
228
|
+
{ type: "line", end: { x: 0, y: 1, mode: "corner" } },
|
|
229
|
+
{ type: "line", end: { x: 0, y: 0, mode: "corner" } },
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
} as const;
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Contours have 2–32 segments and can travel in any direction. They have no holes or multiple loops.
|
|
236
|
+
Structural validity establishes bounded serializable data and explicit closure; the Generator
|
|
237
|
+
owns physical scaling, nonzero area, intersections, winding, and operation-specific geometry checks.
|
|
238
|
+
Optional `widthScale` and `heightScale` use the same positive millimetre references as side profiles.
|
|
239
|
+
They describe the coordinate envelope and never transform saved values; omitting them leaves
|
|
240
|
+
normalized coordinates.
|
|
241
|
+
|
|
242
|
+
`isCrossSectionValue()`, `cloneCrossSectionValue()`, and `crossSectionValuesEqual()` apply the same
|
|
243
|
+
accessor-safe validation, deep cloning/freezing, and shape/editing equality guarantees as profiles.
|
|
244
|
+
Defaults, normalization, codecs, presets, and Worker parameter maps preserve those values.
|
|
245
|
+
Invalid saved data recovers to the declared default; strict boundaries reject it. Cross sections
|
|
246
|
+
cannot be condition operands. Packages declaring them require minimum runtime `2.2.0`; manifest
|
|
247
|
+
parsing rejects lower declared minima. Side profiles retain their existing representation and
|
|
248
|
+
compatibility.
|
|
249
|
+
|
|
188
250
|
### Curve resolution
|
|
189
251
|
|
|
190
252
|
A `number` or `slider` may declare `role: "curve-resolution"` to identify the model's maximum
|
|
@@ -284,6 +346,10 @@ viewport presentation. Geometric/manufacturing validation belongs to the shared
|
|
|
284
346
|
Package format `1`, runtime major `1`, retired `validate/generate` module exports and extra exports
|
|
285
347
|
reject explicitly. No compatibility adapter or preparation cache remains.
|
|
286
348
|
|
|
349
|
+
Packages using the current modeling operations and Section overloads, `holeCutter()`, or optional
|
|
350
|
+
issue `code`/`path` metadata must declare minimum runtime `2.1.0`. Package format and execution
|
|
351
|
+
protocol major remain `2`. The manifest minimum must cover the host capabilities the package uses.
|
|
352
|
+
|
|
287
353
|
## Worker boundary
|
|
288
354
|
|
|
289
355
|
Worker requests/responses are `/runtime` contracts containing structured data and transferable
|
package/dist/contracts.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import type { CrossSectionValue } from "./cross-sections.js";
|
|
1
2
|
import type { FontSelection } from "./fonts.js";
|
|
2
3
|
import type { GeneratorDefinition, ParameterDefinition } from "./parameter-contracts.js";
|
|
3
4
|
import type { ProfileValue } from "./profiles.js";
|
|
4
|
-
export type { ArrayParameterDefinition, BaseParameterDefinition, GeneratorDefinition, FontParameterDefinition, BooleanParameterDefinition, ChoiceSetParameterDefinition, ColorParameterDefinition, NumberArrayItemDefinition, NumberArrayParameterDefinition, NumberParameterDefinition, NumericParameterDefinition, ParameterDefinition, ParameterGroup, ProfileParameterDefinition, ProfileScaleReference, SelectOption, SelectParameterDefinition, StringArrayItemDefinition, StringArrayParameterDefinition, SvgParameterDefinition, SliderParameterDefinition, TextParameterDefinition, } from "./parameter-contracts.js";
|
|
5
|
+
export type { ArrayParameterDefinition, BaseParameterDefinition, GeneratorDefinition, FontParameterDefinition, BooleanParameterDefinition, ChoiceSetParameterDefinition, ColorParameterDefinition, CrossSectionParameterDefinition, CrossSectionScaleReference, NumberArrayItemDefinition, NumberArrayParameterDefinition, NumberParameterDefinition, NumericParameterDefinition, ParameterDefinition, ParameterGroup, ProfileParameterDefinition, ProfileScaleReference, SelectOption, SelectParameterDefinition, StringArrayItemDefinition, StringArrayParameterDefinition, SvgParameterDefinition, SliderParameterDefinition, TextParameterDefinition, } from "./parameter-contracts.js";
|
|
5
6
|
export type ScalarParameterValue = number | boolean | string;
|
|
6
|
-
export type ParameterValue = ScalarParameterValue | readonly number[] | readonly string[] | FontSelection | ProfileValue;
|
|
7
|
+
export type ParameterValue = ScalarParameterValue | readonly number[] | readonly string[] | FontSelection | ProfileValue | CrossSectionValue;
|
|
7
8
|
export type ParameterValues = Readonly<Record<string, ParameterValue>>;
|
|
8
9
|
type ParameterValueFor<Parameter extends ParameterDefinition> = Parameter extends {
|
|
9
10
|
readonly type: "font";
|
|
10
11
|
} ? FontSelection : Parameter extends {
|
|
11
12
|
readonly type: "profile";
|
|
12
13
|
} ? ProfileValue : Parameter extends {
|
|
14
|
+
readonly type: "cross-section";
|
|
15
|
+
} ? CrossSectionValue : Parameter extends {
|
|
13
16
|
readonly type: "number" | "slider";
|
|
14
17
|
} ? number : Parameter extends {
|
|
15
18
|
readonly type: "boolean";
|
|
@@ -36,10 +39,16 @@ export type GeneratorParams<D extends GeneratorDefinition> = {
|
|
|
36
39
|
/** The declared parameter ID union for a Generator definition. */
|
|
37
40
|
export type GeneratorParamId<D extends GeneratorDefinition> = Extract<D["parameters"][number]["id"], string>;
|
|
38
41
|
export type ParameterIssueSeverity = "error" | "warning";
|
|
42
|
+
/** Stable machine-readable categories shared by schema, authoring and strict decoding. */
|
|
43
|
+
export type ParameterIssueCode = "invalid" | "missing" | "type" | "unknown" | "minimum" | "maximum" | "integer" | "choice" | "duplicate" | "length" | "bytes" | "structure";
|
|
39
44
|
export interface ParameterIssue {
|
|
40
45
|
readonly severity: ParameterIssueSeverity;
|
|
41
46
|
readonly parameterId?: string | undefined;
|
|
42
47
|
readonly message: string;
|
|
48
|
+
/** Optional stable category; messages remain suitable for existing hosts. */
|
|
49
|
+
readonly code?: ParameterIssueCode | undefined;
|
|
50
|
+
/** Location relative to this parameter value; omitted or empty means the whole value. */
|
|
51
|
+
readonly path?: readonly (number | string)[] | undefined;
|
|
43
52
|
}
|
|
44
53
|
/** A validation issue whose optional parameter ID is tied to one definition. */
|
|
45
54
|
export type GeneratorIssue<D extends GeneratorDefinition = GeneratorDefinition> = Omit<ParameterIssue, "parameterId"> & {
|
package/dist/contracts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OA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Q,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ParameterIssueCode } from "./contracts.js";
|
|
2
|
+
/** Maximum number of straight or cubic segments in an editable closed cross section. */
|
|
3
|
+
export declare const MAX_CROSS_SECTION_SEGMENTS = 32;
|
|
4
|
+
/** Normalized planar coordinates, with X rightward and Y upward, in the unit square. */
|
|
5
|
+
export interface CrossSectionPoint {
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
|
+
}
|
|
9
|
+
/** Editing intent accompanies the explicit curve controls; no tangent is inferred at runtime. */
|
|
10
|
+
export interface CrossSectionAnchor extends CrossSectionPoint {
|
|
11
|
+
readonly mode: "smooth" | "corner";
|
|
12
|
+
}
|
|
13
|
+
export type CrossSectionSegment = {
|
|
14
|
+
readonly type: "line";
|
|
15
|
+
readonly end: CrossSectionAnchor;
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "cubic";
|
|
18
|
+
readonly control1: CrossSectionPoint;
|
|
19
|
+
readonly control2: CrossSectionPoint;
|
|
20
|
+
readonly end: CrossSectionAnchor;
|
|
21
|
+
};
|
|
22
|
+
/** One explicitly closed planar contour. Generators own physical scaling and topology checks. */
|
|
23
|
+
export interface CrossSectionValue {
|
|
24
|
+
readonly version: 1;
|
|
25
|
+
readonly start: CrossSectionAnchor;
|
|
26
|
+
readonly segments: readonly CrossSectionSegment[];
|
|
27
|
+
}
|
|
28
|
+
interface CrossSectionValueProblem {
|
|
29
|
+
readonly code: ParameterIssueCode;
|
|
30
|
+
readonly path: readonly (number | string)[];
|
|
31
|
+
}
|
|
32
|
+
/** Internal diagnostics share the accessor-safe reader used by predicates and cloning. */
|
|
33
|
+
export declare function crossSectionValueProblem(value: unknown): CrossSectionValueProblem | undefined;
|
|
34
|
+
/** Checks portable data and explicit closure without evaluating getters or inspecting topology. */
|
|
35
|
+
export declare function isCrossSectionValue(value: unknown): value is CrossSectionValue;
|
|
36
|
+
/** Returns a fresh, deeply frozen closed contour, including its editing intent. */
|
|
37
|
+
export declare function cloneCrossSectionValue(value: CrossSectionValue): CrossSectionValue;
|
|
38
|
+
/** Compares the serialized shape and editing intent rather than object identity. */
|
|
39
|
+
export declare function crossSectionValuesEqual(previous: CrossSectionValue, next: CrossSectionValue): boolean;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=cross-sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-sections.d.ts","sourceRoot":"","sources":["../src/cross-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,wFAAwF;AACxF,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iGAAiG;AACjG,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAA;CAAE,GAC3D;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEN,iGAAiG;AACjG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACnD;AAED,UAAU,wBAAwB;IAChC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC7C;AAmKD,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,GAAG,SAAS,CAM7F;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAE9E;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,CA0BlF;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,iBAAiB,GACtB,OAAO,CA4BT"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/** Maximum number of straight or cubic segments in an editable closed cross section. */
|
|
2
|
+
export const MAX_CROSS_SECTION_SEGMENTS = 32;
|
|
3
|
+
function dataObject(value, expectedKeys, path, fail) {
|
|
4
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
5
|
+
return fail(path, "type");
|
|
6
|
+
const prototype = Object.getPrototypeOf(value);
|
|
7
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
8
|
+
return fail(path, "structure");
|
|
9
|
+
const unknown = Reflect.ownKeys(value).find((key) => typeof key !== "string" || !expectedKeys.includes(key));
|
|
10
|
+
if (unknown !== undefined) {
|
|
11
|
+
return fail(typeof unknown === "string" && unknown.length > 0 && unknown.length <= 120
|
|
12
|
+
? [...path, unknown]
|
|
13
|
+
: path, "unknown");
|
|
14
|
+
}
|
|
15
|
+
const entries = [];
|
|
16
|
+
for (const key of expectedKeys) {
|
|
17
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
18
|
+
if (descriptor === undefined)
|
|
19
|
+
return fail([...path, key], "missing");
|
|
20
|
+
if (!("value" in descriptor) || !descriptor.enumerable)
|
|
21
|
+
return fail([...path, key], "structure");
|
|
22
|
+
entries.push([key, descriptor.value]);
|
|
23
|
+
}
|
|
24
|
+
return Object.fromEntries(entries);
|
|
25
|
+
}
|
|
26
|
+
function point(value, anchor, path, fail) {
|
|
27
|
+
const fields = dataObject(value, anchor ? ["x", "y", "mode"] : ["x", "y"], path, fail);
|
|
28
|
+
if (fields === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
for (const coordinate of ["x", "y"]) {
|
|
31
|
+
const entry = fields[coordinate];
|
|
32
|
+
if (typeof entry !== "number" || !Number.isFinite(entry))
|
|
33
|
+
return fail([...path, coordinate], "type");
|
|
34
|
+
if (entry < 0)
|
|
35
|
+
return fail([...path, coordinate], "minimum");
|
|
36
|
+
if (entry > 1)
|
|
37
|
+
return fail([...path, coordinate], "maximum");
|
|
38
|
+
}
|
|
39
|
+
const coordinates = { x: fields.x, y: fields.y };
|
|
40
|
+
if (!anchor)
|
|
41
|
+
return coordinates;
|
|
42
|
+
if (fields.mode !== "smooth" && fields.mode !== "corner")
|
|
43
|
+
return fail([...path, "mode"], "choice");
|
|
44
|
+
return { ...coordinates, mode: fields.mode };
|
|
45
|
+
}
|
|
46
|
+
function readCrossSectionValue(value, report) {
|
|
47
|
+
const fail = (path, code) => {
|
|
48
|
+
report?.({ path, code });
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const fields = dataObject(value, ["version", "start", "segments"], [], fail);
|
|
53
|
+
if (fields === undefined)
|
|
54
|
+
return undefined;
|
|
55
|
+
if (fields.version !== 1)
|
|
56
|
+
return fail(["version"], "invalid");
|
|
57
|
+
const start = point(fields.start, true, ["start"], fail);
|
|
58
|
+
if (start === undefined)
|
|
59
|
+
return undefined;
|
|
60
|
+
if (!Array.isArray(fields.segments))
|
|
61
|
+
return fail(["segments"], "type");
|
|
62
|
+
const segments = fields.segments;
|
|
63
|
+
if (Object.getPrototypeOf(segments) !== Array.prototype)
|
|
64
|
+
return fail(["segments"], "structure");
|
|
65
|
+
const lengthDescriptor = Object.getOwnPropertyDescriptor(segments, "length");
|
|
66
|
+
if (lengthDescriptor === undefined || !("value" in lengthDescriptor))
|
|
67
|
+
return fail(["segments"], "structure");
|
|
68
|
+
const length = lengthDescriptor.value;
|
|
69
|
+
if (typeof length !== "number" ||
|
|
70
|
+
!Number.isInteger(length) ||
|
|
71
|
+
length < 2 ||
|
|
72
|
+
length > MAX_CROSS_SECTION_SEGMENTS)
|
|
73
|
+
return fail(["segments"], "length");
|
|
74
|
+
const keys = Reflect.ownKeys(segments);
|
|
75
|
+
if (keys.length !== length + 1 ||
|
|
76
|
+
!keys.every((key) => key === "length"
|
|
77
|
+
? true
|
|
78
|
+
: typeof key === "string" &&
|
|
79
|
+
Number.isSafeInteger(Number(key)) &&
|
|
80
|
+
Number(key) >= 0 &&
|
|
81
|
+
Number(key) < length &&
|
|
82
|
+
String(Number(key)) === key)) {
|
|
83
|
+
const missingIndex = Array.from({ length }, (_, index) => index).find((index) => !Object.hasOwn(segments, String(index)));
|
|
84
|
+
return fail(missingIndex === undefined ? ["segments"] : ["segments", missingIndex], missingIndex === undefined ? "structure" : "missing");
|
|
85
|
+
}
|
|
86
|
+
const parsedSegments = [];
|
|
87
|
+
for (let index = 0; index < length; index += 1) {
|
|
88
|
+
const segmentPath = ["segments", index];
|
|
89
|
+
const descriptor = Object.getOwnPropertyDescriptor(segments, String(index));
|
|
90
|
+
if (descriptor === undefined || !("value" in descriptor) || !descriptor.enumerable)
|
|
91
|
+
return fail(segmentPath, "structure");
|
|
92
|
+
const segment = descriptor.value;
|
|
93
|
+
if (typeof segment !== "object" || segment === null || Array.isArray(segment))
|
|
94
|
+
return fail(segmentPath, "type");
|
|
95
|
+
const typeDescriptor = Object.getOwnPropertyDescriptor(segment, "type");
|
|
96
|
+
if (typeDescriptor === undefined)
|
|
97
|
+
return fail([...segmentPath, "type"], "missing");
|
|
98
|
+
if (!("value" in typeDescriptor))
|
|
99
|
+
return fail([...segmentPath, "type"], "structure");
|
|
100
|
+
const type = typeDescriptor.value;
|
|
101
|
+
if (type !== "line" && type !== "cubic")
|
|
102
|
+
return fail([...segmentPath, "type"], "choice");
|
|
103
|
+
const segmentFields = dataObject(segment, type === "line" ? ["type", "end"] : ["type", "end", "control1", "control2"], segmentPath, fail);
|
|
104
|
+
if (segmentFields === undefined)
|
|
105
|
+
return undefined;
|
|
106
|
+
if (segmentFields.type !== type)
|
|
107
|
+
return fail([...segmentPath, "type"], "invalid");
|
|
108
|
+
const end = point(segmentFields.end, true, [...segmentPath, "end"], fail);
|
|
109
|
+
if (end === undefined)
|
|
110
|
+
return undefined;
|
|
111
|
+
if (index === length - 1) {
|
|
112
|
+
for (const key of ["x", "y", "mode"]) {
|
|
113
|
+
if (end[key] !== start[key])
|
|
114
|
+
return fail([...segmentPath, "end", key], "invalid");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (type === "cubic") {
|
|
118
|
+
const control1 = point(segmentFields.control1, false, [...segmentPath, "control1"], fail);
|
|
119
|
+
if (control1 === undefined)
|
|
120
|
+
return undefined;
|
|
121
|
+
const control2 = point(segmentFields.control2, false, [...segmentPath, "control2"], fail);
|
|
122
|
+
if (control2 === undefined)
|
|
123
|
+
return undefined;
|
|
124
|
+
parsedSegments.push({ type, control1, control2, end });
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
parsedSegments.push({ type, end });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return { version: 1, start, segments: parsedSegments };
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return fail([], "structure");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** Internal diagnostics share the accessor-safe reader used by predicates and cloning. */
|
|
137
|
+
export function crossSectionValueProblem(value) {
|
|
138
|
+
let problem;
|
|
139
|
+
const parsed = readCrossSectionValue(value, (entry) => {
|
|
140
|
+
problem = entry;
|
|
141
|
+
});
|
|
142
|
+
return parsed === undefined ? (problem ?? { code: "structure", path: [] }) : undefined;
|
|
143
|
+
}
|
|
144
|
+
/** Checks portable data and explicit closure without evaluating getters or inspecting topology. */
|
|
145
|
+
export function isCrossSectionValue(value) {
|
|
146
|
+
return readCrossSectionValue(value) !== undefined;
|
|
147
|
+
}
|
|
148
|
+
/** Returns a fresh, deeply frozen closed contour, including its editing intent. */
|
|
149
|
+
export function cloneCrossSectionValue(value) {
|
|
150
|
+
const canonical = readCrossSectionValue(value);
|
|
151
|
+
if (canonical === undefined)
|
|
152
|
+
throw new TypeError("Cross section must be a bounded, normalized closed contour.");
|
|
153
|
+
const clonePoint = (entry) => Object.freeze({ x: entry.x, y: entry.y });
|
|
154
|
+
const cloneAnchor = (entry) => Object.freeze({ x: entry.x, y: entry.y, mode: entry.mode });
|
|
155
|
+
return Object.freeze({
|
|
156
|
+
version: 1,
|
|
157
|
+
start: cloneAnchor(canonical.start),
|
|
158
|
+
segments: Object.freeze(canonical.segments.map((segment) => Object.freeze(segment.type === "line"
|
|
159
|
+
? { type: "line", end: cloneAnchor(segment.end) }
|
|
160
|
+
: {
|
|
161
|
+
type: "cubic",
|
|
162
|
+
control1: clonePoint(segment.control1),
|
|
163
|
+
control2: clonePoint(segment.control2),
|
|
164
|
+
end: cloneAnchor(segment.end),
|
|
165
|
+
}))),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/** Compares the serialized shape and editing intent rather than object identity. */
|
|
169
|
+
export function crossSectionValuesEqual(previous, next) {
|
|
170
|
+
if (Object.is(previous, next))
|
|
171
|
+
return true;
|
|
172
|
+
const previousData = readCrossSectionValue(previous);
|
|
173
|
+
const nextData = readCrossSectionValue(next);
|
|
174
|
+
if (previousData === undefined || nextData === undefined)
|
|
175
|
+
return false;
|
|
176
|
+
const pointsEqual = (left, right) => Object.is(left.x, right.x) && Object.is(left.y, right.y);
|
|
177
|
+
const anchorsEqual = (left, right) => pointsEqual(left, right) && left.mode === right.mode;
|
|
178
|
+
return (anchorsEqual(previousData.start, nextData.start) &&
|
|
179
|
+
previousData.segments.length === nextData.segments.length &&
|
|
180
|
+
previousData.segments.every((segment, index) => {
|
|
181
|
+
const other = nextData.segments[index];
|
|
182
|
+
if (other === undefined ||
|
|
183
|
+
segment.type !== other.type ||
|
|
184
|
+
!anchorsEqual(segment.end, other.end))
|
|
185
|
+
return false;
|
|
186
|
+
return (segment.type === "line" ||
|
|
187
|
+
(other.type === "cubic" &&
|
|
188
|
+
pointsEqual(segment.control1, other.control1) &&
|
|
189
|
+
pointsEqual(segment.control2, other.control2)));
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=cross-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-sections.js","sourceRoot":"","sources":["../src/cross-sections.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAmC7C,SAAS,UAAU,CACjB,KAAc,EACd,YAA+B,EAC/B,IAAkC,EAClC,IAAmB;IAEnB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrE,OAAO,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACzF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CACzC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,C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AK,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,YAAY,GAAG,CAAC,IAAwB,EAAE,KAAyB,EAAW,EAAE,CACpF,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC;IACvD,OAAO,CACL,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;QAChD,YAAY,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM;QACzD,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvC,IACE,KAAK,KAAK,SAAS;gBACnB,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;gBAC3B,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;gBAErC,OAAO,KAAK,CAAC;YACf,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,MAAM;gBACvB,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO;oBACrB,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;oBAC7C,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CACjD,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const METAMESH_RUNTIME_VERSION = "2.
|
|
1
|
+
export declare const METAMESH_RUNTIME_VERSION = "2.2.0";
|
|
2
2
|
export declare const GENERATOR_PACKAGE_FORMAT_VERSION = 2;
|
|
3
3
|
export declare const MAX_GENERATOR_PACKAGE_BYTES: number;
|
|
4
4
|
/** Portable metadata limits enforced before package content reaches Studio. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const METAMESH_RUNTIME_VERSION = "2.
|
|
1
|
+
export const METAMESH_RUNTIME_VERSION = "2.2.0";
|
|
2
2
|
export const GENERATOR_PACKAGE_FORMAT_VERSION = 2;
|
|
3
3
|
export const MAX_GENERATOR_PACKAGE_BYTES = 5 * 1024 * 1024;
|
|
4
4
|
/** Portable metadata limits enforced before package content reaches Studio. */
|
|
@@ -17,6 +17,6 @@ export function validationErrorFromZod(context, error) {
|
|
|
17
17
|
if (issue === undefined)
|
|
18
18
|
return new GeneratorPackageValidationError(`${context} is invalid.`);
|
|
19
19
|
const path = formatPath(issue.path);
|
|
20
|
-
return new GeneratorPackageValidationError(`${context}${path === "" ? "" :
|
|
20
|
+
return new GeneratorPackageValidationError(`${context}${path === "" ? "" : `${path.startsWith("[") ? "" : "."}${path}`}: ${issue.message}`);
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/generator-package/errors.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IACxD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAChD,CAAC;CACF;AAED,SAAS,UAAU,CAAC,IAAsB;IACxC,OAAO,IAAI,CAAC,MAAM,CAAS,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAC7C,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,GAAG,MAAM,IAAI,OAAO,GAAG,CAAC;QAChE,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CA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I,+BAA+B,CAAC,GAAG,OAAO,cAAc,CAAC,CAAC;IAC9F,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,+BAA+B,CACxC,GAAG,OAAO,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC,OAAO,EAAE,CAChG,CAAC;AACJ,CAAC"}
|
|
@@ -136,6 +136,23 @@ export declare const generatorDefinitionSchema: z.ZodObject<{
|
|
|
136
136
|
group: z.ZodOptional<z.ZodString>;
|
|
137
137
|
unit: z.ZodOptional<z.ZodString>;
|
|
138
138
|
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
139
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"cross-section">;
|
|
141
|
+
default: z.ZodPipe<z.ZodCustom<import("../../cross-sections.js").CrossSectionValue, import("../../cross-sections.js").CrossSectionValue>, z.ZodTransform<import("../../cross-sections.js").CrossSectionValue, import("../../cross-sections.js").CrossSectionValue>>;
|
|
142
|
+
widthScale: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
parameterId: z.ZodString;
|
|
144
|
+
factor: z.ZodNumber;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
heightScale: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
parameterId: z.ZodString;
|
|
148
|
+
factor: z.ZodNumber;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
label: z.ZodString;
|
|
152
|
+
description: z.ZodOptional<z.ZodString>;
|
|
153
|
+
group: z.ZodOptional<z.ZodString>;
|
|
154
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
155
|
+
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
139
156
|
}, z.core.$strict>, z.ZodObject<{
|
|
140
157
|
type: z.ZodLiteral<"array">;
|
|
141
158
|
default: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.schema.d.ts","sourceRoot":"","sources":["../../../src/generator-package/schemas/definition.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,oBAAoB;;;;;kBAK/B,CAAC;AAEH,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"definition.schema.d.ts","sourceRoot":"","sources":["../../../src/generator-package/schemas/definition.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,oBAAoB;;;;;kBAK/B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAOpC,CAAC;AAEH,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GACpD,SAAS,YAAY,CAAC,IAAI,CAAC,EAAE,GAC7B,CAAC,SAAS,MAAM,GACd;IAAE,QAAQ,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,GACnD,CAAC,CAAC;AAER,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC;AACjF,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC"}
|
|
@@ -136,6 +136,23 @@ export declare const generatorPackageManifestSchema: z.ZodObject<{
|
|
|
136
136
|
group: z.ZodOptional<z.ZodString>;
|
|
137
137
|
unit: z.ZodOptional<z.ZodString>;
|
|
138
138
|
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
139
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"cross-section">;
|
|
141
|
+
default: z.ZodPipe<z.ZodCustom<import("../../cross-sections.js").CrossSectionValue, import("../../cross-sections.js").CrossSectionValue>, z.ZodTransform<import("../../cross-sections.js").CrossSectionValue, import("../../cross-sections.js").CrossSectionValue>>;
|
|
142
|
+
widthScale: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
parameterId: z.ZodString;
|
|
144
|
+
factor: z.ZodNumber;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
heightScale: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
parameterId: z.ZodString;
|
|
148
|
+
factor: z.ZodNumber;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
label: z.ZodString;
|
|
152
|
+
description: z.ZodOptional<z.ZodString>;
|
|
153
|
+
group: z.ZodOptional<z.ZodString>;
|
|
154
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
155
|
+
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
139
156
|
}, z.core.$strict>, z.ZodObject<{
|
|
140
157
|
type: z.ZodLiteral<"array">;
|
|
141
158
|
default: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.schema.d.ts","sourceRoot":"","sources":["../../../src/generator-package/schemas/manifest.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,8BAA8B
|
|
1
|
+
{"version":3,"file":"manifest.schema.d.ts","sourceRoot":"","sources":["../../../src/generator-package/schemas/manifest.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmBzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACvF,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type CrossSectionValue } from "../../cross-sections.js";
|
|
2
3
|
import { type FontSelection } from "../../fonts.js";
|
|
3
4
|
import { type ProfileValue } from "../../profiles.js";
|
|
4
5
|
declare const numberParameterSchema: z.ZodObject<{
|
|
@@ -136,6 +137,24 @@ declare const profileParameterSchema: z.ZodObject<{
|
|
|
136
137
|
unit: z.ZodOptional<z.ZodString>;
|
|
137
138
|
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
138
139
|
}, z.core.$strict>;
|
|
140
|
+
declare const crossSectionParameterSchema: z.ZodObject<{
|
|
141
|
+
type: z.ZodLiteral<"cross-section">;
|
|
142
|
+
default: z.ZodPipe<z.ZodCustom<CrossSectionValue, CrossSectionValue>, z.ZodTransform<CrossSectionValue, CrossSectionValue>>;
|
|
143
|
+
widthScale: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
parameterId: z.ZodString;
|
|
145
|
+
factor: z.ZodNumber;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
heightScale: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
parameterId: z.ZodString;
|
|
149
|
+
factor: z.ZodNumber;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
label: z.ZodString;
|
|
153
|
+
description: z.ZodOptional<z.ZodString>;
|
|
154
|
+
group: z.ZodOptional<z.ZodString>;
|
|
155
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
156
|
+
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
157
|
+
}, z.core.$strict>;
|
|
139
158
|
declare const numberArrayItemSchema: z.ZodObject<{
|
|
140
159
|
type: z.ZodLiteral<"number">;
|
|
141
160
|
integer: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -289,6 +308,23 @@ export declare const parameterDefinitionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
289
308
|
group: z.ZodOptional<z.ZodString>;
|
|
290
309
|
unit: z.ZodOptional<z.ZodString>;
|
|
291
310
|
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
311
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
312
|
+
type: z.ZodLiteral<"cross-section">;
|
|
313
|
+
default: z.ZodPipe<z.ZodCustom<CrossSectionValue, CrossSectionValue>, z.ZodTransform<CrossSectionValue, CrossSectionValue>>;
|
|
314
|
+
widthScale: z.ZodOptional<z.ZodObject<{
|
|
315
|
+
parameterId: z.ZodString;
|
|
316
|
+
factor: z.ZodNumber;
|
|
317
|
+
}, z.core.$strict>>;
|
|
318
|
+
heightScale: z.ZodOptional<z.ZodObject<{
|
|
319
|
+
parameterId: z.ZodString;
|
|
320
|
+
factor: z.ZodNumber;
|
|
321
|
+
}, z.core.$strict>>;
|
|
322
|
+
id: z.ZodString;
|
|
323
|
+
label: z.ZodString;
|
|
324
|
+
description: z.ZodOptional<z.ZodString>;
|
|
325
|
+
group: z.ZodOptional<z.ZodString>;
|
|
326
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
327
|
+
visibleWhen: z.ZodOptional<z.ZodType<import("../../conditions.js").ConditionExpression, unknown, z.core.$ZodTypeInternals<import("../../conditions.js").ConditionExpression, unknown>>>;
|
|
292
328
|
}, z.core.$strict>, z.ZodObject<{
|
|
293
329
|
type: z.ZodLiteral<"array">;
|
|
294
330
|
default: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>;
|
|
@@ -327,6 +363,8 @@ export type FontParameterDefinition = DeepReadonly<z.output<typeof fontParameter
|
|
|
327
363
|
export type SvgParameterDefinition = DeepReadonly<z.output<typeof svgParameterSchema>>;
|
|
328
364
|
export type ProfileParameterDefinition = DeepReadonly<z.output<typeof profileParameterSchema>>;
|
|
329
365
|
export type ProfileScaleReference = DeepReadonly<z.output<typeof profileScaleReferenceSchema>>;
|
|
366
|
+
export type CrossSectionParameterDefinition = DeepReadonly<z.output<typeof crossSectionParameterSchema>>;
|
|
367
|
+
export type CrossSectionScaleReference = ProfileScaleReference;
|
|
330
368
|
export type ArrayParameterDefinition = DeepReadonly<z.output<typeof arrayParameterSchema>>;
|
|
331
369
|
export type NumberArrayParameterDefinition = Omit<ArrayParameterDefinition, "default" | "items"> & {
|
|
332
370
|
readonly default: readonly number[];
|