@storybook/react 8.6.14 → 10.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +2 -0
  2. package/dist/_browser-chunks/chunk-7HDTOAND.js +279 -0
  3. package/dist/_browser-chunks/chunk-BUAOEMNB.js +14 -0
  4. package/dist/_browser-chunks/chunk-HBQ5Y6GW.js +209 -0
  5. package/dist/_browser-chunks/chunk-L5NVL7MD.js +37 -0
  6. package/dist/_browser-chunks/chunk-O24TFCLO.js +43 -0
  7. package/dist/_browser-chunks/chunk-SKEPQA2F.js +12031 -0
  8. package/dist/_browser-chunks/chunk-VVH2AMAL.js +1075 -0
  9. package/dist/entry-preview-argtypes.js +10 -0
  10. package/dist/entry-preview-docs.js +13 -47
  11. package/dist/entry-preview-rsc.js +11 -1
  12. package/dist/entry-preview.js +21 -1
  13. package/dist/index.d.ts +452 -9
  14. package/dist/index.js +79 -47
  15. package/dist/playwright.d.ts +1 -1
  16. package/dist/playwright.js +7 -1
  17. package/dist/preset.js +511 -1
  18. package/dist/preview.d.ts +247 -21
  19. package/dist/preview.js +12 -47
  20. package/package.json +25 -68
  21. package/preset.js +1 -1
  22. package/preview.js +1 -0
  23. package/template/cli/js/Button.stories.js +2 -2
  24. package/template/cli/js/Header.stories.js +1 -1
  25. package/template/cli/js/Page.stories.js +2 -2
  26. package/template/cli/{ts-4-9 → ts}/Button.stories.ts +3 -2
  27. package/template/cli/{ts-4-9 → ts}/Header.stories.ts +2 -1
  28. package/template/cli/{ts-4-9 → ts}/Page.stories.ts +3 -2
  29. package/template/components/index.js +1 -1
  30. package/dist/chunk-EWIU6LHT.mjs +0 -56
  31. package/dist/chunk-TENYCC3B.mjs +0 -8
  32. package/dist/chunk-XP5HYGXS.mjs +0 -3
  33. package/dist/chunk-ZGTCCPPZ.mjs +0 -7
  34. package/dist/entry-preview-docs.d.ts +0 -20
  35. package/dist/entry-preview-docs.mjs +0 -2
  36. package/dist/entry-preview-rsc.d.ts +0 -7
  37. package/dist/entry-preview-rsc.mjs +0 -5
  38. package/dist/entry-preview.d.ts +0 -19
  39. package/dist/entry-preview.mjs +0 -2
  40. package/dist/index.mjs +0 -11
  41. package/dist/playwright.mjs +0 -2
  42. package/dist/preset.d.ts +0 -18
  43. package/dist/preview.mjs +0 -4
  44. package/dist/public-types-f2c70f25.d.ts +0 -230
  45. package/dist/types-5617c98e.d.ts +0 -27
  46. package/template/cli/ts-3-8/Button.stories.ts +0 -53
  47. package/template/cli/ts-3-8/Header.stories.ts +0 -33
  48. package/template/cli/ts-3-8/Page.stories.ts +0 -32
  49. package/template/cli/ts-3-8/Page.tsx +0 -73
  50. package/template/cli/ts-4-9/Button.tsx +0 -37
  51. package/template/cli/ts-4-9/Header.tsx +0 -56
  52. /package/template/cli/{ts-3-8 → ts}/Button.tsx +0 -0
  53. /package/template/cli/{ts-3-8 → ts}/Header.tsx +0 -0
  54. /package/template/cli/{ts-4-9 → ts}/Page.tsx +0 -0
