@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
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.274",
4
+ "version": "1.3.0-dev.276",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -24,14 +24,19 @@
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.274",
39
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.276",
35
40
  "@epam/ai-dial-ui-kit": "^0.16.0-dev.59",
36
41
  "react": "^19.2.8",
37
42
  "react-dom": "^19.2.8"
@@ -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 };
@@ -1,18 +1,14 @@
1
1
  import { i as e } from "./CelebrationEnvironmentContext-BxzY78Zg.js";
2
- import { useSyncExternalStore as t } from "react";
3
- //#region src/hooks/useReducedMotion.ts
4
- var n = "(prefers-reduced-motion: reduce)", r = (e) => {
5
- let t = window.matchMedia?.(n);
6
- return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
7
- }, i = () => window.matchMedia?.(n).matches ?? !1, a = () => t(r, i, () => !0), o = 0, s = (e, t) => {
8
- let n = [e, ...e.querySelectorAll("*")];
9
- if (n.length > 1500) throw Error("Decorative snapshot exceeds its node budget");
10
- let r = e.cloneNode(!0), i = [r, ...r.querySelectorAll("*")], a = `celebration-copy-${++o}-`, s = /* @__PURE__ */ new Map();
11
- n.forEach((e, t) => {
12
- let n = i[t], r = getComputedStyle(e);
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);
13
9
  for (let e of Array.from(r)) n.style.setProperty(e, r.getPropertyValue(e));
14
- n.style.animation = "none", n.style.transition = "none", n.id &&= (s.set(n.id, `${a}${t}`), `${a}${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");
15
- }), i.forEach((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) => {
16
12
  for (let t of [
17
13
  "fill",
18
14
  "stroke",
@@ -26,13 +22,13 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
26
22
  e.setAttribute(t, r), e.style.setProperty(t, r);
27
23
  }
28
24
  }
29
- }), Object.assign(r.style, {
25
+ }), Object.assign(i.style, {
30
26
  position: "relative",
31
27
  inset: "auto",
32
28
  margin: "0",
33
29
  transform: "none",
34
- width: `${t.width}px`,
35
- height: `${t.height}px`,
30
+ width: `${n.width}px`,
31
+ height: `${n.height}px`,
36
32
  minWidth: "0",
37
33
  minHeight: "0",
38
34
  maxWidth: "none",
@@ -43,18 +39,18 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
43
39
  let c = document.createElement("div");
44
40
  return c.inert = !0, c.setAttribute("aria-hidden", "true"), Object.assign(c.style, {
45
41
  position: "absolute",
46
- left: `${t.left}px`,
47
- top: `${t.top}px`,
48
- width: `${t.width}px`,
49
- height: `${t.height}px`,
42
+ left: `${n.left}px`,
43
+ top: `${n.top}px`,
44
+ width: `${n.width}px`,
45
+ height: `${n.height}px`,
50
46
  overflow: "hidden",
51
47
  pointerEvents: "none",
52
48
  margin: "0",
53
49
  transformOrigin: "center"
54
- }), c.appendChild(r), c.dataset.celebrationSnapshot = "true", c;
55
- }, c = (e, t, n) => {
50
+ }), c.appendChild(i), c.dataset.celebrationSnapshot = "true", c;
51
+ }, r = (e, t, r) => {
56
52
  if (!e.length || typeof t.animate != "function") return () => void 0;
57
- let r = [], i = [], a = !1, o, c = [
53
+ let i = [], a = [], o = !1, s, c = [
58
54
  "scroll",
59
55
  "pointerdown",
60
56
  "focusin",
@@ -64,48 +60,48 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
64
60
  "compositionstart",
65
61
  "visibilitychange"
66
62
  ], l = () => {
67
- a || (a = !0, clearTimeout(o), d.disconnect(), i.forEach((e) => e.cancel()), r.forEach((e) => e.remove()), c.forEach((e) => document.removeEventListener(e, u, !0)), window.removeEventListener("resize", l), n.onStop?.());
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?.());
68
64
  }, u = (e) => {
69
65
  e.type === "scroll" && e.target instanceof Node && t.contains(e.target) || l();
70
66
  }, d = new MutationObserver((t) => {
71
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();
72
68
  });
73
69
  try {
74
- e.forEach(({ element: e, rect: a }, o) => {
75
- let c = s(e, a);
76
- r.push(c), t.appendChild(c);
70
+ e.forEach(({ element: e, rect: o }, s) => {
71
+ let c = n(e, o);
72
+ i.push(c), t.appendChild(c);
77
73
  let l = [e, ...e.querySelectorAll("*")], u = c.firstElementChild;
78
74
  if (!u) throw Error("Snapshot is empty");
79
75
  let d = [u, ...u.querySelectorAll("*")];
80
76
  if (l.forEach((e, t) => {
81
77
  d[t].scrollTop = e.scrollTop, d[t].scrollLeft = e.scrollLeft;
82
- }), n.decorateCopy?.(c, o), i.push(c.animate(n.frames(a, o).map((e) => ({
78
+ }), r.decorateCopy?.(c, s), a.push(c.animate(r.frames(o, s).map((e) => ({
83
79
  ...e,
84
80
  easing: e.easing ?? "ease-in-out"
85
81
  })), {
86
- duration: n.durationMs,
82
+ duration: r.durationMs,
87
83
  fill: "both"
88
- })), n.hideOriginal !== !1) {
89
- let t = getComputedStyle(e).opacity, r = typeof n.hideAt == "function" ? n.hideAt(o) : n.hideAt;
90
- i.push(e.animate([
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([
91
87
  {
92
88
  offset: 0,
93
89
  opacity: t
94
90
  },
95
91
  {
96
- offset: r - .01,
92
+ offset: n - .01,
97
93
  opacity: t
98
94
  },
99
95
  {
100
- offset: r,
96
+ offset: n,
101
97
  opacity: 0
102
98
  },
103
99
  {
104
- offset: n.restoreAt,
100
+ offset: r.restoreAt,
105
101
  opacity: 0
106
102
  },
107
103
  {
108
- offset: Math.min(1, n.restoreAt + .04),
104
+ offset: Math.min(1, r.restoreAt + .04),
109
105
  opacity: t
110
106
  },
111
107
  {
@@ -113,12 +109,12 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
113
109
  opacity: t
114
110
  }
115
111
  ], {
116
- duration: n.durationMs,
112
+ duration: r.durationMs,
117
113
  fill: "both"
118
114
  }));
119
115
  }
120
- }), n.startTime !== void 0 && i.forEach((e) => {
121
- e.startTime = n.startTime ?? null;
116
+ }), r.startTime !== void 0 && a.forEach((e) => {
117
+ e.startTime = r.startTime ?? null;
122
118
  }), d.observe(document.body, {
123
119
  subtree: !0,
124
120
  childList: !0,
@@ -133,18 +129,18 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
133
129
  "style",
134
130
  "dir"
135
131
  ]
136
- }), c.forEach((e) => document.addEventListener(e, u, !0)), window.addEventListener("resize", l), o = setTimeout(l, n.durationMs);
132
+ }), c.forEach((e) => document.addEventListener(e, u, !0)), window.addEventListener("resize", l), s = setTimeout(l, r.durationMs);
137
133
  } catch {
138
134
  l();
139
135
  }
140
136
  return l;
141
- }, l = "[role=\"region\"]", u = ({ historyContainer: e, historyRowLink: t }) => e && t ? `.${e} ${t}` : null, d = ({ historyContainer: e }) => e ? `.${e}` : null, f = ({ historyContainer: e }) => e ? `.${e} h2, .${e} button` : null, p = (e, t = document) => e ? Array.from(t.querySelectorAll(e)) : [], m = (e, { welcomeRegion: t }) => e?.closest(t ?? l) ?? null, h = .5, g = (t, n, r = []) => {
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 = []) => {
142
138
  if (!t.length) return () => void 0;
143
139
  let i = [...new Set(t)].map((e) => ({
144
140
  element: e,
145
141
  rect: e.getBoundingClientRect()
146
142
  })), a = !1, o = () => {
147
- a || (a = !0, u.disconnect(), d?.disconnect());
143
+ a || (a = !0, d.disconnect(), f?.disconnect());
148
144
  }, s = () => {
149
145
  a || (o(), n());
150
146
  }, c = () => {
@@ -156,14 +152,14 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
156
152
  "top",
157
153
  "width",
158
154
  "height"
159
- ].some((e) => Math.abs(n[e] - t[e]) > h);
155
+ ].some((e) => Math.abs(n[e] - t[e]) > u);
160
156
  }) && s();
161
- }, l = (t) => r.some((e) => e === t || e.contains(t)) || t instanceof Element && !!t.closest(`.${e.sceneLayer}`), u = new MutationObserver((e) => {
157
+ }, l = (t) => r.some((e) => e === t || e.contains(t)) || t instanceof Element && !!t.closest(`.${e.sceneLayer}`), d = new MutationObserver((e) => {
162
158
  if (a) return;
163
159
  let t = e.filter((e) => !l(e.target) && (e.type !== "childList" || ![...e.addedNodes, ...e.removedNodes].every(l)));
164
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();
165
- }), d = typeof ResizeObserver == "function" ? new ResizeObserver(c) : void 0;
166
- return u.observe(document.documentElement, {
161
+ }), f = typeof ResizeObserver == "function" ? new ResizeObserver(c) : void 0;
162
+ return d.observe(document.documentElement, {
167
163
  subtree: !0,
168
164
  childList: !0,
169
165
  characterData: !0,
@@ -178,7 +174,7 @@ var n = "(prefers-reduced-motion: reduce)", r = (e) => {
178
174
  "aria-expanded",
179
175
  "href"
180
176
  ]
181
- }), i.forEach(({ element: e }) => d?.observe(e)), o;
177
+ }), i.forEach(({ element: e }) => f?.observe(e)), o;
182
178
  };
183
179
  //#endregion
184
- export { u as a, a as c, f as i, m as n, p as o, d as r, c as s, g as t };
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"}