@pixodesk/svg-animator-vue 1.0.39 → 1.0.41
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 +4 -3
- package/dist/index.cjs +27 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4532 -3171
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -95,9 +95,10 @@ Render a single frame — by time in milliseconds, or by fraction of the whole t
|
|
|
95
95
|
| `delay` | `number` | Shortcut for `timeline.delay` (ms) |
|
|
96
96
|
| `iterations` | `number \| 'infinite'` | Shortcut for `timeline.iterations` |
|
|
97
97
|
| `startOn` | `'load' \| 'mouseOver' \| 'click' \| 'scrollIntoView' \| 'programmatic'` | Shortcut for `timeline.trigger.startOn` |
|
|
98
|
-
| `onWarn` | `(diagnostic) => void` |
|
|
99
|
-
| `onError` | `(diagnostic) => void` |
|
|
100
|
-
| `
|
|
98
|
+
| `onWarn` | `(diagnostic) => void` | it plays, but something was ignored, degraded or misspelled; without it → `console.warn` (a prop, not an event — see below) |
|
|
99
|
+
| `onError` | `(diagnostic) => void` | this instance will not play — failed to load, parse or build, or the render threw; without it → `console.error` |
|
|
100
|
+
| `muteWarn` | `boolean` | switch the `console.warn` fallback off — for when you know the player has something to say about this document and are prepared to tolerate it. `onWarn`, if you gave it, still fires: mute is about the console, not about you |
|
|
101
|
+
| `muteError` | `boolean` | the same switch for `console.error` |
|
|
101
102
|
|
|
102
103
|
With none of `autoplay` / `play` / `pause` / `progress` / `time` set, the component renders the animation statically (initial state, no playback); use the template ref for imperative control.
|
|
103
104
|
|
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,8 @@ module.exports = __toCommonJS(index_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/PixodeskSvgAnimator.ts
|
|
30
30
|
var import_svg_animator_web = require("@pixodesk/svg-animator-web");
|
|
31
|
+
var import_svg_animator_core = require("@pixodesk/svg-animator-core");
|
|
32
|
+
var import_internal = require("@pixodesk/svg-animator-core/internal");
|
|
31
33
|
var import_vue = require("vue");
|
|
32
34
|
var VUE_PROP = { ref: "ref" };
|
|
33
35
|
function createVueAdapter(elementRefs, diag) {
|
|
@@ -35,7 +37,7 @@ function createVueAdapter(elementRefs, diag) {
|
|
|
35
37
|
const adapter = {
|
|
36
38
|
isConnected: () => true,
|
|
37
39
|
setAttribute: (id, attrName, value) => {
|
|
38
|
-
attrName = (0,
|
|
40
|
+
attrName = (0, import_internal.camelCaseToKebabWordIfNeeded)(attrName);
|
|
39
41
|
const element = elementRefs.get(id);
|
|
40
42
|
if (!element && !warnedSelectors.has(id)) {
|
|
41
43
|
warnedSelectors.add(id);
|
|
@@ -43,7 +45,7 @@ function createVueAdapter(elementRefs, diag) {
|
|
|
43
45
|
}
|
|
44
46
|
if (element) {
|
|
45
47
|
element.setAttribute(attrName, value);
|
|
46
|
-
if (
|
|
48
|
+
if (import_internal.PX_STYLE_ATTR_NAMES.has(attrName)) {
|
|
47
49
|
element.style[attrName] = value;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -53,8 +55,8 @@ function createVueAdapter(elementRefs, diag) {
|
|
|
53
55
|
}
|
|
54
56
|
function applyDocOverrides(doc, props, compMode, diag) {
|
|
55
57
|
const { timeline, resetTimeline, duration, delay, iterations, startOn } = props;
|
|
56
|
-
const patch = (0,
|
|
57
|
-
const fullPatch = (0,
|
|
58
|
+
const patch = (0, import_svg_animator_core.foldTimelineOverride)(timeline, { duration, delay, iterations, startOn });
|
|
59
|
+
const fullPatch = (0, import_svg_animator_core.controlModeTakesOverTrigger)(compMode) ? {
|
|
58
60
|
...patch ?? {},
|
|
59
61
|
timeline: {
|
|
60
62
|
...patch?.timeline ?? {},
|
|
@@ -62,7 +64,7 @@ function applyDocOverrides(doc, props, compMode, diag) {
|
|
|
62
64
|
}
|
|
63
65
|
} : patch;
|
|
64
66
|
if (fullPatch !== void 0 || resetTimeline) {
|
|
65
|
-
const applied = (0,
|
|
67
|
+
const applied = (0, import_svg_animator_core.applyAnimatorConfig)(doc, fullPatch ?? {}, { resetTimeline: !!resetTimeline });
|
|
66
68
|
for (const w of applied.warnings) diag.warn(import_svg_animator_web.PxDiagnosticKind.usage, "timeline override: " + w);
|
|
67
69
|
doc = applied.doc;
|
|
68
70
|
}
|
|
@@ -70,12 +72,12 @@ function applyDocOverrides(doc, props, compMode, diag) {
|
|
|
70
72
|
}
|
|
71
73
|
function calcSeekMs(doc, props) {
|
|
72
74
|
let seekMs;
|
|
73
|
-
const animator = (0,
|
|
75
|
+
const animator = (0, import_svg_animator_core.getAnimatorConfig)(doc) || {};
|
|
74
76
|
if (props.progress !== void 0) {
|
|
75
77
|
const iterationsValue = props.iterations ?? animator.iterations;
|
|
76
78
|
const iterationsCount = iterationsValue === "infinite" ? Infinity : typeof iterationsValue === "number" && iterationsValue >= 1 ? iterationsValue : 1;
|
|
77
|
-
const singleDuration = props.duration ?? animator.duration ??
|
|
78
|
-
seekMs = (0,
|
|
79
|
+
const singleDuration = props.duration ?? animator.duration ?? import_internal.PX_DEFAULT_DURATION_MS;
|
|
80
|
+
seekMs = (0, import_svg_animator_core.progressToTimeMs)(props.progress, singleDuration, iterationsCount);
|
|
79
81
|
}
|
|
80
82
|
if (props.time !== void 0) seekMs = props.time;
|
|
81
83
|
return seekMs;
|
|
@@ -107,19 +109,20 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
107
109
|
// speaks by default — the same contract as React and React Native.
|
|
108
110
|
onWarn: { type: Function },
|
|
109
111
|
onError: { type: Function },
|
|
110
|
-
// `
|
|
111
|
-
//
|
|
112
|
-
|
|
112
|
+
// `muteWarn` / `muteError` switch the console fallback off — for a host that knows
|
|
113
|
+
// about the warnings and tolerates them; a handler you passed still fires.
|
|
114
|
+
muteWarn: { type: Boolean, default: void 0 },
|
|
115
|
+
muteError: { type: Boolean, default: void 0 }
|
|
113
116
|
},
|
|
114
117
|
emits: ["play", "stop", "pause", "cancel", "finish", "remove"],
|
|
115
118
|
setup(props, { expose, emit }) {
|
|
116
119
|
const elementRefs = /* @__PURE__ */ new Map();
|
|
117
120
|
const apiRef = (0, import_vue.shallowRef)(null);
|
|
118
|
-
const makeDiag = () => (0,
|
|
119
|
-
{ onWarn: props.onWarn, onError: props.onError,
|
|
121
|
+
const makeDiag = () => (0, import_internal.createDiagnostics)(
|
|
122
|
+
{ onWarn: props.onWarn, onError: props.onError, muteWarn: props.muteWarn, muteError: props.muteError },
|
|
120
123
|
"[PixodeskSvgAnimator]"
|
|
121
124
|
);
|
|
122
|
-
const resolvedMode = (0, import_vue.computed)(() => (0,
|
|
125
|
+
const resolvedMode = (0, import_vue.computed)(() => (0, import_svg_animator_core.resolveControlMode)({
|
|
123
126
|
progress: props.progress,
|
|
124
127
|
time: props.time,
|
|
125
128
|
play: props.play,
|
|
@@ -138,7 +141,7 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
138
141
|
function renderNode(node) {
|
|
139
142
|
if (!node) return null;
|
|
140
143
|
const { type, animate, meta, children, ...attrs } = node;
|
|
141
|
-
const normProps = (0, import_svg_animator_web.
|
|
144
|
+
const normProps = (0, import_svg_animator_web.toDomProps)(attrs);
|
|
142
145
|
if (node.id) {
|
|
143
146
|
const nodeId = node.id;
|
|
144
147
|
normProps[VUE_PROP.ref] = (el) => {
|
|
@@ -157,7 +160,7 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
157
160
|
destroyApi();
|
|
158
161
|
const doc = resolvedDoc.value;
|
|
159
162
|
if (!doc) return;
|
|
160
|
-
|
|
163
|
+
const options = {
|
|
161
164
|
doc,
|
|
162
165
|
adapter: createVueAdapter(elementRefs, makeDiag()),
|
|
163
166
|
onPlay: () => emit("play"),
|
|
@@ -169,8 +172,10 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
169
172
|
// The player's own diagnostics reach the same handlers as the component's.
|
|
170
173
|
onWarn: props.onWarn,
|
|
171
174
|
onError: props.onError,
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
muteWarn: props.muteWarn,
|
|
176
|
+
muteError: props.muteError
|
|
177
|
+
};
|
|
178
|
+
apiRef.value = (0, import_svg_animator_web.createAnimator)(options);
|
|
174
179
|
syncPlayState();
|
|
175
180
|
applySeek();
|
|
176
181
|
}
|
|
@@ -179,7 +184,7 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
179
184
|
apiRef.value = null;
|
|
180
185
|
}
|
|
181
186
|
function syncPlayState() {
|
|
182
|
-
if (compMode.value !==
|
|
187
|
+
if (compMode.value !== import_svg_animator_core.PxControlMode.play) return;
|
|
183
188
|
if (props.play && !props.pause) {
|
|
184
189
|
apiRef.value?.play();
|
|
185
190
|
} else if (props.pause) {
|
|
@@ -191,7 +196,7 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
function applySeek() {
|
|
194
|
-
if (compMode.value !==
|
|
199
|
+
if (compMode.value !== import_svg_animator_core.PxControlMode.fixedTime) return;
|
|
195
200
|
const doc = resolvedDoc.value;
|
|
196
201
|
if (!doc) return;
|
|
197
202
|
const seekMs = calcSeekMs(doc, props);
|
|
@@ -229,7 +234,7 @@ var PixodeskSvgAnimator = (0, import_vue.defineComponent)({
|
|
|
229
234
|
var PixodeskSvgAnimator_default = PixodeskSvgAnimator;
|
|
230
235
|
|
|
231
236
|
// src/PixodeskSvgCssAnimator.ts
|
|
232
|
-
var
|
|
237
|
+
var import_svg_animator_core2 = require("@pixodesk/svg-animator-core");
|
|
233
238
|
var import_vue2 = require("vue");
|
|
234
239
|
var PixodeskSvgCssAnimator = (0, import_vue2.defineComponent)({
|
|
235
240
|
name: "PixodeskSvgCssAnimator",
|
|
@@ -237,7 +242,7 @@ var PixodeskSvgCssAnimator = (0, import_vue2.defineComponent)({
|
|
|
237
242
|
props: {
|
|
238
243
|
startOn: { type: String, default: "load" },
|
|
239
244
|
outAction: { type: String, default: "continue" },
|
|
240
|
-
scrollIntoViewThreshold: { type: Number, default:
|
|
245
|
+
scrollIntoViewThreshold: { type: Number, default: import_svg_animator_core2.PX_TRIGGER_DEFAULTS.scrollIntoViewThreshold }
|
|
241
246
|
},
|
|
242
247
|
setup(props, { slots }) {
|
|
243
248
|
const attrs = (0, import_vue2.useAttrs)();
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/PixodeskSvgAnimator.ts","../src/PixodeskSvgCssAnimator.ts"],"sourcesContent":["/*---------------------------------------------------------------------------------------\n * Copyright (c) Pixodesk LTD.\n * Licensed under the MIT License. See the LICENSE file in the project root for details.\n *---------------------------------------------------------------------------------------*/\n\nimport PixodeskSvgAnimator from './PixodeskSvgAnimator';\nexport { PixodeskSvgAnimator };\nexport type { VueAnimatorApi } from './PixodeskSvgAnimator';\n\nimport PixodeskSvgCssAnimator from './PixodeskSvgCssAnimator';\nexport { PixodeskSvgCssAnimator };","/*---------------------------------------------------------------------------------------\n * Copyright (c) Pixodesk LTD.\n * Licensed under the MIT License. See the LICENSE file in the project root for details.\n *---------------------------------------------------------------------------------------*/\n\nimport type { PxAnimatedSvgDocument, PxAnimatorAPI, PxNode, PxPlatformAdapter, PxTimelineEngineExtra, PxTimelinePatch, PxTrigger } from '@pixodesk/svg-animator-web';\nimport { camelCaseToKebabWordIfNeeded, createAnimator, createDiagnostics, generateNewIds, getNormalizedProps, STYLE_ATTR_NAMES, applyAnimatorConfig, foldTimelineOverride, getAnimatorConfig, PxControlMode, resolveControlMode, controlModeTakesOverTrigger, PxDiagnosticKind, progressToTimeMs, DEFAULT_DURATION_MS, type PxAnimatorHandle, type PxControlProps, type PxPlaybackOverrideProps, type PxDiagnostic, type PxDiagnostics } from '@pixodesk/svg-animator-web';\nimport {\n computed, defineComponent, h, onMounted, onUnmounted, ref, shallowRef, type PropType, type VNode,\n watch,\n} from 'vue';\n\n\n// -- Public types -----------------------------------------------------------\n\n/** Vue's own prop names on the vnode — not wire keys. See the React twin. */\nconst VUE_PROP = { ref: 'ref' } as const;\n\n/**\n * The imperative handle the template ref exposes — core's `PxAnimatorHandle` under this\n * package's name (review §9). One definition for React, Vue and React Native.\n */\nexport type VueAnimatorApi = PxAnimatorHandle;\n\n\n// -- Internal types ---------------------------------------------------------\n\n// The control mode is core's `PxControlMode`, shared with React and React Native\n// (API review §1/§7) — one precedence rule, one set of conflict warnings.\n\n\n// -- Vue ↔ Animator bridge --------------------------------------------------\n\n/**\n * Creates a platform adapter that routes animator attribute updates\n * to the corresponding Vue-managed DOM element refs.\n */\nfunction createVueAdapter(elementRefs: Map<string, Element>, diag: PxDiagnostics) {\n const warnedSelectors = new Set<string>();\n\n const adapter: PxPlatformAdapter = {\n isConnected: () => true,\n setAttribute: (id, attrName, value) => {\n attrName = camelCaseToKebabWordIfNeeded(attrName);\n\n const element = elementRefs.get(id);\n\n if (!element && !warnedSelectors.has(id)) {\n warnedSelectors.add(id);\n diag.warn(PxDiagnosticKind.host, 'setAttribute: No elements found for id \"' + id + '\"');\n }\n\n if (element) {\n element.setAttribute(attrName, value);\n if (STYLE_ATTR_NAMES.has(attrName)) {\n (element as HTMLElement).style[attrName as any] = value;\n }\n }\n },\n };\n return adapter;\n}\n\n// FIXME: add model validation (e.g. isElementFileJson check)\n\n\n// -- Helper: apply doc overrides --------------------------------------------\n\n/**\n * What `applyDocOverrides` / `calcSeekMs` read off the props — core's shared shapes, not a local\n * copy (review §9). The runtime `props: {…}` block below stays Vue's own, because Vue needs\n * runtime prop declarations; this is only the TypeScript view of the same members.\n */\ntype DocOverrideProps = PxPlaybackOverrideProps & Pick<PxControlProps, 'progress' | 'time'>;\n\nfunction applyDocOverrides(\n doc: PxAnimatedSvgDocument,\n props: DocOverrideProps,\n compMode: PxControlMode,\n diag: PxDiagnostics,\n): PxAnimatedSvgDocument {\n\n // ONE patch, applied ONCE: the props, plus the component's own need to take the trigger\n // over in the non-autoplay control modes.\n //\n // This replaces three hand-rolled spread blocks that wrote the FLAT runtime keys. On a\n // wire-format document — which is what every writer emits — `flattenAnimatorTimeline`\n // overwrote them from `timeline` immediately afterwards, so the overrides were silently\n // discarded. See PLAYBACK-OVERRIDE-PLAN.md §1.1.\n const { timeline, resetTimeline, duration, delay, iterations, startOn } = props;\n const patch = foldTimelineOverride(timeline, { duration, delay, iterations, startOn });\n const fullPatch: any = controlModeTakesOverTrigger(compMode)\n ? {\n ...(patch ?? {}),\n timeline: {\n ...((patch as any)?.timeline ?? {}),\n trigger: { ...((patch as any)?.timeline?.trigger ?? {}), startOn: 'programmatic' },\n },\n }\n : patch;\n\n if (fullPatch !== undefined || resetTimeline) {\n const applied = applyAnimatorConfig(doc, fullPatch ?? {}, { resetDefaults: !!resetTimeline });\n for (const w of applied.warnings) diag.warn(PxDiagnosticKind.usage, 'timeline override: ' + w);\n doc = applied.doc;\n }\n\n return doc;\n}\n\n/**\n * Controlled-time mode: absolute seek target in ms. `progress` is a fraction\n * (0–1) of the WHOLE timeline (duration × iterations — ONE iteration when\n * endless); `time` is absolute. Applied through the animator API\n * (setCurrentTime) so scrubbing does NOT recreate the animator.\n */\nfunction calcSeekMs(doc: PxAnimatedSvgDocument, props: DocOverrideProps): number | undefined {\n let seekMs: number | undefined;\n // The FLAT runtime view, so this works on a wire-format document too — reading\n // `doc.animator.duration` directly finds nothing there.\n const animator = getAnimatorConfig(doc) || {};\n if (props.progress !== undefined) {\n // ONE rule for progress → time (core's `progressToTimeMs`): the same mapping\n // `getCurrentProgress` reads back, so a prop of 0.5 and a read of 0.5 agree.\n const iterationsValue = props.iterations ?? animator.iterations;\n const iterationsCount = iterationsValue === 'infinite' ? Infinity\n : (typeof iterationsValue === 'number' && iterationsValue >= 1 ? iterationsValue : 1);\n const singleDuration = props.duration ?? animator.duration ?? DEFAULT_DURATION_MS;\n seekMs = progressToTimeMs(props.progress, singleDuration, iterationsCount);\n }\n if (props.time !== undefined) seekMs = props.time;\n return seekMs;\n}\n\n\n// -- Main public component --------------------------------------------------\n\n/**\n * Vue component for rendering and controlling Pixodesk SVG animations.\n *\n * Supports four mutually-exclusive control modes:\n *\n * 1. **Autoplay** – uses triggers from the animation document.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" autoplay />\n * ```\n *\n * 2. **Declarative play/pause** – controlled via boolean props.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" play :pause=\"false\" />\n * ```\n *\n * 3. **Imperative** – exposes a ref-based API for full programmatic control.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" ref=\"animator\" />\n * <button @click=\"$refs.animator.play()\">Play</button>\n * ```\n *\n * 4. **Controlled time** – renders a single frame at a given time.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" :progress=\"0.5\" />\n * <PixodeskSvgAnimator :doc=\"animation\" :time=\"500\" />\n * ```\n */\nconst PixodeskSvgAnimator = defineComponent({\n name: 'PixodeskSvgAnimator',\n\n props: {\n // -- Source\n doc: { type: Object as PropType<PxAnimatedSvgDocument>, required: true },\n\n // -- Playback override: the document's `timeline` block as a patch (or a JSON string),\n // plus the four shortcuts people reach for most. The same names as React / RN.\n timeline: { type: [Object, String] as PropType<PxTimelinePatch | string> },\n resetTimeline: { type: Boolean, default: undefined },\n duration: { type: Number },\n delay: { type: Number },\n iterations: { type: [Number, String] as PropType<number | 'infinite'> },\n startOn: { type: String as PropType<'load' | 'mouseOver' | 'click' | 'scrollIntoView' | 'programmatic'> },\n\n // -- Declarative control\n autoplay: { type: Boolean, default: undefined },\n play: { type: Boolean, default: undefined },\n pause: { type: Boolean, default: undefined },\n\n // -- Controlled time\n progress: { type: Number },\n time: { type: Number },\n\n // -- Diagnostics (API review §5).\n // Function PROPS, not emits, on purpose: an emit handler always exists, so wiring\n // these to `emit` would permanently suppress the console fallback for anyone who\n // never listens. As props, \"not given\" really is undefined and the console still\n // speaks by default — the same contract as React and React Native.\n onWarn: { type: Function as PropType<(diagnostic: PxDiagnostic) => void> },\n onError: { type: Function as PropType<(diagnostic: PxDiagnostic) => void> },\n // `silent` takes `true` or just the kinds to quiet, so `platform` chatter can be\n // silenced while `document` problems still speak.\n silent: { type: [Boolean, Array] as PropType<boolean | ReadonlyArray<PxDiagnosticKind>>, default: undefined },\n },\n\n emits: ['play', 'stop', 'pause', 'cancel', 'finish', 'remove'],\n\n setup(props, { expose, emit }) {\n const elementRefs = new Map<string, Element>();\n const apiRef = shallowRef<PxAnimatorAPI | null>(null);\n\n /**\n * The diagnostics channel, built from the CURRENT props each time (API review §5).\n * Not hoisted into a constant wrapper: `(m, d) => props.onWarn?.(m, d)` would always be\n * a function, so the channel would think a handler exists and the console fallback\n * would never fire for anyone who passed nothing.\n */\n const makeDiag = (): PxDiagnostics => createDiagnostics(\n { onWarn: props.onWarn, onError: props.onError, silent: props.silent },\n '[PixodeskSvgAnimator]',\n );\n\n // -- Determine control mode ---------------------------------------------\n\n // ONE control-mode rule, decided in core (API review §1/§7). The template ref is not an\n // input: it is exposed in every mode and never changes which one is chosen.\n const resolvedMode = computed(() => resolveControlMode({\n progress: props.progress, time: props.time,\n play: props.play, pause: props.pause, autoplay: props.autoplay,\n }));\n const compMode = computed<PxControlMode>(() => resolvedMode.value.mode);\n\n // Warn where the mode is COMPUTED, not inside `applyDocOverrides` — that runs again on\n // every doc recompute and would repeat the same sentence.\n watch(resolvedMode, r => {\n const diag = makeDiag();\n for (const w of r.warnings) diag.warn(PxDiagnosticKind.usage, w);\n }, { immediate: true });\n\n // -- Prepare the document with overrides --------------------------------\n\n const resolvedDoc = computed(() => {\n let doc = generateNewIds(props.doc);\n return applyDocOverrides(doc, props, compMode.value, makeDiag());\n });\n\n // -- Render the SVG node tree -------------------------------------------\n\n function renderNode(node: PxNode | undefined): VNode | null {\n if (!node) return null;\n\n const { type, animate, meta, children, ...attrs } = node;\n const normProps = getNormalizedProps(attrs);\n\n // Capture a ref to each element with an id.\n if (node.id) {\n const nodeId = node.id;\n normProps[VUE_PROP.ref] = (el: Element | null) => {\n if (el) {\n elementRefs.set(nodeId, el);\n } else {\n elementRefs.delete(nodeId);\n }\n };\n }\n\n const childVNodes = children?.map(child => renderNode(child)).filter(Boolean) as VNode[] | undefined;\n // Text content: a node's own `textContent` renders only when it has no child nodes — a\n // line <tspan> can carry both, and then its children are the styled spans (the React\n // Native renderer's rule). `getNormalizedProps` strips `textContent` from the attributes.\n const text = typeof node.textContent === 'string' ? node.textContent : undefined;\n return h(type, normProps, childVNodes?.length ? childVNodes : text);\n }\n\n // -- Animator lifecycle -------------------------------------------------\n\n function createApi() {\n destroyApi();\n const doc = resolvedDoc.value;\n if (!doc) return;\n\n // Route animator lifecycle events to Vue component events, INLINE under the same\n // names every surface uses (review §9). `stop` fires alongside any event that halts\n // playback — that is the PLAYER's rule, so `onStop` is passed through, not re-derived.\n apiRef.value = createAnimator({\n doc,\n adapter: createVueAdapter(elementRefs, makeDiag()),\n onPlay: () => emit('play'),\n onPause: () => emit('pause'),\n onCancel: () => emit('cancel'),\n onFinish: () => emit('finish'),\n onRemove: () => emit('remove'),\n onStop: () => emit('stop'),\n // The player's own diagnostics reach the same handlers as the component's.\n onWarn: props.onWarn,\n onError: props.onError,\n silent: props.silent,\n });\n\n // (Re)apply the declarative control state to the fresh animator —\n // covers both the initial mount (e.g. `:play=\"true\"` from the\n // start) and doc swaps.\n syncPlayState();\n applySeek();\n }\n\n function destroyApi() {\n apiRef.value?.destroy();\n apiRef.value = null;\n }\n\n /** Declarative play/pause → animator calls. */\n function syncPlayState() {\n if (compMode.value !== PxControlMode.play) return;\n if (props.play && !props.pause) {\n apiRef.value?.play();\n } else if (props.pause) {\n apiRef.value?.pause();\n } else if (props.play === false) {\n // explicit play=false → hold where it is (review §8). This used to `finish()`;\n // a boolean whose `false` means \"jump to the end\" is not what anyone guesses.\n apiRef.value?.pause();\n } else {\n // pause-only usage: pause switched off → resume\n apiRef.value?.play();\n }\n }\n\n /** Controlled-time mode: seek through the animator API (no recreate). */\n function applySeek() {\n if (compMode.value !== PxControlMode.fixedTime) return;\n const doc = resolvedDoc.value;\n if (!doc) return;\n const seekMs = calcSeekMs(doc, props);\n if (seekMs !== undefined) {\n apiRef.value?.setCurrentTime(seekMs);\n apiRef.value?.pause();\n }\n }\n\n // Create the animator once DOM refs are available.\n onMounted(() => createApi());\n\n // Recreate the animator when the resolved doc changes.\n // `flush: 'post'` — the animator must be created AFTER the DOM is\n // patched, otherwise the new root element isn't in the document yet\n // and trigger setup fails (autoplay would never resume after a doc swap).\n watch(resolvedDoc, () => createApi(), { flush: 'post' });\n\n // Sync declarative play/pause props with the animator.\n watch([compMode, () => props.play, () => props.pause], () => syncPlayState());\n\n // Scrubbing progress/time only seeks — the animator is NOT recreated.\n watch([compMode, () => props.progress, () => props.time], () => applySeek());\n\n onUnmounted(() => {\n destroyApi();\n });\n\n // -- Expose imperative API ----------------------------------------------\n\n const publicApi: VueAnimatorApi = {\n isPlaying: () => apiRef.value?.isPlaying() || false,\n play: () => apiRef.value?.play(),\n pause: () => apiRef.value?.pause(),\n cancel: () => apiRef.value?.cancel(),\n finish: () => apiRef.value?.finish(),\n setPlaybackRate: (rate: number) => apiRef.value?.setPlaybackRate(rate),\n getCurrentTime: () => apiRef.value?.getCurrentTime() ?? null,\n setCurrentTime: (time: number) => apiRef.value?.setCurrentTime(time),\n getCurrentProgress: () => apiRef.value?.getCurrentProgress() ?? null,\n setCurrentProgress: (progress: number) => apiRef.value?.setCurrentProgress(progress),\n };\n\n expose(publicApi);\n\n // -- Render -------------------------------------------------------------\n\n return () => {\n const doc = resolvedDoc.value;\n return doc ? renderNode(doc) : null;\n };\n },\n});\n\nexport default PixodeskSvgAnimator;\n","/*---------------------------------------------------------------------------------------\n * Copyright (c) Pixodesk LTD.\n * Licensed under the MIT License. See the LICENSE file in the project root for details.\n *---------------------------------------------------------------------------------------*/\n\nimport { PX_TRIGGER_DEFAULTS, PxOutAction, PxStartOn } from \"@pixodesk/svg-animator-web\";\nimport { computed, defineComponent, h, onMounted, onUnmounted, ref, useAttrs, type PropType } from 'vue';\n\n\ntype AnimState = 'idle' | 'paused' | 'playing';\n\n\n/**\n * Controls playback of a SVG+CSS animated file by toggling class names on a wrapper div.\n *\n * Intended for use with SVG files exported from the Pixodesk editor using the\n * **CSS Keyframes** flavor (no `<script>` tag). Import the SVG as a Vue component\n * via `vite-svg-loader` and pass it as the default slot:\n *\n * ```vue\n * <script setup>\n * import AnimationSvg from './animation.svg'; // vite-svg-loader\n * </script>\n *\n * <template>\n * <PixodeskSvgCssAnimator startOn=\"mouseOver\" outAction=\"pause\">\n * <AnimationSvg />\n * </PixodeskSvgCssAnimator>\n * </template>\n * ```\n *\n * The wrapper div carries one of three animation states via CSS class names:\n * - *(no class)* — idle, animation not started\n * - `px-anim-enabled` — started but paused\n * - `px-anim-enabled px-anim-playing` — actively playing\n *\n * @prop startOn - What triggers the animation to start:\n * - `'load'` — plays immediately on mount (default)\n * - `'mouseOver'` — plays on hover\n * - `'click'` — plays on click, toggles on second click\n * - `'scrollIntoView'` — plays when the element enters the viewport\n * - `'programmatic'` — **not supported here.** This wrapper exposes no `play()`, so there is\n * nothing to wait for and the animation never starts. The prop keeps the\n * shared `PxStartOn` type (one enum per wire key), so the value type-checks\n * — it simply has no effect. Use `PixodeskSvgAnimator` (the JSON player)\n * when you need to start an animation from code.\n * @prop outAction - What happens when the trigger ends (hover/scroll out, second click):\n * - `'continue'` — keeps playing (default)\n * - `'pause'` — pauses at the current frame\n * - `'reset'` — resets to the beginning\n * - `'reverse'` — **acts as `'continue'` here.** A CSS class toggle cannot run keyframes\n * backwards. Accepted so the prop keeps the shared `PxOutAction` type.\n * @prop scrollIntoViewThreshold - For `'scrollIntoView'`: how much of the element must be\n * visible (0–1) before it starts, and below which the out action applies. Defaults to the\n * wire default (`0`, any pixel) — the same as the JSON player, not a private `0.1`.\n */\nconst PixodeskSvgCssAnimator = defineComponent({\n name: 'PixodeskSvgCssAnimator',\n\n inheritAttrs: false,\n\n props: {\n startOn: { type: String as PropType<PxStartOn>, default: 'load' },\n outAction: { type: String as PropType<PxOutAction>, default: 'continue' },\n scrollIntoViewThreshold: { type: Number, default: PX_TRIGGER_DEFAULTS.scrollIntoViewThreshold },\n },\n\n setup(props, { slots }) {\n const attrs = useAttrs();\n const state = ref<AnimState>(props.startOn === 'load' ? 'playing' : 'idle');\n const divRef = ref<HTMLDivElement | null>(null);\n\n const goOut = () => {\n state.value =\n props.outAction === 'reset' ? 'idle' :\n props.outAction === 'pause' ? 'paused' : 'playing';\n };\n\n let observerCleanup: (() => void) | undefined;\n\n onMounted(() => {\n if (props.startOn !== 'scrollIntoView') return;\n const el = divRef.value;\n if (!el) return;\n const outState: AnimState =\n props.outAction === 'reset' ? 'idle' :\n props.outAction === 'pause' ? 'paused' : 'playing';\n // `isIntersecting` is true at ONE visible pixel, so with a threshold above 0 it could\n // never report \"out\" — read the ratio against the threshold instead (review §13).\n const threshold = props.scrollIntoViewThreshold;\n const visible = (entry: IntersectionObserverEntry): boolean =>\n threshold > 0 ? entry.intersectionRatio >= threshold : entry.isIntersecting;\n const observer = new IntersectionObserver(\n ([entry]) => { state.value = visible(entry) ? 'playing' : outState; },\n { threshold }\n );\n observer.observe(el);\n observerCleanup = () => observer.disconnect();\n });\n\n onUnmounted(() => observerCleanup?.());\n\n const animClass = computed(() =>\n state.value === 'playing' ? 'px-anim-enabled px-anim-playing' :\n state.value === 'paused' ? 'px-anim-enabled' : ''\n );\n\n const handlers = computed(() =>\n props.startOn === 'mouseOver' ? {\n onMouseenter: () => { state.value = 'playing'; },\n onMouseleave: goOut,\n } :\n props.startOn === 'click' ? {\n onClick: () => state.value === 'playing' ? goOut() : (state.value = 'playing'),\n } : {}\n );\n\n return () => h('div', {\n ref: divRef,\n ...attrs,\n class: [attrs.class, animClass.value],\n ...handlers.value,\n }, slots.default?.());\n },\n});\n\nexport default PixodeskSv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MAAS,MACtB,MAAM,YAAY,cAAc;AAAA,QAC5B,cAAc,MAAM;AAAE,gBAAM,QAAQ;AAAA,QAAW;AAAA,QAC/C,cAAc;AAAA,MAClB,IACA,MAAM,YAAY,UAAU;AAAA,QACxB,SAAS,MAAM,MAAM,UAAU,YAAY,MAAM,IAAK,MAAM,QAAQ;AAAA,MACxE,IAAI,CAAC;AAAA,IACT;AAEA,WAAO,UAAM,eAAE,OAAO;AAAA,MAClB,KAAK;AAAA,MACL,GAAG;AAAA,MACH,OAAO,CAAC,MAAM,OAAO,UAAU,KAAK;AAAA,MACpC,GAAG,SAAS;AAAA,IAChB,GAAG,MAAM,UAAU,CAAC;AAAA,EACxB;AACJ,CAAC;AAED,IAAO,iCAAQ;","names":["import_svg_animator_web","import_vue"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/PixodeskSvgAnimator.ts","../src/PixodeskSvgCssAnimator.ts"],"sourcesContent":["/*---------------------------------------------------------------------------------------\n * Copyright (c) Pixodesk LTD.\n * Licensed under the MIT License. See the LICENSE file in the project root for details.\n *---------------------------------------------------------------------------------------*/\n\nimport PixodeskSvgAnimator from './PixodeskSvgAnimator';\nexport { PixodeskSvgAnimator };\nexport type { VueAnimatorApi } from './PixodeskSvgAnimator';\n\nimport PixodeskSvgCssAnimator from './PixodeskSvgCssAnimator';\nexport { PixodeskSvgCssAnimator };","/*---------------------------------------------------------------------------------------\n * Copyright (c) Pixodesk LTD.\n * Licensed under the MIT License. See the LICENSE file in the project root for details.\n *---------------------------------------------------------------------------------------*/\n\nimport type { PxAnimatedSvgDocument, PxAnimatorApi, PxNode, PxPlatformAdapter, PxTimelineEngineSetting, PxTimelinePatch, PxTrigger } from '@pixodesk/svg-animator-web';\nimport type { PxInternalAnimatorOptions } from '@pixodesk/svg-animator-web/internal';\nimport { createAnimator, generateNewIds, toDomProps, PxDiagnosticKind, type PxPlaybackOverride, type PxDiagnostic, type PxDiagnostics } from '@pixodesk/svg-animator-web';\nimport { applyAnimatorConfig, foldTimelineOverride, getAnimatorConfig, PxControlMode, resolveControlMode, controlModeTakesOverTrigger, progressToTimeMs, type PxAnimatorHandle, type PxControlProps } from '@pixodesk/svg-animator-core';\nimport { camelCaseToKebabWordIfNeeded, createDiagnostics, PX_STYLE_ATTR_NAMES, PX_DEFAULT_DURATION_MS } from '@pixodesk/svg-animator-core/internal';\nimport {\n computed, defineComponent, h, onMounted, onUnmounted, ref, shallowRef, type PropType, type VNode,\n watch,\n} from 'vue';\n\n\n// -- Public types -----------------------------------------------------------\n\n/** Vue's own prop names on the vnode — not wire keys. See the React twin. */\nconst VUE_PROP = { ref: 'ref' } as const;\n\n/**\n * The imperative handle the template ref exposes — core's `PxAnimatorHandle` under this\n * package's name (review §9). One definition for React, Vue and React Native.\n * @public\n */\nexport type VueAnimatorApi = PxAnimatorHandle;\n\n\n// -- Internal types ---------------------------------------------------------\n\n// The control mode is core's `PxControlMode`, shared with React and React Native\n// (API review §1/§7) — one precedence rule, one set of conflict warnings.\n\n\n// -- Vue ↔ Animator bridge --------------------------------------------------\n\n/**\n * Creates a platform adapter that routes animator attribute updates\n * to the corresponding Vue-managed DOM element refs.\n */\nfunction createVueAdapter(elementRefs: Map<string, Element>, diag: PxDiagnostics) {\n const warnedSelectors = new Set<string>();\n\n const adapter: PxPlatformAdapter = {\n isConnected: () => true,\n setAttribute: (id, attrName, value) => {\n attrName = camelCaseToKebabWordIfNeeded(attrName);\n\n const element = elementRefs.get(id);\n\n if (!element && !warnedSelectors.has(id)) {\n warnedSelectors.add(id);\n diag.warn(PxDiagnosticKind.host, 'setAttribute: No elements found for id \"' + id + '\"');\n }\n\n if (element) {\n element.setAttribute(attrName, value);\n if (PX_STYLE_ATTR_NAMES.has(attrName)) {\n (element as HTMLElement).style[attrName as any] = value;\n }\n }\n },\n };\n return adapter;\n}\n\n// FIXME: add model validation (e.g. isElementFileJson check)\n\n\n// -- Helper: apply doc overrides --------------------------------------------\n\n/**\n * What `applyDocOverrides` / `calcSeekMs` read off the props — core's shared shapes, not a local\n * copy (review §9). The runtime `props: {…}` block below stays Vue's own, because Vue needs\n * runtime prop declarations; this is only the TypeScript view of the same members.\n */\ntype DocOverrideProps = PxPlaybackOverride & Pick<PxControlProps, 'progress' | 'time'>;\n\nfunction applyDocOverrides(\n doc: PxAnimatedSvgDocument,\n props: DocOverrideProps,\n compMode: PxControlMode,\n diag: PxDiagnostics,\n): PxAnimatedSvgDocument {\n\n // ONE patch, applied ONCE: the props, plus the component's own need to take the trigger\n // over in the non-autoplay control modes.\n //\n // This replaces three hand-rolled spread blocks that wrote the FLAT runtime keys. On a\n // wire-format document — which is what every writer emits — `flattenAnimatorTimeline`\n // overwrote them from `timeline` immediately afterwards, so the overrides were silently\n // discarded. See dev-docs/plans/playback-override.md §1.1.\n const { timeline, resetTimeline, duration, delay, iterations, startOn } = props;\n const patch = foldTimelineOverride(timeline, { duration, delay, iterations, startOn });\n const fullPatch: any = controlModeTakesOverTrigger(compMode)\n ? {\n ...(patch ?? {}),\n timeline: {\n ...((patch as any)?.timeline ?? {}),\n trigger: { ...((patch as any)?.timeline?.trigger ?? {}), startOn: 'programmatic' },\n },\n }\n : patch;\n\n if (fullPatch !== undefined || resetTimeline) {\n const applied = applyAnimatorConfig(doc, fullPatch ?? {}, { resetTimeline: !!resetTimeline });\n for (const w of applied.warnings) diag.warn(PxDiagnosticKind.usage, 'timeline override: ' + w);\n doc = applied.doc;\n }\n\n return doc;\n}\n\n/**\n * Controlled-time mode: absolute seek target in ms. `progress` is a fraction\n * (0–1) of the WHOLE timeline (duration × iterations — ONE iteration when\n * endless); `time` is absolute. Applied through the animator API\n * (setCurrentTime) so scrubbing does NOT recreate the animator.\n */\nfunction calcSeekMs(doc: PxAnimatedSvgDocument, props: DocOverrideProps): number | undefined {\n let seekMs: number | undefined;\n // The FLAT runtime view, so this works on a wire-format document too — reading\n // `doc.animator.duration` directly finds nothing there.\n const animator = getAnimatorConfig(doc) || {};\n if (props.progress !== undefined) {\n // ONE rule for progress → time (core's `progressToTimeMs`): the same mapping\n // `getCurrentProgress` reads back, so a prop of 0.5 and a read of 0.5 agree.\n const iterationsValue = props.iterations ?? animator.iterations;\n const iterationsCount = iterationsValue === 'infinite' ? Infinity\n : (typeof iterationsValue === 'number' && iterationsValue >= 1 ? iterationsValue : 1);\n const singleDuration = props.duration ?? animator.duration ?? PX_DEFAULT_DURATION_MS;\n seekMs = progressToTimeMs(props.progress, singleDuration, iterationsCount);\n }\n if (props.time !== undefined) seekMs = props.time;\n return seekMs;\n}\n\n\n// -- Main public component --------------------------------------------------\n\n/**\n * Vue component for rendering and controlling Pixodesk SVG animations.\n *\n * Supports four mutually-exclusive control modes:\n *\n * 1. **Autoplay** – uses triggers from the animation document.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" autoplay />\n * ```\n *\n * 2. **Declarative play/pause** – controlled via boolean props.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" play :pause=\"false\" />\n * ```\n *\n * 3. **Imperative** – exposes a ref-based API for full programmatic control.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" ref=\"animator\" />\n * <button @click=\"$refs.animator.play()\">Play</button>\n * ```\n *\n * 4. **Controlled time** – renders a single frame at a given time.\n * ```vue\n * <PixodeskSvgAnimator :doc=\"animation\" :progress=\"0.5\" />\n * <PixodeskSvgAnimator :doc=\"animation\" :time=\"500\" />\n * ```\n * @public\n */\nconst PixodeskSvgAnimator = defineComponent({\n name: 'PixodeskSvgAnimator',\n\n props: {\n // -- Source\n doc: { type: Object as PropType<PxAnimatedSvgDocument>, required: true },\n\n // -- Playback override: the document's `timeline` block as a patch (or a JSON string),\n // plus the four shortcuts people reach for most. The same names as React / RN.\n timeline: { type: [Object, String] as PropType<PxTimelinePatch | string> },\n resetTimeline: { type: Boolean, default: undefined },\n duration: { type: Number },\n delay: { type: Number },\n iterations: { type: [Number, String] as PropType<number | 'infinite'> },\n startOn: { type: String as PropType<'load' | 'mouseOver' | 'click' | 'scrollIntoView' | 'programmatic'> },\n\n // -- Declarative control\n autoplay: { type: Boolean, default: undefined },\n play: { type: Boolean, default: undefined },\n pause: { type: Boolean, default: undefined },\n\n // -- Controlled time\n progress: { type: Number },\n time: { type: Number },\n\n // -- Diagnostics (API review §5).\n // Function PROPS, not emits, on purpose: an emit handler always exists, so wiring\n // these to `emit` would permanently suppress the console fallback for anyone who\n // never listens. As props, \"not given\" really is undefined and the console still\n // speaks by default — the same contract as React and React Native.\n onWarn: { type: Function as PropType<(diagnostic: PxDiagnostic) => void> },\n onError: { type: Function as PropType<(diagnostic: PxDiagnostic) => void> },\n // `muteWarn` / `muteError` switch the console fallback off — for a host that knows\n // about the warnings and tolerates them; a handler you passed still fires.\n muteWarn: { type: Boolean, default: undefined },\n muteError: { type: Boolean, default: undefined },\n },\n\n emits: ['play', 'stop', 'pause', 'cancel', 'finish', 'remove'],\n\n setup(props, { expose, emit }) {\n const elementRefs = new Map<string, Element>();\n const apiRef = shallowRef<PxAnimatorApi | null>(null);\n\n /**\n * The diagnostics channel, built from the CURRENT props each time (API review §5).\n * Not hoisted into a constant wrapper: `(m, d) => props.onWarn?.(m, d)` would always be\n * a function, so the channel would think a handler exists and the console fallback\n * would never fire for anyone who passed nothing.\n */\n const makeDiag = (): PxDiagnostics => createDiagnostics(\n { onWarn: props.onWarn, onError: props.onError, muteWarn: props.muteWarn, muteError: props.muteError },\n '[PixodeskSvgAnimator]',\n );\n\n // -- Determine control mode ---------------------------------------------\n\n // ONE control-mode rule, decided in core (API review §1/§7). The template ref is not an\n // input: it is exposed in every mode and never changes which one is chosen.\n const resolvedMode = computed(() => resolveControlMode({\n progress: props.progress, time: props.time,\n play: props.play, pause: props.pause, autoplay: props.autoplay,\n }));\n const compMode = computed<PxControlMode>(() => resolvedMode.value.mode);\n\n // Warn where the mode is COMPUTED, not inside `applyDocOverrides` — that runs again on\n // every doc recompute and would repeat the same sentence.\n watch(resolvedMode, r => {\n const diag = makeDiag();\n for (const w of r.warnings) diag.warn(PxDiagnosticKind.usage, w);\n }, { immediate: true });\n\n // -- Prepare the document with overrides --------------------------------\n\n const resolvedDoc = computed(() => {\n let doc = generateNewIds(props.doc);\n return applyDocOverrides(doc, props, compMode.value, makeDiag());\n });\n\n // -- Render the SVG node tree -------------------------------------------\n\n function renderNode(node: PxNode | undefined): VNode | null {\n if (!node) return null;\n\n const { type, animate, meta, children, ...attrs } = node;\n const normProps = toDomProps(attrs);\n\n // Capture a ref to each element with an id.\n if (node.id) {\n const nodeId = node.id;\n normProps[VUE_PROP.ref] = (el: Element | null) => {\n if (el) {\n elementRefs.set(nodeId, el);\n } else {\n elementRefs.delete(nodeId);\n }\n };\n }\n\n const childVNodes = children?.map(child => renderNode(child)).filter(Boolean) as VNode[] | undefined;\n // Text content: a node's own `textContent` renders only when it has no child nodes — a\n // line <tspan> can carry both, and then its children are the styled spans (the React\n // Native renderer's rule). `toDomProps` strips `textContent` from the attributes.\n const text = typeof node.textContent === 'string' ? node.textContent : undefined;\n return h(type, normProps, childVNodes?.length ? childVNodes : text);\n }\n\n // -- Animator lifecycle -------------------------------------------------\n\n function createApi() {\n destroyApi();\n const doc = resolvedDoc.value;\n if (!doc) return;\n\n // Route animator lifecycle events to Vue component events, INLINE under the same\n // names every surface uses (review §9). `stop` fires alongside any event that halts\n // playback — that is the PLAYER's rule, so `onStop` is passed through, not re-derived.\n // `adapter` is the components' extension of the public options (`PxInternalAnimatorOptions`,\n // review §25.14): the frame loop writes to the elements Vue rendered, not to a container.\n const options: PxInternalAnimatorOptions = {\n doc,\n adapter: createVueAdapter(elementRefs, makeDiag()),\n onPlay: () => emit('play'),\n onPause: () => emit('pause'),\n onCancel: () => emit('cancel'),\n onFinish: () => emit('finish'),\n onRemove: () => emit('remove'),\n onStop: () => emit('stop'),\n // The player's own diagnostics reach the same handlers as the component's.\n onWarn: props.onWarn,\n onError: props.onError,\n muteWarn: props.muteWarn,\n muteError: props.muteError,\n };\n apiRef.value = createAnimator(options);\n\n // (Re)apply the declarative control state to the fresh animator —\n // covers both the initial mount (e.g. `:play=\"true\"` from the\n // start) and doc swaps.\n syncPlayState();\n applySeek();\n }\n\n function destroyApi() {\n apiRef.value?.destroy();\n apiRef.value = null;\n }\n\n /** Declarative play/pause → animator calls. */\n function syncPlayState() {\n if (compMode.value !== PxControlMode.play) return;\n if (props.play && !props.pause) {\n apiRef.value?.play();\n } else if (props.pause) {\n apiRef.value?.pause();\n } else if (props.play === false) {\n // explicit play=false → hold where it is (review §8). This used to `finish()`;\n // a boolean whose `false` means \"jump to the end\" is not what anyone guesses.\n apiRef.value?.pause();\n } else {\n // pause-only usage: pause switched off → resume\n apiRef.value?.play();\n }\n }\n\n /** Controlled-time mode: seek through the animator API (no recreate). */\n function applySeek() {\n if (compMode.value !== PxControlMode.fixedTime) return;\n const doc = resolvedDoc.value;\n if (!doc) return;\n const seekMs = calcSeekMs(doc, props);\n if (seekMs !== undefined) {\n apiRef.value?.setCurrentTime(seekMs);\n apiRef.value?.pause();\n }\n }\n\n // Create the animator once DOM refs are available.\n onMounted(() => createApi());\n\n // Recreate the animator when the resolved doc changes.\n // `flush: 'post'` — the animator must be created AFTER the DOM is\n // patched, otherwise the new root element isn't in the document yet\n // and trigger setup fails (autoplay would never resume after a doc swap).\n watch(resolvedDoc, () => createApi(), { flush: 'post' });\n\n // Sync declarative play/pause props with the animator.\n watch([compMode, () => props.play, () => props.pause], () => syncPlayState());\n\n // Scrubbing progress/time only seeks — the animator is NOT recreated.\n watch([compMode, () => props.progress, () => props.time], () => applySeek());\n\n onUnmounted(() => {\n destroyApi();\n });\n\n // -- Expose imperative API ----------------------------------------------\n\n const publicApi: VueAnimatorApi = {\n isPlaying: () => apiRef.value?.isPlaying() || false,\n play: () => apiRef.value?.play(),\n pause: () => apiRef.value?.pause(),\n cancel: () => apiRef.value?.cancel(),\n finish: () => apiRef.value?.finish(),\n setPlaybackRate: (rate: number) => apiRef.value?.setPlaybackRate(rate),\n getCurrentTime: () => apiRef.value?.getCurrentTime() ?? null,\n setCurrentTime: (time: number) => apiRef.value?.setCurrentTime(time),\n getCurrentProgress: () => apiRef.value?.getCurrentProgress() ?? null,\n setCurrentProgress: (progress: number) => apiRef.value?.setCurrentProgress(progress),\n };\n\n expose(publicApi);\n\n // -- Render -------------------------------------------------------------\n\n return () => {\n const doc = resolvedDoc.value;\n return doc ? renderNode(doc) : null;\n };\n },\n});\n\nexport default PixodeskSvgAnimator;\n","/*---------------------------------------------------------------------------------------\n * Copyright (c) Pixodesk LTD.\n * Licensed under the MIT License. See the LICENSE file in the project root for details.\n *---------------------------------------------------------------------------------------*/\n\nimport { PX_TRIGGER_DEFAULTS, PxOutAction, PxStartOn } from '@pixodesk/svg-animator-core';\nimport { computed, defineComponent, h, onMounted, onUnmounted, ref, useAttrs, type PropType } from 'vue';\n\n\ntype AnimState = 'idle' | 'paused' | 'playing';\n\n\n/**\n * Controls playback of a SVG+CSS animated file by toggling class names on a wrapper div.\n *\n * Intended for use with SVG files exported from the Pixodesk editor using the\n * **CSS Keyframes** flavor (no `<script>` tag). Import the SVG as a Vue component\n * via `vite-svg-loader` and pass it as the default slot:\n *\n * ```vue\n * <script setup>\n * import AnimationSvg from './animation.svg'; // vite-svg-loader\n * </script>\n *\n * <template>\n * <PixodeskSvgCssAnimator startOn=\"mouseOver\" outAction=\"pause\">\n * <AnimationSvg />\n * </PixodeskSvgCssAnimator>\n * </template>\n * ```\n *\n * The wrapper div carries one of three animation states via CSS class names:\n * - *(no class)* — idle, animation not started\n * - `px-anim-enabled` — started but paused\n * - `px-anim-enabled px-anim-playing` — actively playing\n *\n * @prop startOn - What triggers the animation to start:\n * - `'load'` — plays immediately on mount (default)\n * - `'mouseOver'` — plays on hover\n * - `'click'` — plays on click, toggles on second click\n * - `'scrollIntoView'` — plays when the element enters the viewport\n * - `'programmatic'` — **not supported here.** This wrapper exposes no `play()`, so there is\n * nothing to wait for and the animation never starts. The prop keeps the\n * shared `PxStartOn` type (one enum per wire key), so the value type-checks\n * — it simply has no effect. Use `PixodeskSvgAnimator` (the JSON player)\n * when you need to start an animation from code.\n * @prop outAction - What happens when the trigger ends (hover/scroll out, second click):\n * - `'continue'` — keeps playing (default)\n * - `'pause'` — pauses at the current frame\n * - `'reset'` — resets to the beginning\n * - `'reverse'` — **acts as `'continue'` here.** A CSS class toggle cannot run keyframes\n * backwards. Accepted so the prop keeps the shared `PxOutAction` type.\n * @prop scrollIntoViewThreshold - For `'scrollIntoView'`: how much of the element must be\n * visible (0–1) before it starts, and below which the out action applies. Defaults to the\n * wire default (`0`, any pixel) — the same as the JSON player, not a private `0.1`.\n * @public\n */\nconst PixodeskSvgCssAnimator = defineComponent({\n name: 'PixodeskSvgCssAnimator',\n\n inheritAttrs: false,\n\n props: {\n startOn: { type: String as PropType<PxStartOn>, default: 'load' },\n outAction: { type: String as PropType<PxOutAction>, default: 'continue' },\n scrollIntoViewThreshold: { type: Number, default: PX_TRIGGER_DEFAULTS.scrollIntoViewThreshold },\n },\n\n setup(props, { slots }) {\n const attrs = useAttrs();\n const state = ref<AnimState>(props.startOn === 'load' ? 'playing' : 'idle');\n const divRef = ref<HTMLDivElement | null>(null);\n\n const goOut = () => {\n state.value =\n props.outAction === 'reset' ? 'idle' :\n props.outAction === 'pause' ? 'paused' : 'playing';\n };\n\n let observerCleanup: (() => void) | undefined;\n\n onMounted(() => {\n if (props.startOn !== 'scrollIntoView') return;\n const el = divRef.value;\n if (!el) return;\n const outState: AnimState =\n props.outAction === 'reset' ? 'idle' :\n props.outAction === 'pause' ? 'paused' : 'playing';\n // `isIntersecting` is true at ONE visible pixel, so with a threshold above 0 it could\n // never report \"out\" — read the ratio against the threshold instead (review §13).\n const threshold = props.scrollIntoViewThreshold;\n const visible = (entry: IntersectionObserverEntry): boolean =>\n threshold > 0 ? entry.intersectionRatio >= threshold : entry.isIntersecting;\n const observer = new IntersectionObserver(\n ([entry]) => { state.value = visible(entry) ? 'playing' : outState; },\n { threshold }\n );\n observer.observe(el);\n observerCleanup = () => observer.disconnect();\n });\n\n onUnmounted(() => observerCleanup?.());\n\n const animClass = computed(() =>\n state.value === 'playing' ? 'px-anim-enabled px-anim-playing' :\n state.value === 'paused' ? 'px-anim-enabled' : ''\n );\n\n const handlers = computed(() =>\n props.startOn === 'mouseOver' ? {\n onMouseenter: () => { state.value = 'playing'; },\n onMouseleave: goOut,\n } :\n props.startOn === 'click' ? {\n onClick: () => state.value === 'playing' ? goOut() : (state.value = 'playing'),\n } : {}\n );\n\n return () => h('div', {\n ref: divRef,\n ...attrs,\n class: [attrs.class, animClass.value],\n ...handlers.value,\n }, slots.default?.());\n },\n});\n\nexport default PixodeskSvgCssAnimator;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOA,8BAA6I;AAC7I,+BAA2M;AAC3M,sBAA6G;AAC7G,iBAGO;AAMP,IAAM,WAAW,EAAE,KAAK,MAAM;AAsB9B,SAAS,iBAAiB,aAAmC,MAAqB;AAC9E,QAAM,kBAAkB,oBAAI,IAAY;AAExC,QAAM,UAA6B;AAAA,IAC/B,aAAa,MAAM;AAAA,IACnB,cAAc,CAAC,IAAI,UAAU,UAAU;AACnC,qBAAW,8CAA6B,QAAQ;AAEhD,YAAM,UAAU,YAAY,IAAI,EAAE;AAElC,UAAI,CAAC,WAAW,CAAC,gBAAgB,IAAI,EAAE,GAAG;AACtC,wBAAgB,IAAI,EAAE;AACtB,aAAK,KAAK,yCAAiB,MAAM,6CAA6C,KAAK,GAAG;AAAA,MAC1F;AAEA,UAAI,SAAS;AACT,gBAAQ,aAAa,UAAU,KAAK;AACpC,YAAI,oCAAoB,IAAI,QAAQ,GAAG;AACnC,UAAC,QAAwB,MAAM,QAAe,IAAI;AAAA,QACtD;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACA,SAAO;AACX;AAcA,SAAS,kBACL,KACA,OACA,UACA,MACqB;AASrB,QAAM,EAAE,UAAU,eAAe,UAAU,OAAO,YAAY,QAAQ,IAAI;AAC1E,QAAM,Y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AU,WAAW;AAG7C,YAAM,YAAY,MAAM;AACxB,YAAM,UAAU,CAAC,UACb,YAAY,IAAI,MAAM,qBAAqB,YAAY,MAAM;AACjE,YAAM,WAAW,IAAI;AAAA,QACjB,CAAC,CAAC,KAAK,MAAM;AAAE,gBAAM,QAAQ,QAAQ,KAAK,IAAI,YAAY;AAAA,QAAU;AAAA,QACpE,EAAE,UAAU;AAAA,MAChB;AACA,eAAS,QAAQ,EAAE;AACnB,wBAAkB,MAAM,SAAS,WAAW;AAAA,IAChD,CAAC;AAED,iCAAY,MAAM,kBAAkB,CAAC;AAErC,UAAM,gBAAY;AAAA,MAAS,MACvB,MAAM,UAAU,YAAY,oCAC5B,MAAM,UAAU,WAAY,oBAAoB;AAAA,IACpD;AAEA,UAAM,eAAW;AAAA,MAAS,MACtB,MAAM,YAAY,cAAc;AAAA,QAC5B,cAAc,MAAM;AAAE,gBAAM,QAAQ;AAAA,QAAW;AAAA,QAC/C,cAAc;AAAA,MAClB,IACA,MAAM,YAAY,UAAU;AAAA,QACxB,SAAS,MAAM,MAAM,UAAU,YAAY,MAAM,IAAK,MAAM,QAAQ;AAAA,MACxE,IAAI,CAAC;AAAA,IACT;AAEA,WAAO,UAAM,eAAE,OAAO;AAAA,MAClB,KAAK;AAAA,MACL,GAAG;AAAA,MACH,OAAO,CAAC,MAAM,OAAO,UAAU,KAAK;AAAA,MACpC,GAAG,SAAS;AAAA,IAChB,GAAG,MAAM,UAAU,CAAC;AAAA,EACxB;AACJ,CAAC;AAED,IAAO,iCAAQ;","names":["import_svg_animator_core","import_vue"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, VNode } from 'vue';
|
|
3
|
-
import { PxAnimatedSvgDocument, PxTimelinePatch, PxDiagnostic
|
|
3
|
+
import { PxAnimatedSvgDocument, PxTimelinePatch, PxDiagnostic } from '@pixodesk/svg-animator-web';
|
|
4
|
+
import { PxAnimatorHandle, PxStartOn, PxOutAction } from '@pixodesk/svg-animator-core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The imperative handle the template ref exposes — core's `PxAnimatorHandle` under this
|
|
7
8
|
* package's name (review §9). One definition for React, Vue and React Native.
|
|
9
|
+
* @public
|
|
8
10
|
*/
|
|
9
11
|
type VueAnimatorApi = PxAnimatorHandle;
|
|
10
12
|
/**
|
|
@@ -33,6 +35,7 @@ type VueAnimatorApi = PxAnimatorHandle;
|
|
|
33
35
|
* <PixodeskSvgAnimator :doc="animation" :progress="0.5" />
|
|
34
36
|
* <PixodeskSvgAnimator :doc="animation" :time="500" />
|
|
35
37
|
* ```
|
|
38
|
+
* @public
|
|
36
39
|
*/
|
|
37
40
|
declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
38
41
|
doc: {
|
|
@@ -82,8 +85,12 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
82
85
|
onError: {
|
|
83
86
|
type: PropType<(diagnostic: PxDiagnostic) => void>;
|
|
84
87
|
};
|
|
85
|
-
|
|
86
|
-
type:
|
|
88
|
+
muteWarn: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
muteError: {
|
|
93
|
+
type: BooleanConstructor;
|
|
87
94
|
default: undefined;
|
|
88
95
|
};
|
|
89
96
|
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
@@ -136,8 +143,12 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
136
143
|
onError: {
|
|
137
144
|
type: PropType<(diagnostic: PxDiagnostic) => void>;
|
|
138
145
|
};
|
|
139
|
-
|
|
140
|
-
type:
|
|
146
|
+
muteWarn: {
|
|
147
|
+
type: BooleanConstructor;
|
|
148
|
+
default: undefined;
|
|
149
|
+
};
|
|
150
|
+
muteError: {
|
|
151
|
+
type: BooleanConstructor;
|
|
141
152
|
default: undefined;
|
|
142
153
|
};
|
|
143
154
|
}>> & Readonly<{
|
|
@@ -152,7 +163,8 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
152
163
|
pause: boolean;
|
|
153
164
|
autoplay: boolean;
|
|
154
165
|
resetTimeline: boolean;
|
|
155
|
-
|
|
166
|
+
muteWarn: boolean;
|
|
167
|
+
muteError: boolean;
|
|
156
168
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
157
169
|
|
|
158
170
|
/**
|
|
@@ -198,6 +210,7 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
198
210
|
* @prop scrollIntoViewThreshold - For `'scrollIntoView'`: how much of the element must be
|
|
199
211
|
* visible (0–1) before it starts, and below which the out action applies. Defaults to the
|
|
200
212
|
* wire default (`0`, any pixel) — the same as the JSON player, not a private `0.1`.
|
|
213
|
+
* @public
|
|
201
214
|
*/
|
|
202
215
|
declare const PixodeskSvgCssAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
203
216
|
startOn: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, VNode } from 'vue';
|
|
3
|
-
import { PxAnimatedSvgDocument, PxTimelinePatch, PxDiagnostic
|
|
3
|
+
import { PxAnimatedSvgDocument, PxTimelinePatch, PxDiagnostic } from '@pixodesk/svg-animator-web';
|
|
4
|
+
import { PxAnimatorHandle, PxStartOn, PxOutAction } from '@pixodesk/svg-animator-core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The imperative handle the template ref exposes — core's `PxAnimatorHandle` under this
|
|
7
8
|
* package's name (review §9). One definition for React, Vue and React Native.
|
|
9
|
+
* @public
|
|
8
10
|
*/
|
|
9
11
|
type VueAnimatorApi = PxAnimatorHandle;
|
|
10
12
|
/**
|
|
@@ -33,6 +35,7 @@ type VueAnimatorApi = PxAnimatorHandle;
|
|
|
33
35
|
* <PixodeskSvgAnimator :doc="animation" :progress="0.5" />
|
|
34
36
|
* <PixodeskSvgAnimator :doc="animation" :time="500" />
|
|
35
37
|
* ```
|
|
38
|
+
* @public
|
|
36
39
|
*/
|
|
37
40
|
declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
38
41
|
doc: {
|
|
@@ -82,8 +85,12 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
82
85
|
onError: {
|
|
83
86
|
type: PropType<(diagnostic: PxDiagnostic) => void>;
|
|
84
87
|
};
|
|
85
|
-
|
|
86
|
-
type:
|
|
88
|
+
muteWarn: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
muteError: {
|
|
93
|
+
type: BooleanConstructor;
|
|
87
94
|
default: undefined;
|
|
88
95
|
};
|
|
89
96
|
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
@@ -136,8 +143,12 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
136
143
|
onError: {
|
|
137
144
|
type: PropType<(diagnostic: PxDiagnostic) => void>;
|
|
138
145
|
};
|
|
139
|
-
|
|
140
|
-
type:
|
|
146
|
+
muteWarn: {
|
|
147
|
+
type: BooleanConstructor;
|
|
148
|
+
default: undefined;
|
|
149
|
+
};
|
|
150
|
+
muteError: {
|
|
151
|
+
type: BooleanConstructor;
|
|
141
152
|
default: undefined;
|
|
142
153
|
};
|
|
143
154
|
}>> & Readonly<{
|
|
@@ -152,7 +163,8 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
152
163
|
pause: boolean;
|
|
153
164
|
autoplay: boolean;
|
|
154
165
|
resetTimeline: boolean;
|
|
155
|
-
|
|
166
|
+
muteWarn: boolean;
|
|
167
|
+
muteError: boolean;
|
|
156
168
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
157
169
|
|
|
158
170
|
/**
|
|
@@ -198,6 +210,7 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
198
210
|
* @prop scrollIntoViewThreshold - For `'scrollIntoView'`: how much of the element must be
|
|
199
211
|
* visible (0–1) before it starts, and below which the out action applies. Defaults to the
|
|
200
212
|
* wire default (`0`, any pixel) — the same as the JSON player, not a private `0.1`.
|
|
213
|
+
* @public
|
|
201
214
|
*/
|
|
202
215
|
declare const PixodeskSvgCssAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
203
216
|
startOn: {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
var Vue = window.Vue; var PixodeskAnimatorWeb = window.PixodeskAnimator;
|
|
2
2
|
|
|
3
3
|
// src/PixodeskSvgAnimator.ts
|
|
4
|
-
import {
|
|
4
|
+
import { createAnimator, generateNewIds, toDomProps, PxDiagnosticKind } from "@pixodesk/svg-animator-web";
|
|
5
|
+
import { applyAnimatorConfig, foldTimelineOverride, getAnimatorConfig, PxControlMode, resolveControlMode, controlModeTakesOverTrigger, progressToTimeMs } from "@pixodesk/svg-animator-core";
|
|
6
|
+
import { camelCaseToKebabWordIfNeeded, createDiagnostics, PX_STYLE_ATTR_NAMES, PX_DEFAULT_DURATION_MS } from "@pixodesk/svg-animator-core/internal";
|
|
5
7
|
import {
|
|
6
8
|
computed,
|
|
7
9
|
defineComponent,
|
|
@@ -25,7 +27,7 @@ function createVueAdapter(elementRefs, diag) {
|
|
|
25
27
|
}
|
|
26
28
|
if (element) {
|
|
27
29
|
element.setAttribute(attrName, value);
|
|
28
|
-
if (
|
|
30
|
+
if (PX_STYLE_ATTR_NAMES.has(attrName)) {
|
|
29
31
|
element.style[attrName] = value;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -44,7 +46,7 @@ function applyDocOverrides(doc, props, compMode, diag) {
|
|
|
44
46
|
}
|
|
45
47
|
} : patch;
|
|
46
48
|
if (fullPatch !== void 0 || resetTimeline) {
|
|
47
|
-
const applied = applyAnimatorConfig(doc, fullPatch ?? {}, {
|
|
49
|
+
const applied = applyAnimatorConfig(doc, fullPatch ?? {}, { resetTimeline: !!resetTimeline });
|
|
48
50
|
for (const w of applied.warnings) diag.warn(PxDiagnosticKind.usage, "timeline override: " + w);
|
|
49
51
|
doc = applied.doc;
|
|
50
52
|
}
|
|
@@ -56,7 +58,7 @@ function calcSeekMs(doc, props) {
|
|
|
56
58
|
if (props.progress !== void 0) {
|
|
57
59
|
const iterationsValue = props.iterations ?? animator.iterations;
|
|
58
60
|
const iterationsCount = iterationsValue === "infinite" ? Infinity : typeof iterationsValue === "number" && iterationsValue >= 1 ? iterationsValue : 1;
|
|
59
|
-
const singleDuration = props.duration ?? animator.duration ??
|
|
61
|
+
const singleDuration = props.duration ?? animator.duration ?? PX_DEFAULT_DURATION_MS;
|
|
60
62
|
seekMs = progressToTimeMs(props.progress, singleDuration, iterationsCount);
|
|
61
63
|
}
|
|
62
64
|
if (props.time !== void 0) seekMs = props.time;
|
|
@@ -89,16 +91,17 @@ var PixodeskSvgAnimator = defineComponent({
|
|
|
89
91
|
// speaks by default — the same contract as React and React Native.
|
|
90
92
|
onWarn: { type: Function },
|
|
91
93
|
onError: { type: Function },
|
|
92
|
-
// `
|
|
93
|
-
//
|
|
94
|
-
|
|
94
|
+
// `muteWarn` / `muteError` switch the console fallback off — for a host that knows
|
|
95
|
+
// about the warnings and tolerates them; a handler you passed still fires.
|
|
96
|
+
muteWarn: { type: Boolean, default: void 0 },
|
|
97
|
+
muteError: { type: Boolean, default: void 0 }
|
|
95
98
|
},
|
|
96
99
|
emits: ["play", "stop", "pause", "cancel", "finish", "remove"],
|
|
97
100
|
setup(props, { expose, emit }) {
|
|
98
101
|
const elementRefs = /* @__PURE__ */ new Map();
|
|
99
102
|
const apiRef = shallowRef(null);
|
|
100
103
|
const makeDiag = () => createDiagnostics(
|
|
101
|
-
{ onWarn: props.onWarn, onError: props.onError,
|
|
104
|
+
{ onWarn: props.onWarn, onError: props.onError, muteWarn: props.muteWarn, muteError: props.muteError },
|
|
102
105
|
"[PixodeskSvgAnimator]"
|
|
103
106
|
);
|
|
104
107
|
const resolvedMode = computed(() => resolveControlMode({
|
|
@@ -120,7 +123,7 @@ var PixodeskSvgAnimator = defineComponent({
|
|
|
120
123
|
function renderNode(node) {
|
|
121
124
|
if (!node) return null;
|
|
122
125
|
const { type, animate, meta, children, ...attrs } = node;
|
|
123
|
-
const normProps =
|
|
126
|
+
const normProps = toDomProps(attrs);
|
|
124
127
|
if (node.id) {
|
|
125
128
|
const nodeId = node.id;
|
|
126
129
|
normProps[VUE_PROP.ref] = (el) => {
|
|
@@ -139,7 +142,7 @@ var PixodeskSvgAnimator = defineComponent({
|
|
|
139
142
|
destroyApi();
|
|
140
143
|
const doc = resolvedDoc.value;
|
|
141
144
|
if (!doc) return;
|
|
142
|
-
|
|
145
|
+
const options = {
|
|
143
146
|
doc,
|
|
144
147
|
adapter: createVueAdapter(elementRefs, makeDiag()),
|
|
145
148
|
onPlay: () => emit("play"),
|
|
@@ -151,8 +154,10 @@ var PixodeskSvgAnimator = defineComponent({
|
|
|
151
154
|
// The player's own diagnostics reach the same handlers as the component's.
|
|
152
155
|
onWarn: props.onWarn,
|
|
153
156
|
onError: props.onError,
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
muteWarn: props.muteWarn,
|
|
158
|
+
muteError: props.muteError
|
|
159
|
+
};
|
|
160
|
+
apiRef.value = createAnimator(options);
|
|
156
161
|
syncPlayState();
|
|
157
162
|
applySeek();
|
|
158
163
|
}
|
|
@@ -211,7 +216,7 @@ var PixodeskSvgAnimator = defineComponent({
|
|
|
211
216
|
var PixodeskSvgAnimator_default = PixodeskSvgAnimator;
|
|
212
217
|
|
|
213
218
|
// src/PixodeskSvgCssAnimator.ts
|
|
214
|
-
import { PX_TRIGGER_DEFAULTS } from "@pixodesk/svg-animator-
|
|
219
|
+
import { PX_TRIGGER_DEFAULTS } from "@pixodesk/svg-animator-core";
|
|
215
220
|
import { computed as computed2, defineComponent as defineComponent2, h as h2, onMounted as onMounted2, onUnmounted as onUnmounted2, ref as ref2, useAttrs } from "vue";
|
|
216
221
|
var PixodeskSvgCssAnimator = defineComponent2({
|
|
217
222
|
name: "PixodeskSvgCssAnimator",
|