@@ -1 +1 @@
1
- export { createPlaywrightTest as createTest } from 'storybook/internal/preview-api';
1
+ export { createPlaywrightTest as createTest } from 'storybook/preview-api';
@@ -1 +1,7 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var playwright_exports={};__export(playwright_exports,{createTest:()=>import_preview_api.createPlaywrightTest});module.exports=__toCommonJS(playwright_exports);var import_preview_api=require("storybook/internal/preview-api");0&&(module.exports={createTest});
1
+ import "./_browser-chunks/chunk-L5NVL7MD.js";
2
+
3
+ // src/playwright.ts
4
+ import { createPlaywrightTest } from "storybook/preview-api";
5
+ export {
6
+ createPlaywrightTest as createTest
7
+ };
package/dist/preset.js CHANGED
@@ -1 +1,511 @@
1
- "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{addons:()=>addons,previewAnnotations:()=>previewAnnotations,resolvedReact:()=>resolvedReact});module.exports=__toCommonJS(preset_exports);var import_node_path=require("path"),addons=[require.resolve("@storybook/react-dom-shim/dist/preset")],previewAnnotations=async(input=[],options)=>{let docsConfig=await options.presets.apply("docs",{},options),features=await options.presets.apply("features",{},options),docsEnabled=Object.keys(docsConfig).length>0;return[].concat(input).concat([(0,import_node_path.join)(__dirname,"entry-preview.mjs")]).concat(docsEnabled?[(0,import_node_path.join)(__dirname,"entry-preview-docs.mjs")]:[]).concat(features?.experimentalRSC?[(0,import_node_path.join)(__dirname,"entry-preview-rsc.mjs")]:[])},resolvedReact=async existing=>{try{return{...existing,react:(0,import_node_path.dirname)(require.resolve("react/package.json")),reactDom:(0,import_node_path.dirname)(require.resolve("react-dom/package.json"))}}catch{return existing}};0&&(module.exports={addons,previewAnnotations,resolvedReact});
1
+ import CJS_COMPAT_NODE_URL_f8oqphniavr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f8oqphniavr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f8oqphniavr from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_f8oqphniavr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f8oqphniavr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f8oqphniavr.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ var __defProp = Object.defineProperty;
13
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
+
15
+ // src/preset.ts
16
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
17
+
18
+ // ../../core/src/shared/utils/module.ts
19
+ import { fileURLToPath, pathToFileURL } from "node:url";
20
+
21
+ // ../../node_modules/exsolve/dist/index.mjs
22
+ import assert from "node:assert";
23
+ import v8 from "node:v8";
24
+ import { format, inspect } from "node:util";
25
+ var own$1 = {}.hasOwnProperty;
26
+ var classRegExp = /^([A-Z][a-z\d]*)+$/;
27
+ var kTypes = /* @__PURE__ */ new Set([
28
+ "string",
29
+ "function",
30
+ "number",
31
+ "object",
32
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
33
+ "Function",
34
+ "Object",
35
+ "boolean",
36
+ "bigint",
37
+ "symbol"
38
+ ]);
39
+ var messages = /* @__PURE__ */ new Map();
40
+ var nodeInternalPrefix = "__node_internal_";
41
+ var userStackTraceLimit;
42
+ function formatList(array, type = "and") {
43
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
44
+ }
45
+ __name(formatList, "formatList");
46
+ function createError(sym, value, constructor) {
47
+ messages.set(sym, value);
48
+ return makeNodeErrorWithCode(constructor, sym);
49
+ }
50
+ __name(createError, "createError");
51
+ function makeNodeErrorWithCode(Base, key) {
52
+ return /* @__PURE__ */ __name(function NodeError(...parameters) {
53
+ const limit = Error.stackTraceLimit;
54
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
55
+ const error = new Base();
56
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
57
+ const message = getMessage(key, parameters, error);
58
+ Object.defineProperties(error, {
59
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
60
+ // probably.
61
+ message: {
62
+ value: message,
63
+ enumerable: false,
64
+ writable: true,
65
+ configurable: true
66
+ },
67
+ toString: {
68
+ /** @this {Error} */
69
+ value() {
70
+ return `${this.name} [${key}]: ${this.message}`;
71
+ },
72
+ enumerable: false,
73
+ writable: true,
74
+ configurable: true
75
+ }
76
+ });
77
+ captureLargerStackTrace(error);
78
+ error.code = key;
79
+ return error;
80
+ }, "NodeError");
81
+ }
82
+ __name(makeNodeErrorWithCode, "makeNodeErrorWithCode");
83
+ function isErrorStackTraceLimitWritable() {
84
+ try {
85
+ if (v8.startupSnapshot.isBuildingSnapshot()) {
86
+ return false;
87
+ }
88
+ } catch {
89
+ }
90
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
91
+ if (desc === void 0) {
92
+ return Object.isExtensible(Error);
93
+ }
94
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
95
+ }
96
+ __name(isErrorStackTraceLimitWritable, "isErrorStackTraceLimitWritable");
97
+ function hideStackFrames(wrappedFunction) {
98
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
99
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
100
+ return wrappedFunction;
101
+ }
102
+ __name(hideStackFrames, "hideStackFrames");
103
+ var captureLargerStackTrace = hideStackFrames(function(error) {
104
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
105
+ if (stackTraceLimitIsWritable) {
106
+ userStackTraceLimit = Error.stackTraceLimit;
107
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
108
+ }
109
+ Error.captureStackTrace(error);
110
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
111
+ return error;
112
+ });
113
+ function getMessage(key, parameters, self) {
114
+ const message = messages.get(key);
115
+ assert(message !== void 0, "expected `message` to be found");
116
+ if (typeof message === "function") {
117
+ assert(
118
+ message.length <= parameters.length,
119
+ // Default options do not count.
120
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
121
+ );
122
+ return Reflect.apply(message, self, parameters);
123
+ }
124
+ const regex = /%[dfijoOs]/g;
125
+ let expectedLength = 0;
126
+ while (regex.exec(message) !== null) expectedLength++;
127
+ assert(
128
+ expectedLength === parameters.length,
129
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
130
+ );
131
+ if (parameters.length === 0) return message;
132
+ parameters.unshift(message);
133
+ return Reflect.apply(format, null, parameters);
134
+ }
135
+ __name(getMessage, "getMessage");
136
+ function determineSpecificType(value) {
137
+ if (value === null || value === void 0) {
138
+ return String(value);
139
+ }
140
+ if (typeof value === "function" && value.name) {
141
+ return `function ${value.name}`;
142
+ }
143
+ if (typeof value === "object") {
144
+ if (value.constructor && value.constructor.name) {
145
+ return `an instance of ${value.constructor.name}`;
146
+ }
147
+ return `${inspect(value, { depth: -1 })}`;
148
+ }
149
+ let inspected = inspect(value, { colors: false });
150
+ if (inspected.length > 28) {
151
+ inspected = `${inspected.slice(0, 25)}...`;
152
+ }
153
+ return `type ${typeof value} (${inspected})`;
154
+ }
155
+ __name(determineSpecificType, "determineSpecificType");
156
+ createError(
157
+ "ERR_INVALID_ARG_TYPE",
158
+ (name, expected, actual) => {
159
+ assert(typeof name === "string", "'name' must be a string");
160
+ if (!Array.isArray(expected)) {
161
+ expected = [expected];
162
+ }
163
+ let message = "The ";
164
+ if (name.endsWith(" argument")) {
165
+ message += `${name} `;
166
+ } else {
167
+ const type = name.includes(".") ? "property" : "argument";
168
+ message += `"${name}" ${type} `;
169
+ }
170
+ message += "must be ";
171
+ const types = [];
172
+ const instances = [];
173
+ const other = [];
174
+ for (const value of expected) {
175
+ assert(
176
+ typeof value === "string",
177
+ "All expected entries have to be of type string"
178
+ );
179
+ if (kTypes.has(value)) {
180
+ types.push(value.toLowerCase());
181
+ } else if (classRegExp.exec(value) === null) {
182
+ assert(
183
+ value !== "object",
184
+ 'The value "object" should be written as "Object"'
185
+ );
186
+ other.push(value);
187
+ } else {
188
+ instances.push(value);
189
+ }
190
+ }
191
+ if (instances.length > 0) {
192
+ const pos = types.indexOf("object");
193
+ if (pos !== -1) {
194
+ types.slice(pos, 1);
195
+ instances.push("Object");
196
+ }
197
+ }
198
+ if (types.length > 0) {
199
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
200
+ types,
201
+ "or"
202
+ )}`;
203
+ if (instances.length > 0 || other.length > 0) message += " or ";
204
+ }
205
+ if (instances.length > 0) {
206
+ message += `an instance of ${formatList(instances, "or")}`;
207
+ if (other.length > 0) message += " or ";
208
+ }
209
+ if (other.length > 0) {
210
+ if (other.length > 1) {
211
+ message += `one of ${formatList(other, "or")}`;
212
+ } else {
213
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
214
+ message += `${other[0]}`;
215
+ }
216
+ }
217
+ message += `. Received ${determineSpecificType(actual)}`;
218
+ return message;
219
+ },
220
+ TypeError
221
+ );
222
+ var ERR_INVALID_MODULE_SPECIFIER = createError(
223
+ "ERR_INVALID_MODULE_SPECIFIER",
224
+ /**
225
+ * @param {string} request
226
+ * @param {string} reason
227
+ * @param {string} [base]
228
+ */
229
+ (request, reason, base) => {
230
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
231
+ },
232
+ TypeError
233
+ );
234
+ var ERR_INVALID_PACKAGE_CONFIG = createError(
235
+ "ERR_INVALID_PACKAGE_CONFIG",
236
+ (path2, base, message) => {
237
+ return `Invalid package config ${path2}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
238
+ },
239
+ Error
240
+ );
241
+ var ERR_INVALID_PACKAGE_TARGET = createError(
242
+ "ERR_INVALID_PACKAGE_TARGET",
243
+ (packagePath, key, target, isImport = false, base) => {
244
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
245
+ if (key === ".") {
246
+ assert(isImport === false);
247
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
248
+ }
249
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
250
+ target
251
+ )} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
252
+ },
253
+ Error
254
+ );
255
+ var ERR_MODULE_NOT_FOUND = createError(
256
+ "ERR_MODULE_NOT_FOUND",
257
+ (path2, base, exactUrl = false) => {
258
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path2}' imported from ${base}`;
259
+ },
260
+ Error
261
+ );
262
+ createError(
263
+ "ERR_NETWORK_IMPORT_DISALLOWED",
264
+ "import of '%s' by %s is not supported: %s",
265
+ Error
266
+ );
267
+ var ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
268
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
269
+ (specifier, packagePath, base) => {
270
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
271
+ },
272
+ TypeError
273
+ );
274
+ var ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
275
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
276
+ /**
277
+ * @param {string} packagePath
278
+ * @param {string} subpath
279
+ * @param {string} [base]
280
+ */
281
+ (packagePath, subpath, base) => {
282
+ if (subpath === ".")
283
+ return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
284
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
285
+ },
286
+ Error
287
+ );
288
+ var ERR_UNSUPPORTED_DIR_IMPORT = createError(
289
+ "ERR_UNSUPPORTED_DIR_IMPORT",
290
+ "Directory import '%s' is not supported resolving ES modules imported from %s",
291
+ Error
292
+ );
293
+ var ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
294
+ "ERR_UNSUPPORTED_RESOLVE_REQUEST",
295
+ 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
296
+ TypeError
297
+ );
298
+ var ERR_UNKNOWN_FILE_EXTENSION = createError(
299
+ "ERR_UNKNOWN_FILE_EXTENSION",
300
+ (extension, path2) => {
301
+ return `Unknown file extension "${extension}" for ${path2}`;
302
+ },
303
+ TypeError
304
+ );
305
+ createError(
306
+ "ERR_INVALID_ARG_VALUE",
307
+ (name, value, reason = "is invalid") => {
308
+ let inspected = inspect(value);
309
+ if (inspected.length > 128) {
310
+ inspected = `${inspected.slice(0, 128)}...`;
311
+ }
312
+ const type = name.includes(".") ? "property" : "argument";
313
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
314
+ },
315
+ TypeError
316
+ // Note: extra classes have been shaken out.
317
+ // , RangeError
318
+ );
319
+ var hasOwnProperty$1 = {}.hasOwnProperty;
320
+ var hasOwnProperty = {}.hasOwnProperty;
321
+ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
322
+ var own = {}.hasOwnProperty;
323
+ var isWindows = (() => process.platform === "win32")();
324
+ var globalCache = (() => (
325
+ // eslint-disable-next-line unicorn/no-unreadable-iife
326
+ globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map()
327
+ ))();
328
+
329
+ // ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
330
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
331
+ function normalizeWindowsPath(input = "") {
332
+ if (!input) {
333
+ return input;
334
+ }
335
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
336
+ }
337
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
338
+ var _UNC_REGEX = /^[/\\]{2}/;
339
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
340
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
341
+ var normalize = /* @__PURE__ */ __name(function(path2) {
342
+ if (path2.length === 0) {
343
+ return ".";
344
+ }
345
+ path2 = normalizeWindowsPath(path2);
346
+ const isUNCPath = path2.match(_UNC_REGEX);
347
+ const isPathAbsolute = isAbsolute(path2);
348
+ const trailingSeparator = path2[path2.length - 1] === "/";
349
+ path2 = normalizeString(path2, !isPathAbsolute);
350
+ if (path2.length === 0) {
351
+ if (isPathAbsolute) {
352
+ return "/";
353
+ }
354
+ return trailingSeparator ? "./" : ".";
355
+ }
356
+ if (trailingSeparator) {
357
+ path2 += "/";
358
+ }
359
+ if (_DRIVE_LETTER_RE.test(path2)) {
360
+ path2 += "/";
361
+ }
362
+ if (isUNCPath) {
363
+ if (!isPathAbsolute) {
364
+ return `//./${path2}`;
365
+ }
366
+ return `//${path2}`;
367
+ }
368
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
369
+ }, "normalize");
370
+ var join = /* @__PURE__ */ __name(function(...arguments_) {
371
+ if (arguments_.length === 0) {
372
+ return ".";
373
+ }
374
+ let joined;
375
+ for (const argument of arguments_) {
376
+ if (argument && argument.length > 0) {
377
+ if (joined === void 0) {
378
+ joined = argument;
379
+ } else {
380
+ joined += `/${argument}`;
381
+ }
382
+ }
383
+ }
384
+ if (joined === void 0) {
385
+ return ".";
386
+ }
387
+ return normalize(joined.replace(/\/\/+/g, "/"));
388
+ }, "join");
389
+ function normalizeString(path2, allowAboveRoot) {
390
+ let res = "";
391
+ let lastSegmentLength = 0;
392
+ let lastSlash = -1;
393
+ let dots = 0;
394
+ let char = null;
395
+ for (let index = 0; index <= path2.length; ++index) {
396
+ if (index < path2.length) {
397
+ char = path2[index];
398
+ } else if (char === "/") {
399
+ break;
400
+ } else {
401
+ char = "/";
402
+ }
403
+ if (char === "/") {
404
+ if (lastSlash === index - 1 || dots === 1) ;
405
+ else if (dots === 2) {
406
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
407
+ if (res.length > 2) {
408
+ const lastSlashIndex = res.lastIndexOf("/");
409
+ if (lastSlashIndex === -1) {
410
+ res = "";
411
+ lastSegmentLength = 0;
412
+ } else {
413
+ res = res.slice(0, lastSlashIndex);
414
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
415
+ }
416
+ lastSlash = index;
417
+ dots = 0;
418
+ continue;
419
+ } else if (res.length > 0) {
420
+ res = "";
421
+ lastSegmentLength = 0;
422
+ lastSlash = index;
423
+ dots = 0;
424
+ continue;
425
+ }
426
+ }
427
+ if (allowAboveRoot) {
428
+ res += res.length > 0 ? "/.." : "..";
429
+ lastSegmentLength = 2;
430
+ }
431
+ } else {
432
+ if (res.length > 0) {
433
+ res += `/${path2.slice(lastSlash + 1, index)}`;
434
+ } else {
435
+ res = path2.slice(lastSlash + 1, index);
436
+ }
437
+ lastSegmentLength = index - lastSlash - 1;
438
+ }
439
+ lastSlash = index;
440
+ dots = 0;
441
+ } else if (char === "." && dots !== -1) {
442
+ ++dots;
443
+ } else {
444
+ dots = -1;
445
+ }
446
+ }
447
+ return res;
448
+ }
449
+ __name(normalizeString, "normalizeString");
450
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
451
+ return _IS_ABSOLUTE_RE.test(p);
452
+ }, "isAbsolute");
453
+ var dirname = /* @__PURE__ */ __name(function(p) {
454
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
455
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
456
+ segments[0] += "/";
457
+ }
458
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
459
+ }, "dirname");
460
+
461
+ // ../../core/src/shared/utils/module.ts
462
+ var importMetaResolve = /* @__PURE__ */ __name((...args) => {
463
+ if (typeof import.meta.resolve !== "function" && process.env.VITEST === "true") {
464
+ console.warn(
465
+ "importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
466
+ );
467
+ return pathToFileURL(args[0]).href;
468
+ }
469
+ return import.meta.resolve(...args);
470
+ }, "importMetaResolve");
471
+ var resolvePackageDir = /* @__PURE__ */ __name((pkg, parent) => {
472
+ return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
473
+ }, "resolvePackageDir");
474
+
475
+ // src/preset.ts
476
+ var addons = [
477
+ import.meta.resolve("@storybook/react-dom-shim/preset")
478
+ ];
479
+ var previewAnnotations = /* @__PURE__ */ __name(async (input = [], options) => {
480
+ const [docsConfig, features] = await Promise.all([
481
+ options.presets.apply("docs", {}, options),
482
+ options.presets.apply("features", {}, options)
483
+ ]);
484
+ const docsEnabled = Object.keys(docsConfig).length > 0;
485
+ const experimentalRSC = features?.experimentalRSC;
486
+ const result = [];
487
+ return result.concat(input).concat([
488
+ fileURLToPath2(import.meta.resolve("@storybook/react/entry-preview")),
489
+ fileURLToPath2(import.meta.resolve("@storybook/react/entry-preview-argtypes"))
490
+ ]).concat(
491
+ docsEnabled ? [fileURLToPath2(import.meta.resolve("@storybook/react/entry-preview-docs"))] : []
492
+ ).concat(
493
+ experimentalRSC ? [fileURLToPath2(import.meta.resolve("@storybook/react/entry-preview-rsc"))] : []
494
+ );
495
+ }, "previewAnnotations");
496
+ var resolvedReact = /* @__PURE__ */ __name(async (existing) => {
497
+ try {
498
+ return {
499
+ ...existing,
500
+ react: resolvePackageDir("react"),
501
+ reactDom: resolvePackageDir("react-dom")
502
+ };
503
+ } catch (e) {
504
+ return existing;
505
+ }
506
+ }, "resolvedReact");
507
+ export {
508
+ addons,
509
+ previewAnnotations,
510
+ resolvedReact
511
+ };