@epam/ai-dial-celebrations 1.3.0-dev.274 → 1.3.0-dev.276

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.
Files changed (38) hide show
  1. package/celebration-capabilities-DABcz0mO.js +27 -0
  2. package/components/LottieScene/LottieScene.d.ts +14 -0
  3. package/components/LottieScene/LottieScene.d.ts.map +1 -0
  4. package/components/StaticTriggerDecoration/StaticTriggerDecoration.d.ts +14 -0
  5. package/components/StaticTriggerDecoration/StaticTriggerDecoration.d.ts.map +1 -0
  6. package/constants/celebration-capabilities.d.ts +3 -0
  7. package/constants/celebration-capabilities.d.ts.map +1 -0
  8. package/halloween.js +144 -143
  9. package/hooks/useLottieSceneSession.d.ts +1 -1
  10. package/hooks/useLottieSceneSession.d.ts.map +1 -1
  11. package/index.css +1 -1
  12. package/index.d.ts +3 -0
  13. package/index.d.ts.map +1 -1
  14. package/index.js +62 -61
  15. package/{lottie_light-CowwItMl.js → lottie_light-DUHSXGUj.js} +1 -1
  16. package/models/celebration-pack.d.ts +126 -0
  17. package/models/celebration-pack.d.ts.map +1 -0
  18. package/models/lottie-scene.d.ts +10 -4
  19. package/models/lottie-scene.d.ts.map +1 -1
  20. package/new-year.js +1525 -1698
  21. package/package.json +8 -3
  22. package/packs/index.d.ts +6 -0
  23. package/packs/index.d.ts.map +1 -0
  24. package/packs.js +197 -0
  25. package/{scene-targets-BgiQPucY.js → scene-targets-C5LEjDnN.js} +44 -48
  26. package/types/celebration-pack.d.ts +82 -0
  27. package/types/celebration-pack.d.ts.map +1 -0
  28. package/useLottieSceneSession-FcSRnJ26.js +204 -0
  29. package/useReducedMotion-BWIeAFB_.js +8 -0
  30. package/utils/celebration-descriptor-event.d.ts +9 -0
  31. package/utils/celebration-descriptor-event.d.ts.map +1 -0
  32. package/utils/celebration-pack-scene.d.ts +19 -0
  33. package/utils/celebration-pack-scene.d.ts.map +1 -0
  34. package/utils/celebration-variant.d.ts +7 -0
  35. package/utils/celebration-variant.d.ts.map +1 -0
  36. package/utils/lottie-scene-session.d.ts +1 -1
  37. package/utils/lottie-scene-session.d.ts.map +1 -1
  38. package/rolldown-runtime-VHNaYcLd.js +0 -13
