@pixodesk/svg-animator-web 1.0.40 → 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 CHANGED
@@ -107,9 +107,9 @@ const animator = createAnimator({
107
107
  animator.play();
108
108
  ```
109
109
 
110
- It returns a `PxAnimatorAPI`:
110
+ It returns a `PxAnimatorApi`:
111
111
 
112
- <!-- px-check props PxAnimatorAPI pkg=web -->
112
+ <!-- px-check props PxAnimatorApi pkg=web -->
113
113
  | Method | Description |
114
114
  | ----------------------- | ----------------------------------------------------------------- |
115
115
  | `play()` | Start or resume playback |
@@ -162,8 +162,16 @@ Elements may also carry a `node.effects` bucket (structural effects such as
162
162
  `strokeGradient`, `textPath`). This player materializes and removes them at
163
163
  runtime before any other normalization.
164
164
 
165
+ When you want the markup without a player — a static first frame, a thumbnail, a snapshot —
166
+ `renderNode` is that one step on its own: hand it a node and it returns the DOM element for it, or
167
+ `null` when the node renders to nothing. Give it the document's `animator.definitions` as the
168
+ second argument so named fonts resolve, and a diagnostics channel as the third to hear about
169
+ anything it skips. It renders; it does not animate. `toDomProps(props)` is the attribute half of
170
+ that step on its own: a node's attributes, resolved to what the DOM receives.
171
+
165
172
  See the [JSON format reference](../../docs/format/README.md#json-format-reference) and
166
173
  [Player effects](../../docs/format/README.md#player-effects) for the full schema and
167
- examples (compact printable schema: [SCHEMA.md](../../SCHEMA.md)). The wire
168
- types live in [`PxAnimatorTypes.ts`](../svg-animator-core/src/format/PxAnimatorTypes.ts).
174
+ examples, and [Schema at a glance](../../docs/format/README.md#schema-at-a-glance) for the whole
175
+ format as typings. The wire types live in
176
+ [`PxAnimatorTypes.ts`](../svg-animator-core/src/format/PxAnimatorTypes.ts).
169
177
 
@@ -1,4 +1,4 @@
1
- import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxPlaybackOverrideProps, PxAnimatorCallbacks, PxAnimatedSvgDocument, PxPlatformAdapter } from '@pixodesk/svg-animator-core';
1
+ import { PxAnimatorApi as PxAnimatorApi$1, PxPlaybackApi as PxPlaybackApi$1, PxPlaybackOverride, PxAnimatorCallbacks, PxAnimatedSvgDocument, PxPlatformAdapter } from '@pixodesk/svg-animator-core';
2
2
 
3
3
  /**
4
4
  * DOM specializations of the platform-neutral animator API types.
@@ -6,30 +6,9 @@ import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimator
6
6
  * the historical (pre-core-extraction) signatures for web consumers.
7
7
  * @public
8
8
  */
9
- type PxBasicAnimatorAPI = PxBasicAnimatorAPI$1<Element>;
9
+ type PxPlaybackApi = PxPlaybackApi$1<Element>;
10
10
  /** @public */
11
- type PxAnimatorAPI = PxAnimatorAPI$1<Element>;
12
-
13
- /**
14
- * Wire keys shared by every entry point.
15
- *
16
- * These live here rather than in `PxAnimator.ts` on purpose: that module used to end with a
17
- * top-level `if (typeof window !== 'undefined')` block publishing `createAnimator` /
18
- * `loadTagAnimators` as globals. A module-level side effect cannot be tree-shaken, so
19
- * importing ANY symbol from `PxAnimator.ts` pulled the entire full player in with it —
20
- * which silently made the pre-rendered builds the same size as the full one until this
21
- * constant was moved out. See PRERENDERED-PLAYER-BUILDS.md.
22
- *
23
- * That block is gone (API review §4) and the package now declares `"sideEffects": false`, but
24
- * keeping these here costs nothing and removes the trap for good.
25
- */
26
- /**
27
- * Key under which `createAnimator` options carry the inline animation document. The editor
28
- * writes it into every exported SVG+JS — `createAnimator({"doc": …})` — so it is part of the
29
- * export format, which is why it is a named constant and not a literal.
30
- * @internal
31
- */
32
- declare const PX_ANIMATOR_DOC_KEY = "doc";
11
+ type PxAnimatorApi = PxAnimatorApi$1<Element>;
33
12
 
34
13
  /**
35
14
  * Everything `createAnimator` takes. The playback override (`timeline`, `resetTimeline` and the
@@ -38,10 +17,10 @@ declare const PX_ANIMATOR_DOC_KEY = "doc";
38
17
  * declared here.
39
18
  * @public
40
19
  */
41
- interface PxAnimatorOptions extends PxPlaybackOverrideProps, PxAnimatorCallbacks {
20
+ interface PxAnimatorOptions extends PxPlaybackOverride, PxAnimatorCallbacks {
42
21
  /** URL to fetch the animation document from. Provide either this or `doc`, not both. */
43
22
  src?: string;
44
- /** The animation document, inline (see SCHEMA.md). Provide either this or `src`, not both. */
23
+ /** The animation document, inline (see docs/format/README.md). Provide either this or `src`, not both. */
45
24
  doc?: PxAnimatedSvgDocument;
46
25
  /** CSS selector or element to render the SVG into. */
47
26
  container?: string | Element;
@@ -66,10 +45,10 @@ interface PxInternalAnimatorOptions extends PxAnimatorOptions {
66
45
  * @param options.src URL to fetch the animation document from.
67
46
  * @param options.doc The animation document, inline.
68
47
  * @param options.container CSS selector or element to render the SVG into.
69
- * @returns A PxAnimatorAPI instance to programmatically control the animation.
48
+ * @returns A PxAnimatorApi instance to programmatically control the animation.
70
49
  * @public
71
50
  */
72
- declare function createAnimator(options: PxAnimatorOptions): PxAnimatorAPI;
51
+ declare function createAnimator(options: PxAnimatorOptions): PxAnimatorApi;
73
52
  /**
74
53
  * Scan and load for tags, e.g.
75
54
  * <div data-px-animation-src="animation.json"></div>
@@ -91,4 +70,4 @@ type PxTagAnimatorOptions = Omit<PxAnimatorOptions, 'src' | 'doc' | 'container'>
91
70
  */
92
71
  declare function loadTagAnimators(options?: PxTagAnimatorOptions): void;
93
72
 
94
- export { type PxAnimatorAPI as P, PX_ANIMATOR_DOC_KEY as a, type PxAnimatorOptions as b, type PxBasicAnimatorAPI as c, type PxInternalAnimatorOptions as d, type PxTagAnimatorOptions as e, createAnimator as f, loadTagAnimators as l };
73
+ export { type PxAnimatorApi as P, type PxAnimatorOptions as a, type PxPlaybackApi as b, type PxTagAnimatorOptions as c, createAnimator as d, type PxInternalAnimatorOptions as e, loadTagAnimators as l };
@@ -1,4 +1,4 @@
1
- import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxPlaybackOverrideProps, PxAnimatorCallbacks, PxAnimatedSvgDocument, PxPlatformAdapter } from '@pixodesk/svg-animator-core';
1
+ import { PxAnimatorApi as PxAnimatorApi$1, PxPlaybackApi as PxPlaybackApi$1, PxPlaybackOverride, PxAnimatorCallbacks, PxAnimatedSvgDocument, PxPlatformAdapter } from '@pixodesk/svg-animator-core';
2
2
 
3
3
  /**
4
4
  * DOM specializations of the platform-neutral animator API types.
@@ -6,30 +6,9 @@ import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimator
6
6
  * the historical (pre-core-extraction) signatures for web consumers.
7
7
  * @public
8
8
  */
9
- type PxBasicAnimatorAPI = PxBasicAnimatorAPI$1<Element>;
9
+ type PxPlaybackApi = PxPlaybackApi$1<Element>;
10
10
  /** @public */
11
- type PxAnimatorAPI = PxAnimatorAPI$1<Element>;
12
-
13
- /**
14
- * Wire keys shared by every entry point.
15
- *
16
- * These live here rather than in `PxAnimator.ts` on purpose: that module used to end with a
17
- * top-level `if (typeof window !== 'undefined')` block publishing `createAnimator` /
18
- * `loadTagAnimators` as globals. A module-level side effect cannot be tree-shaken, so
19
- * importing ANY symbol from `PxAnimator.ts` pulled the entire full player in with it —
20
- * which silently made the pre-rendered builds the same size as the full one until this
21
- * constant was moved out. See PRERENDERED-PLAYER-BUILDS.md.
22
- *
23
- * That block is gone (API review §4) and the package now declares `"sideEffects": false`, but
24
- * keeping these here costs nothing and removes the trap for good.
25
- */
26
- /**
27
- * Key under which `createAnimator` options carry the inline animation document. The editor
28
- * writes it into every exported SVG+JS — `createAnimator({"doc": …})` — so it is part of the
29
- * export format, which is why it is a named constant and not a literal.
30
- * @internal
31
- */
32
- declare const PX_ANIMATOR_DOC_KEY = "doc";
11
+ type PxAnimatorApi = PxAnimatorApi$1<Element>;
33
12
 
34
13
  /**
35
14
  * Everything `createAnimator` takes. The playback override (`timeline`, `resetTimeline` and the
@@ -38,10 +17,10 @@ declare const PX_ANIMATOR_DOC_KEY = "doc";
38
17
  * declared here.
39
18
  * @public
40
19
  */
41
- interface PxAnimatorOptions extends PxPlaybackOverrideProps, PxAnimatorCallbacks {
20
+ interface PxAnimatorOptions extends PxPlaybackOverride, PxAnimatorCallbacks {
42
21
  /** URL to fetch the animation document from. Provide either this or `doc`, not both. */
43
22
  src?: string;
44
- /** The animation document, inline (see SCHEMA.md). Provide either this or `src`, not both. */
23
+ /** The animation document, inline (see docs/format/README.md). Provide either this or `src`, not both. */
45
24
  doc?: PxAnimatedSvgDocument;
46
25
  /** CSS selector or element to render the SVG into. */
47
26
  container?: string | Element;
@@ -66,10 +45,10 @@ interface PxInternalAnimatorOptions extends PxAnimatorOptions {
66
45
  * @param options.src URL to fetch the animation document from.
67
46
  * @param options.doc The animation document, inline.
68
47
  * @param options.container CSS selector or element to render the SVG into.
69
- * @returns A PxAnimatorAPI instance to programmatically control the animation.
48
+ * @returns A PxAnimatorApi instance to programmatically control the animation.
70
49
  * @public
71
50
  */
72
- declare function createAnimator(options: PxAnimatorOptions): PxAnimatorAPI;
51
+ declare function createAnimator(options: PxAnimatorOptions): PxAnimatorApi;
73
52
  /**
74
53
  * Scan and load for tags, e.g.
75
54
  * <div data-px-animation-src="animation.json"></div>
@@ -91,4 +70,4 @@ type PxTagAnimatorOptions = Omit<PxAnimatorOptions, 'src' | 'doc' | 'container'>
91
70
  */
92
71
  declare function loadTagAnimators(options?: PxTagAnimatorOptions): void;
93
72
 
94
- export { type PxAnimatorAPI as P, PX_ANIMATOR_DOC_KEY as a, type PxAnimatorOptions as b, type PxBasicAnimatorAPI as c, type PxInternalAnimatorOptions as d, type PxTagAnimatorOptions as e, createAnimator as f, loadTagAnimators as l };
73
+ export { type PxAnimatorApi as P, type PxAnimatorOptions as a, type PxPlaybackApi as b, type PxTagAnimatorOptions as c, createAnimator as d, type PxInternalAnimatorOptions as e, loadTagAnimators as l };
@@ -39,4 +39,4 @@ export {
39
39
  __objRest,
40
40
  PX_ANIMATOR_DOC_KEY
41
41
  };
42
- //# sourceMappingURL=chunk-TNWZIIVG.js.map
42
+ //# sourceMappingURL=chunk-BYDBNKO7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/PxAnimatorKeys.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\n/**\n * Wire keys shared by every entry point.\n *\n * These live here rather than in `PxAnimator.ts` on purpose: that module used to end with a\n * top-level `if (typeof window !== 'undefined')` block publishing `createAnimator` /\n * `loadTagAnimators` as globals. A module-level side effect cannot be tree-shaken, so\n * importing ANY symbol from `PxAnimator.ts` pulled the entire full player in with it —\n * which silently made the pre-rendered builds the same size as the full one until this\n * constant was moved out. See dev-docs/plans/prerendered-player-builds.md.\n *\n * That block is gone (API review §4) and the package now declares `\"sideEffects\": false`, but\n * keeping these here costs nothing and removes the trap for good.\n */\n\n/**\n * Key under which `createAnimator` options carry the inline animation document. The editor\n * writes it into every exported SVG+JS — `createAnimator({\"doc\": …})` — so it is part of the\n * export format, which is why it is a named constant and not a literal.\n * @internal\n */\nexport const PX_ANIMATOR_DOC_KEY = 'doc';\n\n/** Key under which `createAnimator` options carry the per-instance `timeline` override. */\nexport const PX_ANIMATOR_TIMELINE_KEY = 'timeline';\n\n/** Key that makes the override start from the player's default timeline instead of the document's. */\nexport const PX_ANIMATOR_RESET_KEY = 'resetTimeline';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAM,sBAAsB;","names":[]}