@stackflow/plugin-basic-ui 1.4.2 → 1.5.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/hooks/index.d.ts +1 -0
- package/dist/hooks/useMounted.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +49 -35
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +19 -5
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
- package/src/components/AppScreen.tsx +6 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useMounted.ts +11 -0
- package/src/index.ts +3 -0
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMounted(): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,8 @@ export { IconBack, IconClose } from "./assets";
|
|
|
2
2
|
export { basicUIPlugin } from "./basicUIPlugin";
|
|
3
3
|
export { globalVars as cssVars } from "./basicUIPlugin.css";
|
|
4
4
|
export { default as AppScreen, AppScreenContext, AppScreenProps, useAppScreen, } from "./components/AppScreen";
|
|
5
|
+
export { vars as appScreenVars } from "./components/AppScreen.css";
|
|
5
6
|
export { default as BottomSheet, BottomSheetProps, } from "./components/BottomSheet";
|
|
7
|
+
export { vars as bottomSheetVars } from "./components/BottomSheet.css";
|
|
6
8
|
export { default as Modal, ModalProps } from "./components/Modal";
|
|
9
|
+
export { vars as modalVars } from "./components/Modal.css";
|
package/dist/index.js
CHANGED
|
@@ -42,8 +42,11 @@ __export(src_exports, {
|
|
|
42
42
|
IconBack: () => IconBack_default,
|
|
43
43
|
IconClose: () => IconClose_default,
|
|
44
44
|
Modal: () => Modal_default,
|
|
45
|
+
appScreenVars: () => vars,
|
|
45
46
|
basicUIPlugin: () => basicUIPlugin,
|
|
47
|
+
bottomSheetVars: () => vars2,
|
|
46
48
|
cssVars: () => globalVars,
|
|
49
|
+
modalVars: () => vars3,
|
|
47
50
|
useAppScreen: () => useAppScreen
|
|
48
51
|
});
|
|
49
52
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -213,9 +216,9 @@ var basicUIPlugin = (options) => () => ({
|
|
|
213
216
|
});
|
|
214
217
|
|
|
215
218
|
// src/components/AppScreen.tsx
|
|
216
|
-
var
|
|
219
|
+
var import_react9 = require("@stackflow/react");
|
|
217
220
|
var import_dynamic3 = require("@vanilla-extract/dynamic");
|
|
218
|
-
var
|
|
221
|
+
var import_react10 = require("react");
|
|
219
222
|
|
|
220
223
|
// src/hooks/useLazy.tsx
|
|
221
224
|
var import_react2 = require("react");
|
|
@@ -258,14 +261,24 @@ function useMaxWidth({
|
|
|
258
261
|
};
|
|
259
262
|
}
|
|
260
263
|
|
|
264
|
+
// src/hooks/useMounted.ts
|
|
265
|
+
var import_react4 = require("react");
|
|
266
|
+
function useMounted() {
|
|
267
|
+
const [mounted, mount] = (0, import_react4.useReducer)(() => true, false);
|
|
268
|
+
(0, import_react4.useEffect)(() => {
|
|
269
|
+
mount();
|
|
270
|
+
}, []);
|
|
271
|
+
return mounted;
|
|
272
|
+
}
|
|
273
|
+
|
|
261
274
|
// src/hooks/useNullableActivity.ts
|
|
262
|
-
var
|
|
275
|
+
var import_react5 = require("@stackflow/react");
|
|
263
276
|
function useNullableActivity() {
|
|
264
|
-
return (0,
|
|
277
|
+
return (0, import_react5.useActivity)();
|
|
265
278
|
}
|
|
266
279
|
|
|
267
280
|
// src/hooks/useStyleEffect.ts
|
|
268
|
-
var
|
|
281
|
+
var import_react6 = require("react");
|
|
269
282
|
var connections = {};
|
|
270
283
|
function useStyleEffect({
|
|
271
284
|
styleName,
|
|
@@ -274,7 +287,7 @@ function useStyleEffect({
|
|
|
274
287
|
effectDeps
|
|
275
288
|
}) {
|
|
276
289
|
const activity = useNullableActivity();
|
|
277
|
-
(0,
|
|
290
|
+
(0, import_react6.useEffect)(() => {
|
|
278
291
|
if (!activity) {
|
|
279
292
|
return noop;
|
|
280
293
|
}
|
|
@@ -289,7 +302,7 @@ function useStyleEffect({
|
|
|
289
302
|
connections[styleName].delete(activity.zIndex);
|
|
290
303
|
};
|
|
291
304
|
}, [activity == null ? void 0 : activity.id, refs, effect]);
|
|
292
|
-
(0,
|
|
305
|
+
(0, import_react6.useEffect)(() => {
|
|
293
306
|
if (!activity) {
|
|
294
307
|
return noop;
|
|
295
308
|
}
|
|
@@ -622,9 +635,9 @@ function useStyleEffectSwipeBack({
|
|
|
622
635
|
}
|
|
623
636
|
|
|
624
637
|
// src/components/AppBar.tsx
|
|
625
|
-
var
|
|
638
|
+
var import_react7 = require("@stackflow/react");
|
|
626
639
|
var import_dynamic2 = require("@vanilla-extract/dynamic");
|
|
627
|
-
var
|
|
640
|
+
var import_react8 = require("react");
|
|
628
641
|
|
|
629
642
|
// src/components/AppBar.css.ts
|
|
630
643
|
var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -642,7 +655,7 @@ var safeArea = "_1yk3a456";
|
|
|
642
655
|
|
|
643
656
|
// src/components/AppBar.tsx
|
|
644
657
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
645
|
-
var AppBar = (0,
|
|
658
|
+
var AppBar = (0, import_react8.forwardRef)(
|
|
646
659
|
({
|
|
647
660
|
title,
|
|
648
661
|
renderLeft,
|
|
@@ -668,12 +681,12 @@ var AppBar = (0, import_react7.forwardRef)(
|
|
|
668
681
|
onTopClick
|
|
669
682
|
}, ref) => {
|
|
670
683
|
var _a, _b;
|
|
671
|
-
const actions = (0,
|
|
684
|
+
const actions = (0, import_react7.useActions)();
|
|
672
685
|
const activity = useNullableActivity();
|
|
673
686
|
const globalOptions = useGlobalOptions();
|
|
674
687
|
const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
|
|
675
688
|
const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
|
|
676
|
-
const centerRef = (0,
|
|
689
|
+
const centerRef = (0, import_react8.useRef)(null);
|
|
677
690
|
const { maxWidth } = useMaxWidth({
|
|
678
691
|
outerRef: ref,
|
|
679
692
|
innerRef: centerRef,
|
|
@@ -845,9 +858,9 @@ var AppBar_default = AppBar;
|
|
|
845
858
|
|
|
846
859
|
// src/components/AppScreen.tsx
|
|
847
860
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
848
|
-
var Context = (0,
|
|
861
|
+
var Context = (0, import_react10.createContext)(null);
|
|
849
862
|
function useAppScreen() {
|
|
850
|
-
return (0,
|
|
863
|
+
return (0, import_react10.useContext)(Context);
|
|
851
864
|
}
|
|
852
865
|
var AppScreen = ({
|
|
853
866
|
backgroundColor,
|
|
@@ -861,12 +874,13 @@ var AppScreen = ({
|
|
|
861
874
|
var _a, _b;
|
|
862
875
|
const globalOptions = useGlobalOptions();
|
|
863
876
|
const activity = useNullableActivity();
|
|
864
|
-
const
|
|
865
|
-
const
|
|
866
|
-
const
|
|
867
|
-
const
|
|
868
|
-
const
|
|
869
|
-
const
|
|
877
|
+
const mounted = useMounted();
|
|
878
|
+
const { pop } = (0, import_react9.useActions)();
|
|
879
|
+
const appScreenRef = (0, import_react10.useRef)(null);
|
|
880
|
+
const dimRef = (0, import_react10.useRef)(null);
|
|
881
|
+
const paperRef = (0, import_react10.useRef)(null);
|
|
882
|
+
const edgeRef = (0, import_react10.useRef)(null);
|
|
883
|
+
const appBarRef = (0, import_react10.useRef)(null);
|
|
870
884
|
const modalPresentationStyle = globalOptions.theme === "cupertino" ? CUPERTINO_ONLY_modalPresentationStyle : void 0;
|
|
871
885
|
const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
|
|
872
886
|
const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
|
|
@@ -929,7 +943,7 @@ var AppScreen = ({
|
|
|
929
943
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
930
944
|
Context.Provider,
|
|
931
945
|
{
|
|
932
|
-
value: (0,
|
|
946
|
+
value: (0, import_react10.useMemo)(
|
|
933
947
|
() => ({
|
|
934
948
|
scroll({ top }) {
|
|
935
949
|
var _a2;
|
|
@@ -962,8 +976,8 @@ var AppScreen = ({
|
|
|
962
976
|
})
|
|
963
977
|
),
|
|
964
978
|
"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,
|
|
979
|
+
"data-stackflow-activity-id": mounted ? activity == null ? void 0 : activity.id : void 0,
|
|
980
|
+
"data-stackflow-activity-is-active": mounted ? activity == null ? void 0 : activity.isActive : void 0,
|
|
967
981
|
children: [
|
|
968
982
|
activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
|
|
969
983
|
appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -999,9 +1013,9 @@ AppScreen.displayName = "AppScreen";
|
|
|
999
1013
|
var AppScreen_default = AppScreen;
|
|
1000
1014
|
|
|
1001
1015
|
// src/components/BottomSheet.tsx
|
|
1002
|
-
var
|
|
1016
|
+
var import_react11 = require("@stackflow/react");
|
|
1003
1017
|
var import_dynamic4 = require("@vanilla-extract/dynamic");
|
|
1004
|
-
var
|
|
1018
|
+
var import_react12 = require("react");
|
|
1005
1019
|
|
|
1006
1020
|
// src/components/BottomSheet.css.ts
|
|
1007
1021
|
var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -1021,9 +1035,9 @@ var BottomSheet = ({
|
|
|
1021
1035
|
}) => {
|
|
1022
1036
|
var _a, _b, _c;
|
|
1023
1037
|
const activity = useNullableActivity();
|
|
1024
|
-
const { pop } = (0,
|
|
1025
|
-
const containerRef = (0,
|
|
1026
|
-
const paperRef = (0,
|
|
1038
|
+
const { pop } = (0, import_react11.useActions)();
|
|
1039
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
1040
|
+
const paperRef = (0, import_react12.useRef)(null);
|
|
1027
1041
|
useStyleEffect({
|
|
1028
1042
|
styleName: "hide",
|
|
1029
1043
|
refs: [containerRef]
|
|
@@ -1036,7 +1050,7 @@ var BottomSheet = ({
|
|
|
1036
1050
|
styleName: "swipe-back",
|
|
1037
1051
|
refs: [paperRef]
|
|
1038
1052
|
});
|
|
1039
|
-
const popLock = (0,
|
|
1053
|
+
const popLock = (0, import_react12.useRef)(false);
|
|
1040
1054
|
const onDimClick = (e) => {
|
|
1041
1055
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
1042
1056
|
if (e.defaultPrevented) {
|
|
@@ -1082,9 +1096,9 @@ BottomSheet.displayName = "BottomSheet";
|
|
|
1082
1096
|
var BottomSheet_default = BottomSheet;
|
|
1083
1097
|
|
|
1084
1098
|
// src/components/Modal.tsx
|
|
1085
|
-
var
|
|
1099
|
+
var import_react13 = require("@stackflow/react");
|
|
1086
1100
|
var import_dynamic5 = require("@vanilla-extract/dynamic");
|
|
1087
|
-
var
|
|
1101
|
+
var import_react14 = require("react");
|
|
1088
1102
|
|
|
1089
1103
|
// src/components/Modal.css.ts
|
|
1090
1104
|
var import_createRuntimeFn5 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -1104,9 +1118,9 @@ var Modal = ({
|
|
|
1104
1118
|
}) => {
|
|
1105
1119
|
var _a, _b, _c;
|
|
1106
1120
|
const activity = useNullableActivity();
|
|
1107
|
-
const { pop } = (0,
|
|
1108
|
-
const containerRef = (0,
|
|
1109
|
-
const paperRef = (0,
|
|
1121
|
+
const { pop } = (0, import_react13.useActions)();
|
|
1122
|
+
const containerRef = (0, import_react14.useRef)(null);
|
|
1123
|
+
const paperRef = (0, import_react14.useRef)(null);
|
|
1110
1124
|
useStyleEffect({
|
|
1111
1125
|
styleName: "hide",
|
|
1112
1126
|
refs: [containerRef]
|
|
@@ -1119,7 +1133,7 @@ var Modal = ({
|
|
|
1119
1133
|
styleName: "swipe-back",
|
|
1120
1134
|
refs: [paperRef]
|
|
1121
1135
|
});
|
|
1122
|
-
const popLock = (0,
|
|
1136
|
+
const popLock = (0, import_react14.useRef)(false);
|
|
1123
1137
|
const onDimClick = (e) => {
|
|
1124
1138
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
1125
1139
|
if (e.defaultPrevented) {
|