@@ -0,0 +1,204 @@
1
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ //#region \0rolldown/runtime.js
3
+ var i = Object.create, a = Object.defineProperty, o = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, c = Object.getPrototypeOf, l = Object.prototype.hasOwnProperty, u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), d = (e, t, n, r) => {
4
+ if (t && typeof t == "object" || typeof t == "function") for (var i = s(t), c = 0, u = i.length, d; c < u; c++) d = i[c], !l.call(e, d) && d !== n && a(e, d, {
5
+ get: ((e) => t[e]).bind(null, d),
6
+ enumerable: !(r = o(t, d)) || r.enumerable
7
+ });
8
+ return e;
9
+ }, f = (e, t, n) => (n = e == null ? {} : i(c(e)), d(t || !e || !e.__esModule || !l.call(e, "default") ? a(n, "default", {
10
+ value: e,
11
+ enumerable: !0
12
+ }) : n, e)), p = /* @__PURE__ */ function(e) {
13
+ return e.Idle = "idle", e.Loading = "loading", e.Prepared = "prepared", e.Initializing = "initializing", e.Playing = "playing", e.Completed = "completed", e.Cancelled = "cancelled", e.Failed = "failed", e;
14
+ }({}), m = /* @__PURE__ */ function(e) {
15
+ return e.Completed = "completed", e.Cancelled = "cancelled", e.Failed = "failed", e;
16
+ }({}), h = /* @__PURE__ */ function(e) {
17
+ return e.Transferred = "transferred", e.Shared = "shared", e;
18
+ }({}), g = /* @__PURE__ */ function(e) {
19
+ return e.Idle = "idle", e.Loading = "loading", e.Prepared = "prepared", e.Ended = "ended", e.Failed = "failed", e;
20
+ }({}), _ = async () => {
21
+ let { default: e } = await import("./lottie_light-DUHSXGUj.js").then((e) => /* @__PURE__ */ f(e.default, 1));
22
+ return e;
23
+ }, v = (e, t, n) => {
24
+ let r = e.loadAnimation({
25
+ container: t,
26
+ renderer: "svg",
27
+ loop: !1,
28
+ autoplay: !1,
29
+ animationData: n,
30
+ rendererSettings: {
31
+ progressiveLoad: !1,
32
+ preserveAspectRatio: "xMidYMid meet",
33
+ focusable: !1
34
+ }
35
+ });
36
+ try {
37
+ r.setSubframe(!0);
38
+ } catch (e) {
39
+ try {
40
+ r.destroy();
41
+ } catch {
42
+ t.replaceChildren();
43
+ }
44
+ throw e;
45
+ }
46
+ return r;
47
+ }, y = {
48
+ [m.Completed]: p.Completed,
49
+ [m.Cancelled]: p.Cancelled,
50
+ [m.Failed]: p.Failed
51
+ }, b = (e) => e === p.Completed || e === p.Cancelled || e === p.Failed, x = (e) => {
52
+ try {
53
+ e();
54
+ } catch {}
55
+ }, S = ({ playback: e, prepare: t, onPrepared: n, onTerminal: r, loadPlayer: i = _, loadData: a }) => {
56
+ let o = p.Idle, s = !1, c = !1, l, u, d, f, g, S, C, w, T, E = [], D = (e) => {
57
+ if (b(o)) return;
58
+ o = y[e];
59
+ let t = d;
60
+ t && x(() => {
61
+ t.style.visibility = "hidden";
62
+ }), clearTimeout(C), clearTimeout(w), clearTimeout(T);
63
+ let n = S;
64
+ S = void 0, n && x(() => n.abort()), E.splice(0).reverse().forEach(x);
65
+ let i = f;
66
+ if (i) {
67
+ x(() => i.removeEventListener("DOMLoaded", M)), x(() => i.removeEventListener("enterFrame", j)), x(() => i.removeEventListener("complete", O)), x(() => i.removeEventListener("data_failed", k)), x(() => i.removeEventListener("error", k));
68
+ try {
69
+ i.destroy();
70
+ } catch {
71
+ x(() => t?.replaceChildren());
72
+ }
73
+ }
74
+ c || r(e);
75
+ }, O = () => D(m.Completed), k = () => D(m.Failed), A = () => D(m.Cancelled), j = () => {
76
+ let t = f, n = e.onPlaybackStarted;
77
+ if (o !== p.Playing || !t || !g || (t.removeEventListener("enterFrame", j), !n)) return;
78
+ let r = document.timeline?.currentTime, i = typeof r == "number" ? r : performance.now();
79
+ try {
80
+ n({
81
+ ...g,
82
+ timelineZeroMs: i - t.currentFrame / t.frameRate * 1e3
83
+ });
84
+ } catch {
85
+ k();
86
+ }
87
+ }, M = () => {
88
+ if (o !== p.Initializing || !f) return;
89
+ if (!f.isLoaded) {
90
+ k();
91
+ return;
92
+ }
93
+ let t = e.isRendererAccepted;
94
+ if (t && d) {
95
+ let e = !1;
96
+ try {
97
+ e = t(d);
98
+ } catch {}
99
+ if (!e) {
100
+ k();
101
+ return;
102
+ }
103
+ }
104
+ o = p.Playing, clearTimeout(w), f.removeEventListener("DOMLoaded", M), T = setTimeout(O, e.timings.playbackMs), e.onPlaybackStarted && f.addEventListener("enterFrame", j);
105
+ try {
106
+ f.play();
107
+ } catch {
108
+ k();
109
+ }
110
+ }, N = (e) => {
111
+ b(o) ? x(e) : E.push(e);
112
+ }, P = async () => {
113
+ if (await Promise.resolve(), b(o)) return;
114
+ if (document.hidden) {
115
+ A();
116
+ return;
117
+ }
118
+ o = p.Loading, C = setTimeout(k, e.timings.loadTimeoutMs), S = a ? new AbortController() : void 0;
119
+ let r = S?.signal, s, c;
120
+ try {
121
+ [s, c] = await Promise.all([i(), a && r ? a(r) : void 0]);
122
+ } catch {
123
+ o === p.Loading && k();
124
+ return;
125
+ }
126
+ if (o === p.Loading) {
127
+ if (S = void 0, clearTimeout(C), document.hidden) A();
128
+ else try {
129
+ u = { preparation: t(s, c) }, l = s, o = p.Prepared, n(u.preparation);
130
+ } catch {
131
+ k();
132
+ }
133
+ }
134
+ };
135
+ return {
136
+ get state() {
137
+ return o;
138
+ },
139
+ start: () => {
140
+ s || (s = !0, P());
141
+ },
142
+ attach: (t) => {
143
+ if (o !== p.Prepared || !l || !u) return;
144
+ let { preparation: n } = u;
145
+ d = t, o = p.Initializing;
146
+ try {
147
+ let r = e.getAnimationData(n), i = e.ownership === h.Shared ? JSON.parse(JSON.stringify(r)) : r;
148
+ f = v(l, t, i), f.addEventListener("DOMLoaded", M), f.addEventListener("complete", O), f.addEventListener("data_failed", k), f.addEventListener("error", k), g = {
149
+ preparation: n,
150
+ host: t,
151
+ addDisposer: N,
152
+ cancel: A
153
+ }, e.onAnimationCreated?.(g), o === p.Initializing && (w = setTimeout(k, e.timings.readyTimeoutMs));
154
+ } catch {
155
+ k();
156
+ }
157
+ },
158
+ cancel: A,
159
+ dispose: () => {
160
+ c = !0, A();
161
+ }
162
+ };
163
+ }, C = ({ enabled: i, playback: a, prepare: o, loadData: s }) => {
164
+ let [c, l] = r(null), [u, d] = r(!1), [f, p] = r(!1), h = n(null), _ = n(null), v = n(o);
165
+ v.current = o;
166
+ let y = n(a);
167
+ y.current = a;
168
+ let b = n(s);
169
+ b.current = s, t(() => {
170
+ if (!i || u || f) return;
171
+ let e = b.current, t = S({
172
+ playback: y.current,
173
+ prepare: (e, t) => v.current(e, t),
174
+ loadData: e ? (t) => e(t) : void 0,
175
+ onPrepared: (e) => l({
176
+ session: t,
177
+ preparation: e
178
+ }),
179
+ onTerminal: (e) => {
180
+ e === m.Failed ? p(!0) : d(!0);
181
+ }
182
+ });
183
+ return _.current = t, t.start(), () => {
184
+ t.dispose(), _.current === t && (_.current = null), l((e) => e?.session === t ? null : e);
185
+ };
186
+ }, [
187
+ i,
188
+ u,
189
+ f
190
+ ]), t(() => {
191
+ c && h.current && c.session.attach(h.current);
192
+ }, [c]);
193
+ let x = e(() => {
194
+ h.current && (h.current.style.visibility = "hidden"), _.current?.cancel(), d(!0);
195
+ }, []), C = g.Idle;
196
+ return u ? C = g.Ended : f ? C = g.Failed : c ? C = g.Prepared : i && (C = g.Loading), {
197
+ phase: C,
198
+ preparation: c?.preparation ?? null,
199
+ hostRef: h,
200
+ cancel: x
201
+ };
202
+ };
203
+ //#endregion
204
+ export { g as a, h as i, v as n, u as o, _ as r, C as t };
@@ -0,0 +1,8 @@
1
+ import { useSyncExternalStore as e } from "react";
2
+ //#region src/hooks/useReducedMotion.ts
3
+ var t = "(prefers-reduced-motion: reduce)", n = (e) => {
4
+ let n = window.matchMedia?.(t);
5
+ return n?.addEventListener("change", e), () => n?.removeEventListener("change", e);
6
+ }, r = () => window.matchMedia?.(t).matches ?? !1, i = () => e(n, r, () => !0);
7
+ //#endregion
8
+ export { i as t };
@@ -0,0 +1,9 @@
1
+ import { CelebrationEvent, CelebrationScene } from '../models/celebration';
2
+ import { CelebrationAssetLoaders, CelebrationPackDescriptor, CelebrationSceneDescriptor, CelebrationVariantContext } from '../models/celebration-pack';
3
+ /** Returns a scene that plays the descriptor through `LottieScene` and lives for `timing.maxLifetimeMs`. */
4
+ export declare const createCelebrationSceneFromDescriptor: (descriptor: CelebrationSceneDescriptor, loaders: CelebrationAssetLoaders, context: CelebrationVariantContext) => CelebrationScene;
5
+ /** Returns a copy of `event` whose existing scenes are swapped for same-id replacements, keeping their `labelId`. */
6
+ export declare const replaceCelebrationScenes: (event: CelebrationEvent, scenes: readonly CelebrationScene[]) => CelebrationEvent;
7
+ /** Returns the event an external-only pack describes; throws when the descriptor has no `event` block. */
8
+ export declare const createCelebrationEventFromDescriptor: (descriptor: CelebrationPackDescriptor, loaders: CelebrationAssetLoaders, context: CelebrationVariantContext) => CelebrationEvent;
9
+ //# sourceMappingURL=celebration-descriptor-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"celebration-descriptor-event.d.ts","sourceRoot":"","sources":["../../src/utils/celebration-descriptor-event.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAEpC,4GAA4G;AAC5G,eAAO,MAAM,oCAAoC,GAC/C,YAAY,0BAA0B,EACtC,SAAS,uBAAuB,EAChC,SAAS,yBAAyB,KACjC,gBASF,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,wBAAwB,GACnC,OAAO,gBAAgB,EACvB,QAAQ,SAAS,gBAAgB,EAAE,KAClC,gBASF,CAAC;AAiBF,0GAA0G;AAC1G,eAAO,MAAM,oCAAoC,GAC/C,YAAY,yBAAyB,EACrC,SAAS,uBAAuB,EAChC,SAAS,yBAAyB,KACjC,gBA2BF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { CelebrationSceneDescriptor, CelebrationStageAlignment, CelebrationTextDirection } from '../models/celebration-pack';
2
+ /** Most SVG elements a generated pack renderer may hold before it counts as a failure. */
3
+ export declare const MAX_PACK_SCENE_ELEMENTS = 800;
4
+ /** A pack animation ready for the player, with its stage width-to-height ratio. */
5
+ export interface PackScenePreparation {
6
+ /** The validated Lottie JSON. */
7
+ data: object;
8
+ /** Composition width divided by its height. */
9
+ aspectRatio: number;
10
+ }
11
+ /** Whether this release can play the scene's renderer, capabilities and placement. */
12
+ export declare const isCelebrationSceneSupported: (scene: CelebrationSceneDescriptor) => boolean;
13
+ /** Returns the preparation for loaded Lottie JSON; throws when it has no positive `w` and `h`. */
14
+ export declare const preparePackSceneData: (data: unknown) => PackScenePreparation;
15
+ /** Whether the rendered stage stays within the element budget. */
16
+ export declare const isPackRendererWithinBudget: (host: HTMLElement) => boolean;
17
+ /** Returns the poster's `object-position`; the inline edge follows `direction`, inverted for a mirrored poster. */
18
+ export declare const resolvePosterObjectPosition: (alignment: CelebrationStageAlignment, direction: CelebrationTextDirection, isMirrored: boolean) => string;
19
+ //# sourceMappingURL=celebration-pack-scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"celebration-pack-scene.d.ts","sourceRoot":"","sources":["../../src/utils/celebration-pack-scene.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAOpC,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,sFAAsF;AACtF,eAAO,MAAM,2BAA2B,GACtC,OAAO,0BAA0B,KAChC,OAKA,CAAC;AAKJ,kGAAkG;AAClG,eAAO,MAAM,oBAAoB,GAAI,MAAM,OAAO,KAAG,oBAOpD,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,0BAA0B,GAAI,MAAM,WAAW,KAAG,OACG,CAAC;AAQnE,mHAAmH;AACnH,eAAO,MAAM,2BAA2B,GACtC,WAAW,yBAAyB,EACpC,WAAW,wBAAwB,EACnC,YAAY,OAAO,KAClB,MAQF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CelebrationSceneVariantDescriptor, CelebrationStageAlignment, CelebrationVariantInput } from '../models/celebration-pack';
2
+ import { CelebrationStageAlign } from '../types/celebration-pack';
3
+ /** Returns the variant meeting the most conditions, the earliest on a tie, or `undefined` when none applies. */
4
+ export declare const selectCelebrationVariant: (variants: readonly CelebrationSceneVariantDescriptor[], input: CelebrationVariantInput) => CelebrationSceneVariantDescriptor | undefined;
5
+ /** Returns the logical block and inline position of a stage; `start`/`end` follow the stage's own `dir`. */
6
+ export declare const resolveStageAlignment: (align: CelebrationStageAlign) => CelebrationStageAlignment;
7
+ //# sourceMappingURL=celebration-variant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"celebration-variant.d.ts","sourceRoot":"","sources":["../../src/utils/celebration-variant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAsBnC,gHAAgH;AAChH,eAAO,MAAM,wBAAwB,GACnC,UAAU,SAAS,iCAAiC,EAAE,EACtD,OAAO,uBAAuB,KAC7B,iCAAiC,GAAG,SAWtC,CAAC;AAoCF,4GAA4G;AAC5G,eAAO,MAAM,qBAAqB,GAChC,OAAO,qBAAqB,KAC3B,yBACsE,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { LottieSceneSession, LottieSceneSessionOptions } from '../models/lottie-scene';
2
2
  /** Creates one activation's Lottie session; it ends exactly once and then holds no resources. */
