@storybook/react-native 7.0.0-alpha.4 → 7.0.0-alpha.6

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