@seed-design/stackflow 0.0.1-rc.1 → 0.0.1-rc.4
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/lib/components/AppBar/AppBar.cjs +92 -0
- package/lib/components/AppBar/AppBar.d.ts +13 -12
- package/lib/components/AppBar/AppBar.js +81 -0
- package/lib/components/AppBar/AppBar.namespace.cjs +15 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts +2 -2
- package/lib/components/AppBar/AppBar.namespace.js +1 -0
- package/lib/components/AppBar/index.cjs +17 -0
- package/lib/components/AppBar/index.d.ts +3 -3
- package/lib/components/AppBar/index.js +3 -0
- package/lib/components/AppScreen/AppScreen.cjs +58 -0
- package/lib/components/AppScreen/AppScreen.d.ts +8 -7
- package/lib/components/AppScreen/AppScreen.js +50 -0
- package/lib/components/AppScreen/AppScreen.namespace.cjs +13 -0
- package/lib/components/AppScreen/AppScreen.namespace.d.ts +2 -2
- package/lib/components/AppScreen/AppScreen.namespace.js +1 -0
- package/lib/components/AppScreen/index.cjs +15 -0
- package/lib/components/AppScreen/index.d.ts +3 -3
- package/lib/components/AppScreen/index.js +3 -0
- package/lib/components/index.cjs +25 -0
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.js +6 -0
- package/lib/index.cjs +29 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.js +9 -786
- package/lib/plugin.cjs +16 -0
- package/lib/plugin.d.ts +1 -1
- package/lib/plugin.js +12 -0
- package/lib/primitive/AppBar/AppBar.cjs +43 -0
- package/lib/primitive/AppBar/AppBar.d.ts +7 -6
- package/lib/primitive/AppBar/AppBar.js +36 -0
- package/lib/primitive/AppBar/AppBar.namespace.cjs +12 -0
- package/lib/primitive/AppBar/AppBar.namespace.d.ts +1 -1
- package/lib/primitive/AppBar/AppBar.namespace.js +1 -0
- package/lib/primitive/AppBar/index.cjs +14 -0
- package/lib/primitive/AppBar/index.d.ts +2 -2
- package/lib/primitive/AppBar/index.js +3 -0
- package/lib/primitive/AppBar/useAppBar.cjs +38 -0
- package/lib/primitive/AppBar/useAppBar.d.ts +168 -167
- package/lib/primitive/AppBar/useAppBar.js +34 -0
- package/lib/primitive/AppBar/useAppBarContext.cjs +20 -0
- package/lib/primitive/AppBar/useAppBarContext.d.ts +3 -2
- package/lib/primitive/AppBar/useAppBarContext.js +15 -0
- package/lib/primitive/AppScreen/AppScreen.cjs +57 -0
- package/lib/primitive/AppScreen/AppScreen.d.ts +7 -6
- package/lib/primitive/AppScreen/AppScreen.js +50 -0
- package/lib/primitive/AppScreen/AppScreen.namespace.cjs +12 -0
- package/lib/primitive/AppScreen/AppScreen.namespace.d.ts +1 -1
- package/lib/primitive/AppScreen/AppScreen.namespace.js +1 -0
- package/lib/primitive/AppScreen/index.cjs +16 -0
- package/lib/primitive/AppScreen/index.d.ts +3 -3
- package/lib/primitive/AppScreen/index.js +4 -0
- package/lib/primitive/AppScreen/useAppScreen.cjs +64 -0
- package/lib/primitive/AppScreen/useAppScreen.d.ts +657 -655
- package/lib/primitive/AppScreen/useAppScreen.js +60 -0
- package/lib/primitive/AppScreen/useAppScreenContext.cjs +20 -0
- package/lib/primitive/AppScreen/useAppScreenContext.d.ts +3 -2
- package/lib/primitive/AppScreen/useAppScreenContext.js +15 -0
- package/lib/primitive/GlobalInteraction/GlobalInteraction.cjs +27 -0
- package/lib/primitive/GlobalInteraction/GlobalInteraction.d.ts +3 -2
- package/lib/primitive/GlobalInteraction/GlobalInteraction.js +23 -0
- package/lib/primitive/GlobalInteraction/index.cjs +11 -0
- package/lib/primitive/GlobalInteraction/index.d.ts +2 -2
- package/lib/primitive/GlobalInteraction/index.js +2 -0
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +122 -0
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +5 -4
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +118 -0
- package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.cjs +20 -0
- package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.d.ts +3 -2
- package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.js +15 -0
- package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +57 -0
- package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +1 -1
- package/lib/primitive/GlobalInteraction/useSwipeBack.js +53 -0
- package/lib/primitive/index.cjs +27 -0
- package/lib/primitive/index.d.ts +3 -3
- package/lib/primitive/index.js +9 -0
- package/lib/primitive/private/useElementOffset.cjs +53 -0
- package/lib/primitive/private/useElementOffset.js +30 -0
- package/lib/primitive/private/useTopActivity.cjs +31 -0
- package/lib/primitive/private/useTopActivity.js +27 -0
- package/lib/utils/createStyleContext.cjs +76 -0
- package/lib/utils/createStyleContext.js +72 -0
- package/lib/utils/createWithStateProps.d.ts +2 -1
- package/package.json +13 -14
- package/src/components/AppScreen/AppScreen.namespace.ts +1 -0
- package/src/components/AppScreen/{index.tsx → index.ts} +1 -0
- package/src/plugin.tsx +1 -1
- package/lib/index.js.map +0 -7
- package/lib/index.mjs +0 -759
- package/lib/index.mjs.map +0 -7
- /package/src/components/AppBar/{index.tsx → index.ts} +0 -0
- /package/src/components/{index.tsx → index.ts} +0 -0
- /package/src/primitive/{index.tsx → index.ts} +0 -0
package/lib/index.js
CHANGED
|
@@ -1,786 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
AppBar: () => AppBar_namespace_exports2,
|
|
34
|
-
AppBarIconButton: () => AppBarIconButton,
|
|
35
|
-
AppBarLeft: () => AppBarLeft2,
|
|
36
|
-
AppBarMain: () => AppBarMain2,
|
|
37
|
-
AppBarRight: () => AppBarRight2,
|
|
38
|
-
AppBarRoot: () => AppBarRoot2,
|
|
39
|
-
AppBarSubtitle: () => AppBarSubtitle,
|
|
40
|
-
AppBarTitle: () => AppBarTitle,
|
|
41
|
-
AppScreen: () => AppScreen_namespace_exports2,
|
|
42
|
-
AppScreenDim: () => AppScreenDim2,
|
|
43
|
-
AppScreenEdge: () => AppScreenEdge2,
|
|
44
|
-
AppScreenLayer: () => AppScreenLayer2,
|
|
45
|
-
AppScreenRoot: () => AppScreenRoot2,
|
|
46
|
-
Primitive: () => primitive_exports,
|
|
47
|
-
seedPlugin: () => seedPlugin
|
|
48
|
-
});
|
|
49
|
-
module.exports = __toCommonJS(index_exports);
|
|
50
|
-
|
|
51
|
-
// src/components/AppScreen/AppScreen.tsx
|
|
52
|
-
var import_app_screen = require("@seed-design/css/recipes/app-screen");
|
|
53
|
-
var import_react15 = require("react");
|
|
54
|
-
|
|
55
|
-
// src/primitive/index.tsx
|
|
56
|
-
var primitive_exports = {};
|
|
57
|
-
__export(primitive_exports, {
|
|
58
|
-
AppBar: () => AppBar_namespace_exports,
|
|
59
|
-
AppBarLeft: () => AppBarLeft,
|
|
60
|
-
AppBarMain: () => AppBarMain,
|
|
61
|
-
AppBarRight: () => AppBarRight,
|
|
62
|
-
AppBarRoot: () => AppBarRoot,
|
|
63
|
-
AppScreen: () => AppScreen_namespace_exports,
|
|
64
|
-
AppScreenDim: () => AppScreenDim,
|
|
65
|
-
AppScreenEdge: () => AppScreenEdge,
|
|
66
|
-
AppScreenLayer: () => AppScreenLayer,
|
|
67
|
-
AppScreenRoot: () => AppScreenRoot,
|
|
68
|
-
GlobalInteraction: () => GlobalInteraction,
|
|
69
|
-
useAppScreenContext: () => useAppScreenContext,
|
|
70
|
-
useGlobalInteractionContext: () => useGlobalInteractionContext
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// src/primitive/AppScreen/AppScreen.tsx
|
|
74
|
-
var import_dom_utils2 = require("@seed-design/dom-utils");
|
|
75
|
-
var import_react_primitive = require("@seed-design/react-primitive");
|
|
76
|
-
var import_react5 = require("react");
|
|
77
|
-
|
|
78
|
-
// src/primitive/AppScreen/useAppScreen.tsx
|
|
79
|
-
var import_dom_utils = require("@seed-design/dom-utils");
|
|
80
|
-
var import_react_ui_core = require("@stackflow/react-ui-core");
|
|
81
|
-
var import_react3 = require("react");
|
|
82
|
-
|
|
83
|
-
// src/primitive/GlobalInteraction/useSwipeBack.ts
|
|
84
|
-
var import_react2 = require("react");
|
|
85
|
-
|
|
86
|
-
// src/primitive/GlobalInteraction/useGlobalInteractionContext.tsx
|
|
87
|
-
var import_react = require("react");
|
|
88
|
-
var GlobalInteractionContext = (0, import_react.createContext)(null);
|
|
89
|
-
var GlobalInteractionProvider = GlobalInteractionContext.Provider;
|
|
90
|
-
function useGlobalInteractionContext({
|
|
91
|
-
strict = true
|
|
92
|
-
} = {}) {
|
|
93
|
-
const context = (0, import_react.useContext)(GlobalInteractionContext);
|
|
94
|
-
if (!context && strict) {
|
|
95
|
-
throw new Error("useGlobalInteractionContext must be used within a GlobalInteractionProvider");
|
|
96
|
-
}
|
|
97
|
-
return context;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/primitive/GlobalInteraction/useSwipeBack.ts
|
|
101
|
-
function useSwipeBack(props) {
|
|
102
|
-
const globalInteraction = useGlobalInteractionContext();
|
|
103
|
-
const events = globalInteraction.getSwipeBackEvents(props);
|
|
104
|
-
(0, import_react2.useEffect)(() => {
|
|
105
|
-
return () => {
|
|
106
|
-
events.reset();
|
|
107
|
-
};
|
|
108
|
-
}, [events]);
|
|
109
|
-
return (0, import_react2.useMemo)(
|
|
110
|
-
() => ({
|
|
111
|
-
activityProps: {
|
|
112
|
-
"data-swipe-back": ""
|
|
113
|
-
},
|
|
114
|
-
layerProps: {
|
|
115
|
-
onTransitionEnd: (e) => {
|
|
116
|
-
if (e.target === e.currentTarget) {
|
|
117
|
-
events.reset();
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
onAnimationEnd: (e) => {
|
|
121
|
-
if (e.target === e.currentTarget) {
|
|
122
|
-
events.reset();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
edgeProps: {
|
|
127
|
-
tabIndex: -1,
|
|
128
|
-
onTouchStart: (e) => {
|
|
129
|
-
const x0 = e.touches[0].clientX;
|
|
130
|
-
const t0 = Date.now();
|
|
131
|
-
events.startSwipeBack({ x0, t0 });
|
|
132
|
-
},
|
|
133
|
-
onTouchMove: (e) => {
|
|
134
|
-
const x = e.touches[0].clientX;
|
|
135
|
-
const t = Date.now();
|
|
136
|
-
events.moveSwipeBack({ x, t });
|
|
137
|
-
},
|
|
138
|
-
onTouchEnd: () => {
|
|
139
|
-
events.endSwipeBack({});
|
|
140
|
-
},
|
|
141
|
-
onTouchCancel: () => {
|
|
142
|
-
events.endSwipeBack({});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}),
|
|
146
|
-
[events]
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// src/primitive/AppScreen/useAppScreen.tsx
|
|
151
|
-
function useAppScreen(props) {
|
|
152
|
-
var _a;
|
|
153
|
-
const activity = (0, import_react_ui_core.useNullableActivity)();
|
|
154
|
-
const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
|
|
155
|
-
const { activityProps, layerProps, edgeProps } = useSwipeBack(props);
|
|
156
|
-
const zIndexBase = (0, import_react_ui_core.useZIndexBase)();
|
|
157
|
-
const zIndexStyle = (0, import_react3.useMemo)(
|
|
158
|
-
() => ({
|
|
159
|
-
"--z-index-base": zIndexBase.toString()
|
|
160
|
-
}),
|
|
161
|
-
[zIndexBase]
|
|
162
|
-
);
|
|
163
|
-
const stateProps = (0, import_react3.useMemo)(
|
|
164
|
-
() => ({
|
|
165
|
-
"data-activity-is-top": (0, import_dom_utils.dataAttr)(activity == null ? void 0 : activity.isTop),
|
|
166
|
-
"data-activity-is-active": (0, import_dom_utils.dataAttr)(activity == null ? void 0 : activity.isActive),
|
|
167
|
-
"data-transition-state": transitionState
|
|
168
|
-
}),
|
|
169
|
-
[transitionState, activity == null ? void 0 : activity.isActive, activity == null ? void 0 : activity.isTop]
|
|
170
|
-
);
|
|
171
|
-
return (0, import_react3.useMemo)(
|
|
172
|
-
() => ({
|
|
173
|
-
activity,
|
|
174
|
-
stateProps,
|
|
175
|
-
activityProps: (0, import_dom_utils.elementProps)({
|
|
176
|
-
"data-part": "activity",
|
|
177
|
-
"data-activity-type": "full-screen",
|
|
178
|
-
...activityProps,
|
|
179
|
-
...stateProps,
|
|
180
|
-
"data-activity-id": activity == null ? void 0 : activity.id,
|
|
181
|
-
style: zIndexStyle,
|
|
182
|
-
// FIXME: @stackflow/react should prevent activity.id hydration mismatch; this is temporal fix.
|
|
183
|
-
suppressHydrationWarning: true
|
|
184
|
-
}),
|
|
185
|
-
dimProps: (0, import_dom_utils.elementProps)({
|
|
186
|
-
"data-part": "dim",
|
|
187
|
-
...stateProps
|
|
188
|
-
}),
|
|
189
|
-
layerProps: (0, import_dom_utils.elementProps)({
|
|
190
|
-
"data-part": "layer",
|
|
191
|
-
...stateProps,
|
|
192
|
-
...layerProps
|
|
193
|
-
}),
|
|
194
|
-
edgeProps: (0, import_dom_utils.elementProps)({
|
|
195
|
-
"data-part": "edge",
|
|
196
|
-
"aria-hidden": true,
|
|
197
|
-
tabIndex: -1,
|
|
198
|
-
...edgeProps,
|
|
199
|
-
...stateProps
|
|
200
|
-
})
|
|
201
|
-
}),
|
|
202
|
-
[activity, zIndexStyle, stateProps, activityProps, edgeProps, layerProps]
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// src/primitive/AppScreen/useAppScreenContext.ts
|
|
207
|
-
var import_react4 = require("react");
|
|
208
|
-
var AppScreenContext = (0, import_react4.createContext)(null);
|
|
209
|
-
var AppScreenProvider = AppScreenContext.Provider;
|
|
210
|
-
function useAppScreenContext({
|
|
211
|
-
strict = true
|
|
212
|
-
} = {}) {
|
|
213
|
-
const context = (0, import_react4.useContext)(AppScreenContext);
|
|
214
|
-
if (!context && strict) {
|
|
215
|
-
throw new Error("useAppScreenContext must be used within a AppScreen");
|
|
216
|
-
}
|
|
217
|
-
return context;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/primitive/AppScreen/AppScreen.tsx
|
|
221
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
222
|
-
var AppScreenRoot = (0, import_react5.forwardRef)((props, ref) => {
|
|
223
|
-
const {
|
|
224
|
-
swipeBackDisplacementRatioThreshold,
|
|
225
|
-
swipeBackVelocityThreshold,
|
|
226
|
-
onSwipeBackEnd,
|
|
227
|
-
onSwipeBackMove,
|
|
228
|
-
onSwipeBackStart,
|
|
229
|
-
...otherProps
|
|
230
|
-
} = props;
|
|
231
|
-
const api = useAppScreen({
|
|
232
|
-
swipeBackDisplacementRatioThreshold,
|
|
233
|
-
swipeBackVelocityThreshold,
|
|
234
|
-
onSwipeBackEnd,
|
|
235
|
-
onSwipeBackMove,
|
|
236
|
-
onSwipeBackStart
|
|
237
|
-
});
|
|
238
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppScreenProvider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
239
|
-
import_react_primitive.Primitive.div,
|
|
240
|
-
{
|
|
241
|
-
ref,
|
|
242
|
-
"data-stackflow-component-name": "AppScreen",
|
|
243
|
-
...(0, import_dom_utils2.mergeProps)(api.activityProps, otherProps)
|
|
244
|
-
}
|
|
245
|
-
) });
|
|
246
|
-
});
|
|
247
|
-
AppScreenRoot.displayName = "AppScreenRoot";
|
|
248
|
-
var AppScreenDim = (0, import_react5.forwardRef)((props, ref) => {
|
|
249
|
-
const { dimProps } = useAppScreenContext();
|
|
250
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ref, ...(0, import_dom_utils2.mergeProps)(dimProps, props) });
|
|
251
|
-
});
|
|
252
|
-
AppScreenDim.displayName = "AppScreenDim";
|
|
253
|
-
var AppScreenEdge = (0, import_react5.forwardRef)((props, ref) => {
|
|
254
|
-
const { edgeProps } = useAppScreenContext();
|
|
255
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ref, ...(0, import_dom_utils2.mergeProps)(edgeProps, props) });
|
|
256
|
-
});
|
|
257
|
-
AppScreenEdge.displayName = "AppScreenEdge";
|
|
258
|
-
var AppScreenLayer = (0, import_react5.forwardRef)((props, ref) => {
|
|
259
|
-
const { layerProps } = useAppScreenContext();
|
|
260
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ref, ...(0, import_dom_utils2.mergeProps)(layerProps, props) });
|
|
261
|
-
});
|
|
262
|
-
AppScreenLayer.displayName = "AppScreenLayer";
|
|
263
|
-
|
|
264
|
-
// src/primitive/AppScreen/AppScreen.namespace.ts
|
|
265
|
-
var AppScreen_namespace_exports = {};
|
|
266
|
-
__export(AppScreen_namespace_exports, {
|
|
267
|
-
Dim: () => AppScreenDim,
|
|
268
|
-
Edge: () => AppScreenEdge,
|
|
269
|
-
Layer: () => AppScreenLayer,
|
|
270
|
-
Root: () => AppScreenRoot
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// src/primitive/AppBar/AppBar.tsx
|
|
274
|
-
var import_react_primitive2 = require("@seed-design/react-primitive");
|
|
275
|
-
var import_react8 = require("react");
|
|
276
|
-
|
|
277
|
-
// src/primitive/AppBar/useAppBar.tsx
|
|
278
|
-
var import_dom_utils3 = require("@seed-design/dom-utils");
|
|
279
|
-
var import_react6 = require("react");
|
|
280
|
-
|
|
281
|
-
// src/primitive/private/useElementOffset.ts
|
|
282
|
-
var React = __toESM(require("react"));
|
|
283
|
-
var useLayoutEffect2 = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
284
|
-
function useElementOffset(element) {
|
|
285
|
-
const [offset, setOffset] = React.useState(
|
|
286
|
-
void 0
|
|
287
|
-
);
|
|
288
|
-
useLayoutEffect2(() => {
|
|
289
|
-
var _a;
|
|
290
|
-
if (!element) {
|
|
291
|
-
setOffset(void 0);
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
if (element) {
|
|
295
|
-
setOffset({
|
|
296
|
-
fromLeft: element.offsetLeft + element.offsetWidth,
|
|
297
|
-
fromRight: ((_a = element.offsetParent) != null ? _a : document.body).clientWidth - element.offsetLeft
|
|
298
|
-
});
|
|
299
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
300
|
-
var _a2;
|
|
301
|
-
const fromLeft = element.offsetLeft + element.offsetWidth;
|
|
302
|
-
const fromRight = ((_a2 = element.offsetParent) != null ? _a2 : document.body).clientWidth - element.offsetLeft;
|
|
303
|
-
setOffset({ fromLeft, fromRight });
|
|
304
|
-
});
|
|
305
|
-
resizeObserver.observe(element);
|
|
306
|
-
return () => resizeObserver.unobserve(element);
|
|
307
|
-
}
|
|
308
|
-
}, [element]);
|
|
309
|
-
return offset;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// src/primitive/AppBar/useAppBar.tsx
|
|
313
|
-
function useAppBar(_props) {
|
|
314
|
-
var _a, _b;
|
|
315
|
-
const { stateProps } = useAppScreenContext();
|
|
316
|
-
const [root, rootRef] = (0, import_react6.useState)(null);
|
|
317
|
-
const [left, leftRef] = (0, import_react6.useState)(null);
|
|
318
|
-
const [right, rightRef] = (0, import_react6.useState)(null);
|
|
319
|
-
const leftOffset = useElementOffset(left);
|
|
320
|
-
const rightOffset = useElementOffset(right);
|
|
321
|
-
const centeredTitlePaddingX = root ? `${Math.max((_a = leftOffset == null ? void 0 : leftOffset.fromLeft) != null ? _a : 0, (_b = rightOffset == null ? void 0 : rightOffset.fromRight) != null ? _b : 0)}px` : "initial";
|
|
322
|
-
return (0, import_react6.useMemo)(
|
|
323
|
-
() => ({
|
|
324
|
-
refs: {
|
|
325
|
-
root: rootRef,
|
|
326
|
-
left: leftRef,
|
|
327
|
-
right: rightRef
|
|
328
|
-
},
|
|
329
|
-
stateProps,
|
|
330
|
-
rootProps: (0, import_dom_utils3.elementProps)({
|
|
331
|
-
"data-part": "appBar",
|
|
332
|
-
...stateProps,
|
|
333
|
-
style: {
|
|
334
|
-
"--centered-title-padding-x": centeredTitlePaddingX
|
|
335
|
-
}
|
|
336
|
-
})
|
|
337
|
-
}),
|
|
338
|
-
[stateProps, centeredTitlePaddingX]
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// src/primitive/AppBar/useAppBarContext.ts
|
|
343
|
-
var import_react7 = require("react");
|
|
344
|
-
var AppBarContext = (0, import_react7.createContext)(null);
|
|
345
|
-
var AppBarProvider = AppBarContext.Provider;
|
|
346
|
-
function useAppBarContext({
|
|
347
|
-
strict = true
|
|
348
|
-
} = {}) {
|
|
349
|
-
const context = (0, import_react7.useContext)(AppBarContext);
|
|
350
|
-
if (!context && strict) {
|
|
351
|
-
throw new Error("useAppBarContext must be used within a AppBar");
|
|
352
|
-
}
|
|
353
|
-
return context;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// src/primitive/AppBar/AppBar.tsx
|
|
357
|
-
var import_dom_utils4 = require("@seed-design/dom-utils");
|
|
358
|
-
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
359
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
360
|
-
var AppBarRoot = (0, import_react8.forwardRef)((props, ref) => {
|
|
361
|
-
const { ...otherProps } = props;
|
|
362
|
-
const api = useAppBar({});
|
|
363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppBarProvider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
364
|
-
import_react_primitive2.Primitive.div,
|
|
365
|
-
{
|
|
366
|
-
ref: (0, import_react_compose_refs.composeRefs)(api.refs.root, ref),
|
|
367
|
-
...(0, import_dom_utils4.mergeProps)(api.rootProps, otherProps)
|
|
368
|
-
}
|
|
369
|
-
) });
|
|
370
|
-
});
|
|
371
|
-
AppBarRoot.displayName = "AppBarRoot";
|
|
372
|
-
var AppBarLeft = (0, import_react8.forwardRef)((props, ref) => {
|
|
373
|
-
const { refs, stateProps } = useAppBarContext();
|
|
374
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_primitive2.Primitive.div, { ref: (0, import_react_compose_refs.composeRefs)(refs.left, ref), ...(0, import_dom_utils4.mergeProps)(stateProps, props) });
|
|
375
|
-
});
|
|
376
|
-
AppBarLeft.displayName = "AppBarLeft";
|
|
377
|
-
var AppBarRight = (0, import_react8.forwardRef)((props, ref) => {
|
|
378
|
-
const { refs, stateProps } = useAppBarContext();
|
|
379
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_primitive2.Primitive.div, { ref: (0, import_react_compose_refs.composeRefs)(refs.right, ref), ...(0, import_dom_utils4.mergeProps)(stateProps, props) });
|
|
380
|
-
});
|
|
381
|
-
AppBarRight.displayName = "AppBarRight";
|
|
382
|
-
var AppBarMain = (0, import_react8.forwardRef)((props, ref) => {
|
|
383
|
-
const { stateProps } = useAppBarContext();
|
|
384
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_primitive2.Primitive.div, { ref, ...(0, import_dom_utils4.mergeProps)(stateProps, props) });
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
// src/primitive/AppBar/AppBar.namespace.ts
|
|
388
|
-
var AppBar_namespace_exports = {};
|
|
389
|
-
__export(AppBar_namespace_exports, {
|
|
390
|
-
Left: () => AppBarLeft,
|
|
391
|
-
Main: () => AppBarMain,
|
|
392
|
-
Right: () => AppBarRight,
|
|
393
|
-
Root: () => AppBarRoot
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
// src/primitive/GlobalInteraction/GlobalInteraction.tsx
|
|
397
|
-
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
|
398
|
-
var import_dom_utils5 = require("@seed-design/dom-utils");
|
|
399
|
-
var import_react_primitive3 = require("@seed-design/react-primitive");
|
|
400
|
-
var import_react12 = require("react");
|
|
401
|
-
|
|
402
|
-
// src/primitive/GlobalInteraction/useGlobalInteraction.ts
|
|
403
|
-
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
404
|
-
var import_react11 = require("react");
|
|
405
|
-
|
|
406
|
-
// src/primitive/private/useTopActivity.ts
|
|
407
|
-
var import_react9 = require("@stackflow/react");
|
|
408
|
-
var import_react10 = require("react");
|
|
409
|
-
function useTopActivity() {
|
|
410
|
-
var _a, _b;
|
|
411
|
-
const stack = (0, import_react9.useStack)();
|
|
412
|
-
if (!stack) {
|
|
413
|
-
throw new Error(
|
|
414
|
-
"useStack is not available in the context. Make sure you are using @stackflow/react >= 1.4.1. (https://github.com/daangn/stackflow/blob/main/integrations/react/CHANGELOG.md#141)"
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
const topId = (_a = stack.activities.find((activity) => activity.isTop)) == null ? void 0 : _a.id;
|
|
418
|
-
const topActivity = stack.activities.find((activity) => activity.isTop);
|
|
419
|
-
const transitionState = (_b = topActivity == null ? void 0 : topActivity.transitionState) != null ? _b : "enter-done";
|
|
420
|
-
const [topEl, setTopEl] = (0, import_react10.useState)(null);
|
|
421
|
-
const activityType = topEl == null ? void 0 : topEl.dataset["activityType"];
|
|
422
|
-
(0, import_react10.useEffect)(() => {
|
|
423
|
-
if (!topId) return;
|
|
424
|
-
const el = document.querySelector(`[data-activity-id="${topId}"]`);
|
|
425
|
-
setTopEl(el);
|
|
426
|
-
}, [topId]);
|
|
427
|
-
return {
|
|
428
|
-
transitionState,
|
|
429
|
-
activityType
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// src/primitive/GlobalInteraction/useGlobalInteraction.ts
|
|
434
|
-
function useGlobalInteraction() {
|
|
435
|
-
const [swipeBackState, setSwipeBackState] = (0, import_react11.useState)("idle");
|
|
436
|
-
const swipeBackContextRef = (0, import_react11.useRef)({
|
|
437
|
-
x0: 0,
|
|
438
|
-
t0: 0,
|
|
439
|
-
displacement: 0,
|
|
440
|
-
displacementRatio: 0,
|
|
441
|
-
velocity: 0
|
|
442
|
-
});
|
|
443
|
-
const stackRef = (0, import_react11.useRef)(null);
|
|
444
|
-
const setSwipeBackContext = (0, import_react11.useCallback)((ctx) => {
|
|
445
|
-
var _a, _b;
|
|
446
|
-
swipeBackContextRef.current = ctx;
|
|
447
|
-
(_a = stackRef.current) == null ? void 0 : _a.style.setProperty(
|
|
448
|
-
"--swipe-back-displacement",
|
|
449
|
-
`${ctx.displacement.toString()}px`
|
|
450
|
-
);
|
|
451
|
-
(_b = stackRef.current) == null ? void 0 : _b.style.setProperty(
|
|
452
|
-
"--swipe-back-displacement-ratio",
|
|
453
|
-
ctx.displacementRatio.toString()
|
|
454
|
-
);
|
|
455
|
-
}, []);
|
|
456
|
-
const getSwipeBackEvents = (0, import_react11.useCallback)(
|
|
457
|
-
(props) => {
|
|
458
|
-
const {
|
|
459
|
-
swipeBackDisplacementRatioThreshold: displacementRatioThreshold = 0.4,
|
|
460
|
-
swipeBackVelocityThreshold: velocityThreshold = 1
|
|
461
|
-
} = props;
|
|
462
|
-
const onSwipeStart = (0, import_react_use_callback_ref.useCallbackRef)(props.onSwipeBackStart);
|
|
463
|
-
const onSwipeMove = (0, import_react_use_callback_ref.useCallbackRef)(props.onSwipeBackMove);
|
|
464
|
-
const onSwipeEnd = (0, import_react_use_callback_ref.useCallbackRef)(props.onSwipeBackEnd);
|
|
465
|
-
const startSwipeBack = (0, import_react11.useCallback)(
|
|
466
|
-
({ x0, t0 }) => {
|
|
467
|
-
setSwipeBackContext({
|
|
468
|
-
x0,
|
|
469
|
-
t0,
|
|
470
|
-
displacement: 0,
|
|
471
|
-
displacementRatio: 0,
|
|
472
|
-
velocity: 0
|
|
473
|
-
});
|
|
474
|
-
setSwipeBackState("swiping");
|
|
475
|
-
onSwipeStart == null ? void 0 : onSwipeStart();
|
|
476
|
-
},
|
|
477
|
-
[onSwipeStart]
|
|
478
|
-
);
|
|
479
|
-
const moveSwipeBack = (0, import_react11.useCallback)(
|
|
480
|
-
({ x, t }) => {
|
|
481
|
-
const displacement = x - swipeBackContextRef.current.x0;
|
|
482
|
-
const displacementRatio = displacement / window.innerWidth;
|
|
483
|
-
const velocity = displacement / (t - swipeBackContextRef.current.t0);
|
|
484
|
-
setSwipeBackContext({
|
|
485
|
-
...swipeBackContextRef.current,
|
|
486
|
-
displacement,
|
|
487
|
-
displacementRatio,
|
|
488
|
-
velocity
|
|
489
|
-
});
|
|
490
|
-
setSwipeBackState("swiping");
|
|
491
|
-
onSwipeMove == null ? void 0 : onSwipeMove({ displacement, displacementRatio });
|
|
492
|
-
},
|
|
493
|
-
[onSwipeMove]
|
|
494
|
-
);
|
|
495
|
-
const endSwipeBack = (0, import_react11.useCallback)(
|
|
496
|
-
(_) => {
|
|
497
|
-
const swiped = swipeBackContextRef.current.displacementRatio > displacementRatioThreshold || swipeBackContextRef.current.velocity > velocityThreshold;
|
|
498
|
-
setSwipeBackState("transitioning");
|
|
499
|
-
onSwipeEnd == null ? void 0 : onSwipeEnd({ swiped });
|
|
500
|
-
},
|
|
501
|
-
[onSwipeEnd, displacementRatioThreshold, velocityThreshold]
|
|
502
|
-
);
|
|
503
|
-
const reset = (0, import_react11.useCallback)(() => {
|
|
504
|
-
setSwipeBackContext({
|
|
505
|
-
x0: 0,
|
|
506
|
-
t0: 0,
|
|
507
|
-
displacement: 0,
|
|
508
|
-
displacementRatio: 0,
|
|
509
|
-
velocity: 0
|
|
510
|
-
});
|
|
511
|
-
setSwipeBackState("idle");
|
|
512
|
-
}, []);
|
|
513
|
-
return (0, import_react11.useMemo)(
|
|
514
|
-
() => ({
|
|
515
|
-
startSwipeBack,
|
|
516
|
-
moveSwipeBack,
|
|
517
|
-
endSwipeBack,
|
|
518
|
-
reset
|
|
519
|
-
}),
|
|
520
|
-
[startSwipeBack, moveSwipeBack, endSwipeBack, reset]
|
|
521
|
-
);
|
|
522
|
-
},
|
|
523
|
-
[setSwipeBackContext]
|
|
524
|
-
);
|
|
525
|
-
const topActivity = useTopActivity();
|
|
526
|
-
const stackProps = (0, import_react11.useMemo)(
|
|
527
|
-
() => ({
|
|
528
|
-
"data-swipe-back-state": swipeBackState,
|
|
529
|
-
"data-global-transition-state": topActivity.transitionState,
|
|
530
|
-
"data-top-activity-type": topActivity.activityType
|
|
531
|
-
}),
|
|
532
|
-
[swipeBackState, topActivity.transitionState, topActivity.activityType]
|
|
533
|
-
);
|
|
534
|
-
return (0, import_react11.useMemo)(
|
|
535
|
-
() => ({
|
|
536
|
-
stackRef,
|
|
537
|
-
swipeBackContextRef,
|
|
538
|
-
swipeBackState,
|
|
539
|
-
setSwipeBackState,
|
|
540
|
-
setSwipeBackContext,
|
|
541
|
-
getSwipeBackEvents,
|
|
542
|
-
stackProps
|
|
543
|
-
}),
|
|
544
|
-
[swipeBackState, setSwipeBackContext, getSwipeBackEvents, stackProps]
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// src/primitive/GlobalInteraction/GlobalInteraction.tsx
|
|
549
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
550
|
-
var GlobalInteraction = (0, import_react12.forwardRef)(
|
|
551
|
-
(props, ref) => {
|
|
552
|
-
const api = useGlobalInteraction();
|
|
553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlobalInteractionProvider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
554
|
-
import_react_primitive3.Primitive.div,
|
|
555
|
-
{
|
|
556
|
-
ref: (0, import_react_compose_refs2.composeRefs)(api.stackRef, ref),
|
|
557
|
-
...(0, import_dom_utils5.mergeProps)(api.stackProps, props)
|
|
558
|
-
}
|
|
559
|
-
) });
|
|
560
|
-
}
|
|
561
|
-
);
|
|
562
|
-
GlobalInteraction.displayName = "GlobalInteraction";
|
|
563
|
-
|
|
564
|
-
// src/utils/createStyleContext.tsx
|
|
565
|
-
var import_clsx = __toESM(require("clsx"));
|
|
566
|
-
var import_react13 = require("react");
|
|
567
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
568
|
-
function createStyleContext(recipe) {
|
|
569
|
-
const ClassNamesContext = (0, import_react13.createContext)(null);
|
|
570
|
-
const PropsContext = (0, import_react13.createContext)(null);
|
|
571
|
-
const ClassNamesProvider3 = ({
|
|
572
|
-
children,
|
|
573
|
-
value
|
|
574
|
-
}) => {
|
|
575
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClassNamesContext.Provider, { value, children });
|
|
576
|
-
};
|
|
577
|
-
const PropsProvider3 = ({ children, value }) => {
|
|
578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PropsContext.Provider, { value, children });
|
|
579
|
-
};
|
|
580
|
-
function useClassNames2() {
|
|
581
|
-
const context = (0, import_react13.useContext)(ClassNamesContext);
|
|
582
|
-
if (context === null) {
|
|
583
|
-
throw new Error(
|
|
584
|
-
"useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?"
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
return context;
|
|
588
|
-
}
|
|
589
|
-
function useProps3() {
|
|
590
|
-
return (0, import_react13.useContext)(PropsContext);
|
|
591
|
-
}
|
|
592
|
-
const withRootProvider = (Component, options) => {
|
|
593
|
-
const { defaultProps } = options != null ? options : {};
|
|
594
|
-
const StyledComponent = (innerProps) => {
|
|
595
|
-
const props = { ...defaultProps != null ? defaultProps : {}, ...useProps3(), ...innerProps };
|
|
596
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
597
|
-
const classNames = recipe(variantProps);
|
|
598
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClassNamesProvider3, { value: classNames, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...otherProps }) });
|
|
599
|
-
};
|
|
600
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
601
|
-
return StyledComponent;
|
|
602
|
-
};
|
|
603
|
-
const withProvider = (Component, slot, options) => {
|
|
604
|
-
const { defaultProps } = options != null ? options : {};
|
|
605
|
-
const StyledComponent = (0, import_react13.forwardRef)((innerProps, ref) => {
|
|
606
|
-
const props = { ...defaultProps != null ? defaultProps : {}, ...useProps3(), ...innerProps };
|
|
607
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
608
|
-
const classNames = recipe(variantProps);
|
|
609
|
-
const className = classNames[slot];
|
|
610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClassNamesProvider3, { value: classNames, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ref, ...otherProps, className: (0, import_clsx.default)(className, props.className) }) });
|
|
611
|
-
});
|
|
612
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
613
|
-
return StyledComponent;
|
|
614
|
-
};
|
|
615
|
-
const withContext3 = (Component, slot) => {
|
|
616
|
-
const StyledComponent = (0, import_react13.forwardRef)((props, ref) => {
|
|
617
|
-
const classNames = useClassNames2();
|
|
618
|
-
const className = classNames == null ? void 0 : classNames[slot];
|
|
619
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ref, ...props, className: (0, import_clsx.default)(className, props.className) });
|
|
620
|
-
});
|
|
621
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
622
|
-
return StyledComponent;
|
|
623
|
-
};
|
|
624
|
-
return {
|
|
625
|
-
ClassNamesProvider: ClassNamesProvider3,
|
|
626
|
-
PropsProvider: PropsProvider3,
|
|
627
|
-
useClassNames: useClassNames2,
|
|
628
|
-
useProps: useProps3,
|
|
629
|
-
withRootProvider,
|
|
630
|
-
withProvider,
|
|
631
|
-
withContext: withContext3
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// src/components/AppBar/AppBar.tsx
|
|
636
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
637
|
-
var import_dom_utils6 = require("@seed-design/dom-utils");
|
|
638
|
-
var import_react_primitive4 = require("@seed-design/react-primitive");
|
|
639
|
-
var import_app_bar = require("@seed-design/css/recipes/app-bar");
|
|
640
|
-
var import_clsx2 = __toESM(require("clsx"));
|
|
641
|
-
var import_react14 = require("react");
|
|
642
|
-
var import_app_bar_main = require("@seed-design/css/recipes/app-bar-main");
|
|
643
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
644
|
-
var { PropsProvider, ClassNamesProvider, useProps, withContext, useClassNames } = createStyleContext(import_app_bar.appBar);
|
|
645
|
-
var {
|
|
646
|
-
PropsProvider: MainPropsProvider,
|
|
647
|
-
withProvider: withMainProvider,
|
|
648
|
-
withContext: withMainContext
|
|
649
|
-
} = createStyleContext(import_app_bar_main.appBarMain);
|
|
650
|
-
var AppBarPropsProvider = PropsProvider;
|
|
651
|
-
var AppBarRoot2 = (0, import_react14.forwardRef)((props, ref) => {
|
|
652
|
-
const contextProps = useProps();
|
|
653
|
-
const [variantProps, otherProps] = import_app_bar.appBar.splitVariantProps({ ...contextProps, ...props });
|
|
654
|
-
const classNames = (0, import_app_bar.appBar)(variantProps);
|
|
655
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
656
|
-
MainPropsProvider,
|
|
657
|
-
{
|
|
658
|
-
value: {
|
|
659
|
-
theme: variantProps.theme,
|
|
660
|
-
transitionStyle: variantProps.transitionStyle,
|
|
661
|
-
tone: variantProps.tone
|
|
662
|
-
},
|
|
663
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
664
|
-
AppBar_namespace_exports.Root,
|
|
665
|
-
{
|
|
666
|
-
ref,
|
|
667
|
-
...(0, import_dom_utils6.mergeProps)({ className: classNames.root }, otherProps)
|
|
668
|
-
}
|
|
669
|
-
)
|
|
670
|
-
}
|
|
671
|
-
) });
|
|
672
|
-
});
|
|
673
|
-
AppBarRoot2.displayName = "AppBarRoot";
|
|
674
|
-
var AppBarLeft2 = withContext(
|
|
675
|
-
AppBar_namespace_exports.Left,
|
|
676
|
-
"left"
|
|
677
|
-
);
|
|
678
|
-
var AppBarRight2 = withContext(
|
|
679
|
-
AppBar_namespace_exports.Right,
|
|
680
|
-
"right"
|
|
681
|
-
);
|
|
682
|
-
var AppBarMain2 = withMainProvider(
|
|
683
|
-
AppBar_namespace_exports.Main,
|
|
684
|
-
"root"
|
|
685
|
-
);
|
|
686
|
-
var AppBarTitle = withMainContext(
|
|
687
|
-
import_react_primitive4.Primitive.span,
|
|
688
|
-
"title"
|
|
689
|
-
);
|
|
690
|
-
var AppBarSubtitle = withMainContext(
|
|
691
|
-
import_react_primitive4.Primitive.span,
|
|
692
|
-
"subtitle"
|
|
693
|
-
);
|
|
694
|
-
var AppBarIconButton = (0, import_react14.forwardRef)(
|
|
695
|
-
({ children, className, ...otherProps }, ref) => {
|
|
696
|
-
const { stateProps } = useAppBarContext();
|
|
697
|
-
const classNames = useClassNames();
|
|
698
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
699
|
-
import_react_primitive4.Primitive.button,
|
|
700
|
-
{
|
|
701
|
-
ref,
|
|
702
|
-
type: "button",
|
|
703
|
-
className: (0, import_clsx2.default)(classNames.iconButton, className),
|
|
704
|
-
...(0, import_dom_utils6.mergeProps)(stateProps, otherProps),
|
|
705
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_slot.Slot, { className: classNames.icon, ...stateProps, children })
|
|
706
|
-
}
|
|
707
|
-
);
|
|
708
|
-
}
|
|
709
|
-
);
|
|
710
|
-
AppBarIconButton.displayName = "IconButton";
|
|
711
|
-
|
|
712
|
-
// src/components/AppScreen/AppScreen.tsx
|
|
713
|
-
var import_dom_utils7 = require("@seed-design/dom-utils");
|
|
714
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
715
|
-
var { ClassNamesProvider: ClassNamesProvider2, PropsProvider: PropsProvider2, withContext: withContext2, useProps: useProps2 } = createStyleContext(import_app_screen.appScreen);
|
|
716
|
-
var AppScreenPropsProvider = PropsProvider2;
|
|
717
|
-
var AppScreenRoot2 = (0, import_react15.forwardRef)((props, ref) => {
|
|
718
|
-
var _a;
|
|
719
|
-
const contextProps = useProps2();
|
|
720
|
-
const [variantProps, otherProps] = import_app_screen.appScreen.splitVariantProps({ ...contextProps, ...props });
|
|
721
|
-
const transitionStyle = (_a = variantProps.transitionStyle) != null ? _a : variantProps.theme === "cupertino" ? "slideFromRightIOS" : "fadeFromBottomAndroid";
|
|
722
|
-
const classNames = (0, import_app_screen.appScreen)({
|
|
723
|
-
...variantProps,
|
|
724
|
-
transitionStyle
|
|
725
|
-
});
|
|
726
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ClassNamesProvider2, { value: classNames, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
727
|
-
AppBarPropsProvider,
|
|
728
|
-
{
|
|
729
|
-
value: (0, import_react15.useMemo)(
|
|
730
|
-
() => ({ theme: variantProps.theme, transitionStyle }),
|
|
731
|
-
[variantProps.theme, transitionStyle]
|
|
732
|
-
),
|
|
733
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
734
|
-
AppScreen_namespace_exports.Root,
|
|
735
|
-
{
|
|
736
|
-
ref,
|
|
737
|
-
...(0, import_dom_utils7.mergeProps)({ className: classNames.root }, otherProps)
|
|
738
|
-
}
|
|
739
|
-
)
|
|
740
|
-
}
|
|
741
|
-
) });
|
|
742
|
-
});
|
|
743
|
-
AppScreenRoot2.displayName = "AppScreenRoot";
|
|
744
|
-
var AppScreenDim2 = withContext2(
|
|
745
|
-
AppScreen_namespace_exports.Dim,
|
|
746
|
-
"dim"
|
|
747
|
-
);
|
|
748
|
-
var AppScreenEdge2 = withContext2(
|
|
749
|
-
AppScreen_namespace_exports.Edge,
|
|
750
|
-
"edge"
|
|
751
|
-
);
|
|
752
|
-
var AppScreenLayer2 = withContext2(
|
|
753
|
-
AppScreen_namespace_exports.Layer,
|
|
754
|
-
"layer"
|
|
755
|
-
);
|
|
756
|
-
|
|
757
|
-
// src/plugin.tsx
|
|
758
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
759
|
-
var seedPlugin = (options) => () => ({
|
|
760
|
-
key: "seed-design",
|
|
761
|
-
wrapStack({ stack }) {
|
|
762
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AppScreenPropsProvider, { value: options, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GlobalInteraction, { children: stack.render() }) });
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
|
|
766
|
-
// src/components/AppBar/AppBar.namespace.ts
|
|
767
|
-
var AppBar_namespace_exports2 = {};
|
|
768
|
-
__export(AppBar_namespace_exports2, {
|
|
769
|
-
IconButton: () => AppBarIconButton,
|
|
770
|
-
Left: () => AppBarLeft2,
|
|
771
|
-
Main: () => AppBarMain2,
|
|
772
|
-
Right: () => AppBarRight2,
|
|
773
|
-
Root: () => AppBarRoot2,
|
|
774
|
-
Subtitle: () => AppBarSubtitle,
|
|
775
|
-
Title: () => AppBarTitle
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
// src/components/AppScreen/AppScreen.namespace.ts
|
|
779
|
-
var AppScreen_namespace_exports2 = {};
|
|
780
|
-
__export(AppScreen_namespace_exports2, {
|
|
781
|
-
Dim: () => AppScreenDim2,
|
|
782
|
-
Edge: () => AppScreenEdge2,
|
|
783
|
-
Layer: () => AppScreenLayer2,
|
|
784
|
-
Root: () => AppScreenRoot2
|
|
785
|
-
});
|
|
786
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { seedPlugin } from './plugin.js';
|
|
2
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSubtitle, AppBarTitle } from './components/AppBar/AppBar.js';
|
|
3
|
+
import * as AppBar_namespace from './components/AppBar/AppBar.namespace.js';
|
|
4
|
+
export { AppBar_namespace as AppBar };
|
|
5
|
+
export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenPropsProvider, AppScreenRoot } from './components/AppScreen/AppScreen.js';
|
|
6
|
+
import * as AppScreen_namespace from './components/AppScreen/AppScreen.namespace.js';
|
|
7
|
+
export { AppScreen_namespace as AppScreen };
|
|
8
|
+
import * as index from './primitive/index.js';
|
|
9
|
+
export { index as Primitive };
|