@pixodesk/svg-animator-web 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 +1 -1
- package/dist/index.cjs +107 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +105 -24
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.prerendered-waapi.umd.js.map +1 -1
- package/dist/index.prerendered.umd.js +28 -2
- package/dist/index.prerendered.umd.js.map +1 -1
- package/dist/index.prerendered.umd.min.js +1 -1
- package/dist/index.umd.js +104 -24
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxAnimatedSvgDocument, PxPlatformAdapter, PxAnimatorCallbacksConfig, PxTrigger, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
|
|
2
|
-
export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, JsMode, KeysMatch, MaterialiseAllOptions, MotionPathMaterialisationOptions, MotionPathSample, OutAction, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, PathPoint, PathSampler, PlaybackDirection, PxAnimatable, PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, PxAnimationDefinition, PxAnimationDefinitionSchema, PxAnimatorCallbacksConfig, PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema,
|
|
2
|
+
export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, JsMode, KeysMatch, MISSING_GLYPH_CLASS_NAME, MaterialiseAllOptions, MotionPathMaterialisationOptions, MotionPathSample, OutAction, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, PathPoint, PathSampler, PlaybackDirection, PxAnimatable, PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, PxAnimationDefinition, PxAnimationDefinitionSchema, PxAnimatorCallbacksConfig, PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema, PxValidationContext, PxValidationResult, RemoveIndex, STYLE_ATTR_NAMES, StartOn, TRANSFORM_FN_NAMES, Vec2, applyPlayerEffects, calcAnimationValues, camelCaseToKebabWordIfNeeded, collectSampleTimes, createBasicFrameLoopAnimator, createPathSampler, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalizedProps, isPxElementFileFormat, isPxElementFileFormatDeep, jsonElementFactory, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, getNormalisedBindings as normalizeDocument, propAnimIsMotionPath, px, schemaKeys, shiftAnimatable, toRGBA, validateNodeEffects, visualModelAt } from '@pixodesk/svg-animator-core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DOM specialisations of the platform-neutral animator API types.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxAnimatedSvgDocument, PxPlatformAdapter, PxAnimatorCallbacksConfig, PxTrigger, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
|
|
2
|
-
export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, JsMode, KeysMatch, MaterialiseAllOptions, MotionPathMaterialisationOptions, MotionPathSample, OutAction, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, PathPoint, PathSampler, PlaybackDirection, PxAnimatable, PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, PxAnimationDefinition, PxAnimationDefinitionSchema, PxAnimatorCallbacksConfig, PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema,
|
|
2
|
+
export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, JsMode, KeysMatch, MISSING_GLYPH_CLASS_NAME, MaterialiseAllOptions, MotionPathMaterialisationOptions, MotionPathSample, OutAction, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, PathPoint, PathSampler, PlaybackDirection, PxAnimatable, PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, PxAnimationDefinition, PxAnimationDefinitionSchema, PxAnimatorCallbacksConfig, PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema, PxValidationContext, PxValidationResult, RemoveIndex, STYLE_ATTR_NAMES, StartOn, TRANSFORM_FN_NAMES, Vec2, applyPlayerEffects, calcAnimationValues, camelCaseToKebabWordIfNeeded, collectSampleTimes, createBasicFrameLoopAnimator, createPathSampler, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalizedProps, isPxElementFileFormat, isPxElementFileFormatDeep, jsonElementFactory, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, getNormalisedBindings as normalizeDocument, propAnimIsMotionPath, px, schemaKeys, shiftAnimatable, toRGBA, validateNodeEffects, visualModelAt } from '@pixodesk/svg-animator-core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DOM specialisations of the platform-neutral animator API types.
|
package/dist/index.js
CHANGED
|
@@ -1052,7 +1052,7 @@ var PxTextPathSpacing = {
|
|
|
1052
1052
|
auto: "auto",
|
|
1053
1053
|
exact: "exact"
|
|
1054
1054
|
};
|
|
1055
|
-
var
|
|
1055
|
+
var PxStrokeTrimSubPaths = {
|
|
1056
1056
|
separate: "separate",
|
|
1057
1057
|
combined: "combined"
|
|
1058
1058
|
};
|
|
@@ -1211,6 +1211,7 @@ var PxScrollSchema = implementsInterface()(px.object({
|
|
|
1211
1211
|
subject: px.string().optional(),
|
|
1212
1212
|
smoothing: px.number().optional(),
|
|
1213
1213
|
pin: px.boolean().optional(),
|
|
1214
|
+
pinAlign: px.enum(["top", "center", "bottom"]).optional(),
|
|
1214
1215
|
pinTop: px.number().optional(),
|
|
1215
1216
|
pinDistance: px.number().optional(),
|
|
1216
1217
|
range: PxScrollRangeSchema.optional()
|
|
@@ -1293,10 +1294,10 @@ var PxClipPathEffectSchema = implementsInterface()(px.object({
|
|
|
1293
1294
|
d: PxAnimatableStringSchema.optional(),
|
|
1294
1295
|
animate: PxPropertyAnimationSchema.optional()
|
|
1295
1296
|
}));
|
|
1296
|
-
var
|
|
1297
|
+
var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
|
|
1297
1298
|
offset: PxAnimatableNumberSchema.optional(),
|
|
1298
1299
|
range: PxAnimatableVec2Schema.optional(),
|
|
1299
|
-
subPaths: px.enum([
|
|
1300
|
+
subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined]).optional()
|
|
1300
1301
|
}));
|
|
1301
1302
|
var PxRetimeEffectSchema = implementsInterface()(px.object({
|
|
1302
1303
|
sourceId: px.string().optional(),
|
|
@@ -1350,7 +1351,7 @@ var PxEffectsSchema = implementsInterface()(px.object({
|
|
|
1350
1351
|
repeater: PxRepeaterEffectSchema.optional(),
|
|
1351
1352
|
maskedBy: PxMaskedByEffectSchema.optional(),
|
|
1352
1353
|
clipPath: PxClipPathEffectSchema.optional(),
|
|
1353
|
-
|
|
1354
|
+
strokeTrim: PxStrokeTrimEffectSchema.optional(),
|
|
1354
1355
|
clone: PxCloneEffectSchema.optional(),
|
|
1355
1356
|
fillGradient: PxFillGradientEffectSchema.optional(),
|
|
1356
1357
|
strokeGradient: PxStrokeGradientEffectSchema.optional(),
|
|
@@ -4445,6 +4446,19 @@ var TEXT_ATTR_KEYS = [
|
|
|
4445
4446
|
TEXT_CONTENT_ATTR,
|
|
4446
4447
|
"xml:space"
|
|
4447
4448
|
];
|
|
4449
|
+
var PAINT_STATIC_KEYS = [
|
|
4450
|
+
"fillOpacity",
|
|
4451
|
+
"fillRule",
|
|
4452
|
+
"strokeOpacity",
|
|
4453
|
+
"strokeDasharray",
|
|
4454
|
+
"strokeDashoffset",
|
|
4455
|
+
"strokeLinecap",
|
|
4456
|
+
"strokeLinejoin",
|
|
4457
|
+
"strokeMiterlimit",
|
|
4458
|
+
"mixBlendMode",
|
|
4459
|
+
"filter"
|
|
4460
|
+
];
|
|
4461
|
+
var PAINT_ANIMATE_KEYS = ["fill", "stroke", "strokeWidth", "opacity", "fillOpacity", "strokeOpacity", "strokeDasharray", "strokeDashoffset"];
|
|
4448
4462
|
function parseLen(v) {
|
|
4449
4463
|
if (typeof v === "number") return v;
|
|
4450
4464
|
if (typeof v === "string") {
|
|
@@ -4456,17 +4470,39 @@ function parseLen(v) {
|
|
|
4456
4470
|
function str(v) {
|
|
4457
4471
|
return typeof v === "string" ? v : void 0;
|
|
4458
4472
|
}
|
|
4473
|
+
function paintAnimateOf(node) {
|
|
4474
|
+
const bag = node.animate;
|
|
4475
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
4476
|
+
let out;
|
|
4477
|
+
for (const k of PAINT_ANIMATE_KEYS) {
|
|
4478
|
+
if (bag[k] !== void 0) (out != null ? out : out = {})[k] = bag[k];
|
|
4479
|
+
}
|
|
4480
|
+
return out;
|
|
4481
|
+
}
|
|
4459
4482
|
function resolveStyle2(node, parent) {
|
|
4460
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4461
|
-
|
|
4483
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4484
|
+
const isTextRoot = node.type === "text";
|
|
4485
|
+
const nodeStyle = node.style;
|
|
4486
|
+
const own = (key) => {
|
|
4487
|
+
var _a2;
|
|
4488
|
+
return isTextRoot ? void 0 : (_a2 = node[key]) != null ? _a2 : nodeStyle == null ? void 0 : nodeStyle[key];
|
|
4489
|
+
};
|
|
4490
|
+
const res = {
|
|
4462
4491
|
fontFamily: (_a = str(node.fontFamily)) != null ? _a : parent.fontFamily,
|
|
4463
4492
|
fontSize: (_b = parseLen(node.fontSize)) != null ? _b : parent.fontSize,
|
|
4464
4493
|
fill: (_c = node.fill) != null ? _c : parent.fill,
|
|
4465
4494
|
stroke: (_d = node.stroke) != null ? _d : parent.stroke,
|
|
4466
4495
|
strokeWidth: (_e = node.strokeWidth) != null ? _e : parent.strokeWidth,
|
|
4467
4496
|
letterSpacing: (_f = parseLen(node.letterSpacing)) != null ? _f : parent.letterSpacing,
|
|
4468
|
-
wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing
|
|
4497
|
+
wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing,
|
|
4498
|
+
opacity: (_h = parseLen(own("opacity"))) != null ? _h : parent.opacity,
|
|
4499
|
+
animate: (_i = isTextRoot ? void 0 : paintAnimateOf(node)) != null ? _i : parent.animate
|
|
4469
4500
|
};
|
|
4501
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4502
|
+
const v = (_j = own(key)) != null ? _j : parent[key];
|
|
4503
|
+
if (v !== void 0) res[key] = v;
|
|
4504
|
+
}
|
|
4505
|
+
return res;
|
|
4470
4506
|
}
|
|
4471
4507
|
function rootStyleOf(node) {
|
|
4472
4508
|
var _a, _b, _c;
|
|
@@ -4485,6 +4521,11 @@ function paintOf(s) {
|
|
|
4485
4521
|
if (s.fill !== void 0) p.fill = s.fill;
|
|
4486
4522
|
if (s.stroke !== void 0) p.stroke = s.stroke;
|
|
4487
4523
|
if (s.strokeWidth !== void 0) p.strokeWidth = s.strokeWidth;
|
|
4524
|
+
if (s.opacity !== void 0 && s.opacity !== 1) p.opacity = s.opacity;
|
|
4525
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4526
|
+
if (s[key] !== void 0) p[key] = s[key];
|
|
4527
|
+
}
|
|
4528
|
+
if (s.animate !== void 0) p.animate = s.animate;
|
|
4488
4529
|
return p;
|
|
4489
4530
|
}
|
|
4490
4531
|
function glyphFontFor(s, glyphs, soleFont, warnings) {
|
|
@@ -4498,6 +4539,7 @@ function soleFontOf(glyphs) {
|
|
|
4498
4539
|
return names.length === 1 ? glyphs[names[0]] : void 0;
|
|
4499
4540
|
}
|
|
4500
4541
|
var MISSING_GLYPH_ADVANCE_EM = 0.6;
|
|
4542
|
+
var MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
4501
4543
|
function missingGlyphBoxEm(advanceEm, ascentEm) {
|
|
4502
4544
|
if (advanceEm <= 0 || ascentEm <= 0) return "";
|
|
4503
4545
|
const inset = 0.08;
|
|
@@ -4533,7 +4575,7 @@ function materialiseGlyphTextHorizontal(node, opts) {
|
|
|
4533
4575
|
pen.x += g.width * scale;
|
|
4534
4576
|
} else if (/\S/.test(ch)) {
|
|
4535
4577
|
const advEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * upm;
|
|
4536
|
-
placements.push({ glyphD: missingGlyphBoxEm(advEm, ascentEm), m: [scale, 0, 0, scale, pen.x, pen.y], paint, line, x: pen.x, y: pen.y, scale });
|
|
4578
|
+
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 });
|
|
4537
4579
|
pen.x += advEm * scale;
|
|
4538
4580
|
} else {
|
|
4539
4581
|
pen.x += (g ? g.width : 0) * scale;
|
|
@@ -4724,7 +4766,7 @@ function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
|
4724
4766
|
} else if (/\S/.test(ch)) {
|
|
4725
4767
|
const wEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * gf.unitsPerEm;
|
|
4726
4768
|
const boxAdv = wEm * scale;
|
|
4727
|
-
cells.push({ glyphD: missingGlyphBoxEm(wEm, ascentEm), widthEm: wEm, scale, paint, midBase: adv + boxAdv / 2 });
|
|
4769
|
+
cells.push({ glyphD: missingGlyphBoxEm(wEm, ascentEm), widthEm: wEm, scale, paint, isMissing: true, midBase: adv + boxAdv / 2 });
|
|
4728
4770
|
adv += boxAdv;
|
|
4729
4771
|
} else {
|
|
4730
4772
|
adv += (g ? g.width : 0) * scale;
|
|
@@ -4780,6 +4822,7 @@ function materialiseGlyphTextAlongPath(node, pathD, startOffset, opts, textLengt
|
|
|
4780
4822
|
const placements = placeCells.map((c) => ({
|
|
4781
4823
|
glyphD: c.glyphD,
|
|
4782
4824
|
paint: c.paint,
|
|
4825
|
+
isMissing: c.isMissing,
|
|
4783
4826
|
m: alongAffine(sampler, base + c.midBase * k, c.scale, c.widthEm, perp)
|
|
4784
4827
|
}));
|
|
4785
4828
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
@@ -4868,12 +4911,13 @@ function buildAnimatedAlongPath(cells, sampler, distOf, times, loop, create, isC
|
|
|
4868
4911
|
const transform = { keyframes: kfs };
|
|
4869
4912
|
if (loop !== void 0) transform.loop = loop;
|
|
4870
4913
|
const animate = { transform };
|
|
4914
|
+
if (c.paint.animate) Object.assign(animate, c.paint.animate);
|
|
4871
4915
|
if (isClip && opKfs.some((k) => k.value === 0)) {
|
|
4872
4916
|
const op = { keyframes: opKfs };
|
|
4873
4917
|
if (loop !== void 0) op.loop = loop;
|
|
4874
4918
|
animate.opacity = op;
|
|
4875
4919
|
}
|
|
4876
|
-
out.push(create("path", __spreadProps2(__spreadValues2({ d }, paintProps(c.paint)), { animate }), []));
|
|
4920
|
+
out.push(create("path", __spreadProps2(__spreadValues2(__spreadValues2({ d }, paintProps(c.paint)), missingGlyphProps(c.isMissing)), { animate }), []));
|
|
4877
4921
|
}
|
|
4878
4922
|
return out;
|
|
4879
4923
|
}
|
|
@@ -4882,24 +4926,34 @@ function paintProps(paint) {
|
|
|
4882
4926
|
if (paint.fill !== void 0) p.fill = paint.fill;
|
|
4883
4927
|
if (paint.stroke !== void 0) p.stroke = paint.stroke;
|
|
4884
4928
|
if (paint.strokeWidth !== void 0) p.strokeWidth = paint.strokeWidth;
|
|
4929
|
+
if (paint.opacity !== void 0) p.opacity = paint.opacity;
|
|
4930
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4931
|
+
if (paint[key] !== void 0) p[key] = paint[key];
|
|
4932
|
+
}
|
|
4885
4933
|
return p;
|
|
4886
4934
|
}
|
|
4935
|
+
function missingGlyphProps(isMissing) {
|
|
4936
|
+
return isMissing ? { class: MISSING_GLYPH_CLASS_NAME } : {};
|
|
4937
|
+
}
|
|
4887
4938
|
function buildPaths(placements, create, warnings) {
|
|
4888
|
-
var _a, _b, _c;
|
|
4889
4939
|
if (!placements.length) {
|
|
4890
4940
|
warnings == null ? void 0 : warnings.push("textGlyphs: nothing to render");
|
|
4891
4941
|
return [];
|
|
4892
4942
|
}
|
|
4893
4943
|
const byPaint = /* @__PURE__ */ new Map();
|
|
4894
4944
|
for (const p of placements) {
|
|
4895
|
-
const key = JSON.stringify([
|
|
4945
|
+
const key = JSON.stringify([p.paint, !!p.isMissing]);
|
|
4896
4946
|
const baked = transformPathData(p.glyphD, p.m);
|
|
4897
4947
|
const entry = byPaint.get(key);
|
|
4898
4948
|
if (entry) entry.d += baked;
|
|
4899
|
-
else byPaint.set(key, { paint: p.paint, d: baked });
|
|
4949
|
+
else byPaint.set(key, { paint: p.paint, d: baked, isMissing: p.isMissing });
|
|
4900
4950
|
}
|
|
4901
4951
|
const out = [];
|
|
4902
|
-
for (const { paint, d } of byPaint.values())
|
|
4952
|
+
for (const { paint, d, isMissing } of byPaint.values()) {
|
|
4953
|
+
out.push(create("path", __spreadValues2(__spreadValues2(__spreadValues2({
|
|
4954
|
+
d
|
|
4955
|
+
}, paintProps(paint)), missingGlyphProps(isMissing)), paint.animate !== void 0 ? { animate: __spreadValues2({}, paint.animate) } : {}), []));
|
|
4956
|
+
}
|
|
4903
4957
|
return out;
|
|
4904
4958
|
}
|
|
4905
4959
|
function toGroup(node, children, create) {
|
|
@@ -4935,9 +4989,9 @@ function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pat
|
|
|
4935
4989
|
}
|
|
4936
4990
|
return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
|
|
4937
4991
|
}
|
|
4938
|
-
function
|
|
4939
|
-
if (!
|
|
4940
|
-
const combined =
|
|
4992
|
+
function applyStrokeTrimEffect(node, strokeTrim, ctx) {
|
|
4993
|
+
if (!strokeTrim) return node;
|
|
4994
|
+
const combined = strokeTrim.subPaths === PxStrokeTrimSubPaths.combined;
|
|
4941
4995
|
const leafEntries = [];
|
|
4942
4996
|
const measure = (n) => {
|
|
4943
4997
|
if (Array.isArray(n.children) && n.children.length > 0) {
|
|
@@ -4968,9 +5022,9 @@ function applyTrimPathEffect(node, trimPath, ctx) {
|
|
|
4968
5022
|
}
|
|
4969
5023
|
const chainLengthPx = acc;
|
|
4970
5024
|
if (combined && chainLengthPx < 1e-3) return node;
|
|
4971
|
-
const offsetReadRaw = readAnimatable(
|
|
5025
|
+
const offsetReadRaw = readAnimatable(strokeTrim.offset);
|
|
4972
5026
|
const offsetRead = offsetReadRaw.kind === "absent" ? { kind: "static", value: 0 } : offsetReadRaw;
|
|
4973
|
-
const rangeReadRaw = readRangeWithCrossings(
|
|
5027
|
+
const rangeReadRaw = readRangeWithCrossings(strokeTrim.range);
|
|
4974
5028
|
const rangeRead = rangeReadRaw.kind === "absent" ? { kind: "static", value: [0, 1] } : rangeReadRaw;
|
|
4975
5029
|
const offsetValues = readScalarValues(offsetRead);
|
|
4976
5030
|
const minOffset = offsetValues.length ? Math.min(...offsetValues) : 0;
|
|
@@ -5300,7 +5354,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
|
|
|
5300
5354
|
const originalId = typeof node.id === "string" ? node.id : void 0;
|
|
5301
5355
|
const innerIdForContentRef = originalId ? ctx.contentRefInnerIds.get(originalId) : void 0;
|
|
5302
5356
|
if (!fx && !innerIdForContentRef) return node;
|
|
5303
|
-
const { transformBy, repeater, maskedBy, clipPath,
|
|
5357
|
+
const { transformBy, repeater, maskedBy, clipPath, strokeTrim, clone: cloneFx, fillGradient, strokeGradient, textPath, text } = fx != null ? fx : {};
|
|
5304
5358
|
if (fx) delete node.effects;
|
|
5305
5359
|
let n = node;
|
|
5306
5360
|
let consumedByGlyphs = false;
|
|
@@ -5320,7 +5374,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
|
|
|
5320
5374
|
if (!consumedByGlyphs) n = applyTextPathEffect(n, textPath, ctx);
|
|
5321
5375
|
n = applyFillGradientEffect(n, fillGradient, ctx);
|
|
5322
5376
|
n = applyStrokeGradientEffect(n, strokeGradient, ctx);
|
|
5323
|
-
n =
|
|
5377
|
+
n = applyStrokeTrimEffect(n, strokeTrim, ctx);
|
|
5324
5378
|
n = applyRepeaterEffect(n, repeater, ctx);
|
|
5325
5379
|
n = applyMaskedByEffect(n, maskedBy, transformBy, ctx);
|
|
5326
5380
|
n = applyClipPathEffect(n, clipPath, ctx);
|
|
@@ -6619,8 +6673,11 @@ function createScrollDriver(subject, config, onProgress) {
|
|
|
6619
6673
|
driver.refresh();
|
|
6620
6674
|
return driver;
|
|
6621
6675
|
}
|
|
6676
|
+
function pinScrollportHeight(svgRoot) {
|
|
6677
|
+
const scroller = findNearestScroller(svgRoot, "y");
|
|
6678
|
+
return scroller ? scroller.clientHeight : document.documentElement.clientHeight;
|
|
6679
|
+
}
|
|
6622
6680
|
function applyScrollPin(svgRoot, scroll) {
|
|
6623
|
-
var _a;
|
|
6624
6681
|
const styled = svgRoot;
|
|
6625
6682
|
if (!(scroll == null ? void 0 : scroll.pin) || !styled.style) return () => {
|
|
6626
6683
|
};
|
|
@@ -6628,7 +6685,28 @@ function applyScrollPin(svgRoot, scroll) {
|
|
|
6628
6685
|
const prevPosition = style.position;
|
|
6629
6686
|
const prevTop = style.top;
|
|
6630
6687
|
style.position = "sticky";
|
|
6631
|
-
|
|
6688
|
+
const alignFactor = scroll.pinAlign === "center" ? 0.5 : scroll.pinAlign === "bottom" ? 1 : 0;
|
|
6689
|
+
const applyTop = () => {
|
|
6690
|
+
var _a;
|
|
6691
|
+
const extra = (_a = scroll.pinTop) != null ? _a : 0;
|
|
6692
|
+
if (!alignFactor) {
|
|
6693
|
+
style.top = extra + "px";
|
|
6694
|
+
return;
|
|
6695
|
+
}
|
|
6696
|
+
const portSize = pinScrollportHeight(svgRoot);
|
|
6697
|
+
const ownSize = svgRoot.getBoundingClientRect().height;
|
|
6698
|
+
style.top = Math.round((portSize - ownSize) * alignFactor + extra) + "px";
|
|
6699
|
+
};
|
|
6700
|
+
applyTop();
|
|
6701
|
+
let resizeObserver = null;
|
|
6702
|
+
const onWindowResize = alignFactor ? applyTop : null;
|
|
6703
|
+
if (alignFactor) {
|
|
6704
|
+
if (onWindowResize) window.addEventListener("resize", onWindowResize);
|
|
6705
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
6706
|
+
resizeObserver = new ResizeObserver(applyTop);
|
|
6707
|
+
resizeObserver.observe(svgRoot);
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6632
6710
|
let wrapper = null;
|
|
6633
6711
|
const parent = svgRoot.parentElement;
|
|
6634
6712
|
if (scroll.pinDistance && scroll.pinDistance > 0 && parent) {
|
|
@@ -6639,6 +6717,8 @@ function applyScrollPin(svgRoot, scroll) {
|
|
|
6639
6717
|
wrapper.appendChild(svgRoot);
|
|
6640
6718
|
}
|
|
6641
6719
|
return () => {
|
|
6720
|
+
if (onWindowResize) window.removeEventListener("resize", onWindowResize);
|
|
6721
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
6642
6722
|
style.position = prevPosition;
|
|
6643
6723
|
style.top = prevTop;
|
|
6644
6724
|
if (wrapper == null ? void 0 : wrapper.parentElement) {
|
|
@@ -6905,6 +6985,7 @@ if (typeof window !== "undefined") {
|
|
|
6905
6985
|
}
|
|
6906
6986
|
export {
|
|
6907
6987
|
COLOUR_ATTR_NAMES,
|
|
6988
|
+
MISSING_GLYPH_CLASS_NAME,
|
|
6908
6989
|
PX_ANIMATOR_DATA_KEY,
|
|
6909
6990
|
PX_ANIM_ATTR_NAME,
|
|
6910
6991
|
PX_ANIM_SRC_ATTR_NAME,
|
|
@@ -6937,6 +7018,7 @@ export {
|
|
|
6937
7018
|
PxRepeaterEffectSchema,
|
|
6938
7019
|
PxRetimeEffectSchema,
|
|
6939
7020
|
PxStrokeGradientEffectSchema,
|
|
7021
|
+
PxStrokeTrimEffectSchema,
|
|
6940
7022
|
PxSvgNodeExtra,
|
|
6941
7023
|
PxTextEffectSchema,
|
|
6942
7024
|
PxTextPathEffectSchema,
|
|
@@ -6944,7 +7026,6 @@ export {
|
|
|
6944
7026
|
PxTransformPartsSchema,
|
|
6945
7027
|
PxTransformValueSchema,
|
|
6946
7028
|
PxTriggerSchema,
|
|
6947
|
-
PxTrimPathEffectSchema,
|
|
6948
7029
|
STYLE_ATTR_NAMES,
|
|
6949
7030
|
TRANSFORM_FN_NAMES,
|
|
6950
7031
|
applyPlayerEffects,
|