@stackflow/plugin-basic-ui 1.3.4-alpha.0 → 1.3.4-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -222,7 +222,7 @@ function useMaxWidth({
222
222
  setMaxWidth(screenWidth - 2 * sideMargin);
223
223
  });
224
224
  return dispose;
225
- }, []);
225
+ });
226
226
  return {
227
227
  maxWidth
228
228
  };
@@ -335,28 +335,13 @@ var OFFSET_PX_CUPERTINO = 80;
335
335
  function useStyleEffectOffset({
336
336
  refs,
337
337
  theme,
338
- activityEnterStyle,
339
338
  hasEffect
340
339
  }) {
341
340
  useStyleEffect({
342
341
  styleName: "offset",
343
342
  refs,
344
343
  effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
345
- let transform;
346
- let opacity;
347
- switch (theme) {
348
- case "cupertino": {
349
- transform = `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)`;
350
- opacity = "1";
351
- break;
352
- }
353
- case "android":
354
- default: {
355
- transform = activityEnterStyle === "slideInLeft" ? `translate3d(-50%, 0, 0)` : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
356
- opacity = activityEnterStyle === "slideInLeft" ? "0" : "1";
357
- break;
358
- }
359
- }
344
+ const transform = theme === "cupertino" ? `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)` : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
360
345
  const cleanup = () => {
361
346
  requestNextFrame(() => {
362
347
  refs2.forEach((ref) => {
@@ -365,7 +350,6 @@ function useStyleEffectOffset({
365
350
  }
366
351
  const $el = ref.current;
367
352
  $el.style.transform = "";
368
- $el.style.opacity = "";
369
353
  listenOnce($el, "transitionend", () => {
370
354
  $el.style.transition = "";
371
355
  });
@@ -381,7 +365,6 @@ function useStyleEffectOffset({
381
365
  }
382
366
  ref.current.style.transition = globalVars.computedTransitionDuration;
383
367
  ref.current.style.transform = transform;
384
- ref.current.style.opacity = opacity;
385
368
  });
386
369
  switch (activityTransitionState) {
387
370
  case "enter-done":
@@ -412,10 +395,10 @@ function useStyleEffectOffset({
412
395
  import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
413
396
  var appScreen = _7a4682({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf4349", "enter-done": "_1dlf434a", "exit-active": "_1dlf434b", "exit-done": "_1dlf434c" } }, defaultVariants: {}, compoundVariants: [] });
414
397
  var dim = "_1dlf434i dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4346 _1dlf4348";
415
- var edge = _7a4682({ defaultClassName: "_1dlf434n dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434o" } }, defaultVariants: {}, compoundVariants: [] });
398
+ var edge = _7a4682({ defaultClassName: "_1dlf434m dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
416
399
  var exitActive = "_1dlf434b";
417
400
  var exitDone = "_1dlf434c";
418
- var paper = _7a4682({ defaultClassName: "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4348", variantClassNames: { hasAppBar: { true: "_1dlf434k dhthxqg" }, modalPresentationStyle: { fullScreen: "_1dlf434l" }, activityEnterStyle: { slideInLeft: "_1dlf434m" } }, defaultVariants: {}, compoundVariants: [] });
401
+ var paper = _7a4682({ defaultClassName: "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4348", variantClassNames: { hasAppBar: { true: "_1dlf434k dhthxqg" }, presentModalFullScreen: { true: "_1dlf434l" } }, defaultVariants: {}, compoundVariants: [] });
419
402
  var vars = { transitionDuration: "var(--_1dlf4340)", zIndexes: { dim: "var(--_1dlf4341)", paper: "var(--_1dlf4342)", edge: "var(--_1dlf4343)", appBar: "var(--_1dlf4344)" }, appBar: { center: { mainWidth: "var(--_1dlf4345)" } } };
420
403
 
421
404
  // src/hooks/useStyleEffectSwipeBack.ts
@@ -598,17 +581,17 @@ import { forwardRef, useRef } from "react";
598
581
 
599
582
  // src/components/AppBar.css.ts
600
583
  import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
601
- var appBar = _7a4683({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4347 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
602
- var backButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
584
+ var appBar = _7a4683({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4347 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, presentModalFullScreen: { true: "_1yk3a454" } }, defaultVariants: {}, compoundVariants: [] });
585
+ var backButton = "_1yk3a458 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
603
586
  var center = "dhthxq9 dhthxq7 dhthxq8 _1yk3a450";
604
- var centerMain = _7a4683({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
605
- var centerMainEdge = "_1yk3a45e dhthxqi dhthxq4 dhthxq2 dhthxqf";
606
- var centerText = "_1yk3a45f dhthxqc dhthxqd dhthxq0";
607
- var closeButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
608
- var container = "_1yk3a457 dhthxqa dhthxq7 _1yk3a451";
609
- var left = "_1yk3a458 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
610
- var right = "_1yk3a45g dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
611
- var safeArea = "_1yk3a456";
587
+ var centerMain = _7a4683({ defaultClassName: "_1yk3a45b", variantClassNames: { hasLeft: { true: "_1yk3a45c" } }, defaultVariants: {}, compoundVariants: [] });
588
+ var centerMainEdge = "_1yk3a45d dhthxqi dhthxq4 dhthxq2 dhthxqf";
589
+ var centerText = "_1yk3a45e dhthxqc dhthxqd dhthxq0";
590
+ var closeButton = "_1yk3a458 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
591
+ var container = "_1yk3a456 dhthxqa dhthxq7 _1yk3a451";
592
+ var left = "_1yk3a457 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
593
+ var right = "_1yk3a45f dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
594
+ var safeArea = "_1yk3a455";
612
595
 
613
596
  // src/components/AppBar.tsx
614
597
  import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -622,7 +605,6 @@ var AppBar = forwardRef(
622
605
  closeButtonLocation = "left",
623
606
  border = true,
624
607
  modalPresentationStyle,
625
- activityEnterStyle,
626
608
  iconColor,
627
609
  iconColorTransitionDuration,
628
610
  textColor,
@@ -649,6 +631,7 @@ var AppBar = forwardRef(
649
631
  innerRef: centerRef,
650
632
  enable: globalOptions.theme === "cupertino"
651
633
  });
634
+ const presentModalFullScreen = modalPresentationStyle === "fullScreen";
652
635
  const onBackClick = (e) => {
653
636
  if (backButton2 && "onClick" in backButton2 && backButton2.onClick) {
654
637
  backButton2.onClick(e);
@@ -696,7 +679,7 @@ var AppBar = forwardRef(
696
679
  if (globalBackButton && "renderIcon" in globalBackButton && globalBackButton.renderIcon) {
697
680
  return globalBackButton.renderIcon();
698
681
  }
699
- if (modalPresentationStyle === "fullScreen") {
682
+ if (presentModalFullScreen) {
700
683
  return /* @__PURE__ */ jsx4(IconClose_default, {});
701
684
  }
702
685
  return /* @__PURE__ */ jsx4(IconBack_default, {});
@@ -752,8 +735,7 @@ var AppBar = forwardRef(
752
735
  ref,
753
736
  className: appBar({
754
737
  border,
755
- modalPresentationStyle,
756
- activityEnterStyle
738
+ presentModalFullScreen
757
739
  }),
758
740
  style: assignInlineVars2(
759
741
  compactMap({
@@ -824,8 +806,7 @@ var AppScreen = ({
824
806
  dimBackgroundColor,
825
807
  appBar: appBar2,
826
808
  preventSwipeBack,
827
- CUPERTINO_ONLY_modalPresentationStyle,
828
- ANDROID_ONLY_activityEnterStyle,
809
+ modalPresentationStyle,
829
810
  children
830
811
  }) => {
831
812
  var _a, _b;
@@ -837,55 +818,36 @@ var AppScreen = ({
837
818
  const paperRef = useRef2(null);
838
819
  const edgeRef = useRef2(null);
839
820
  const appBarRef = useRef2(null);
840
- const modalPresentationStyle = globalOptions.theme === "cupertino" ? CUPERTINO_ONLY_modalPresentationStyle : void 0;
841
- const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
842
- const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
843
- const hasAppBar = !!appBar2;
844
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
845
- let zIndexDim;
846
- let zIndexPaper;
847
- let zIndexEdge;
848
- let zIndexAppBar;
849
- switch (globalOptions.theme) {
850
- case "cupertino": {
851
- zIndexDim = zIndexBase + (modalPresentationStyle === "fullScreen" ? 2 : 0);
852
- zIndexPaper = zIndexBase + (hasAppBar && modalPresentationStyle !== "fullScreen" ? 1 : 3);
853
- zIndexEdge = zIndexBase + 4;
854
- zIndexAppBar = zIndexBase + 7;
855
- break;
856
- }
857
- case "android":
858
- default: {
859
- zIndexDim = zIndexBase;
860
- zIndexPaper = zIndexBase + (activityEnterStyle === "slideInLeft" ? 1 : 3);
861
- zIndexEdge = zIndexBase + 4;
862
- zIndexAppBar = zIndexBase + (activityEnterStyle === "slideInLeft" ? 7 : 4);
863
- break;
864
- }
865
- }
866
- const transitionState = (_b = activity == null ? void 0 : activity.transitionState) != null ? _b : "enter-done";
867
- const lazyTransitionState = useLazy(transitionState);
821
+ const presentModalFullScreen = modalPresentationStyle === "fullScreen";
822
+ const swipeBackPrevented = preventSwipeBack || presentModalFullScreen;
868
823
  useStyleEffectHide({
869
824
  refs: [appScreenRef],
870
825
  hasEffect: true
871
826
  });
872
827
  useStyleEffectOffset({
873
- refs: globalOptions.theme === "cupertino" || activityEnterStyle === "slideInLeft" ? [paperRef] : [paperRef, appBarRef],
874
828
  theme: globalOptions.theme,
875
- activityEnterStyle,
876
- hasEffect: modalPresentationStyle !== "fullScreen"
829
+ refs: globalOptions.theme === "cupertino" ? [paperRef] : [paperRef, appBarRef],
830
+ hasEffect: !presentModalFullScreen
877
831
  });
878
832
  useStyleEffectSwipeBack({
833
+ theme: globalOptions.theme,
879
834
  dimRef,
880
835
  edgeRef,
881
836
  paperRef,
882
- theme: globalOptions.theme,
837
+ hasEffect: true,
883
838
  prevented: swipeBackPrevented,
884
839
  onSwiped() {
885
840
  pop();
886
- },
887
- hasEffect: true
841
+ }
888
842
  });
843
+ const hasAppBar = !!appBar2;
844
+ const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
845
+ const zIndexDim = zIndexBase;
846
+ const zIndexPaper = zIndexBase + (globalOptions.theme === "cupertino" && hasAppBar ? 1 : 3);
847
+ const zIndexEdge = zIndexBase + 4;
848
+ const zIndexAppBar = globalOptions.theme === "cupertino" ? zIndexBase + 7 : zIndexBase + 4;
849
+ const transitionState = (_b = activity == null ? void 0 : activity.transitionState) != null ? _b : "enter-done";
850
+ const lazyTransitionState = useLazy(transitionState);
889
851
  const onAppBarTopClick = (e) => {
890
852
  var _a2, _b2;
891
853
  (_a2 = appBar2 == null ? void 0 : appBar2.onTopClick) == null ? void 0 : _a2.call(appBar2, e);
@@ -932,13 +894,12 @@ var AppScreen = ({
932
894
  })
933
895
  ),
934
896
  children: [
935
- activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ jsx5("div", { className: dim, ref: dimRef }),
897
+ /* @__PURE__ */ jsx5("div", { className: dim, ref: dimRef }),
936
898
  appBar2 && /* @__PURE__ */ jsx5(
937
899
  AppBar_default,
938
900
  __spreadProps(__spreadValues({}, appBar2), {
939
901
  ref: appBarRef,
940
902
  modalPresentationStyle,
941
- activityEnterStyle,
942
903
  onTopClick: onAppBarTopClick
943
904
  })
944
905
  ),
@@ -947,8 +908,7 @@ var AppScreen = ({
947
908
  {
948
909
  className: paper({
949
910
  hasAppBar,
950
- modalPresentationStyle,
951
- activityEnterStyle
911
+ presentModalFullScreen
952
912
  }),
953
913
  ref: paperRef,
954
914
  children