@vvfx/dsl-ir 0.0.1-beta.10 → 0.0.1-beta.12
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/README.md +84 -28
- package/dist/dsl/parse-particle-shape.d.ts +7 -0
- package/dist/dsl/schema.d.ts +43 -14
- package/dist/dsl/validator/index.d.ts +1 -1
- package/dist/dsl/validator/types.d.ts +0 -3
- package/dist/dsl/validator/validation.d.ts +2 -2
- package/dist/dsl2ir/convert-source-instances.d.ts +4 -0
- package/dist/dsl2ir/convert.d.ts +8 -3
- package/dist/dsl2ir/recombine/convert.d.ts +2 -2
- package/dist/dsl2ir/recombine/resolve-shared-edits.d.ts +11 -0
- package/dist/dsl2ir/recombine/update-ir.d.ts +2 -2
- package/dist/dsl2ir/recombine/update-layer.d.ts +1 -1
- package/dist/dsl2ir/types.d.ts +14 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +784 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +784 -129
- package/dist/index.mjs.map +1 -1
- package/dist/ir2dsl/convert.d.ts +5 -1
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @vvfx/dsl-ir
|
|
2
2
|
|
|
3
|
+
English | [简体中文](./README-zh_CN.md)
|
|
4
|
+
|
|
3
5
|
Bidirectional conversion and validation for editable DSL and source-neutral Animation IR.
|
|
4
6
|
|
|
5
7
|
The package owns the DSL boundary only. Importing and exporting Galacean Effects JSONScene, including preservation of
|
|
@@ -12,12 +14,11 @@ GE-only data, is handled by `@vvfx/ge-ir`.
|
|
|
12
14
|
- [Data and editing boundaries](#data-and-editing-boundaries)
|
|
13
15
|
- [API](#api)
|
|
14
16
|
- [Project structure](#project-structure)
|
|
15
|
-
- [Contributing](#contributing)
|
|
16
17
|
- [License](#license)
|
|
17
18
|
|
|
18
19
|
## Install
|
|
19
20
|
|
|
20
|
-
Node.js
|
|
21
|
+
Node.js 24 or later is required.
|
|
21
22
|
|
|
22
23
|
```bash
|
|
23
24
|
pnpm add @vvfx/dsl-ir
|
|
@@ -55,7 +56,10 @@ const { scene, diagnostics } = convertDSLToIR(dsl);
|
|
|
55
56
|
```
|
|
56
57
|
|
|
57
58
|
DSL timing is expressed in seconds. Animation IR timing is expressed in frames, using `dsl.meta.fps` as the frame
|
|
58
|
-
rate. Adjacent animation segments may have different end and start values to represent an instantaneous reset.
|
|
59
|
+
rate. Frame rates and canvas dimensions accept finite positive fractional values. Adjacent animation segments may have different end and start values to represent an instantaneous reset.
|
|
60
|
+
|
|
61
|
+
Preserved write-back retains each source composition's frame rate unless `meta.fps` is edited. An explicit FPS edit
|
|
62
|
+
resamples all compositions to the requested rate while preserving durations and precomposition source offsets in seconds.
|
|
59
63
|
|
|
60
64
|
DSL uses the initial `position.z` as a sibling stacking value: higher values render above lower values.
|
|
61
65
|
Array order does not control stacking. Equal values retain the imported order with preserved data; standalone DSL
|
|
@@ -97,8 +101,10 @@ const { scene: updatedScene, diagnostics } = convertDSLToIR(editedDSL, {
|
|
|
97
101
|
```
|
|
98
102
|
|
|
99
103
|
When `preservedData` is supplied, the converter applies DSL-representable changes to the retained IR snapshot while
|
|
100
|
-
keeping information outside the DSL contract.
|
|
101
|
-
|
|
104
|
+
keeping information outside the DSL contract. Warnings do not stop conversion. Edits that can be safely ignored, such as
|
|
105
|
+
new layers or type changes, are skipped and reported through diagnostics and `onWarning`; supported edits still apply.
|
|
106
|
+
Invalid input, invalid preserved data, or edits that cannot retain source depth throw.
|
|
107
|
+
Applications should catch conversion failures and retain their last valid scene, replacing it only after conversion succeeds.
|
|
102
108
|
|
|
103
109
|
### Combine with `@vvfx/ge-ir`
|
|
104
110
|
|
|
@@ -130,11 +136,59 @@ read-only emitter geometry supplied by a source adapter.
|
|
|
130
136
|
|
|
131
137
|
Applications compose source effects, target layout, model requests and GE resource restoration through public adapter APIs.
|
|
132
138
|
|
|
139
|
+
### Convert a complete DSL with particle sources
|
|
140
|
+
|
|
141
|
+
Pass the complete DSL to `convertDSLToIR`. Bind its particle placeholders to the paired source DSL sidecar;
|
|
142
|
+
ordinary layers are authored in the same conversion. This example uses a source with one root particle layer and
|
|
143
|
+
a `fullDSL` containing the target layer ID `target-particle`:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { convertDSLToIR, convertIRToDSL } from '@vvfx/dsl-ir';
|
|
147
|
+
import { convertGEToIR, convertIRToGE } from '@vvfx/ge-ir';
|
|
148
|
+
|
|
149
|
+
const particle = convertGEToIR(particleGE, { frameRate: 30 });
|
|
150
|
+
const source = convertIRToDSL(particle.scene);
|
|
151
|
+
const converted = convertDSLToIR(fullDSL, {
|
|
152
|
+
particleSources: [{
|
|
153
|
+
preservedData: source.preservedData,
|
|
154
|
+
layers: { 'target-particle': source.dsl.layers[0].id },
|
|
155
|
+
}],
|
|
156
|
+
});
|
|
157
|
+
const exported = convertIRToGE(converted.scene, {
|
|
158
|
+
sources: converted.sourceInstances?.map(({ idMap }) => ({ ...particle, idMap })),
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Each `particleSources` entry creates one independent IR Precomp instance. Its `layers` record maps target DSL IDs to
|
|
163
|
+
source DSL IDs. Bind one system or every system in the source composition. Shared systems must have identical target
|
|
164
|
+
width, height, and static position. Targets must be root particle leaves. Use separate entries for independent
|
|
165
|
+
placements or repeated instances. Auxiliary layers accompany the first source system when systems are split.
|
|
166
|
+
|
|
167
|
+
Target width, height, and position place the source region; Z controls painter order with ordinary DSL layers.
|
|
168
|
+
Optional `authoringBounds` defaults to the source canvas and fits proportionally without clipping. Source-local
|
|
169
|
+
position and depth remain intact. Particle values, name, and supplied rotation, scale, anchor, opacity, and timing
|
|
170
|
+
edit the retained source IR. Unedited curves survive. Omitted timing extends the particle and its ancestors to the
|
|
171
|
+
host duration; explicit timing remains unchanged. Source frame rates are retained and the host covers source duration.
|
|
172
|
+
|
|
173
|
+
`sourceInstances` returns each input `sourceIndex` and its `idMap`. For multiple sources, pair each mapping with the
|
|
174
|
+
original GE import at that index. `convertIRToGE` restores and namespaces GE payloads through `options.sources`,
|
|
175
|
+
reconciles edited fields, and exports once. The assembled preserved data is used internally during export.
|
|
176
|
+
Inputs are not mutated.
|
|
177
|
+
|
|
178
|
+
Sources require trusted GE 3.6 data and self-contained compositions. Coupled systems must stay in one instance.
|
|
179
|
+
DSL and GE adapters remain independent; source selection and paired sidecars belong to the application.
|
|
180
|
+
|
|
133
181
|
## Data and editing boundaries
|
|
134
182
|
|
|
135
183
|
- `@vvfx/animation-ir` is the single source of truth for Animation IR types and validation.
|
|
136
184
|
- DSL is an editing-oriented subset, not a mirror of any source format schema.
|
|
137
185
|
- `convertIRToDSL` expands precompositions and stores the write-back relationships in `IRToDSLPreservedData`.
|
|
186
|
+
Shared instances edit the same source layers. Conflicting values for one field retain that field's original value
|
|
187
|
+
with a warning; other edits apply. Deleting a shared child affects every instance and produces a warning.
|
|
188
|
+
- Independent rotation axes are sampled at their combined keyframe times and linearly interpolated with a diagnostic.
|
|
189
|
+
Original easing and curves remain in the sidecar until rotation is edited.
|
|
190
|
+
- Text size and line height are positive composition-pixel values; letter spacing uses the same units and may be negative.
|
|
191
|
+
Omitted line height uses the font size.
|
|
138
192
|
- Fidelity-preserving write-back supports field edits, deletion, and reordering of existing layers under the same
|
|
139
193
|
parent. Unsafe edits are reported through diagnostics or warnings.
|
|
140
194
|
- Both conversion directions validate their IR boundary. Every successfully returned `scene` satisfies the Animation
|
|
@@ -154,11 +208,9 @@ Applications compose source effects, target layout, model requests and GE resour
|
|
|
154
208
|
|
|
155
209
|
Further documentation:
|
|
156
210
|
|
|
157
|
-
- [DSL
|
|
158
|
-
- [
|
|
159
|
-
- [
|
|
160
|
-
- [DSL, IR, and GE package boundaries](../../docs/dsl-ir-ge-ir-boundary.md)
|
|
161
|
-
- [Animation IR particle contract](../../docs/particle-ir-contract.md)
|
|
211
|
+
- [DSL schema types](./src/dsl/schema.ts)
|
|
212
|
+
- [Animation IR contract](../animation-ir/README.md)
|
|
213
|
+
- [GE adapter and package boundaries](../ge-ir/README.md)
|
|
162
214
|
|
|
163
215
|
## API
|
|
164
216
|
|
|
@@ -169,16 +221,18 @@ Further documentation:
|
|
|
169
221
|
| `convertDSLToIR` | Convert a new DSL document to IR, or write DSL values back to retained IR |
|
|
170
222
|
| `convertIRToDSL` | Convert IR to editable DSL and return the sidecar needed for write-back |
|
|
171
223
|
| `validateDSL` | Validate an unknown value against the DSL contract |
|
|
172
|
-
| `DSLValidationError` | Structured error
|
|
224
|
+
| `DSLValidationError` | Structured error for invalid DSL; conversion may also throw IR validation or other errors |
|
|
225
|
+
| `parseParticleShape` | Project GE-style numeric shape tags into optional read-only DSL context |
|
|
226
|
+
| `ValueType` | Runtime particle expression tags: `CONSTANT = 0`, `RANDOM = 4` |
|
|
173
227
|
|
|
174
228
|
Core signatures:
|
|
175
229
|
|
|
176
230
|
```ts
|
|
177
|
-
function convertDSLToIR(composition: Composition, options?:
|
|
231
|
+
function convertDSLToIR(composition: Composition, options?: DSLToIROptions): DSLToIRResult;
|
|
178
232
|
|
|
179
233
|
function convertIRToDSL(scene: IRScene): IRToDSLResult;
|
|
180
234
|
|
|
181
|
-
function validateDSL(dsl: unknown
|
|
235
|
+
function validateDSL(dsl: unknown): DSLValidationResult;
|
|
182
236
|
```
|
|
183
237
|
|
|
184
238
|
### Type exports
|
|
@@ -188,8 +242,8 @@ All public types are imported from the package root:
|
|
|
188
242
|
- DSL schema: `AnimationCurve`, `AnimatedProperty`, `Asset`, `Composition`, `CompositionMeta`, `Description`, `Layer`,
|
|
189
243
|
`LLMSVGAsset`, `NumberExpression`, the `Particle*` types, `TextProperties`, `UserAsset`, and
|
|
190
244
|
`ValueType`.
|
|
191
|
-
- Validation: `DSLValidationIssue
|
|
192
|
-
- DSL to IR: `
|
|
245
|
+
- Validation: `DSLValidationIssue` and `DSLValidationResult`.
|
|
246
|
+
- DSL to IR: `DSLToIROptions`, `DSLParticleSource`, `DSLToIRChange`, `DSLToIRResult`, and `DSLToIRWarning`.
|
|
193
247
|
- IR to DSL: `IRToDSLPreservedData` and `IRToDSLResult`.
|
|
194
248
|
|
|
195
249
|
Important result and option types:
|
|
@@ -202,39 +256,41 @@ interface IRToDSLResult {
|
|
|
202
256
|
}
|
|
203
257
|
|
|
204
258
|
interface DSLToIRResult {
|
|
259
|
+
sourceInstances?: { sourceIndex: number; idMap: Record<string, string> }[];
|
|
205
260
|
scene: IRScene;
|
|
206
261
|
diagnostics: ConversionDiagnostic[];
|
|
207
262
|
}
|
|
208
263
|
|
|
209
|
-
interface
|
|
264
|
+
interface DSLParticleSource {
|
|
265
|
+
preservedData: IRToDSLPreservedData;
|
|
266
|
+
layers: Readonly<Record<string, string>>;
|
|
267
|
+
authoringBounds?: readonly [x: number, y: number, width: number, height: number];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface DSLToIROptions {
|
|
210
271
|
preservedData?: IRToDSLPreservedData;
|
|
211
|
-
|
|
272
|
+
particleSources?: readonly DSLParticleSource[];
|
|
212
273
|
onWarning?: (warning: DSLToIRWarning) => void;
|
|
213
274
|
onChange?: (change: DSLToIRChange) => void;
|
|
214
275
|
}
|
|
215
276
|
```
|
|
216
277
|
|
|
278
|
+
TypeScript callers should use `Layer['position']` or `AnimatedProperty<[number, number, number]>` for vector tracks
|
|
279
|
+
and `AnimatedProperty<number>` for opacity. `anchor` is static. Construct each `Layer` variant together with its required
|
|
280
|
+
`asset`, `text`, or `particle` content. Zero font size and non-positive explicit line height are rejected;
|
|
281
|
+
omit `line_height` to use the font size.
|
|
282
|
+
|
|
217
283
|
## Project structure
|
|
218
284
|
|
|
219
285
|
```text
|
|
220
286
|
src/
|
|
221
|
-
dsl/ DSL schema and validation
|
|
287
|
+
dsl/ DSL schema, emitter shape parsing, and validation
|
|
222
288
|
dsl2ir/ DSL to Animation IR
|
|
223
289
|
recombine/ Preserved-data write-back into retained IR
|
|
224
290
|
ir2dsl/ Animation IR to DSL and precomposition expansion
|
|
225
291
|
common/ Value mappings shared by both directions
|
|
226
292
|
```
|
|
227
293
|
|
|
228
|
-
## Contributing
|
|
229
|
-
|
|
230
|
-
Use repository issues for questions and bug reports. Pull requests are welcome. Run the package checks after changing
|
|
231
|
-
public behavior:
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
pnpm --filter @vvfx/dsl-ir test
|
|
235
|
-
pnpm --filter @vvfx/dsl-ir build
|
|
236
|
-
```
|
|
237
|
-
|
|
238
294
|
## License
|
|
239
295
|
|
|
240
296
|
[MIT](./LICENSE) © 2019-present Ant Group Co., Ltd.
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { ParticleShape } from './particle-shape';
|
|
2
|
+
/**
|
|
3
|
+
* Project a GE-style emitter shape (numeric type 0..9) into read-only DSL context.
|
|
4
|
+
* Shape names come from the type tag; missing arcMode defaults to 0. Other numeric
|
|
5
|
+
* fields retain source units. Unsupported types or invalid required fields return
|
|
6
|
+
* undefined; invalid optional fields are omitted. Direction expressions are cloned,
|
|
7
|
+
* so their payloads must be structured-cloneable. No geometry is written into IR.
|
|
8
|
+
*/
|
|
2
9
|
export declare function parseParticleShape(value: unknown): ParticleShape | undefined;
|
package/dist/dsl/schema.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import type { NumberExpression } from './number-expression';
|
|
2
2
|
import type { ParticleShape } from './particle-shape';
|
|
3
|
-
|
|
3
|
+
type Vector3 = [number, number, number];
|
|
4
|
+
export interface AnimationCurve<T extends number | number[] = number | number[]> {
|
|
4
5
|
t: [number, number];
|
|
5
|
-
start: number[];
|
|
6
|
-
end: number[];
|
|
6
|
+
start: T extends number ? [number] : T;
|
|
7
|
+
end: T extends number ? [number] : T;
|
|
8
|
+
/** Cubic Bezier [x1, y1, x2, y2] over normalized segment time and progress. */
|
|
7
9
|
easing: [number, number, number, number];
|
|
10
|
+
/** Incoming/outgoing spatial offsets for position segments, in composition pixels. */
|
|
8
11
|
in?: [number, number, number];
|
|
9
12
|
out?: [number, number, number];
|
|
10
13
|
}
|
|
11
|
-
export type AnimatedProperty = {
|
|
14
|
+
export type AnimatedProperty<T extends number | number[] = number | number[]> = {
|
|
12
15
|
a: false;
|
|
13
|
-
value:
|
|
16
|
+
value: T;
|
|
14
17
|
} | {
|
|
15
18
|
a: true;
|
|
16
|
-
animation: AnimationCurve[];
|
|
19
|
+
animation: AnimationCurve<T>[];
|
|
17
20
|
};
|
|
18
21
|
export interface Description {
|
|
19
22
|
self: string;
|
|
@@ -35,10 +38,13 @@ export type Asset = UserAsset | LLMSVGAsset;
|
|
|
35
38
|
export interface TextProperties {
|
|
36
39
|
content: string;
|
|
37
40
|
font?: string;
|
|
41
|
+
/** Font size in composition pixels; finite and greater than zero. */
|
|
38
42
|
size: number;
|
|
39
43
|
color: string;
|
|
40
44
|
align?: 'left' | 'center' | 'right';
|
|
45
|
+
/** Absolute line height in composition pixels; greater than zero. Omission uses size. */
|
|
41
46
|
line_height?: number;
|
|
47
|
+
/** Additional spacing in composition pixels, independent of size; negative values are allowed. */
|
|
42
48
|
letter_spacing?: number;
|
|
43
49
|
}
|
|
44
50
|
export interface ParticleOptions {
|
|
@@ -63,31 +69,53 @@ export interface ParticleProperties {
|
|
|
63
69
|
options: ParticleOptions;
|
|
64
70
|
emission: ParticleEmissionProperties;
|
|
65
71
|
}
|
|
66
|
-
|
|
72
|
+
/** Missing optional transform channels retain source values on write-back; fresh conversion uses identity defaults. */
|
|
73
|
+
interface LayerBase {
|
|
67
74
|
id: string;
|
|
68
75
|
name: string;
|
|
69
|
-
type: 'null' | 'layer' | 'text' | 'particle';
|
|
70
76
|
width: number;
|
|
71
77
|
height: number;
|
|
72
78
|
description: Description;
|
|
73
79
|
parent?: string | null;
|
|
74
80
|
/** Omission retains source timing during preserved write-back, otherwise uses the composition duration. */
|
|
75
81
|
time_range?: [number, number];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
/** XY are composition pixels; initial Z is the fixed sibling stacking rank, not spatial depth. */
|
|
83
|
+
position: AnimatedProperty<Vector3>;
|
|
84
|
+
/** Euler angles in degrees. */
|
|
85
|
+
rotation?: AnimatedProperty<Vector3>;
|
|
86
|
+
/** Unitless axis multipliers. */
|
|
87
|
+
scale?: AnimatedProperty<Vector3>;
|
|
88
|
+
/** Static anchor in layer-local pixels. */
|
|
89
|
+
anchor?: {
|
|
90
|
+
a: false;
|
|
91
|
+
value: Vector3;
|
|
92
|
+
};
|
|
93
|
+
/** Unitless opacity in [0, 1]; animated endpoints are single-element arrays. */
|
|
94
|
+
opacity?: AnimatedProperty<number>;
|
|
82
95
|
asset?: Asset;
|
|
83
96
|
text?: TextProperties;
|
|
84
97
|
particle?: ParticleProperties;
|
|
85
98
|
children?: Layer[];
|
|
86
99
|
}
|
|
100
|
+
export type Layer = LayerBase & ({
|
|
101
|
+
type: 'null';
|
|
102
|
+
} | {
|
|
103
|
+
type: 'layer';
|
|
104
|
+
asset: Asset;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'text';
|
|
107
|
+
text: TextProperties;
|
|
108
|
+
} | {
|
|
109
|
+
type: 'particle';
|
|
110
|
+
particle: ParticleProperties;
|
|
111
|
+
});
|
|
87
112
|
export interface CompositionMeta {
|
|
88
113
|
name: string;
|
|
114
|
+
/** Finite positive duration in seconds. */
|
|
89
115
|
duration: number;
|
|
116
|
+
/** Finite positive frames per second; fractional rates are supported. */
|
|
90
117
|
fps: number;
|
|
118
|
+
/** Finite positive canvas dimensions in composition pixels; fractional sizes are supported. */
|
|
91
119
|
width: number;
|
|
92
120
|
height: number;
|
|
93
121
|
loop: boolean;
|
|
@@ -98,3 +126,4 @@ export interface Composition {
|
|
|
98
126
|
meta: CompositionMeta;
|
|
99
127
|
layers: Layer[];
|
|
100
128
|
}
|
|
129
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DSLValidationError, validateDSL } from './validation';
|
|
2
|
-
export type { DSLValidationIssue, DSLValidationResult
|
|
2
|
+
export type { DSLValidationIssue, DSLValidationResult } from './types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DSLLintReport, DSLValidationIssue, DSLValidationResult
|
|
1
|
+
import type { DSLLintReport, DSLValidationIssue, DSLValidationResult } from './types';
|
|
2
2
|
/** Lint an unnormalized DSL value while preserving issue severity. */
|
|
3
3
|
export declare function lintDSL(dsl: unknown): DSLLintReport;
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ export declare function lintDSL(dsl: unknown): DSLLintReport;
|
|
|
6
6
|
* Strings are interpreted as raw JSON. File-system paths are intentionally not
|
|
7
7
|
* accepted so the same validator works unchanged in Node.js and browsers.
|
|
8
8
|
*/
|
|
9
|
-
export declare function validateDSL(dsl: unknown
|
|
9
|
+
export declare function validateDSL(dsl: unknown): DSLValidationResult;
|
|
10
10
|
/** Error thrown when a value cannot be used as a valid DSL composition. */
|
|
11
11
|
export declare class DSLValidationError extends TypeError {
|
|
12
12
|
readonly issues: DSLValidationIssue[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Composition } from '../dsl/schema';
|
|
2
|
+
import type { DSLToIROptions, DSLToIRResult } from './types';
|
|
3
|
+
/** Source bindings distinguish target layout from edits to source-local emitter transforms. */
|
|
4
|
+
export declare function convertDSLWithParticleSources(document: Composition, options: DSLToIROptions): DSLToIRResult;
|
package/dist/dsl2ir/convert.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Composition } from '../dsl/schema';
|
|
2
|
-
import type {
|
|
3
|
-
/**
|
|
4
|
-
|
|
2
|
+
import type { DSLToIROptions, DSLToIRResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Convert DSL into a new IR scene, or apply edits to its paired preserved snapshot.
|
|
5
|
+
* Inputs are not mutated. Recoverable unsupported edits produce diagnostics.
|
|
6
|
+
* Invalid DSL throws DSLValidationError; IR validation, invalid sidecars, unsafe
|
|
7
|
+
* depth edits, and caller callbacks may throw other errors.
|
|
8
|
+
*/
|
|
9
|
+
export declare function convertDSLToIR(composition: Composition, options?: DSLToIROptions): DSLToIRResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Composition } from '../../dsl/schema';
|
|
2
2
|
import type { IRToDSLPreservedData } from '../../ir2dsl/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { DSLToIROptions, DSLToIRResult } from '../types';
|
|
4
4
|
/** Convert DSL to a clone of the baseline IR carried by the adapter-owned preserved data. */
|
|
5
|
-
export declare function convertDSLToIRWithPreservedData(composition: Composition, preservedData: IRToDSLPreservedData, options?:
|
|
5
|
+
export declare function convertDSLToIRWithPreservedData(composition: Composition, preservedData: IRToDSLPreservedData, options?: DSLToIROptions): DSLToIRResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Layer } from '../../dsl/schema';
|
|
2
|
+
import type { IRToDSLLayerMapping } from '../../ir2dsl/types';
|
|
3
|
+
import type { DSLToIRWarningReporter } from '../types';
|
|
4
|
+
interface SharedLayerEdit {
|
|
5
|
+
baseline: Layer;
|
|
6
|
+
edited: Layer | undefined;
|
|
7
|
+
path: string;
|
|
8
|
+
}
|
|
9
|
+
/** Resolve linked edits before mutating IR; conflicting fields retain their baseline values. */
|
|
10
|
+
export declare function resolveSharedPrecompEdits(entries: SharedLayerEdit[], mapping: IRToDSLLayerMapping, reportWarning: DSLToIRWarningReporter): void;
|
|
11
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IRScene } from '@vvfx/animation-ir';
|
|
2
2
|
import type { Composition } from '../../dsl/schema';
|
|
3
3
|
import type { IRToDSLLayerMapping } from '../../ir2dsl/types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DSLToIROptions } from '../types';
|
|
5
5
|
/** Apply previously validated DSL to a clone of the baseline IR. */
|
|
6
|
-
export declare function updateValidatedIRFromDSL(baselineScene: IRScene, editedDocument: Composition, layerMapping: IRToDSLLayerMapping, options?:
|
|
6
|
+
export declare function updateValidatedIRFromDSL(baselineScene: IRScene, editedDocument: Composition, layerMapping: IRToDSLLayerMapping, options?: DSLToIROptions): IRScene;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IRLayer, IRScene } from '@vvfx/animation-ir';
|
|
2
2
|
import type { Layer } from '../../dsl/schema';
|
|
3
3
|
import type { DSLToIRChangeReporter, DSLToIRWarningReporter } from '../types';
|
|
4
|
-
export declare function updateIRLayer(irLayer: IRLayer, irScene: IRScene, editedLayer: Layer, baselineLayer: Layer, dslPath: string, frameRate: number,
|
|
4
|
+
export declare function updateIRLayer(irLayer: IRLayer, irScene: IRScene, editedLayer: Layer, baselineLayer: Layer, dslPath: string, frameRate: number, reportWarning: DSLToIRWarningReporter, reportChange: DSLToIRChangeReporter, applySupportedEdits?: boolean): void;
|
package/dist/dsl2ir/types.d.ts
CHANGED
|
@@ -22,9 +22,16 @@ export interface DSLToIRChange {
|
|
|
22
22
|
note?: string;
|
|
23
23
|
}
|
|
24
24
|
export type DSLToIRChangeReporter = (change: DSLToIRChange) => void;
|
|
25
|
-
|
|
25
|
+
/** One source group or independent particle system placed in the target DSL. */
|
|
26
|
+
export interface DSLParticleSource {
|
|
27
|
+
preservedData: IRToDSLPreservedData;
|
|
28
|
+
/** Target DSL layer ID -> source DSL layer ID. */
|
|
29
|
+
layers: Readonly<Record<string, string>>;
|
|
30
|
+
authoringBounds?: readonly [x: number, y: number, width: number, height: number];
|
|
31
|
+
}
|
|
32
|
+
export interface DSLToIROptions {
|
|
26
33
|
preservedData?: IRToDSLPreservedData;
|
|
27
|
-
|
|
34
|
+
particleSources?: readonly DSLParticleSource[];
|
|
28
35
|
onWarning?: (warning: DSLToIRWarning) => void;
|
|
29
36
|
onChange?: (change: DSLToIRChange) => void;
|
|
30
37
|
}
|
|
@@ -32,4 +39,9 @@ export interface ConvertDSLToIROptions {
|
|
|
32
39
|
export interface DSLToIRResult {
|
|
33
40
|
scene: IRScene;
|
|
34
41
|
diagnostics: ConversionDiagnostic[];
|
|
42
|
+
/** Source identities for adapters restoring data outside the IR contract. */
|
|
43
|
+
sourceInstances?: {
|
|
44
|
+
sourceIndex: number;
|
|
45
|
+
idMap: Record<string, string>;
|
|
46
|
+
}[];
|
|
35
47
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ export { convertDSLToIR } from './dsl2ir/convert';
|
|
|
2
2
|
export { convertIRToDSL } from './ir2dsl/convert';
|
|
3
3
|
export { DSLValidationError, validateDSL } from './dsl/validator';
|
|
4
4
|
export type { AnimationCurve, AnimatedProperty, Asset, Composition, CompositionMeta, Description, Layer, LLMSVGAsset, ParticleBurst, ParticleEmissionProperties, ParticleOptions, ParticleProperties, TextProperties, UserAsset, } from './dsl/schema';
|
|
5
|
-
export
|
|
5
|
+
export { ValueType } from './dsl/number-expression';
|
|
6
|
+
export type { ConstantNumber, NumberExpression, RandomValue, } from './dsl/number-expression';
|
|
6
7
|
export type { ParticleShape, ParticleShapeArcMode, ParticleShapeName, ParticleShapeNumberExpression, ParticleTextureShapeDetail, } from './dsl/particle-shape';
|
|
7
|
-
export type { DSLValidationIssue, DSLValidationResult
|
|
8
|
-
export type {
|
|
8
|
+
export type { DSLValidationIssue, DSLValidationResult } from './dsl/validator';
|
|
9
|
+
export type { DSLToIROptions, DSLParticleSource, DSLToIRChange, DSLToIRResult, DSLToIRWarning, } from './dsl2ir/types';
|
|
9
10
|
export type { IRToDSLPreservedData, IRToDSLResult } from './ir2dsl/types';
|
|
10
11
|
export { parseParticleShape } from './dsl/parse-particle-shape';
|