@stackflow/plugin-basic-ui 1.3.5-alpha.3 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ var IconBack = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
62
62
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
63
63
  "path",
64
64
  {
65
- d: "M11.5659 5.56564C11.8783 5.25322 11.8783 4.74669 11.5659 4.43427C11.2535 4.12185 10.7469 4.12185 10.4345 4.43427L3.43451 11.4343C3.12209 11.7467 3.12209 12.2532 3.43451 12.5656L10.4345 19.5656C10.7469 19.8781 11.2535 19.8781 11.5659 19.5656C11.8783 19.2532 11.8783 18.7467 11.5659 18.4343L5.93157 12.8H20.0002C20.442 12.8 20.8002 12.4418 20.8002 12C20.8002 11.5581 20.442 11.2 20.0002 11.2H5.93157L11.5659 5.56564Z",
65
+ d: "M16.66 3.23C16.96 3.53 16.96 4.02 16.66 4.32L8.97999 12L16.66 19.68C16.96 19.98 16.96 20.47 16.66 20.77C16.36 21.07 15.87 21.07 15.57 20.77L7.33999 12.55C7.03999 12.25 7.03999 11.76 7.33999 11.46L15.56 3.23C15.86 2.93 16.35 2.93 16.65 3.23H16.66Z",
66
66
  fill: "currentColor"
67
67
  }
68
68
  )
