@pixodesk/svg-animator-web 1.0.43 → 1.0.45

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.
@@ -1,5 +1,5 @@
1
- export { e as PxInternalAnimatorOptions } from './PxAnimator-yjuSFhQw.cjs';
2
- import '@pixodesk/svg-animator-core';
1
+ export { e as PxInternalAnimatorOptions } from './PxAnimator-BS-SZULN.cjs';
2
+ import { resolveTrigger } from '@pixodesk/svg-animator-core';
3
3
 
4
4
  /**
5
5
  * Wire keys shared by every entry point.
@@ -22,4 +22,52 @@ import '@pixodesk/svg-animator-core';
22
22
  */
23
23
  declare const PX_ANIMATOR_DOC_KEY = "doc";
24
24
 
25
- export { PX_ANIMATOR_DOC_KEY };
25
+ /**
26
+ * THE VISIBILITY GATE — permission to run, separate from whatever starts the animation.
27
+ *
28
+ * `trigger.start` says what STARTS an animation; this says whether it may RUN. The two are
29
+ * independent, so "start on click, but pause while scrolled away" is sayable, and the common
30
+ * document says neither and gets both defaults: start on load, pause off screen.
31
+ *
32
+ * Three rules decide everything here:
33
+ * - OPEN at `visibilityThreshold`, CLOSE only at zero visibility. One value, two edges, so a
34
+ * graphic resting on the boundary cannot flap between playing and paused.
35
+ * - A pending open waits `visibilityDebounce` ms and is cancelled if visibility falls back below
36
+ * the threshold, so scrolling straight past a graphic starts nothing.
37
+ * - A hidden TAB is off screen. `IntersectionObserver` never fires for a hidden tab, so
38
+ * `visibilitychange` feeds the same state.
39
+ *
40
+ * FAILS OPEN. No `IntersectionObserver` (jsdom, SSR, an old engine) means the animation plays as
41
+ * if fully visible. A page that cannot measure is better off animating than frozen, and failing
42
+ * closed would silently stop every animation in environments that never had the API.
43
+ */
44
+ /** The resolved trigger, as this module reads it — the shape `resolveTrigger` returns, named
45
+ * here rather than exported from core so the public surface gains nothing. @internal */
46
+ type PxGateTrigger = ReturnType<typeof resolveTrigger>;
47
+ /** What the gate drives. The animator API, narrowed to what is actually needed. @internal */
48
+ interface PxGateHost {
49
+ isPlaying(): boolean;
50
+ play(): void;
51
+ pause(): void;
52
+ cancel(): void;
53
+ }
54
+ /** Permission to run, wired by `setupAnimationTriggers` for every document. @internal */
55
+ interface PxVisibilityGate {
56
+ /** A trigger fired. `immediate` skips the gate for a direct interaction (a click or a hover
57
+ * happens on something the reader can already see, and must never wait out a timer). */
58
+ requestStart(immediate: boolean): void;
59
+ /** Detaches the observer, the listener and any pending timer. */
60
+ dispose(): void;
61
+ }
62
+ /** The gate's own half of `PX_TRIGGER_DEFAULTS`, for a caller that has props rather than a
63
+ * document (the CSS-only React and Vue wrappers). @internal */
64
+ declare const PLAY_WHEN_VISIBLE_DEFAULTS: {
65
+ readonly offScreen: "pause";
66
+ readonly visibilityThreshold: 0.5;
67
+ readonly visibilityDebounce: 150;
68
+ };
69
+ /** Builds the gate for one document. Returns an always-open one when visibility does not govern
70
+ * it, or when nothing can measure. @internal */
71
+ declare function createVisibilityGate(root: Element, trigger: PxGateTrigger, host: PxGateHost): PxVisibilityGate;
72
+
73
+ export { PLAY_WHEN_VISIBLE_DEFAULTS, PX_ANIMATOR_DOC_KEY, type PxGateHost, type PxGateTrigger, type PxVisibilityGate, createVisibilityGate };
@@ -1,5 +1,5 @@
1
- export { e as PxInternalAnimatorOptions } from './PxAnimator-yjuSFhQw.js';
2
- import '@pixodesk/svg-animator-core';
1
+ export { e as PxInternalAnimatorOptions } from './PxAnimator-BS-SZULN.js';
2
+ import { resolveTrigger } from '@pixodesk/svg-animator-core';
3
3
 
