@repere/core 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +184 -189
- package/package.json +5 -1
- /package/dist/{styles.css → core.css} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
var c = (e, i, t) => p(e, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
var d = /* @__PURE__ */ ((e) => (e.TopLeft = "top-left", e.TopCenter = "top-center", e.TopRight = "top-right", e.RightCenter = "right-center", e.BottomRight = "bottom-right", e.BottomCenter = "bottom-center", e.BottomLeft = "bottom-left", e.LeftCenter = "left-center", e))(d || {});
|
|
5
|
-
const x = d.TopRight;
|
|
1
|
+
var c = /* @__PURE__ */ ((e) => (e.TopLeft = "top-left", e.TopCenter = "top-center", e.TopRight = "top-right", e.RightCenter = "right-center", e.BottomRight = "bottom-right", e.BottomCenter = "bottom-center", e.BottomLeft = "bottom-left", e.LeftCenter = "left-center", e))(c || {});
|
|
2
|
+
const g = c.TopRight;
|
|
6
3
|
class m {
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
state = /* @__PURE__ */ new Map();
|
|
5
|
+
isDismissed(t) {
|
|
6
|
+
return this.state.get(t)?.isDismissed ?? !1;
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
dismiss(i) {
|
|
15
|
-
this.state.set(i, {
|
|
16
|
-
id: i,
|
|
8
|
+
dismiss(t) {
|
|
9
|
+
this.state.set(t, {
|
|
10
|
+
id: t,
|
|
17
11
|
isDismissed: !0
|
|
18
12
|
});
|
|
19
13
|
}
|
|
20
|
-
reset(
|
|
21
|
-
this.state.delete(
|
|
14
|
+
reset(t) {
|
|
15
|
+
this.state.delete(t);
|
|
22
16
|
}
|
|
23
17
|
resetAll() {
|
|
24
18
|
this.state.clear();
|
|
@@ -27,193 +21,193 @@ class m {
|
|
|
27
21
|
return Array.from(this.state.values());
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
[
|
|
24
|
+
var d = /* @__PURE__ */ ((e) => (e.Fade = "fade", e.Scale = "scale", e.Grow = "grow", e.Shrink = "shrink", e.SlideUp = "slide-up", e.SlideDown = "slide-down", e.SlideLeft = "slide-left", e.SlideRight = "slide-right", e.None = "none", e))(d || {});
|
|
25
|
+
const f = {
|
|
26
|
+
[d.SlideDown]: {
|
|
33
27
|
initial: { y: -20, opacity: 0 },
|
|
34
28
|
animate: { y: 0, opacity: 1 },
|
|
35
29
|
exit: { y: -20, opacity: 0 }
|
|
36
30
|
},
|
|
37
|
-
[
|
|
31
|
+
[d.SlideUp]: {
|
|
38
32
|
initial: { y: 20, opacity: 0 },
|
|
39
33
|
animate: { y: 0, opacity: 1 },
|
|
40
34
|
exit: { y: 20, opacity: 0 }
|
|
41
35
|
},
|
|
42
|
-
[
|
|
36
|
+
[d.SlideLeft]: {
|
|
43
37
|
initial: { x: 20, opacity: 0 },
|
|
44
38
|
animate: { x: 0, opacity: 1 },
|
|
45
39
|
exit: { x: 20, opacity: 0 }
|
|
46
40
|
},
|
|
47
|
-
[
|
|
41
|
+
[d.SlideRight]: {
|
|
48
42
|
initial: { x: -20, opacity: 0 },
|
|
49
43
|
animate: { x: 0, opacity: 1 },
|
|
50
44
|
exit: { x: -20, opacity: 0 }
|
|
51
45
|
},
|
|
52
|
-
[
|
|
46
|
+
[d.Fade]: {
|
|
53
47
|
initial: { opacity: 0 },
|
|
54
48
|
animate: { opacity: 1 },
|
|
55
49
|
exit: { opacity: 0 }
|
|
56
50
|
},
|
|
57
|
-
[
|
|
51
|
+
[d.Shrink]: {
|
|
58
52
|
initial: { scale: 1.1, opacity: 0 },
|
|
59
53
|
animate: { scale: 1, opacity: 1 },
|
|
60
54
|
exit: { scale: 0.9, opacity: 0 }
|
|
61
55
|
},
|
|
62
|
-
[
|
|
56
|
+
[d.Grow]: {
|
|
63
57
|
initial: { scale: 0.9, opacity: 0 },
|
|
64
58
|
animate: { scale: 1, opacity: 1 },
|
|
65
59
|
exit: { scale: 1.1, opacity: 0 }
|
|
66
60
|
},
|
|
67
|
-
[
|
|
61
|
+
[d.Scale]: {
|
|
68
62
|
initial: { scale: 0, opacity: 0 },
|
|
69
63
|
animate: { scale: 1, opacity: 1 },
|
|
70
64
|
exit: { scale: 0, opacity: 0 }
|
|
71
65
|
},
|
|
72
|
-
[
|
|
66
|
+
[d.None]: {
|
|
73
67
|
initial: {},
|
|
74
68
|
animate: {},
|
|
75
69
|
exit: {}
|
|
76
70
|
}
|
|
77
71
|
};
|
|
78
|
-
function
|
|
72
|
+
function u(e) {
|
|
79
73
|
return e ? typeof e == "string" ? { variant: e } : e : null;
|
|
80
74
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
83
|
-
return !
|
|
84
|
-
variant: s.variant ??
|
|
85
|
-
duration: s.duration ??
|
|
86
|
-
delay: s.delay ??
|
|
87
|
-
ease: s.ease ??
|
|
88
|
-
} :
|
|
75
|
+
function y(e, t) {
|
|
76
|
+
const i = u(e), s = u(t);
|
|
77
|
+
return !i && !s ? null : i ? s ? {
|
|
78
|
+
variant: s.variant ?? i.variant,
|
|
79
|
+
duration: s.duration ?? i.duration,
|
|
80
|
+
delay: s.delay ?? i.delay,
|
|
81
|
+
ease: s.ease ?? i.ease
|
|
82
|
+
} : i : s;
|
|
89
83
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
return
|
|
95
|
-
variants:
|
|
84
|
+
function w(e) {
|
|
85
|
+
const t = u(e);
|
|
86
|
+
if (!t) return null;
|
|
87
|
+
const i = f[t.variant];
|
|
88
|
+
return i ? {
|
|
89
|
+
variants: i,
|
|
96
90
|
transition: {
|
|
97
|
-
duration: (
|
|
91
|
+
duration: (t.duration || 300) / 1e3,
|
|
98
92
|
// Convert ms to seconds
|
|
99
|
-
delay: (
|
|
100
|
-
ease:
|
|
93
|
+
delay: (t.delay || 0) / 1e3,
|
|
94
|
+
ease: t.ease || [0.4, 0, 0.2, 1]
|
|
101
95
|
// cubic-bezier
|
|
102
96
|
}
|
|
103
|
-
} : (console.warn(`[Repere] Unknown animation variant: ${
|
|
97
|
+
} : (console.warn(`[Repere] Unknown animation variant: ${t.variant}`), null);
|
|
104
98
|
}
|
|
105
|
-
function
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
}, s =
|
|
99
|
+
function b(e, t) {
|
|
100
|
+
const i = (r) => {
|
|
101
|
+
const n = r.match(/(-?\d+)%/);
|
|
102
|
+
return n ? parseFloat(n[1]) : 0;
|
|
103
|
+
}, s = i(e.x), a = i(e.y), o = (r = 0) => a === 0 && r === 0 ? `translate(${s}%, 0)` : r === 0 ? `translate(${s}%, ${a}%)` : `translate(${s}%, calc(${a}% + ${r}px))`;
|
|
110
104
|
return {
|
|
111
105
|
initial: {
|
|
112
|
-
...
|
|
113
|
-
transform:
|
|
106
|
+
...t.initial,
|
|
107
|
+
transform: o(t.initial.y || 0)
|
|
114
108
|
},
|
|
115
109
|
animate: {
|
|
116
|
-
...
|
|
117
|
-
transform:
|
|
110
|
+
...t.animate,
|
|
111
|
+
transform: o(t.animate.y || 0)
|
|
118
112
|
},
|
|
119
113
|
exit: {
|
|
120
|
-
...
|
|
121
|
-
transform:
|
|
114
|
+
...t.exit,
|
|
115
|
+
transform: o(t.exit.y || 0)
|
|
122
116
|
}
|
|
123
117
|
};
|
|
124
118
|
}
|
|
125
|
-
function
|
|
126
|
-
if (!e && !
|
|
127
|
-
const
|
|
119
|
+
function x(e, t) {
|
|
120
|
+
if (!e && !t) return {};
|
|
121
|
+
const i = e?.variants, s = e?.transition, a = t?.variants, o = t?.transition, r = o?.ease ?? s?.ease ?? [0.4, 0, 0.2, 1], n = Array.isArray(r) ? `cubic-bezier(${r.join(", ")})` : r;
|
|
128
122
|
return {
|
|
129
123
|
// Initial state (when opening starts) - from onOpen animation
|
|
130
|
-
"--repere-initial-opacity":
|
|
131
|
-
"--repere-initial-x": `${
|
|
132
|
-
"--repere-initial-y": `${
|
|
133
|
-
"--repere-initial-scale":
|
|
124
|
+
"--repere-initial-opacity": i?.initial.opacity ?? 0,
|
|
125
|
+
"--repere-initial-x": `${i?.initial.x ?? 0}px`,
|
|
126
|
+
"--repere-initial-y": `${i?.initial.y ?? 0}px`,
|
|
127
|
+
"--repere-initial-scale": i?.initial.scale ?? 1,
|
|
134
128
|
// Animate state (fully open) - from onOpen animation
|
|
135
|
-
"--repere-animate-opacity":
|
|
136
|
-
"--repere-animate-x": `${
|
|
137
|
-
"--repere-animate-y": `${
|
|
138
|
-
"--repere-animate-scale":
|
|
129
|
+
"--repere-animate-opacity": i?.animate.opacity ?? 1,
|
|
130
|
+
"--repere-animate-x": `${i?.animate.x ?? 0}px`,
|
|
131
|
+
"--repere-animate-y": `${i?.animate.y ?? 0}px`,
|
|
132
|
+
"--repere-animate-scale": i?.animate.scale ?? 1,
|
|
139
133
|
// Exit state (when closing) - from onClose animation
|
|
140
|
-
"--repere-exit-opacity":
|
|
141
|
-
"--repere-exit-x": `${
|
|
142
|
-
"--repere-exit-y": `${
|
|
143
|
-
"--repere-exit-scale":
|
|
134
|
+
"--repere-exit-opacity": a?.exit.opacity ?? 0,
|
|
135
|
+
"--repere-exit-x": `${a?.exit.x ?? 0}px`,
|
|
136
|
+
"--repere-exit-y": `${a?.exit.y ?? 0}px`,
|
|
137
|
+
"--repere-exit-scale": a?.exit.scale ?? 1,
|
|
144
138
|
// Transition timing
|
|
145
|
-
"--repere-transition-duration": `${
|
|
146
|
-
"--repere-transition-timing":
|
|
139
|
+
"--repere-transition-duration": `${o?.duration ?? s?.duration ?? 0.3}s`,
|
|
140
|
+
"--repere-transition-timing": n
|
|
147
141
|
};
|
|
148
142
|
}
|
|
149
|
-
function
|
|
150
|
-
const
|
|
151
|
-
return Math.max(
|
|
143
|
+
function v(e, t) {
|
|
144
|
+
const i = e?.transition.duration ?? 0, s = t?.transition.duration ?? 0;
|
|
145
|
+
return Math.max(i, s) * 1e3;
|
|
152
146
|
}
|
|
153
|
-
function
|
|
154
|
-
return new Promise((
|
|
147
|
+
function k(e) {
|
|
148
|
+
return new Promise((t) => setTimeout(t, e));
|
|
155
149
|
}
|
|
156
|
-
function
|
|
157
|
-
if (
|
|
158
|
-
return
|
|
159
|
-
if (
|
|
150
|
+
function p(e, t) {
|
|
151
|
+
if (t instanceof RegExp)
|
|
152
|
+
return t.test(e);
|
|
153
|
+
if (t === e)
|
|
160
154
|
return !0;
|
|
161
|
-
if (
|
|
162
|
-
const
|
|
163
|
-
return new RegExp(`^${
|
|
155
|
+
if (t.includes("*")) {
|
|
156
|
+
const i = t.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
157
|
+
return new RegExp(`^${i}$`).test(e);
|
|
164
158
|
}
|
|
165
159
|
return !1;
|
|
166
160
|
}
|
|
167
|
-
class
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.store =
|
|
161
|
+
class L {
|
|
162
|
+
store;
|
|
163
|
+
debug;
|
|
164
|
+
constructor(t, i = {}) {
|
|
165
|
+
this.store = t, this.debug = i.debug ?? !1;
|
|
172
166
|
}
|
|
173
167
|
/**
|
|
174
168
|
* Find all pages that match the current path
|
|
175
169
|
* This supports wildcards - e.g., path="*" will match all pages
|
|
176
170
|
*/
|
|
177
|
-
findMatchingPages(
|
|
178
|
-
const s =
|
|
171
|
+
findMatchingPages(t, i) {
|
|
172
|
+
const s = t.filter((a) => typeof a.path == "function" ? a.path(i) : p(i, a.path));
|
|
179
173
|
return this.debug && console.log(
|
|
180
174
|
"[BeaconManager] Path:",
|
|
181
|
-
|
|
175
|
+
i,
|
|
182
176
|
"Matched pages:",
|
|
183
|
-
s.map((
|
|
177
|
+
s.map((a) => a.id).join(", ") || "none"
|
|
184
178
|
), s;
|
|
185
179
|
}
|
|
186
180
|
/**
|
|
187
181
|
* Get all active (non-dismissed) beacons for the current path
|
|
188
182
|
* Includes beacons from all matching pages (supports wildcards)
|
|
189
183
|
*/
|
|
190
|
-
async getActiveBeacons(
|
|
191
|
-
const s = this.findMatchingPages(
|
|
184
|
+
async getActiveBeacons(t, i) {
|
|
185
|
+
const s = this.findMatchingPages(t, i);
|
|
192
186
|
if (s.length === 0)
|
|
193
187
|
return this.debug && console.log("[BeaconManager] No matching pages found"), [];
|
|
194
188
|
this.debug && console.log(
|
|
195
189
|
"[BeaconManager] Found",
|
|
196
190
|
s.length,
|
|
197
191
|
"matching page(s):",
|
|
198
|
-
s.map((
|
|
192
|
+
s.map((n) => n.id).join(", ")
|
|
199
193
|
);
|
|
200
|
-
const
|
|
201
|
-
for (const
|
|
202
|
-
for (const l of
|
|
203
|
-
if (
|
|
194
|
+
const a = [], o = /* @__PURE__ */ new Set();
|
|
195
|
+
for (const n of s)
|
|
196
|
+
for (const l of n.beacons) {
|
|
197
|
+
if (o.has(l.id)) {
|
|
204
198
|
this.debug && console.warn(
|
|
205
|
-
`[BeaconManager] Duplicate beacon ID "${l.id}" in page "${
|
|
199
|
+
`[BeaconManager] Duplicate beacon ID "${l.id}" in page "${n.id}", skipping`
|
|
206
200
|
);
|
|
207
201
|
continue;
|
|
208
202
|
}
|
|
209
|
-
|
|
203
|
+
o.add(l.id), a.push(l);
|
|
210
204
|
}
|
|
211
|
-
const
|
|
212
|
-
for (const
|
|
205
|
+
const r = [];
|
|
206
|
+
for (const n of a)
|
|
213
207
|
await Promise.resolve(
|
|
214
|
-
this.store.isDismissed(
|
|
215
|
-
) ? this.debug && console.log("[BeaconManager] Beacon",
|
|
216
|
-
return this.debug && console.log("[BeaconManager] Active beacons:",
|
|
208
|
+
this.store.isDismissed(n.id)
|
|
209
|
+
) ? this.debug && console.log("[BeaconManager] Beacon", n.id, "is dismissed") : r.push(n);
|
|
210
|
+
return this.debug && console.log("[BeaconManager] Active beacons:", r.length), r;
|
|
217
211
|
}
|
|
218
212
|
/**
|
|
219
213
|
* Get the store instance
|
|
@@ -222,101 +216,103 @@ class S {
|
|
|
222
216
|
return this.store;
|
|
223
217
|
}
|
|
224
218
|
}
|
|
225
|
-
function
|
|
226
|
-
const { x: s = 0, y:
|
|
227
|
-
let
|
|
228
|
-
switch (
|
|
229
|
-
|
|
230
|
-
|
|
219
|
+
function h(e, t = c.TopRight, i = { x: 0, y: 0 }) {
|
|
220
|
+
const { x: s = 0, y: a = 0 } = i;
|
|
221
|
+
let o = 0, r = 0, n = "0", l = "0";
|
|
222
|
+
switch (t) {
|
|
223
|
+
// Top positions
|
|
224
|
+
case c.TopLeft:
|
|
225
|
+
o = e.top + window.scrollY, r = e.left + window.scrollX, n = "-50%", l = "-100%";
|
|
231
226
|
break;
|
|
232
|
-
case
|
|
233
|
-
|
|
227
|
+
case c.TopCenter:
|
|
228
|
+
o = e.top + window.scrollY, r = e.left + window.scrollX + e.width / 2, n = "-50%", l = "-100%";
|
|
234
229
|
break;
|
|
235
|
-
case
|
|
236
|
-
|
|
230
|
+
case c.TopRight:
|
|
231
|
+
o = e.top + window.scrollY, r = e.right + window.scrollX, n = "-50%", l = "-100%";
|
|
237
232
|
break;
|
|
238
|
-
|
|
239
|
-
|
|
233
|
+
// Right positions
|
|
234
|
+
case c.RightCenter:
|
|
235
|
+
o = e.top + window.scrollY + e.height / 2, r = e.right + window.scrollX, n = "0", l = "-50%";
|
|
240
236
|
break;
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
// Bottom positions
|
|
238
|
+
case c.BottomLeft:
|
|
239
|
+
o = e.bottom + window.scrollY, r = e.left + window.scrollX, n = "-50%", l = "0";
|
|
243
240
|
break;
|
|
244
|
-
case
|
|
245
|
-
|
|
241
|
+
case c.BottomCenter:
|
|
242
|
+
o = e.bottom + window.scrollY, r = e.left + window.scrollX + e.width / 2, n = "-50%", l = "0";
|
|
246
243
|
break;
|
|
247
|
-
case
|
|
248
|
-
|
|
244
|
+
case c.BottomRight:
|
|
245
|
+
o = e.bottom + window.scrollY, r = e.right + window.scrollX, n = "-50%", l = "0";
|
|
249
246
|
break;
|
|
250
|
-
|
|
251
|
-
|
|
247
|
+
// Left positions
|
|
248
|
+
case c.LeftCenter:
|
|
249
|
+
o = e.top + window.scrollY + e.height / 2, r = e.left + window.scrollX, n = "-100%", l = "-50%";
|
|
252
250
|
break;
|
|
253
251
|
}
|
|
254
|
-
return
|
|
255
|
-
top:
|
|
256
|
-
left:
|
|
257
|
-
translate: { x:
|
|
252
|
+
return o += a, r += s, {
|
|
253
|
+
top: o,
|
|
254
|
+
left: r,
|
|
255
|
+
translate: { x: n, y: l }
|
|
258
256
|
};
|
|
259
257
|
}
|
|
260
|
-
class
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
for (const [i] of this.tracked)
|
|
270
|
-
this.updatePosition(i);
|
|
271
|
-
});
|
|
272
|
-
this.debug = i;
|
|
258
|
+
class z {
|
|
259
|
+
tracked = /* @__PURE__ */ new Map();
|
|
260
|
+
scrollListener = null;
|
|
261
|
+
resizeListener = null;
|
|
262
|
+
resizeObserver = null;
|
|
263
|
+
mutationObserver = null;
|
|
264
|
+
debug = !1;
|
|
265
|
+
constructor(t = !1) {
|
|
266
|
+
this.debug = t;
|
|
273
267
|
}
|
|
274
268
|
/**
|
|
275
269
|
* Subscribe to position updates for an element
|
|
276
270
|
*/
|
|
277
|
-
subscribe(
|
|
278
|
-
const
|
|
279
|
-
this.tracked.has(
|
|
280
|
-
selector:
|
|
281
|
-
position:
|
|
282
|
-
offset:
|
|
283
|
-
zIndex:
|
|
271
|
+
subscribe(t, i, s, a = {}) {
|
|
272
|
+
const o = t;
|
|
273
|
+
return this.tracked.has(o) || this.tracked.set(o, {
|
|
274
|
+
selector: t,
|
|
275
|
+
position: i,
|
|
276
|
+
offset: a.offset,
|
|
277
|
+
zIndex: a.zIndex ?? 9999,
|
|
284
278
|
callbacks: /* @__PURE__ */ new Set(),
|
|
285
279
|
element: null
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const a = this.tracked.get(n);
|
|
290
|
-
a && (a.callbacks.delete(s), a.callbacks.size === 0 && (this.tracked.delete(n), this.tracked.size === 0 && this.stopListening()));
|
|
280
|
+
}), this.tracked.get(o)?.callbacks.add(s), this.tracked.size === 1 && this.startListening(), this.updatePosition(o), () => {
|
|
281
|
+
const n = this.tracked.get(o);
|
|
282
|
+
n && (n.callbacks.delete(s), n.callbacks.size === 0 && (this.tracked.delete(o), this.tracked.size === 0 && this.stopListening()));
|
|
291
283
|
};
|
|
292
284
|
}
|
|
293
|
-
updatePosition(
|
|
294
|
-
const
|
|
295
|
-
if (!
|
|
296
|
-
const s = document.querySelector(
|
|
285
|
+
updatePosition(t) {
|
|
286
|
+
const i = this.tracked.get(t);
|
|
287
|
+
if (!i) return;
|
|
288
|
+
const s = document.querySelector(i.selector);
|
|
297
289
|
if (!s) {
|
|
298
|
-
this.debug && console.log(`[PositionTracker] Element not found: ${
|
|
299
|
-
for (const
|
|
300
|
-
|
|
290
|
+
this.debug && console.log(`[PositionTracker] Element not found: ${i.selector}`), i.element = null;
|
|
291
|
+
for (const n of i.callbacks)
|
|
292
|
+
n(null);
|
|
301
293
|
return;
|
|
302
294
|
}
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
...
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
295
|
+
i.element = s;
|
|
296
|
+
const a = s.getBoundingClientRect(), r = {
|
|
297
|
+
...h(
|
|
298
|
+
a,
|
|
299
|
+
i.position,
|
|
300
|
+
i.offset
|
|
309
301
|
),
|
|
310
302
|
position: "fixed",
|
|
311
|
-
zIndex:
|
|
303
|
+
zIndex: i.zIndex
|
|
312
304
|
};
|
|
313
305
|
this.debug && console.log(
|
|
314
|
-
`[PositionTracker] Updated position for ${
|
|
315
|
-
|
|
306
|
+
`[PositionTracker] Updated position for ${i.selector}:`,
|
|
307
|
+
r
|
|
316
308
|
);
|
|
317
|
-
for (const
|
|
318
|
-
|
|
309
|
+
for (const n of i.callbacks)
|
|
310
|
+
n(r);
|
|
319
311
|
}
|
|
312
|
+
updateAllPositions = () => {
|
|
313
|
+
for (const [t] of this.tracked)
|
|
314
|
+
this.updatePosition(t);
|
|
315
|
+
};
|
|
320
316
|
startListening() {
|
|
321
317
|
this.scrollListener = this.updateAllPositions, window.addEventListener("scroll", this.scrollListener, !0), this.resizeListener = this.updateAllPositions, window.addEventListener("resize", this.resizeListener), "ResizeObserver" in window && (this.resizeObserver = new ResizeObserver(this.updateAllPositions)), this.mutationObserver = new MutationObserver(() => {
|
|
322
318
|
this.updateAllPositions();
|
|
@@ -326,8 +322,7 @@ class M {
|
|
|
326
322
|
});
|
|
327
323
|
}
|
|
328
324
|
stopListening() {
|
|
329
|
-
|
|
330
|
-
this.scrollListener && (window.removeEventListener("scroll", this.scrollListener, !0), this.scrollListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), (i = this.resizeObserver) == null || i.disconnect(), this.resizeObserver = null, (t = this.mutationObserver) == null || t.disconnect(), this.mutationObserver = null;
|
|
325
|
+
this.scrollListener && (window.removeEventListener("scroll", this.scrollListener, !0), this.scrollListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.resizeObserver?.disconnect(), this.resizeObserver = null, this.mutationObserver?.disconnect(), this.mutationObserver = null;
|
|
331
326
|
}
|
|
332
327
|
/**
|
|
333
328
|
* Clean up all listeners and subscriptions
|
|
@@ -337,16 +332,16 @@ class M {
|
|
|
337
332
|
}
|
|
338
333
|
}
|
|
339
334
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
335
|
+
d as Animation,
|
|
336
|
+
L as BeaconManager,
|
|
337
|
+
g as DEFAULT_POSITION,
|
|
343
338
|
m as MemoryStore,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
339
|
+
c as Position,
|
|
340
|
+
z as PositionTracker,
|
|
341
|
+
v as calculateDismissDuration,
|
|
342
|
+
b as combineTranslateWithAnimation,
|
|
343
|
+
w as getAnimationConfig,
|
|
344
|
+
x as getPopoverAnimationStyles,
|
|
345
|
+
y as mergeAnimationConfigs,
|
|
346
|
+
k as waitForAnimations
|
|
352
347
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repere/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"vite": "^7.3.0",
|
|
34
|
+
"vite-plugin-dts": "^4.5.4"
|
|
35
|
+
},
|
|
32
36
|
"scripts": {
|
|
33
37
|
"dev": "vite build --watch",
|
|
34
38
|
"build": "vite build",
|
|
File without changes
|