@repere/core 0.0.4 → 0.1.0

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 CHANGED
@@ -2,17 +2,17 @@ var c = /* @__PURE__ */ ((e) => (e.TopLeft = "top-left", e.TopCenter = "top-cent
2
2
  const g = c.TopRight;
3
3
  class m {
4
4
  state = /* @__PURE__ */ new Map();
5
- isDismissed(t) {
6
- return this.state.get(t)?.isDismissed ?? !1;
5
+ isDismissed(i) {
6
+ return this.state.get(i)?.isDismissed ?? !1;
7
7
  }
8
- dismiss(t) {
9
- this.state.set(t, {
10
- id: t,
8
+ dismiss(i) {
9
+ this.state.set(i, {
10
+ id: i,
11
11
  isDismissed: !0
12
12
  });
13
13
  }
14
- reset(t) {
15
- this.state.delete(t);
14
+ reset(i) {
15
+ this.state.delete(i);
16
16
  }
17
17
  resetAll() {
18
18
  this.state.clear();
@@ -72,142 +72,142 @@ const f = {
72
72
  function u(e) {
73
73
  return e ? typeof e == "string" ? { variant: e } : e : null;
74
74
  }
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;
75
+ function y(e, i) {
76
+ const t = u(e), n = u(i);
77
+ return !t && !n ? null : t ? n ? {
78
+ variant: n.variant ?? t.variant,
79
+ duration: n.duration ?? t.duration,
80
+ delay: n.delay ?? t.delay,
81
+ ease: n.ease ?? t.ease
82
+ } : t : n;
83
83
  }
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,
84
+ function b(e) {
85
+ const i = u(e);
86
+ if (!i) return null;
87
+ const t = f[i.variant];
88
+ return t ? {
89
+ variants: t,
90
90
  transition: {
91
- duration: (t.duration || 300) / 1e3,
91
+ duration: (i.duration || 300) / 1e3,
92
92
  // Convert ms to seconds
93
- delay: (t.delay || 0) / 1e3,
94
- ease: t.ease || [0.4, 0, 0.2, 1]
93
+ delay: (i.delay || 0) / 1e3,
94
+ ease: i.ease || [0.4, 0, 0.2, 1]
95
95
  // cubic-bezier
96
96
  }
97
- } : (console.warn(`[Repere] Unknown animation variant: ${t.variant}`), null);
97
+ } : (console.warn(`[Repere] Unknown animation variant: ${i.variant}`), null);
98
98
  }
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))`;
99
+ function w(e, i) {
100
+ const t = (a) => {
101
+ const s = a.match(/(-?\d+)%/);
102
+ return s ? parseFloat(s[1]) : 0;
103
+ }, n = t(e.x), r = t(e.y), o = (a = 0) => r === 0 && a === 0 ? `translate(${n}%, 0)` : a === 0 ? `translate(${n}%, ${r}%)` : `translate(${n}%, calc(${r}% + ${a}px))`;
104
104
  return {
105
105
  initial: {
106
- ...t.initial,
107
- transform: o(t.initial.y || 0)
106
+ ...i.initial,
107
+ transform: o(i.initial.y || 0)
108
108
  },
109
109
  animate: {
110
- ...t.animate,
111
- transform: o(t.animate.y || 0)
110
+ ...i.animate,
111
+ transform: o(i.animate.y || 0)
112
112
  },
113
113
  exit: {
114
- ...t.exit,
115
- transform: o(t.exit.y || 0)
114
+ ...i.exit,
115
+ transform: o(i.exit.y || 0)
116
116
  }
117
117
  };
118
118
  }
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;
119
+ function x(e, i) {
120
+ if (!e && !i) return {};
121
+ const t = e?.variants, n = e?.transition, r = i?.variants, o = i?.transition, a = o?.ease ?? n?.ease ?? [0.4, 0, 0.2, 1], s = Array.isArray(a) ? `cubic-bezier(${a.join(", ")})` : a;
122
122
  return {
123
123
  // Initial state (when opening starts) - from onOpen animation
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,
124
+ "--repere-initial-opacity": t?.initial.opacity ?? 0,
125
+ "--repere-initial-x": `${t?.initial.x ?? 0}px`,
126
+ "--repere-initial-y": `${t?.initial.y ?? 0}px`,
127
+ "--repere-initial-scale": t?.initial.scale ?? 1,
128
128
  // Animate state (fully open) - from onOpen animation
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,
129
+ "--repere-animate-opacity": t?.animate.opacity ?? 1,
130
+ "--repere-animate-x": `${t?.animate.x ?? 0}px`,
131
+ "--repere-animate-y": `${t?.animate.y ?? 0}px`,
132
+ "--repere-animate-scale": t?.animate.scale ?? 1,
133
133
  // Exit state (when closing) - from onClose animation
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,
134
+ "--repere-exit-opacity": r?.exit.opacity ?? 0,
135
+ "--repere-exit-x": `${r?.exit.x ?? 0}px`,
136
+ "--repere-exit-y": `${r?.exit.y ?? 0}px`,
137
+ "--repere-exit-scale": r?.exit.scale ?? 1,
138
138
  // Transition timing
139
- "--repere-transition-duration": `${o?.duration ?? s?.duration ?? 0.3}s`,
140
- "--repere-transition-timing": n
139
+ "--repere-transition-duration": `${o?.duration ?? n?.duration ?? 0.3}s`,
140
+ "--repere-transition-timing": s
141
141
  };
142
142
  }
143
- function v(e, t) {
144
- const i = e?.transition.duration ?? 0, s = t?.transition.duration ?? 0;
145
- return Math.max(i, s) * 1e3;
143
+ function v(e, i) {
144
+ const t = e?.transition.duration ?? 0, n = i?.transition.duration ?? 0;
145
+ return Math.max(t, n) * 1e3;
146
146
  }
147
147
  function k(e) {
148
- return new Promise((t) => setTimeout(t, e));
148
+ return new Promise((i) => setTimeout(i, e));
149
149
  }
150
- function p(e, t) {
151
- if (t instanceof RegExp)
152
- return t.test(e);
153
- if (t === e)
150
+ function h(e, i) {
151
+ if (i instanceof RegExp)
152
+ return i.test(e);
153
+ if (i === e)
154
154
  return !0;
155
- if (t.includes("*")) {
156
- const i = t.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
157
- return new RegExp(`^${i}$`).test(e);
155
+ if (i.includes("*")) {
156
+ const t = i.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
157
+ return new RegExp(`^${t}$`).test(e);
158
158
  }
159
159
  return !1;
160
160
  }
161
- class L {
161
+ class T {
162
162
  store;
163
163
  debug;
164
- constructor(t, i = {}) {
165
- this.store = t, this.debug = i.debug ?? !1;
164
+ constructor(i, t = {}) {
165
+ this.store = i, this.debug = t.debug ?? !1;
166
166
  }
167
167
  /**
168
168
  * Find all pages that match the current path
169
169
  * This supports wildcards - e.g., path="*" will match all pages
170
170
  */
171
- findMatchingPages(t, i) {
172
- const s = t.filter((a) => typeof a.path == "function" ? a.path(i) : p(i, a.path));
171
+ findMatchingPages(i, t) {
172
+ const n = i.filter((r) => typeof r.path == "function" ? r.path(t) : h(t, r.path));
173
173
  return this.debug && console.log(
174
174
  "[BeaconManager] Path:",
175
- i,
175
+ t,
176
176
  "Matched pages:",
177
- s.map((a) => a.id).join(", ") || "none"
178
- ), s;
177
+ n.map((r) => r.id).join(", ") || "none"
178
+ ), n;
179
179
  }
180
180
  /**
181
181
  * Get all active (non-dismissed) beacons for the current path
182
182
  * Includes beacons from all matching pages (supports wildcards)
183
183
  */
184
- async getActiveBeacons(t, i) {
185
- const s = this.findMatchingPages(t, i);
186
- if (s.length === 0)
184
+ async getActiveBeacons(i, t) {
185
+ const n = this.findMatchingPages(i, t);
186
+ if (n.length === 0)
187
187
  return this.debug && console.log("[BeaconManager] No matching pages found"), [];
188
188
  this.debug && console.log(
189
189
  "[BeaconManager] Found",
190
- s.length,
190
+ n.length,
191
191
  "matching page(s):",
192
- s.map((n) => n.id).join(", ")
192
+ n.map((s) => s.id).join(", ")
193
193
  );
194
- const a = [], o = /* @__PURE__ */ new Set();
195
- for (const n of s)
196
- for (const l of n.beacons) {
194
+ const r = [], o = /* @__PURE__ */ new Set();
195
+ for (const s of n)
196
+ for (const l of s.beacons) {
197
197
  if (o.has(l.id)) {
198
198
  this.debug && console.warn(
199
- `[BeaconManager] Duplicate beacon ID "${l.id}" in page "${n.id}", skipping`
199
+ `[BeaconManager] Duplicate beacon ID "${l.id}" in page "${s.id}", skipping`
200
200
  );
201
201
  continue;
202
202
  }
203
- o.add(l.id), a.push(l);
203
+ o.add(l.id), r.push(l);
204
204
  }
205
- const r = [];
206
- for (const n of a)
205
+ const a = [];
206
+ for (const s of r)
207
207
  await Promise.resolve(
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;
208
+ this.store.isDismissed(s.id)
209
+ ) ? this.debug && console.log("[BeaconManager] Beacon", s.id, "is dismissed") : a.push(s);
210
+ return this.debug && console.log("[BeaconManager] Active beacons:", a.length), a;
211
211
  }
212
212
  /**
213
213
  * Get the store instance
@@ -216,102 +216,114 @@ class L {
216
216
  return this.store;
217
217
  }
218
218
  }
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) {
219
+ function p(e, i = c.TopRight, t = { x: 0, y: 0 }) {
220
+ const { x: n = 0, y: r = 0 } = t;
221
+ let o = 0, a = 0, s = "0", l = "0";
222
+ switch (i) {
223
223
  // Top positions
224
224
  case c.TopLeft:
225
- o = e.top + window.scrollY, r = e.left + window.scrollX, n = "-50%", l = "-100%";
225
+ o = e.top + window.scrollY, a = e.left + window.scrollX, s = "-50%", l = "-100%";
226
226
  break;
227
227
  case c.TopCenter:
228
- o = e.top + window.scrollY, r = e.left + window.scrollX + e.width / 2, n = "-50%", l = "-100%";
228
+ o = e.top + window.scrollY, a = e.left + window.scrollX + e.width / 2, s = "-50%", l = "-100%";
229
229
  break;
230
230
  case c.TopRight:
231
- o = e.top + window.scrollY, r = e.right + window.scrollX, n = "-50%", l = "-100%";
231
+ o = e.top + window.scrollY, a = e.right + window.scrollX, s = "-50%", l = "-100%";
232
232
  break;
233
233
  // Right positions
234
234
  case c.RightCenter:
235
- o = e.top + window.scrollY + e.height / 2, r = e.right + window.scrollX, n = "0", l = "-50%";
235
+ o = e.top + window.scrollY + e.height / 2, a = e.right + window.scrollX, s = "0", l = "-50%";
236
236
  break;
237
237
  // Bottom positions
238
238
  case c.BottomLeft:
239
- o = e.bottom + window.scrollY, r = e.left + window.scrollX, n = "-50%", l = "0";
239
+ o = e.bottom + window.scrollY, a = e.left + window.scrollX, s = "-50%", l = "0";
240
240
  break;
241
241
  case c.BottomCenter:
242
- o = e.bottom + window.scrollY, r = e.left + window.scrollX + e.width / 2, n = "-50%", l = "0";
242
+ o = e.bottom + window.scrollY, a = e.left + window.scrollX + e.width / 2, s = "-50%", l = "0";
243
243
  break;
244
244
  case c.BottomRight:
245
- o = e.bottom + window.scrollY, r = e.right + window.scrollX, n = "-50%", l = "0";
245
+ o = e.bottom + window.scrollY, a = e.right + window.scrollX, s = "-50%", l = "0";
246
246
  break;
247
247
  // Left positions
248
248
  case c.LeftCenter:
249
- o = e.top + window.scrollY + e.height / 2, r = e.left + window.scrollX, n = "-100%", l = "-50%";
249
+ o = e.top + window.scrollY + e.height / 2, a = e.left + window.scrollX, s = "-100%", l = "-50%";
250
250
  break;
251
251
  }
252
- return o += a, r += s, {
252
+ return o += r, a += n, {
253
253
  top: o,
254
- left: r,
255
- translate: { x: n, y: l }
254
+ left: a,
255
+ translate: { x: s, y: l }
256
256
  };
257
257
  }
258
- class z {
258
+ class L {
259
259
  tracked = /* @__PURE__ */ new Map();
260
260
  scrollListener = null;
261
261
  resizeListener = null;
262
262
  resizeObserver = null;
263
263
  mutationObserver = null;
264
264
  debug = !1;
265
- constructor(t = !1) {
266
- this.debug = t;
265
+ constructor(i = !1) {
266
+ this.debug = i;
267
267
  }
268
268
  /**
269
269
  * Subscribe to position updates for an element
270
270
  */
271
- subscribe(t, i, s, a = {}) {
272
- const o = t;
271
+ subscribe(i, t, n, r = {}) {
272
+ const o = i;
273
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,
274
+ selector: i,
275
+ position: t,
276
+ offset: r.offset,
277
+ zIndex: r.zIndex ?? 9999,
278
+ delay: r.delay,
278
279
  callbacks: /* @__PURE__ */ new Set(),
279
- element: null
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()));
280
+ element: null,
281
+ hasInitialUpdate: !1
282
+ }), this.tracked.get(o)?.callbacks.add(n), this.tracked.size === 1 && this.startListening(), this.scheduleInitialUpdate(o), () => {
283
+ const s = this.tracked.get(o);
284
+ s && (s.callbacks.delete(n), s.callbacks.size === 0 && (s.delayTimeoutId !== void 0 && (clearTimeout(s.delayTimeoutId), s.delayTimeoutId = void 0), this.tracked.delete(o), this.tracked.size === 0 && this.stopListening()));
283
285
  };
284
286
  }
285
- updatePosition(t) {
286
- const i = this.tracked.get(t);
287
- if (!i) return;
288
- const s = document.querySelector(i.selector);
289
- if (!s) {
290
- this.debug && console.log(`[PositionTracker] Element not found: ${i.selector}`), i.element = null;
291
- for (const n of i.callbacks)
292
- n(null);
287
+ scheduleInitialUpdate(i) {
288
+ const t = this.tracked.get(i);
289
+ t && (!t.hasInitialUpdate && t.delay && t.delay > 0 ? (t.hasInitialUpdate = !0, this.debug && console.log(
290
+ `[PositionTracker] Delaying initial position calculation for ${i} by ${t.delay}ms`
291
+ ), t.delayTimeoutId = setTimeout(() => {
292
+ this.debug && console.log(
293
+ `[PositionTracker] Calculating position for ${i} after delay`
294
+ ), t.delayTimeoutId !== void 0 && (t.delayTimeoutId = void 0), this.updatePosition(i);
295
+ }, t.delay)) : (t.hasInitialUpdate || (t.hasInitialUpdate = !0), this.updatePosition(i)));
296
+ }
297
+ updatePosition(i) {
298
+ const t = this.tracked.get(i);
299
+ if (!t) return;
300
+ const n = document.querySelector(t.selector);
301
+ if (!n) {
302
+ this.debug && console.log(`[PositionTracker] Element not found: ${t.selector}`), t.element = null;
303
+ for (const s of t.callbacks)
304
+ s(null);
293
305
  return;
294
306
  }
295
- i.element = s;
296
- const a = s.getBoundingClientRect(), r = {
297
- ...h(
298
- a,
299
- i.position,
300
- i.offset
307
+ t.element = n;
308
+ const r = n.getBoundingClientRect(), a = {
309
+ ...p(
310
+ r,
311
+ t.position,
312
+ t.offset
301
313
  ),
302
314
  position: "fixed",
303
- zIndex: i.zIndex
315
+ zIndex: t.zIndex
304
316
  };
305
317
  this.debug && console.log(
306
- `[PositionTracker] Updated position for ${i.selector}:`,
307
- r
318
+ `[PositionTracker] Updated position for ${t.selector}:`,
319
+ a
308
320
  );
309
- for (const n of i.callbacks)
310
- n(r);
321
+ for (const s of t.callbacks)
322
+ s(a);
311
323
  }
312
324
  updateAllPositions = () => {
313
- for (const [t] of this.tracked)
314
- this.updatePosition(t);
325
+ for (const [i] of this.tracked)
326
+ this.updatePosition(i);
315
327
  };
316
328
  startListening() {
317
329
  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(() => {
@@ -328,19 +340,21 @@ class z {
328
340
  * Clean up all listeners and subscriptions
329
341
  */
330
342
  destroy() {
343
+ for (const [, i] of this.tracked)
344
+ i.delayTimeoutId !== void 0 && (clearTimeout(i.delayTimeoutId), i.delayTimeoutId = void 0);
331
345
  this.stopListening(), this.tracked.clear();
332
346
  }
333
347
  }
334
348
  export {
335
349
  d as Animation,
336
- L as BeaconManager,
350
+ T as BeaconManager,
337
351
  g as DEFAULT_POSITION,
338
352
  m as MemoryStore,
339
353
  c as Position,
340
- z as PositionTracker,
354
+ L as PositionTracker,
341
355
  v as calculateDismissDuration,
342
- b as combineTranslateWithAnimation,
343
- w as getAnimationConfig,
356
+ w as combineTranslateWithAnimation,
357
+ b as getAnimationConfig,
344
358
  x as getPopoverAnimationStyles,
345
359
  y as mergeAnimationConfigs,
346
360
  k as waitForAnimations
@@ -10,6 +10,12 @@ export interface TriggerConfig<TNode = unknown> {
10
10
  zIndex?: number;
11
11
  animations?: TriggerAnimations;
12
12
  component?: TNode;
13
+ /**
14
+ * Delay in milliseconds before calculating the beacon position.
15
+ * Useful when the target element has entrance animations that affect its position.
16
+ * @default 0
17
+ */
18
+ delay?: number;
13
19
  }
14
20
  export interface PopoverConfig<TNode = unknown> {
15
21
  position?: Position;
@@ -1 +1 @@
1
- {"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../src/types/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,MAAM;IACrB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa,CAAC,KAAK,GAAG,OAAO;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;AAED,MAAM,WAAW,aAAa,CAAC,KAAK,GAAG,OAAO;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;AAED,MAAM,WAAW,MAAM,CAAC,KAAK,GAAG,OAAO;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../src/types/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,MAAM;IACrB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa,CAAC,KAAK,GAAG,OAAO;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa,CAAC,KAAK,GAAG,OAAO;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;AAED,MAAM,WAAW,MAAM,CAAC,KAAK,GAAG,OAAO;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -19,7 +19,9 @@ export declare class PositionTracker {
19
19
  subscribe(selector: string, position: Position, callback: PositionCallback, options?: {
20
20
  offset?: Offset;
21
21
  zIndex?: number;
22
+ delay?: number;
22
23
  }): () => void;
24
+ private scheduleInitialUpdate;
23
25
  private updatePosition;
24
26
  private updateAllPositions;
25
27
  private startListening;
@@ -1 +1 @@
1
- {"version":3,"file":"PositionTracker.d.ts","sourceRoot":"","sources":["../../src/utils/PositionTracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,QAAQ,EAAE,wBAAwB,GAAG,IAAI,KACtC,IAAI,CAAC;AAWV;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,cAAc,CAA6B;IACnD,OAAO,CAAC,cAAc,CAA6B;IACnD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,KAAK,CAAS;gBAEV,KAAK,UAAQ;IAIzB;;OAEG;IACH,SAAS,CACP,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACZ,GACL,MAAM,IAAI;IA4Cb,OAAO,CAAC,cAAc;IA2CtB,OAAO,CAAC,kBAAkB,CAIxB;IAEF,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO;CAIR"}
1
+ {"version":3,"file":"PositionTracker.d.ts","sourceRoot":"","sources":["../../src/utils/PositionTracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,QAAQ,EAAE,wBAAwB,GAAG,IAAI,KACtC,IAAI,CAAC;AAcV;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,cAAc,CAA6B;IACnD,OAAO,CAAC,cAAc,CAA6B;IACnD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,KAAK,CAAS;gBAEV,KAAK,UAAQ;IAIzB;;OAEG;IACH,SAAS,CACP,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KACX,GACL,MAAM,IAAI;IAoDb,OAAO,CAAC,qBAAqB;IAoC7B,OAAO,CAAC,cAAc;IA2CtB,OAAO,CAAC,kBAAkB,CAIxB;IAEF,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO;CAYR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repere/core",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {