@epam/ai-dial-celebrations 1.3.0-dev.35 → 1.3.0-dev.354

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 (104) 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/components/Halloween/HalloweenCandy.d.ts.map +1 -1
  9. package/halloween/components/Halloween/HalloweenMimic.d.ts.map +1 -1
  10. package/halloween/components/Halloween/HalloweenSpiderTheft.d.ts.map +1 -1
  11. package/halloween/components/Halloween/HalloweenTrain.d.ts.map +1 -1
  12. package/halloween/utils/halloween-bowling.d.ts.map +1 -1
  13. package/halloween/utils/halloween-candy-plan.d.ts.map +1 -1
  14. package/halloween/utils/halloween-footprint-plan.d.ts.map +1 -1
  15. package/halloween/utils/halloween-raven-targets.d.ts.map +1 -1
  16. package/halloween/utils/halloween-skeleton-plan.d.ts.map +1 -1
  17. package/halloween/utils/halloween-witch-plan.d.ts.map +1 -1
  18. package/halloween.js +3109 -3277
  19. package/hooks/useLottieSceneSession.d.ts +1 -1
  20. package/hooks/useLottieSceneSession.d.ts.map +1 -1
  21. package/index.css +3 -2
  22. package/index.d.ts +3 -0
  23. package/index.d.ts.map +1 -1
  24. package/index.js +63 -62
  25. package/{lottie_light-DVla0_7m.js → lottie_light-DUHSXGUj.js} +1003 -1056
  26. package/models/celebration-pack.d.ts +126 -0
  27. package/models/celebration-pack.d.ts.map +1 -0
  28. package/models/lottie-scene.d.ts +17 -4
  29. package/models/lottie-scene.d.ts.map +1 -1
  30. package/new-year/components/NewYear/NewYearSceneOverlay.d.ts.map +1 -1
  31. package/new-year/components/NewYearReindeerTakeoff/NewYearReindeerTakeoff.d.ts +5 -0
  32. package/new-year/components/NewYearReindeerTakeoff/NewYearReindeerTakeoff.d.ts.map +1 -0
  33. package/new-year/components/NewYearReindeerTakeoff/ReindeerStill.d.ts +4 -0
  34. package/new-year/components/NewYearReindeerTakeoff/ReindeerStill.d.ts.map +1 -0
  35. package/new-year/components/NewYearSnowmanDelivery/NewYearSnowmanDelivery.d.ts +5 -0
  36. package/new-year/components/NewYearSnowmanDelivery/NewYearSnowmanDelivery.d.ts.map +1 -0
  37. package/new-year/components/NewYearSnowmanDelivery/SnowmanDeliveryStill.d.ts +4 -0
  38. package/new-year/components/NewYearSnowmanDelivery/SnowmanDeliveryStill.d.ts.map +1 -0
  39. package/new-year/constants/labels.d.ts +2 -3
  40. package/new-year/constants/labels.d.ts.map +1 -1
  41. package/new-year/constants/new-year.d.ts +3 -3
  42. package/new-year/constants/new-year.d.ts.map +1 -1
  43. package/new-year/event.d.ts.map +1 -1
  44. package/new-year/models/labels.d.ts +4 -6
  45. package/new-year/models/labels.d.ts.map +1 -1
  46. package/new-year/types/new-year.d.ts +17 -6
  47. package/new-year/types/new-year.d.ts.map +1 -1
  48. package/new-year/utils/gift-wrapping-composition.d.ts.map +1 -1
  49. package/new-year/utils/penguin-star-art.d.ts.map +1 -1
  50. package/new-year/utils/penguin-star-composition.d.ts.map +1 -1
  51. package/new-year/utils/reindeer-animation.d.ts +5 -0
  52. package/new-year/utils/reindeer-animation.d.ts.map +1 -0
  53. package/new-year/utils/reindeer-art.d.ts +58 -0
  54. package/new-year/utils/reindeer-art.d.ts.map +1 -0
  55. package/new-year/utils/reindeer-composition.d.ts +66 -0
  56. package/new-year/utils/reindeer-composition.d.ts.map +1 -0
  57. package/new-year/utils/reindeer-physics.d.ts +60 -0
  58. package/new-year/utils/reindeer-physics.d.ts.map +1 -0
  59. package/new-year/utils/reindeer-scene.d.ts +4 -0
  60. package/new-year/utils/reindeer-scene.d.ts.map +1 -0
  61. package/new-year/utils/reindeer-targets.d.ts +28 -0
  62. package/new-year/utils/reindeer-targets.d.ts.map +1 -0
  63. package/new-year/utils/reindeer-text.d.ts +14 -0
  64. package/new-year/utils/reindeer-text.d.ts.map +1 -0
  65. package/new-year/utils/snowman-delivery-animation.d.ts +7 -0
  66. package/new-year/utils/snowman-delivery-animation.d.ts.map +1 -0
  67. package/new-year/utils/snowman-delivery-art.d.ts +96 -0
  68. package/new-year/utils/snowman-delivery-art.d.ts.map +1 -0
  69. package/new-year/utils/snowman-delivery-card.d.ts +12 -0
  70. package/new-year/utils/snowman-delivery-card.d.ts.map +1 -0
  71. package/new-year/utils/snowman-delivery-composition.d.ts +161 -0
  72. package/new-year/utils/snowman-delivery-composition.d.ts.map +1 -0
  73. package/new-year/utils/snowman-delivery-rig.d.ts +87 -0
  74. package/new-year/utils/snowman-delivery-rig.d.ts.map +1 -0
  75. package/new-year/utils/snowman-delivery-targets.d.ts +65 -0
  76. package/new-year/utils/snowman-delivery-targets.d.ts.map +1 -0
  77. package/new-year/utils/snowman-delivery-timeline.d.ts +47 -0
  78. package/new-year/utils/snowman-delivery-timeline.d.ts.map +1 -0
  79. package/new-year.js +3474 -1026
  80. package/package.json +9 -4
  81. package/packs/index.d.ts +6 -0
  82. package/packs/index.d.ts.map +1 -0
  83. package/packs.js +197 -0
  84. package/scene-targets-C5LEjDnN.js +180 -0
  85. package/types/celebration-pack.d.ts +82 -0
  86. package/types/celebration-pack.d.ts.map +1 -0
  87. package/useLottieSceneSession-FcSRnJ26.js +204 -0
  88. package/useReducedMotion-BWIeAFB_.js +8 -0
  89. package/utils/celebration-descriptor-event.d.ts +9 -0
  90. package/utils/celebration-descriptor-event.d.ts.map +1 -0
  91. package/utils/celebration-pack-scene.d.ts +19 -0
  92. package/utils/celebration-pack-scene.d.ts.map +1 -0
  93. package/utils/celebration-snapshots.d.ts.map +1 -1
  94. package/utils/celebration-variant.d.ts +7 -0
  95. package/utils/celebration-variant.d.ts.map +1 -0
  96. package/utils/lottie-scene-session.d.ts +1 -1
  97. package/utils/lottie-scene-session.d.ts.map +1 -1
  98. package/flying-characters-Czuzwf8T.js +0 -40
  99. package/new-year/components/NewYear/NewYearParticles.d.ts +0 -10
  100. package/new-year/components/NewYear/NewYearParticles.d.ts.map +0 -1
  101. package/new-year/components/NewYear/NewYearSleigh.d.ts +0 -3
  102. package/new-year/components/NewYear/NewYearSleigh.d.ts.map +0 -1
  103. package/new-year/components/NewYear/particles.d.ts +0 -5
  104. package/new-year/components/NewYear/particles.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-celebrations",