3
- export declare const createLottieSceneSession: <P>({ playback, prepare, onPrepared, onTerminal, loadPlayer, }: LottieSceneSessionOptions<P>) => LottieSceneSession;
3
+ export declare const createLottieSceneSession: <P>({ playback, prepare, onPrepared, onTerminal, loadPlayer, loadData, }: LottieSceneSessionOptions<P>) => LottieSceneSession;
4
4
  //# sourceMappingURL=lottie-scene-session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lottie-scene-session.d.ts","sourceRoot":"","sources":["../../src/utils/lottie-scene-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAgChC,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,4DAMzC,yBAAyB,CAAC,CAAC,CAAC,KAAG,kBA6KjC,CAAC"}
1
+ {"version":3,"file":"lottie-scene-session.d.ts","sourceRoot":"","sources":["../../src/utils/lottie-scene-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAgChC,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,sEAOzC,yBAAyB,CAAC,CAAC,CAAC,KAAG,kBAsMjC,CAAC"}
@@ -1,13 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, i, o, s) => {
3
- if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
4
- get: ((e) => i[e]).bind(null, d),
5
- enumerable: !(s = n(i, d)) || s.enumerable
6
- });
7
- return e;
8
- }, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
9
- value: n,
10
- enumerable: !0
11
- }) : o, n));
12
- //#endregion
13
- export { c as n, o as t };