@stackflow/plugin-basic-ui 1.8.4 → 1.9.1-canary.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.
Files changed (68) hide show
  1. package/dist/components/AppBar.d.ts.map +1 -1
  2. package/dist/components/AppScreen.d.ts +2 -0
  3. package/dist/components/AppScreen.d.ts.map +1 -1
  4. package/dist/components/BottomSheet.d.ts.map +1 -1
  5. package/dist/components/Modal.d.ts.map +1 -1
  6. package/dist/index.css +3 -3
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +111 -518
  11. package/dist/index.js.map +4 -4
  12. package/dist/index.mjs +94 -480
  13. package/dist/index.mjs.map +4 -4
  14. package/dist/utils/index.d.ts +0 -5
  15. package/dist/utils/index.d.ts.map +1 -1
  16. package/package.json +6 -5
  17. package/src/components/AppBar.tsx +6 -2
  18. package/src/components/AppScreen.css.ts +4 -4
  19. package/src/components/AppScreen.tsx +52 -14
  20. package/src/components/BottomSheet.tsx +3 -3
  21. package/src/components/Modal.tsx +3 -3
  22. package/src/index.ts +0 -1
  23. package/src/utils/index.ts +0 -5
  24. package/dist/hooks/index.d.ts +0 -10
  25. package/dist/hooks/index.d.ts.map +0 -1
  26. package/dist/hooks/useLazy.d.ts +0 -2
  27. package/dist/hooks/useLazy.d.ts.map +0 -1
  28. package/dist/hooks/useMaxWidth.d.ts +0 -8
  29. package/dist/hooks/useMaxWidth.d.ts.map +0 -1
  30. package/dist/hooks/useMounted.d.ts +0 -2
  31. package/dist/hooks/useMounted.d.ts.map +0 -1
  32. package/dist/hooks/useNullableActivity.d.ts +0 -3
  33. package/dist/hooks/useNullableActivity.d.ts.map +0 -1
  34. package/dist/hooks/useStyleEffect.d.ts +0 -11
  35. package/dist/hooks/useStyleEffect.d.ts.map +0 -1
  36. package/dist/hooks/useStyleEffectHide.d.ts +0 -5
  37. package/dist/hooks/useStyleEffectHide.d.ts.map +0 -1
  38. package/dist/hooks/useStyleEffectOffset.d.ts +0 -9
  39. package/dist/hooks/useStyleEffectOffset.d.ts.map +0 -1
  40. package/dist/hooks/useStyleEffectSwipeBack.d.ts +0 -10
  41. package/dist/hooks/useStyleEffectSwipeBack.d.ts.map +0 -1
  42. package/dist/hooks/useZIndexBase.d.ts +0 -2
  43. package/dist/hooks/useZIndexBase.d.ts.map +0 -1
  44. package/dist/utils/last.d.ts +0 -2
  45. package/dist/utils/last.d.ts.map +0 -1
  46. package/dist/utils/listenOnce.d.ts +0 -2
  47. package/dist/utils/listenOnce.d.ts.map +0 -1
  48. package/dist/utils/listenResize.d.ts +0 -2
  49. package/dist/utils/listenResize.d.ts.map +0 -1
  50. package/dist/utils/noop.d.ts +0 -2
  51. package/dist/utils/noop.d.ts.map +0 -1
  52. package/dist/utils/requestNextFrame.d.ts +0 -2
  53. package/dist/utils/requestNextFrame.d.ts.map +0 -1
  54. package/src/hooks/index.ts +0 -9
  55. package/src/hooks/useLazy.tsx +0 -15
  56. package/src/hooks/useMaxWidth.ts +0 -42
  57. package/src/hooks/useMounted.ts +0 -11
  58. package/src/hooks/useNullableActivity.ts +0 -6
  59. package/src/hooks/useStyleEffect.ts +0 -85
  60. package/src/hooks/useStyleEffectHide.ts +0 -51
  61. package/src/hooks/useStyleEffectOffset.ts +0 -100
  62. package/src/hooks/useStyleEffectSwipeBack.ts +0 -251
  63. package/src/hooks/useZIndexBase.ts +0 -6
  64. package/src/utils/last.ts +0 -1
  65. package/src/utils/listenOnce.ts +0 -12
  66. package/src/utils/listenResize.ts +0 -8
  67. package/src/utils/noop.ts +0 -1
  68. package/src/utils/requestNextFrame.tsx +0 -8
package/dist/index.js CHANGED
@@ -47,9 +47,7 @@ __export(src_exports, {
47
47
  bottomSheetVars: () => vars2,
48
48
  cssVars: () => globalVars,
49
49
  modalVars: () => vars3,
50
- useAppScreen: () => useAppScreen,
51
- useStyleEffect: () => useStyleEffect,
52
- useZIndexBase: () => useZIndexBase
50
+ useAppScreen: () => useAppScreen
53
51
  });
