@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.mjs CHANGED
@@ -97,37 +97,6 @@ function compactMap(obj) {
97
97
  }, {});
98
98
  }
99
99
 
100
- // src/utils/listenOnce.ts
101
- function listenOnce(el, type, cb) {
102
- const listener = () => {
103
- el.removeEventListener(type, listener);
104
- cb();
105
- };
106
- el.addEventListener(type, listener);
107
- }
108
-
109
- // src/utils/listenResize.ts
110
- var listenResize = (cb) => {
111
- cb();
112
- window.addEventListener("resize", cb);
113
- return () => {
114
- window.removeEventListener("resize", cb);
115
- };
116
- };
117
-
118
- // src/utils/noop.ts
119
- var noop = () => {
120
- };
121
-
122
- // src/utils/requestNextFrame.tsx
123
- function requestNextFrame(cb) {
124
- requestAnimationFrame(() => {
125
- requestAnimationFrame(() => {
126
- cb();
127
- });
128
- });
129
- }
130
-
131
100
  // src/basicUIPlugin.tsx
132
101
  import { jsx as jsx3 } from "react/jsx-runtime";
133
102
  var GlobalOptionsContext = createContext({
@@ -186,437 +155,31 @@ var basicUIPlugin = (options) => () => ({
186
155
  import { useActions as useActions2 } from "@stackflow/react";
187
156
  import { assignInlineVars as assignInlineVars3 } from "@vanilla-extract/dynamic";
188
157
  import { createContext as createContext2, useContext as useContext2, useMemo, useRef as useRef2 } from "react";
189
-
190
- // src/hooks/useLazy.tsx
191
- import { useEffect, useState } from "react";
192
- function useLazy(value) {
193
- const [state, setState] = useState(void 0);
194
- useEffect(() => {
195
- requestNextFrame(() => {
196
- setState(value);
197
- });
198
- }, [value]);
199
- return state;
200
- }
201
-
202
- // src/hooks/useMaxWidth.ts
203
- import { useEffect as useEffect2, useState as useState2 } from "react";
204
- function useMaxWidth({
205
- outerRef,
206
- innerRef,
207
- enable
208
- }) {
209
- const [maxWidth, setMaxWidth] = useState2(void 0);
210
- useEffect2(() => {
211
- const $outer = outerRef && "current" in outerRef && outerRef.current;
212
- const $inner = innerRef.current;
213
- if (!enable || !$outer || !$inner) {
214
- return noop;
215
- }
216
- const dispose = listenResize(() => {
217
- const screenWidth = $outer.clientWidth;
218
- const leftWidth = $inner.offsetLeft;
219
- const centerWidth = $inner.clientWidth;
220
- const rightWidth = screenWidth - leftWidth - centerWidth;
221
- const sideMargin = Math.max(leftWidth, rightWidth);
222
- setMaxWidth(screenWidth - 2 * sideMargin);
223
- });
224
- return dispose;
225
- });
226
- return {
227
- maxWidth
228
- };
229
- }
230
-
231
- // src/hooks/useMounted.ts
232
- import { useEffect as useEffect3, useReducer } from "react";
233
- function useMounted() {
234
- const [mounted, mount] = useReducer(() => true, false);
235
- useEffect3(() => {
236
- mount();
237
- }, []);
238
- return mounted;
239
- }
240
-
241
- // src/hooks/useNullableActivity.ts
242
- import { useActivity } from "@stackflow/react";
243
- function useNullableActivity() {
244
- return useActivity();
245
- }
246
-
247
- // src/hooks/useStyleEffect.ts
248
- import { useEffect as useEffect4 } from "react";
249
- var connections = {};
250
- function useStyleEffect({
251
- styleName,
252
- refs,
253
- effect,
254
- effectDeps
255
- }) {
256
- const activity = useNullableActivity();
257
- useEffect4(() => {
258
- if (!activity) {
259
- return noop;
260
- }
261
- if (!connections[styleName]) {
262
- connections[styleName] = /* @__PURE__ */ new Map();
263
- }
264
- connections[styleName].set(activity.zIndex, {
265
- refs,
266
- hasEffect: !!effect
267
- });
268
- return () => {
269
- connections[styleName].delete(activity.zIndex);
270
- };
271
- }, [activity == null ? void 0 : activity.id, refs, effect]);
272
- useEffect4(() => {
273
- if (!activity) {
274
- return noop;
275
- }
276
- if (!effect) {
277
- return noop;
278
- }
279
- const refs2 = (() => {
280
- let arr = [];
281
- for (let i = 1; i <= activity.zIndex; i += 1) {
282
- const connection = connections[styleName].get(activity.zIndex - i);
283
- if (connection == null ? void 0 : connection.refs) {
284
- arr = [...arr, ...connection.refs];
285
- }
286
- if (connection == null ? void 0 : connection.hasEffect) {
287
- break;
288
- }
289
- }
290
- return arr;
291
- })();
292
- const cleanup = effect({
293
- activityTransitionState: activity.transitionState,
294
- refs: refs2
295
- });
296
- return () => {
297
- cleanup == null ? void 0 : cleanup();
298
- };
299
- }, [activity == null ? void 0 : activity.transitionState, ...effectDeps != null ? effectDeps : []]);
300
- }
301
-
302
- // src/hooks/useStyleEffectHide.ts
303
- function useStyleEffectHide({
304
- refs,
305
- hasEffect
306
- }) {
307
- useStyleEffect({
308
- styleName: "hide",
309
- refs,
310
- effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
311
- const cleanup = () => {
312
- refs2.forEach((ref) => {
313
- if (!ref.current) {
314
- return;
315
- }
316
- const $ref = ref.current;
317
- $ref.style.display = "";
318
- });
319
- };
320
- switch (activityTransitionState) {
321
- case "enter-done": {
322
- refs2.forEach((ref) => {
323
- if (!ref.current) {
324
- return;
325
- }
326
- const $ref = ref.current;
327
- $ref.style.display = "none";
328
- });
329
- return () => {
330
- cleanup();
331
- };
332
- }
333
- default: {
334
- cleanup();
335
- return noop;
336
- }
337
- }
338
- } : void 0
339
- });
340
- }
341
-
342
- // src/hooks/useStyleEffectOffset.ts
343
- var OFFSET_PX_ANDROID = 32;
344
- var OFFSET_PX_CUPERTINO = 80;
345
- function useStyleEffectOffset({
346
- refs,
347
- theme,
348
- activityEnterStyle,
349
- hasEffect = false
350
- }) {
351
- useStyleEffect({
352
- styleName: "offset",
353
- refs,
354
- effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
355
- let transform;
356
- let opacity;
357
- switch (theme) {
358
- case "cupertino": {
359
- transform = `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)`;
360
- opacity = "1";
361
- break;
362
- }
363
- default: {
364
- transform = activityEnterStyle === "slideInLeft" ? "translate3d(-50%, 0, 0)" : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
365
- opacity = activityEnterStyle === "slideInLeft" ? "0" : "1";
366
- break;
367
- }
368
- }
369
- const cleanup = () => {
370
- requestNextFrame(() => {
371
- refs2.forEach((ref) => {
372
- if (!ref.current) {
373
- return;
374
- }
375
- const $el = ref.current;
376
- $el.style.transform = "";
377
- $el.style.opacity = "";
378
- listenOnce($el, "transitionend", () => {
379
- $el.style.transition = "";
380
- });
381
- });
382
- });
383
- };
384
- switch (activityTransitionState) {
385
- case "enter-active":
386
- case "enter-done": {
387
- refs2.forEach((ref) => {
388
- if (!ref.current) {
389
- return;
390
- }
391
- ref.current.style.transition = globalVars.computedTransitionDuration;
392
- ref.current.style.transform = transform;
393
- ref.current.style.opacity = opacity;
394
- });
395
- switch (activityTransitionState) {
396
- case "enter-done":
397
- return () => {
398
- cleanup();
399
- };
400
- default:
401
- return noop;
402
- }
403
- }
404
- case "exit-active":
405
- case "exit-done": {
406
- requestNextFrame(() => {
407
- cleanup();
408
- });
409
- return noop;
410
- }
411
- default: {
412
- return noop;
413
- }
414
- }
415
- } : void 0
416
- });
417
- }
418
-
419
- // src/components/AppScreen.css.ts
420
- import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
421
- var appScreen = _7a4682({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf434a", "enter-done": "_1dlf434b", "exit-active": "_1dlf434c", "exit-done": "_1dlf434d" } }, defaultVariants: {}, compoundVariants: [] });
422
- var dim = "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4349";
423
- var edge = _7a4682({ defaultClassName: "_1dlf434o dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434p" } }, defaultVariants: {}, compoundVariants: [] });
424
- var exitActive = "_1dlf434c";
425
- var exitDone = "_1dlf434d";
426
- var paper = _7a4682({ defaultClassName: "_1dlf434k dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4348 _1dlf4349", variantClassNames: { hasAppBar: { true: "_1dlf434l dhthxqg" }, modalPresentationStyle: { fullScreen: "_1dlf434m" }, activityEnterStyle: { slideInLeft: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
427
- 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)" } } };
428
-
429
- // src/hooks/useStyleEffectSwipeBack.ts
430
- function useStyleEffectSwipeBack({
431
- theme,
432
- dimRef,
433
- edgeRef,
434
- paperRef,
435
- hasEffect,
436
- prevented,
437
- onSwiped
438
- }) {
439
- useStyleEffect({
440
- styleName: "swipe-back",
441
- refs: [paperRef],
442
- effect: hasEffect ? ({ refs }) => {
443
- if (theme !== "cupertino") {
444
- return noop;
445
- }
446
- if (!dimRef.current || !edgeRef.current || !paperRef.current) {
447
- return noop;
448
- }
449
- const $dim = dimRef.current;
450
- const $edge = edgeRef.current;
451
- const $paper = paperRef.current;
452
- let x0 = null;
453
- let t0 = null;
454
- let x = null;
455
- let cachedRefs = [];
456
- const resetState = () => {
457
- x0 = null;
458
- t0 = null;
459
- x = null;
460
- cachedRefs = [];
461
- };
462
- let _rAFLock = false;
463
- function movePaper(dx) {
464
- if (!_rAFLock) {
465
- _rAFLock = true;
466
- requestAnimationFrame(() => {
467
- const p = dx / $paper.clientWidth;
468
- $dim.style.opacity = `${1 - p}`;
469
- $dim.style.transition = "0s";
470
- $paper.style.overflowY = "hidden";
471
- $paper.style.transform = `translate3d(${dx}px, 0, 0)`;
472
- $paper.style.transition = "0s";
473
- refs.forEach((ref) => {
474
- var _a;
475
- if (!ref.current) {
476
- return;
477
- }
478
- ref.current.style.transform = `translate3d(${-1 * (1 - p) * OFFSET_PX_CUPERTINO}px, 0, 0)`;
479
- ref.current.style.transition = "0s";
480
- if (((_a = ref.current.parentElement) == null ? void 0 : _a.style.display) === "none") {
481
- ref.current.parentElement.style.display = "block";
482
- }
483
- });
484
- _rAFLock = false;
485
- });
486
- }
487
- }
488
- function resetPaper({ swiped }) {
489
- return new Promise((resolve) => {
490
- requestAnimationFrame(() => {
491
- $dim.style.opacity = `${swiped ? 0 : 1}`;
492
- $dim.style.transition = globalVars.transitionDuration;
493
- $paper.style.overflowY = "hidden";
494
- $paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
495
- $paper.style.transition = globalVars.transitionDuration;
496
- refs.forEach((ref) => {
497
- if (!ref.current) {
498
- return;
499
- }
500
- ref.current.style.transition = globalVars.transitionDuration;
501
- ref.current.style.transform = `translate3d(${swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`}, 0, 0)`;
502
- });
503
- const _cachedRefs = [...cachedRefs];
504
- resolve();
505
- listenOnce($paper, "transitionend", () => {
506
- var _a, _b;
507
- const _swiped = swiped || ((_a = $paper.parentElement) == null ? void 0 : _a.classList.contains(
508
- exitActive
509
- )) || ((_b = $paper.parentElement) == null ? void 0 : _b.classList.contains(
510
- exitDone
511
- ));
512
- $dim.style.opacity = "";
513
- $paper.style.overflowY = "";
514
- $paper.style.transform = "";
515
- refs.forEach((ref, i) => {
516
- if (!ref.current) {
517
- return;
518
- }
519
- const _cachedRef = _cachedRefs[i];
520
- if (_swiped) {
521
- ref.current.style.transition = "";
522
- ref.current.style.transform = "";
523
- if (ref.current.parentElement) {
524
- ref.current.parentElement.style.display = "";
525
- }
526
- } else if (_cachedRef) {
527
- ref.current.style.transition = _cachedRef.style.transition;
528
- ref.current.style.transform = _cachedRef.style.transform;
529
- if (ref.current.parentElement && _cachedRef.parentElement) {
530
- ref.current.parentElement.style.display = _cachedRef.parentElement.style.display;
531
- }
532
- }
533
- });
534
- });
535
- });
536
- });
537
- }
538
- const onTouchStart = (e) => {
539
- var _a;
540
- const { activeElement } = document;
541
- (_a = activeElement == null ? void 0 : activeElement.blur) == null ? void 0 : _a.call(activeElement);
542
- x0 = x = e.touches[0].clientX;
543
- t0 = Date.now();
544
- cachedRefs = refs.map((ref) => {
545
- if (!ref.current) {
546
- return {
547
- style: {
548
- transform: "",
549
- transition: ""
550
- }
551
- };
552
- }
553
- return {
554
- style: {
555
- transform: ref.current.style.transform,
556
- transition: ref.current.style.transition
557
- },
558
- parentElement: ref.current.parentElement ? {
559
- style: {
560
- display: ref.current.parentElement.style.display
561
- }
562
- } : void 0
563
- };
564
- });
565
- };
566
- const onTouchMove = (e) => {
567
- if (!x0) {
568
- resetState();
569
- return;
570
- }
571
- x = e.touches[0].clientX;
572
- movePaper(x - x0);
573
- };
574
- const onTouchEnd = () => {
575
- if (!x0 || !t0 || !x) {
576
- resetState();
577
- return;
578
- }
579
- const t = Date.now();
580
- const v = (x - x0) / (t - t0);
581
- const swiped = v > 1 || x / $paper.clientWidth > 0.4;
582
- if (swiped) {
583
- onSwiped == null ? void 0 : onSwiped();
584
- }
585
- Promise.resolve().then(() => resetPaper({ swiped })).then(() => resetState());
586
- };
587
- $edge.addEventListener("touchstart", onTouchStart, { passive: true });
588
- $edge.addEventListener("touchmove", onTouchMove, { passive: true });
589
- $edge.addEventListener("touchend", onTouchEnd, { passive: true });
590
- $edge.addEventListener("touchcancel", onTouchEnd, { passive: true });
591
- return () => {
592
- $edge.removeEventListener("touchstart", onTouchStart);
593
- $edge.removeEventListener("touchmove", onTouchMove);
594
- $edge.removeEventListener("touchend", onTouchEnd);
595
- $edge.removeEventListener("touchcancel", onTouchEnd);
596
- };
597
- } : void 0,
598
- effectDeps: [prevented]
599
- });
600
- }
601
-
602
- // src/hooks/useZIndexBase.ts
603
- function useZIndexBase() {
604
- var _a;
605
- const activity = useNullableActivity();
606
- return ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
607
- }
158
+ import {
159
+ useLazy,
160
+ useMounted,
161
+ useNullableActivity as useNullableActivity2,
162
+ useStyleEffectHide,
163
+ useStyleEffectOffset,
164
+ useStyleEffectSwipeBack,
165
+ useZIndexBase
166
+ } from "@stackflow/react-ui-core";
608
167
 
609
168
  // src/components/AppBar.tsx
610
169
  import { useActions } from "@stackflow/react";
611
170
  import { assignInlineVars as assignInlineVars2 } from "@vanilla-extract/dynamic";
612
171
  import { forwardRef, useRef } from "react";
172
+ import {
173
+ useAppBarTitleMaxWidth,
174
+ useNullableActivity
175
+ } from "@stackflow/react-ui-core";
613
176
 
614
177
  // src/components/AppBar.css.ts
615
- import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
616
- var appBar = _7a4683({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4348 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
178
+ import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
179
+ var appBar = _7a4682({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4348 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
617
180
  var backButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
618
181
  var center = "dhthxq9 dhthxq7 dhthxq8 _1yk3a450";
619
- var centerMain = _7a4683({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
182
+ var centerMain = _7a4682({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
620
183
  var centerMainEdge = "_1yk3a45e dhthxqi dhthxq4 dhthxq2 dhthxqf";
621
184
  var centerText = "_1yk3a45f dhthxqc dhthxqd dhthxq0";
622
185
  var closeButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
@@ -625,6 +188,18 @@ var left = "_1yk3a458 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
625
188
  var right = "_1yk3a45g dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
626
189
  var safeArea = "_1yk3a456";
627
190
 
191
+ // src/components/AppScreen.css.ts
192
+ import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
193
+ var appScreen = _7a4683({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf434a", "enter-done": "_1dlf434b", "exit-active": "_1dlf434c", "exit-done": "_1dlf434d" } }, defaultVariants: {}, compoundVariants: [] });
194
+ var dim = "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4349";
195
+ var edge = _7a4683({ defaultClassName: "_1dlf434o dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434p" } }, defaultVariants: {}, compoundVariants: [] });
196
+ var enterActive = "_1dlf434a";
197
+ var enterDone = "_1dlf434b";
198
+ var exitActive = "_1dlf434c";
199
+ var exitDone = "_1dlf434d";
200
+ var paper = _7a4683({ defaultClassName: "_1dlf434k dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4348 _1dlf4349", variantClassNames: { hasAppBar: { true: "_1dlf434l dhthxqg" }, modalPresentationStyle: { fullScreen: "_1dlf434m" }, activityEnterStyle: { slideInLeft: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
201
+ 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)" } } };
202
+
628
203
  // src/components/AppBar.tsx
629
204
  import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
630
205
  var AppBar = forwardRef(
@@ -659,7 +234,7 @@ var AppBar = forwardRef(
659
234
  const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
660
235
  const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
661
236
  const centerRef = useRef(null);
662
- const { maxWidth } = useMaxWidth({
237
+ const { maxWidth } = useAppBarTitleMaxWidth({
663
238
  outerRef: ref,
664
239
  innerRef: centerRef,
665
240
  enable: globalOptions.theme === "cupertino"
@@ -830,6 +405,8 @@ var AppBar_default = AppBar;
830
405
 
831
406
  // src/components/AppScreen.tsx
832
407
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
408
+ var OFFSET_PX_ANDROID = 32;
409
+ var OFFSET_PX_CUPERTINO = 80;
833
410
  var Context = createContext2(null);
834
411
  function useAppScreen() {
835
412
  return useContext2(Context);
@@ -845,7 +422,7 @@ var AppScreen = ({
845
422
  }) => {
846
423
  var _a;
847
424
  const globalOptions = useGlobalOptions();
848
- const activity = useNullableActivity();
425
+ const activity = useNullableActivity2();
849
426
  const mounted = useMounted();
850
427
  const { pop } = useActions2();
851
428
  const appScreenRef = useRef2(null);
@@ -855,7 +432,7 @@ var AppScreen = ({
855
432
  const appBarRef = useRef2(null);
856
433
  const modalPresentationStyle = globalOptions.theme === "cupertino" ? CUPERTINO_ONLY_modalPresentationStyle : void 0;
857
434
  const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
858
- const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
435
+ const isSwipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
859
436
  const hasAppBar = !!appBar2;
860
437
  const zIndexBase = useZIndexBase();
861
438
  let zIndexDim;
@@ -881,25 +458,53 @@ var AppScreen = ({
881
458
  const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
882
459
  const lazyTransitionState = useLazy(transitionState);
883
460
  useStyleEffectHide({
884
- refs: [appScreenRef],
885
- hasEffect: true
461
+ refs: [appScreenRef]
886
462
  });
887
463
  useStyleEffectOffset({
888
464
  refs: globalOptions.theme === "cupertino" || activityEnterStyle === "slideInLeft" ? [paperRef] : [paperRef, appBarRef],
889
- theme: globalOptions.theme,
890
- activityEnterStyle,
465
+ offsetStyles: globalOptions.theme === "cupertino" ? {
466
+ transform: `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)`,
467
+ opacity: "1"
468
+ } : activityEnterStyle === "slideInLeft" ? {
469
+ transform: "translate3d(-50%, 0, 0)",
470
+ opacity: "0"
471
+ } : {
472
+ transform: `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`,
473
+ opacity: "1"
474
+ },
475
+ transitionDuration: globalVars.computedTransitionDuration,
891
476
  hasEffect: modalPresentationStyle !== "fullScreen"
892
477
  });
893
478
  useStyleEffectSwipeBack({
894
479
  dimRef,
895
480
  edgeRef,
896
481
  paperRef,
897
- theme: globalOptions.theme,
898
- prevented: swipeBackPrevented,
482
+ offset: OFFSET_PX_CUPERTINO,
483
+ transitionDuration: globalVars.transitionDuration,
484
+ preventSwipeBack: isSwipeBackPrevented || globalOptions.theme !== "cupertino",
485
+ getActivityTransitionState() {
486
+ const $paper = paperRef.current;
487
+ const $appScreen = $paper == null ? void 0 : $paper.parentElement;
488
+ if (!$appScreen) {
489
+ return null;
490
+ }
491
+ if ($appScreen.classList.contains(enterActive)) {
492
+ return "enter-active";
493
+ }
494
+ if ($appScreen.classList.contains(enterDone)) {
495
+ return "enter-done";
496
+ }
497
+ if ($appScreen.classList.contains(exitActive)) {
498
+ return "exit-active";
499
+ }
500
+ if ($appScreen.classList.contains(exitDone)) {
501
+ return "exit-done";
502
+ }
503
+ return null;
504
+ },
899
505
  onSwiped() {
900
506
  pop();
901
- },
902
- hasEffect: true
507
+ }
903
508
  });
904
509
  const onAppBarTopClick = (e) => {
905
510
  var _a2, _b;
@@ -973,20 +578,25 @@ var AppScreen = ({
973
578
  },
974
579
  activity == null ? void 0 : activity.id
975
580
  ),
976
- !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ jsx5("div", { className: edge({ hasAppBar }), ref: edgeRef })
581
+ !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !isSwipeBackPrevented && /* @__PURE__ */ jsx5("div", { className: edge({ hasAppBar }), ref: edgeRef })
977
582
  ]
978
583
  }
979
584
  )
980
585
  }
981
586
  );
982
587
  };
983
- AppScreen.displayName = "AppScreen";
984
588
  var AppScreen_default = AppScreen;
985
589
 
986
590
  // src/components/BottomSheet.tsx
987
591
  import { useActions as useActions3 } from "@stackflow/react";
988
592
  import { assignInlineVars as assignInlineVars4 } from "@vanilla-extract/dynamic";
989
593
  import { useRef as useRef3 } from "react";
594
+ import {
595
+ useLazy as useLazy2,
596
+ useNullableActivity as useNullableActivity3,
597
+ useStyleEffect,
598
+ useZIndexBase as useZIndexBase2
599
+ } from "@stackflow/react-ui-core";
990
600
 
991
601
  // src/components/BottomSheet.css.ts
992
602
  import { createRuntimeFn as _7a4684 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -1006,7 +616,7 @@ var BottomSheet = ({
1006
616
  children
1007
617
  }) => {
1008
618
  var _a;
1009
- const activity = useNullableActivity();
619
+ const activity = useNullableActivity3();
1010
620
  const { pop } = useActions3();
1011
621
  const containerRef = useRef3(null);
1012
622
  const dimRef = useRef3(null);
@@ -1037,14 +647,14 @@ var BottomSheet = ({
1037
647
  const onPaperClick = (e) => {
1038
648
  e.stopPropagation();
1039
649
  };
1040
- const zIndexBase = useZIndexBase() + 3;
1041
- const zIndexPaper = useZIndexBase() + 4;
650
+ const zIndexBase = useZIndexBase2() + 3;
651
+ const zIndexPaper = useZIndexBase2() + 4;
1042
652
  const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1043
653
  return /* @__PURE__ */ jsx6(
1044
654
  "div",
1045
655
  {
1046
656
  className: container2({
1047
- transitionState: useLazy(transitionState)
657
+ transitionState: useLazy2(transitionState)
1048
658
  }),
1049
659
  ref: containerRef,
1050
660
  style: assignInlineVars4(
@@ -1071,6 +681,12 @@ var BottomSheet_default = BottomSheet;
1071
681
  import { useActions as useActions4 } from "@stackflow/react";
1072
682
  import { assignInlineVars as assignInlineVars5 } from "@vanilla-extract/dynamic";
1073
683
  import { useRef as useRef4 } from "react";
684
+ import {
685
+ useLazy as useLazy3,
686
+ useNullableActivity as useNullableActivity4,
687
+ useStyleEffect as useStyleEffect2,
688
+ useZIndexBase as useZIndexBase3
689
+ } from "@stackflow/react-ui-core";
1074
690
 
1075
691
  // src/components/Modal.css.ts
1076
692
  import { createRuntimeFn as _7a4685 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -1089,19 +705,19 @@ var Modal = ({
1089
705
  children
1090
706
  }) => {
1091
707
  var _a;
1092
- const activity = useNullableActivity();
708
+ const activity = useNullableActivity4();
1093
709
  const { pop } = useActions4();
1094
710
  const containerRef = useRef4(null);
1095
711
  const paperRef = useRef4(null);
1096
- useStyleEffect({
712
+ useStyleEffect2({
1097
713
  styleName: "hide",
1098
714
  refs: [containerRef]
1099
715
  });
1100
- useStyleEffect({
716
+ useStyleEffect2({
1101
717
  styleName: "offset",
1102
718
  refs: [paperRef]
1103
719
  });
1104
- useStyleEffect({
720
+ useStyleEffect2({
1105
721
  styleName: "swipe-back",
1106
722
  refs: [paperRef]
1107
723
  });
@@ -1120,14 +736,14 @@ var Modal = ({
1120
736
  const onPaperClick = (e) => {
1121
737
  e.stopPropagation();
1122
738
  };
1123
- const zIndexBase = useZIndexBase() + 3;
1124
- const zIndexPaper = useZIndexBase() + 4;
739
+ const zIndexBase = useZIndexBase3() + 3;
740
+ const zIndexPaper = useZIndexBase3() + 4;
1125
741
  const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1126
742
  return /* @__PURE__ */ jsx7(
1127
743
  "div",
1128
744
  {
1129
745
  className: container3({
1130
- transitionState: useLazy(transitionState)
746
+ transitionState: useLazy3(transitionState)
1131
747
  }),
1132
748
  ref: containerRef,
1133
749
  style: assignInlineVars5(
@@ -1160,8 +776,6 @@ export {
1160
776
  vars2 as bottomSheetVars,
1161
777
  globalVars as cssVars,
1162
778
  vars3 as modalVars,
1163
- useAppScreen,
1164
- useStyleEffect,
1165
- useZIndexBase
779
+ useAppScreen
1166
780
  };
1167
781
  //# sourceMappingURL=index.mjs.map