@flemo/core 1.1.1 → 1.1.2

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 (2) hide show
  1. package/dist/index.mjs +224 -218
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { create as D } from "zustand";
2
- import { pathToRegexp as S, match as Y } from "path-to-regexp";
3
- class B {
1
+ import { create as w } from "zustand";
2
+ import { pathToRegexp as v, match as B } from "path-to-regexp";
3
+ class Q {
4
4
  tasks = /* @__PURE__ */ new Map();
5
5
  instanceId = Date.now().toString();
6
6
  isLocked = !1;
@@ -10,7 +10,7 @@ class B {
10
10
  pendingTaskQueue = [];
11
11
  isProcessingPending = !1;
12
12
  async acquireLock(t) {
13
- for (let s = 0; s < 10; s++) {
13
+ for (let a = 0; a < 10; a++) {
14
14
  if (!this.isLocked)
15
15
  return this.isLocked = !0, this.currentTaskId = t, !0;
16
16
  await new Promise((r) => setTimeout(r, 100));
@@ -25,8 +25,8 @@ class B {
25
25
  }
26
26
  emitSignal(t) {
27
27
  const e = this.signalListeners.get(t);
28
- e && (e.forEach((a) => {
29
- this.resolveTask(a);
28
+ e && (e.forEach((s) => {
29
+ this.resolveTask(s);
30
30
  }), this.signalListeners.delete(t));
31
31
  }
32
32
  // 대기 중인 태스크들을 처리하는 메서드
@@ -53,7 +53,7 @@ class B {
53
53
  return new Promise((t) => {
54
54
  const e = () => {
55
55
  this.pendingTaskQueue.filter(
56
- (s) => s.status === "MANUAL_PENDING" || s.status === "SIGNAL_PENDING"
56
+ (a) => a.status === "MANUAL_PENDING" || a.status === "SIGNAL_PENDING"
57
57
  ).length === 0 ? t() : setTimeout(e, 100);
58
58
  };
59
59
  e();
@@ -61,15 +61,15 @@ class B {
61
61
  }
62
62
  // 태스크 상태 변경 시 대기 큐 처리
63
63
  async onTaskStatusChange(t, e) {
64
- (e === "COMPLETED" || e === "FAILED" || e === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((a) => a.id !== t), await this.processPendingTasks());
64
+ (e === "COMPLETED" || e === "FAILED" || e === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((s) => s.id !== t), await this.processPendingTasks());
65
65
  }
66
66
  async addTask(t, e = {}) {
67
- const a = e.id || this.generateTaskId();
68
- return new Promise((s, r) => {
67
+ const s = e.id || this.generateTaskId();
68
+ return new Promise((a, r) => {
69
69
  this.taskQueue = this.taskQueue.then(async () => {
70
70
  try {
71
71
  const { control: o, validate: c, rollback: l, dependencies: u = [], delay: d } = e, m = new AbortController(), i = {
72
- id: a,
72
+ id: s,
73
73
  execute: t,
74
74
  timestamp: Date.now(),
75
75
  retryCount: 0,
@@ -81,7 +81,7 @@ class B {
81
81
  control: o,
82
82
  abortController: m
83
83
  };
84
- this.tasks.set(i.id, i), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(i), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((g) => g.id !== i.id));
84
+ this.tasks.set(i.id, i), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(i), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((P) => P.id !== i.id));
85
85
  try {
86
86
  if (!await this.acquireLock(i.id))
87
87
  throw i.status = "FAILED", new Error("FAILED");
@@ -97,7 +97,7 @@ class B {
97
97
  d && d > 0 && await new Promise((f) => setTimeout(f, d));
98
98
  const p = await i.execute(i.abortController);
99
99
  if (i.abortController.signal.aborted) {
100
- i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"), s({
100
+ i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"), a({
101
101
  success: !0,
102
102
  result: void 0,
103
103
  taskId: i.id,
@@ -109,19 +109,19 @@ class B {
109
109
  if (e.control) {
110
110
  const f = e.control;
111
111
  if (f.delay && f.delay > 0 && await new Promise((y) => setTimeout(y, f.delay)), f.manual) {
112
- i.status = "MANUAL_PENDING", i.manualResolver = { resolve: s, reject: r, result: p }, this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "MANUAL_PENDING");
112
+ i.status = "MANUAL_PENDING", i.manualResolver = { resolve: a, reject: r, result: p }, this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "MANUAL_PENDING");
113
113
  return;
114
114
  }
115
115
  if (f.signal) {
116
- i.status = "SIGNAL_PENDING", i.manualResolver = { resolve: s, reject: r, result: p }, this.signalListeners.has(f.signal) || this.signalListeners.set(f.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(f.signal).add(i.id), this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "SIGNAL_PENDING");
116
+ i.status = "SIGNAL_PENDING", i.manualResolver = { resolve: a, reject: r, result: p }, this.signalListeners.has(f.signal) || this.signalListeners.set(f.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(f.signal).add(i.id), this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "SIGNAL_PENDING");
117
117
  return;
118
118
  }
119
119
  if (f.condition && !await f.condition()) {
120
- i.status = "MANUAL_PENDING", i.manualResolver = { resolve: s, reject: r, result: p }, this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "MANUAL_PENDING");
120
+ i.status = "MANUAL_PENDING", i.manualResolver = { resolve: a, reject: r, result: p }, this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "MANUAL_PENDING");
121
121
  return;
122
122
  }
123
123
  }
124
- i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"), s({
124
+ i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"), a({
125
125
  success: !0,
126
126
  result: p,
127
127
  taskId: i.id,
@@ -138,8 +138,8 @@ class B {
138
138
  } finally {
139
139
  this.releaseLock(i.id);
140
140
  }
141
- } catch (g) {
142
- r(g);
141
+ } catch (P) {
142
+ r(P);
143
143
  }
144
144
  } catch (o) {
145
145
  r(o);
@@ -155,10 +155,10 @@ class B {
155
155
  if (e.control?.condition && !await e.control.condition())
156
156
  return !1;
157
157
  e.status = "COMPLETED";
158
- const a = e.manualResolver;
159
- return a.resolve({
158
+ const s = e.manualResolver;
159
+ return s.resolve({
160
160
  success: !0,
161
- result: a.result,
161
+ result: s.result,
162
162
  taskId: e.id,
163
163
  timestamp: Date.now(),
164
164
  instanceId: this.instanceId
@@ -173,7 +173,7 @@ class B {
173
173
  await Promise.all(t.map((e) => this.resolveTask(e.id)));
174
174
  }
175
175
  }
176
- const pt = new B(), yt = D((n) => ({
176
+ const yt = new Q(), Pt = w((n) => ({
177
177
  index: -1,
178
178
  histories: [],
179
179
  addHistory: (t) => n((e) => ({
@@ -186,27 +186,27 @@ const pt = new B(), yt = D((n) => ({
186
186
  })),
187
187
  popHistory: (t) => n((e) => ({
188
188
  index: e.index - 1,
189
- histories: e.histories.filter((a, s) => s !== t)
189
+ histories: e.histories.filter((s, a) => a !== t)
190
190
  }))
191
- })), gt = D((n) => ({
191
+ })), gt = w((n) => ({
192
192
  status: "IDLE",
193
193
  transitionTaskId: null,
194
194
  setStatus: (t) => n({ status: t }),
195
195
  setTransitionTaskId: (t) => n({ transitionTaskId: t })
196
196
  }));
197
- let N = 0;
198
- function Pt() {
199
- N += 1;
197
+ let L = 0;
198
+ function It() {
199
+ L += 1;
200
200
  }
201
201
  function Et() {
202
- return N > 0 ? (N -= 1, !0) : !1;
202
+ return L > 0 ? (L -= 1, !0) : !1;
203
203
  }
204
- function k({
204
+ function T({
205
205
  name: n,
206
206
  initial: t,
207
207
  idle: e,
208
- enter: a,
209
- enterBack: s,
208
+ enter: s,
209
+ enterBack: a,
210
210
  exit: r,
211
211
  exitBack: o,
212
212
  options: c
@@ -218,23 +218,23 @@ function k({
218
218
  "IDLE-true": e,
219
219
  "IDLE-false": e,
220
220
  "PUSHING-false": r,
221
- "PUSHING-true": a,
221
+ "PUSHING-true": s,
222
222
  "REPLACING-false": r,
223
- "REPLACING-true": a,
223
+ "REPLACING-true": s,
224
224
  "POPPING-false": o,
225
- "POPPING-true": s,
225
+ "POPPING-true": a,
226
226
  "COMPLETED-false": r,
227
- "COMPLETED-true": a
227
+ "COMPLETED-true": s
228
228
  },
229
229
  ...c
230
230
  };
231
231
  }
232
- function It({
232
+ function kt({
233
233
  name: n,
234
234
  initial: t,
235
235
  idle: e,
236
- pushOnEnter: a,
237
- pushOnExit: s,
236
+ pushOnEnter: s,
237
+ pushOnExit: a,
238
238
  replaceOnEnter: r,
239
239
  replaceOnExit: o,
240
240
  popOnEnter: c,
@@ -249,8 +249,8 @@ function It({
249
249
  variants: {
250
250
  "IDLE-true": e,
251
251
  "IDLE-false": e,
252
- "PUSHING-false": s,
253
- "PUSHING-true": a,
252
+ "PUSHING-false": a,
253
+ "PUSHING-true": s,
254
254
  "REPLACING-false": o,
255
255
  "REPLACING-true": r,
256
256
  "POPPING-false": l,
@@ -261,12 +261,12 @@ function It({
261
261
  ...m
262
262
  };
263
263
  }
264
- const Q = (n, t, e) => {
265
- const [a, s] = t, [r, o] = e;
266
- if (s === a) return r;
267
- const c = (n - a) / (s - a);
264
+ const X = (n, t, e) => {
265
+ const [s, a] = t, [r, o] = e;
266
+ if (a === s) return r;
267
+ const c = (n - s) / (a - s);
268
268
  return r + c * (o - r);
269
- }, X = k({
269
+ }, F = T({
270
270
  name: "cupertino",
271
271
  initial: {
272
272
  x: "100%"
@@ -319,10 +319,10 @@ const Q = (n, t, e) => {
319
319
  decoratorName: "overlay",
320
320
  swipeDirection: "x",
321
321
  onSwipeStart: async () => !0,
322
- onSwipe: (n, t, { animate: e, currentScreen: a, prevScreen: s, onProgress: r }) => {
323
- const { offset: o } = t, c = o.x, l = Q(c, [0, window.innerWidth], [0, 100]);
322
+ onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
323
+ const { offset: o } = t, c = o.x, l = X(c, [0, window.innerWidth], [0, 100]);
324
324
  return r?.(!0, l), e(
325
- a,
325
+ s,
326
326
  {
327
327
  x: Math.max(0, c)
328
328
  },
@@ -330,7 +330,7 @@ const Q = (n, t, e) => {
330
330
  duration: 0
331
331
  }
332
332
  ), e(
333
- s,
333
+ a,
334
334
  {
335
335
  x: -100 + l
336
336
  },
@@ -339,11 +339,11 @@ const Q = (n, t, e) => {
339
339
  }
340
340
  ), l;
341
341
  },
342
- onSwipeEnd: async (n, t, { animate: e, currentScreen: a, prevScreen: s, onStart: r }) => {
342
+ onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
343
343
  const { offset: o, velocity: c } = t, u = o.x > 50 || c.x > 20;
344
344
  return r?.(u), await Promise.all([
345
345
  e(
346
- a,
346
+ s,
347
347
  {
348
348
  x: u ? "100%" : 0
349
349
  },
@@ -353,7 +353,7 @@ const Q = (n, t, e) => {
353
353
  }
354
354
  ),
355
355
  e(
356
- s,
356
+ a,
357
357
  {
358
358
  x: u ? 0 : -100
359
359
  },
@@ -365,12 +365,12 @@ const Q = (n, t, e) => {
365
365
  ]), u;
366
366
  }
367
367
  }
368
- }), F = (n, t, e) => {
369
- const [a, s] = t, [r, o] = e;
370
- if (s === a) return r;
371
- const c = (n - a) / (s - a);
368
+ }), z = (n, t, e) => {
369
+ const [s, a] = t, [r, o] = e;
370
+ if (a === s) return r;
371
+ const c = (n - s) / (a - s);
372
372
  return r + c * (o - r);
373
- }, z = k({
373
+ }, V = T({
374
374
  name: "layout",
375
375
  initial: {
376
376
  opacity: 0.97
@@ -419,10 +419,10 @@ const Q = (n, t, e) => {
419
419
  decoratorName: "overlay",
420
420
  swipeDirection: "y",
421
421
  onSwipeStart: async () => !0,
422
- onSwipe: (n, t, { animate: e, currentScreen: a, onProgress: s }) => {
423
- const { offset: r } = t, o = r.y, c = Math.max(0, Math.min(56, o)), l = F(c, [0, 56], [1, 0.96]), u = Math.max(0, o - 56), d = Math.min(1, u / 160), m = Math.sqrt(d) * 12, i = Math.max(0, c + m), h = Math.min(56, i);
424
- return s?.(!0, 100), e(
425
- a,
422
+ onSwipe: (n, t, { animate: e, currentScreen: s, onProgress: a }) => {
423
+ const { offset: r } = t, o = r.y, c = Math.max(0, Math.min(56, o)), l = z(c, [0, 56], [1, 0.96]), u = Math.max(0, o - 56), d = Math.min(1, u / 160), m = Math.sqrt(d) * 12, i = Math.max(0, c + m), h = Math.min(56, i);
424
+ return a?.(!0, 100), e(
425
+ s,
426
426
  {
427
427
  y: i,
428
428
  opacity: l
@@ -432,11 +432,11 @@ const Q = (n, t, e) => {
432
432
  }
433
433
  ), h;
434
434
  },
435
- onSwipeEnd: async (n, t, { animate: e, currentScreen: a, prevScreen: s, onStart: r }) => {
435
+ onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
436
436
  const { offset: o, velocity: c } = t, u = o.y > 56 || c.y > 20;
437
437
  return r?.(u), await Promise.all([
438
438
  e(
439
- a,
439
+ s,
440
440
  {
441
441
  y: u ? "100%" : 0,
442
442
  opacity: u ? 0.96 : 1
@@ -446,7 +446,7 @@ const Q = (n, t, e) => {
446
446
  }
447
447
  ),
448
448
  e(
449
- s,
449
+ a,
450
450
  {
451
451
  y: 0,
452
452
  opacity: u ? 1 : 0.97
@@ -458,7 +458,7 @@ const Q = (n, t, e) => {
458
458
  ]), u;
459
459
  }
460
460
  }
461
- }), V = k({
461
+ }), Z = T({
462
462
  name: "material",
463
463
  initial: {
464
464
  y: "100%"
@@ -510,10 +510,10 @@ const Q = (n, t, e) => {
510
510
  options: {
511
511
  swipeDirection: "y",
512
512
  onSwipeStart: async () => !0,
513
- onSwipe: (n, t, { animate: e, currentScreen: a, prevScreen: s, onProgress: r }) => {
513
+ onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
514
514
  const { offset: o } = t, c = o.y, l = Math.max(0, Math.min(56, c)), u = Math.max(0, c - 56), d = Math.min(1, u / 160), m = Math.sqrt(d) * 12, i = Math.max(0, l + m), h = Math.min(56, i);
515
515
  return r?.(!0, h), e(
516
- a,
516
+ s,
517
517
  {
518
518
  y: i
519
519
  },
@@ -521,18 +521,18 @@ const Q = (n, t, e) => {
521
521
  duration: 0
522
522
  }
523
523
  ), e(
524
- s,
524
+ a,
525
525
  {
526
526
  y: -56 + h
527
527
  },
528
528
  { duration: 0 }
529
529
  ), h;
530
530
  },
531
- onSwipeEnd: async (n, t, { animate: e, currentScreen: a, prevScreen: s, onStart: r }) => {
531
+ onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
532
532
  const { offset: o, velocity: c } = t, u = o.y > 56 || c.y > 20;
533
533
  return r?.(u), await Promise.all([
534
534
  e(
535
- a,
535
+ s,
536
536
  {
537
537
  y: u ? "100%" : 0
538
538
  },
@@ -542,7 +542,7 @@ const Q = (n, t, e) => {
542
542
  }
543
543
  ),
544
544
  e(
545
- s,
545
+ a,
546
546
  {
547
547
  y: u ? 0 : -56
548
548
  },
@@ -554,7 +554,7 @@ const Q = (n, t, e) => {
554
554
  ]), u;
555
555
  }
556
556
  }
557
- }), Z = k({
557
+ }), j = T({
558
558
  name: "none",
559
559
  initial: {},
560
560
  idle: {
@@ -587,21 +587,21 @@ const Q = (n, t, e) => {
587
587
  duration: 0
588
588
  }
589
589
  }
590
- }), kt = /* @__PURE__ */ new Map([
591
- ["none", Z],
592
- ["cupertino", X],
593
- ["material", V],
594
- ["layout", z]
595
- ]), Tt = D((n) => ({
590
+ }), Tt = /* @__PURE__ */ new Map([
591
+ ["none", j],
592
+ ["cupertino", F],
593
+ ["material", Z],
594
+ ["layout", V]
595
+ ]), Nt = w((n) => ({
596
596
  defaultTransitionName: "cupertino",
597
597
  setDefaultTransitionName: (t) => n({ defaultTransitionName: t })
598
598
  }));
599
- function j({
599
+ function K({
600
600
  name: n,
601
601
  initial: t,
602
602
  idle: e,
603
- enter: a,
604
- exit: s,
603
+ enter: s,
604
+ exit: a,
605
605
  options: r
606
606
  }) {
607
607
  return {
@@ -611,23 +611,23 @@ function j({
611
611
  "IDLE-true": e,
612
612
  "IDLE-false": e,
613
613
  "PUSHING-true": e,
614
- "PUSHING-false": a,
614
+ "PUSHING-false": s,
615
615
  "REPLACING-true": e,
616
- "REPLACING-false": a,
616
+ "REPLACING-false": s,
617
617
  "POPPING-true": e,
618
- "POPPING-false": s,
618
+ "POPPING-false": a,
619
619
  "COMPLETED-true": e,
620
- "COMPLETED-false": a
620
+ "COMPLETED-false": s
621
621
  },
622
622
  ...r
623
623
  };
624
624
  }
625
- function Nt({
625
+ function Lt({
626
626
  name: n,
627
627
  initial: t,
628
628
  idle: e,
629
- pushOnEnter: a,
630
- pushOnExit: s,
629
+ pushOnEnter: s,
630
+ pushOnExit: a,
631
631
  replaceOnEnter: r,
632
632
  replaceOnExit: o,
633
633
  popOnEnter: c,
@@ -642,8 +642,8 @@ function Nt({
642
642
  variants: {
643
643
  "IDLE-true": e,
644
644
  "IDLE-false": e,
645
- "PUSHING-false": s,
646
- "PUSHING-true": a,
645
+ "PUSHING-false": a,
646
+ "PUSHING-true": s,
647
647
  "REPLACING-false": o,
648
648
  "REPLACING-true": r,
649
649
  "POPPING-false": l,
@@ -654,16 +654,16 @@ function Nt({
654
654
  ...m
655
655
  };
656
656
  }
657
- const K = j({
657
+ const I = "rgba(0, 0, 0, 0.3)", q = K({
658
658
  name: "overlay",
659
659
  initial: {
660
660
  opacity: 0,
661
- backgroundColor: "rgba(0, 0, 0, 0)"
661
+ backgroundColor: I
662
662
  },
663
663
  idle: {
664
664
  value: {
665
665
  opacity: 0,
666
- backgroundColor: "rgba(0, 0, 0, 0)"
666
+ backgroundColor: I
667
667
  },
668
668
  options: {
669
669
  duration: 0
@@ -671,25 +671,31 @@ const K = j({
671
671
  },
672
672
  // Visible dim — applied when this screen is the one going behind / sitting
673
673
  // behind a new active screen (PUSHING-false / REPLACING-false / COMPLETED-false).
674
+ // Duration + easing track cupertino's enter/exit so the dim arrives in
675
+ // lockstep with the underlying screen slide and there's no
676
+ // animation-vs-hold-by-fill window for the rest-rule handoff to race against.
674
677
  enter: {
675
678
  value: {
676
679
  opacity: 1,
677
- backgroundColor: "rgba(0, 0, 0, 0.3)"
680
+ backgroundColor: I
678
681
  },
679
682
  options: {
680
- duration: 0.3
683
+ duration: 0.7,
684
+ ease: [0.32, 0.72, 0, 1]
681
685
  }
682
686
  },
683
687
  // POPPING-false target: the previously-behind screen is returning to active.
684
688
  // Fades from `enter` (visible dim) back to invisible so the overlay clears
685
- // before the screen lands at COMPLETED-true (= idle).
689
+ // before the screen lands at COMPLETED-true (= idle). Mirrors cupertino's
690
+ // enterBack (the returning screen's slide-in) duration.
686
691
  exit: {
687
692
  value: {
688
693
  opacity: 0,
689
- backgroundColor: "rgba(0, 0, 0, 0)"
694
+ backgroundColor: I
690
695
  },
691
696
  options: {
692
- duration: 0.3
697
+ duration: 0.6,
698
+ ease: [0.32, 0.72, 0, 1]
693
699
  }
694
700
  },
695
701
  options: {
@@ -702,8 +708,8 @@ const K = j({
702
708
  duration: 0.3
703
709
  }
704
710
  ),
705
- onSwipe: (n, t, { animate: e, prevDecorator: a }) => e(
706
- a,
711
+ onSwipe: (n, t, { animate: e, prevDecorator: s }) => e(
712
+ s,
707
713
  {
708
714
  opacity: Math.max(0, 1 - t / 100)
709
715
  },
@@ -721,7 +727,7 @@ const K = j({
721
727
  }
722
728
  )
723
729
  }
724
- }), Lt = /* @__PURE__ */ new Map([["overlay", K]]), I = {
730
+ }), Dt = /* @__PURE__ */ new Map([["overlay", q]]), k = {
725
731
  "IDLE-true": "self",
726
732
  "IDLE-false": "self",
727
733
  "PUSHING-true": "initial",
@@ -732,7 +738,7 @@ const K = j({
732
738
  "POPPING-false": "PUSHING-false",
733
739
  "COMPLETED-true": "self",
734
740
  "COMPLETED-false": "self"
735
- }, G = Object.keys(I), q = G, W = (n) => n.replace(/[^a-zA-Z0-9_-]/g, "_"), O = (n) => typeof n == "object" && n !== null && !Array.isArray(n), J = /* @__PURE__ */ new Set([
741
+ }, O = Object.keys(k), W = O, J = (n) => n.replace(/[^a-zA-Z0-9_-]/g, "_"), b = (n) => typeof n == "object" && n !== null && !Array.isArray(n), tt = /* @__PURE__ */ new Set([
736
742
  "opacity",
737
743
  "scale",
738
744
  "scaleX",
@@ -769,7 +775,7 @@ const K = j({
769
775
  "strokeDashoffset",
770
776
  "strokeMiterlimit",
771
777
  "strokeWidth"
772
- ]), tt = (n, t) => t.startsWith("--") ? `${n}` : J.has(t) ? `${n}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${n}deg` : `${n}px`, b = (n, t) => typeof t == "number" ? tt(t, n) : typeof t == "string" ? t : "", $ = (n) => n.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`), R = /* @__PURE__ */ new Set([
778
+ ]), et = (n, t) => t.startsWith("--") ? `${n}` : tt.has(t) ? `${n}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${n}deg` : `${n}px`, $ = (n, t) => typeof t == "number" ? et(t, n) : typeof t == "string" ? t : "", R = (n) => n.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`), _ = /* @__PURE__ */ new Set([
773
779
  "x",
774
780
  "y",
775
781
  "z",
@@ -780,7 +786,7 @@ const K = j({
780
786
  "rotateX",
781
787
  "rotateY",
782
788
  "rotateZ"
783
- ]), et = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, nt = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, at = /^1(\.0+)?$/, st = (n, t) => n === "scale" || n === "scaleX" || n === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? at.test(t.trim()) : !1 : n === "rotate" || n === "rotateX" || n === "rotateY" || n === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? nt.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? et.test(t.trim()) : !1, rt = (n, t) => {
789
+ ]), nt = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, st = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, at = /^1(\.0+)?$/, rt = (n, t) => n === "scale" || n === "scaleX" || n === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? at.test(t.trim()) : !1 : n === "rotate" || n === "rotateX" || n === "rotateY" || n === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? st.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? nt.test(t.trim()) : !1, ot = (n, t) => {
784
790
  switch (n) {
785
791
  case "x":
786
792
  return `translateX(${t})`;
@@ -804,35 +810,35 @@ const K = j({
804
810
  default:
805
811
  return "";
806
812
  }
807
- }, Dt = (n) => {
813
+ }, wt = (n) => {
808
814
  const t = /* @__PURE__ */ new Set();
809
815
  let e = !1;
810
- const a = (s) => {
811
- if (O(s))
812
- for (const r of Object.keys(s)) {
813
- const o = s[r];
814
- b(r, o) !== "" && (R.has(r) ? e = !0 : t.add($(r)));
816
+ const s = (a) => {
817
+ if (b(a))
818
+ for (const r of Object.keys(a)) {
819
+ const o = a[r];
820
+ $(r, o) !== "" && (_.has(r) ? e = !0 : t.add(R(r)));
815
821
  }
816
822
  };
817
- a(n.initial);
818
- for (const s of Object.values(n.variants))
819
- a(s.value);
823
+ s(n.initial);
824
+ for (const a of Object.values(n.variants))
825
+ s(a.value);
820
826
  return e && t.add("transform"), Array.from(t);
821
- }, P = (n) => {
822
- if (!O(n)) return [];
827
+ }, g = (n) => {
828
+ if (!b(n)) return [];
823
829
  const t = [];
824
830
  let e = !0;
825
- const a = [];
826
- for (const s of Object.keys(n)) {
827
- const r = n[s], o = b(s, r);
828
- o !== "" && (R.has(s) ? (t.push(rt(s, o)), st(s, r) || (e = !1)) : a.push({ property: $(s), value: o }));
831
+ const s = [];
832
+ for (const a of Object.keys(n)) {
833
+ const r = n[a], o = $(a, r);
834
+ o !== "" && (_.has(a) ? (t.push(ot(a, o)), rt(a, r) || (e = !1)) : s.push({ property: R(a), value: o }));
829
835
  }
830
- return t.length > 0 && a.push({
836
+ return t.length > 0 && s.push({
831
837
  property: "transform",
832
838
  value: e ? "none" : t.join(" ")
833
- }), a;
839
+ }), s;
834
840
  }, E = (n) => n.map((t) => ` ${t.property}: ${t.value};`).join(`
835
- `), ot = (n) => Array.isArray(n) ? n.length === 4 && n.every((t) => typeof t == "number") ? `cubic-bezier(${n.join(", ")})` : "linear" : typeof n == "string" ? {
841
+ `), it = (n) => Array.isArray(n) ? n.length === 4 && n.every((t) => typeof t == "number") ? `cubic-bezier(${n.join(", ")})` : "linear" : typeof n == "string" ? {
836
842
  linear: "linear",
837
843
  easeIn: "ease-in",
838
844
  easeOut: "ease-out",
@@ -842,22 +848,22 @@ const K = j({
842
848
  backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
843
849
  backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
844
850
  anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
845
- }[n] ?? "ease" : "ease", _ = (n) => {
851
+ }[n] ?? "ease" : "ease", H = (n) => {
846
852
  if (!n) return 0;
847
853
  const t = n.duration;
848
854
  return typeof t == "number" && t >= 0 ? t : 0;
849
- }, H = (n) => n && typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, v = (n, t) => {
850
- const [e, a] = t.split("-");
851
- return `[data-flemo-screen][data-flemo-transition="${n}"][data-flemo-status="${e}"][data-flemo-active="${a}"]`;
852
- }, A = (n, t) => {
853
- const [e, a] = t.split("-");
854
- return `[data-flemo-decorator][data-flemo-decorator-name="${n}"][data-flemo-status="${e}"][data-flemo-active="${a}"]`;
855
- }, it = (n, t) => {
856
- const [e, a] = t.split("-");
857
- return `[data-flemo-bar][data-flemo-bar-transition="${n}"][data-flemo-bar-status="${e}"][data-flemo-bar-active="${a}"][data-flemo-bar-riding="true"]`;
858
- }, ct = (n, t, e) => `flemo-${n}-${W(t)}-${e}`, M = (n, t, e, a, s, r) => {
859
- const o = P(a), c = P(s.value), l = _(s.options), u = H(s.options), d = ot(s.options?.ease), m = r(t, e), i = n === "screen" ? `${m},
860
- ${it(t, e)}` : m;
855
+ }, U = (n) => n && typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, A = (n, t) => {
856
+ const [e, s] = t.split("-");
857
+ return `[data-flemo-screen][data-flemo-transition="${n}"][data-flemo-status="${e}"][data-flemo-active="${s}"]`;
858
+ }, M = (n, t) => {
859
+ const [e, s] = t.split("-");
860
+ return `[data-flemo-decorator][data-flemo-decorator-name="${n}"][data-flemo-status="${e}"][data-flemo-active="${s}"]`;
861
+ }, ct = (n, t) => {
862
+ const [e, s] = t.split("-");
863
+ return `[data-flemo-bar][data-flemo-bar-transition="${n}"][data-flemo-bar-status="${e}"][data-flemo-bar-active="${s}"][data-flemo-bar-riding="true"]`;
864
+ }, ut = (n, t, e) => `flemo-${n}-${J(t)}-${e}`, C = (n, t, e, s, a, r) => {
865
+ const o = g(s), c = g(a.value), l = H(a.options), u = U(a.options), d = it(a.options?.ease), m = r(t, e), i = n === "screen" ? `${m},
866
+ ${ct(t, e)}` : m;
861
867
  if (c.length === 0 && o.length === 0)
862
868
  return "";
863
869
  if (l <= 0 && u <= 0)
@@ -865,7 +871,7 @@ ${it(t, e)}` : m;
865
871
  ${E(c)}
866
872
  animation: none;
867
873
  }`;
868
- const h = ct(n, t, e), g = [
874
+ const h = ut(n, t, e), P = [
869
875
  `@keyframes ${h} {`,
870
876
  " from {",
871
877
  E(o).replace(/^/gm, " "),
@@ -882,142 +888,142 @@ ${E(c)}
882
888
  u > 0 ? `${u}s` : null,
883
889
  "both"
884
890
  ].filter(Boolean).join(" "), f = Array.from(
885
- /* @__PURE__ */ new Set([...o.map((T) => T.property), ...c.map((T) => T.property)])
891
+ /* @__PURE__ */ new Set([...o.map((N) => N.property), ...c.map((N) => N.property)])
886
892
  ), y = f.length > 0 ? ` will-change: ${f.join(", ")};
887
- ` : "", w = e.split("-")[0], U = `${i} {
893
+ ` : "", S = e.split("-")[0], Y = `${i} {
888
894
  animation: ${p};
889
- ${y}${w === "PUSHING" || w === "REPLACING" ? ` contain: layout;
895
+ ${y}${S === "PUSHING" || S === "REPLACING" ? ` contain: layout;
890
896
  pointer-events: none;
891
897
  ` : ""}}`;
892
- return `${g}
893
- ${U}`;
894
- }, x = (n, t, e, a) => {
895
- const s = P(a.value);
896
- return s.length === 0 ? "" : `${n(t, e)} {
897
- ${E(s)}
898
+ return `${P}
899
+ ${Y}`;
900
+ }, x = (n, t, e, s) => {
901
+ const a = g(s.value);
902
+ return a.length === 0 ? "" : `${n(t, e)} {
903
+ ${E(a)}
898
904
  }`;
899
- }, wt = (n, t) => {
905
+ }, St = (n, t) => {
900
906
  const e = [];
901
- for (const a of n) {
902
- const s = a.name;
903
- for (const r of G) {
904
- const o = a.variants[r], c = I[r];
907
+ for (const s of n) {
908
+ const a = s.name;
909
+ for (const r of O) {
910
+ const o = s.variants[r], c = k[r];
905
911
  if (c === "self") {
906
- e.push(x(v, s, r, o));
912
+ e.push(x(A, a, r, o));
907
913
  continue;
908
914
  }
909
- const l = c === "initial" ? a.initial : a.variants[c].value;
915
+ const l = c === "initial" ? s.initial : s.variants[c].value;
910
916
  e.push(
911
- M("screen", s, r, l, o, v)
917
+ C("screen", a, r, l, o, A)
912
918
  );
913
919
  }
914
920
  }
915
- for (const a of t) {
916
- const s = a.name;
917
- for (const r of q) {
918
- const o = a.variants[r], c = I[r];
921
+ for (const s of t) {
922
+ const a = s.name;
923
+ for (const r of W) {
924
+ const o = s.variants[r], c = k[r];
919
925
  if (c === "self") {
920
- e.push(x(A, s, r, o));
926
+ e.push(x(M, a, r, o));
921
927
  continue;
922
928
  }
923
- const l = c === "initial" ? a.initial : a.variants[c].value;
929
+ const l = c === "initial" ? s.initial : s.variants[c].value;
924
930
  e.push(
925
- M(
931
+ C(
926
932
  "decorator",
927
- s,
933
+ a,
928
934
  r,
929
935
  l,
930
936
  o,
931
- A
937
+ M
932
938
  )
933
939
  );
934
940
  }
935
941
  }
936
- return e.filter((a) => a.length > 0).join(`
942
+ return e.filter((s) => s.length > 0).join(`
937
943
 
938
944
  `);
939
- }, St = (n, t) => {
940
- const e = I[t];
945
+ }, vt = (n, t) => {
946
+ const e = k[t];
941
947
  if (e === "self") return !1;
942
- const a = n.variants[t], s = _(a.options), r = H(a.options);
943
- if (s <= 0 && r <= 0) return !1;
944
- const o = e === "initial" ? n.initial : n.variants[e].value, c = P(o), l = P(a.value);
948
+ const s = n.variants[t], a = H(s.options), r = U(s.options);
949
+ if (a <= 0 && r <= 0) return !1;
950
+ const o = e === "initial" ? n.initial : n.variants[e].value, c = g(o), l = g(s.value);
945
951
  return c.length > 0 || l.length > 0;
946
952
  };
947
- function vt() {
953
+ function At() {
948
954
  return typeof document > "u";
949
955
  }
950
- function ut(n, t) {
951
- return Array.isArray(n) ? n.find((e) => S(e).regexp.test(t)) ?? "" : S(n).regexp.test(t) ? n : "";
956
+ function lt(n, t) {
957
+ return Array.isArray(n) ? n.find((e) => v(e).regexp.test(t)) ?? "" : v(n).regexp.test(t) ? n : "";
952
958
  }
953
- function At(n, t, e) {
954
- const a = ut(n, t), s = Y(a)(t), r = new URLSearchParams(e), o = Object.fromEntries(r.entries());
955
- return s ? { ...s.params, ...o } : {};
959
+ function Mt(n, t, e) {
960
+ const s = lt(n, t), a = B(s)(t), r = new URLSearchParams(e), o = Object.fromEntries(r.entries());
961
+ return a ? { ...a.params, ...o } : {};
956
962
  }
957
- function Mt(n, t) {
963
+ function Ct(n, t) {
958
964
  const {
959
965
  direction: e = "x",
960
- markerSelector: a = "[data-swipe-at-edge]",
961
- depthLimit: s = 24,
966
+ markerSelector: s = "[data-swipe-at-edge]",
967
+ depthLimit: a = 24,
962
968
  verifyByScroll: r = !1
963
- } = t ?? {}, o = lt(n);
969
+ } = t ?? {}, o = ft(n);
964
970
  if (!o) return { element: null, hasMarker: !1 };
965
- const c = o.closest?.(a);
966
- if (c instanceof HTMLElement && L(c, e) && (!r || C(c, e)))
971
+ const c = o.closest?.(s);
972
+ if (c instanceof HTMLElement && D(c, e) && (!r || G(c, e)))
967
973
  return { element: c, hasMarker: !0 };
968
974
  let l = o, u = 0;
969
- for (; l && u < s; ) {
970
- if (L(l, e) && (!r || C(l, e)))
975
+ for (; l && u < a; ) {
976
+ if (D(l, e) && (!r || G(l, e)))
971
977
  return { element: l, hasMarker: !1 };
972
978
  l = l.parentElement, u++;
973
979
  }
974
980
  return { element: null, hasMarker: !1 };
975
981
  }
976
- function lt(n) {
982
+ function ft(n) {
977
983
  if (!n) return null;
978
984
  const t = n, e = typeof t.composedPath == "function" ? t.composedPath() : void 0;
979
985
  if (e && e.length) {
980
- for (const a of e)
981
- if (a instanceof HTMLElement) return a;
986
+ for (const s of e)
987
+ if (s instanceof HTMLElement) return s;
982
988
  }
983
989
  return n instanceof HTMLElement ? n : null;
984
990
  }
985
- function L(n, t) {
991
+ function D(n, t) {
986
992
  return t === "y" ? n.scrollHeight - n.clientHeight > 1 : n.scrollWidth - n.clientWidth > 1;
987
993
  }
988
- function C(n, t) {
989
- if (!L(n, t) || typeof window > "u") return !1;
990
- const e = window.getComputedStyle(n), a = t === "y" ? e.overflowY : e.overflowX;
991
- return a === "auto" || a === "scroll" || a === "overlay";
994
+ function G(n, t) {
995
+ if (!D(n, t) || typeof window > "u") return !1;
996
+ const e = window.getComputedStyle(n), s = t === "y" ? e.overflowY : e.overflowX;
997
+ return s === "auto" || s === "scroll" || s === "overlay";
992
998
  }
993
999
  export {
994
- pt as TaskManger,
995
- ct as animationName,
996
- C as canProgrammaticallyScroll,
997
- Dt as collectAnimatedProperties,
998
- wt as compileTransitionStyles,
1000
+ yt as TaskManger,
1001
+ ut as animationName,
1002
+ G as canProgrammaticallyScroll,
1003
+ wt as collectAnimatedProperties,
1004
+ St as compileTransitionStyles,
999
1005
  Et as consumeSelfInducedPop,
1000
- j as createDecorator,
1001
- Nt as createRawDecorator,
1002
- It as createRawTransition,
1003
- k as createTransition,
1004
- X as cupertino,
1005
- Lt as decoratorMap,
1006
- ot as easingToCss,
1007
- Mt as findScrollable,
1008
- ut as getMatchedPathPattern,
1009
- At as getParams,
1010
- vt as isServer,
1011
- z as layout,
1012
- Pt as markSelfInducedPop,
1013
- V as material,
1014
- Z as none,
1015
- L as overflowsAxis,
1016
- K as overlay,
1017
- P as targetToDecls,
1018
- kt as transitionMap,
1019
- yt as useHistoryStore,
1006
+ K as createDecorator,
1007
+ Lt as createRawDecorator,
1008
+ kt as createRawTransition,
1009
+ T as createTransition,
1010
+ F as cupertino,
1011
+ Dt as decoratorMap,
1012
+ it as easingToCss,
1013
+ Ct as findScrollable,
1014
+ lt as getMatchedPathPattern,
1015
+ Mt as getParams,
1016
+ At as isServer,
1017
+ V as layout,
1018
+ It as markSelfInducedPop,
1019
+ Z as material,
1020
+ j as none,
1021
+ D as overflowsAxis,
1022
+ q as overlay,
1023
+ g as targetToDecls,
1024
+ Tt as transitionMap,
1025
+ Pt as useHistoryStore,
1020
1026
  gt as useNavigateStore,
1021
- Tt as useTransitionStore,
1022
- St as variantHasAnimation
1027
+ Nt as useTransitionStore,
1028
+ vt as variantHasAnimation
1023
1029
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flemo/core",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Framework-agnostic primitives for flemo: history, navigation, transitions, task manager.",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",