@pixodesk/svg-animator-core 1.0.28 → 1.0.30
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 +3 -3
- package/dist/index.cjs +82 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -12
- package/dist/index.d.ts +28 -12
- package/dist/index.js +79 -24
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -237,15 +237,15 @@ declare const PxLoopExtend: {
|
|
|
237
237
|
readonly after: "after";
|
|
238
238
|
};
|
|
239
239
|
type PxLoopExtend = typeof PxLoopExtend[keyof typeof PxLoopExtend];
|
|
240
|
-
/** `
|
|
240
|
+
/** `strokeTrim.subPaths` — what the 0..1 `range`/`offset` window is measured over.
|
|
241
241
|
* `separate` (default): each sub-path against its OWN length, all trimmed alike.
|
|
242
242
|
* `combined`: every descendant sub-path chained end-to-end into one virtual path,
|
|
243
243
|
* so the window slides across siblings (AE "Trim All As One"). */
|
|
244
|
-
declare const
|
|
244
|
+
declare const PxStrokeTrimSubPaths: {
|
|
245
245
|
readonly separate: "separate";
|
|
246
246
|
readonly combined: "combined";
|
|
247
247
|
};
|
|
248
|
-
type
|
|
248
|
+
type PxStrokeTrimSubPaths = typeof PxStrokeTrimSubPaths[keyof typeof PxStrokeTrimSubPaths];
|
|
249
249
|
/** @deprecated Backwards-compatibility alias — use {@link PxAnimatorMode} for the type. */
|
|
250
250
|
type JsMode = PxAnimatorMode;
|
|
251
251
|
declare const TEXT_ATTR = "text";
|
|
@@ -1317,6 +1317,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1317
1317
|
subject?: string | undefined;
|
|
1318
1318
|
smoothing?: number | undefined;
|
|
1319
1319
|
pin?: boolean | undefined;
|
|
1320
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1320
1321
|
pinTop?: number | undefined;
|
|
1321
1322
|
pinDistance?: number | undefined;
|
|
1322
1323
|
range?: ({} & {
|
|
@@ -1338,6 +1339,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1338
1339
|
subject: PxSchema<string | undefined, true>;
|
|
1339
1340
|
smoothing: PxSchema<number | undefined, true>;
|
|
1340
1341
|
pin: PxSchema<boolean | undefined, true>;
|
|
1342
|
+
pinAlign: PxSchema<"top" | "center" | "bottom" | undefined, true>;
|
|
1341
1343
|
pinTop: PxSchema<number | undefined, true>;
|
|
1342
1344
|
pinDistance: PxSchema<number | undefined, true>;
|
|
1343
1345
|
range: PxSchema<({} & {
|
|
@@ -1644,6 +1646,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1644
1646
|
subject?: string | undefined;
|
|
1645
1647
|
smoothing?: number | undefined;
|
|
1646
1648
|
pin?: boolean | undefined;
|
|
1649
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1647
1650
|
pinTop?: number | undefined;
|
|
1648
1651
|
pinDistance?: number | undefined;
|
|
1649
1652
|
range?: ({} & {
|
|
@@ -1950,6 +1953,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1950
1953
|
subject?: string | undefined;
|
|
1951
1954
|
smoothing?: number | undefined;
|
|
1952
1955
|
pin?: boolean | undefined;
|
|
1956
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1953
1957
|
pinTop?: number | undefined;
|
|
1954
1958
|
pinDistance?: number | undefined;
|
|
1955
1959
|
range?: ({} & {
|
|
@@ -4162,7 +4166,7 @@ declare const PxMaskedByEffectSchema: PxSchema<{} & {
|
|
|
4162
4166
|
};
|
|
4163
4167
|
};
|
|
4164
4168
|
type PxMaskedByEffect = PxInfer<typeof PxMaskedByEffectSchema>;
|
|
4165
|
-
declare const
|
|
4169
|
+
declare const PxStrokeTrimEffectSchema: PxSchema<{} & {
|
|
4166
4170
|
offset?: number | ({} & {
|
|
4167
4171
|
value?: string | number | number[] | ({} & {
|
|
4168
4172
|
translate?: [number, number] | undefined;
|
|
@@ -4517,7 +4521,7 @@ declare const PxTrimPathEffectSchema: PxSchema<{} & {
|
|
|
4517
4521
|
subPaths: PxSchema<"separate" | "combined" | undefined, true>;
|
|
4518
4522
|
};
|
|
4519
4523
|
};
|
|
4520
|
-
type
|
|
4524
|
+
type PxStrokeTrimEffect = PxInfer<typeof PxStrokeTrimEffectSchema>;
|
|
4521
4525
|
declare const PxRetimeEffectSchema: PxSchema<{} & {
|
|
4522
4526
|
sourceId?: string | undefined;
|
|
4523
4527
|
start?: number | undefined;
|
|
@@ -8144,7 +8148,7 @@ declare const PxEffectsSchema: PxSchema<{} & {
|
|
|
8144
8148
|
autoOrient?: boolean | undefined;
|
|
8145
8149
|
}) | undefined;
|
|
8146
8150
|
}) | undefined;
|
|
8147
|
-
|
|
8151
|
+
strokeTrim?: ({} & {
|
|
8148
8152
|
offset?: number | ({} & {
|
|
8149
8153
|
value?: string | number | number[] | ({} & {
|
|
8150
8154
|
translate?: [number, number] | undefined;
|
|
@@ -10647,7 +10651,7 @@ declare const PxEffectsSchema: PxSchema<{} & {
|
|
|
10647
10651
|
autoOrient?: boolean | undefined;
|
|
10648
10652
|
}) | undefined;
|
|
10649
10653
|
}) | undefined, true>;
|
|
10650
|
-
|
|
10654
|
+
strokeTrim: PxSchema<({} & {
|
|
10651
10655
|
offset?: number | ({} & {
|
|
10652
10656
|
value?: string | number | number[] | ({} & {
|
|
10653
10657
|
translate?: [number, number] | undefined;
|
|
@@ -13175,7 +13179,7 @@ declare const PxNodeBase: PxSchema<{
|
|
|
13175
13179
|
autoOrient?: boolean | undefined;
|
|
13176
13180
|
}) | undefined;
|
|
13177
13181
|
}) | undefined;
|
|
13178
|
-
|
|
13182
|
+
strokeTrim?: ({} & {
|
|
13179
13183
|
offset?: number | ({} & {
|
|
13180
13184
|
value?: string | number | number[] | ({} & {
|
|
13181
13185
|
translate?: [number, number] | undefined;
|
|
@@ -15855,7 +15859,7 @@ declare const PxNodeBase: PxSchema<{
|
|
|
15855
15859
|
autoOrient?: boolean | undefined;
|
|
15856
15860
|
}) | undefined;
|
|
15857
15861
|
}) | undefined;
|
|
15858
|
-
|
|
15862
|
+
strokeTrim?: ({} & {
|
|
15859
15863
|
offset?: number | ({} & {
|
|
15860
15864
|
value?: string | number | number[] | ({} & {
|
|
15861
15865
|
translate?: [number, number] | undefined;
|
|
@@ -17783,6 +17787,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
17783
17787
|
subject?: string | undefined;
|
|
17784
17788
|
smoothing?: number | undefined;
|
|
17785
17789
|
pin?: boolean | undefined;
|
|
17790
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
17786
17791
|
pinTop?: number | undefined;
|
|
17787
17792
|
pinDistance?: number | undefined;
|
|
17788
17793
|
range?: ({} & {
|
|
@@ -18094,6 +18099,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
18094
18099
|
subject?: string | undefined;
|
|
18095
18100
|
smoothing?: number | undefined;
|
|
18096
18101
|
pin?: boolean | undefined;
|
|
18102
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18097
18103
|
pinTop?: number | undefined;
|
|
18098
18104
|
pinDistance?: number | undefined;
|
|
18099
18105
|
range?: ({} & {
|
|
@@ -18424,6 +18430,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
18424
18430
|
subject?: string | undefined;
|
|
18425
18431
|
smoothing?: number | undefined;
|
|
18426
18432
|
pin?: boolean | undefined;
|
|
18433
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18427
18434
|
pinTop?: number | undefined;
|
|
18428
18435
|
pinDistance?: number | undefined;
|
|
18429
18436
|
range?: ({} & {
|
|
@@ -19501,7 +19508,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
19501
19508
|
autoOrient?: boolean | undefined;
|
|
19502
19509
|
}) | undefined;
|
|
19503
19510
|
}) | undefined;
|
|
19504
|
-
|
|
19511
|
+
strokeTrim?: ({} & {
|
|
19505
19512
|
offset?: number | ({} & {
|
|
19506
19513
|
value?: string | number | number[] | ({} & {
|
|
19507
19514
|
translate?: [number, number] | undefined;
|
|
@@ -21414,6 +21421,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
21414
21421
|
subject?: string | undefined;
|
|
21415
21422
|
smoothing?: number | undefined;
|
|
21416
21423
|
pin?: boolean | undefined;
|
|
21424
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
21417
21425
|
pinTop?: number | undefined;
|
|
21418
21426
|
pinDistance?: number | undefined;
|
|
21419
21427
|
range?: ({} & {
|
|
@@ -22491,7 +22499,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
22491
22499
|
autoOrient?: boolean | undefined;
|
|
22492
22500
|
}) | undefined;
|
|
22493
22501
|
}) | undefined;
|
|
22494
|
-
|
|
22502
|
+
strokeTrim?: ({} & {
|
|
22495
22503
|
offset?: number | ({} & {
|
|
22496
22504
|
value?: string | number | number[] | ({} & {
|
|
22497
22505
|
translate?: [number, number] | undefined;
|
|
@@ -24608,6 +24616,14 @@ interface GlyphMaterialiseOpts<E = any> {
|
|
|
24608
24616
|
/** Optional diagnostics sink. */
|
|
24609
24617
|
warnings?: Array<string>;
|
|
24610
24618
|
}
|
|
24619
|
+
/**
|
|
24620
|
+
* Class stamped on the `<path>` holding the □ placeholders — and ONLY on it: the missing
|
|
24621
|
+
* boxes are emitted separately from the real glyphs so a consumer can style them on their
|
|
24622
|
+
* own. The editor uses it to fade them in with a delay: a freshly typed character is
|
|
24623
|
+
* missing for a few frames until its glyph is fetched asynchronously, and a □ that flashes
|
|
24624
|
+
* for that long reads as a rendering glitch.
|
|
24625
|
+
*/
|
|
24626
|
+
declare const MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
24611
24627
|
declare function materialiseGlyphTextHorizontal<E = any>(node: PxNode, opts: GlyphMaterialiseOpts<E>): E;
|
|
24612
24628
|
/** Per-CHARACTER advance box (local, pre-transform coords). `x,y` = the char's baseline start,
|
|
24613
24629
|
* `width` = its advance, `ascent`/`fontSize` size its bbox. */
|
|
@@ -24738,4 +24754,4 @@ interface EffectDiff {
|
|
|
24738
24754
|
*/
|
|
24739
24755
|
declare function diffInEffect(a: VmNode, b: VmNode): Array<EffectDiff>;
|
|
24740
24756
|
|
|
24741
|
-
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type
|
|
24757
|
+
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, MISSING_GLYPH_CLASS_NAME, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxStrokeTrimSubPaths, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type PxValidationContext, type PxValidationResult, type RemoveIndex, STYLE_ATTR_NAMES, type StartOn, TEXT_ATTR, TEXT_CONTENT_ATTR, TRANSFORM_FN_NAMES, type Vec2, applyPlayerEffects, bezierToSvgPath, calcAnimationValues, camelCaseToKebabWordIfNeeded, clamp, collectSampleTimes, composeTransformParts, createBasicFrameLoopAnimator, createPathSampler, cubicBezier, deepClone, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, generateUniqueId, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalisedBindings, getNormalizedProps, interpolateBeziers, interpolateValue, isPxElementFileFormat, isPxElementFileFormatDeep, isScrollTimeline, jsonElementFactory, kebabToCamelCaseWord, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, propAnimIsMotionPath, px, resolveStyle, reverseEasing, sanitiseAttributeValue, schemaKeys, scrollOffsetProgress, scrollPhaseInterval, scrollResolveAxis, scrollTotalDurationMs, scrollViewProgress, shiftAnimatable, splitEasing, subdivideCubicBezier, toRGBA, validateNodeEffects, visualModelAt };
|
package/dist/index.d.ts
CHANGED
|
@@ -237,15 +237,15 @@ declare const PxLoopExtend: {
|
|
|
237
237
|
readonly after: "after";
|
|
238
238
|
};
|
|
239
239
|
type PxLoopExtend = typeof PxLoopExtend[keyof typeof PxLoopExtend];
|
|
240
|
-
/** `
|
|
240
|
+
/** `strokeTrim.subPaths` — what the 0..1 `range`/`offset` window is measured over.
|
|
241
241
|
* `separate` (default): each sub-path against its OWN length, all trimmed alike.
|
|
242
242
|
* `combined`: every descendant sub-path chained end-to-end into one virtual path,
|
|
243
243
|
* so the window slides across siblings (AE "Trim All As One"). */
|
|
244
|
-
declare const
|
|
244
|
+
declare const PxStrokeTrimSubPaths: {
|
|
245
245
|
readonly separate: "separate";
|
|
246
246
|
readonly combined: "combined";
|
|
247
247
|
};
|
|
248
|
-
type
|
|
248
|
+
type PxStrokeTrimSubPaths = typeof PxStrokeTrimSubPaths[keyof typeof PxStrokeTrimSubPaths];
|
|
249
249
|
/** @deprecated Backwards-compatibility alias — use {@link PxAnimatorMode} for the type. */
|
|
250
250
|
type JsMode = PxAnimatorMode;
|
|
251
251
|
declare const TEXT_ATTR = "text";
|
|
@@ -1317,6 +1317,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1317
1317
|
subject?: string | undefined;
|
|
1318
1318
|
smoothing?: number | undefined;
|
|
1319
1319
|
pin?: boolean | undefined;
|
|
1320
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1320
1321
|
pinTop?: number | undefined;
|
|
1321
1322
|
pinDistance?: number | undefined;
|
|
1322
1323
|
range?: ({} & {
|
|
@@ -1338,6 +1339,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1338
1339
|
subject: PxSchema<string | undefined, true>;
|
|
1339
1340
|
smoothing: PxSchema<number | undefined, true>;
|
|
1340
1341
|
pin: PxSchema<boolean | undefined, true>;
|
|
1342
|
+
pinAlign: PxSchema<"top" | "center" | "bottom" | undefined, true>;
|
|
1341
1343
|
pinTop: PxSchema<number | undefined, true>;
|
|
1342
1344
|
pinDistance: PxSchema<number | undefined, true>;
|
|
1343
1345
|
range: PxSchema<({} & {
|
|
@@ -1644,6 +1646,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1644
1646
|
subject?: string | undefined;
|
|
1645
1647
|
smoothing?: number | undefined;
|
|
1646
1648
|
pin?: boolean | undefined;
|
|
1649
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1647
1650
|
pinTop?: number | undefined;
|
|
1648
1651
|
pinDistance?: number | undefined;
|
|
1649
1652
|
range?: ({} & {
|
|
@@ -1950,6 +1953,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1950
1953
|
subject?: string | undefined;
|
|
1951
1954
|
smoothing?: number | undefined;
|
|
1952
1955
|
pin?: boolean | undefined;
|
|
1956
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1953
1957
|
pinTop?: number | undefined;
|
|
1954
1958
|
pinDistance?: number | undefined;
|
|
1955
1959
|
range?: ({} & {
|
|
@@ -4162,7 +4166,7 @@ declare const PxMaskedByEffectSchema: PxSchema<{} & {
|
|
|
4162
4166
|
};
|
|
4163
4167
|
};
|
|
4164
4168
|
type PxMaskedByEffect = PxInfer<typeof PxMaskedByEffectSchema>;
|
|
4165
|
-
declare const
|
|
4169
|
+
declare const PxStrokeTrimEffectSchema: PxSchema<{} & {
|
|
4166
4170
|
offset?: number | ({} & {
|
|
4167
4171
|
value?: string | number | number[] | ({} & {
|
|
4168
4172
|
translate?: [number, number] | undefined;
|
|
@@ -4517,7 +4521,7 @@ declare const PxTrimPathEffectSchema: PxSchema<{} & {
|
|
|
4517
4521
|
subPaths: PxSchema<"separate" | "combined" | undefined, true>;
|
|
4518
4522
|
};
|
|
4519
4523
|
};
|
|
4520
|
-
type
|
|
4524
|
+
type PxStrokeTrimEffect = PxInfer<typeof PxStrokeTrimEffectSchema>;
|
|
4521
4525
|
declare const PxRetimeEffectSchema: PxSchema<{} & {
|
|
4522
4526
|
sourceId?: string | undefined;
|
|
4523
4527
|
start?: number | undefined;
|
|
@@ -8144,7 +8148,7 @@ declare const PxEffectsSchema: PxSchema<{} & {
|
|
|
8144
8148
|
autoOrient?: boolean | undefined;
|
|
8145
8149
|
}) | undefined;
|
|
8146
8150
|
}) | undefined;
|
|
8147
|
-
|
|
8151
|
+
strokeTrim?: ({} & {
|
|
8148
8152
|
offset?: number | ({} & {
|
|
8149
8153
|
value?: string | number | number[] | ({} & {
|
|
8150
8154
|
translate?: [number, number] | undefined;
|
|
@@ -10647,7 +10651,7 @@ declare const PxEffectsSchema: PxSchema<{} & {
|
|
|
10647
10651
|
autoOrient?: boolean | undefined;
|
|
10648
10652
|
}) | undefined;
|
|
10649
10653
|
}) | undefined, true>;
|
|
10650
|
-
|
|
10654
|
+
strokeTrim: PxSchema<({} & {
|
|
10651
10655
|
offset?: number | ({} & {
|
|
10652
10656
|
value?: string | number | number[] | ({} & {
|
|
10653
10657
|
translate?: [number, number] | undefined;
|
|
@@ -13175,7 +13179,7 @@ declare const PxNodeBase: PxSchema<{
|
|
|
13175
13179
|
autoOrient?: boolean | undefined;
|
|
13176
13180
|
}) | undefined;
|
|
13177
13181
|
}) | undefined;
|
|
13178
|
-
|
|
13182
|
+
strokeTrim?: ({} & {
|
|
13179
13183
|
offset?: number | ({} & {
|
|
13180
13184
|
value?: string | number | number[] | ({} & {
|
|
13181
13185
|
translate?: [number, number] | undefined;
|
|
@@ -15855,7 +15859,7 @@ declare const PxNodeBase: PxSchema<{
|
|
|
15855
15859
|
autoOrient?: boolean | undefined;
|
|
15856
15860
|
}) | undefined;
|
|
15857
15861
|
}) | undefined;
|
|
15858
|
-
|
|
15862
|
+
strokeTrim?: ({} & {
|
|
15859
15863
|
offset?: number | ({} & {
|
|
15860
15864
|
value?: string | number | number[] | ({} & {
|
|
15861
15865
|
translate?: [number, number] | undefined;
|
|
@@ -17783,6 +17787,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
17783
17787
|
subject?: string | undefined;
|
|
17784
17788
|
smoothing?: number | undefined;
|
|
17785
17789
|
pin?: boolean | undefined;
|
|
17790
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
17786
17791
|
pinTop?: number | undefined;
|
|
17787
17792
|
pinDistance?: number | undefined;
|
|
17788
17793
|
range?: ({} & {
|
|
@@ -18094,6 +18099,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
18094
18099
|
subject?: string | undefined;
|
|
18095
18100
|
smoothing?: number | undefined;
|
|
18096
18101
|
pin?: boolean | undefined;
|
|
18102
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18097
18103
|
pinTop?: number | undefined;
|
|
18098
18104
|
pinDistance?: number | undefined;
|
|
18099
18105
|
range?: ({} & {
|
|
@@ -18424,6 +18430,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
18424
18430
|
subject?: string | undefined;
|
|
18425
18431
|
smoothing?: number | undefined;
|
|
18426
18432
|
pin?: boolean | undefined;
|
|
18433
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18427
18434
|
pinTop?: number | undefined;
|
|
18428
18435
|
pinDistance?: number | undefined;
|
|
18429
18436
|
range?: ({} & {
|
|
@@ -19501,7 +19508,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
19501
19508
|
autoOrient?: boolean | undefined;
|
|
19502
19509
|
}) | undefined;
|
|
19503
19510
|
}) | undefined;
|
|
19504
|
-
|
|
19511
|
+
strokeTrim?: ({} & {
|
|
19505
19512
|
offset?: number | ({} & {
|
|
19506
19513
|
value?: string | number | number[] | ({} & {
|
|
19507
19514
|
translate?: [number, number] | undefined;
|
|
@@ -21414,6 +21421,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
21414
21421
|
subject?: string | undefined;
|
|
21415
21422
|
smoothing?: number | undefined;
|
|
21416
21423
|
pin?: boolean | undefined;
|
|
21424
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
21417
21425
|
pinTop?: number | undefined;
|
|
21418
21426
|
pinDistance?: number | undefined;
|
|
21419
21427
|
range?: ({} & {
|
|
@@ -22491,7 +22499,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
22491
22499
|
autoOrient?: boolean | undefined;
|
|
22492
22500
|
}) | undefined;
|
|
22493
22501
|
}) | undefined;
|
|
22494
|
-
|
|
22502
|
+
strokeTrim?: ({} & {
|
|
22495
22503
|
offset?: number | ({} & {
|
|
22496
22504
|
value?: string | number | number[] | ({} & {
|
|
22497
22505
|
translate?: [number, number] | undefined;
|
|
@@ -24608,6 +24616,14 @@ interface GlyphMaterialiseOpts<E = any> {
|
|
|
24608
24616
|
/** Optional diagnostics sink. */
|
|
24609
24617
|
warnings?: Array<string>;
|
|
24610
24618
|
}
|
|
24619
|
+
/**
|
|
24620
|
+
* Class stamped on the `<path>` holding the □ placeholders — and ONLY on it: the missing
|
|
24621
|
+
* boxes are emitted separately from the real glyphs so a consumer can style them on their
|
|
24622
|
+
* own. The editor uses it to fade them in with a delay: a freshly typed character is
|
|
24623
|
+
* missing for a few frames until its glyph is fetched asynchronously, and a □ that flashes
|
|
24624
|
+
* for that long reads as a rendering glitch.
|
|
24625
|
+
*/
|
|
24626
|
+
declare const MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
24611
24627
|
declare function materialiseGlyphTextHorizontal<E = any>(node: PxNode, opts: GlyphMaterialiseOpts<E>): E;
|
|
24612
24628
|
/** Per-CHARACTER advance box (local, pre-transform coords). `x,y` = the char's baseline start,
|
|
24613
24629
|
* `width` = its advance, `ascent`/`fontSize` size its bbox. */
|
|
@@ -24738,4 +24754,4 @@ interface EffectDiff {
|
|
|
24738
24754
|
*/
|
|
24739
24755
|
declare function diffInEffect(a: VmNode, b: VmNode): Array<EffectDiff>;
|
|
24740
24756
|
|
|
24741
|
-
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type
|
|
24757
|
+
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, MISSING_GLYPH_CLASS_NAME, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxStrokeTrimSubPaths, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type PxValidationContext, type PxValidationResult, type RemoveIndex, STYLE_ATTR_NAMES, type StartOn, TEXT_ATTR, TEXT_CONTENT_ATTR, TRANSFORM_FN_NAMES, type Vec2, applyPlayerEffects, bezierToSvgPath, calcAnimationValues, camelCaseToKebabWordIfNeeded, clamp, collectSampleTimes, composeTransformParts, createBasicFrameLoopAnimator, createPathSampler, cubicBezier, deepClone, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, generateUniqueId, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalisedBindings, getNormalizedProps, interpolateBeziers, interpolateValue, isPxElementFileFormat, isPxElementFileFormatDeep, isScrollTimeline, jsonElementFactory, kebabToCamelCaseWord, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, propAnimIsMotionPath, px, resolveStyle, reverseEasing, sanitiseAttributeValue, schemaKeys, scrollOffsetProgress, scrollPhaseInterval, scrollResolveAxis, scrollTotalDurationMs, scrollViewProgress, shiftAnimatable, splitEasing, subdivideCubicBezier, toRGBA, validateNodeEffects, visualModelAt };
|
package/dist/index.js
CHANGED
|
@@ -1027,7 +1027,7 @@ var PxTextPathSpacing = {
|
|
|
1027
1027
|
auto: "auto",
|
|
1028
1028
|
exact: "exact"
|
|
1029
1029
|
};
|
|
1030
|
-
var
|
|
1030
|
+
var PxStrokeTrimSubPaths = {
|
|
1031
1031
|
separate: "separate",
|
|
1032
1032
|
combined: "combined"
|
|
1033
1033
|
};
|
|
@@ -1188,6 +1188,7 @@ var PxScrollSchema = implementsInterface()(px.object({
|
|
|
1188
1188
|
subject: px.string().optional(),
|
|
1189
1189
|
smoothing: px.number().optional(),
|
|
1190
1190
|
pin: px.boolean().optional(),
|
|
1191
|
+
pinAlign: px.enum(["top", "center", "bottom"]).optional(),
|
|
1191
1192
|
pinTop: px.number().optional(),
|
|
1192
1193
|
pinDistance: px.number().optional(),
|
|
1193
1194
|
range: PxScrollRangeSchema.optional()
|
|
@@ -1270,10 +1271,10 @@ var PxClipPathEffectSchema = implementsInterface()(px.object({
|
|
|
1270
1271
|
d: PxAnimatableStringSchema.optional(),
|
|
1271
1272
|
animate: PxPropertyAnimationSchema.optional()
|
|
1272
1273
|
}));
|
|
1273
|
-
var
|
|
1274
|
+
var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
|
|
1274
1275
|
offset: PxAnimatableNumberSchema.optional(),
|
|
1275
1276
|
range: PxAnimatableVec2Schema.optional(),
|
|
1276
|
-
subPaths: px.enum([
|
|
1277
|
+
subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined]).optional()
|
|
1277
1278
|
}));
|
|
1278
1279
|
var PxRetimeEffectSchema = implementsInterface()(px.object({
|
|
1279
1280
|
sourceId: px.string().optional(),
|
|
@@ -1327,7 +1328,7 @@ var PxEffectsSchema = implementsInterface()(px.object({
|
|
|
1327
1328
|
repeater: PxRepeaterEffectSchema.optional(),
|
|
1328
1329
|
maskedBy: PxMaskedByEffectSchema.optional(),
|
|
1329
1330
|
clipPath: PxClipPathEffectSchema.optional(),
|
|
1330
|
-
|
|
1331
|
+
strokeTrim: PxStrokeTrimEffectSchema.optional(),
|
|
1331
1332
|
clone: PxCloneEffectSchema.optional(),
|
|
1332
1333
|
fillGradient: PxFillGradientEffectSchema.optional(),
|
|
1333
1334
|
strokeGradient: PxStrokeGradientEffectSchema.optional(),
|
|
@@ -4461,6 +4462,19 @@ var TEXT_ATTR_KEYS = [
|
|
|
4461
4462
|
TEXT_CONTENT_ATTR,
|
|
4462
4463
|
"xml:space"
|
|
4463
4464
|
];
|
|
4465
|
+
var PAINT_STATIC_KEYS = [
|
|
4466
|
+
"fillOpacity",
|
|
4467
|
+
"fillRule",
|
|
4468
|
+
"strokeOpacity",
|
|
4469
|
+
"strokeDasharray",
|
|
4470
|
+
"strokeDashoffset",
|
|
4471
|
+
"strokeLinecap",
|
|
4472
|
+
"strokeLinejoin",
|
|
4473
|
+
"strokeMiterlimit",
|
|
4474
|
+
"mixBlendMode",
|
|
4475
|
+
"filter"
|
|
4476
|
+
];
|
|
4477
|
+
var PAINT_ANIMATE_KEYS = ["fill", "stroke", "strokeWidth", "opacity", "fillOpacity", "strokeOpacity", "strokeDasharray", "strokeDashoffset"];
|
|
4464
4478
|
function parseLen(v) {
|
|
4465
4479
|
if (typeof v === "number") return v;
|
|
4466
4480
|
if (typeof v === "string") {
|
|
@@ -4472,17 +4486,39 @@ function parseLen(v) {
|
|
|
4472
4486
|
function str(v) {
|
|
4473
4487
|
return typeof v === "string" ? v : void 0;
|
|
4474
4488
|
}
|
|
4489
|
+
function paintAnimateOf(node) {
|
|
4490
|
+
const bag = node.animate;
|
|
4491
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
4492
|
+
let out;
|
|
4493
|
+
for (const k of PAINT_ANIMATE_KEYS) {
|
|
4494
|
+
if (bag[k] !== void 0) (out != null ? out : out = {})[k] = bag[k];
|
|
4495
|
+
}
|
|
4496
|
+
return out;
|
|
4497
|
+
}
|
|
4475
4498
|
function resolveStyle2(node, parent) {
|
|
4476
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4477
|
-
|
|
4499
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4500
|
+
const isTextRoot = node.type === "text";
|
|
4501
|
+
const nodeStyle = node.style;
|
|
4502
|
+
const own = (key) => {
|
|
4503
|
+
var _a2;
|
|
4504
|
+
return isTextRoot ? void 0 : (_a2 = node[key]) != null ? _a2 : nodeStyle == null ? void 0 : nodeStyle[key];
|
|
4505
|
+
};
|
|
4506
|
+
const res = {
|
|
4478
4507
|
fontFamily: (_a = str(node.fontFamily)) != null ? _a : parent.fontFamily,
|
|
4479
4508
|
fontSize: (_b = parseLen(node.fontSize)) != null ? _b : parent.fontSize,
|
|
4480
4509
|
fill: (_c = node.fill) != null ? _c : parent.fill,
|
|
4481
4510
|
stroke: (_d = node.stroke) != null ? _d : parent.stroke,
|
|
4482
4511
|
strokeWidth: (_e = node.strokeWidth) != null ? _e : parent.strokeWidth,
|
|
4483
4512
|
letterSpacing: (_f = parseLen(node.letterSpacing)) != null ? _f : parent.letterSpacing,
|
|
4484
|
-
wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing
|
|
4513
|
+
wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing,
|
|
4514
|
+
opacity: (_h = parseLen(own("opacity"))) != null ? _h : parent.opacity,
|
|
4515
|
+
animate: (_i = isTextRoot ? void 0 : paintAnimateOf(node)) != null ? _i : parent.animate
|
|
4485
4516
|
};
|
|
4517
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4518
|
+
const v = (_j = own(key)) != null ? _j : parent[key];
|
|
4519
|
+
if (v !== void 0) res[key] = v;
|
|
4520
|
+
}
|
|
4521
|
+
return res;
|
|
4486
4522
|
}
|
|
4487
4523
|
function rootStyleOf(node) {
|
|
4488
4524
|
var _a, _b, _c;
|
|
@@ -4501,6 +4537,11 @@ function paintOf(s) {
|
|
|
4501
4537
|
if (s.fill !== void 0) p.fill = s.fill;
|
|
4502
4538
|
if (s.stroke !== void 0) p.stroke = s.stroke;
|
|
4503
4539
|
if (s.strokeWidth !== void 0) p.strokeWidth = s.strokeWidth;
|
|
4540
|
+
if (s.opacity !== void 0 && s.opacity !== 1) p.opacity = s.opacity;
|
|
4541
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4542
|
+
if (s[key] !== void 0) p[key] = s[key];
|
|
4543
|
+
}
|
|
4544
|
+
if (s.animate !== void 0) p.animate = s.animate;
|
|
4504
4545
|
return p;
|
|
4505
4546
|
}
|
|
4506
4547
|
function glyphFontFor(s, glyphs, soleFont, warnings) {
|
|
@@ -4514,6 +4555,7 @@ function soleFontOf(glyphs) {
|
|
|
4514
4555
|
return names.length === 1 ? glyphs[names[0]] : void 0;
|
|
4515
4556
|
}
|
|
4516
4557
|
var MISSING_GLYPH_ADVANCE_EM = 0.6;
|
|
4558
|
+
var MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
4517
4559
|
function missingGlyphBoxEm(advanceEm, ascentEm) {
|
|
4518
4560
|
if (advanceEm <= 0 || ascentEm <= 0) return "";
|
|
4519
4561
|
const inset = 0.08;
|
|
@@ -4549,7 +4591,7 @@ function materialiseGlyphTextHorizontal(node, opts) {
|
|
|
4549
4591
|
pen.x += g.width * scale;
|
|
4550
4592
|
} else if (/\S/.test(ch)) {
|
|
4551
4593
|
const advEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * upm;
|
|
4552
|
-
placements.push({ glyphD: missingGlyphBoxEm(advEm, ascentEm), m: [scale, 0, 0, scale, pen.x, pen.y], paint, line, x: pen.x, y: pen.y, scale });
|
|
4594
|
+
placements.push({ glyphD: missingGlyphBoxEm(advEm, ascentEm), m: [scale, 0, 0, scale, pen.x, pen.y], paint, isMissing: true, line, x: pen.x, y: pen.y, scale });
|
|
4553
4595
|
pen.x += advEm * scale;
|
|
4554
4596
|
} else {
|
|
4555
4597
|
pen.x += (g ? g.width : 0) * scale;
|
|
@@ -4740,7 +4782,7 @@ function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
|
4740
4782
|
} else if (/\S/.test(ch)) {
|
|
4741
4783
|
const wEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * gf.unitsPerEm;
|
|
4742
4784
|
const boxAdv = wEm * scale;
|
|
4743
|
-
cells.push({ glyphD: missingGlyphBoxEm(wEm, ascentEm), widthEm: wEm, scale, paint, midBase: adv + boxAdv / 2 });
|
|
4785
|
+
cells.push({ glyphD: missingGlyphBoxEm(wEm, ascentEm), widthEm: wEm, scale, paint, isMissing: true, midBase: adv + boxAdv / 2 });
|
|
4744
4786
|
adv += boxAdv;
|
|
4745
4787
|
} else {
|
|
4746
4788
|
adv += (g ? g.width : 0) * scale;
|
|
@@ -4796,6 +4838,7 @@ function materialiseGlyphTextAlongPath(node, pathD, startOffset, opts, textLengt
|
|
|
4796
4838
|
const placements = placeCells.map((c) => ({
|
|
4797
4839
|
glyphD: c.glyphD,
|
|
4798
4840
|
paint: c.paint,
|
|
4841
|
+
isMissing: c.isMissing,
|
|
4799
4842
|
m: alongAffine(sampler, base + c.midBase * k, c.scale, c.widthEm, perp)
|
|
4800
4843
|
}));
|
|
4801
4844
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
@@ -4878,12 +4921,13 @@ function buildAnimatedAlongPath(cells, sampler, distOf, times, loop, create, isC
|
|
|
4878
4921
|
const transform = { keyframes: kfs };
|
|
4879
4922
|
if (loop !== void 0) transform.loop = loop;
|
|
4880
4923
|
const animate = { transform };
|
|
4924
|
+
if (c.paint.animate) Object.assign(animate, c.paint.animate);
|
|
4881
4925
|
if (isClip && opKfs.some((k) => k.value === 0)) {
|
|
4882
4926
|
const op = { keyframes: opKfs };
|
|
4883
4927
|
if (loop !== void 0) op.loop = loop;
|
|
4884
4928
|
animate.opacity = op;
|
|
4885
4929
|
}
|
|
4886
|
-
out.push(create("path", __spreadProps(__spreadValues({ d }, paintProps(c.paint)), { animate }), []));
|
|
4930
|
+
out.push(create("path", __spreadProps(__spreadValues(__spreadValues({ d }, paintProps(c.paint)), missingGlyphProps(c.isMissing)), { animate }), []));
|
|
4887
4931
|
}
|
|
4888
4932
|
return out;
|
|
4889
4933
|
}
|
|
@@ -4892,24 +4936,34 @@ function paintProps(paint) {
|
|
|
4892
4936
|
if (paint.fill !== void 0) p.fill = paint.fill;
|
|
4893
4937
|
if (paint.stroke !== void 0) p.stroke = paint.stroke;
|
|
4894
4938
|
if (paint.strokeWidth !== void 0) p.strokeWidth = paint.strokeWidth;
|
|
4939
|
+
if (paint.opacity !== void 0) p.opacity = paint.opacity;
|
|
4940
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4941
|
+
if (paint[key] !== void 0) p[key] = paint[key];
|
|
4942
|
+
}
|
|
4895
4943
|
return p;
|
|
4896
4944
|
}
|
|
4945
|
+
function missingGlyphProps(isMissing) {
|
|
4946
|
+
return isMissing ? { class: MISSING_GLYPH_CLASS_NAME } : {};
|
|
4947
|
+
}
|
|
4897
4948
|
function buildPaths(placements, create, warnings) {
|
|
4898
|
-
var _a, _b, _c;
|
|
4899
4949
|
if (!placements.length) {
|
|
4900
4950
|
warnings == null ? void 0 : warnings.push("textGlyphs: nothing to render");
|
|
4901
4951
|
return [];
|
|
4902
4952
|
}
|
|
4903
4953
|
const byPaint = /* @__PURE__ */ new Map();
|
|
4904
4954
|
for (const p of placements) {
|
|
4905
|
-
const key = JSON.stringify([
|
|
4955
|
+
const key = JSON.stringify([p.paint, !!p.isMissing]);
|
|
4906
4956
|
const baked = transformPathData(p.glyphD, p.m);
|
|
4907
4957
|
const entry = byPaint.get(key);
|
|
4908
4958
|
if (entry) entry.d += baked;
|
|
4909
|
-
else byPaint.set(key, { paint: p.paint, d: baked });
|
|
4959
|
+
else byPaint.set(key, { paint: p.paint, d: baked, isMissing: p.isMissing });
|
|
4910
4960
|
}
|
|
4911
4961
|
const out = [];
|
|
4912
|
-
for (const { paint, d } of byPaint.values())
|
|
4962
|
+
for (const { paint, d, isMissing } of byPaint.values()) {
|
|
4963
|
+
out.push(create("path", __spreadValues(__spreadValues(__spreadValues({
|
|
4964
|
+
d
|
|
4965
|
+
}, paintProps(paint)), missingGlyphProps(isMissing)), paint.animate !== void 0 ? { animate: __spreadValues({}, paint.animate) } : {}), []));
|
|
4966
|
+
}
|
|
4913
4967
|
return out;
|
|
4914
4968
|
}
|
|
4915
4969
|
function toGroup(node, children, create) {
|
|
@@ -4946,10 +5000,10 @@ function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pat
|
|
|
4946
5000
|
return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
|
|
4947
5001
|
}
|
|
4948
5002
|
|
|
4949
|
-
// src/effects/
|
|
4950
|
-
function
|
|
4951
|
-
if (!
|
|
4952
|
-
const combined =
|
|
5003
|
+
// src/effects/strokeTrimEffect.ts
|
|
5004
|
+
function applyStrokeTrimEffect(node, strokeTrim, ctx) {
|
|
5005
|
+
if (!strokeTrim) return node;
|
|
5006
|
+
const combined = strokeTrim.subPaths === PxStrokeTrimSubPaths.combined;
|
|
4953
5007
|
const leafEntries = [];
|
|
4954
5008
|
const measure = (n) => {
|
|
4955
5009
|
if (Array.isArray(n.children) && n.children.length > 0) {
|
|
@@ -4980,9 +5034,9 @@ function applyTrimPathEffect(node, trimPath, ctx) {
|
|
|
4980
5034
|
}
|
|
4981
5035
|
const chainLengthPx = acc;
|
|
4982
5036
|
if (combined && chainLengthPx < 1e-3) return node;
|
|
4983
|
-
const offsetReadRaw = readAnimatable(
|
|
5037
|
+
const offsetReadRaw = readAnimatable(strokeTrim.offset);
|
|
4984
5038
|
const offsetRead = offsetReadRaw.kind === "absent" /* Absent */ ? { kind: "static" /* Static */, value: 0 } : offsetReadRaw;
|
|
4985
|
-
const rangeReadRaw = readRangeWithCrossings(
|
|
5039
|
+
const rangeReadRaw = readRangeWithCrossings(strokeTrim.range);
|
|
4986
5040
|
const rangeRead = rangeReadRaw.kind === "absent" /* Absent */ ? { kind: "static" /* Static */, value: [0, 1] } : rangeReadRaw;
|
|
4987
5041
|
const offsetValues = readScalarValues(offsetRead);
|
|
4988
5042
|
const minOffset = offsetValues.length ? Math.min(...offsetValues) : 0;
|
|
@@ -5314,7 +5368,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
|
|
|
5314
5368
|
const originalId = typeof node.id === "string" ? node.id : void 0;
|
|
5315
5369
|
const innerIdForContentRef = originalId ? ctx.contentRefInnerIds.get(originalId) : void 0;
|
|
5316
5370
|
if (!fx && !innerIdForContentRef) return node;
|
|
5317
|
-
const { transformBy, repeater, maskedBy, clipPath,
|
|
5371
|
+
const { transformBy, repeater, maskedBy, clipPath, strokeTrim, clone: cloneFx, fillGradient, strokeGradient, textPath, text } = fx != null ? fx : {};
|
|
5318
5372
|
if (fx) delete node.effects;
|
|
5319
5373
|
let n = node;
|
|
5320
5374
|
let consumedByGlyphs = false;
|
|
@@ -5334,7 +5388,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
|
|
|
5334
5388
|
if (!consumedByGlyphs) n = applyTextPathEffect(n, textPath, ctx);
|
|
5335
5389
|
n = applyFillGradientEffect(n, fillGradient, ctx);
|
|
5336
5390
|
n = applyStrokeGradientEffect(n, strokeGradient, ctx);
|
|
5337
|
-
n =
|
|
5391
|
+
n = applyStrokeTrimEffect(n, strokeTrim, ctx);
|
|
5338
5392
|
n = applyRepeaterEffect(n, repeater, ctx);
|
|
5339
5393
|
n = applyMaskedByEffect(n, maskedBy, transformBy, ctx);
|
|
5340
5394
|
n = applyClipPathEffect(n, clipPath, ctx);
|
|
@@ -6020,6 +6074,7 @@ export {
|
|
|
6020
6074
|
DISALLOWED_SVG_TAGS_LOWER,
|
|
6021
6075
|
INTERNAL_ATTRS,
|
|
6022
6076
|
LOOP_JUMP_SHIFT_MS,
|
|
6077
|
+
MISSING_GLYPH_CLASS_NAME,
|
|
6023
6078
|
PCT_BASED_ATTR_NAMES,
|
|
6024
6079
|
PX_ANIM_ATTR_NAME,
|
|
6025
6080
|
PX_ANIM_SRC_ATTR_NAME,
|
|
@@ -6056,6 +6111,8 @@ export {
|
|
|
6056
6111
|
PxScrollRangeSchema,
|
|
6057
6112
|
PxScrollSchema,
|
|
6058
6113
|
PxStrokeGradientEffectSchema,
|
|
6114
|
+
PxStrokeTrimEffectSchema,
|
|
6115
|
+
PxStrokeTrimSubPaths,
|
|
6059
6116
|
PxSvgNodeExtra,
|
|
6060
6117
|
PxTextEffectSchema,
|
|
6061
6118
|
PxTextPathEffectSchema,
|
|
@@ -6063,8 +6120,6 @@ export {
|
|
|
6063
6120
|
PxTransformPartsSchema,
|
|
6064
6121
|
PxTransformValueSchema,
|
|
6065
6122
|
PxTriggerSchema,
|
|
6066
|
-
PxTrimPathEffectSchema,
|
|
6067
|
-
PxTrimSubPaths,
|
|
6068
6123
|
STYLE_ATTR_NAMES,
|
|
6069
6124
|
TEXT_ATTR,
|
|
6070
6125
|
TEXT_CONTENT_ATTR,
|