4
4
  /**
5
5
  * Wire keys shared by every entry point.
@@ -22,4 +22,52 @@ import '@pixodesk/svg-animator-core';
22
22
  */
23
23
  declare const PX_ANIMATOR_DOC_KEY = "doc";
24
24
 
25
- export { PX_ANIMATOR_DOC_KEY };
25
+ /**
26
+ * THE VISIBILITY GATE — permission to run, separate from whatever starts the animation.
27
+ *
28
+ * `trigger.start` says what STARTS an animation; this says whether it may RUN. The two are
29
+ * independent, so "start on click, but pause while scrolled away" is sayable, and the common
30
+ * document says neither and gets both defaults: start on load, pause off screen.
31
+ *
32
+ * Three rules decide everything here:
33
+ * - OPEN at `visibilityThreshold`, CLOSE only at zero visibility. One value, two edges, so a
34
+ * graphic resting on the boundary cannot flap between playing and paused.
35
+ * - A pending open waits `visibilityDebounce` ms and is cancelled if visibility falls back below
36
+ * the threshold, so scrolling straight past a graphic starts nothing.
37
+ * - A hidden TAB is off screen. `IntersectionObserver` never fires for a hidden tab, so
38
+ * `visibilitychange` feeds the same state.
39
+ *
40
+ * FAILS OPEN. No `IntersectionObserver` (jsdom, SSR, an old engine) means the animation plays as
41
+ * if fully visible. A page that cannot measure is better off animating than frozen, and failing
42
+ * closed would silently stop every animation in environments that never had the API.
43
+ */
44
+ /** The resolved trigger, as this module reads it — the shape `resolveTrigger` returns, named
45
+ * here rather than exported from core so the public surface gains nothing. @internal */
46
+ type PxGateTrigger = ReturnType<typeof resolveTrigger>;
47
+ /** What the gate drives. The animator API, narrowed to what is actually needed. @internal */
48
+ interface PxGateHost {
49
+ isPlaying(): boolean;
50
+ play(): void;
51
+ pause(): void;
52
+ cancel(): void;
53
+ }
54
+ /** Permission to run, wired by `setupAnimationTriggers` for every document. @internal */
55
+ interface PxVisibilityGate {
56
+ /** A trigger fired. `immediate` skips the gate for a direct interaction (a click or a hover
57
+ * happens on something the reader can already see, and must never wait out a timer). */
58
+ requestStart(immediate: boolean): void;
59
+ /** Detaches the observer, the listener and any pending timer. */
60
+ dispose(): void;
61
+ }
62
+ /** The gate's own half of `PX_TRIGGER_DEFAULTS`, for a caller that has props rather than a
63
+ * document (the CSS-only React and Vue wrappers). @internal */
64
+ declare const PLAY_WHEN_VISIBLE_DEFAULTS: {
65
+ readonly offScreen: "pause";
66
+ readonly visibilityThreshold: 0.5;
67
+ readonly visibilityDebounce: 150;
68
+ };
69
+ /** Builds the gate for one document. Returns an always-open one when visibility does not govern
70
+ * it, or when nothing can measure. @internal */
71
+ declare function createVisibilityGate(root: Element, trigger: PxGateTrigger, host: PxGateHost): PxVisibilityGate;
72
+
73
+ export { PLAY_WHEN_VISIBLE_DEFAULTS, PX_ANIMATOR_DOC_KEY, type PxGateHost, type PxGateTrigger, type PxVisibilityGate, createVisibilityGate };
package/dist/internal.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import {
2
- PX_ANIMATOR_DOC_KEY
3
- } from "./chunk-BYDBNKO7.js";
2
+ PLAY_WHEN_VISIBLE_DEFAULTS,
3
+ PX_ANIMATOR_DOC_KEY,
4
+ createVisibilityGate
5
+ } from "./chunk-QE7KJWAN.js";
4
6
  export {
5
- PX_ANIMATOR_DOC_KEY
7
+ PLAY_WHEN_VISIBLE_DEFAULTS,
8
+ PX_ANIMATOR_DOC_KEY,
9
+ createVisibilityGate
6
10
  };
