@stackflow/plugin-basic-ui 1.3.3-alpha.0 → 1.3.4-alpha.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.
- package/dist/basicUIPlugin.css.d.ts +1 -1
- package/dist/components/AppBar.css.d.ts +17 -2
- package/dist/components/AppBar.d.ts +2 -1
- package/dist/components/AppScreen.css.d.ts +11 -2
- package/dist/components/AppScreen.d.ts +2 -1
- package/dist/hooks/useStyleEffectOffset.d.ts +2 -1
- package/dist/index.css +42 -28
- package/dist/index.css.map +3 -3
- package/dist/index.js +76 -36
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +76 -36
- package/dist/index.mjs.map +2 -2
- package/package.json +5 -5
- package/src/basicUIPlugin.css.ts +2 -2
- package/src/basicUIPlugin.tsx +2 -2
- package/src/components/AppBar.css.ts +23 -6
- package/src/components/AppBar.tsx +5 -4
- package/src/components/AppScreen.css.ts +13 -4
- package/src/components/AppScreen.tsx +64 -24
- package/src/hooks/useStyleEffectOffset.ts +23 -4
package/dist/index.js
CHANGED
|
@@ -107,7 +107,7 @@ var import_react = require("react");
|
|
|
107
107
|
|
|
108
108
|
// src/basicUIPlugin.css.ts
|
|
109
109
|
var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
110
|
-
var globalVars = { backgroundColor: "var(--stackflow-plugin-basic-ui-background-color)", dimBackgroundColor: "var(--stackflow-plugin-basic-ui-dim-background-color)", transitionDuration: "var(--stackflow-plugin-basic-ui-transition-duration)", computedTransitionDuration: "var(--stackflow-plugin-basic-ui-computed-transition-duration)", appBar: { borderColor: "var(--stackflow-plugin-basic-ui-app-bar-border-color)", borderColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-border-color-transition-duration)", borderSize: "var(--stackflow-plugin-basic-ui-app-bar-border-size)", height: "var(--stackflow-plugin-basic-ui-app-bar-height)", heightTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-height-transition-duration)", minHeight: "var(--stackflow-plugin-basic-ui-app-bar-min-height)", iconColor: "var(--stackflow-plugin-basic-ui-app-bar-icon-color)", iconColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-icon-color-transition-duration)", textColor: "var(--stackflow-plugin-basic-ui-app-bar-text-color)", textColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-text-color-transition-duration)", backgroundColor: "var(--stackflow-plugin-basic-ui-app-bar-background-color)", backgroundColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-background-color-transition-duration)", overflow: "var(--stackflow-plugin-basic-ui-app-bar-overflow)",
|
|
110
|
+
var globalVars = { backgroundColor: "var(--stackflow-plugin-basic-ui-background-color)", dimBackgroundColor: "var(--stackflow-plugin-basic-ui-dim-background-color)", transitionDuration: "var(--stackflow-plugin-basic-ui-transition-duration)", computedTransitionDuration: "var(--stackflow-plugin-basic-ui-computed-transition-duration)", appBar: { borderColor: "var(--stackflow-plugin-basic-ui-app-bar-border-color)", borderColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-border-color-transition-duration)", borderSize: "var(--stackflow-plugin-basic-ui-app-bar-border-size)", height: "var(--stackflow-plugin-basic-ui-app-bar-height)", heightTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-height-transition-duration)", minHeight: "var(--stackflow-plugin-basic-ui-app-bar-min-height)", iconColor: "var(--stackflow-plugin-basic-ui-app-bar-icon-color)", iconColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-icon-color-transition-duration)", textColor: "var(--stackflow-plugin-basic-ui-app-bar-text-color)", textColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-text-color-transition-duration)", backgroundColor: "var(--stackflow-plugin-basic-ui-app-bar-background-color)", backgroundColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-background-color-transition-duration)", overflow: "var(--stackflow-plugin-basic-ui-app-bar-overflow)", minSafeAreaInsetTop: "var(--stackflow-plugin-basic-ui-app-bar-min-safe-area-inset-top)" }, bottomSheet: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" }, modal: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" } };
|
|
111
111
|
var stackWrapper = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1q6dj2j2", variantClassNames: { theme: { android: "_1q6dj2j0", cupertino: "_1q6dj2j1" }, loading: { true: "_1q6dj2j5" } }, defaultVariants: {}, compoundVariants: [] });
|
|
112
112
|
|
|
113
113
|
// src/utils/compact.ts
|
|
@@ -199,7 +199,7 @@ var basicUIPlugin = (options) => () => ({
|
|
|
199
199
|
[globalVars.appBar.height]: (_e = _options.appBar) == null ? void 0 : _e.height,
|
|
200
200
|
[globalVars.appBar.iconColor]: (_f = _options.appBar) == null ? void 0 : _f.iconColor,
|
|
201
201
|
[globalVars.appBar.textColor]: (_g = _options.appBar) == null ? void 0 : _g.textColor,
|
|
202
|
-
[globalVars.appBar.
|
|
202
|
+
[globalVars.appBar.minSafeAreaInsetTop]: (_h = _options.appBar) == null ? void 0 : _h.minSafeAreaInsetTop,
|
|
203
203
|
[globalVars.bottomSheet.borderRadius]: (_i = _options.bottomSheet) == null ? void 0 : _i.borderRadius,
|
|
204
204
|
[globalVars.modal.borderRadius]: (_j = _options.modal) == null ? void 0 : _j.borderRadius
|
|
205
205
|
})
|
|
@@ -365,13 +365,28 @@ var OFFSET_PX_CUPERTINO = 80;
|
|
|
365
365
|
function useStyleEffectOffset({
|
|
366
366
|
refs,
|
|
367
367
|
theme,
|
|
368
|
+
activityEnterStyle,
|
|
368
369
|
hasEffect
|
|
369
370
|
}) {
|
|
370
371
|
useStyleEffect({
|
|
371
372
|
styleName: "offset",
|
|
372
373
|
refs,
|
|
373
374
|
effect: hasEffect ? ({ activityTransitionState, refs: refs2 }) => {
|
|
374
|
-
|
|
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: "
|
|
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" },
|
|
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,17 +628,17 @@ 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" },
|
|
615
|
-
var backButton = "
|
|
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: "
|
|
618
|
-
var centerMainEdge = "
|
|
619
|
-
var centerText = "
|
|
620
|
-
var closeButton = "
|
|
621
|
-
var container = "
|
|
622
|
-
var left = "
|
|
623
|
-
var right = "
|
|
624
|
-
var safeArea = "
|
|
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");
|
|
@@ -635,6 +652,7 @@ var AppBar = (0, import_react7.forwardRef)(
|
|
|
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 (
|
|
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, {});
|
|
@@ -765,7 +782,8 @@ var AppBar = (0, import_react7.forwardRef)(
|
|
|
765
782
|
ref,
|
|
766
783
|
className: appBar({
|
|
767
784
|
border,
|
|
768
|
-
|
|
785
|
+
modalPresentationStyle,
|
|
786
|
+
activityEnterStyle
|
|
769
787
|
}),
|
|
770
788
|
style: (0, import_dynamic2.assignInlineVars)(
|
|
771
789
|
compactMap({
|
|
@@ -836,7 +854,8 @@ var AppScreen = ({
|
|
|
836
854
|
dimBackgroundColor,
|
|
837
855
|
appBar: appBar2,
|
|
838
856
|
preventSwipeBack,
|
|
839
|
-
|
|
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
|
|
852
|
-
const
|
|
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
|
-
|
|
860
|
-
hasEffect:
|
|
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
|
-
|
|
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);
|
|
@@ -924,12 +962,13 @@ var AppScreen = ({
|
|
|
924
962
|
})
|
|
925
963
|
),
|
|
926
964
|
children: [
|
|
927
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
|
|
965
|
+
activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
|
|
928
966
|
appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
929
967
|
AppBar_default,
|
|
930
968
|
__spreadProps(__spreadValues({}, appBar2), {
|
|
931
969
|
ref: appBarRef,
|
|
932
970
|
modalPresentationStyle,
|
|
971
|
+
activityEnterStyle,
|
|
933
972
|
onTopClick: onAppBarTopClick
|
|
934
973
|
})
|
|
935
974
|
),
|
|
@@ -938,7 +977,8 @@ var AppScreen = ({
|
|
|
938
977
|
{
|
|
939
978
|
className: paper({
|
|
940
979
|
hasAppBar,
|
|
941
|
-
|
|
980
|
+
modalPresentationStyle,
|
|
981
|
+
activityEnterStyle
|
|
942
982
|
}),
|
|
943
983
|
ref: paperRef,
|
|
944
984
|
children
|