@@ -365,13 +365,28 @@ var OFFSET_PX_CUPERTINO = 80;
365
365
  function useStyleEffectOffset({
366
366
  refs,
367
367
  theme,
368
- hasEffect
368
+ activityEnterStyle,
369
+ hasEffect = false
369
370
  }) {
370
371
  useStyleEffect({
371
372
  styleName: "offset",
372
373
  refs,
373
374
  effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
374
- const transform = theme === "cupertino" ? `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)` : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
375
+ let transform;
376
+ let opacity;
377
+ switch (theme) {
378
+ case "cupertino": {
379
+ transform = `translate3d(-${OFFSET_PX_CUPERTINO / 16}rem, 0, 0)`;
380
+ opacity = "1";
381
+ break;
382
+ }
383
+ case "android":
384
+ default: {
385
+ transform = activityEnterStyle === "slideInLeft" ? `translate3d(-50%, 0, 0)` : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
386
+ opacity = activityEnterStyle === "slideInLeft" ? "0" : "1";
387
+ break;
388
+ }
389
+ }
375
390
  const cleanup = () => {
376
391
  requestNextFrame(() => {
377
392
  refs2.forEach((ref) => {
@@ -380,6 +395,7 @@ function useStyleEffectOffset({
380
395
  }
381
396
  const $el = ref.current;
382
397
  $el.style.transform = "";
398
+ $el.style.opacity = "";
383
399
  listenOnce($el, "transitionend", () => {
384
400
  $el.style.transition = "";
385
401
  });
@@ -395,6 +411,7 @@ function useStyleEffectOffset({
395
411
  }
396
412
  ref.current.style.transition = globalVars.computedTransitionDuration;
397
413
  ref.current.style.transform = transform;
414
+ ref.current.style.opacity = opacity;
398
415
  });
399
416
  switch (activityTransitionState) {
400
417
  case "enter-done":
@@ -425,10 +442,10 @@ function useStyleEffectOffset({
425
442
  var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
426
443
  var appScreen = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf4349", "enter-done": "_1dlf434a", "exit-active": "_1dlf434b", "exit-done": "_1dlf434c" } }, defaultVariants: {}, compoundVariants: [] });
427
444
  var dim = "_1dlf434i dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4346 _1dlf4348";
428
- var edge = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1dlf434m dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
445
+ var edge = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1dlf434n dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434o" } }, defaultVariants: {}, compoundVariants: [] });
429
446
  var exitActive = "_1dlf434b";
430
447
  var exitDone = "_1dlf434c";
431
- var paper = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4348", variantClassNames: { hasAppBar: { true: "_1dlf434k dhthxqg" }, presentModalFullScreen: { true: "_1dlf434l" } }, defaultVariants: {}, compoundVariants: [] });
448
+ var paper = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4348", variantClassNames: { hasAppBar: { true: "_1dlf434k dhthxqg" }, modalPresentationStyle: { fullScreen: "_1dlf434l" }, activityEnterStyle: { slideInLeft: "_1dlf434m" } }, defaultVariants: {}, compoundVariants: [] });
432
449
  var vars = { transitionDuration: "var(--_1dlf4340)", zIndexes: { dim: "var(--_1dlf4341)", paper: "var(--_1dlf4342)", edge: "var(--_1dlf4343)", appBar: "var(--_1dlf4344)" }, appBar: { center: { mainWidth: "var(--_1dlf4345)" } } };
433
450
 
434
451
  // src/hooks/useStyleEffectSwipeBack.ts
@@ -611,30 +628,31 @@ var import_react7 = require("react");
611
628
 
612
629
  // src/components/AppBar.css.ts
613
630
  var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
614
- var appBar = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4347 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, presentModalFullScreen: { true: "_1yk3a454" } }, defaultVariants: {}, compoundVariants: [] });
615
- var backButton = "_1yk3a458 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
631
+ var appBar = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4347 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
632
+ var backButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
616
633
  var center = "dhthxq9 dhthxq7 dhthxq8 _1yk3a450";
617
- var centerMain = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1yk3a45b", variantClassNames: { hasLeft: { true: "_1yk3a45c" } }, defaultVariants: {}, compoundVariants: [] });
618
- var centerMainEdge = "_1yk3a45d dhthxqi dhthxq4 dhthxq2 dhthxqf";
619
- var centerText = "_1yk3a45e dhthxqc dhthxqd dhthxq0";
620
- var closeButton = "_1yk3a458 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
621
- var container = "_1yk3a456 dhthxqa dhthxq7 _1yk3a451";
622
- var left = "_1yk3a457 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
623
- var right = "_1yk3a45f dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
624
- var safeArea = "_1yk3a455";
634
+ var centerMain = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
635
+ var centerMainEdge = "_1yk3a45e dhthxqi dhthxq4 dhthxq2 dhthxqf";
636
+ var centerText = "_1yk3a45f dhthxqc dhthxqd dhthxq0";
637
+ var closeButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
638
+ var container = "_1yk3a457 dhthxqa dhthxq7 _1yk3a451";
639
+ var left = "_1yk3a458 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
640
+ var right = "_1yk3a45g dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
641
+ var safeArea = "_1yk3a456";
625
642
 
626
643
  // src/components/AppBar.tsx
627
644
  var import_jsx_runtime4 = require("react/jsx-runtime");
628
645
  var AppBar = (0, import_react7.forwardRef)(
629
646
  ({
630
647
  title,
631
- appendLeft,
632
- appendRight,
648
+ renderLeft,
649
+ renderRight,
633
650
  backButton: backButton2,
634
651
  closeButton: closeButton2,
635
652
  closeButtonLocation = "left",
636
653
  border = true,
637
654
  modalPresentationStyle,
655
+ activityEnterStyle,
638
656
  iconColor,
639
657
  iconColorTransitionDuration,
640
658
  textColor,
@@ -661,7 +679,6 @@ var AppBar = (0, import_react7.forwardRef)(
661
679
  innerRef: centerRef,
662
680
  enable: globalOptions.theme === "cupertino"
663
681
  });
664
- const presentModalFullScreen = modalPresentationStyle === "fullScreen";
665
682
  const onBackClick = (e) => {
666
683
  if (backButton2 && "onClick" in backButton2 && backButton2.onClick) {
667
684
  backButton2.onClick(e);
@@ -709,7 +726,7 @@ var AppBar = (0, import_react7.forwardRef)(
709
726
  if (globalBackButton && "renderIcon" in globalBackButton && globalBackButton.renderIcon) {
710
727
  return globalBackButton.renderIcon();
711
728
  }
712
- if (presentModalFullScreen) {
729
+ if (modalPresentationStyle === "fullScreen") {
713
730
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconClose_default, {});
714
731
  }
715
732
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBack_default, {});
@@ -758,14 +775,15 @@ var AppBar = (0, import_react7.forwardRef)(
758
775
  }
759
776
  );
760
777
  };
761
- const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || appendLeft);
778
+ const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || renderLeft);
762
779
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
763
780
  "div",
764
781
  {
765
782
  ref,
766
783
  className: appBar({
767
784
  border,
768
- presentModalFullScreen
785
+ modalPresentationStyle,
786
+ activityEnterStyle
769
787
  }),
770
788
  style: (0, import_dynamic2.assignInlineVars)(
771
789
  compactMap({
@@ -790,7 +808,7 @@ var AppBar = (0, import_react7.forwardRef)(
790
808
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: left, children: [
791
809
  closeButtonLocation === "left" && renderCloseButton(),
792
810
  renderBackButton(),
793
- appendLeft == null ? void 0 : appendLeft()
811
+ renderLeft == null ? void 0 : renderLeft()
794
812
  ] }),
795
813
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: centerRef, className: center, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
796
814
  "div",
@@ -813,7 +831,7 @@ var AppBar = (0, import_react7.forwardRef)(
813
831
  }
814
832
  ) }),
815
833
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: right, children: [
816
- appendRight == null ? void 0 : appendRight(),
834
+ renderRight == null ? void 0 : renderRight(),
817
835
  closeButtonLocation === "right" && renderCloseButton()
818
836
  ] })
819
837
  ] })
@@ -836,7 +854,8 @@ var AppScreen = ({
836
854
  dimBackgroundColor,
837
855
  appBar: appBar2,
838
856
  preventSwipeBack,
839
- modalPresentationStyle,
857
+ CUPERTINO_ONLY_modalPresentationStyle,
858
+ ANDROID_ONLY_activityEnterStyle,
840
859
  children
841
860
  }) => {
842
861
  var _a, _b;
@@ -848,36 +867,55 @@ var AppScreen = ({
848
867
  const paperRef = (0, import_react9.useRef)(null);
849
868
  const edgeRef = (0, import_react9.useRef)(null);
850
869
  const appBarRef = (0, import_react9.useRef)(null);
851
- const presentModalFullScreen = modalPresentationStyle === "fullScreen";
852
- const swipeBackPrevented = preventSwipeBack || presentModalFullScreen;
870
+ const modalPresentationStyle = globalOptions.theme === "cupertino" ? CUPERTINO_ONLY_modalPresentationStyle : void 0;
871
+ const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
872
+ const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
873
+ const hasAppBar = !!appBar2;
874
+ const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
875
+ let zIndexDim;
876
+ let zIndexPaper;
877
+ let zIndexEdge;
878
+ let zIndexAppBar;
879
+ switch (globalOptions.theme) {
880
+ case "cupertino": {
881
+ zIndexDim = zIndexBase + (modalPresentationStyle === "fullScreen" ? 2 : 0);
882
+ zIndexPaper = zIndexBase + (hasAppBar && modalPresentationStyle !== "fullScreen" ? 1 : 3);
883
+ zIndexEdge = zIndexBase + 4;
884
+ zIndexAppBar = zIndexBase + 7;
885
+ break;
886
+ }
887
+ case "android":
888
+ default: {
889
+ zIndexDim = zIndexBase;
890
+ zIndexPaper = zIndexBase + (activityEnterStyle === "slideInLeft" ? 1 : 3);
891
+ zIndexEdge = zIndexBase + 4;
892
+ zIndexAppBar = zIndexBase + (activityEnterStyle === "slideInLeft" ? 7 : 4);
893
+ break;
894
+ }
895
+ }
896
+ const transitionState = (_b = activity == null ? void 0 : activity.transitionState) != null ? _b : "enter-done";
897
+ const lazyTransitionState = useLazy(transitionState);
853
898
  useStyleEffectHide({
854
899
  refs: [appScreenRef],
855
900
  hasEffect: true
856
901
  });
857
902
  useStyleEffectOffset({
903
+ refs: globalOptions.theme === "cupertino" || activityEnterStyle === "slideInLeft" ? [paperRef] : [paperRef, appBarRef],
858
904
  theme: globalOptions.theme,
859
- refs: globalOptions.theme === "cupertino" ? [paperRef] : [paperRef, appBarRef],
860
- hasEffect: !presentModalFullScreen
905
+ activityEnterStyle,
906
+ hasEffect: modalPresentationStyle !== "fullScreen"
861
907
  });
862
908
  useStyleEffectSwipeBack({
863
- theme: globalOptions.theme,
864
909
  dimRef,
865
910
  edgeRef,
866
911
  paperRef,
867
- hasEffect: true,
912
+ theme: globalOptions.theme,
868
913
  prevented: swipeBackPrevented,
869
914
  onSwiped() {
870
915
  pop();
871
- }
916
+ },
917
+ hasEffect: true
872
918
  });
873
- const hasAppBar = !!appBar2;
874
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
875
- const zIndexDim = zIndexBase;
876
- const zIndexPaper = zIndexBase + (globalOptions.theme === "cupertino" && hasAppBar ? 1 : 3);
877
- const zIndexEdge = zIndexBase + 4;
878
- const zIndexAppBar = globalOptions.theme === "cupertino" ? zIndexBase + 7 : zIndexBase + 4;
879
- const transitionState = (_b = activity == null ? void 0 : activity.transitionState) != null ? _b : "enter-done";
880
- const lazyTransitionState = useLazy(transitionState);
881
919
  const onAppBarTopClick = (e) => {
882
920
  var _a2, _b2;
883
921
  (_a2 = appBar2 == null ? void 0 : appBar2.onTopClick) == null ? void 0 : _a2.call(appBar2, e);
@@ -923,13 +961,17 @@ var AppScreen = ({
923
961
  [vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.computedTransitionDuration : "0ms"
924
962
  })
925
963
  ),
964
+ "data-stackflow-component-name": "AppScreen",
965
+ "data-stackflow-activity-id": activity == null ? void 0 : activity.id,
966
+ "data-stackflow-activity-is-active": activity == null ? void 0 : activity.isActive,
926
967
  children: [
927
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
968
+ activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
928
969
  appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
929
970
  AppBar_default,
930
971
  __spreadProps(__spreadValues({}, appBar2), {
931
972
  ref: appBarRef,
932
973
  modalPresentationStyle,
974
+ activityEnterStyle,
933
975
  onTopClick: onAppBarTopClick
934
976
  })
935
977
  ),
@@ -938,7 +980,8 @@ var AppScreen = ({
938
980
  {
939
981
  className: paper({
940
982
  hasAppBar,
941
- presentModalFullScreen
983
+ modalPresentationStyle,
984
+ activityEnterStyle
942
985
  }),
943
986
  ref: paperRef,
944
987
  children
@@ -1028,6 +1071,9 @@ var BottomSheet = ({
1028
1071
  [vars2.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.computedTransitionDuration : "0ms"
1029
1072
  })
1030
1073
  ),
1074
+ "data-stackflow-component-name": "BottomSheet",
1075
+ "data-stackflow-activity-id": activity == null ? void 0 : activity.id,
1076
+ "data-stackflow-activity-is-active": activity == null ? void 0 : activity.isActive,
1031
1077
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: dim2, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: paper2, onClick: onPaperClick, children }) })
1032
1078
  }
1033
1079
  );
@@ -1108,6 +1154,9 @@ var Modal = ({
1108
1154
  [vars3.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.computedTransitionDuration : "0ms"
1109
1155
  })
1110
1156
  ),
1157
+ "data-stackflow-component-name": "Modal",
1158
+ "data-stackflow-activity-id": activity == null ? void 0 : activity.id,
1159
+ "data-stackflow-activity-is-active": activity == null ? void 0 : activity.isActive,
1111
1160
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: dim3, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: paper3, onClick: onPaperClick, children }) })
1112
1161
  }
1113
1162
  );