54
52
  module.exports = __toCommonJS(src_exports);
55
53
 
@@ -132,37 +130,6 @@ function compactMap(obj) {
132
130
  }, {});
133
131
  }
134
132
 
135
- // src/utils/listenOnce.ts
136
- function listenOnce(el, type, cb) {
137
- const listener = () => {
138
- el.removeEventListener(type, listener);
139
- cb();
140
- };
141
- el.addEventListener(type, listener);
142
- }
143
-
144
- // src/utils/listenResize.ts
145
- var listenResize = (cb) => {
146
- cb();
147
- window.addEventListener("resize", cb);
148
- return () => {
149
- window.removeEventListener("resize", cb);
150
- };
151
- };
152
-
153
- // src/utils/noop.ts
154
- var noop = () => {
155
- };
156
-
157
- // src/utils/requestNextFrame.tsx
158
- function requestNextFrame(cb) {
159
- requestAnimationFrame(() => {
160
- requestAnimationFrame(() => {
161
- cb();
162
- });
163
- });
164
- }
165
-
166
133
  // src/basicUIPlugin.tsx
167
134
  var import_jsx_runtime3 = require("react/jsx-runtime");
168
135
  var GlobalOptionsContext = (0, import_react.createContext)({
@@ -218,440 +185,23 @@ var basicUIPlugin = (options) => () => ({
218
185
  });
219
186
 
220
187
  // src/components/AppScreen.tsx
221
- var import_react9 = require("@stackflow/react");
188
+ var import_react4 = require("@stackflow/react");
222
189
  var import_dynamic3 = require("@vanilla-extract/dynamic");
223
- var import_react10 = require("react");
224
-
225
- // src/hooks/useLazy.tsx
226
- var import_react2 = require("react");
227
- function useLazy(value) {
228
- const [state, setState] = (0, import_react2.useState)(void 0);
229
- (0, import_react2.useEffect)(() => {
230
- requestNextFrame(() => {
231
- setState(value);
232
- });
233
- }, [value]);
234
- return state;
235
- }
236
-
237
- // src/hooks/useMaxWidth.ts
238
- var import_react3 = require("react");
239
- function useMaxWidth({
240
- outerRef,
241
- innerRef,
242
- enable
243
- }) {
244
- const [maxWidth, setMaxWidth] = (0, import_react3.useState)(void 0);
245
- (0, import_react3.useEffect)(() => {
246
- const $outer = outerRef && "current" in outerRef && outerRef.current;
247
- const $inner = innerRef.current;
248
- if (!enable || !$outer || !$inner) {
249
- return noop;
250
- }
251
- const dispose = listenResize(() => {
252
- const screenWidth = $outer.clientWidth;
253
- const leftWidth = $inner.offsetLeft;
254
- const centerWidth = $inner.clientWidth;
255
- const rightWidth = screenWidth - leftWidth - centerWidth;
256
- const sideMargin = Math.max(leftWidth, rightWidth);
257
- setMaxWidth(screenWidth - 2 * sideMargin);
258
- });
259
- return dispose;
260
- });
261
- return {
262
- maxWidth
263
- };
264
- }
265
-
266
- // src/hooks/useMounted.ts
267
- var import_react4 = require("react");
268
- function useMounted() {
269
- const [mounted, mount] = (0, import_react4.useReducer)(() => true, false);
270
- (0, import_react4.useEffect)(() => {
271
- mount();
272
- }, []);
273
- return mounted;
274
- }
275
-
276
- // src/hooks/useNullableActivity.ts
277
- var import_react5 = require("@stackflow/react");
278
- function useNullableActivity() {
279
- return (0, import_react5.useActivity)();
280
- }
281
-
282
- // src/hooks/useStyleEffect.ts
283
- var import_react6 = require("react");
284
- var connections = {};
285
- function useStyleEffect({
286
- styleName,
287
- refs,
288
- effect,
289
- effectDeps
290
- }) {
291
- const activity = useNullableActivity();
292
- (0, import_react6.useEffect)(() => {
293
- if (!activity) {
294
- return noop;
295
- }
296
- if (!connections[styleName]) {
297
- connections[styleName] = /* @__PURE__ */ new Map();
298
- }
299
- connections[styleName].set(activity.zIndex, {
300
- refs,
301
- hasEffect: !!effect
302
- });
303
- return () => {
304
- connections[styleName].delete(activity.zIndex);
305
- };
306
- }, [activity == null ? void 0 : activity.id, refs, effect]);
307
- (0, import_react6.useEffect)(() => {
308
- if (!activity) {
309
- return noop;
310
- }
311
- if (!effect) {
312
- return noop;
313
- }
314
- const refs2 = (() => {
315
- let arr = [];
316
- for (let i = 1; i <= activity.zIndex; i += 1) {
317
- const connection = connections[styleName].get(activity.zIndex - i);
318
- if (connection == null ? void 0 : connection.refs) {
319
- arr = [...arr, ...connection.refs];
320
- }
321
- if (connection == null ? void 0 : connection.hasEffect) {
322
- break;
323
- }
324
- }
325
- return arr;
326
- })();
327
- const cleanup = effect({
328
- activityTransitionState: activity.transitionState,
329
- refs: refs2
330
- });
331
- return () => {
332
- cleanup == null ? void 0 : cleanup();
333
- };
334
- }, [activity == null ? void 0 : activity.transitionState, ...effectDeps != null ? effectDeps : []]);
335
- }
336
-
337
- // src/hooks/useStyleEffectHide.ts
338
- function useStyleEffectHide({
339
- refs,
340
- hasEffect
341
- }) {
342
- useStyleEffect({
343
- styleName: "hide",
344
- refs,
345
- effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
346
- const cleanup = () => {
347
- refs2.forEach((ref) => {
348
- if (!ref.current) {
349
- return;
350
- }
351
- const $ref = ref.current;
352
- $ref.style.display = "";
353
- });
354
- };
355
- switch (activityTransitionState) {
356
- case "enter-done": {
357
- refs2.forEach((ref) => {
358
- if (!ref.current) {
359
- return;
360
- }
361
- const $ref = ref.current;
362
- $ref.style.display = "none";
363
- });
364
- return () => {
365
- cleanup();
366
- };
367
- }
368
- default: {
369
- cleanup();
370
- return noop;
371
- }
372
- }
373
- } : void 0
374
- });
375
- }
376
-
377
- // src/hooks/useStyleEffectOffset.ts
378
- var OFFSET_PX_ANDROID = 32;
379
- var OFFSET_PX_CUPERTINO = 80;
380
- function useStyleEffectOffset({
381
- refs,
382
- theme,
383
- activityEnterStyle,
384
- hasEffect = false
385
- }) {
386
- useStyleEffect({
387
- styleName: "offset",
388
- refs,
389
- effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
390
- let transform;
391
- let opacity;
392
- switch (theme) {
393
- case "cupertino": {
394
- transform = `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)`;
395
- opacity = "1";
396
- break;
397
- }
398
- default: {
399
- transform = activityEnterStyle === "slideInLeft" ? "translate3d(-50%, 0, 0)" : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
400
- opacity = activityEnterStyle === "slideInLeft" ? "0" : "1";
401
- break;
402
- }
403
- }
404
- const cleanup = () => {
405
- requestNextFrame(() => {
406
- refs2.forEach((ref) => {
407
- if (!ref.current) {
408
- return;
409
- }
410
- const $el = ref.current;
411
- $el.style.transform = "";
412
- $el.style.opacity = "";
413
- listenOnce($el, "transitionend", () => {
414
- $el.style.transition = "";
415
- });
416
- });
417
- });
418
- };
419
- switch (activityTransitionState) {
420
- case "enter-active":
421
- case "enter-done": {
422
- refs2.forEach((ref) => {
423
- if (!ref.current) {
424
- return;
425
- }
426
- ref.current.style.transition = globalVars.computedTransitionDuration;
427
- ref.current.style.transform = transform;
428
- ref.current.style.opacity = opacity;
429
- });
430
- switch (activityTransitionState) {
431
- case "enter-done":
432
- return () => {
433
- cleanup();
434
- };
435
- default:
436
- return noop;
437
- }
438
- }
439
- case "exit-active":
440
- case "exit-done": {
441
- requestNextFrame(() => {
442
- cleanup();
443
- });
444
- return noop;
445
- }
446
- default: {
447
- return noop;
448
- }
449
- }
450
- } : void 0
451
- });
452
- }
453
-
454
- // src/components/AppScreen.css.ts
455
- var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
456
- var appScreen = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf434a", "enter-done": "_1dlf434b", "exit-active": "_1dlf434c", "exit-done": "_1dlf434d" } }, defaultVariants: {}, compoundVariants: [] });
457
- var dim = "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4349";
458
- var edge = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1dlf434o dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434p" } }, defaultVariants: {}, compoundVariants: [] });
459
- var exitActive = "_1dlf434c";
460
- var exitDone = "_1dlf434d";
461
- var paper = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1dlf434k dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4348 _1dlf4349", variantClassNames: { hasAppBar: { true: "_1dlf434l dhthxqg" }, modalPresentationStyle: { fullScreen: "_1dlf434m" }, activityEnterStyle: { slideInLeft: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
462
- var vars = { transitionDuration: "var(--_1dlf4340)", zIndexes: { dim: "var(--_1dlf4341)", paper: "var(--_1dlf4342)", edge: "var(--_1dlf4343)", appBar: "var(--_1dlf4344)" }, appBar: { topMargin: "var(--_1dlf4345)", center: { mainWidth: "var(--_1dlf4346)" } } };
463
-
464
- // src/hooks/useStyleEffectSwipeBack.ts
465
- function useStyleEffectSwipeBack({
466
- theme,
467
- dimRef,
468
- edgeRef,
469
- paperRef,
470
- hasEffect,
471
- prevented,
472
- onSwiped
473
- }) {
474
- useStyleEffect({
475
- styleName: "swipe-back",
476
- refs: [paperRef],
477
- effect: hasEffect ? ({ refs }) => {
478
- if (theme !== "cupertino") {
479
- return noop;
480
- }
481
- if (!dimRef.current || !edgeRef.current || !paperRef.current) {
482
- return noop;
483
- }
484
- const $dim = dimRef.current;
485
- const $edge = edgeRef.current;
486
- const $paper = paperRef.current;
487
- let x0 = null;
488
- let t0 = null;
489
- let x = null;
490
- let cachedRefs = [];
491
- const resetState = () => {
492
- x0 = null;
493
- t0 = null;
494
- x = null;
495
- cachedRefs = [];
496
- };
497
- let _rAFLock = false;
498
- function movePaper(dx) {
499
- if (!_rAFLock) {
500
- _rAFLock = true;
501
- requestAnimationFrame(() => {
502
- const p = dx / $paper.clientWidth;
503
- $dim.style.opacity = `${1 - p}`;
504
- $dim.style.transition = "0s";
505
- $paper.style.overflowY = "hidden";
506
- $paper.style.transform = `translate3d(${dx}px, 0, 0)`;
507
- $paper.style.transition = "0s";
508
- refs.forEach((ref) => {
509
- var _a;
510
- if (!ref.current) {
511
- return;
512
- }
513
- ref.current.style.transform = `translate3d(${-1 * (1 - p) * OFFSET_PX_CUPERTINO}px, 0, 0)`;
514
- ref.current.style.transition = "0s";
515
- if (((_a = ref.current.parentElement) == null ? void 0 : _a.style.display) === "none") {
516
- ref.current.parentElement.style.display = "block";
517
- }
518
- });
519
- _rAFLock = false;
520
- });
521
- }
522
- }
523
- function resetPaper({ swiped }) {
524
- return new Promise((resolve) => {
525
- requestAnimationFrame(() => {
526
- $dim.style.opacity = `${swiped ? 0 : 1}`;
527
- $dim.style.transition = globalVars.transitionDuration;
528
- $paper.style.overflowY = "hidden";
529
- $paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
530
- $paper.style.transition = globalVars.transitionDuration;
531
- refs.forEach((ref) => {
532
- if (!ref.current) {
533
- return;
534
- }
535
- ref.current.style.transition = globalVars.transitionDuration;
536
- ref.current.style.transform = `translate3d(${swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`}, 0, 0)`;
537
- });
538
- const _cachedRefs = [...cachedRefs];
539
- resolve();
540
- listenOnce($paper, "transitionend", () => {
541
- var _a, _b;
542
- const _swiped = swiped || ((_a = $paper.parentElement) == null ? void 0 : _a.classList.contains(
543
- exitActive
544
- )) || ((_b = $paper.parentElement) == null ? void 0 : _b.classList.contains(
545
- exitDone
546
- ));
547
- $dim.style.opacity = "";
548
- $paper.style.overflowY = "";
549
- $paper.style.transform = "";
550
- refs.forEach((ref, i) => {
551
- if (!ref.current) {
552
- return;
553
- }
554
- const _cachedRef = _cachedRefs[i];
555
- if (_swiped) {
556
- ref.current.style.transition = "";
557
- ref.current.style.transform = "";
558
- if (ref.current.parentElement) {
559
- ref.current.parentElement.style.display = "";
560
- }
561
- } else if (_cachedRef) {
562
- ref.current.style.transition = _cachedRef.style.transition;
563
- ref.current.style.transform = _cachedRef.style.transform;
564
- if (ref.current.parentElement && _cachedRef.parentElement) {
565
- ref.current.parentElement.style.display = _cachedRef.parentElement.style.display;
566
- }
567
- }
568
- });
569
- });
570
- });
571
- });
572
- }
573
- const onTouchStart = (e) => {
574
- var _a;
575
- const { activeElement } = document;
576
- (_a = activeElement == null ? void 0 : activeElement.blur) == null ? void 0 : _a.call(activeElement);
577
- x0 = x = e.touches[0].clientX;
578
- t0 = Date.now();
579
- cachedRefs = refs.map((ref) => {
580
- if (!ref.current) {
581
- return {
582
- style: {
583
- transform: "",
584
- transition: ""
585
- }
586
- };
587
- }
588
- return {
589
- style: {
590
- transform: ref.current.style.transform,
591
- transition: ref.current.style.transition
592
- },
593
- parentElement: ref.current.parentElement ? {
594
- style: {
595
- display: ref.current.parentElement.style.display
596
- }
597
- } : void 0
598
- };
599
- });
600
- };
601
- const onTouchMove = (e) => {
602
- if (!x0) {
603
- resetState();
604
- return;
605
- }
606
- x = e.touches[0].clientX;
607
- movePaper(x - x0);
608
- };
609
- const onTouchEnd = () => {
610
- if (!x0 || !t0 || !x) {
611
- resetState();
612
- return;
613
- }
614
- const t = Date.now();
615
- const v = (x - x0) / (t - t0);
616
- const swiped = v > 1 || x / $paper.clientWidth > 0.4;
617
- if (swiped) {
618
- onSwiped == null ? void 0 : onSwiped();
619
- }
620
- Promise.resolve().then(() => resetPaper({ swiped })).then(() => resetState());
621
- };
622
- $edge.addEventListener("touchstart", onTouchStart, { passive: true });
623
- $edge.addEventListener("touchmove", onTouchMove, { passive: true });
624
- $edge.addEventListener("touchend", onTouchEnd, { passive: true });
625
- $edge.addEventListener("touchcancel", onTouchEnd, { passive: true });
626
- return () => {
627
- $edge.removeEventListener("touchstart", onTouchStart);
628
- $edge.removeEventListener("touchmove", onTouchMove);
629
- $edge.removeEventListener("touchend", onTouchEnd);
630
- $edge.removeEventListener("touchcancel", onTouchEnd);
631
- };
632
- } : void 0,
633
- effectDeps: [prevented]
634
- });
635
- }
636
-
637
- // src/hooks/useZIndexBase.ts
638
- function useZIndexBase() {
639
- var _a;
640
- const activity = useNullableActivity();
641
- return ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
642
- }
190
+ var import_react5 = require("react");
191
+ var import_react_ui_core2 = require("@stackflow/react-ui-core");
643
192
 
644
193
  // src/components/AppBar.tsx
645
- var import_react7 = require("@stackflow/react");
194
+ var import_react2 = require("@stackflow/react");
646
195
  var import_dynamic2 = require("@vanilla-extract/dynamic");
647
- var import_react8 = require("react");
196
+ var import_react3 = require("react");
197
+ var import_react_ui_core = require("@stackflow/react-ui-core");
648
198
 
649
199
  // src/components/AppBar.css.ts
650
- var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
651
- var appBar = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4348 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
200
+ var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
201
+ var appBar = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4348 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
652
202
  var backButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
653
203
  var center = "dhthxq9 dhthxq7 dhthxq8 _1yk3a450";
654
- var centerMain = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
204
+ var centerMain = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
655
205
  var centerMainEdge = "_1yk3a45e dhthxqi dhthxq4 dhthxq2 dhthxqf";
656
206
  var centerText = "_1yk3a45f dhthxqc dhthxqd dhthxq0";
657
207
  var closeButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
@@ -660,9 +210,21 @@ var left = "_1yk3a458 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
660
210
  var right = "_1yk3a45g dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
661
211
  var safeArea = "_1yk3a456";
662
212
 
213
+ // src/components/AppScreen.css.ts
214
+ var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
215
+ var appScreen = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf434a", "enter-done": "_1dlf434b", "exit-active": "_1dlf434c", "exit-done": "_1dlf434d" } }, defaultVariants: {}, compoundVariants: [] });
216
+ var dim = "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4349";
217
+ var edge = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1dlf434o dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434p" } }, defaultVariants: {}, compoundVariants: [] });
218
+ var enterActive = "_1dlf434a";
219
+ var enterDone = "_1dlf434b";
220
+ var exitActive = "_1dlf434c";
221
+ var exitDone = "_1dlf434d";
222
+ var paper = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1dlf434k dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4348 _1dlf4349", variantClassNames: { hasAppBar: { true: "_1dlf434l dhthxqg" }, modalPresentationStyle: { fullScreen: "_1dlf434m" }, activityEnterStyle: { slideInLeft: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
223
+ var vars = { transitionDuration: "var(--_1dlf4340)", zIndexes: { dim: "var(--_1dlf4341)", paper: "var(--_1dlf4342)", edge: "var(--_1dlf4343)", appBar: "var(--_1dlf4344)" }, appBar: { topMargin: "var(--_1dlf4345)", center: { mainWidth: "var(--_1dlf4346)" } } };
224
+
663
225
  // src/components/AppBar.tsx
664
226
  var import_jsx_runtime4 = require("react/jsx-runtime");
665
- var AppBar = (0, import_react8.forwardRef)(
227
+ var AppBar = (0, import_react3.forwardRef)(
666
228
  ({
667
229
  title,
668
230
  renderLeft,
@@ -688,13 +250,13 @@ var AppBar = (0, import_react8.forwardRef)(
688
250
  onTopClick
689
251
  }, ref) => {
690
252
  var _a, _b;
691
- const actions = (0, import_react7.useActions)();
692
- const activity = useNullableActivity();
253
+ const actions = (0, import_react2.useActions)();
254
+ const activity = (0, import_react_ui_core.useNullableActivity)();
693
255
  const globalOptions = useGlobalOptions();
694
256
  const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
695
257
  const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
696
- const centerRef = (0, import_react8.useRef)(null);
697
- const { maxWidth } = useMaxWidth({
258
+ const centerRef = (0, import_react3.useRef)(null);
259
+ const { maxWidth } = (0, import_react_ui_core.useAppBarTitleMaxWidth)({
698
260
  outerRef: ref,
699
261
  innerRef: centerRef,
700
262
  enable: globalOptions.theme === "cupertino"
@@ -865,9 +427,11 @@ var AppBar_default = AppBar;
865
427
 
866
428
  // src/components/AppScreen.tsx
867
429
  var import_jsx_runtime5 = require("react/jsx-runtime");
868
- var Context = (0, import_react10.createContext)(null);
430
+ var OFFSET_PX_ANDROID = 32;
431
+ var OFFSET_PX_CUPERTINO = 80;
432
+ var Context = (0, import_react5.createContext)(null);
869
433
  function useAppScreen() {
870
- return (0, import_react10.useContext)(Context);
434
+ return (0, import_react5.useContext)(Context);
871
435
  }
872
436
  var AppScreen = ({
873
437
  backgroundColor,
@@ -880,19 +444,19 @@ var AppScreen = ({
880
444
  }) => {
881
445
  var _a;
882
446
  const globalOptions = useGlobalOptions();
883
- const activity = useNullableActivity();
884
- const mounted = useMounted();
885
- const { pop } = (0, import_react9.useActions)();
886
- const appScreenRef = (0, import_react10.useRef)(null);
887
- const dimRef = (0, import_react10.useRef)(null);
888
- const paperRef = (0, import_react10.useRef)(null);
889
- const edgeRef = (0, import_react10.useRef)(null);
890
- const appBarRef = (0, import_react10.useRef)(null);
447
+ const activity = (0, import_react_ui_core2.useNullableActivity)();
448
+ const mounted = (0, import_react_ui_core2.useMounted)();
449
+ const { pop } = (0, import_react4.useActions)();
450
+ const appScreenRef = (0, import_react5.useRef)(null);
451
+ const dimRef = (0, import_react5.useRef)(null);
452
+ const paperRef = (0, import_react5.useRef)(null);
453
+ const edgeRef = (0, import_react5.useRef)(null);
454
+ const appBarRef = (0, import_react5.useRef)(null);
891
455
  const modalPresentationStyle = globalOptions.theme === "cupertino" ? CUPERTINO_ONLY_modalPresentationStyle : void 0;
892
456
  const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
893
- const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
457
+ const isSwipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
894
458
  const hasAppBar = !!appBar2;
895
- const zIndexBase = useZIndexBase();
459
+ const zIndexBase = (0, import_react_ui_core2.useZIndexBase)();
896
460
  let zIndexDim;
897
461
  let zIndexPaper;
898
462
  let zIndexEdge;
@@ -914,27 +478,55 @@ var AppScreen = ({
914
478
  }
915
479
  }
916
480
  const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
917
- const lazyTransitionState = useLazy(transitionState);
918
- useStyleEffectHide({
919
- refs: [appScreenRef],
920
- hasEffect: true
481
+ const lazyTransitionState = (0, import_react_ui_core2.useLazy)(transitionState);
482
+ (0, import_react_ui_core2.useStyleEffectHide)({
483
+ refs: [appScreenRef]
921
484
  });
922
- useStyleEffectOffset({
485
+ (0, import_react_ui_core2.useStyleEffectOffset)({
923
486
  refs: globalOptions.theme === "cupertino" || activityEnterStyle === "slideInLeft" ? [paperRef] : [paperRef, appBarRef],
924
- theme: globalOptions.theme,
925
- activityEnterStyle,
487
+ offsetStyles: globalOptions.theme === "cupertino" ? {
488
+ transform: `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)`,
489
+ opacity: "1"
490
+ } : activityEnterStyle === "slideInLeft" ? {
491
+ transform: "translate3d(-50%, 0, 0)",
492
+ opacity: "0"
493
+ } : {
494
+ transform: `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`,
495
+ opacity: "1"
496
+ },
497
+ transitionDuration: globalVars.computedTransitionDuration,
926
498
  hasEffect: modalPresentationStyle !== "fullScreen"
927
499
  });
928
- useStyleEffectSwipeBack({
500
+ (0, import_react_ui_core2.useStyleEffectSwipeBack)({
929
501
  dimRef,
930
502
  edgeRef,
931
503
  paperRef,
932
- theme: globalOptions.theme,
933
- prevented: swipeBackPrevented,
504
+ offset: OFFSET_PX_CUPERTINO,
505
+ transitionDuration: globalVars.transitionDuration,
506
+ preventSwipeBack: isSwipeBackPrevented || globalOptions.theme !== "cupertino",
507
+ getActivityTransitionState() {
508
+ const $paper = paperRef.current;
509
+ const $appScreen = $paper == null ? void 0 : $paper.parentElement;
510
+ if (!$appScreen) {
511
+ return null;
512
+ }
513
+ if ($appScreen.classList.contains(enterActive)) {
514
+ return "enter-active";
515
+ }
516
+ if ($appScreen.classList.contains(enterDone)) {
517
+ return "enter-done";
518
+ }
519
+ if ($appScreen.classList.contains(exitActive)) {
520
+ return "exit-active";
521
+ }
522
+ if ($appScreen.classList.contains(exitDone)) {
523
+ return "exit-done";
524
+ }
525
+ return null;
526
+ },
934
527
  onSwiped() {
935
528
  pop();
936
- },
937
- hasEffect: true
529
+ }
938
530
  });
939
531
  const onAppBarTopClick = (e) => {
940
532
  var _a2, _b;
@@ -949,7 +541,7 @@ var AppScreen = ({
949
541
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
950
542
  Context.Provider,
951
543
  {
952
- value: (0, import_react10.useMemo)(
544
+ value: (0, import_react5.useMemo)(
953
545
  () => ({
954
546
  scroll({ top }) {
955
547
  var _a2;
@@ -1008,20 +600,20 @@ var AppScreen = ({
1008
600
  },
1009
601
  activity == null ? void 0 : activity.id
1010
602
  ),
1011
- !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: edge({ hasAppBar }), ref: edgeRef })
603
+ !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !isSwipeBackPrevented && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: edge({ hasAppBar }), ref: edgeRef })
1012
604
  ]
1013
605
  }
1014
606
  )
1015
607
  }
1016
608
  );
1017
609
  };
1018
- AppScreen.displayName = "AppScreen";
1019
610
  var AppScreen_default = AppScreen;
1020
611
 
1021
612
  // src/components/BottomSheet.tsx
1022
- var import_react11 = require("@stackflow/react");
613
+ var import_react6 = require("@stackflow/react");
1023
614
  var import_dynamic4 = require("@vanilla-extract/dynamic");
1024
- var import_react12 = require("react");
615
+ var import_react7 = require("react");
616
+ var import_react_ui_core3 = require("@stackflow/react-ui-core");
1025
617
 
1026
618
  // src/components/BottomSheet.css.ts
1027
619
  var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
@@ -1041,23 +633,23 @@ var BottomSheet = ({
1041
633
  children
1042
634
  }) => {
1043
635
  var _a;
1044
- const activity = useNullableActivity();
1045
- const { pop } = (0, import_react11.useActions)();
1046
- const containerRef = (0, import_react12.useRef)(null);
1047
- const dimRef = (0, import_react12.useRef)(null);
1048
- useStyleEffect({
636
+ const activity = (0, import_react_ui_core3.useNullableActivity)();
637
+ const { pop } = (0, import_react6.useActions)();
638
+ const containerRef = (0, import_react7.useRef)(null);
639
+ const dimRef = (0, import_react7.useRef)(null);
640
+ (0, import_react_ui_core3.useStyleEffect)({
1049
641
  styleName: "hide",
1050
642
  refs: [containerRef]
1051
643
  });
1052
- useStyleEffect({
644
+ (0, import_react_ui_core3.useStyleEffect)({
1053
645
  styleName: "offset",
1054
646
  refs: [dimRef]
1055
647
  });
1056
- useStyleEffect({
648
+ (0, import_react_ui_core3.useStyleEffect)({
1057
649
  styleName: "swipe-back",
1058
650
  refs: [dimRef]
1059
651
  });
1060
- const popLock = (0, import_react12.useRef)(false);
652
+ const popLock = (0, import_react7.useRef)(false);
1061
653
  const onDimClick = (e) => {
1062
654
  onOutsideClick == null ? void 0 : onOutsideClick(e);
1063
655
  if (e.defaultPrevented) {
@@ -1072,14 +664,14 @@ var BottomSheet = ({
1072
664
  const onPaperClick = (e) => {
1073
665
  e.stopPropagation();
1074
666
  };
1075
- const zIndexBase = useZIndexBase() + 3;
1076
- const zIndexPaper = useZIndexBase() + 4;
667
+ const zIndexBase = (0, import_react_ui_core3.useZIndexBase)() + 3;
668
+ const zIndexPaper = (0, import_react_ui_core3.useZIndexBase)() + 4;
1077
669
  const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1078
670
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1079
671
  "div",
1080
672
  {
1081
673
  className: container2({
1082
- transitionState: useLazy(transitionState)
674
+ transitionState: (0, import_react_ui_core3.useLazy)(transitionState)
1083
675
  }),
1084
676
  ref: containerRef,
1085
677
  style: (0, import_dynamic4.assignInlineVars)(
@@ -1103,9 +695,10 @@ BottomSheet.displayName = "BottomSheet";
1103
695
  var BottomSheet_default = BottomSheet;
1104
696
 
1105
697
  // src/components/Modal.tsx
1106
- var import_react13 = require("@stackflow/react");
698
+ var import_react8 = require("@stackflow/react");
1107
699
  var import_dynamic5 = require("@vanilla-extract/dynamic");
1108
- var import_react14 = require("react");
700
+ var import_react9 = require("react");
701
+ var import_react_ui_core4 = require("@stackflow/react-ui-core");
1109
702
 
1110
703
  // src/components/Modal.css.ts
1111
704
  var import_createRuntimeFn5 = require("@vanilla-extract/recipes/createRuntimeFn");
@@ -1124,23 +717,23 @@ var Modal = ({
1124
717
  children
1125
718
  }) => {
1126
719
  var _a;
1127
- const activity = useNullableActivity();
1128
- const { pop } = (0, import_react13.useActions)();
1129
- const containerRef = (0, import_react14.useRef)(null);
1130
- const paperRef = (0, import_react14.useRef)(null);
1131
- useStyleEffect({
720
+ const activity = (0, import_react_ui_core4.useNullableActivity)();
721
+ const { pop } = (0, import_react8.useActions)();
722
+ const containerRef = (0, import_react9.useRef)(null);
723
+ const paperRef = (0, import_react9.useRef)(null);
724
+ (0, import_react_ui_core4.useStyleEffect)({
1132
725
  styleName: "hide",
1133
726
  refs: [containerRef]
1134
727
  });
1135
- useStyleEffect({
728
+ (0, import_react_ui_core4.useStyleEffect)({
1136
729
  styleName: "offset",
1137
730
  refs: [paperRef]
1138
731
  });
1139
- useStyleEffect({
732
+ (0, import_react_ui_core4.useStyleEffect)({
1140
733
  styleName: "swipe-back",
1141
734
  refs: [paperRef]
1142
735
  });
1143
- const popLock = (0, import_react14.useRef)(false);
736
+ const popLock = (0, import_react9.useRef)(false);
1144
737
  const onDimClick = (e) => {
1145
738
  onOutsideClick == null ? void 0 : onOutsideClick(e);
1146
739
  if (e.defaultPrevented) {
@@ -1155,14 +748,14 @@ var Modal = ({
1155
748
  const onPaperClick = (e) => {
1156
749
  e.stopPropagation();
1157
750
  };
1158
- const zIndexBase = useZIndexBase() + 3;
1159
- const zIndexPaper = useZIndexBase() + 4;
751
+ const zIndexBase = (0, import_react_ui_core4.useZIndexBase)() + 3;
752
+ const zIndexPaper = (0, import_react_ui_core4.useZIndexBase)() + 4;
1160
753
  const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1161
754
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1162
755
  "div",
1163
756
  {
1164
757
  className: container3({
1165
- transitionState: useLazy(transitionState)
758
+ transitionState: (0, import_react_ui_core4.useLazy)(transitionState)
1166
759
  }),
1167
760
  ref: containerRef,
1168
761
  style: (0, import_dynamic5.assignInlineVars)(