7
11
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,a={};((e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})})(a,{PX_ANIMATOR_DOC_KEY:()=>c}),module.exports=(e=a,((e,a,c,p)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let c of o(a))n.call(e,c)||void 0===c||t(e,c,{get:()=>a[c],enumerable:!(p=r(a,c))||p.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c="doc";
1
+ var t,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={};((t,i)=>{for(var n in i)e(t,n,{get:i[n],enumerable:!0})})(s,{PLAY_WHEN_VISIBLE_DEFAULTS:()=>Ft,PX_ANIMATOR_DOC_KEY:()=>r,createVisibilityGate:()=>Wt}),module.exports=(t=s,((t,s,r,a)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let r of n(s))o.call(t,r)||void 0===r||e(t,r,{get:()=>s[r],enumerable:!(a=i(s,r))||a.enumerable});return t})(e({},"__esModule",{value:!0}),t));var r="doc",a=Object.defineProperty,l=Object.defineProperties,p=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,d=(t,e,i)=>e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,f=(t,e)=>{for(var i in e||(e={}))c.call(e,i)&&d(t,i,e[i]);if(u)for(var i of u(e))h.call(e,i)&&d(t,i,e[i]);return t},y=(t,e)=>l(t,p(e));function m(t){if(!t.length)return".";let e="";for(const i of t)i.startsWith("[")?e+=i:e+=(e?".":"")+i;return e}var g=class{_canSanitize(t){return this.isValid(t)}optional(){return new _(this)}},_=class extends g{constructor(t){super(),this.inner=t,this._default=void 0}sanitize(t){if(null!=t)return this.inner._canSanitize(t)?this.inner.sanitize(t):void 0}isValid(t,e,i){return null==t||this.inner.isValid(t,e,i)}_canSanitize(t){return null==t||this.inner._canSanitize(t)}},v=class extends g{constructor(t=""){super(),this._default=t}sanitize(t){return"string"==typeof t?t:this._default}isValid(t,e,i){return"string"==typeof t||(null==e||e.errors.push(m(null!=i?i:[])+": expected string, got "+typeof t),!1)}},b=class extends g{constructor(t=0){super(),this._default=t}sanitize(t){return"number"==typeof t&&isFinite(t)?t:this._default}isValid(t,e,i){return!("number"!=typeof t||!isFinite(t))||(null==e||e.errors.push(m(null!=i?i:[])+": expected finite number, got "+JSON.stringify(t)),!1)}},A=class extends g{constructor(t=!1){super(),this._default=t}sanitize(t){return"boolean"==typeof t?t:this._default}isValid(t,e,i){return"boolean"==typeof t||(null==e||e.errors.push(m(null!=i?i:[])+": expected boolean, got "+typeof t),!1)}},x=class extends g{constructor(t){super(),this.value=t,this._default=t}sanitize(t){return t===this.value?this.value:this._default}isValid(t,e,i){return t===this.value||(null==e||e.errors.push(m(null!=i?i:[])+": expected "+JSON.stringify(this.value)+", got "+JSON.stringify(t)),!1)}},S=class extends g{constructor(t,e){super(),this.values=t,this._default=null!=e?e:t[0]}sanitize(t){return this.values.includes(t)?t:this._default}isValid(t,e,i){return!!this.values.includes(t)||(null==e||e.errors.push(m(null!=i?i:[])+": expected one of "+this.values.map(t=>JSON.stringify(t)).join(" | ")+", got "+JSON.stringify(t)),!1)}},O=class extends g{constructor(t,e){super(),this.schemas=t,this._kind="union",this._default=null!=e?e:t[0]._default}sanitize(t){for(const e of this.schemas)if(e.isValid(t))return e.sanitize(t);return this._default}isValid(t,e,i){var n;const o=e&&{errors:[],warnings:[],strict:e.strict};if(this.schemas.some(e=>e.isValid(t,o,i?[...i]:void 0)))return!0;if(!e)return!1;const s=m(null!=i?i:[]);let r;e.errors.push(s+": no union member matched for value "+(null!=(n=JSON.stringify(t))?n:"").slice(0,240));let a=-1;const l=[];for(const n of this.schemas){const o={errors:[],warnings:[],strict:e.strict};if(n.isValid(t,o,i?[...i]:void 0),!o.errors.length)continue;const p=Math.max(...o.errors.map(t=>t.slice(0,t.indexOf(":")).length));if((p>a||p===a&&r&&o.errors.length<r.length)&&(a=p,r=o.errors),p<=s.length)for(const t of o.errors){const e=/: expected (.+?), got /.exec(t);e&&!l.includes(e[1])&&l.push(e[1])}}if(r&&a>s.length)for(const t of r.slice(0,4))e.errors.includes(t)||e.errors.push(t);else l.length&&e.errors.push(s+": expected "+l.join(" | "));return!1}_canSanitize(t){return this.schemas.some(e=>e._canSanitize(t))}},j=class extends g{constructor(t){super(),this._shape=t;const e={};for(const i of Object.keys(t))e[i]=t[i]._default;this._default=e}sanitize(t){const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},i={};for(const t of Object.keys(this._shape)){const n=this._shape[t].sanitize(e[t]);void 0!==n&&(i[t]=n)}return i}isValid(t,e,i){if(!t||"object"!=typeof t||Array.isArray(t))return null==e||e.errors.push(m(null!=i?i:[])+": expected object, got "+(Array.isArray(t)?"array":typeof t)),!1;const n=t,o=null!=i?i:[];let s=!0;for(const t of Object.keys(this._shape))o.push(t),this._shape[t].isValid(n[t],e,o)||(s=!1),o.pop();if(null==e?void 0:e.strict)for(const t of Object.keys(n))t in this._shape||void 0!==n[t]&&(o.push(t),e.errors.push(m(o)+": unexpected extra key"),o.pop(),s=!1);return s}_canSanitize(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}},w=class extends g{constructor(t,e){super(),this._shape=t,this._openSchema=e;const i={};for(const e of Object.keys(t))i[e]=t[e]._default;this._default=i}sanitize(t){const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},i=f({},e);for(const t of Object.keys(this._shape)){const n=this._shape[t].sanitize(e[t]);void 0!==n&&(i[t]=n)}if(this._openSchema)for(const t of Object.keys(e))t in this._shape||(i[t]=this._openSchema.sanitize(e[t]));return i}isValid(t,e,i){if(!t||"object"!=typeof t||Array.isArray(t))return null==e||e.errors.push(m(null!=i?i:[])+": expected object, got "+(Array.isArray(t)?"array":typeof t)),!1;const n=t,o=null!=i?i:[];let s=!0;for(const t of Object.keys(this._shape))o.push(t),this._shape[t].isValid(n[t],e,o)||(s=!1),o.pop();if(this._openSchema)for(const t of Object.keys(n))t in this._shape||(o.push(t),this._openSchema.isValid(n[t],e,o)||(s=!1),o.pop());return s}_canSanitize(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}},z=class extends g{constructor(t){super(),this.item=t,this._default=[]}sanitize(t){if(!Array.isArray(t))return[];const e=[];for(const i of t)this.item._canSanitize(i)&&e.push(this.item.sanitize(i));return e}isValid(t,e,i){if(!Array.isArray(t))return null==e||e.errors.push(m(null!=i?i:[])+": expected array, got "+typeof t),!1;const n=null!=i?i:[];let o=!0;for(let i=0;i<t.length;i++)n.push("["+i+"]"),this.item.isValid(t[i],e,n)||(o=!1),n.pop();return o}_canSanitize(t){return Array.isArray(t)}},k=class extends g{constructor(t){super(),this.value=t,this._kind="record",this._default={}}sanitize(t){if(!t||"object"!=typeof t||Array.isArray(t))return{};const e={};for(const[i,n]of Object.entries(t))this.value._canSanitize(n)&&(e[i]=this.value.sanitize(n));return e}isValid(t,e,i){if(!t||"object"!=typeof t||Array.isArray(t))return null==e||e.errors.push(m(null!=i?i:[])+": expected object/record, got "+(Array.isArray(t)?"array":typeof t)),!1;const n=null!=i?i:[];let o=!0;for(const[i,s]of Object.entries(t))n.push(i),this.value.isValid(s,e,n)||(o=!1),n.pop();return o}_canSanitize(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}},V=class extends g{constructor(t,e){super(),this.fn=t,this._default=e,this.resolved=null}get schema(){var t;return null!=(t=this.resolved)?t:this.resolved=this.fn()}sanitize(t){return this.schema.sanitize(t)}isValid(t,e,i){return this.schema.isValid(t,e,i)}_canSanitize(t){return this.schema._canSanitize(t)}},P=class extends g{constructor(t){super(),this.schemas=t,this._kind="tuple",this._default=t.map(t=>t._default)}sanitize(t){return Array.isArray(t)&&t.length===this.schemas.length?this.schemas.map((e,i)=>e.sanitize(t[i])):this._default}isValid(t,e,i){if(!Array.isArray(t)||t.length!==this.schemas.length)return null==e||e.errors.push(m(null!=i?i:[])+": expected tuple of length "+this.schemas.length+", got "+(Array.isArray(t)?"array["+t.length+"]":typeof t)),!1;const n=null!=i?i:[];let o=!0;for(let i=0;i<this.schemas.length;i++)n.push("["+i+"]"),this.schemas[i].isValid(t[i],e,n)||(o=!1),n.pop();return o}_canSanitize(t){return Array.isArray(t)&&t.length===this.schemas.length}},N=(t="")=>new v(t),D=(t=0)=>new b(t),M=(t=!1)=>new A(t),T=t=>new x(t),E=(t,e)=>new S(t,e),I=(t,e)=>new O(t,e),B=t=>new j(t),J=(t,e)=>new w(t,e),R=t=>new z(t),C=t=>new k(t),G=t=>new P(t),L=(t,e)=>new V(t,e),U=/^(\d+)\.(\d+)(?:\.(\d+))?$/;!function(){const t=U.exec("1.2".trim());t&&(Number(t[1]),Number(t[2]),void 0===t[3]||Number(t[3]))}();var F,q={pause:"pause",continue:"continue",reset:"reset"},H="block",W="inline",Y="nearest",K="root",X="center",$="bottom",Q=y(f({},{native:"native",js:"js"}),{auto:"auto"}),Z="pause",tt="userSpaceOnUse",et="objectBoundingBox",it=I([N(),G([D(),D(),D(),D()])]),nt=I([N(),D(),R(D()),B({pathData:N()}),L(()=>R(Tt),[]),L(()=>at,{})]),ot=B({time:D().optional(),value:nt.optional(),easing:it.optional(),tangentOut:G([D(),D()]).optional(),tangentIn:G([D(),D()]).optional()}),st=B({segmentCount:D().optional(),repeatAt:E(["start","end"]).optional(),direction:E(["normal","alternate"]).optional()}),rt=B({value:nt.optional(),keyframes:R(ot).optional(),loop:I([st,M()]).optional(),autoOrient:M().optional(),alongPathMode:E(["sampled","offsetPath"]).optional()}),at=B({translate:G([D(),D()]).optional(),rotate:D().optional(),skew:D().optional(),scale:G([D(),D()]).optional(),origin:G([D(),D()]).optional()}),lt=(I([N(),at,B({value:at}),rt]),C(rt)),pt=I([N(),R(I([N(),lt])),lt]),ut=B({start:E(["load","mouseOver","click","none"],"load").optional(),offScreen:E([q.pause,q.continue,q.reset],Z).optional(),mouseOut:E(["continue","pause","reset","reverse"],"continue").optional(),finish:E(["hold","reset"]).optional(),visibilityThreshold:D().optional(),visibilityDebounce:D().optional()}),ct=B({width:D(),pathData:N()}),ht=B({fontFamily:N(),fontStyle:N(),ascent:D(),unitsPerEm:D(),glyphs:C(ct)}),dt=B({easings:C(G([D(),D(),D(),D()])).optional(),animations:C(lt).optional(),fonts:C(ht).optional()}),ft=B({phase:E(["cover","contain","entry","exit","entry-crossing","exit-crossing"]).optional(),fraction:D().optional()}),yt=B({start:ft.optional(),end:ft.optional()}),mt=(B({kind:E(["view","scroll"]).optional(),axis:E([H,W,"x","y"]).optional(),source:E([Y,K]).optional(),subject:N().optional(),smoothing:D().optional(),pin:M().optional(),pinAlign:E(["top",X,$]).optional(),pinOffset:D().optional(),pinDistance:D().optional(),range:yt.optional()}),B({align:E(["top",X,$]).optional(),offset:D().optional(),distance:D().optional()})),gt=E([Q.auto,Q.native,Q.js]).optional(),_t=B({type:T("time").optional(),engine:gt,frameRate:D().optional(),duration:D().optional(),trigger:ut.optional(),delay:D().optional(),iterations:I([D(),T("infinite")]).optional(),fillMode:E(["forwards","backwards","both","none"]).optional(),direction:E(["normal","reverse","alternate","alternate-reverse"]).optional()}),vt={duration:D().optional(),iterations:D().optional(),engine:gt,frameRate:D().optional(),axis:E([H,W,"x","y"]).optional(),source:E([Y,K]).optional(),subject:N().optional(),smoothing:D().optional(),pin:I([M(),mt]).optional(),range:yt.optional()},bt=(F=[_t,B(f({type:T("scroll")},vt)),B(f({type:T("view")},vt))],new class extends g{constructor(t,e,i){var n;super(),this._key=t,this._schemas=e,this._kind="discriminatedUnion",this._default=null!=i?i:e[0]._default,this._map=new Map;for(const i of e){const e=i._shape[t];if(!e)continue;const o=null!=(n=e.inner)?n:e;this._map.set(o._default,i),e.inner&&(this._absentMember=i)}}_findSchema(t){if(null===t||"object"!=typeof t||Array.isArray(t))return;const e=t[this._key];return null==e?this._absentMember:this._map.get(e)}sanitize(t){var e;return(null!=(e=this._findSchema(t))?e:this._schemas[0]).sanitize(t)}isValid(t,e,i){const n=this._findSchema(t);if(!n){const n=null===t||"object"!=typeof t||Array.isArray(t)?void 0:t[this._key];return null==e||e.errors.push(m(null!=i?i:[])+": no discriminated union member matched "+this._key+"="+JSON.stringify(n)),!1}return n.isValid(t,e,i)}_canSanitize(t){if(null===t||"object"!=typeof t||Array.isArray(t))return!1;const e=this._findSchema(t);return e?e._canSanitize(t):this._schemas[0]._canSanitize(t)}}("type",F)),At=B({target:N(),animateWith:R(N())}),xt=B({timeline:bt.optional(),definitions:dt.optional(),bindings:R(At).optional(),debugGlobalName:N().optional(),version:N().optional()}),St=I([N(),D(),R(D()),B({value:new class extends g{constructor(){super(...arguments),this._default=void 0}sanitize(t){return t}isValid(t,e,i){return void 0!==t||(null==e||e.errors.push(m(null!=i?i:[])+": required value is missing"),!1)}_canSanitize(t){return void 0!==t}}}),at]),Ot=I([D(),rt,B({value:D()})]),jt=I([G([D(),D()]),rt,B({value:G([D(),D()])})]),wt=I([N(),rt,B({value:N()})]),zt=B({translate:jt.optional(),rotate:Ot.optional(),scale:jt.optional(),skew:Ot.optional(),origin:jt.optional()}),kt=B({copies:D().optional(),translate:jt.optional(),rotate:Ot.optional(),skew:Ot.optional(),scale:jt.optional(),origin:jt.optional()}),Vt=B({source:N().optional(),maskType:E(["luminance","alpha"]).optional(),maskUnits:E([tt,et]).optional(),maskContentUnits:E([tt,et]).optional(),x:D().optional(),y:D().optional(),width:D().optional(),height:D().optional()}),Pt=B({pathData:wt.optional()}),Nt=B({offset:Ot.optional(),range:jt.optional(),subPaths:E(["separate","combined"]).optional()}),Dt=B({start:D().optional(),stretch:D().optional(),timeCrop:G([D(),D()]).optional()}),Mt=B({without:E(["translate"]).optional(),source:N().optional(),retime:Dt.optional()}),Tt=B({offset:D(),color:N()}),Et=I([R(Tt),B({value:R(Tt)}),rt]),It=B({type:E(["linear","radial"]),start:jt.optional(),end:jt.optional(),center:jt.optional(),radius:Ot.optional(),focal:jt.optional(),stops:Et.optional(),gradientUnits:E([tt,et]).optional(),spreadMethod:E(["pad","reflect","repeat"]).optional(),gradientTransform:N().optional()}),Bt=It,Jt=B({pathData:N(),pathOverflow:E(["clip","extend"]).optional(),lengthAdjust:E(["spacing","spacingAndGlyphs"]).optional(),method:E(["align","stretch"]).optional(),spacing:E(["auto","exact"]).optional(),startOffset:Ot.optional(),textLength:Ot.optional()}),Rt=B({useGlyphs:M().optional()}),Ct=B({transformBy:zt.optional(),repeater:kt.optional(),maskedBy:Vt.optional(),clipPath:Pt.optional(),strokeTrim:Nt.optional(),clone:Mt.optional(),fillGradient:It.optional(),strokeGradient:Bt.optional(),textPath:Jt.optional(),text:Rt.optional()}),Gt=J({type:N(),domType:N().optional(),textContent:N().optional(),id:N().optional(),meta:(new class extends g{constructor(){super(...arguments),this._default=void 0}sanitize(t){return t}isValid(t,e,i){return!0}_canSanitize(t){return!0}}).optional(),effects:Ct.optional(),animate:pt.optional(),style:C(I([N(),D()])).optional()},St),Lt=J(y(f({},Gt._shape),{children:L(()=>R(Lt),[]).optional()}),St),Ut=B({width:I([D(),N()]).optional(),height:I([D(),N()]).optional(),viewBox:N().optional(),animator:xt.optional()}),Ft=(J(y(f(f({},Gt._shape),Ut._shape),{type:T("svg"),children:R(Lt).optional()}),St),B({v:R(R(D())),i:R(R(D())).optional(),o:R(R(D())).optional(),c:M().optional()}),{offScreen:Z,visibilityThreshold:.5,visibilityDebounce:150}),qt=Array.from({length:21},(t,e)=>e/20);function Ht(t){return{requestStart:()=>t.play(),dispose:()=>{}}}function Wt(t,e,i){if(e.offScreen===q.continue)return Ht(i);if("undefined"==typeof IntersectionObserver)return Ht(i);const n=e.visibilityThreshold,o=e.visibilityDebounce;let s,r,a=!1,l=!1,p=0;const u=()=>{void 0!==r&&(clearTimeout(r),r=void 0)},c=()=>{r=void 0,!0!==s&&(s=!0,(a||l)&&(a=!1,l=!1,i.play()))},h=()=>{u(),!1!==s&&(s=!1,i.isPlaying()&&(e.offScreen===q.reset?i.cancel():i.pause(),l=!0))},d=t=>{if(p=t,"undefined"==typeof document||"hidden"!==document.visibilityState)if(t>=n){if(!0===s||void 0!==r)return;o>0?r=setTimeout(c,o):c()}else t<=0?h():!0!==s&&u();else h()},f=new IntersectionObserver(t=>{const e=t[t.length-1];e&&d(e.isIntersecting?function(t){var e,i;const n=t.boundingClientRect,o=t.intersectionRect;if(!(null==n?void 0:n.height)||!o)return t.intersectionRatio;const s="undefined"!=typeof window&&window.innerHeight?window.innerHeight:1/0,r=null!=(i=null==(e=t.rootBounds)?void 0:e.height)?i:1/0,a=Math.min(s,r),l=Math.min(n.height,Number.isFinite(a)?a:n.height);return l>0?o.height/l:t.intersectionRatio}(e):0)},{threshold:qt});f.observe(t);const y=()=>{d(p)},m="undefined"!=typeof document;return m&&document.addEventListener("visibilitychange",y),{requestStart:t=>{if(t||!0===s)return u(),s=!0,a=!1,l=!1,void i.play();a=!0},dispose:()=>{u(),f.disconnect(),m&&document.removeEventListener("visibilitychange",y)}}}
@@ -1 +1 @@
1
- import{PX_ANIMATOR_DOC_KEY as m}from"./chunk-RK3CEIRB.min.js";export{m as PX_ANIMATOR_DOC_KEY};
1
+ import{PLAY_WHEN_VISIBLE_DEFAULTS as m,PX_ANIMATOR_DOC_KEY as o,createVisibilityGate as r}from"./chunk-RQ5KZXDT.min.js";export{m as PLAY_WHEN_VISIBLE_DEFAULTS,o as PX_ANIMATOR_DOC_KEY,r as createVisibilityGate};