3
3
  "description": "Seasonal start-page celebrations with lazily loaded Halloween and New Year scenes that hosts can switch on and off one by one",
4
- "version": "1.3.0-dev.35",
4
+ "version": "1.3.0-dev.354",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -24,15 +24,20 @@
24
24
  "types": "./new-year/index.d.ts",
25
25
  "import": "./new-year.js",
26
26
  "default": "./new-year.js"
27
+ },
28
+ "./packs": {
29
+ "types": "./packs/index.d.ts",
30
+ "import": "./packs.js",
31
+ "default": "./packs.js"
27
32
  }
28
33
  },
29
34
  "dependencies": {
30
35
  "lottie-web": "5.13.0",
31
- "react-error-boundary": "^6.1.5"
36
+ "react-error-boundary": "^6.1.6"
32
37
  },
33
38
  "peerDependencies": {
34
- "@epam/ai-dial-chat-shared": "1.3.0-dev.35",
35
- "@epam/ai-dial-ui-kit": "^0.15.3",
39
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.354",
40
+ "@epam/ai-dial-ui-kit": "^0.16.0",
36
41
  "react": "^19.2.8",
37
42
  "react-dom": "^19.2.8"
38
43
  },
@@ -0,0 +1,6 @@
1
+ export { LottieScene } from '../components/LottieScene/LottieScene';
2
+ export type { LottieSceneProps } from '../components/LottieScene/LottieScene';
3
+ export { StaticTriggerDecoration } from '../components/StaticTriggerDecoration/StaticTriggerDecoration';
4
+ export type { StaticTriggerDecorationProps } from '../components/StaticTriggerDecoration/StaticTriggerDecoration';
5
+ export { createCelebrationEventFromDescriptor, createCelebrationSceneFromDescriptor, replaceCelebrationScenes, } from '../utils/celebration-descriptor-event';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/packs/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAC;AACxG,YAAY,EAAE,4BAA4B,EAAE,MAAM,+DAA+D,CAAC;AAClH,OAAO,EACL,oCAAoC,EACpC,oCAAoC,EACpC,wBAAwB,GACzB,MAAM,uCAAuC,CAAC"}
package/packs.js ADDED
@@ -0,0 +1,197 @@
1
+ import { a as e, i as t, t as n } from "./useLottieSceneSession-FcSRnJ26.js";
2
+ import { i as r, n as i } from "./CelebrationEnvironmentContext-BxzY78Zg.js";
3
+ import { a, c as o, l as s, n as c, o as l, s as u, t as d, u as f } from "./celebration-capabilities-DABcz0mO.js";
4
+ import { t as p } from "./useReducedMotion-BWIeAFB_.js";
5
+ import { mergeClasses as m } from "@epam/ai-dial-chat-shared";
6
+ import { createElement as h, useCallback as g, useEffect as _, useMemo as v, useState as y } from "react";
7
+ import { jsx as b } from "react/jsx-runtime";
8
+ var x = (e) => e.renderer === c.LottieLightSvgV1 && e.placement.template === u.ViewportStageV1 && e.requiredCapabilities.every((e) => d.has(e)), S = (e) => typeof e == "number" && Number.isFinite(e) && e > 0, C = (e) => {
9
+ if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("Animation data is not an object");
10
+ let { w: t, h: n } = e;
11
+ if (!S(t) || !S(n)) throw TypeError("Animation data has no stage size");
12
+ return {
13
+ data: e,
14
+ aspectRatio: t / n
15
+ };
16
+ }, w = (e) => e.getElementsByTagName("*").length <= 800, T = {
17
+ [s.Start]: "top",
18
+ [s.Center]: "center",
19
+ [s.End]: "bottom"
20
+ }, E = (e, t, n) => {
21
+ let r = t === "ltr" !== n, i = "center";
22
+ return e.inline === s.Start ? i = r ? "left" : "right" : e.inline === s.End && (i = r ? "right" : "left"), `${i} ${T[e.block]}`;
23
+ }, D = (e, t) => {
24
+ let { layout: n, direction: r, colorScheme: i } = e.when, a = [
25
+ [n, t.layout],
26
+ [r, t.direction],
27
+ [i, t.colorScheme]
28
+ ], o = 0;
29
+ for (let [e, t] of a) if (e != null) {
30
+ if (e !== t) return -1;
31
+ o += 1;
32
+ }
33
+ return o;
34
+ }, O = (e, t) => {
35
+ let n, r = -1;
36
+ for (let i of e) {
37
+ let e = D(i, t);
38
+ e > r && (n = i, r = e);
39
+ }
40
+ return n;
41
+ }, k = {
42
+ [o.Center]: {
43
+ block: s.Center,
44
+ inline: s.Center
45
+ },
46
+ [o.Top]: {
47
+ block: s.Start,
48
+ inline: s.Center
49
+ },
50
+ [o.Bottom]: {
51
+ block: s.End,
52
+ inline: s.Center
53
+ },
54
+ [o.TopStart]: {
55
+ block: s.Start,
56
+ inline: s.Start
57
+ },
58
+ [o.TopEnd]: {
59
+ block: s.Start,
60
+ inline: s.End
61
+ },
62
+ [o.BottomStart]: {
63
+ block: s.End,
64
+ inline: s.Start
65
+ },
66
+ [o.BottomEnd]: {
67
+ block: s.End,
68
+ inline: s.End
69
+ }
70
+ }, A = (e) => k[e] ?? k[o.Center], j = {
71
+ scene: "_scene_15yht_3",
72
+ blockStart: "_blockStart_15yht_12",
73
+ blockCenter: "_blockCenter_15yht_16",
74
+ blockEnd: "_blockEnd_15yht_20",
75
+ inlineStart: "_inlineStart_15yht_25",
76
+ inlineCenter: "_inlineCenter_15yht_29",
77
+ inlineEnd: "_inlineEnd_15yht_33",
78
+ stage: "_stage_15yht_37",
79
+ cover: "_cover_15yht_44",
80
+ poster: "_poster_15yht_48",
81
+ posterCover: "_posterCover_15yht_54",
82
+ mirrored: "_mirrored_15yht_59"
83
+ }, M = {
84
+ [s.Start]: j.blockStart,
85
+ [s.Center]: j.blockCenter,
86
+ [s.End]: j.blockEnd
87
+ }, N = {
88
+ [s.Start]: j.inlineStart,
89
+ [s.Center]: j.inlineCenter,
90
+ [s.End]: j.inlineEnd
91
+ }, P = ({ scene: r, loaders: o, context: s }) => {
92
+ let { isMobile: c } = i(), u = p(), [d] = y(() => ({
93
+ isMobile: c,
94
+ isReducedMotion: u
95
+ })), h = d.isMobile !== c || d.isReducedMotion !== u, [S] = y(() => x(r) ? O(r.variants, {
96
+ ...s,
97
+ layout: d.isMobile ? l.Mobile : l.Desktop
98
+ }) : void 0), [T, D] = y(!1), [k, P] = y(!1), F = v(() => ({
99
+ timings: {
100
+ loadTimeoutMs: r.timing.loadTimeoutMs,
101
+ readyTimeoutMs: r.timing.readyTimeoutMs,
102
+ playbackMs: r.timing.playbackDurationMs
103
+ },
104
+ ownership: t.Shared,
105
+ getAnimationData: ({ data: e }) => e,
106
+ isRendererAccepted: w,
107
+ onPlaybackStarted: () => D(!0)
108
+ }), [r.timing]), I = S?.animationAssetId, L = g((e) => I ? o.loadAnimationData(I, e) : Promise.reject(/* @__PURE__ */ Error("No variant")), [I, o]), { phase: R, preparation: z, hostRef: B } = n({
109
+ enabled: !d.isReducedMotion && S !== void 0 && !h,
110
+ playback: F,
111
+ prepare: (e, t) => C(t),
112
+ loadData: L
113
+ }), V = !h && (d.isReducedMotion || S === void 0 || R === e.Failed && !T), H = V ? o.resolveImageUrl(r.posterAssetId) : void 0, U = H !== void 0 && !k;
114
+ _(() => {
115
+ if (!U) return;
116
+ let e = window.setTimeout(() => P(!0), r.posterDurationMs);
117
+ return () => window.clearTimeout(e);
118
+ }, [U, r.posterDurationMs]);
119
+ let W = A(r.placement.align), G = r.direction === a.Mirror && s.direction === "rtl", K = r.placement.fit === f.Cover, q = m(j.scene, M[W.block], N[W.inline]);
120
+ return h ? null : V ? U ? /* @__PURE__ */ b("div", {
121
+ className: q,
122
+ dir: s.direction,
123
+ inert: !0,
124
+ children: /* @__PURE__ */ b("img", {
125
+ alt: "",
126
+ src: H,
127
+ className: m(j.poster, K && j.posterCover, G && j.mirrored),
128
+ style: { objectPosition: E(W, s.direction, G) }
129
+ })
130
+ }) : null : !z || R !== e.Prepared ? null : /* @__PURE__ */ b("div", {
131
+ className: q,
132
+ dir: s.direction,
133
+ inert: !0,
134
+ children: /* @__PURE__ */ b("div", {
135
+ ref: B,
136
+ className: m(j.stage, K && j.cover, G && j.mirrored),
137
+ style: { "--celebrations-stage-ratio": String(z.aspectRatio) }
138
+ })
139
+ });
140
+ }, F = {
141
+ trigger: "_trigger_1jsls_2",
142
+ image: "_image_1jsls_20"
143
+ }, I = "Play celebration", L = ({ onActivate: e, imageUrl: t, label: n }) => /* @__PURE__ */ b("button", {
144
+ type: "button",
145
+ className: m(F.trigger, r.trigger),
146
+ "aria-label": n || "Play celebration",
147
+ onClick: e,
148
+ children: t && /* @__PURE__ */ b("img", {
149
+ alt: "",
150
+ "aria-hidden": "true",
151
+ src: t,
152
+ className: F.image
153
+ })
154
+ }), R = (e, t, n) => ({
155
+ id: e.id,
156
+ labelId: e.labelId,
157
+ durationMs: e.timing.maxLifetimeMs,
158
+ Component: () => h(P, {
159
+ scene: e,
160
+ loaders: t,
161
+ context: n
162
+ })
163
+ }), z = (e, t) => {
164
+ let n = new Map(t.map((e) => [e.id, e]));
165
+ return {
166
+ ...e,
167
+ scenes: e.scenes.map((e) => {
168
+ let t = n.get(e.id);
169
+ return t ? {
170
+ ...t,
171
+ labelId: e.labelId
172
+ } : e;
173
+ })
174
+ };
175
+ }, B = (e, t) => ({ onActivate: n }) => {
176
+ let { labels: r } = i();
177
+ return h(L, {
178
+ onActivate: n,
179
+ imageUrl: t,
180
+ label: r[e]
181
+ });
182
+ }, V = (e, t, n) => {
183
+ let { event: r } = e;
184
+ if (!r) throw TypeError(`Pack ${e.packId} does not describe an external event`);
185
+ let i = e.scenes.map((e) => R(e, t, n)), a = new Set(i.map(({ id: e }) => e)), { labelId: o, posterAssetId: s } = r.decoration, c = { ...e.labels };
186
+ return c[o] || (c[o] = I), {
187
+ id: e.eventId,
188
+ iconUrl: r.iconAssetId ? t.resolveImageUrl(r.iconAssetId) : void 0,
189
+ Decoration: B(o, t.resolveImageUrl(s)),
190
+ scenes: i,
191
+ clickSceneIds: r.clickSceneIds.filter((e) => a.has(e)),
192
+ labels: c,
193
+ titleLabelId: r.titleLabelId
194
+ };
195
+ };
196
+ //#endregion
197
+ export { P as LottieScene, L as StaticTriggerDecoration, V as createCelebrationEventFromDescriptor, R as createCelebrationSceneFromDescriptor, z as replaceCelebrationScenes };
@@ -0,0 +1,180 @@
1
+ import { i as e } from "./CelebrationEnvironmentContext-BxzY78Zg.js";
2
+ //#region src/utils/celebration-snapshots.ts
3
+ var t = 0, n = (e, n) => {
4
+ let r = [e, ...e.querySelectorAll("*")];
5
+ if (r.length > 1500) throw Error("Decorative snapshot exceeds its node budget");
6
+ let i = e.cloneNode(!0), a = [i, ...i.querySelectorAll("*")], o = `celebration-copy-${++t}-`, s = /* @__PURE__ */ new Map();
7
+ r.forEach((e, t) => {
8
+ let n = a[t], r = getComputedStyle(e);
9
+ for (let e of Array.from(r)) n.style.setProperty(e, r.getPropertyValue(e));
10
+ n.style.animation = "none", n.style.transition = "none", n.id &&= (s.set(n.id, `${o}${t}`), `${o}${t}`), e instanceof HTMLTextAreaElement && n instanceof HTMLTextAreaElement && (n.value = e.value), e instanceof HTMLInputElement && n instanceof HTMLInputElement && e.type !== "file" && (n.value = e.value, n.checked = e.checked), n.removeAttribute("autofocus"), n.removeAttribute("name"), n.tagName.toLowerCase() === "a" && n.removeAttribute("href");
11
+ }), a.forEach((e) => {
12
+ for (let t of [
13
+ "fill",
14
+ "stroke",
15
+ "clip-path",
16
+ "mask",
17
+ "filter"
18
+ ]) {
19
+ let n = e.getAttribute(t)?.match(/^url\(#(.+)\)$/)?.[1];
20
+ if (n && s.has(n)) {
21
+ let r = `url(#${s.get(n)})`;
22
+ e.setAttribute(t, r), e.style.setProperty(t, r);
23
+ }
24
+ }
25
+ }), Object.assign(i.style, {
26
+ position: "relative",
27
+ inset: "auto",
28
+ margin: "0",
29
+ transform: "none",
30
+ width: `${n.width}px`,
31
+ height: `${n.height}px`,
32
+ minWidth: "0",
33
+ minHeight: "0",
34
+ maxWidth: "none",
35
+ maxHeight: "none",
36
+ animation: "none",
37
+ transition: "none"
38
+ });
39
+ let c = document.createElement("div");
40
+ return c.inert = !0, c.setAttribute("aria-hidden", "true"), Object.assign(c.style, {
41
+ position: "absolute",
42
+ left: `${n.left}px`,
43
+ top: `${n.top}px`,
44
+ width: `${n.width}px`,
45
+ height: `${n.height}px`,
46
+ overflow: "hidden",
47
+ pointerEvents: "none",
48
+ margin: "0",
49
+ transformOrigin: "center"
50
+ }), c.appendChild(i), c.dataset.celebrationSnapshot = "true", c;
51
+ }, r = (e, t, r) => {
52
+ if (!e.length || typeof t.animate != "function") return () => void 0;
53
+ let i = [], a = [], o = !1, s, c = [
54
+ "scroll",
55
+ "pointerdown",
56
+ "focusin",
57
+ "keydown",
58
+ "beforeinput",
59
+ "input",
60
+ "compositionstart",
61
+ "visibilitychange"
62
+ ], l = () => {
63
+ o || (o = !0, clearTimeout(s), d.disconnect(), a.forEach((e) => e.cancel()), i.forEach((e) => e.remove()), c.forEach((e) => document.removeEventListener(e, u, !0)), window.removeEventListener("resize", l), r.onStop?.());
64
+ }, u = (e) => {
65
+ e.type === "scroll" && e.target instanceof Node && t.contains(e.target) || l();
66
+ }, d = new MutationObserver((t) => {
67
+ e.some(({ element: e }) => !e.isConnected || e.closest("[inert], [aria-hidden=\"true\"]") || t.some((t) => e.contains(t.target) || t.type === "attributes" && t.target instanceof Element && t.target.contains(e))) && l();
68
+ });
69
+ try {
70
+ e.forEach(({ element: e, rect: o }, s) => {
71
+ let c = n(e, o);
72
+ i.push(c), t.appendChild(c);
73
+ let l = [e, ...e.querySelectorAll("*")], u = c.firstElementChild;
74
+ if (!u) throw Error("Snapshot is empty");
75
+ let d = [u, ...u.querySelectorAll("*")];
76
+ if (l.forEach((e, t) => {
77
+ d[t].scrollTop = e.scrollTop, d[t].scrollLeft = e.scrollLeft;
78
+ }), r.decorateCopy?.(c, s), a.push(c.animate(r.frames(o, s).map((e) => ({
79
+ ...e,
80
+ easing: e.easing ?? "ease-in-out"
81
+ })), {
82
+ duration: r.durationMs,
83
+ fill: "both"
84
+ })), r.hideOriginal !== !1) {
85
+ let t = getComputedStyle(e).opacity, n = typeof r.hideAt == "function" ? r.hideAt(s) : r.hideAt;
86
+ a.push(e.animate([
87
+ {
88
+ offset: 0,
89
+ opacity: t
90
+ },
91
+ {
92
+ offset: n - .01,
93
+ opacity: t
94
+ },
95
+ {
96
+ offset: n,
97
+ opacity: 0
98
+ },
99
+ {
100
+ offset: r.restoreAt,
101
+ opacity: 0
102
+ },
103
+ {
104
+ offset: Math.min(1, r.restoreAt + .04),
105
+ opacity: t
106
+ },
107
+ {
108
+ offset: 1,
109
+ opacity: t
110
+ }
111
+ ], {
112
+ duration: r.durationMs,
113
+ fill: "both"
114
+ }));
115
+ }
116
+ }), r.startTime !== void 0 && a.forEach((e) => {
117
+ e.startTime = r.startTime ?? null;
118
+ }), d.observe(document.body, {
119
+ subtree: !0,
120
+ childList: !0,
121
+ characterData: !0,
122
+ attributes: !0,
123
+ attributeFilter: [
124
+ "href",
125
+ "inert",
126
+ "aria-hidden",
127
+ "aria-expanded",
128
+ "class",
129
+ "style",
130
+ "dir"
131
+ ]
132
+ }), c.forEach((e) => document.addEventListener(e, u, !0)), window.addEventListener("resize", l), s = setTimeout(l, r.durationMs);
133
+ } catch {
134
+ l();
135
+ }
136
+ return l;
137
+ }, i = "[role=\"region\"]", a = ({ historyContainer: e, historyRowLink: t }) => e && t ? `.${e} ${t}` : null, o = ({ historyContainer: e }) => e ? `.${e}` : null, s = ({ historyContainer: e }) => e ? `.${e} h2, .${e} button` : null, c = (e, t = document) => e ? Array.from(t.querySelectorAll(e)) : [], l = (e, { welcomeRegion: t }) => e?.closest(t ?? i) ?? null, u = .5, d = (t, n, r = []) => {
138
+ if (!t.length) return () => void 0;
139
+ let i = [...new Set(t)].map((e) => ({
140
+ element: e,
141
+ rect: e.getBoundingClientRect()
142
+ })), a = !1, o = () => {
143
+ a || (a = !0, d.disconnect(), f?.disconnect());
144
+ }, s = () => {
145
+ a || (o(), n());
146
+ }, c = () => {
147
+ a || i.some(({ element: e, rect: t }) => {
148
+ if (!e.isConnected) return !0;
149
+ let n = e.getBoundingClientRect();
150
+ return [
151
+ "left",
152
+ "top",
153
+ "width",
154
+ "height"
155
+ ].some((e) => Math.abs(n[e] - t[e]) > u);
156
+ }) && s();
157
+ }, l = (t) => r.some((e) => e === t || e.contains(t)) || t instanceof Element && !!t.closest(`.${e.sceneLayer}`), d = new MutationObserver((e) => {
158
+ if (a) return;
159
+ let t = e.filter((e) => !l(e.target) && (e.type !== "childList" || ![...e.addedNodes, ...e.removedNodes].every(l)));
160
+ i.some(({ element: e }) => !e.isConnected || t.some((t) => e.contains(t.target) || t.type === "attributes" && t.target.contains(e))) ? s() : t.some((e) => e.type === "childList" && i.some(({ element: t }) => e.target.contains(t))) && c();
161
+ }), f = typeof ResizeObserver == "function" ? new ResizeObserver(c) : void 0;
162
+ return d.observe(document.documentElement, {
163
+ subtree: !0,
164
+ childList: !0,
165
+ characterData: !0,
166
+ attributes: !0,
167
+ attributeFilter: [
168
+ "class",
169
+ "style",
170
+ "dir",
171
+ "hidden",
172
+ "inert",
173
+ "aria-hidden",
174
+ "aria-expanded",
175
+ "href"
176
+ ]
177
+ }), i.forEach(({ element: e }) => f?.observe(e)), o;
178
+ };
179
+ //#endregion
180
+ export { a, s as i, l as n, c as o, o as r, r as s, d as t };
@@ -0,0 +1,82 @@
1
+ /** Runtime features a pack scene may require; a host plays only what this release supports. */
2
+ export declare enum CelebrationCapability {
3
+ /** Plays Lottie JSON with the pinned SVG-only `lottie_light` player. */
4
+ LottieLightSvgV1 = "lottie-light-svg-v1",
5
+ /** Places a fixed-aspect stage in the viewport scene layer. */
6
+ ViewportStageV1 = "viewport-stage-v1",
7
+ /** Anchors the stage to the composer; not implemented in this release. */
8
+ ComposerAnchorV1 = "composer-anchor-v1",
9
+ /** Shows a static poster image instead of motion. */
10
+ StaticPosterV1 = "static-poster-v1",
11
+ /** Renders a static image button as an external event's decoration. */
12
+ StaticTriggerV1 = "static-trigger-v1"
13
+ }
14
+ /** How a scene adapts to right-to-left documents. */
15
+ export declare enum CelebrationDirectionMode {
16
+ /** The motion is the same in both directions. */
17
+ None = "none",
18
+ /** The stage is flipped horizontally around its center in RTL. */
19
+ Mirror = "mirror",
20
+ /** A dedicated RTL variant is selected. */
21
+ Variant = "variant"
22
+ }
23
+ /** Host layout a variant targets. */
24
+ export declare enum CelebrationLayout {
25
+ /** The host's mobile layout. */
26
+ Mobile = "mobile",
27
+ /** The host's desktop layout. */
28
+ Desktop = "desktop"
29
+ }
30
+ /** Color scheme a variant targets. */
31
+ export declare enum CelebrationColorScheme {
32
+ /** A light theme. */
33
+ Light = "light",
34
+ /** A dark theme. */
35
+ Dark = "dark"
36
+ }
37
+ /** Placement templates a scene may declare. */
38
+ export declare enum CelebrationPlacementTemplate {
39
+ /** A fixed-aspect stage fitted into the viewport scene layer. */
40
+ ViewportStageV1 = "viewport-stage-v1",
41
+ /** A stage anchored to the composer; not implemented in this release. */
42
+ ComposerAnchorV1 = "composer-anchor-v1"
43
+ }
44
+ /** How a viewport stage scales into the viewport, always uniformly. */
45
+ export declare enum CelebrationStageFit {
46
+ /** The whole stage stays visible. */
47
+ Contain = "contain",
48
+ /** The stage covers the viewport and may be cropped. */
49
+ Cover = "cover"
50
+ }
51
+ /** Where a viewport stage sits; `start`/`end` follow the supplied direction. */
52
+ export declare enum CelebrationStageAlign {
53
+ /** Centered on both axes. */
54
+ Center = "center",
55
+ /** Top edge, centered horizontally. */
56
+ Top = "top",
57
+ /** Bottom edge, centered horizontally. */
58
+ Bottom = "bottom",
59
+ /** Top edge at the inline start. */
60
+ TopStart = "top-start",
61
+ /** Top edge at the inline end. */
62
+ TopEnd = "top-end",
63
+ /** Bottom edge at the inline start. */
64
+ BottomStart = "bottom-start",
65
+ /** Bottom edge at the inline end. */
66
+ BottomEnd = "bottom-end"
67
+ }
68
+ /** Template of an external event's decoration. */
69
+ export declare enum CelebrationDecorationTemplate {
70
+ /** A static image button. */
71
+ StaticTriggerV1 = "static-trigger-v1"
72
+ }
73
+ /** Position of the stage along one logical axis. */
74
+ export declare enum CelebrationStageEdge {
75
+ /** The axis start: top, or the inline start. */
76
+ Start = "start",
77
+ /** The axis center. */
78
+ Center = "center",
79
+ /** The axis end: bottom, or the inline end. */
80
+ End = "end"
81
+ }
82
+ //# sourceMappingURL=celebration-pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"celebration-pack.d.ts","sourceRoot":"","sources":["../../src/types/celebration-pack.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,oBAAY,qBAAqB;IAC/B,wEAAwE;IACxE,gBAAgB,wBAAwB;IACxC,+DAA+D;IAC/D,eAAe,sBAAsB;IACrC,0EAA0E;IAC1E,gBAAgB,uBAAuB;IACvC,qDAAqD;IACrD,cAAc,qBAAqB;IACnC,uEAAuE;IACvE,eAAe,sBAAsB;CACtC;AAED,qDAAqD;AACrD,oBAAY,wBAAwB;IAClC,iDAAiD;IACjD,IAAI,SAAS;IACb,kEAAkE;IAClE,MAAM,WAAW;IACjB,2CAA2C;IAC3C,OAAO,YAAY;CACpB;AAED,qCAAqC;AACrC,oBAAY,iBAAiB;IAC3B,gCAAgC;IAChC,MAAM,WAAW;IACjB,iCAAiC;IACjC,OAAO,YAAY;CACpB;AAED,sCAAsC;AACtC,oBAAY,sBAAsB;IAChC,qBAAqB;IACrB,KAAK,UAAU;IACf,oBAAoB;IACpB,IAAI,SAAS;CACd;AAED,+CAA+C;AAC/C,oBAAY,4BAA4B;IACtC,iEAAiE;IACjE,eAAe,sBAAsB;IACrC,yEAAyE;IACzE,gBAAgB,uBAAuB;CACxC;AAED,uEAAuE;AACvE,oBAAY,mBAAmB;IAC7B,qCAAqC;IACrC,OAAO,YAAY;IACnB,wDAAwD;IACxD,KAAK,UAAU;CAChB;AAED,gFAAgF;AAChF,oBAAY,qBAAqB;IAC/B,6BAA6B;IAC7B,MAAM,WAAW;IACjB,uCAAuC;IACvC,GAAG,QAAQ;IACX,0CAA0C;IAC1C,MAAM,WAAW;IACjB,oCAAoC;IACpC,QAAQ,cAAc;IACtB,kCAAkC;IAClC,MAAM,YAAY;IAClB,uCAAuC;IACvC,WAAW,iBAAiB;IAC5B,qCAAqC;IACrC,SAAS,eAAe;CACzB;AAED,kDAAkD;AAClD,oBAAY,6BAA6B;IACvC,6BAA6B;IAC7B,eAAe,sBAAsB;CACtC;AAED,oDAAoD;AACpD,oBAAY,oBAAoB;IAC9B,gDAAgD;IAChD,KAAK,UAAU;IACf,uBAAuB;IACvB,MAAM,WAAW;IACjB,+CAA+C;IAC/C,GAAG,QAAQ;CACZ"}