@storybook/react-native 7.6.12 → 8.0.0-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/index.d-b039fbf0.d.ts +1358 -0
- package/dist/index.d.ts +64 -8
- package/dist/index.js +26 -22
- package/dist/preview.d.ts +1 -2
- package/package.json +12 -14
- package/readme.md +5 -0
- package/V6.js +0 -1
- package/dist/V6.d.ts +0 -37
- package/dist/V6.js +0 -2379
- package/dist/View-bd441663.d.ts +0 -66
- package/dist/index.d-da6c1de4.d.ts +0 -3270
package/dist/V6.js
DELETED
|
@@ -1,2379 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
-
mod
|
|
29
|
-
));
|
|
30
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
-
|
|
32
|
-
// ../../node_modules/@storybook/types/dist/index.js
|
|
33
|
-
var require_dist = __commonJS({
|
|
34
|
-
"../../node_modules/@storybook/types/dist/index.js"(exports, module2) {
|
|
35
|
-
"use strict";
|
|
36
|
-
var __defProp2 = Object.defineProperty;
|
|
37
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
38
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
39
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
40
|
-
var __export2 = (target, all) => {
|
|
41
|
-
for (var name in all)
|
|
42
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
43
|
-
};
|
|
44
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
45
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
46
|
-
for (let key of __getOwnPropNames2(from))
|
|
47
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
48
|
-
return to;
|
|
49
|
-
};
|
|
50
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
51
|
-
var src_exports = {};
|
|
52
|
-
__export2(src_exports, { Addon_TypesEnum: () => Addon_TypesEnum2 });
|
|
53
|
-
module2.exports = __toCommonJS2(src_exports);
|
|
54
|
-
var Addon_TypesEnum2 = ((Addon_TypesEnum22) => (Addon_TypesEnum22.TAB = "tab", Addon_TypesEnum22.PANEL = "panel", Addon_TypesEnum22.TOOL = "tool", Addon_TypesEnum22.TOOLEXTRA = "toolextra", Addon_TypesEnum22.PREVIEW = "preview", Addon_TypesEnum22.experimental_PAGE = "page", Addon_TypesEnum22.experimental_SIDEBAR_BOTTOM = "sidebar-bottom", Addon_TypesEnum22.experimental_SIDEBAR_TOP = "sidebar-top", Addon_TypesEnum22.NOTES_ELEMENT = "notes-element", Addon_TypesEnum22))(Addon_TypesEnum2 || {});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// src/V6.ts
|
|
59
|
-
var V6_exports = {};
|
|
60
|
-
__export(V6_exports, {
|
|
61
|
-
addArgTypesEnhancer: () => addArgTypesEnhancer,
|
|
62
|
-
addArgsEnhancer: () => addArgsEnhancer,
|
|
63
|
-
addDecorator: () => addDecorator,
|
|
64
|
-
addParameters: () => addParameters,
|
|
65
|
-
configure: () => configure,
|
|
66
|
-
darkTheme: () => import_react_native_theming13.darkTheme,
|
|
67
|
-
getStorybookUI: () => getStorybookUI,
|
|
68
|
-
raw: () => raw,
|
|
69
|
-
storiesOf: () => storiesOf,
|
|
70
|
-
theme: () => import_react_native_theming13.theme
|
|
71
|
-
});
|
|
72
|
-
module.exports = __toCommonJS(V6_exports);
|
|
73
|
-
|
|
74
|
-
// src/StartV6.tsx
|
|
75
|
-
var import_channels2 = require("@storybook/channels");
|
|
76
|
-
var import_core_events3 = __toESM(require("@storybook/core-events"));
|
|
77
|
-
var import_global = require("@storybook/global");
|
|
78
|
-
var import_manager_api3 = require("@storybook/manager-api");
|
|
79
|
-
var import_preview_api3 = require("@storybook/preview-api");
|
|
80
|
-
var import_preview_web = require("@storybook/preview-web");
|
|
81
|
-
|
|
82
|
-
// src/View.tsx
|
|
83
|
-
var import_csf = require("@storybook/csf");
|
|
84
|
-
var import_manager_api2 = require("@storybook/manager-api");
|
|
85
|
-
var import_preview_api2 = require("@storybook/preview-api");
|
|
86
|
-
var import_react_native_theming12 = require("@storybook/react-native-theming");
|
|
87
|
-
var import_react16 = require("react");
|
|
88
|
-
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
89
|
-
|
|
90
|
-
// src/components/OnDeviceUI/OnDeviceUI.tsx
|
|
91
|
-
var import_react_native_theming10 = require("@storybook/react-native-theming");
|
|
92
|
-
var import_react15 = __toESM(require("react"));
|
|
93
|
-
var import_react_native14 = require("react-native");
|
|
94
|
-
|
|
95
|
-
// src/constants.ts
|
|
96
|
-
var ANIMATION_DURATION_TRANSITION = 400;
|
|
97
|
-
|
|
98
|
-
// src/hooks.tsx
|
|
99
|
-
var import_react2 = __toESM(require("react"));
|
|
100
|
-
|
|
101
|
-
// ../../node_modules/jotai/esm/vanilla.mjs
|
|
102
|
-
var import_meta = {};
|
|
103
|
-
var keyCount = 0;
|
|
104
|
-
function atom(read, write) {
|
|
105
|
-
const key = `atom${++keyCount}`;
|
|
106
|
-
const config = {
|
|
107
|
-
toString: () => key
|
|
108
|
-
};
|
|
109
|
-
if (typeof read === "function") {
|
|
110
|
-
config.read = read;
|
|
111
|
-
} else {
|
|
112
|
-
config.init = read;
|
|
113
|
-
config.read = function(get) {
|
|
114
|
-
return get(this);
|
|
115
|
-
};
|
|
116
|
-
config.write = function(get, set, arg) {
|
|
117
|
-
return set(
|
|
118
|
-
this,
|
|
119
|
-
typeof arg === "function" ? arg(get(this)) : arg
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
if (write) {
|
|
124
|
-
config.write = write;
|
|
125
|
-
}
|
|
126
|
-
return config;
|
|
127
|
-
}
|
|
128
|
-
var hasInitialValue = (atom2) => "init" in atom2;
|
|
129
|
-
var isActuallyWritableAtom = (atom2) => !!atom2.write;
|
|
130
|
-
var cancelPromiseMap = /* @__PURE__ */ new WeakMap();
|
|
131
|
-
var registerCancelPromise = (promise, cancel) => {
|
|
132
|
-
cancelPromiseMap.set(promise, cancel);
|
|
133
|
-
promise.catch(() => {
|
|
134
|
-
}).finally(() => cancelPromiseMap.delete(promise));
|
|
135
|
-
};
|
|
136
|
-
var cancelPromise = (promise, next) => {
|
|
137
|
-
const cancel = cancelPromiseMap.get(promise);
|
|
138
|
-
if (cancel) {
|
|
139
|
-
cancelPromiseMap.delete(promise);
|
|
140
|
-
cancel(next);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
var resolvePromise = (promise, value) => {
|
|
144
|
-
promise.status = "fulfilled";
|
|
145
|
-
promise.value = value;
|
|
146
|
-
};
|
|
147
|
-
var rejectPromise = (promise, e) => {
|
|
148
|
-
promise.status = "rejected";
|
|
149
|
-
promise.reason = e;
|
|
150
|
-
};
|
|
151
|
-
var isPromiseLike = (x) => typeof (x == null ? void 0 : x.then) === "function";
|
|
152
|
-
var isEqualAtomValue = (a, b) => !!a && "v" in a && "v" in b && Object.is(a.v, b.v);
|
|
153
|
-
var isEqualAtomError = (a, b) => !!a && "e" in a && "e" in b && Object.is(a.e, b.e);
|
|
154
|
-
var hasPromiseAtomValue = (a) => !!a && "v" in a && a.v instanceof Promise;
|
|
155
|
-
var isEqualPromiseAtomValue = (a, b) => "v" in a && "v" in b && a.v.orig && a.v.orig === b.v.orig;
|
|
156
|
-
var returnAtomValue = (atomState) => {
|
|
157
|
-
if ("e" in atomState) {
|
|
158
|
-
throw atomState.e;
|
|
159
|
-
}
|
|
160
|
-
return atomState.v;
|
|
161
|
-
};
|
|
162
|
-
var createStore = () => {
|
|
163
|
-
const atomStateMap = /* @__PURE__ */ new WeakMap();
|
|
164
|
-
const mountedMap = /* @__PURE__ */ new WeakMap();
|
|
165
|
-
const pendingMap = /* @__PURE__ */ new Map();
|
|
166
|
-
let storeListenersRev2;
|
|
167
|
-
let mountedAtoms;
|
|
168
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
169
|
-
storeListenersRev2 = /* @__PURE__ */ new Set();
|
|
170
|
-
mountedAtoms = /* @__PURE__ */ new Set();
|
|
171
|
-
}
|
|
172
|
-
const getAtomState = (atom2) => atomStateMap.get(atom2);
|
|
173
|
-
const setAtomState = (atom2, atomState) => {
|
|
174
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
175
|
-
Object.freeze(atomState);
|
|
176
|
-
}
|
|
177
|
-
const prevAtomState = atomStateMap.get(atom2);
|
|
178
|
-
atomStateMap.set(atom2, atomState);
|
|
179
|
-
if (!pendingMap.has(atom2)) {
|
|
180
|
-
pendingMap.set(atom2, prevAtomState);
|
|
181
|
-
}
|
|
182
|
-
if (hasPromiseAtomValue(prevAtomState)) {
|
|
183
|
-
const next = "v" in atomState ? atomState.v instanceof Promise ? atomState.v : Promise.resolve(atomState.v) : Promise.reject(atomState.e);
|
|
184
|
-
if (prevAtomState.v !== next) {
|
|
185
|
-
cancelPromise(prevAtomState.v, next);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const updateDependencies = (atom2, nextAtomState, nextDependencies) => {
|
|
190
|
-
const dependencies = /* @__PURE__ */ new Map();
|
|
191
|
-
let changed = false;
|
|
192
|
-
nextDependencies.forEach((aState, a) => {
|
|
193
|
-
if (!aState && a === atom2) {
|
|
194
|
-
aState = nextAtomState;
|
|
195
|
-
}
|
|
196
|
-
if (aState) {
|
|
197
|
-
dependencies.set(a, aState);
|
|
198
|
-
if (nextAtomState.d.get(a) !== aState) {
|
|
199
|
-
changed = true;
|
|
200
|
-
}
|
|
201
|
-
} else if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
202
|
-
console.warn("[Bug] atom state not found");
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
if (changed || nextAtomState.d.size !== dependencies.size) {
|
|
206
|
-
nextAtomState.d = dependencies;
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
const setAtomValue = (atom2, value, nextDependencies) => {
|
|
210
|
-
const prevAtomState = getAtomState(atom2);
|
|
211
|
-
const nextAtomState = {
|
|
212
|
-
d: (prevAtomState == null ? void 0 : prevAtomState.d) || /* @__PURE__ */ new Map(),
|
|
213
|
-
v: value
|
|
214
|
-
};
|
|
215
|
-
if (nextDependencies) {
|
|
216
|
-
updateDependencies(atom2, nextAtomState, nextDependencies);
|
|
217
|
-
}
|
|
218
|
-
if (isEqualAtomValue(prevAtomState, nextAtomState) && prevAtomState.d === nextAtomState.d) {
|
|
219
|
-
return prevAtomState;
|
|
220
|
-
}
|
|
221
|
-
if (hasPromiseAtomValue(prevAtomState) && hasPromiseAtomValue(nextAtomState) && isEqualPromiseAtomValue(prevAtomState, nextAtomState)) {
|
|
222
|
-
if (prevAtomState.d === nextAtomState.d) {
|
|
223
|
-
return prevAtomState;
|
|
224
|
-
} else {
|
|
225
|
-
nextAtomState.v = prevAtomState.v;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
setAtomState(atom2, nextAtomState);
|
|
229
|
-
return nextAtomState;
|
|
230
|
-
};
|
|
231
|
-
const setAtomValueOrPromise = (atom2, valueOrPromise, nextDependencies, abortPromise) => {
|
|
232
|
-
if (isPromiseLike(valueOrPromise)) {
|
|
233
|
-
let continuePromise;
|
|
234
|
-
const updatePromiseDependencies = () => {
|
|
235
|
-
const prevAtomState = getAtomState(atom2);
|
|
236
|
-
if (!hasPromiseAtomValue(prevAtomState) || prevAtomState.v !== promise) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const nextAtomState = setAtomValue(
|
|
240
|
-
atom2,
|
|
241
|
-
promise,
|
|
242
|
-
nextDependencies
|
|
243
|
-
);
|
|
244
|
-
if (mountedMap.has(atom2) && prevAtomState.d !== nextAtomState.d) {
|
|
245
|
-
mountDependencies(atom2, nextAtomState, prevAtomState.d);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
const promise = new Promise((resolve, reject) => {
|
|
249
|
-
let settled = false;
|
|
250
|
-
valueOrPromise.then(
|
|
251
|
-
(v) => {
|
|
252
|
-
if (!settled) {
|
|
253
|
-
settled = true;
|
|
254
|
-
resolvePromise(promise, v);
|
|
255
|
-
resolve(v);
|
|
256
|
-
updatePromiseDependencies();
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
(e) => {
|
|
260
|
-
if (!settled) {
|
|
261
|
-
settled = true;
|
|
262
|
-
rejectPromise(promise, e);
|
|
263
|
-
reject(e);
|
|
264
|
-
updatePromiseDependencies();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
);
|
|
268
|
-
continuePromise = (next) => {
|
|
269
|
-
if (!settled) {
|
|
270
|
-
settled = true;
|
|
271
|
-
next.then(
|
|
272
|
-
(v) => resolvePromise(promise, v),
|
|
273
|
-
(e) => rejectPromise(promise, e)
|
|
274
|
-
);
|
|
275
|
-
resolve(next);
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
});
|
|
279
|
-
promise.orig = valueOrPromise;
|
|
280
|
-
promise.status = "pending";
|
|
281
|
-
registerCancelPromise(promise, (next) => {
|
|
282
|
-
if (next) {
|
|
283
|
-
continuePromise(next);
|
|
284
|
-
}
|
|
285
|
-
abortPromise == null ? void 0 : abortPromise();
|
|
286
|
-
});
|
|
287
|
-
return setAtomValue(atom2, promise, nextDependencies);
|
|
288
|
-
}
|
|
289
|
-
return setAtomValue(atom2, valueOrPromise, nextDependencies);
|
|
290
|
-
};
|
|
291
|
-
const setAtomError = (atom2, error, nextDependencies) => {
|
|
292
|
-
const prevAtomState = getAtomState(atom2);
|
|
293
|
-
const nextAtomState = {
|
|
294
|
-
d: (prevAtomState == null ? void 0 : prevAtomState.d) || /* @__PURE__ */ new Map(),
|
|
295
|
-
e: error
|
|
296
|
-
};
|
|
297
|
-
if (nextDependencies) {
|
|
298
|
-
updateDependencies(atom2, nextAtomState, nextDependencies);
|
|
299
|
-
}
|
|
300
|
-
if (isEqualAtomError(prevAtomState, nextAtomState) && prevAtomState.d === nextAtomState.d) {
|
|
301
|
-
return prevAtomState;
|
|
302
|
-
}
|
|
303
|
-
setAtomState(atom2, nextAtomState);
|
|
304
|
-
return nextAtomState;
|
|
305
|
-
};
|
|
306
|
-
const readAtomState = (atom2, force) => {
|
|
307
|
-
const atomState = getAtomState(atom2);
|
|
308
|
-
if (!force && atomState) {
|
|
309
|
-
if (mountedMap.has(atom2)) {
|
|
310
|
-
return atomState;
|
|
311
|
-
}
|
|
312
|
-
if (Array.from(atomState.d).every(([a, s]) => {
|
|
313
|
-
if (a === atom2) {
|
|
314
|
-
return true;
|
|
315
|
-
}
|
|
316
|
-
const aState = readAtomState(a);
|
|
317
|
-
return aState === s || isEqualAtomValue(aState, s);
|
|
318
|
-
})) {
|
|
319
|
-
return atomState;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
const nextDependencies = /* @__PURE__ */ new Map();
|
|
323
|
-
let isSync = true;
|
|
324
|
-
const getter = (a) => {
|
|
325
|
-
if (a === atom2) {
|
|
326
|
-
const aState2 = getAtomState(a);
|
|
327
|
-
if (aState2) {
|
|
328
|
-
nextDependencies.set(a, aState2);
|
|
329
|
-
return returnAtomValue(aState2);
|
|
330
|
-
}
|
|
331
|
-
if (hasInitialValue(a)) {
|
|
332
|
-
nextDependencies.set(a, void 0);
|
|
333
|
-
return a.init;
|
|
334
|
-
}
|
|
335
|
-
throw new Error("no atom init");
|
|
336
|
-
}
|
|
337
|
-
const aState = readAtomState(a);
|
|
338
|
-
nextDependencies.set(a, aState);
|
|
339
|
-
return returnAtomValue(aState);
|
|
340
|
-
};
|
|
341
|
-
let controller;
|
|
342
|
-
let setSelf;
|
|
343
|
-
const options = {
|
|
344
|
-
get signal() {
|
|
345
|
-
if (!controller) {
|
|
346
|
-
controller = new AbortController();
|
|
347
|
-
}
|
|
348
|
-
return controller.signal;
|
|
349
|
-
},
|
|
350
|
-
get setSelf() {
|
|
351
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && !isActuallyWritableAtom(atom2)) {
|
|
352
|
-
console.warn("setSelf function cannot be used with read-only atom");
|
|
353
|
-
}
|
|
354
|
-
if (!setSelf && isActuallyWritableAtom(atom2)) {
|
|
355
|
-
setSelf = (...args) => {
|
|
356
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && isSync) {
|
|
357
|
-
console.warn("setSelf function cannot be called in sync");
|
|
358
|
-
}
|
|
359
|
-
if (!isSync) {
|
|
360
|
-
return writeAtom(atom2, ...args);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
return setSelf;
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
try {
|
|
368
|
-
const valueOrPromise = atom2.read(getter, options);
|
|
369
|
-
return setAtomValueOrPromise(
|
|
370
|
-
atom2,
|
|
371
|
-
valueOrPromise,
|
|
372
|
-
nextDependencies,
|
|
373
|
-
() => controller == null ? void 0 : controller.abort()
|
|
374
|
-
);
|
|
375
|
-
} catch (error) {
|
|
376
|
-
return setAtomError(atom2, error, nextDependencies);
|
|
377
|
-
} finally {
|
|
378
|
-
isSync = false;
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
const readAtom = (atom2) => returnAtomValue(readAtomState(atom2));
|
|
382
|
-
const addAtom = (atom2) => {
|
|
383
|
-
let mounted = mountedMap.get(atom2);
|
|
384
|
-
if (!mounted) {
|
|
385
|
-
mounted = mountAtom(atom2);
|
|
386
|
-
}
|
|
387
|
-
return mounted;
|
|
388
|
-
};
|
|
389
|
-
const canUnmountAtom = (atom2, mounted) => !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom2));
|
|
390
|
-
const delAtom = (atom2) => {
|
|
391
|
-
const mounted = mountedMap.get(atom2);
|
|
392
|
-
if (mounted && canUnmountAtom(atom2, mounted)) {
|
|
393
|
-
unmountAtom(atom2);
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
const recomputeDependents = (atom2) => {
|
|
397
|
-
const dependencyMap = /* @__PURE__ */ new Map();
|
|
398
|
-
const dirtyMap = /* @__PURE__ */ new WeakMap();
|
|
399
|
-
const getDependents = (a) => {
|
|
400
|
-
var _a;
|
|
401
|
-
const dependents = new Set((_a = mountedMap.get(a)) == null ? void 0 : _a.t);
|
|
402
|
-
pendingMap.forEach((_, pendingAtom) => {
|
|
403
|
-
var _a2;
|
|
404
|
-
if ((_a2 = getAtomState(pendingAtom)) == null ? void 0 : _a2.d.has(a)) {
|
|
405
|
-
dependents.add(pendingAtom);
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
return dependents;
|
|
409
|
-
};
|
|
410
|
-
const loop1 = (a) => {
|
|
411
|
-
getDependents(a).forEach((dependent) => {
|
|
412
|
-
if (dependent !== a) {
|
|
413
|
-
dependencyMap.set(
|
|
414
|
-
dependent,
|
|
415
|
-
(dependencyMap.get(dependent) || /* @__PURE__ */ new Set()).add(a)
|
|
416
|
-
);
|
|
417
|
-
dirtyMap.set(dependent, (dirtyMap.get(dependent) || 0) + 1);
|
|
418
|
-
loop1(dependent);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
};
|
|
422
|
-
loop1(atom2);
|
|
423
|
-
const loop2 = (a) => {
|
|
424
|
-
getDependents(a).forEach((dependent) => {
|
|
425
|
-
var _a;
|
|
426
|
-
if (dependent !== a) {
|
|
427
|
-
let dirtyCount = dirtyMap.get(dependent);
|
|
428
|
-
if (dirtyCount) {
|
|
429
|
-
dirtyMap.set(dependent, --dirtyCount);
|
|
430
|
-
}
|
|
431
|
-
if (!dirtyCount) {
|
|
432
|
-
let isChanged = !!((_a = dependencyMap.get(dependent)) == null ? void 0 : _a.size);
|
|
433
|
-
if (isChanged) {
|
|
434
|
-
const prevAtomState = getAtomState(dependent);
|
|
435
|
-
const nextAtomState = readAtomState(dependent, true);
|
|
436
|
-
isChanged = !isEqualAtomValue(prevAtomState, nextAtomState);
|
|
437
|
-
}
|
|
438
|
-
if (!isChanged) {
|
|
439
|
-
dependencyMap.forEach((s) => s.delete(dependent));
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
loop2(dependent);
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
};
|
|
446
|
-
loop2(atom2);
|
|
447
|
-
};
|
|
448
|
-
const writeAtomState = (atom2, ...args) => {
|
|
449
|
-
let isSync = true;
|
|
450
|
-
const getter = (a) => returnAtomValue(readAtomState(a));
|
|
451
|
-
const setter = (a, ...args2) => {
|
|
452
|
-
let r;
|
|
453
|
-
if (a === atom2) {
|
|
454
|
-
if (!hasInitialValue(a)) {
|
|
455
|
-
throw new Error("atom not writable");
|
|
456
|
-
}
|
|
457
|
-
const prevAtomState = getAtomState(a);
|
|
458
|
-
const nextAtomState = setAtomValueOrPromise(a, args2[0]);
|
|
459
|
-
if (!isEqualAtomValue(prevAtomState, nextAtomState)) {
|
|
460
|
-
recomputeDependents(a);
|
|
461
|
-
}
|
|
462
|
-
} else {
|
|
463
|
-
r = writeAtomState(a, ...args2);
|
|
464
|
-
}
|
|
465
|
-
if (!isSync) {
|
|
466
|
-
const flushed = flushPending();
|
|
467
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
468
|
-
storeListenersRev2.forEach(
|
|
469
|
-
(l) => l({ type: "async-write", flushed })
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
return r;
|
|
474
|
-
};
|
|
475
|
-
const result = atom2.write(getter, setter, ...args);
|
|
476
|
-
isSync = false;
|
|
477
|
-
return result;
|
|
478
|
-
};
|
|
479
|
-
const writeAtom = (atom2, ...args) => {
|
|
480
|
-
const result = writeAtomState(atom2, ...args);
|
|
481
|
-
const flushed = flushPending();
|
|
482
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
483
|
-
storeListenersRev2.forEach(
|
|
484
|
-
(l) => l({ type: "write", flushed })
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
return result;
|
|
488
|
-
};
|
|
489
|
-
const mountAtom = (atom2, initialDependent, onMountQueue) => {
|
|
490
|
-
var _a;
|
|
491
|
-
const queue = onMountQueue || [];
|
|
492
|
-
(_a = getAtomState(atom2)) == null ? void 0 : _a.d.forEach((_, a) => {
|
|
493
|
-
const aMounted = mountedMap.get(a);
|
|
494
|
-
if (aMounted) {
|
|
495
|
-
aMounted.t.add(atom2);
|
|
496
|
-
} else {
|
|
497
|
-
if (a !== atom2) {
|
|
498
|
-
mountAtom(a, atom2, queue);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
readAtomState(atom2);
|
|
503
|
-
const mounted = {
|
|
504
|
-
t: new Set(initialDependent && [initialDependent]),
|
|
505
|
-
l: /* @__PURE__ */ new Set()
|
|
506
|
-
};
|
|
507
|
-
mountedMap.set(atom2, mounted);
|
|
508
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
509
|
-
mountedAtoms.add(atom2);
|
|
510
|
-
}
|
|
511
|
-
if (isActuallyWritableAtom(atom2) && atom2.onMount) {
|
|
512
|
-
const { onMount } = atom2;
|
|
513
|
-
queue.push(() => {
|
|
514
|
-
const onUnmount = onMount((...args) => writeAtom(atom2, ...args));
|
|
515
|
-
if (onUnmount) {
|
|
516
|
-
mounted.u = onUnmount;
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
if (!onMountQueue) {
|
|
521
|
-
queue.forEach((f) => f());
|
|
522
|
-
}
|
|
523
|
-
return mounted;
|
|
524
|
-
};
|
|
525
|
-
const unmountAtom = (atom2) => {
|
|
526
|
-
var _a;
|
|
527
|
-
const onUnmount = (_a = mountedMap.get(atom2)) == null ? void 0 : _a.u;
|
|
528
|
-
if (onUnmount) {
|
|
529
|
-
onUnmount();
|
|
530
|
-
}
|
|
531
|
-
mountedMap.delete(atom2);
|
|
532
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
533
|
-
mountedAtoms.delete(atom2);
|
|
534
|
-
}
|
|
535
|
-
const atomState = getAtomState(atom2);
|
|
536
|
-
if (atomState) {
|
|
537
|
-
if (hasPromiseAtomValue(atomState)) {
|
|
538
|
-
cancelPromise(atomState.v);
|
|
539
|
-
}
|
|
540
|
-
atomState.d.forEach((_, a) => {
|
|
541
|
-
if (a !== atom2) {
|
|
542
|
-
const mounted = mountedMap.get(a);
|
|
543
|
-
if (mounted) {
|
|
544
|
-
mounted.t.delete(atom2);
|
|
545
|
-
if (canUnmountAtom(a, mounted)) {
|
|
546
|
-
unmountAtom(a);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
} else if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
552
|
-
console.warn("[Bug] could not find atom state to unmount", atom2);
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
const mountDependencies = (atom2, atomState, prevDependencies) => {
|
|
556
|
-
const depSet = new Set(atomState.d.keys());
|
|
557
|
-
const maybeUnmountAtomSet = /* @__PURE__ */ new Set();
|
|
558
|
-
prevDependencies == null ? void 0 : prevDependencies.forEach((_, a) => {
|
|
559
|
-
if (depSet.has(a)) {
|
|
560
|
-
depSet.delete(a);
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
maybeUnmountAtomSet.add(a);
|
|
564
|
-
const mounted = mountedMap.get(a);
|
|
565
|
-
if (mounted) {
|
|
566
|
-
mounted.t.delete(atom2);
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
depSet.forEach((a) => {
|
|
570
|
-
const mounted = mountedMap.get(a);
|
|
571
|
-
if (mounted) {
|
|
572
|
-
mounted.t.add(atom2);
|
|
573
|
-
} else if (mountedMap.has(atom2)) {
|
|
574
|
-
mountAtom(a, atom2);
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
maybeUnmountAtomSet.forEach((a) => {
|
|
578
|
-
const mounted = mountedMap.get(a);
|
|
579
|
-
if (mounted && canUnmountAtom(a, mounted)) {
|
|
580
|
-
unmountAtom(a);
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
};
|
|
584
|
-
const flushPending = () => {
|
|
585
|
-
let flushed;
|
|
586
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
587
|
-
flushed = /* @__PURE__ */ new Set();
|
|
588
|
-
}
|
|
589
|
-
while (pendingMap.size) {
|
|
590
|
-
const pending = Array.from(pendingMap);
|
|
591
|
-
pendingMap.clear();
|
|
592
|
-
pending.forEach(([atom2, prevAtomState]) => {
|
|
593
|
-
const atomState = getAtomState(atom2);
|
|
594
|
-
if (atomState) {
|
|
595
|
-
const mounted = mountedMap.get(atom2);
|
|
596
|
-
if (mounted && atomState.d !== (prevAtomState == null ? void 0 : prevAtomState.d)) {
|
|
597
|
-
mountDependencies(atom2, atomState, prevAtomState == null ? void 0 : prevAtomState.d);
|
|
598
|
-
}
|
|
599
|
-
if (mounted && !// TODO This seems pretty hacky. Hope to fix it.
|
|
600
|
-
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
601
|
-
(!hasPromiseAtomValue(prevAtomState) && (isEqualAtomValue(prevAtomState, atomState) || isEqualAtomError(prevAtomState, atomState)))) {
|
|
602
|
-
mounted.l.forEach((listener) => listener());
|
|
603
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
604
|
-
flushed.add(atom2);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
} else if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
608
|
-
console.warn("[Bug] no atom state to flush");
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
613
|
-
return flushed;
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
const subscribeAtom = (atom2, listener) => {
|
|
617
|
-
const mounted = addAtom(atom2);
|
|
618
|
-
const flushed = flushPending();
|
|
619
|
-
const listeners = mounted.l;
|
|
620
|
-
listeners.add(listener);
|
|
621
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
622
|
-
storeListenersRev2.forEach(
|
|
623
|
-
(l) => l({ type: "sub", flushed })
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
return () => {
|
|
627
|
-
listeners.delete(listener);
|
|
628
|
-
delAtom(atom2);
|
|
629
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
630
|
-
storeListenersRev2.forEach((l) => l({ type: "unsub" }));
|
|
631
|
-
}
|
|
632
|
-
};
|
|
633
|
-
};
|
|
634
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
635
|
-
return {
|
|
636
|
-
get: readAtom,
|
|
637
|
-
set: writeAtom,
|
|
638
|
-
sub: subscribeAtom,
|
|
639
|
-
// store dev methods (these are tentative and subject to change without notice)
|
|
640
|
-
dev_subscribe_store: (l, rev) => {
|
|
641
|
-
if (rev !== 2) {
|
|
642
|
-
throw new Error("The current StoreListener revision is 2.");
|
|
643
|
-
}
|
|
644
|
-
storeListenersRev2.add(l);
|
|
645
|
-
return () => {
|
|
646
|
-
storeListenersRev2.delete(l);
|
|
647
|
-
};
|
|
648
|
-
},
|
|
649
|
-
dev_get_mounted_atoms: () => mountedAtoms.values(),
|
|
650
|
-
dev_get_atom_state: (a) => atomStateMap.get(a),
|
|
651
|
-
dev_get_mounted: (a) => mountedMap.get(a),
|
|
652
|
-
dev_restore_atoms: (values) => {
|
|
653
|
-
for (const [atom2, valueOrPromise] of values) {
|
|
654
|
-
if (hasInitialValue(atom2)) {
|
|
655
|
-
setAtomValueOrPromise(atom2, valueOrPromise);
|
|
656
|
-
recomputeDependents(atom2);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
const flushed = flushPending();
|
|
660
|
-
storeListenersRev2.forEach(
|
|
661
|
-
(l) => l({ type: "restore", flushed })
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
return {
|
|
667
|
-
get: readAtom,
|
|
668
|
-
set: writeAtom,
|
|
669
|
-
sub: subscribeAtom
|
|
670
|
-
};
|
|
671
|
-
};
|
|
672
|
-
var defaultStore;
|
|
673
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
674
|
-
if (typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__ === "number") {
|
|
675
|
-
++globalThis.__NUMBER_OF_JOTAI_INSTANCES__;
|
|
676
|
-
} else {
|
|
677
|
-
globalThis.__NUMBER_OF_JOTAI_INSTANCES__ = 1;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
var getDefaultStore = () => {
|
|
681
|
-
if (!defaultStore) {
|
|
682
|
-
defaultStore = createStore();
|
|
683
|
-
}
|
|
684
|
-
return defaultStore;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
// ../../node_modules/jotai/esm/react.mjs
|
|
688
|
-
var import_react = __toESM(require("react"), 1);
|
|
689
|
-
var import_meta2 = {};
|
|
690
|
-
var StoreContext = (0, import_react.createContext)(void 0);
|
|
691
|
-
var useStore = (options) => {
|
|
692
|
-
const store = (0, import_react.useContext)(StoreContext);
|
|
693
|
-
return (options == null ? void 0 : options.store) || store || getDefaultStore();
|
|
694
|
-
};
|
|
695
|
-
var isPromiseLike2 = (x) => typeof (x == null ? void 0 : x.then) === "function";
|
|
696
|
-
var use = import_react.default.use || ((promise) => {
|
|
697
|
-
if (promise.status === "pending") {
|
|
698
|
-
throw promise;
|
|
699
|
-
} else if (promise.status === "fulfilled") {
|
|
700
|
-
return promise.value;
|
|
701
|
-
} else if (promise.status === "rejected") {
|
|
702
|
-
throw promise.reason;
|
|
703
|
-
} else {
|
|
704
|
-
promise.status = "pending";
|
|
705
|
-
promise.then(
|
|
706
|
-
(v) => {
|
|
707
|
-
promise.status = "fulfilled";
|
|
708
|
-
promise.value = v;
|
|
709
|
-
},
|
|
710
|
-
(e) => {
|
|
711
|
-
promise.status = "rejected";
|
|
712
|
-
promise.reason = e;
|
|
713
|
-
}
|
|
714
|
-
);
|
|
715
|
-
throw promise;
|
|
716
|
-
}
|
|
717
|
-
});
|
|
718
|
-
function useAtomValue(atom2, options) {
|
|
719
|
-
const store = useStore(options);
|
|
720
|
-
const [[valueFromReducer, storeFromReducer, atomFromReducer], rerender] = (0, import_react.useReducer)(
|
|
721
|
-
(prev) => {
|
|
722
|
-
const nextValue = store.get(atom2);
|
|
723
|
-
if (Object.is(prev[0], nextValue) && prev[1] === store && prev[2] === atom2) {
|
|
724
|
-
return prev;
|
|
725
|
-
}
|
|
726
|
-
return [nextValue, store, atom2];
|
|
727
|
-
},
|
|
728
|
-
void 0,
|
|
729
|
-
() => [store.get(atom2), store, atom2]
|
|
730
|
-
);
|
|
731
|
-
let value = valueFromReducer;
|
|
732
|
-
if (storeFromReducer !== store || atomFromReducer !== atom2) {
|
|
733
|
-
rerender();
|
|
734
|
-
value = store.get(atom2);
|
|
735
|
-
}
|
|
736
|
-
const delay = options == null ? void 0 : options.delay;
|
|
737
|
-
(0, import_react.useEffect)(() => {
|
|
738
|
-
const unsub = store.sub(atom2, () => {
|
|
739
|
-
if (typeof delay === "number") {
|
|
740
|
-
setTimeout(rerender, delay);
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
rerender();
|
|
744
|
-
});
|
|
745
|
-
rerender();
|
|
746
|
-
return unsub;
|
|
747
|
-
}, [store, atom2, delay]);
|
|
748
|
-
(0, import_react.useDebugValue)(value);
|
|
749
|
-
return isPromiseLike2(value) ? use(value) : value;
|
|
750
|
-
}
|
|
751
|
-
function useSetAtom(atom2, options) {
|
|
752
|
-
const store = useStore(options);
|
|
753
|
-
const setAtom = (0, import_react.useCallback)(
|
|
754
|
-
(...args) => {
|
|
755
|
-
if ((import_meta2.env ? import_meta2.env.MODE : void 0) !== "production" && !("write" in atom2)) {
|
|
756
|
-
throw new Error("not writable atom");
|
|
757
|
-
}
|
|
758
|
-
return store.set(atom2, ...args);
|
|
759
|
-
},
|
|
760
|
-
[store, atom2]
|
|
761
|
-
);
|
|
762
|
-
return setAtom;
|
|
763
|
-
}
|
|
764
|
-
function useAtom(atom2, options) {
|
|
765
|
-
return [
|
|
766
|
-
useAtomValue(atom2, options),
|
|
767
|
-
// We do wrong type assertion here, which results in throwing an error.
|
|
768
|
-
useSetAtom(atom2, options)
|
|
769
|
-
];
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
// src/hooks.tsx
|
|
773
|
-
var storyContextAtom = atom(null);
|
|
774
|
-
function useSetStoryContext() {
|
|
775
|
-
return useSetAtom(storyContextAtom);
|
|
776
|
-
}
|
|
777
|
-
function useStoryContext() {
|
|
778
|
-
return useAtomValue(storyContextAtom);
|
|
779
|
-
}
|
|
780
|
-
function useStoryContextParam(name, defaultValue) {
|
|
781
|
-
const paramAtom = (0, import_react2.useMemo)(() => atom((get) => get(storyContextAtom)?.parameters?.[name]), [name]);
|
|
782
|
-
return useAtomValue(paramAtom) ?? defaultValue;
|
|
783
|
-
}
|
|
784
|
-
function useIsStorySelected(storyId) {
|
|
785
|
-
return useAtomValue(
|
|
786
|
-
(0, import_react2.useMemo)(() => atom((get) => get(storyContextAtom)?.id === storyId), [storyId])
|
|
787
|
-
);
|
|
788
|
-
}
|
|
789
|
-
function useIsStorySectionSelected(title) {
|
|
790
|
-
return useAtomValue(
|
|
791
|
-
(0, import_react2.useMemo)(
|
|
792
|
-
() => atom((get) => {
|
|
793
|
-
const contextTitle = get(storyContextAtom)?.title;
|
|
794
|
-
return contextTitle === title || contextTitle?.startsWith(`${title}/`);
|
|
795
|
-
}),
|
|
796
|
-
[title]
|
|
797
|
-
)
|
|
798
|
-
);
|
|
799
|
-
}
|
|
800
|
-
function useIsChildSelected(entries) {
|
|
801
|
-
return useAtomValue(
|
|
802
|
-
(0, import_react2.useMemo)(
|
|
803
|
-
() => atom((get) => {
|
|
804
|
-
const contextId = get(storyContextAtom)?.id;
|
|
805
|
-
return !!entries.find(({ id }) => id === contextId);
|
|
806
|
-
}),
|
|
807
|
-
[entries]
|
|
808
|
-
)
|
|
809
|
-
);
|
|
810
|
-
}
|
|
811
|
-
function useUpdateOnStoryChanged() {
|
|
812
|
-
useAtomValue((0, import_react2.useMemo)(() => atom((get) => get(storyContextAtom)?.id), []));
|
|
813
|
-
}
|
|
814
|
-
function atomWithToggle(initialValue) {
|
|
815
|
-
const anAtom = atom(initialValue, (get, set, nextValue) => {
|
|
816
|
-
const update = nextValue ?? !get(anAtom);
|
|
817
|
-
set(anAtom, update);
|
|
818
|
-
});
|
|
819
|
-
return anAtom;
|
|
820
|
-
}
|
|
821
|
-
var isUIVisibleAtom = atomWithToggle(true);
|
|
822
|
-
function useIsUIVisible() {
|
|
823
|
-
return useAtom(isUIVisibleAtom);
|
|
824
|
-
}
|
|
825
|
-
var isSplitPanelVisibleAtom = atomWithToggle(false);
|
|
826
|
-
function useIsSplitPanelVisible() {
|
|
827
|
-
return useAtom(isSplitPanelVisibleAtom);
|
|
828
|
-
}
|
|
829
|
-
function syncExternalUI({ isUIVisible, isSplitPanelVisible }) {
|
|
830
|
-
const jotaiStore = getDefaultStore();
|
|
831
|
-
if (isUIVisible !== void 0) {
|
|
832
|
-
jotaiStore.set(isUIVisibleAtom, isUIVisible);
|
|
833
|
-
}
|
|
834
|
-
if (isSplitPanelVisible !== void 0) {
|
|
835
|
-
jotaiStore.set(isSplitPanelVisibleAtom, isSplitPanelVisible);
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
var selectedAddonAtom = atom(void 0);
|
|
839
|
-
function useSelectedAddon(initialValue) {
|
|
840
|
-
const result = useAtom(selectedAddonAtom);
|
|
841
|
-
const set = result[1];
|
|
842
|
-
import_react2.default.useEffect(() => {
|
|
843
|
-
const jotaiStore = getDefaultStore();
|
|
844
|
-
if (jotaiStore.get(selectedAddonAtom) === void 0) {
|
|
845
|
-
set(initialValue);
|
|
846
|
-
}
|
|
847
|
-
}, []);
|
|
848
|
-
return result;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
// src/components/StoryListView/StoryListView.tsx
|
|
852
|
-
var import_core_events = __toESM(require("@storybook/core-events"));
|
|
853
|
-
var import_react_native_theming = require("@storybook/react-native-theming");
|
|
854
|
-
var import_react3 = __toESM(require("react"));
|
|
855
|
-
var import_react_native2 = require("react-native");
|
|
856
|
-
|
|
857
|
-
// src/components/Shared/icons.tsx
|
|
858
|
-
var import_react_native = require("react-native");
|
|
859
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
860
|
-
var iconSources = {
|
|
861
|
-
grid: {
|
|
862
|
-
uri: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAALdQTFRFAAAAIJ//Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqj9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Haf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqb9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqj9Hqf9Hmz01QAAAD10Uk5TAAAEGjNefYqLXDUFAjSY0e79/9KZAghmyMkBQbz6vUIBBnD1cQcOo6Sp76qBePTHVOoC+RQTX4mCDZsBMmX5zDcAAAHcSURBVHic7ZrrcoIwEIVX8W5VpAiUaq33GyJqrfby/s9VacsCDojUJNNx9vzCTLLfZJdkHM4ChJTJSrl8oVj6s4qFckWqZiBed7V6Q24qV6op36uVVgxC042rAQh60LUIhPnY7rBCuOo8dZ9PGb3+gCXC1WA4CjPGE9YIV9NxiNHmwVCUWYAy4rIPV1PMmNnnxVCUoVf9LvOa+xp0f89HqCDzhbWMle3NsuPnWIt5MF7757zogfOxcqLOEGrtzVufm6U5Kz9i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a8+MlWxhcj46sFiFkiyc57TG/lME9tL7Q1RzFlYQNXuXdmdTweOX3C/JwEHYt4BzAuq2MZNyPnx1g6AiFlYer4FXH2tEsyEy8igl84of36tFgYkepHo2F1EwvxsI7oIVZk8J2KQ5INnHbta0bQqG+egktYV/f8lTAuDwoVfkj4HHRijVD44mw+ErLShbPR8/041UxYI7HrK6RZx+jq9RG71G7gvdrIVDOMFea1PuFPhEYiPqMfZ4S9mIaWotoddSYK81unUNHHC0f5AV5WgrTCXrXLNazlyxu5LV+eSBU1ZhQF9eObpFj2CIdh1BFn6s1oZqiKfqHtWYLz/wAUO/neFu9thgAAAABJRU5ErkJggg=="
|
|
872
|
-
},
|
|
873
|
-
"layout-bottom": {
|
|
874
|
-
uri: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEzSURBVHgB7ZjhDYIwEIWfTsAIjOAIHYGNZANwAnQi3KBu4AhYIiYNNHCF0ivxvuR+mHjNe70eyR0gCIKQOspEZUKb6CJFa6IxkWMD2SC8Y45q0OItvgXALd6uiJeJFG7eVQkSuSNZ49sL3qVcSQF3zylKcoOp+FjCbTJMTdSUxPHbL8CHwvQyFxmXjZMMC3pOjqSO8J+YzOo54+CIAW7EADdigBsxwI0Y4EYMcLPWwNXEG+HGxf4s8si4xNI8sOe8XK7Q450Q8uZdlfDS85c9cMN+PBAAypvrtwOhm7jcoGc2gWOlYuPdA6/R7wv4GK90niDQPw/bsUY6i62GkqgwLVt/UKwFVzZo0A4dOfWQGvt969cGaa1o38Kh1+s/EylUosbGHsxN3BG3InoQriAIgpA0H3BBw2jFymiHAAAAAElFTkSuQmCC"
|
|
875
|
-
},
|
|
876
|
-
"layout-bottom-inverse": {
|
|
877
|
-
uri: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFgSURBVHgB7ZjhcYMwDIXlTEA2YISOYDbIRmSD0AloJ+kIyQbuBskGqnz4R+OYw7jYchN9dzouwYIn2+LgAQiCIFQNImqKE4XBcpwpRooWUqHkxgnnxmpo5nSqOfF0+KJ4gzq4UHRKqZt/YjeT0EM94i1WSx81kma/DSyjwakXGigA3eeA4Z7TMcljQHwR4Z6OJlDEEJN49pIOwIRb9bvJ9MeoQBLeDSCACbfy19//+XqqLsCypGcH/xwpgBspgBspgBspgBspgBspgJukAugFsae44nbYa51gC/wrB87ndCqOa/Ws/h6ws0WHXJ+YN7rdHlboeckeeId8fMJfWdpzbsyA2zfxMUXPYg8Q+5AjVoqUHvj2frM5dPho6VxikgZv1QzWY2yNMYk6sEcNFjK4nHCNYWuxjb3IgPURtBWf0153AzvI+8yPxWrokp+EONntH/ho+ubE4LSNNQiCIFTND53ElQfvR3pDAAAAAElFTkSuQmCC"
|
|
878
|
-
},
|
|
879
|
-
"layout-split": {
|
|
880
|
-
uri: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADxSURBVHgB7ZjhCcIwFITP4gAdISM4QkZwI0doNqgb1Q3iJjU/Imga5YVK3yveB/ejkJa7vgTCAYQQYh2fNCTFpHkjTUljksMK+mx8VtaQvTSbnwBom3+dSFMIC3++NgkRDlA3+0m+NNtVAlxgl7NkkaW9XyqWZg+VADNs8+a5w85hAG0YQBsG0IYBtNl9gKNgzQG6fL3acAtpwwDaMIA2DKDNXwRorvW2pBbgXjyfoEfZA90gIGDZxWhMoceyER8lL3rUCyVRK/YD+uwhVnw46UcC7LVyAQ3svl5/hrAwiYCVZ9AlXbHtRGI27kEIIaZ5ALildIGPrcQbAAAAAElFTkSuQmCC"
|
|
881
|
-
},
|
|
882
|
-
"layout-split-inverse": {
|
|
883
|
-
uri: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEaSURBVHgB7ZntDYJADIaLcQBGYARHgAl0I0YQJ8BNdAPZ4BzBDWov8ENrkYuJtJA+SUO4D/K+1yaQAuA4jmMaRCwpjhQB5+NG0VIU8Cu0OR+EaxM15GM6szHxdLlQ7MAGHUWVZdmDT2xGNtRgR3wkaqmliY8MYF93AWwSs3B9HZAyUINdDnxAMmCpdDh7PiCVEIJhqITeNG9g4bgBbdyANm5AGzegzeINbKcW8Ff33Ex92ngJaeMGtHED2rgBbdZv4FtbzwKSgTu7V2uz0OHxPlCXsqlhzdWgkQXsm8uBaWlTNpZChzgIp/EXBuElyu38IvUhDdqjkbSus70+LKwoTqBP1CCKT4KyUVCcsf/tMxcB+zIuwXEcxzRPpfGo9y3IYogAAAAASUVORK5CYII="
|
|
884
|
-
},
|
|
885
|
-
folder: {
|
|
886
|
-
uri: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAHTSURBVGiB7Zk7LwRRGIbf7wwRRIJGlDSEpdmI6Fw6lRWZXiJ0lkZUsn8A2dD5B0MhkS1UepGIXZu4hsKlJASxyZyjoJAx4uzutztjc57yXN58T+Z8M5kZoEKg2R4nSpL6IdCQ72YlhQLh3LLc/dUj+7YUBepC8ciWYshxidSy+1a/tHYx+s6QlzeCKcdSihZEzWtqfsCpZcrMCy6RTwgj8knsBCHDKwIEJsPVI36cKOCGK4ygnkHYbcpkNxJISO98lc+eR4Au9eJVG4DmXyY7CejUrvRPCFCIPUQifTjG1I9ZnyuynTyeiOlEx3udDkixB6CVo1RdXCHb19P21fexonokmbZPIeQQgPuiKssTS1K3d6zoZg9Choh+tATLXSuZtk8tSwyC1B1HXiH4NXtBrByNn8V7nWFIMcmVCVJzAGp0lrKJAF/HDFjkyotHtmagKcL/QAwIIxI2jEjYMCJhw4iEDSMSNoxI2DAiYcOIhI2KEfF71W2c7XGiZa/EDwVLd6mfyCApccBYTlmomKNlRAJFymvv0P8TIRzediHjHRYAMgBK9Y+EkxygUpBybHPTdr2TBADT0Z06K/ek9UUvKFpk9Usia+eCrsNgMBgMBkM5+ADkCHptw04GlAAAAABJRU5ErkJggg=="
|
|
887
|
-
}
|
|
888
|
-
};
|
|
889
|
-
function Icon({ name, ...props }) {
|
|
890
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
891
|
-
import_react_native.Image,
|
|
892
|
-
{
|
|
893
|
-
source: {
|
|
894
|
-
...iconSources[name],
|
|
895
|
-
width: 16,
|
|
896
|
-
height: 16
|
|
897
|
-
},
|
|
898
|
-
...props
|
|
899
|
-
}
|
|
900
|
-
);
|
|
901
|
-
}
|
|
902
|
-
function BackgroundIcon({ name, ...props }) {
|
|
903
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
904
|
-
import_react_native.ImageBackground,
|
|
905
|
-
{
|
|
906
|
-
source: {
|
|
907
|
-
...iconSources[name],
|
|
908
|
-
width: 16,
|
|
909
|
-
height: 16
|
|
910
|
-
},
|
|
911
|
-
...props
|
|
912
|
-
}
|
|
913
|
-
);
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// src/components/StoryListView/getNestedStories.ts
|
|
917
|
-
function getNestedStories(storyIndex) {
|
|
918
|
-
const stories = Object.values(storyIndex?.entries ?? {});
|
|
919
|
-
const group = [];
|
|
920
|
-
stories?.forEach((story) => {
|
|
921
|
-
const nameParts = story.title.split("/");
|
|
922
|
-
formGroup(nameParts, story, group);
|
|
923
|
-
});
|
|
924
|
-
return group;
|
|
925
|
-
}
|
|
926
|
-
function formGroup(nameParts, story, group) {
|
|
927
|
-
if (nameParts.length === 1) {
|
|
928
|
-
const current = group.find(({ name }) => name === nameParts[0]);
|
|
929
|
-
if (current) {
|
|
930
|
-
current.stories.push(story);
|
|
931
|
-
} else {
|
|
932
|
-
group.push({
|
|
933
|
-
title: story.title,
|
|
934
|
-
name: nameParts[0],
|
|
935
|
-
children: [],
|
|
936
|
-
stories: [story]
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
941
|
-
const newParts = nameParts.slice(1);
|
|
942
|
-
const currentListPart = group.find(({ name }) => name === nameParts[0]);
|
|
943
|
-
if (!currentListPart) {
|
|
944
|
-
const toPush = {
|
|
945
|
-
name: nameParts[0],
|
|
946
|
-
title: story.title,
|
|
947
|
-
children: [],
|
|
948
|
-
stories: []
|
|
949
|
-
};
|
|
950
|
-
group.push(toPush);
|
|
951
|
-
return formGroup(newParts, story, toPush.children);
|
|
952
|
-
} else if (!currentListPart.children) {
|
|
953
|
-
currentListPart.children = [];
|
|
954
|
-
}
|
|
955
|
-
const newGroup = currentListPart.children;
|
|
956
|
-
return formGroup(newParts, story, newGroup);
|
|
957
|
-
}
|
|
958
|
-
var filterNestedStories = (stories, filter) => {
|
|
959
|
-
const filteredStories = [];
|
|
960
|
-
stories.forEach((story) => {
|
|
961
|
-
const filtered = filterStoryGroup(story, filter);
|
|
962
|
-
if (filtered) {
|
|
963
|
-
filteredStories.push(filtered);
|
|
964
|
-
}
|
|
965
|
-
});
|
|
966
|
-
return filteredStories;
|
|
967
|
-
};
|
|
968
|
-
var filterStoryGroup = (story, filter) => {
|
|
969
|
-
const filteredStories = story.stories.filter(
|
|
970
|
-
(item) => item.title.toLowerCase().includes(filter.toLowerCase()) || item.name.toLowerCase().includes(filter.toLowerCase())
|
|
971
|
-
);
|
|
972
|
-
const filteredChildren = filterNestedStories(story.children, filter);
|
|
973
|
-
if (filteredStories.length || filteredChildren.length) {
|
|
974
|
-
return {
|
|
975
|
-
...story,
|
|
976
|
-
children: filteredChildren,
|
|
977
|
-
stories: filteredStories
|
|
978
|
-
};
|
|
979
|
-
}
|
|
980
|
-
};
|
|
981
|
-
var findFirstChildStory = (story) => {
|
|
982
|
-
if (story.stories.length) {
|
|
983
|
-
return story.stories[0];
|
|
984
|
-
}
|
|
985
|
-
if (story.children.length) {
|
|
986
|
-
return findFirstChildStory(story.children[0]);
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
// src/components/StoryListView/StoryListView.tsx
|
|
991
|
-
var import_preview_api = require("@storybook/preview-api");
|
|
992
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
993
|
-
var SectionHeaderText = import_react_native_theming.styled.Text(({ theme: theme3 }) => ({
|
|
994
|
-
fontSize: theme3.storyList.fontSize,
|
|
995
|
-
color: theme3.storyList.headerTextColor,
|
|
996
|
-
fontWeight: theme3.storyList.headerFontWeight,
|
|
997
|
-
flexShrink: 1
|
|
998
|
-
}));
|
|
999
|
-
var StoryNameText = import_react_native_theming.styled.Text(({ selected, theme: theme3 }) => ({
|
|
1000
|
-
fontSize: theme3.storyList.fontSize,
|
|
1001
|
-
fontWeight: selected ? theme3.storyList.storySelectedFontWeight : theme3.storyList.storyFontWeight,
|
|
1002
|
-
color: selected ? theme3.storyList.storySelectedTextColor : theme3.storyList.storyTextColor
|
|
1003
|
-
}));
|
|
1004
|
-
var SEARCH_ICON_SIZE = 24;
|
|
1005
|
-
var SearchInput = import_react_native_theming.styled.TextInput(
|
|
1006
|
-
{
|
|
1007
|
-
padding: 0,
|
|
1008
|
-
...import_react_native2.StyleSheet.absoluteFillObject
|
|
1009
|
-
},
|
|
1010
|
-
({ theme: theme3 }) => ({
|
|
1011
|
-
fontSize: theme3.storyList.search.fontSize,
|
|
1012
|
-
paddingStart: theme3.storyList.search.paddingHorizontal + SEARCH_ICON_SIZE,
|
|
1013
|
-
color: theme3.storyList.search.textColor
|
|
1014
|
-
})
|
|
1015
|
-
);
|
|
1016
|
-
var SearchContainer = import_react_native_theming.styled.View(({ theme: theme3 }) => ({
|
|
1017
|
-
flexDirection: "row",
|
|
1018
|
-
alignItems: "center",
|
|
1019
|
-
margin: theme3.panel.paddingHorizontal,
|
|
1020
|
-
paddingVertical: theme3.storyList.search.paddingVertical,
|
|
1021
|
-
paddingStart: theme3.storyList.search.paddingHorizontal,
|
|
1022
|
-
borderColor: theme3.storyList.search.borderColor,
|
|
1023
|
-
borderWidth: theme3.storyList.search.borderWidth,
|
|
1024
|
-
borderRadius: theme3.storyList.search.borderRadius,
|
|
1025
|
-
backgroundColor: theme3.storyList.search.backgroundColor
|
|
1026
|
-
}));
|
|
1027
|
-
var SearchBar = (props) => {
|
|
1028
|
-
const theme3 = (0, import_react_native_theming.useTheme)();
|
|
1029
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(SearchContainer, { children: [
|
|
1030
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "search", style: { opacity: 0.5 } }),
|
|
1031
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1032
|
-
SearchInput,
|
|
1033
|
-
{
|
|
1034
|
-
...props,
|
|
1035
|
-
autoCapitalize: "none",
|
|
1036
|
-
autoComplete: "off",
|
|
1037
|
-
autoCorrect: false,
|
|
1038
|
-
spellCheck: false,
|
|
1039
|
-
clearButtonMode: "while-editing",
|
|
1040
|
-
disableFullscreenUI: true,
|
|
1041
|
-
placeholderTextColor: theme3.storyList.search.placeholderTextColor,
|
|
1042
|
-
returnKeyType: "search"
|
|
1043
|
-
}
|
|
1044
|
-
)
|
|
1045
|
-
] });
|
|
1046
|
-
};
|
|
1047
|
-
var HeaderContainer = import_react_native_theming.styled.TouchableOpacity(
|
|
1048
|
-
{
|
|
1049
|
-
flexDirection: "row",
|
|
1050
|
-
alignItems: "center"
|
|
1051
|
-
},
|
|
1052
|
-
({ selected, theme: theme3, childSelected }) => ({
|
|
1053
|
-
marginTop: theme3.storyList.sectionSpacing,
|
|
1054
|
-
paddingHorizontal: theme3.storyList.headerPaddingHorizontal,
|
|
1055
|
-
paddingVertical: theme3.storyList.headerPaddingVertical,
|
|
1056
|
-
backgroundColor: selected ? theme3.storyList.sectionActiveBackgroundColor : void 0,
|
|
1057
|
-
borderTopLeftRadius: theme3.storyList.sectionBorderRadius,
|
|
1058
|
-
borderTopRightRadius: theme3.storyList.sectionBorderRadius,
|
|
1059
|
-
borderBottomLeftRadius: selected && !childSelected ? theme3.storyList.sectionBorderRadius : void 0,
|
|
1060
|
-
borderBottomRightRadius: selected && !childSelected ? theme3.storyList.sectionBorderRadius : void 0
|
|
1061
|
-
})
|
|
1062
|
-
);
|
|
1063
|
-
var SectionHeader = import_react3.default.memo(
|
|
1064
|
-
({ name, onPress, isChildSelected, icon = "grid", expanded }) => {
|
|
1065
|
-
const selected = useIsStorySectionSelected(name) || isChildSelected;
|
|
1066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1067
|
-
HeaderContainer,
|
|
1068
|
-
{
|
|
1069
|
-
selected,
|
|
1070
|
-
childSelected: isChildSelected,
|
|
1071
|
-
onPress,
|
|
1072
|
-
activeOpacity: 0.8,
|
|
1073
|
-
children: [
|
|
1074
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1075
|
-
import_react_native2.View,
|
|
1076
|
-
{
|
|
1077
|
-
style: {
|
|
1078
|
-
transform: [{ rotate: expanded ? "90deg" : "0deg" }],
|
|
1079
|
-
marginRight: 6,
|
|
1080
|
-
alignItems: "center",
|
|
1081
|
-
justifyContent: "center"
|
|
1082
|
-
},
|
|
1083
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style: { fontSize: 8, color: "grey", lineHeight: 8 }, children: "\u27A4" })
|
|
1084
|
-
}
|
|
1085
|
-
),
|
|
1086
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: icon, width: 12, height: 12, style: { marginRight: 6 } }),
|
|
1087
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SectionHeaderText, { numberOfLines: 2, selected, children: name })
|
|
1088
|
-
]
|
|
1089
|
-
},
|
|
1090
|
-
name
|
|
1091
|
-
);
|
|
1092
|
-
}
|
|
1093
|
-
);
|
|
1094
|
-
var ItemTouchable = import_react_native_theming.styled.TouchableOpacity(
|
|
1095
|
-
{
|
|
1096
|
-
flexDirection: "row",
|
|
1097
|
-
alignItems: "center"
|
|
1098
|
-
},
|
|
1099
|
-
({ selected, sectionSelected, isLastItem, theme: theme3 }) => ({
|
|
1100
|
-
padding: theme3.storyList.storyPaddingHorizontal,
|
|
1101
|
-
paddingStart: theme3.storyList.storyIndent,
|
|
1102
|
-
backgroundColor: selected ? theme3.storyList.storySelectedBackgroundColor : sectionSelected ? theme3.storyList.sectionActiveBackgroundColor : void 0,
|
|
1103
|
-
borderBottomLeftRadius: isLastItem ? theme3.storyList.sectionBorderRadius : void 0,
|
|
1104
|
-
borderBottomRightRadius: isLastItem ? theme3.storyList.sectionBorderRadius : void 0
|
|
1105
|
-
})
|
|
1106
|
-
);
|
|
1107
|
-
var ListItem = ({
|
|
1108
|
-
storyId,
|
|
1109
|
-
kind,
|
|
1110
|
-
title,
|
|
1111
|
-
isLastItem,
|
|
1112
|
-
onPress,
|
|
1113
|
-
isSiblingSelected
|
|
1114
|
-
}) => {
|
|
1115
|
-
const selected = useIsStorySelected(storyId);
|
|
1116
|
-
const sectionSelected = useIsStorySectionSelected(kind) || isSiblingSelected;
|
|
1117
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1118
|
-
ItemTouchable,
|
|
1119
|
-
{
|
|
1120
|
-
onPress,
|
|
1121
|
-
activeOpacity: 0.8,
|
|
1122
|
-
testID: `Storybook.ListItem.${kind}.${title}`,
|
|
1123
|
-
accessibilityLabel: `Storybook.ListItem.${title}`,
|
|
1124
|
-
selected,
|
|
1125
|
-
sectionSelected,
|
|
1126
|
-
isLastItem,
|
|
1127
|
-
children: [
|
|
1128
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1129
|
-
Icon,
|
|
1130
|
-
{
|
|
1131
|
-
width: 14,
|
|
1132
|
-
height: 14,
|
|
1133
|
-
name: selected ? "story-white" : "story-blue",
|
|
1134
|
-
style: { marginRight: 6 }
|
|
1135
|
-
}
|
|
1136
|
-
),
|
|
1137
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StoryNameText, { selected, children: title })
|
|
1138
|
-
]
|
|
1139
|
-
},
|
|
1140
|
-
title
|
|
1141
|
-
);
|
|
1142
|
-
};
|
|
1143
|
-
var styles = import_react_native2.StyleSheet.create({
|
|
1144
|
-
sectionList: { flex: 1 },
|
|
1145
|
-
sectionListContentContainer: { paddingBottom: 6 }
|
|
1146
|
-
});
|
|
1147
|
-
function keyExtractor(item, index) {
|
|
1148
|
-
return item.name + index;
|
|
1149
|
-
}
|
|
1150
|
-
var RenderItem = ({
|
|
1151
|
-
item,
|
|
1152
|
-
changeStory
|
|
1153
|
-
}) => {
|
|
1154
|
-
const isChildSelected = useIsChildSelected(item.stories);
|
|
1155
|
-
const firstChild = findFirstChildStory(item);
|
|
1156
|
-
const firstChildSelected = useIsStorySelected(firstChild?.id);
|
|
1157
|
-
const [showChildren, setShowChildren] = (0, import_react3.useState)(false);
|
|
1158
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1159
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1160
|
-
SectionHeader,
|
|
1161
|
-
{
|
|
1162
|
-
name: item.name,
|
|
1163
|
-
isChildSelected,
|
|
1164
|
-
onPress: () => {
|
|
1165
|
-
if (firstChildSelected && showChildren) {
|
|
1166
|
-
setShowChildren(false);
|
|
1167
|
-
} else if (!showChildren && firstChild) {
|
|
1168
|
-
setShowChildren(true);
|
|
1169
|
-
changeStory(firstChild.id);
|
|
1170
|
-
} else if (showChildren && !firstChildSelected && firstChild) {
|
|
1171
|
-
changeStory(firstChild.id);
|
|
1172
|
-
}
|
|
1173
|
-
},
|
|
1174
|
-
icon: item.children.length ? "folder" : "grid",
|
|
1175
|
-
expanded: showChildren
|
|
1176
|
-
}
|
|
1177
|
-
),
|
|
1178
|
-
showChildren && item.stories?.map((story, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1179
|
-
ListItem,
|
|
1180
|
-
{
|
|
1181
|
-
storyId: story.id,
|
|
1182
|
-
title: story.name,
|
|
1183
|
-
kind: item.name,
|
|
1184
|
-
isSiblingSelected: isChildSelected,
|
|
1185
|
-
isLastItem: idx === item.stories.length - 1,
|
|
1186
|
-
onPress: () => changeStory(story.id)
|
|
1187
|
-
},
|
|
1188
|
-
story.id
|
|
1189
|
-
)),
|
|
1190
|
-
showChildren && item.children?.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style: { marginLeft: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RenderItem, { item: child, changeStory }) }, `${child.title}-${idx}`))
|
|
1191
|
-
] });
|
|
1192
|
-
};
|
|
1193
|
-
var StoryListView = ({ storyIndex }) => {
|
|
1194
|
-
const originalData = (0, import_react3.useMemo)(() => getNestedStories(storyIndex), [storyIndex]);
|
|
1195
|
-
const [data, setData] = (0, import_react3.useState)(originalData);
|
|
1196
|
-
const theme3 = (0, import_react_native_theming.useTheme)();
|
|
1197
|
-
const handleChangeSearchText = (text) => {
|
|
1198
|
-
const query = text.trim();
|
|
1199
|
-
if (!query) {
|
|
1200
|
-
setData(originalData);
|
|
1201
|
-
return;
|
|
1202
|
-
}
|
|
1203
|
-
setData(filterNestedStories(originalData, query));
|
|
1204
|
-
};
|
|
1205
|
-
const changeStory = (storyId) => {
|
|
1206
|
-
const channel = import_preview_api.addons.getChannel();
|
|
1207
|
-
channel.emit(import_core_events.default.SET_CURRENT_STORY, { storyId });
|
|
1208
|
-
};
|
|
1209
|
-
const renderItem = import_react3.default.useCallback(({ item }) => {
|
|
1210
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RenderItem, { item, changeStory });
|
|
1211
|
-
}, []);
|
|
1212
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.View, { style: { flex: 1 }, children: [
|
|
1213
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1214
|
-
SearchBar,
|
|
1215
|
-
{
|
|
1216
|
-
testID: "Storybook.ListView.SearchBar",
|
|
1217
|
-
onChangeText: handleChangeSearchText,
|
|
1218
|
-
placeholder: "Find by name"
|
|
1219
|
-
}
|
|
1220
|
-
),
|
|
1221
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1222
|
-
import_react_native2.FlatList,
|
|
1223
|
-
{
|
|
1224
|
-
style: styles.sectionList,
|
|
1225
|
-
contentContainerStyle: [
|
|
1226
|
-
styles.sectionListContentContainer,
|
|
1227
|
-
{
|
|
1228
|
-
paddingVertical: theme3.panel.paddingVertical,
|
|
1229
|
-
paddingHorizontal: theme3.panel.paddingHorizontal
|
|
1230
|
-
}
|
|
1231
|
-
],
|
|
1232
|
-
testID: "Storybook.ListView",
|
|
1233
|
-
renderItem,
|
|
1234
|
-
keyExtractor,
|
|
1235
|
-
data
|
|
1236
|
-
}
|
|
1237
|
-
)
|
|
1238
|
-
] });
|
|
1239
|
-
};
|
|
1240
|
-
var StoryListView_default = import_react3.default.memo(StoryListView);
|
|
1241
|
-
|
|
1242
|
-
// src/components/StoryView/StoryView.tsx
|
|
1243
|
-
var import_react5 = __toESM(require("react"));
|
|
1244
|
-
var import_react_native_theming2 = require("@storybook/react-native-theming");
|
|
1245
|
-
var import_react_native4 = require("react-native");
|
|
1246
|
-
|
|
1247
|
-
// src/components/StoryView/ErrorBoundary.tsx
|
|
1248
|
-
var import_react4 = __toESM(require("react"));
|
|
1249
|
-
var import_react_native3 = require("react-native");
|
|
1250
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1251
|
-
var ErrorBoundary = class extends import_react4.default.Component {
|
|
1252
|
-
constructor(props) {
|
|
1253
|
-
super(props);
|
|
1254
|
-
this.state = { hasError: false };
|
|
1255
|
-
}
|
|
1256
|
-
static getDerivedStateFromError(_error) {
|
|
1257
|
-
return { hasError: true };
|
|
1258
|
-
}
|
|
1259
|
-
componentDidCatch(error, errorInfo) {
|
|
1260
|
-
console.warn(error, errorInfo);
|
|
1261
|
-
}
|
|
1262
|
-
render() {
|
|
1263
|
-
if (this.state.hasError) {
|
|
1264
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { children: "Something went wrong rendering your story" });
|
|
1265
|
-
}
|
|
1266
|
-
return this.props.children;
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
|
-
|
|
1270
|
-
// src/components/StoryView/StoryView.tsx
|
|
1271
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1272
|
-
function dismissOnStartResponder() {
|
|
1273
|
-
import_react_native4.Keyboard.dismiss();
|
|
1274
|
-
return false;
|
|
1275
|
-
}
|
|
1276
|
-
var StoryView = () => {
|
|
1277
|
-
const context = useStoryContext();
|
|
1278
|
-
const id = context?.id;
|
|
1279
|
-
const { backgroundColor } = (0, import_react_native_theming2.useTheme)();
|
|
1280
|
-
if (context && context.unboundStoryFn) {
|
|
1281
|
-
const { unboundStoryFn: StoryComponent } = context;
|
|
1282
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1283
|
-
import_react_native4.View,
|
|
1284
|
-
{
|
|
1285
|
-
style: { flex: 1, backgroundColor },
|
|
1286
|
-
testID: id,
|
|
1287
|
-
onStartShouldSetResponder: dismissOnStartResponder,
|
|
1288
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorBoundary, { children: StoryComponent && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StoryComponent, { ...context }) })
|
|
1289
|
-
},
|
|
1290
|
-
id
|
|
1291
|
-
);
|
|
1292
|
-
}
|
|
1293
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style: { flex: 1, padding: 16, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { children: "Please open the sidebar and select a story to preview." }) });
|
|
1294
|
-
};
|
|
1295
|
-
var StoryView_default = import_react5.default.memo(StoryView);
|
|
1296
|
-
|
|
1297
|
-
// src/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.tsx
|
|
1298
|
-
var import_react6 = __toESM(require("react"));
|
|
1299
|
-
var import_react_native5 = require("react-native");
|
|
1300
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1301
|
-
var AbsolutePositionedKeyboardAwareView = ({
|
|
1302
|
-
onLayout,
|
|
1303
|
-
previewDimensions: { width, height },
|
|
1304
|
-
children
|
|
1305
|
-
}) => {
|
|
1306
|
-
const onLayoutHandler = ({ nativeEvent }) => {
|
|
1307
|
-
const { height: layoutHeight, width: layoutWidth } = nativeEvent.layout;
|
|
1308
|
-
if (layoutHeight !== height || layoutWidth !== width) {
|
|
1309
|
-
onLayout({
|
|
1310
|
-
height: layoutHeight,
|
|
1311
|
-
width: layoutWidth
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.View, { style: styles2.container, onLayout: onLayoutHandler, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1316
|
-
import_react_native5.View,
|
|
1317
|
-
{
|
|
1318
|
-
style: width === 0 ? styles2.container : [styles2.absolute, { position: "absolute", width, height }],
|
|
1319
|
-
children
|
|
1320
|
-
}
|
|
1321
|
-
) });
|
|
1322
|
-
};
|
|
1323
|
-
var styles2 = import_react_native5.StyleSheet.create({
|
|
1324
|
-
absolute: { position: "absolute" },
|
|
1325
|
-
container: { flex: 1 }
|
|
1326
|
-
});
|
|
1327
|
-
var absolute_positioned_keyboard_aware_view_default = import_react6.default.memo(AbsolutePositionedKeyboardAwareView);
|
|
1328
|
-
|
|
1329
|
-
// src/components/OnDeviceUI/OnDeviceUI.tsx
|
|
1330
|
-
var import_react_native_theming11 = require("@storybook/react-native-theming");
|
|
1331
|
-
var import_react_native15 = require("react-native");
|
|
1332
|
-
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
1333
|
-
|
|
1334
|
-
// src/components/OnDeviceUI/Panel.tsx
|
|
1335
|
-
var import_react7 = __toESM(require("react"));
|
|
1336
|
-
var import_react_native6 = require("react-native");
|
|
1337
|
-
var import_react_native_theming3 = require("@storybook/react-native-theming");
|
|
1338
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1339
|
-
var Container = (0, import_react_native_theming3.styled)(import_react_native6.Animated.View)(({ theme: theme3, edge }) => ({
|
|
1340
|
-
backgroundColor: theme3.panel.backgroundColor,
|
|
1341
|
-
borderTopWidth: edge === "top" ? theme3.panel.borderWidth : void 0,
|
|
1342
|
-
borderStartWidth: edge === "left" ? theme3.panel.borderWidth : void 0,
|
|
1343
|
-
borderEndWidth: edge === "right" ? theme3.panel.borderWidth : void 0,
|
|
1344
|
-
borderColor: theme3.panel.borderColor
|
|
1345
|
-
}));
|
|
1346
|
-
var Panel = ({ edge, children, style }) => {
|
|
1347
|
-
const containerStyle = import_react_native6.StyleSheet.flatten([
|
|
1348
|
-
edge === "top" ? void 0 : import_react_native6.StyleSheet.absoluteFillObject,
|
|
1349
|
-
style
|
|
1350
|
-
]);
|
|
1351
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Container, { edge, style: containerStyle, children });
|
|
1352
|
-
};
|
|
1353
|
-
var Panel_default = import_react7.default.memo(Panel);
|
|
1354
|
-
|
|
1355
|
-
// src/components/OnDeviceUI/addons/Addons.tsx
|
|
1356
|
-
var import_manager_api = require("@storybook/manager-api");
|
|
1357
|
-
var import_react_native_theming7 = require("@storybook/react-native-theming");
|
|
1358
|
-
var import_types = __toESM(require_dist());
|
|
1359
|
-
var import_react11 = __toESM(require("react"));
|
|
1360
|
-
var import_react_native9 = require("react-native");
|
|
1361
|
-
|
|
1362
|
-
// src/components/OnDeviceUI/addons/List.tsx
|
|
1363
|
-
var import_react9 = __toESM(require("react"));
|
|
1364
|
-
|
|
1365
|
-
// src/components/Shared/tabs.tsx
|
|
1366
|
-
var import_react8 = __toESM(require("react"));
|
|
1367
|
-
var import_react_native7 = require("react-native");
|
|
1368
|
-
var import_react_native_theming4 = require("@storybook/react-native-theming");
|
|
1369
|
-
var import_react_native_theming5 = require("@storybook/react-native-theming");
|
|
1370
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1371
|
-
var TabButtonText = import_react_native_theming4.styled.Text(({ theme: theme3, active }) => ({
|
|
1372
|
-
color: active ? theme3.tabs.activeTextColor : theme3.tabs.inactiveTextColor,
|
|
1373
|
-
paddingVertical: theme3.tabs.paddingVertical,
|
|
1374
|
-
paddingHorizontal: theme3.tabs.paddingHorizontal,
|
|
1375
|
-
fontSize: theme3.tabs.fontSize,
|
|
1376
|
-
fontWeight: theme3.tabs.fontWeight
|
|
1377
|
-
}));
|
|
1378
|
-
var hitSlop = { top: 8, left: 0, right: 0, bottom: 20 };
|
|
1379
|
-
var TabButtonTouchable = import_react_native_theming4.styled.TouchableOpacity(({ theme: theme3, active }) => ({
|
|
1380
|
-
borderWidth: theme3.tabs.borderWidth,
|
|
1381
|
-
borderColor: active ? theme3.tabs.activeBorderColor : theme3.tabs.inactiveBorderColor,
|
|
1382
|
-
borderRadius: theme3.tabs.borderRadius,
|
|
1383
|
-
backgroundColor: active ? theme3.tabs.activeBackgroundColor : theme3.tabs.inactiveBackgroundColor
|
|
1384
|
-
}));
|
|
1385
|
-
var TabButton = import_react8.default.memo(({ onPress, id, active, children, testID }) => {
|
|
1386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1387
|
-
TabButtonTouchable,
|
|
1388
|
-
{
|
|
1389
|
-
active,
|
|
1390
|
-
testID,
|
|
1391
|
-
onPress: () => onPress(id),
|
|
1392
|
-
activeOpacity: 0.8,
|
|
1393
|
-
hitSlop,
|
|
1394
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabButtonText, { active, children })
|
|
1395
|
-
}
|
|
1396
|
-
);
|
|
1397
|
-
});
|
|
1398
|
-
var TabBar = import_react8.default.memo(({ scrollable = false, style, children }) => {
|
|
1399
|
-
const theme3 = (0, import_react_native_theming5.useTheme)();
|
|
1400
|
-
if (scrollable) {
|
|
1401
|
-
children = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1402
|
-
import_react_native7.ScrollView,
|
|
1403
|
-
{
|
|
1404
|
-
showsHorizontalScrollIndicator: false,
|
|
1405
|
-
horizontal: true,
|
|
1406
|
-
contentContainerStyle: { paddingHorizontal: theme3.tokens.spacing2 },
|
|
1407
|
-
children
|
|
1408
|
-
}
|
|
1409
|
-
);
|
|
1410
|
-
}
|
|
1411
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.View, { style, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabBarContainer, { children }) });
|
|
1412
|
-
});
|
|
1413
|
-
var TabBarContainer = import_react_native_theming4.styled.View(() => ({
|
|
1414
|
-
flexDirection: "row",
|
|
1415
|
-
paddingVertical: 6,
|
|
1416
|
-
justifyItems: "center"
|
|
1417
|
-
}));
|
|
1418
|
-
|
|
1419
|
-
// src/components/OnDeviceUI/addons/List.tsx
|
|
1420
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1421
|
-
var AddonList = ({ panels, addonSelected, onPressAddon }) => {
|
|
1422
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TabBar, { scrollable: true, children: Object.values(panels).map(({ id, title }) => {
|
|
1423
|
-
let resolvedTitle = typeof title === "function" ? title({}) : title;
|
|
1424
|
-
if (typeof resolvedTitle === "string") {
|
|
1425
|
-
resolvedTitle = resolvedTitle.toUpperCase();
|
|
1426
|
-
}
|
|
1427
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1428
|
-
TabButton,
|
|
1429
|
-
{
|
|
1430
|
-
active: id === addonSelected,
|
|
1431
|
-
id,
|
|
1432
|
-
onPress: () => onPressAddon(id),
|
|
1433
|
-
children: resolvedTitle
|
|
1434
|
-
},
|
|
1435
|
-
id
|
|
1436
|
-
);
|
|
1437
|
-
}) });
|
|
1438
|
-
};
|
|
1439
|
-
var List_default = import_react9.default.memo(AddonList);
|
|
1440
|
-
|
|
1441
|
-
// src/components/OnDeviceUI/addons/Wrapper.tsx
|
|
1442
|
-
var import_react_native_theming6 = require("@storybook/react-native-theming");
|
|
1443
|
-
var import_react10 = __toESM(require("react"));
|
|
1444
|
-
var import_react_native8 = require("react-native");
|
|
1445
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1446
|
-
var Container2 = import_react_native_theming6.styled.View(({ selected }) => ({
|
|
1447
|
-
display: selected ? "flex" : "none",
|
|
1448
|
-
flex: 1
|
|
1449
|
-
}));
|
|
1450
|
-
var Wrapper = ({ panels, addonSelected }) => {
|
|
1451
|
-
useUpdateOnStoryChanged();
|
|
1452
|
-
const theme3 = (0, import_react_native_theming6.useTheme)();
|
|
1453
|
-
const addonKeys = Object.keys(panels);
|
|
1454
|
-
const content = addonKeys.map((id) => {
|
|
1455
|
-
const selected = addonSelected === id;
|
|
1456
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Container2, { selected, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native8.ScrollView, { contentContainerStyle: { padding: theme3.panel.paddingHorizontal }, children: panels[id].render({ active: selected, key: id }) }) }, id);
|
|
1457
|
-
});
|
|
1458
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content });
|
|
1459
|
-
};
|
|
1460
|
-
var Wrapper_default = import_react10.default.memo(Wrapper);
|
|
1461
|
-
|
|
1462
|
-
// src/components/OnDeviceUI/addons/Addons.tsx
|
|
1463
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1464
|
-
var Text4 = import_react_native_theming7.styled.Text(({ theme: theme3 }) => ({
|
|
1465
|
-
marginTop: theme3.tokens.spacing4
|
|
1466
|
-
}));
|
|
1467
|
-
var Addons = ({ active }) => {
|
|
1468
|
-
const panels = import_manager_api.addons.getElements(import_types.Addon_TypesEnum.PANEL);
|
|
1469
|
-
const [addonSelected, setAddonSelected] = useSelectedAddon(Object.keys(panels)[0]);
|
|
1470
|
-
const context = useStoryContext();
|
|
1471
|
-
const id = context?.id;
|
|
1472
|
-
if (!id) {
|
|
1473
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native9.View, { style: { alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text4, { children: "No Story Selected" }) });
|
|
1474
|
-
}
|
|
1475
|
-
if (Object.keys(panels).length === 0) {
|
|
1476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native9.View, { style: { alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text4, { children: "No addons loaded." }) });
|
|
1477
|
-
}
|
|
1478
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native9.View, { style: { flex: 1 }, children: [
|
|
1479
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1480
|
-
List_default,
|
|
1481
|
-
{
|
|
1482
|
-
onPressAddon: setAddonSelected,
|
|
1483
|
-
panels,
|
|
1484
|
-
addonSelected: active ? addonSelected : null
|
|
1485
|
-
}
|
|
1486
|
-
),
|
|
1487
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Wrapper_default, { addonSelected: active ? addonSelected : null, panels })
|
|
1488
|
-
] });
|
|
1489
|
-
};
|
|
1490
|
-
var Addons_default = import_react11.default.memo(Addons);
|
|
1491
|
-
|
|
1492
|
-
// src/components/OnDeviceUI/addons/AddonsSkeleton.tsx
|
|
1493
|
-
var import_react12 = __toESM(require("react"));
|
|
1494
|
-
var import_react_native_theming8 = require("@storybook/react-native-theming");
|
|
1495
|
-
var import_react_native10 = require("react-native");
|
|
1496
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1497
|
-
var AddonsSkeleton = import_react12.default.memo(function AddonsSkeleton2({ visible }) {
|
|
1498
|
-
const progress = import_react12.default.useRef(new import_react_native10.Animated.Value(visible ? 1 : 0));
|
|
1499
|
-
import_react12.default.useEffect(() => {
|
|
1500
|
-
import_react_native10.Animated.timing(progress.current, {
|
|
1501
|
-
toValue: visible ? 1 : 0,
|
|
1502
|
-
duration: ANIMATION_DURATION_TRANSITION,
|
|
1503
|
-
useNativeDriver: true,
|
|
1504
|
-
easing: import_react_native10.Easing.inOut(import_react_native10.Easing.cubic)
|
|
1505
|
-
}).start();
|
|
1506
|
-
}, [visible]);
|
|
1507
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(AddonsSkeletonContainer, { pointerEvents: "none", style: { opacity: progress.current }, children: [
|
|
1508
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TabsSkeleton, {}),
|
|
1509
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AddonsContentSkeleton, {})
|
|
1510
|
-
] });
|
|
1511
|
-
});
|
|
1512
|
-
var TabSkeleton = import_react_native_theming8.styled.View(({ theme: theme3, active }) => ({
|
|
1513
|
-
opacity: active ? 1 : 0.5,
|
|
1514
|
-
backgroundColor: active ? theme3.tabs.activeBackgroundColor : theme3.tokens.color.grey200,
|
|
1515
|
-
borderRadius: theme3.tokens.borderRadius.round,
|
|
1516
|
-
width: active ? 100 : 70,
|
|
1517
|
-
height: 30,
|
|
1518
|
-
marginRight: 12
|
|
1519
|
-
}));
|
|
1520
|
-
var BoxSkeleton = import_react_native_theming8.styled.View(
|
|
1521
|
-
({ theme: theme3, width, height, marginBottom }) => ({
|
|
1522
|
-
backgroundColor: theme3.tokens.color.blue200,
|
|
1523
|
-
borderRadius: theme3.tokens.borderRadius.large,
|
|
1524
|
-
height,
|
|
1525
|
-
marginBottom,
|
|
1526
|
-
width
|
|
1527
|
-
})
|
|
1528
|
-
);
|
|
1529
|
-
function AddonsFieldSkeleton({ long = false }) {
|
|
1530
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native10.View, { style: { marginBottom: 32 }, children: [
|
|
1531
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BoxSkeleton, { width: 75, height: 10, marginBottom: 12 }),
|
|
1532
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BoxSkeleton, { width: long ? 200 : 120, height: 15 })
|
|
1533
|
-
] });
|
|
1534
|
-
}
|
|
1535
|
-
function AddonsContentSkeleton() {
|
|
1536
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1537
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AddonsFieldSkeleton, { long: true }),
|
|
1538
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AddonsFieldSkeleton, { long: true }),
|
|
1539
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AddonsFieldSkeleton, {}),
|
|
1540
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AddonsFieldSkeleton, {})
|
|
1541
|
-
] });
|
|
1542
|
-
}
|
|
1543
|
-
function TabsSkeleton() {
|
|
1544
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native10.View, { style: { flexDirection: "row", marginBottom: 16 }, children: [
|
|
1545
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TabSkeleton, {}),
|
|
1546
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TabSkeleton, { active: true }),
|
|
1547
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TabSkeleton, {})
|
|
1548
|
-
] });
|
|
1549
|
-
}
|
|
1550
|
-
var AddonsSkeletonContainer = (0, import_react_native_theming8.styled)(import_react_native10.Animated.View)(
|
|
1551
|
-
({ theme: theme3 }) => ({
|
|
1552
|
-
...import_react_native10.StyleSheet.absoluteFillObject,
|
|
1553
|
-
flex: 1,
|
|
1554
|
-
backgroundColor: theme3.panel.backgroundColor,
|
|
1555
|
-
borderTopWidth: theme3.panel.borderWidth,
|
|
1556
|
-
borderColor: theme3.panel.borderColor,
|
|
1557
|
-
padding: theme3.panel.paddingHorizontal,
|
|
1558
|
-
overflow: "hidden"
|
|
1559
|
-
})
|
|
1560
|
-
);
|
|
1561
|
-
|
|
1562
|
-
// src/components/OnDeviceUI/animation.ts
|
|
1563
|
-
var import_react_native11 = require("react-native");
|
|
1564
|
-
|
|
1565
|
-
// src/components/OnDeviceUI/navigation/constants.ts
|
|
1566
|
-
var SIDEBAR = -1;
|
|
1567
|
-
var CANVAS = 0;
|
|
1568
|
-
var ADDONS = 1;
|
|
1569
|
-
|
|
1570
|
-
// src/components/OnDeviceUI/animation.ts
|
|
1571
|
-
var RTL_SCALE = import_react_native11.I18nManager.isRTL ? -1 : 1;
|
|
1572
|
-
var PREVIEW_SCALE = 0.3;
|
|
1573
|
-
var PREVIEW_SCALE_WIDE = 0.7;
|
|
1574
|
-
var PREVIEW_SCALE_SHRINK = 0.9;
|
|
1575
|
-
var SCALE_OFFSET = 0.025;
|
|
1576
|
-
var TRANSLATE_Y_OFFSET = 12;
|
|
1577
|
-
var panelWidth = (width, wide) => {
|
|
1578
|
-
const scale = wide ? PREVIEW_SCALE_WIDE : PREVIEW_SCALE;
|
|
1579
|
-
return width * (1 - scale - SCALE_OFFSET);
|
|
1580
|
-
};
|
|
1581
|
-
var getSidebarPanelPosition = (animatedValue, previewWidth, wide) => {
|
|
1582
|
-
return [
|
|
1583
|
-
{
|
|
1584
|
-
transform: [
|
|
1585
|
-
{
|
|
1586
|
-
translateX: animatedValue.interpolate({
|
|
1587
|
-
inputRange: [SIDEBAR, CANVAS],
|
|
1588
|
-
outputRange: [0, (-panelWidth(previewWidth, wide) - 1) * RTL_SCALE]
|
|
1589
|
-
})
|
|
1590
|
-
}
|
|
1591
|
-
],
|
|
1592
|
-
width: panelWidth(previewWidth, wide)
|
|
1593
|
-
}
|
|
1594
|
-
];
|
|
1595
|
-
};
|
|
1596
|
-
var getAddonPanelPosition = (animatedValue, previewWidth, wide) => {
|
|
1597
|
-
return [
|
|
1598
|
-
{
|
|
1599
|
-
transform: [
|
|
1600
|
-
{
|
|
1601
|
-
translateX: animatedValue.interpolate({
|
|
1602
|
-
inputRange: [CANVAS, ADDONS],
|
|
1603
|
-
outputRange: [
|
|
1604
|
-
previewWidth * RTL_SCALE,
|
|
1605
|
-
(previewWidth - panelWidth(previewWidth, wide)) * RTL_SCALE
|
|
1606
|
-
]
|
|
1607
|
-
})
|
|
1608
|
-
}
|
|
1609
|
-
],
|
|
1610
|
-
width: panelWidth(previewWidth, wide)
|
|
1611
|
-
}
|
|
1612
|
-
];
|
|
1613
|
-
};
|
|
1614
|
-
var getPreviewStyle = ({
|
|
1615
|
-
animatedValue,
|
|
1616
|
-
previewDimensions: { width: previewWidth, height: previewHeight },
|
|
1617
|
-
wide,
|
|
1618
|
-
insets,
|
|
1619
|
-
tabOpen,
|
|
1620
|
-
lastTabOpen
|
|
1621
|
-
}) => {
|
|
1622
|
-
const scale = (wide ? PREVIEW_SCALE_WIDE : PREVIEW_SCALE) * PREVIEW_SCALE_SHRINK;
|
|
1623
|
-
const scaledPreviewWidth = previewWidth * scale;
|
|
1624
|
-
const scaledPreviewHeight = previewHeight * scale;
|
|
1625
|
-
const nonPanelWidth = previewWidth - panelWidth(previewWidth, wide);
|
|
1626
|
-
const translateXOffset = (nonPanelWidth - scaledPreviewWidth) / 2;
|
|
1627
|
-
const translateX = (previewWidth / 2 - previewWidth * scale / 2 - translateXOffset) * RTL_SCALE;
|
|
1628
|
-
const translateY = -(previewHeight / 2 - scaledPreviewHeight / 2) + insets.top + TRANSLATE_Y_OFFSET;
|
|
1629
|
-
const skipPreview = lastTabOpen !== CANVAS && tabOpen !== CANVAS;
|
|
1630
|
-
return {
|
|
1631
|
-
transform: [
|
|
1632
|
-
{
|
|
1633
|
-
translateX: animatedValue.interpolate({
|
|
1634
|
-
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
1635
|
-
outputRange: [translateX, 0, -translateX]
|
|
1636
|
-
})
|
|
1637
|
-
},
|
|
1638
|
-
{
|
|
1639
|
-
translateY: animatedValue.interpolate({
|
|
1640
|
-
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
1641
|
-
outputRange: [translateY, skipPreview ? translateY : 0, translateY]
|
|
1642
|
-
})
|
|
1643
|
-
},
|
|
1644
|
-
{
|
|
1645
|
-
scale: animatedValue.interpolate({
|
|
1646
|
-
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
1647
|
-
outputRange: [scale, skipPreview ? scale : 1, scale]
|
|
1648
|
-
})
|
|
1649
|
-
}
|
|
1650
|
-
]
|
|
1651
|
-
};
|
|
1652
|
-
};
|
|
1653
|
-
var getPreviewShadowStyle = (animatedValue) => ({
|
|
1654
|
-
elevation: 8,
|
|
1655
|
-
shadowColor: "#000",
|
|
1656
|
-
shadowOpacity: animatedValue.interpolate({
|
|
1657
|
-
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
1658
|
-
outputRange: [0.25, 0, 0.25]
|
|
1659
|
-
}),
|
|
1660
|
-
shadowRadius: 8,
|
|
1661
|
-
shadowOffset: { width: 0, height: 0 },
|
|
1662
|
-
overflow: "visible"
|
|
1663
|
-
});
|
|
1664
|
-
|
|
1665
|
-
// src/components/OnDeviceUI/navigation/Navigation.tsx
|
|
1666
|
-
var import_react14 = __toESM(require("react"));
|
|
1667
|
-
var import_react_native13 = require("react-native");
|
|
1668
|
-
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
1669
|
-
var import_react_native_swipe_gestures = __toESM(require("react-native-swipe-gestures"));
|
|
1670
|
-
|
|
1671
|
-
// src/components/OnDeviceUI/navigation/NavigationBar.tsx
|
|
1672
|
-
var import_react13 = __toESM(require("react"));
|
|
1673
|
-
var import_react_native_theming9 = require("@storybook/react-native-theming");
|
|
1674
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1675
|
-
var NavigationTabBar = (0, import_react_native_theming9.styled)(TabBar)(({ theme: theme3 }) => ({
|
|
1676
|
-
paddingHorizontal: theme3.tokens.spacing2,
|
|
1677
|
-
backgroundColor: theme3.navigation.backgroundColor,
|
|
1678
|
-
borderColor: theme3.navigation.borderColor,
|
|
1679
|
-
borderTopWidth: theme3.navigation.borderWidth
|
|
1680
|
-
}));
|
|
1681
|
-
var NavigationBar = import_react13.default.memo(({ index, onPress, style }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(NavigationTabBar, { style, children: [
|
|
1682
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1683
|
-
TabButton,
|
|
1684
|
-
{
|
|
1685
|
-
onPress,
|
|
1686
|
-
testID: "BottomMenu.Sidebar",
|
|
1687
|
-
id: SIDEBAR,
|
|
1688
|
-
active: index === SIDEBAR,
|
|
1689
|
-
children: "SIDEBAR"
|
|
1690
|
-
}
|
|
1691
|
-
),
|
|
1692
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TabButton, { onPress, testID: "BottomMenu.Canvas", id: CANVAS, active: index === CANVAS, children: "CANVAS" }),
|
|
1693
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TabButton, { onPress, testID: "BottomMenu.Addons", id: ADDONS, active: index === ADDONS, children: "ADDONS" })
|
|
1694
|
-
] }));
|
|
1695
|
-
|
|
1696
|
-
// src/components/OnDeviceUI/navigation/NavigationButton.tsx
|
|
1697
|
-
var import_react_native12 = require("react-native");
|
|
1698
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1699
|
-
var hitSlop2 = { top: 5, left: 5, right: 5, bottom: 5 };
|
|
1700
|
-
function NavigationButton({ iconName, inverseIconName, active, toggle }) {
|
|
1701
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native12.TouchableWithoutFeedback, { onPress: toggle, hitSlop: hitSlop2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native12.View, { style: { marginHorizontal: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BackgroundIcon, { style: { flex: 1, opacity: 0.8 }, name: inverseIconName, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: iconName, style: { opacity: active ? 0.6 : 0.25 } }) }) }) });
|
|
1702
|
-
}
|
|
1703
|
-
function VisibilityButton() {
|
|
1704
|
-
const [active, toggle] = useIsUIVisible();
|
|
1705
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1706
|
-
NavigationButton,
|
|
1707
|
-
{
|
|
1708
|
-
iconName: "layout-bottom",
|
|
1709
|
-
inverseIconName: "layout-bottom-inverse",
|
|
1710
|
-
active,
|
|
1711
|
-
toggle: () => toggle()
|
|
1712
|
-
}
|
|
1713
|
-
);
|
|
1714
|
-
}
|
|
1715
|
-
function AddonsSplitButton() {
|
|
1716
|
-
const [active, toggle] = useIsSplitPanelVisible();
|
|
1717
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1718
|
-
NavigationButton,
|
|
1719
|
-
{
|
|
1720
|
-
iconName: "layout-split",
|
|
1721
|
-
inverseIconName: "layout-split-inverse",
|
|
1722
|
-
active,
|
|
1723
|
-
toggle: () => toggle()
|
|
1724
|
-
}
|
|
1725
|
-
);
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
// src/components/OnDeviceUI/navigation/Navigation.tsx
|
|
1729
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1730
|
-
var SWIPE_CONFIG = {
|
|
1731
|
-
velocityThreshold: 0.2,
|
|
1732
|
-
directionalOffsetThreshold: 80
|
|
1733
|
-
};
|
|
1734
|
-
var navStyle = {
|
|
1735
|
-
position: "absolute",
|
|
1736
|
-
left: 0,
|
|
1737
|
-
right: 0,
|
|
1738
|
-
bottom: 0
|
|
1739
|
-
};
|
|
1740
|
-
var Navigation = ({ tabOpen, onChangeTab, onLayout }) => {
|
|
1741
|
-
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1742
|
-
const handleSwipeLeft = () => {
|
|
1743
|
-
if (tabOpen < 1) {
|
|
1744
|
-
onChangeTab(tabOpen + 1);
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
const handleSwipeRight = () => {
|
|
1748
|
-
if (tabOpen > -1) {
|
|
1749
|
-
onChangeTab(tabOpen - 1);
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
const [isUIVisible] = useIsUIVisible();
|
|
1753
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native13.View, { style: navStyle, onLayout, children: [
|
|
1754
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native13.View, { children: isUIVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1755
|
-
import_react_native_swipe_gestures.default,
|
|
1756
|
-
{
|
|
1757
|
-
onSwipeLeft: handleSwipeLeft,
|
|
1758
|
-
onSwipeRight: handleSwipeRight,
|
|
1759
|
-
config: SWIPE_CONFIG,
|
|
1760
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1761
|
-
NavigationBar,
|
|
1762
|
-
{
|
|
1763
|
-
index: tabOpen,
|
|
1764
|
-
onPress: onChangeTab,
|
|
1765
|
-
style: { paddingBottom: insets.bottom }
|
|
1766
|
-
}
|
|
1767
|
-
)
|
|
1768
|
-
}
|
|
1769
|
-
) }),
|
|
1770
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(NavigationShortcuts, { children: [
|
|
1771
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VisibilityButton, {}),
|
|
1772
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AddonsSplitButton, {})
|
|
1773
|
-
] })
|
|
1774
|
-
] });
|
|
1775
|
-
};
|
|
1776
|
-
var Navigation_default = import_react14.default.memo(Navigation);
|
|
1777
|
-
function NavigationShortcuts({ children }) {
|
|
1778
|
-
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1780
|
-
import_react_native13.View,
|
|
1781
|
-
{
|
|
1782
|
-
style: {
|
|
1783
|
-
zIndex: 100,
|
|
1784
|
-
alignSelf: "center",
|
|
1785
|
-
justifyContent: "center",
|
|
1786
|
-
alignItems: "center",
|
|
1787
|
-
flexDirection: "row-reverse",
|
|
1788
|
-
position: "absolute",
|
|
1789
|
-
bottom: insets.bottom + 14,
|
|
1790
|
-
right: 8
|
|
1791
|
-
},
|
|
1792
|
-
children
|
|
1793
|
-
}
|
|
1794
|
-
);
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
// src/components/OnDeviceUI/OnDeviceUI.tsx
|
|
1798
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1799
|
-
var IS_IOS = import_react_native14.Platform.OS === "ios";
|
|
1800
|
-
var getExpoRoot = () => global.Expo || global.__expo || global.__exponent;
|
|
1801
|
-
var IS_EXPO = getExpoRoot() !== void 0;
|
|
1802
|
-
var IS_ANDROID = import_react_native14.Platform.OS === "android";
|
|
1803
|
-
var BREAKPOINT = 1024;
|
|
1804
|
-
var flex = { flex: 1 };
|
|
1805
|
-
function Preview({ animatedValue, style, children }) {
|
|
1806
|
-
const theme3 = (0, import_react_native_theming11.useTheme)();
|
|
1807
|
-
const containerStyle = {
|
|
1808
|
-
backgroundColor: theme3.preview.backgroundColor,
|
|
1809
|
-
...getPreviewShadowStyle(animatedValue)
|
|
1810
|
-
};
|
|
1811
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native14.Animated.View, { style: [flex, containerStyle], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native14.View, { style: [flex, style], children }) });
|
|
1812
|
-
}
|
|
1813
|
-
var styles3 = import_react_native14.StyleSheet.create({
|
|
1814
|
-
expoAndroidContainer: { paddingTop: import_react_native14.StatusBar.currentHeight }
|
|
1815
|
-
});
|
|
1816
|
-
var Container3 = import_react_native_theming10.styled.View(({ theme: theme3 }) => ({
|
|
1817
|
-
flex: 1,
|
|
1818
|
-
backgroundColor: theme3.preview.containerBackgroundColor,
|
|
1819
|
-
...IS_ANDROID && IS_EXPO ? styles3.expoAndroidContainer : void 0,
|
|
1820
|
-
...import_react_native14.Platform.select({ web: { overflow: "hidden" } })
|
|
1821
|
-
}));
|
|
1822
|
-
var OnDeviceUI = ({
|
|
1823
|
-
storyIndex,
|
|
1824
|
-
shouldDisableKeyboardAvoidingView,
|
|
1825
|
-
keyboardAvoidingViewVerticalOffset,
|
|
1826
|
-
tabOpen: initialTabOpen
|
|
1827
|
-
}) => {
|
|
1828
|
-
const [tabOpen, setTabOpen] = (0, import_react15.useState)(initialTabOpen || CANVAS);
|
|
1829
|
-
const lastTabOpen = import_react15.default.useRef(tabOpen);
|
|
1830
|
-
const [previewDimensions, setPreviewDimensions] = (0, import_react15.useState)(() => ({
|
|
1831
|
-
width: import_react_native14.Dimensions.get("window").width,
|
|
1832
|
-
height: import_react_native14.Dimensions.get("window").height
|
|
1833
|
-
}));
|
|
1834
|
-
const animatedValue = (0, import_react15.useRef)(new import_react_native14.Animated.Value(tabOpen));
|
|
1835
|
-
const wide = (0, import_react_native15.useWindowDimensions)().width >= BREAKPOINT;
|
|
1836
|
-
const insets = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
1837
|
-
const handleToggleTab = import_react15.default.useCallback(
|
|
1838
|
-
(newTabOpen) => {
|
|
1839
|
-
if (newTabOpen === tabOpen) {
|
|
1840
|
-
return;
|
|
1841
|
-
}
|
|
1842
|
-
lastTabOpen.current = tabOpen;
|
|
1843
|
-
import_react_native14.Animated.timing(animatedValue.current, {
|
|
1844
|
-
toValue: newTabOpen,
|
|
1845
|
-
duration: ANIMATION_DURATION_TRANSITION,
|
|
1846
|
-
easing: import_react_native14.Easing.inOut(import_react_native14.Easing.cubic),
|
|
1847
|
-
useNativeDriver: true
|
|
1848
|
-
}).start();
|
|
1849
|
-
setTabOpen(newTabOpen);
|
|
1850
|
-
if (newTabOpen === CANVAS) {
|
|
1851
|
-
import_react_native14.Keyboard.dismiss();
|
|
1852
|
-
}
|
|
1853
|
-
},
|
|
1854
|
-
[tabOpen]
|
|
1855
|
-
);
|
|
1856
|
-
const noSafeArea = useStoryContextParam("noSafeArea", false);
|
|
1857
|
-
const previewWrapperStyles = [
|
|
1858
|
-
flex,
|
|
1859
|
-
getPreviewStyle({
|
|
1860
|
-
animatedValue: animatedValue.current,
|
|
1861
|
-
previewDimensions,
|
|
1862
|
-
wide,
|
|
1863
|
-
insets,
|
|
1864
|
-
tabOpen,
|
|
1865
|
-
lastTabOpen: lastTabOpen.current
|
|
1866
|
-
})
|
|
1867
|
-
];
|
|
1868
|
-
const [isUIVisible] = useIsUIVisible();
|
|
1869
|
-
const [navBarHeight, setNavBarHeight] = import_react15.default.useState(insets.bottom + 40);
|
|
1870
|
-
const measureNavigation = import_react15.default.useCallback(
|
|
1871
|
-
({ nativeEvent }) => {
|
|
1872
|
-
const inset = insets.bottom;
|
|
1873
|
-
setNavBarHeight(isUIVisible ? nativeEvent.layout.height - inset : 0);
|
|
1874
|
-
},
|
|
1875
|
-
[isUIVisible, insets]
|
|
1876
|
-
);
|
|
1877
|
-
const safeAreaMargins = {
|
|
1878
|
-
paddingBottom: isUIVisible ? insets.bottom + navBarHeight : noSafeArea ? 0 : insets.bottom,
|
|
1879
|
-
paddingTop: !noSafeArea ? insets.top : 0,
|
|
1880
|
-
overflow: "hidden"
|
|
1881
|
-
};
|
|
1882
|
-
const panelSafeAreaMargins = {
|
|
1883
|
-
paddingBottom: insets.bottom + navBarHeight,
|
|
1884
|
-
paddingTop: insets.top
|
|
1885
|
-
};
|
|
1886
|
-
const keyboardVerticalOffset = -panelSafeAreaMargins.paddingBottom + (keyboardAvoidingViewVerticalOffset ?? 0);
|
|
1887
|
-
const [isSplitPanelVisible] = useIsSplitPanelVisible();
|
|
1888
|
-
const isPreviewInactive = tabOpen !== CANVAS;
|
|
1889
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Container3, { children: [
|
|
1890
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1891
|
-
import_react_native14.KeyboardAvoidingView,
|
|
1892
|
-
{
|
|
1893
|
-
enabled: !shouldDisableKeyboardAvoidingView || isPreviewInactive,
|
|
1894
|
-
behavior: IS_IOS ? "padding" : null,
|
|
1895
|
-
keyboardVerticalOffset,
|
|
1896
|
-
style: flex,
|
|
1897
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1898
|
-
absolute_positioned_keyboard_aware_view_default,
|
|
1899
|
-
{
|
|
1900
|
-
onLayout: setPreviewDimensions,
|
|
1901
|
-
previewDimensions,
|
|
1902
|
-
children: [
|
|
1903
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native14.Animated.View, { style: previewWrapperStyles, children: [
|
|
1904
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Preview, { style: safeAreaMargins, animatedValue: animatedValue.current, children: [
|
|
1905
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StoryView_default, {}),
|
|
1906
|
-
isSplitPanelVisible ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Panel_default, { edge: "top", style: { flex: 1 }, children: [
|
|
1907
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Addons_default, { active: true }),
|
|
1908
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddonsSkeleton, { visible: isPreviewInactive })
|
|
1909
|
-
] }) : null
|
|
1910
|
-
] }),
|
|
1911
|
-
isPreviewInactive ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1912
|
-
import_react_native14.TouchableOpacity,
|
|
1913
|
-
{
|
|
1914
|
-
style: import_react_native14.StyleSheet.absoluteFillObject,
|
|
1915
|
-
onPress: () => handleToggleTab(CANVAS)
|
|
1916
|
-
}
|
|
1917
|
-
) : null
|
|
1918
|
-
] }),
|
|
1919
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1920
|
-
Panel_default,
|
|
1921
|
-
{
|
|
1922
|
-
edge: "right",
|
|
1923
|
-
style: [
|
|
1924
|
-
getSidebarPanelPosition(animatedValue.current, previewDimensions.width, wide),
|
|
1925
|
-
panelSafeAreaMargins
|
|
1926
|
-
],
|
|
1927
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StoryListView_default, { storyIndex })
|
|
1928
|
-
}
|
|
1929
|
-
),
|
|
1930
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1931
|
-
Panel_default,
|
|
1932
|
-
{
|
|
1933
|
-
edge: "left",
|
|
1934
|
-
style: [
|
|
1935
|
-
getAddonPanelPosition(animatedValue.current, previewDimensions.width, wide),
|
|
1936
|
-
panelSafeAreaMargins
|
|
1937
|
-
],
|
|
1938
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Addons_default, { active: tabOpen === ADDONS })
|
|
1939
|
-
}
|
|
1940
|
-
)
|
|
1941
|
-
]
|
|
1942
|
-
}
|
|
1943
|
-
)
|
|
1944
|
-
}
|
|
1945
|
-
),
|
|
1946
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Navigation_default, { onLayout: measureNavigation, tabOpen, onChangeTab: handleToggleTab })
|
|
1947
|
-
] }) });
|
|
1948
|
-
};
|
|
1949
|
-
var OnDeviceUI_default = import_react15.default.memo(OnDeviceUI);
|
|
1950
|
-
|
|
1951
|
-
// src/View.tsx
|
|
1952
|
-
var import_channels = require("@storybook/channels");
|
|
1953
|
-
var import_core_events2 = __toESM(require("@storybook/core-events"));
|
|
1954
|
-
var import_dedent = __toESM(require("dedent"));
|
|
1955
|
-
var import_deepmerge = __toESM(require("deepmerge"));
|
|
1956
|
-
var import_react_native16 = require("react-native");
|
|
1957
|
-
|
|
1958
|
-
// src/rn-host-detect.js
|
|
1959
|
-
function getByRemoteConfig(hostname) {
|
|
1960
|
-
var remoteModuleConfig = window?.__fbBatchedBridgeConfig?.remoteModuleConfig;
|
|
1961
|
-
if (!Array.isArray(remoteModuleConfig) || hostname !== "localhost" && hostname !== "127.0.0.1") {
|
|
1962
|
-
return { hostname, passed: false };
|
|
1963
|
-
}
|
|
1964
|
-
var constants = (remoteModuleConfig.find(getConstants) || [])[1];
|
|
1965
|
-
if (constants) {
|
|
1966
|
-
var serverHost = constants.ServerHost || hostname;
|
|
1967
|
-
return { hostname: serverHost.split(":")[0], passed: true };
|
|
1968
|
-
}
|
|
1969
|
-
return { hostname, passed: false };
|
|
1970
|
-
}
|
|
1971
|
-
function getConstants(config) {
|
|
1972
|
-
return config && (config[0] === "AndroidConstants" || config[0] === "PlatformConstants");
|
|
1973
|
-
}
|
|
1974
|
-
function getByRNRequirePolyfill(hostname) {
|
|
1975
|
-
var NativeModules;
|
|
1976
|
-
var PlatformConstants;
|
|
1977
|
-
var AndroidConstants;
|
|
1978
|
-
if (typeof window === "undefined" || !window.__DEV__ || typeof window.require !== "function" || // RN >= 0.56
|
|
1979
|
-
// TODO: Get NativeModules for RN >= 0.56
|
|
1980
|
-
window.require.name === "metroRequire") {
|
|
1981
|
-
return hostname;
|
|
1982
|
-
}
|
|
1983
|
-
NativeModules = window.require("NativeModules");
|
|
1984
|
-
if (!NativeModules || !NativeModules.PlatformConstants && !NativeModules.AndroidConstants) {
|
|
1985
|
-
return hostname;
|
|
1986
|
-
}
|
|
1987
|
-
PlatformConstants = NativeModules.PlatformConstants;
|
|
1988
|
-
AndroidConstants = NativeModules.AndroidConstants;
|
|
1989
|
-
var serverHost = (PlatformConstants ? PlatformConstants.ServerHost : AndroidConstants.ServerHost) || hostname;
|
|
1990
|
-
return serverHost.split(":")[0];
|
|
1991
|
-
}
|
|
1992
|
-
function getHost(hostname) {
|
|
1993
|
-
if (typeof __fbBatchedBridge !== "object" || hostname !== "localhost" && hostname !== "127.0.0.1") {
|
|
1994
|
-
return hostname;
|
|
1995
|
-
}
|
|
1996
|
-
var result = getByRemoteConfig(hostname);
|
|
1997
|
-
if (result.passed) {
|
|
1998
|
-
return result.hostname;
|
|
1999
|
-
}
|
|
2000
|
-
return getByRNRequirePolyfill(hostname);
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
// src/View.tsx
|
|
2004
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2005
|
-
var STORAGE_KEY = "lastOpenedStory";
|
|
2006
|
-
var View10 = class {
|
|
2007
|
-
_storyIndex;
|
|
2008
|
-
_setStory = () => {
|
|
2009
|
-
};
|
|
2010
|
-
_forceRerender;
|
|
2011
|
-
_ready = false;
|
|
2012
|
-
_preview;
|
|
2013
|
-
_asyncStorageStoryId;
|
|
2014
|
-
_webUrl;
|
|
2015
|
-
_storage;
|
|
2016
|
-
_channel;
|
|
2017
|
-
_idToPrepared = {};
|
|
2018
|
-
constructor(preview, channel) {
|
|
2019
|
-
this._preview = preview;
|
|
2020
|
-
this._channel = channel;
|
|
2021
|
-
}
|
|
2022
|
-
_getInitialStory = async ({
|
|
2023
|
-
initialSelection,
|
|
2024
|
-
shouldPersistSelection = true
|
|
2025
|
-
} = {}) => {
|
|
2026
|
-
if (initialSelection) {
|
|
2027
|
-
if (typeof initialSelection === "string") {
|
|
2028
|
-
return { storySpecifier: initialSelection, viewMode: "story" };
|
|
2029
|
-
} else {
|
|
2030
|
-
return {
|
|
2031
|
-
storySpecifier: (0, import_csf.toId)(initialSelection.kind, initialSelection.name),
|
|
2032
|
-
viewMode: "story"
|
|
2033
|
-
};
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
if (shouldPersistSelection) {
|
|
2037
|
-
try {
|
|
2038
|
-
let value = this._asyncStorageStoryId;
|
|
2039
|
-
if (!value && this._storage != null) {
|
|
2040
|
-
value = await this._storage.getItem(STORAGE_KEY);
|
|
2041
|
-
this._asyncStorageStoryId = value;
|
|
2042
|
-
}
|
|
2043
|
-
const exists = value && Object.keys(this._storyIndex.entries).includes(value);
|
|
2044
|
-
if (!exists)
|
|
2045
|
-
console.log("Storybook: could not find persisted story");
|
|
2046
|
-
return { storySpecifier: exists ? value : "*", viewMode: "story" };
|
|
2047
|
-
} catch (e) {
|
|
2048
|
-
console.warn("storybook-log: error reading from async storage", e);
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
return { storySpecifier: "*", viewMode: "story" };
|
|
2052
|
-
};
|
|
2053
|
-
_getServerChannel = (params = {}) => {
|
|
2054
|
-
const host = getHost(params.host || "localhost");
|
|
2055
|
-
const port = `:${params.port || 7007}`;
|
|
2056
|
-
const query = params.query || "";
|
|
2057
|
-
const websocketType = params.secured ? "wss" : "ws";
|
|
2058
|
-
const url = `${websocketType}://${host}${port}/${query}`;
|
|
2059
|
-
return (0, import_channels.createWebSocketChannel)({
|
|
2060
|
-
url,
|
|
2061
|
-
async: true,
|
|
2062
|
-
onError: async () => {
|
|
2063
|
-
}
|
|
2064
|
-
});
|
|
2065
|
-
};
|
|
2066
|
-
createPreparedStoryMapping = async () => {
|
|
2067
|
-
await Promise.all(
|
|
2068
|
-
Object.keys(this._storyIndex.entries).map(async (storyId) => {
|
|
2069
|
-
this._idToPrepared[storyId] = await this._preview.storyStore.loadStory({ storyId });
|
|
2070
|
-
})
|
|
2071
|
-
);
|
|
2072
|
-
console.log("Storybook: Finished building story index");
|
|
2073
|
-
};
|
|
2074
|
-
getStorybookUI = (params = {}) => {
|
|
2075
|
-
const {
|
|
2076
|
-
shouldPersistSelection = true,
|
|
2077
|
-
onDeviceUI = true,
|
|
2078
|
-
enableWebsockets = false,
|
|
2079
|
-
storage
|
|
2080
|
-
} = params;
|
|
2081
|
-
this._storage = storage;
|
|
2082
|
-
const initialStory = this._getInitialStory(params);
|
|
2083
|
-
if (enableWebsockets) {
|
|
2084
|
-
const channel = this._getServerChannel(params);
|
|
2085
|
-
import_manager_api2.addons.setChannel(channel);
|
|
2086
|
-
import_preview_api2.addons.setChannel(channel);
|
|
2087
|
-
this._channel = channel;
|
|
2088
|
-
this._preview.channel = channel;
|
|
2089
|
-
this._preview.setupListeners();
|
|
2090
|
-
channel.emit(import_core_events2.default.CHANNEL_CREATED);
|
|
2091
|
-
this._preview.initializeWithStoryIndex(this._storyIndex);
|
|
2092
|
-
}
|
|
2093
|
-
import_manager_api2.addons.loadAddons({
|
|
2094
|
-
store: () => ({
|
|
2095
|
-
fromId: (id) => {
|
|
2096
|
-
if (!this._ready) {
|
|
2097
|
-
throw new Error("Storybook is not ready yet");
|
|
2098
|
-
}
|
|
2099
|
-
return this._preview.storyStore.getStoryContext(this._idToPrepared[id]);
|
|
2100
|
-
},
|
|
2101
|
-
getSelection: () => {
|
|
2102
|
-
return this._preview.currentSelection;
|
|
2103
|
-
},
|
|
2104
|
-
_channel: this._channel
|
|
2105
|
-
})
|
|
2106
|
-
});
|
|
2107
|
-
const self = this;
|
|
2108
|
-
syncExternalUI({
|
|
2109
|
-
isUIVisible: params.isUIHidden !== void 0 ? !params.isUIHidden : void 0,
|
|
2110
|
-
isSplitPanelVisible: params.isSplitPanelVisible
|
|
2111
|
-
});
|
|
2112
|
-
return () => {
|
|
2113
|
-
const setContext = useSetStoryContext();
|
|
2114
|
-
const colorScheme = (0, import_react_native16.useColorScheme)();
|
|
2115
|
-
const [, forceUpdate] = (0, import_react16.useReducer)((x) => x + 1, 0);
|
|
2116
|
-
const [ready, setReady] = (0, import_react16.useState)(false);
|
|
2117
|
-
const appliedTheme = (0, import_react16.useMemo)(
|
|
2118
|
-
() => (0, import_deepmerge.default)(colorScheme === "dark" ? import_react_native_theming12.darkTheme : import_react_native_theming12.theme, params.theme ?? {}),
|
|
2119
|
-
[colorScheme]
|
|
2120
|
-
);
|
|
2121
|
-
(0, import_react16.useEffect)(() => {
|
|
2122
|
-
this.createPreparedStoryMapping().then(() => {
|
|
2123
|
-
this._ready = true;
|
|
2124
|
-
setReady(true);
|
|
2125
|
-
}).catch((e) => console.error(e));
|
|
2126
|
-
self._setStory = (newStory) => {
|
|
2127
|
-
setContext(newStory);
|
|
2128
|
-
if (shouldPersistSelection && !storage) {
|
|
2129
|
-
console.warn(import_dedent.default`Please set storage in getStorybookUI like this:
|
|
2130
|
-
const StorybookUIRoot = view.getStorybookUI({
|
|
2131
|
-
storage: {
|
|
2132
|
-
getItem: AsyncStorage.getItem,
|
|
2133
|
-
setItem: AsyncStorage.setItem,
|
|
2134
|
-
},
|
|
2135
|
-
});
|
|
2136
|
-
`);
|
|
2137
|
-
}
|
|
2138
|
-
if (shouldPersistSelection && !!this._storage) {
|
|
2139
|
-
this._storage.setItem(STORAGE_KEY, newStory.id).catch((e) => {
|
|
2140
|
-
console.warn("storybook-log: error writing to async storage", e);
|
|
2141
|
-
});
|
|
2142
|
-
}
|
|
2143
|
-
};
|
|
2144
|
-
self._forceRerender = () => forceUpdate();
|
|
2145
|
-
initialStory.then((story) => {
|
|
2146
|
-
self._preview.selectionStore.selectionSpecifier = story;
|
|
2147
|
-
self._preview.selectSpecifiedStory();
|
|
2148
|
-
});
|
|
2149
|
-
}, []);
|
|
2150
|
-
if (!ready) {
|
|
2151
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2152
|
-
import_react_native16.View,
|
|
2153
|
-
{
|
|
2154
|
-
style: {
|
|
2155
|
-
...import_react_native16.StyleSheet.absoluteFillObject,
|
|
2156
|
-
alignItems: "center",
|
|
2157
|
-
justifyContent: "center"
|
|
2158
|
-
},
|
|
2159
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native16.ActivityIndicator, { animating: true, size: "large" })
|
|
2160
|
-
}
|
|
2161
|
-
);
|
|
2162
|
-
}
|
|
2163
|
-
if (onDeviceUI) {
|
|
2164
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native_safe_area_context3.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native_theming12.ThemeProvider, { theme: appliedTheme, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2165
|
-
OnDeviceUI_default,
|
|
2166
|
-
{
|
|
2167
|
-
storyIndex: self._storyIndex,
|
|
2168
|
-
tabOpen: params.tabOpen,
|
|
2169
|
-
shouldDisableKeyboardAvoidingView: params.shouldDisableKeyboardAvoidingView,
|
|
2170
|
-
keyboardAvoidingViewVerticalOffset: params.keyboardAvoidingViewVerticalOffset
|
|
2171
|
-
}
|
|
2172
|
-
) }) });
|
|
2173
|
-
} else {
|
|
2174
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StoryView_default, {});
|
|
2175
|
-
}
|
|
2176
|
-
};
|
|
2177
|
-
};
|
|
2178
|
-
};
|
|
2179
|
-
|
|
2180
|
-
// src/executeLoadable.ts
|
|
2181
|
-
var import_client_logger = require("@storybook/client-logger");
|
|
2182
|
-
function executeLoadable(loadable) {
|
|
2183
|
-
let reqs = null;
|
|
2184
|
-
if (Array.isArray(loadable)) {
|
|
2185
|
-
reqs = loadable;
|
|
2186
|
-
} else if (loadable.keys) {
|
|
2187
|
-
reqs = [loadable];
|
|
2188
|
-
}
|
|
2189
|
-
let exportsMap = /* @__PURE__ */ new Map();
|
|
2190
|
-
if (reqs) {
|
|
2191
|
-
reqs.forEach((req) => {
|
|
2192
|
-
req.keys().forEach((filename) => {
|
|
2193
|
-
try {
|
|
2194
|
-
const fileExports = req(filename);
|
|
2195
|
-
if (fileExports.default) {
|
|
2196
|
-
exportsMap.set(
|
|
2197
|
-
// NOTE context.resolve is not yet implemented for metro
|
|
2198
|
-
// typeof req.resolve === 'function' ? req.resolve(filename) : filename,
|
|
2199
|
-
filename,
|
|
2200
|
-
fileExports
|
|
2201
|
-
);
|
|
2202
|
-
}
|
|
2203
|
-
} catch (error) {
|
|
2204
|
-
const errorString = error.message && error.stack ? `${error.message}
|
|
2205
|
-
${error.stack}` : error.toString();
|
|
2206
|
-
import_client_logger.logger.error(`Unexpected error while loading ${filename}: ${errorString}`);
|
|
2207
|
-
}
|
|
2208
|
-
});
|
|
2209
|
-
});
|
|
2210
|
-
} else {
|
|
2211
|
-
const exported = loadable();
|
|
2212
|
-
if (typeof exported === "object") {
|
|
2213
|
-
const csfExports = Object.entries(exported).filter(
|
|
2214
|
-
([_key, value]) => value.default != null
|
|
2215
|
-
);
|
|
2216
|
-
exportsMap = new Map(csfExports.map(([filePath, fileExports]) => [filePath, fileExports]));
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
return exportsMap;
|
|
2220
|
-
}
|
|
2221
|
-
global.lastExportsMap = /* @__PURE__ */ new Map();
|
|
2222
|
-
function executeLoadableForChanges(loadable, m) {
|
|
2223
|
-
if (m?.hot?.accept) {
|
|
2224
|
-
m.hot.accept();
|
|
2225
|
-
}
|
|
2226
|
-
const lastExportsMap = global.lastExportsMap;
|
|
2227
|
-
const exportsMap = executeLoadable(loadable);
|
|
2228
|
-
const added = /* @__PURE__ */ new Map();
|
|
2229
|
-
Array.from(exportsMap.entries()).filter(([, fileExports]) => !!fileExports.default).filter(([fileName, fileExports]) => lastExportsMap.get(fileName) !== fileExports).forEach(([fileName, fileExports]) => added.set(fileName, fileExports));
|
|
2230
|
-
const removed = /* @__PURE__ */ new Map();
|
|
2231
|
-
Array.from(lastExportsMap.keys()).filter((fileName) => !exportsMap.has(fileName)).forEach((fileName) => removed.set(fileName, lastExportsMap.get(fileName)));
|
|
2232
|
-
global.lastExportsMap = exportsMap;
|
|
2233
|
-
return { added, removed };
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
// src/StartV6.tsx
|
|
2237
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2238
|
-
import_global.global.FEATURES = {
|
|
2239
|
-
storyStoreV7: false
|
|
2240
|
-
};
|
|
2241
|
-
var render = (args, context) => {
|
|
2242
|
-
const { id, component: Component } = context;
|
|
2243
|
-
if (!Component) {
|
|
2244
|
-
throw new Error(
|
|
2245
|
-
`Unable to render story ${id} as the component annotation is missing from the default export`
|
|
2246
|
-
);
|
|
2247
|
-
}
|
|
2248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Component, { ...args });
|
|
2249
|
-
};
|
|
2250
|
-
function start() {
|
|
2251
|
-
const channel = new import_channels2.Channel({ async: true });
|
|
2252
|
-
import_manager_api3.addons.setChannel(channel);
|
|
2253
|
-
channel.emit(import_core_events3.default.CHANNEL_CREATED);
|
|
2254
|
-
const clientApi2 = import_global.global?.__STORYBOOK_CLIENT_API__ || new import_preview_api3.ClientApi();
|
|
2255
|
-
const previewView = {
|
|
2256
|
-
prepareForStory: () => {
|
|
2257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, {});
|
|
2258
|
-
},
|
|
2259
|
-
prepareForDocs: () => {
|
|
2260
|
-
},
|
|
2261
|
-
showErrorDisplay: () => {
|
|
2262
|
-
},
|
|
2263
|
-
showDocs: () => {
|
|
2264
|
-
},
|
|
2265
|
-
showMain: () => {
|
|
2266
|
-
},
|
|
2267
|
-
showNoPreview: () => {
|
|
2268
|
-
},
|
|
2269
|
-
showPreparingDocs: () => {
|
|
2270
|
-
},
|
|
2271
|
-
showPreparingStory: () => {
|
|
2272
|
-
},
|
|
2273
|
-
showStory: () => {
|
|
2274
|
-
},
|
|
2275
|
-
showStoryDuringRender: () => {
|
|
2276
|
-
}
|
|
2277
|
-
};
|
|
2278
|
-
const urlStore = {
|
|
2279
|
-
selection: null,
|
|
2280
|
-
selectionSpecifier: null,
|
|
2281
|
-
setQueryParams: () => {
|
|
2282
|
-
},
|
|
2283
|
-
setSelection: (selection) => {
|
|
2284
|
-
console.log("setSelection");
|
|
2285
|
-
preview.selectionStore.selection = selection;
|
|
2286
|
-
}
|
|
2287
|
-
};
|
|
2288
|
-
const preview = import_global.global?.__STORYBOOK_PREVIEW__ || new import_preview_web.PreviewWithSelection(urlStore, previewView);
|
|
2289
|
-
clientApi2.storyStore = preview.storyStore;
|
|
2290
|
-
if (import_global.global) {
|
|
2291
|
-
import_global.global.__STORYBOOK_CLIENT_API__ = clientApi2;
|
|
2292
|
-
import_global.global.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
|
2293
|
-
import_global.global.__STORYBOOK_PREVIEW__ = preview;
|
|
2294
|
-
import_global.global.__STORYBOOK_STORY_STORE__ = preview.storyStore;
|
|
2295
|
-
}
|
|
2296
|
-
(0, import_preview_api3.setGlobalRender)(render);
|
|
2297
|
-
let initialized = false;
|
|
2298
|
-
function onStoriesChanged() {
|
|
2299
|
-
const storyIndex = clientApi2.getStoryIndex();
|
|
2300
|
-
preview.onStoriesChanged({ storyIndex });
|
|
2301
|
-
view2._storyIndex = storyIndex;
|
|
2302
|
-
}
|
|
2303
|
-
const view2 = new View10(preview, channel);
|
|
2304
|
-
return {
|
|
2305
|
-
view: view2,
|
|
2306
|
-
forceReRender: () => channel.emit(import_core_events3.default.FORCE_RE_RENDER),
|
|
2307
|
-
clientApi: clientApi2,
|
|
2308
|
-
preview,
|
|
2309
|
-
// This gets called each time the user calls configure (i.e. once per HMR)
|
|
2310
|
-
// The first time, it constructs thecurrentSelection preview, subsequently it updates it
|
|
2311
|
-
configure(loadable, m) {
|
|
2312
|
-
clientApi2.addParameters({ renderer: "react-native" });
|
|
2313
|
-
const getProjectAnnotations = () => {
|
|
2314
|
-
const { added, removed } = executeLoadableForChanges(loadable, m);
|
|
2315
|
-
clientApi2._loadAddedExports();
|
|
2316
|
-
Array.from(added.entries()).forEach(
|
|
2317
|
-
([fileName, fileExports]) => clientApi2.facade.addStoriesFromExports(fileName, fileExports)
|
|
2318
|
-
);
|
|
2319
|
-
Array.from(removed.entries()).forEach(
|
|
2320
|
-
([fileName]) => clientApi2.facade.clearFilenameExports(fileName)
|
|
2321
|
-
);
|
|
2322
|
-
return {
|
|
2323
|
-
...clientApi2.facade.projectAnnotations,
|
|
2324
|
-
renderToCanvas: (context) => {
|
|
2325
|
-
view2._setStory(context.storyContext);
|
|
2326
|
-
}
|
|
2327
|
-
};
|
|
2328
|
-
};
|
|
2329
|
-
const importFn = (path) => clientApi2.importFn(path);
|
|
2330
|
-
if (!initialized) {
|
|
2331
|
-
preview.initialize({
|
|
2332
|
-
getStoryIndex: () => {
|
|
2333
|
-
const index = clientApi2.getStoryIndex();
|
|
2334
|
-
view2._storyIndex = index;
|
|
2335
|
-
return index;
|
|
2336
|
-
},
|
|
2337
|
-
importFn,
|
|
2338
|
-
getProjectAnnotations
|
|
2339
|
-
});
|
|
2340
|
-
initialized = true;
|
|
2341
|
-
} else {
|
|
2342
|
-
getProjectAnnotations();
|
|
2343
|
-
onStoriesChanged();
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
};
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
// src/V6.ts
|
|
2350
|
-
var import_react_native_theming13 = require("@storybook/react-native-theming");
|
|
2351
|
-
var { clientApi, configure, view } = start();
|
|
2352
|
-
var rawStoriesOf = clientApi.storiesOf.bind(clientApi);
|
|
2353
|
-
var addDecorator = clientApi.addDecorator.bind(clientApi);
|
|
2354
|
-
var addParameters = clientApi.addParameters.bind(clientApi);
|
|
2355
|
-
var addArgsEnhancer = clientApi.addArgsEnhancer.bind(clientApi);
|
|
2356
|
-
var addArgTypesEnhancer = clientApi.addArgTypesEnhancer.bind(clientApi);
|
|
2357
|
-
var raw = clientApi.raw.bind(clientApi);
|
|
2358
|
-
var storiesOf = (kind, m) => {
|
|
2359
|
-
return rawStoriesOf(kind, m).addParameters({
|
|
2360
|
-
renderer: "react-native"
|
|
2361
|
-
});
|
|
2362
|
-
};
|
|
2363
|
-
var getStorybookUI = view.getStorybookUI;
|
|
2364
|
-
global.__STORYBOOK_STORY_STORE__ = {
|
|
2365
|
-
initializationPromise: clientApi.storyStore?.initializationPromise
|
|
2366
|
-
};
|
|
2367
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2368
|
-
0 && (module.exports = {
|
|
2369
|
-
addArgTypesEnhancer,
|
|
2370
|
-
addArgsEnhancer,
|
|
2371
|
-
addDecorator,
|
|
2372
|
-
addParameters,
|
|
2373
|
-
configure,
|
|
2374
|
-
darkTheme,
|
|
2375
|
-
getStorybookUI,
|
|
2376
|
-
raw,
|
|
2377
|
-
storiesOf,
|
|
2378
|
-
theme
|
|
2379
|
-
});
|