@stackflow/plugin-basic-ui 1.5.0 → 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.js +46 -35
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +16 -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/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMounted(): boolean;
|
package/dist/index.js
CHANGED
|
@@ -216,9 +216,9 @@ var basicUIPlugin = (options) => () => ({
|
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
// src/components/AppScreen.tsx
|
|
219
|
-
var
|
|
219
|
+
var import_react9 = require("@stackflow/react");
|
|
220
220
|
var import_dynamic3 = require("@vanilla-extract/dynamic");
|
|
221
|
-
var
|
|
221
|
+
var import_react10 = require("react");
|
|
222
222
|
|
|
223
223
|
// src/hooks/useLazy.tsx
|
|
224
224
|
var import_react2 = require("react");
|
|
@@ -261,14 +261,24 @@ function useMaxWidth({
|
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
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
|
+
|
|
264
274
|
// src/hooks/useNullableActivity.ts
|
|
265
|
-
var
|
|
275
|
+
var import_react5 = require("@stackflow/react");
|
|
266
276
|
function useNullableActivity() {
|
|
267
|
-
return (0,
|
|
277
|
+
return (0, import_react5.useActivity)();
|
|
268
278
|
}
|
|
269
279
|
|
|
270
280
|
// src/hooks/useStyleEffect.ts
|
|
271
|
-
var
|
|
281
|
+
var import_react6 = require("react");
|
|
272
282
|
var connections = {};
|
|
273
283
|
function useStyleEffect({
|
|
274
284
|
styleName,
|
|
@@ -277,7 +287,7 @@ function useStyleEffect({
|
|
|
277
287
|
effectDeps
|
|
278
288
|
}) {
|
|
279
289
|
const activity = useNullableActivity();
|
|
280
|
-
(0,
|
|
290
|
+
(0, import_react6.useEffect)(() => {
|
|
281
291
|
if (!activity) {
|
|
282
292
|
return noop;
|
|
283
293
|
}
|
|
@@ -292,7 +302,7 @@ function useStyleEffect({
|
|
|
292
302
|
connections[styleName].delete(activity.zIndex);
|
|
293
303
|
};
|
|
294
304
|
}, [activity == null ? void 0 : activity.id, refs, effect]);
|
|
295
|
-
(0,
|
|
305
|
+
(0, import_react6.useEffect)(() => {
|
|
296
306
|
if (!activity) {
|
|
297
307
|
return noop;
|
|
298
308
|
}
|
|
@@ -625,9 +635,9 @@ function useStyleEffectSwipeBack({
|
|
|
625
635
|
}
|
|
626
636
|
|
|
627
637
|
// src/components/AppBar.tsx
|
|
628
|
-
var
|
|
638
|
+
var import_react7 = require("@stackflow/react");
|
|
629
639
|
var import_dynamic2 = require("@vanilla-extract/dynamic");
|
|
630
|
-
var
|
|
640
|
+
var import_react8 = require("react");
|
|
631
641
|
|
|
632
642
|
// src/components/AppBar.css.ts
|
|
633
643
|
var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -645,7 +655,7 @@ var safeArea = "_1yk3a456";
|
|
|
645
655
|
|
|
646
656
|
// src/components/AppBar.tsx
|
|
647
657
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
648
|
-
var AppBar = (0,
|
|
658
|
+
var AppBar = (0, import_react8.forwardRef)(
|
|
649
659
|
({
|
|
650
660
|
title,
|
|
651
661
|
renderLeft,
|
|
@@ -671,12 +681,12 @@ var AppBar = (0, import_react7.forwardRef)(
|
|
|
671
681
|
onTopClick
|
|
672
682
|
}, ref) => {
|
|
673
683
|
var _a, _b;
|
|
674
|
-
const actions = (0,
|
|
684
|
+
const actions = (0, import_react7.useActions)();
|
|
675
685
|
const activity = useNullableActivity();
|
|
676
686
|
const globalOptions = useGlobalOptions();
|
|
677
687
|
const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
|
|
678
688
|
const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
|
|
679
|
-
const centerRef = (0,
|
|
689
|
+
const centerRef = (0, import_react8.useRef)(null);
|
|
680
690
|
const { maxWidth } = useMaxWidth({
|
|
681
691
|
outerRef: ref,
|
|
682
692
|
innerRef: centerRef,
|
|
@@ -848,9 +858,9 @@ var AppBar_default = AppBar;
|
|
|
848
858
|
|
|
849
859
|
// src/components/AppScreen.tsx
|
|
850
860
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
851
|
-
var Context = (0,
|
|
861
|
+
var Context = (0, import_react10.createContext)(null);
|
|
852
862
|
function useAppScreen() {
|
|
853
|
-
return (0,
|
|
863
|
+
return (0, import_react10.useContext)(Context);
|
|
854
864
|
}
|
|
855
865
|
var AppScreen = ({
|
|
856
866
|
backgroundColor,
|
|
@@ -864,12 +874,13 @@ var AppScreen = ({
|
|
|
864
874
|
var _a, _b;
|
|
865
875
|
const globalOptions = useGlobalOptions();
|
|
866
876
|
const activity = useNullableActivity();
|
|
867
|
-
const
|
|
868
|
-
const
|
|
869
|
-
const
|
|
870
|
-
const
|
|
871
|
-
const
|
|
872
|
-
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);
|
|
873
884
|
const modalPresentationStyle = globalOptions.theme === "cupertino" ? CUPERTINO_ONLY_modalPresentationStyle : void 0;
|
|
874
885
|
const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
|
|
875
886
|
const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
|
|
@@ -932,7 +943,7 @@ var AppScreen = ({
|
|
|
932
943
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
933
944
|
Context.Provider,
|
|
934
945
|
{
|
|
935
|
-
value: (0,
|
|
946
|
+
value: (0, import_react10.useMemo)(
|
|
936
947
|
() => ({
|
|
937
948
|
scroll({ top }) {
|
|
938
949
|
var _a2;
|
|
@@ -965,8 +976,8 @@ var AppScreen = ({
|
|
|
965
976
|
})
|
|
966
977
|
),
|
|
967
978
|
"data-stackflow-component-name": "AppScreen",
|
|
968
|
-
"data-stackflow-activity-id": activity == null ? void 0 : activity.id,
|
|
969
|
-
"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,
|
|
970
981
|
children: [
|
|
971
982
|
activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
|
|
972
983
|
appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -1002,9 +1013,9 @@ AppScreen.displayName = "AppScreen";
|
|
|
1002
1013
|
var AppScreen_default = AppScreen;
|
|
1003
1014
|
|
|
1004
1015
|
// src/components/BottomSheet.tsx
|
|
1005
|
-
var
|
|
1016
|
+
var import_react11 = require("@stackflow/react");
|
|
1006
1017
|
var import_dynamic4 = require("@vanilla-extract/dynamic");
|
|
1007
|
-
var
|
|
1018
|
+
var import_react12 = require("react");
|
|
1008
1019
|
|
|
1009
1020
|
// src/components/BottomSheet.css.ts
|
|
1010
1021
|
var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -1024,9 +1035,9 @@ var BottomSheet = ({
|
|
|
1024
1035
|
}) => {
|
|
1025
1036
|
var _a, _b, _c;
|
|
1026
1037
|
const activity = useNullableActivity();
|
|
1027
|
-
const { pop } = (0,
|
|
1028
|
-
const containerRef = (0,
|
|
1029
|
-
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);
|
|
1030
1041
|
useStyleEffect({
|
|
1031
1042
|
styleName: "hide",
|
|
1032
1043
|
refs: [containerRef]
|
|
@@ -1039,7 +1050,7 @@ var BottomSheet = ({
|
|
|
1039
1050
|
styleName: "swipe-back",
|
|
1040
1051
|
refs: [paperRef]
|
|
1041
1052
|
});
|
|
1042
|
-
const popLock = (0,
|
|
1053
|
+
const popLock = (0, import_react12.useRef)(false);
|
|
1043
1054
|
const onDimClick = (e) => {
|
|
1044
1055
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
1045
1056
|
if (e.defaultPrevented) {
|
|
@@ -1085,9 +1096,9 @@ BottomSheet.displayName = "BottomSheet";
|
|
|
1085
1096
|
var BottomSheet_default = BottomSheet;
|
|
1086
1097
|
|
|
1087
1098
|
// src/components/Modal.tsx
|
|
1088
|
-
var
|
|
1099
|
+
var import_react13 = require("@stackflow/react");
|
|
1089
1100
|
var import_dynamic5 = require("@vanilla-extract/dynamic");
|
|
1090
|
-
var
|
|
1101
|
+
var import_react14 = require("react");
|
|
1091
1102
|
|
|
1092
1103
|
// src/components/Modal.css.ts
|
|
1093
1104
|
var import_createRuntimeFn5 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -1107,9 +1118,9 @@ var Modal = ({
|
|
|
1107
1118
|
}) => {
|
|
1108
1119
|
var _a, _b, _c;
|
|
1109
1120
|
const activity = useNullableActivity();
|
|
1110
|
-
const { pop } = (0,
|
|
1111
|
-
const containerRef = (0,
|
|
1112
|
-
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);
|
|
1113
1124
|
useStyleEffect({
|
|
1114
1125
|
styleName: "hide",
|
|
1115
1126
|
refs: [containerRef]
|
|
@@ -1122,7 +1133,7 @@ var Modal = ({
|
|
|
1122
1133
|
styleName: "swipe-back",
|
|
1123
1134
|
refs: [paperRef]
|
|
1124
1135
|
});
|
|
1125
|
-
const popLock = (0,
|
|
1136
|
+
const popLock = (0, import_react14.useRef)(false);
|
|
1126
1137
|
const onDimClick = (e) => {
|
|
1127
1138
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
1128
1139
|
if (e.defaultPrevented) {
|