storybook 10.3.3 → 10.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/server/base-preview-head.html +79 -74
- package/dist/_browser-chunks/{Color-KPF66X3F.js → Color-QOVTYR6E.js} +12 -4
- package/dist/_browser-chunks/{chunk-JVRDBUUP.js → chunk-2HVKLHKJ.js} +4 -1
- package/dist/_browser-chunks/chunk-4AB3IUR2.js +13 -0
- package/dist/_browser-chunks/{chunk-V5NV5R37.js → chunk-C3TKC4WX.js} +1 -1
- package/dist/_browser-chunks/{chunk-RD3KTAHR.js → chunk-JT6NUAUC.js} +1 -20
- package/dist/_browser-chunks/chunk-LITCR56V.js +53 -0
- package/dist/_browser-chunks/{chunk-POMIZRJL.js → chunk-MFQQ5L5I.js} +11 -1
- package/dist/_browser-chunks/chunk-QIIJQEST.js +174 -0
- package/dist/_browser-chunks/{syntaxhighlighter-OH4MV7E3.js → syntaxhighlighter-W7WJGI2T.js} +77 -19
- package/dist/_node-chunks/{builder-manager-LPFGKXTG.js → builder-manager-H3RE756K.js} +21 -14
- package/dist/_node-chunks/{camelcase-N7ZROTBG.js → camelcase-3C63TIAT.js} +7 -7
- package/dist/_node-chunks/{chunk-6KXUKKG7.js → chunk-2E2JVUNS.js} +7 -7
- package/dist/_node-chunks/{chunk-CERCAI3W.js → chunk-2W743EA3.js} +7 -7
- package/dist/_node-chunks/{chunk-AV2LSJTV.js → chunk-3BPHYDN5.js} +14 -14
- package/dist/_node-chunks/{chunk-BKLQ6O3U.js → chunk-3LVSS6GN.js} +133 -12
- package/dist/_node-chunks/{chunk-7FOO4VZY.js → chunk-4ISTEHCM.js} +20 -19
- package/dist/_node-chunks/{chunk-ZNOZEVUY.js → chunk-5IHDTMLC.js} +6 -6
- package/dist/_node-chunks/{chunk-C2H53V4H.js → chunk-5L7EORB4.js} +6 -6
- package/dist/_node-chunks/chunk-6GCVEFD6.js +18 -0
- package/dist/_node-chunks/chunk-BV2M6I75.js +84 -0
- package/dist/_node-chunks/{chunk-Y7LKTMXG.js → chunk-BV5YQP4B.js} +7 -7
- package/dist/_node-chunks/chunk-C43BFJMS.js +51 -0
- package/dist/_node-chunks/chunk-CUZMMOHY.js +1489 -0
- package/dist/_node-chunks/{chunk-73MPA7MW.js → chunk-CXHD3UA6.js} +9 -9
- package/dist/_node-chunks/chunk-FFFNDE22.js +144 -0
- package/dist/_node-chunks/{chunk-KBP3PLJZ.js → chunk-JBJRWIDV.js} +11 -9
- package/dist/_node-chunks/chunk-JM4QTCUN.js +181 -0
- package/dist/_node-chunks/{chunk-UE3FZNFM.js → chunk-JQXQP7A4.js} +6 -6
- package/dist/_node-chunks/{chunk-XLBFPKTO.js → chunk-KZ7QL465.js} +120 -116
- package/dist/_node-chunks/{p-limit-PYJ6ADAG.js → chunk-NXYAADHN.js} +8 -8
- package/dist/_node-chunks/{chunk-NQBOIYE4.js → chunk-PNYLLFX3.js} +1611 -2564
- package/dist/_node-chunks/{chunk-HULCERYQ.js → chunk-R3VBEOHQ.js} +7 -7
- package/dist/_node-chunks/{chunk-FVZGAF6J.js → chunk-RYS45SZ5.js} +8 -8
- package/dist/_node-chunks/{chunk-ZEK5SANA.js → chunk-TGEJ6REI.js} +7 -6
- package/dist/_node-chunks/{chunk-ID6EW6PR.js → chunk-UEFVJ4BB.js} +6 -6
- package/dist/_node-chunks/{chunk-GMFDJH6Z.js → chunk-UHVMRW65.js} +7 -7
- package/dist/_node-chunks/{chunk-LFZC4GGD.js → chunk-UQRAUAGM.js} +7 -7
- package/dist/_node-chunks/{chunk-WBQJIPO2.js → chunk-UZQ7S6LH.js} +57 -7
- package/dist/_node-chunks/{chunk-2FN7EC43.js → chunk-XQ72YXLB.js} +6 -6
- package/dist/_node-chunks/{chunk-IPFJ62CM.js → chunk-XSYEGQMM.js} +7 -7
- package/dist/_node-chunks/chunk-ZJMC6JVU.js +1799 -0
- package/dist/_node-chunks/{globby-2JQDE3NB.js → globby-JBOYUSB4.js} +9 -9
- package/dist/_node-chunks/{lib-KLPVH2U2.js → lib-6NOKBEFE.js} +7 -7
- package/dist/_node-chunks/p-limit-J2VX66LD.js +20 -0
- package/dist/_node-chunks/session-id-TNKIKECX.js +22 -0
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +12 -12
- package/dist/bin/dispatcher.js +16 -14
- package/dist/bin/loader.js +41 -17
- package/dist/cli/index.d.ts +80 -2
- package/dist/cli/index.js +19 -18
- package/dist/common/index.d.ts +57 -3
- package/dist/common/index.js +49 -31
- package/dist/components/index.d.ts +117 -179
- package/dist/components/index.js +85 -76
- package/dist/core-events/index.d.ts +9 -5
- package/dist/core-events/index.js +9 -5
- package/dist/core-server/index.d.ts +380 -15
- package/dist/core-server/index.js +14952 -3737
- package/dist/core-server/presets/common-manager.js +183 -83
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +336 -497
- package/dist/csf/index.d.ts +3 -3
- package/dist/csf/index.js +1 -1
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +3165 -2727
- package/dist/manager/runtime.js +1895 -510
- package/dist/manager-api/index.d.ts +126 -18
- package/dist/manager-api/index.js +332 -240
- package/dist/manager-errors.d.ts +2 -1
- package/dist/manager-errors.js +2 -2
- package/dist/mocking-utils/index.js +9 -9
- package/dist/node-logger/index.d.ts +1 -1
- package/dist/node-logger/index.js +9 -9
- package/dist/oxc-parser/index.d.ts +74 -0
- package/dist/oxc-parser/index.js +224 -0
- package/dist/oxc-parser/worker.js +38 -0
- package/dist/preview/runtime.js +50 -26
- package/dist/preview-api/index.d.ts +1 -1
- package/dist/preview-errors.d.ts +6 -2
- package/dist/preview-errors.js +4 -2
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.js +1 -1
- package/dist/server-errors.d.ts +22 -2
- package/dist/server-errors.js +15 -13
- package/dist/telemetry/index.d.ts +54 -4
- package/dist/telemetry/index.js +46 -26
- package/dist/test/index.d.ts +41 -40
- package/dist/types/index.d.ts +138 -8
- package/dist/types/index.js +11 -2
- package/package.json +29 -5
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +0 -7
- package/dist/_node-chunks/chunk-5EBSFPNT.js +0 -97
- package/dist/_node-chunks/chunk-6PADJQ3N.js +0 -557
- package/dist/_node-chunks/chunk-KZRQTMIL.js +0 -18
- package/dist/_node-chunks/chunk-N326NX4R.js +0 -1762
- package/dist/_node-chunks/chunk-YH55PJTI.js +0 -61
- package/dist/_node-chunks/chunk-Z44UHNLR.js +0 -23
- package/dist/_node-chunks/mdx-N42X6CFJ-E6XEY3IS.js +0 -14329
package/README.md
CHANGED
|
@@ -33,6 +33,6 @@ The `storybook` package contains Storybook's core. It includes:
|
|
|
33
33
|
- User-facing utility libraries such as `storybook/test`, `theming`, and `viewport`
|
|
34
34
|
- Libraries used by Storybook's ecosystem of frameworks, addons, and builders
|
|
35
35
|
|
|
36
|
-
It also contains a variety of other libraries and utilities under the `
|
|
36
|
+
It also contains a variety of other libraries and utilities under the `storybook/internal` namespace, such as utilities for CSF, MDX & Docs.
|
|
37
37
|
|
|
38
38
|
Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme).
|
|
@@ -112,11 +112,11 @@
|
|
|
112
112
|
border-radius: 10px;
|
|
113
113
|
background: rgb(247, 247, 247);
|
|
114
114
|
color: rgb(46, 52, 56);
|
|
115
|
+
}
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
117
|
+
.sb-nopreview_main * {
|
|
118
|
+
background: rgb(247, 247, 247);
|
|
119
|
+
color: rgb(46, 52, 56);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
.sb-nopreview_heading {
|
|
@@ -147,84 +147,89 @@
|
|
|
147
147
|
border: 1px solid #ff0000;
|
|
148
148
|
box-shadow: 0 0 64px rgba(0, 0, 0, 0.1);
|
|
149
149
|
gap: 24px;
|
|
150
|
+
}
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
.sb-errordisplay_main ol {
|
|
153
|
+
padding-left: 18px;
|
|
154
|
+
margin: 0;
|
|
155
|
+
}
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
/* Redefine colors to ensure readability regardless of user-provided * selectors. */
|
|
158
|
+
.sb-errordisplay_main * {
|
|
159
|
+
background: white;
|
|
160
|
+
color: black;
|
|
161
|
+
}
|
|
161
162
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
margin: 0;
|
|
169
|
-
|
|
170
|
-
&::before {
|
|
171
|
-
content: '';
|
|
172
|
-
display: inline-block;
|
|
173
|
-
width: 12px;
|
|
174
|
-
height: 12px;
|
|
175
|
-
background: #ff4400;
|
|
176
|
-
border-radius: 50%;
|
|
177
|
-
margin-right: 8px;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
163
|
+
/* Exclude error code block from the universal reset to preserve ANSI colors and dark theme */
|
|
164
|
+
.sb-errordisplay_main .sb-errordisplay_code,
|
|
165
|
+
.sb-errordisplay_main .sb-errordisplay_code * {
|
|
166
|
+
background: #242424;
|
|
167
|
+
color: #c6c6c6;
|
|
168
|
+
}
|
|
180
169
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
170
|
+
.sb-errordisplay_main h1 {
|
|
171
|
+
font-family: inherit;
|
|
172
|
+
font-size: 22px;
|
|
173
|
+
font-weight: 400;
|
|
174
|
+
line-height: 30px;
|
|
175
|
+
margin: 0;
|
|
176
|
+
}
|
|
189
177
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
178
|
+
.sb-errordisplay_main h1::before {
|
|
179
|
+
content: '';
|
|
180
|
+
display: inline-block;
|
|
181
|
+
width: 12px;
|
|
182
|
+
height: 12px;
|
|
183
|
+
background: #ff4400;
|
|
184
|
+
border-radius: 50%;
|
|
185
|
+
margin-right: 8px;
|
|
186
|
+
}
|
|
195
187
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
188
|
+
.sb-errordisplay_main p,
|
|
189
|
+
.sb-errordisplay_main ol {
|
|
190
|
+
font-family: inherit;
|
|
191
|
+
font-size: 14px;
|
|
192
|
+
font-weight: 400;
|
|
193
|
+
line-height: 19px;
|
|
194
|
+
margin: 0;
|
|
195
|
+
}
|
|
199
196
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
box-sizing: border-box;
|
|
206
|
-
|
|
207
|
-
font-size: 14px;
|
|
208
|
-
font-weight: 400;
|
|
209
|
-
line-height: 19px;
|
|
210
|
-
border-radius: 4px;
|
|
211
|
-
|
|
212
|
-
font-family:
|
|
213
|
-
'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono',
|
|
214
|
-
'Lucida Console', Consolas, Monaco, monospace;
|
|
215
|
-
margin: 0;
|
|
216
|
-
overflow: auto;
|
|
217
|
-
|
|
218
|
-
& code {
|
|
219
|
-
background-color: inherit;
|
|
220
|
-
color: inherit;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
197
|
+
.sb-errordisplay_main li + li {
|
|
198
|
+
margin: 0;
|
|
199
|
+
padding: 0;
|
|
200
|
+
padding-top: 12px;
|
|
201
|
+
}
|
|
223
202
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
203
|
+
.sb-errordisplay_main a {
|
|
204
|
+
color: currentColor;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.sb-errordisplay_main .sb-errordisplay_code {
|
|
208
|
+
padding: 10px;
|
|
209
|
+
flex: 1;
|
|
210
|
+
background: #242424;
|
|
211
|
+
color: #c6c6c6;
|
|
212
|
+
box-sizing: border-box;
|
|
213
|
+
|
|
214
|
+
font-size: 14px;
|
|
215
|
+
font-weight: 400;
|
|
216
|
+
line-height: 19px;
|
|
217
|
+
border-radius: 4px;
|
|
218
|
+
|
|
219
|
+
font-family:
|
|
220
|
+
'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono',
|
|
221
|
+
'Lucida Console', Consolas, Monaco, monospace;
|
|
222
|
+
margin: 0;
|
|
223
|
+
overflow: auto;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.sb-errordisplay_main .sb-errordisplay_code code {
|
|
227
|
+
background-color: inherit;
|
|
228
|
+
color: inherit;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.sb-errordisplay_main .sb-errordisplay_code {
|
|
232
|
+
white-space: pre-wrap;
|
|
228
233
|
}
|
|
229
234
|
|
|
230
235
|
@-webkit-keyframes sb-rotate360 {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getControlId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4AB3IUR2.js";
|
|
4
4
|
import "./chunk-NZMVUW5T.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
@@ -999,12 +999,18 @@ var Wrapper = styled.div({
|
|
|
999
999
|
setValue(updatedValue), onChange(updatedValue);
|
|
1000
1000
|
}, [color, colorSpace, onChange]);
|
|
1001
1001
|
return { value, realValue, updateValue, color, colorSpace, cycleColorSpace };
|
|
1002
|
-
}, id = (value) => value.replace(/\s*/, "").toLowerCase(), usePresets = (presetColors, currentColor, colorSpace) => {
|
|
1002
|
+
}, id = (value) => value.replace(/\s*/, "").toLowerCase(), usePresets = (presetColors, currentColor, colorSpace, maxPresetColors = 27) => {
|
|
1003
1003
|
let [selectedColors, setSelectedColors] = useState(currentColor?.valid ? [currentColor] : []);
|
|
1004
1004
|
useEffect(() => {
|
|
1005
1005
|
currentColor === void 0 && setSelectedColors([]);
|
|
1006
1006
|
}, [currentColor]);
|
|
1007
|
-
let presets = useMemo(() =>
|
|
1007
|
+
let presets = useMemo(() => {
|
|
1008
|
+
let combined = (presetColors || []).map((preset) => typeof preset == "string" ? parseValue(preset) : preset.title ? { ...parseValue(preset.color), keyword: preset.title } : parseValue(preset.color)).concat(selectedColors).filter(Boolean);
|
|
1009
|
+
if (maxPresetColors === 0 || maxPresetColors === 1 / 0)
|
|
1010
|
+
return combined;
|
|
1011
|
+
let limit = Number.isInteger(maxPresetColors) && maxPresetColors > 0 ? maxPresetColors : 27;
|
|
1012
|
+
return combined.slice(-limit);
|
|
1013
|
+
}, [presetColors, selectedColors, maxPresetColors]), addPreset = useCallback(
|
|
1008
1014
|
(color) => {
|
|
1009
1015
|
color?.valid && (presets.some(
|
|
1010
1016
|
(preset) => preset && preset[colorSpace] && id(preset[colorSpace] || "") === id(color[colorSpace] || "")
|
|
@@ -1015,18 +1021,20 @@ var Wrapper = styled.div({
|
|
|
1015
1021
|
return { presets, addPreset };
|
|
1016
1022
|
}, ColorControl = ({
|
|
1017
1023
|
name,
|
|
1024
|
+
storyId,
|
|
1018
1025
|
value: initialValue,
|
|
1019
1026
|
onChange,
|
|
1020
1027
|
onFocus,
|
|
1021
1028
|
onBlur,
|
|
1022
1029
|
presetColors,
|
|
1030
|
+
maxPresetColors,
|
|
1023
1031
|
startOpen = !1,
|
|
1024
1032
|
argType
|
|
1025
1033
|
}) => {
|
|
1026
1034
|
let debouncedOnChange = useCallback(debounce(onChange, 200), [onChange]), { value, realValue, updateValue, color, colorSpace, cycleColorSpace } = useColorInput(
|
|
1027
1035
|
initialValue,
|
|
1028
1036
|
debouncedOnChange
|
|
1029
|
-
), { presets, addPreset } = usePresets(presetColors ?? [], color, colorSpace), Picker = ColorPicker[colorSpace], readOnly = !!argType?.table?.readonly, controlId = getControlId(name);
|
|
1037
|
+
), { presets, addPreset } = usePresets(presetColors ?? [], color, colorSpace, maxPresetColors), Picker = ColorPicker[colorSpace], readOnly = !!argType?.table?.readonly, controlId = getControlId(name, storyId);
|
|
1030
1038
|
return React.createElement(Wrapper, null, React.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React.createElement(
|
|
1031
1039
|
Input,
|
|
1032
1040
|
{
|
|
@@ -18,7 +18,10 @@ function appendErrorRef(url) {
|
|
|
18
18
|
}
|
|
19
19
|
var StorybookError = class _StorybookError extends Error {
|
|
20
20
|
constructor(props) {
|
|
21
|
-
super(
|
|
21
|
+
super(
|
|
22
|
+
_StorybookError.getFullMessage(props),
|
|
23
|
+
props.cause === void 0 ? void 0 : { cause: props.cause }
|
|
24
|
+
);
|
|
22
25
|
/**
|
|
23
26
|
* Data associated with the error. Used to provide additional information in the error message or
|
|
24
27
|
* to be passed to telemetry.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// ../addons/docs/src/blocks/controls/helpers.ts
|
|
2
|
+
var getControlId = (value, storyId) => {
|
|
3
|
+
let base = value.replace(/\s+/g, "-");
|
|
4
|
+
return storyId ? `control-${storyId}-${base}` : `control-${base}`;
|
|
5
|
+
}, getControlSetterButtonId = (value, storyId) => {
|
|
6
|
+
let base = value.replace(/\s+/g, "-");
|
|
7
|
+
return storyId ? `set-${storyId}-${base}` : `set-${base}`;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
getControlId,
|
|
12
|
+
getControlSetterButtonId
|
|
13
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorybookError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2HVKLHKJ.js";
|
|
4
4
|
|
|
5
5
|
// src/manager-errors.ts
|
|
6
6
|
var Category = /* @__PURE__ */ ((Category2) => (Category2.MANAGER_UNCAUGHT = "MANAGER_UNCAUGHT", Category2.MANAGER_UI = "MANAGER_UI", Category2.MANAGER_API = "MANAGER_API", Category2.MANAGER_CLIENT_LOGGER = "MANAGER_CLIENT-LOGGER", Category2.MANAGER_CHANNELS = "MANAGER_CHANNELS", Category2.MANAGER_CORE_EVENTS = "MANAGER_CORE-EVENTS", Category2.MANAGER_ROUTER = "MANAGER_ROUTER", Category2.MANAGER_THEMING = "MANAGER_THEMING", Category2))(Category || {}), ProviderDoesNotExtendBaseProviderError = class extends StorybookError {
|
|
@@ -950,26 +950,7 @@ var ScrollAreaRoot = styled2(Root)(
|
|
|
950
950
|
);
|
|
951
951
|
ScrollArea2.displayName = "ScrollArea";
|
|
952
952
|
|
|
953
|
-
// src/components/components/syntaxhighlighter/clipboard.ts
|
|
954
|
-
import { global } from "@storybook/global";
|
|
955
|
-
var { document: document2, window: globalWindow } = global;
|
|
956
|
-
async function copyUsingClipboardAPI(text) {
|
|
957
|
-
try {
|
|
958
|
-
await globalWindow.top?.navigator.clipboard.writeText(text);
|
|
959
|
-
} catch {
|
|
960
|
-
await globalWindow.navigator.clipboard.writeText(text);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
async function copyUsingWorkAround(text) {
|
|
964
|
-
let tmp = document2.createElement("TEXTAREA"), focus = document2.activeElement;
|
|
965
|
-
tmp.value = text, document2.body.appendChild(tmp), tmp.select(), document2.execCommand("copy"), document2.body.removeChild(tmp), focus.focus();
|
|
966
|
-
}
|
|
967
|
-
function createCopyToClipboardFunction() {
|
|
968
|
-
return globalWindow.navigator?.clipboard ? copyUsingClipboardAPI : copyUsingWorkAround;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
953
|
export {
|
|
972
954
|
ActionBar,
|
|
973
|
-
ScrollArea2 as ScrollArea
|
|
974
|
-
createCopyToClipboardFunction
|
|
955
|
+
ScrollArea2 as ScrollArea
|
|
975
956
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// ../../node_modules/@react-aria/live-announcer/dist/LiveAnnouncer.mjs
|
|
2
|
+
var $319e236875307eab$var$liveAnnouncer = null;
|
|
3
|
+
function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = 7e3) {
|
|
4
|
+
$319e236875307eab$var$liveAnnouncer ? $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout) : ($319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer(), (typeof IS_REACT_ACT_ENVIRONMENT == "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest < "u") ? $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout) : setTimeout(() => {
|
|
5
|
+
$319e236875307eab$var$liveAnnouncer?.isAttached() && $319e236875307eab$var$liveAnnouncer?.announce(message, assertiveness, timeout);
|
|
6
|
+
}, 100));
|
|
7
|
+
}
|
|
8
|
+
function $319e236875307eab$export$d10ae4f68404609a(assertiveness) {
|
|
9
|
+
$319e236875307eab$var$liveAnnouncer && $319e236875307eab$var$liveAnnouncer.clear(assertiveness);
|
|
10
|
+
}
|
|
11
|
+
var $319e236875307eab$var$LiveAnnouncer = class {
|
|
12
|
+
isAttached() {
|
|
13
|
+
var _this_node;
|
|
14
|
+
return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
|
|
15
|
+
}
|
|
16
|
+
createLog(ariaLive) {
|
|
17
|
+
let node = document.createElement("div");
|
|
18
|
+
return node.setAttribute("role", "log"), node.setAttribute("aria-live", ariaLive), node.setAttribute("aria-relevant", "additions"), node;
|
|
19
|
+
}
|
|
20
|
+
destroy() {
|
|
21
|
+
this.node && (document.body.removeChild(this.node), this.node = null);
|
|
22
|
+
}
|
|
23
|
+
announce(message, assertiveness = "assertive", timeout = 7e3) {
|
|
24
|
+
var _this_assertiveLog, _this_politeLog;
|
|
25
|
+
if (!this.node) return;
|
|
26
|
+
let node = document.createElement("div");
|
|
27
|
+
typeof message == "object" ? (node.setAttribute("role", "img"), node.setAttribute("aria-labelledby", message["aria-labelledby"])) : node.textContent = message, assertiveness === "assertive" ? (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 || _this_assertiveLog.appendChild(node) : (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 || _this_politeLog.appendChild(node), message !== "" && setTimeout(() => {
|
|
28
|
+
node.remove();
|
|
29
|
+
}, timeout);
|
|
30
|
+
}
|
|
31
|
+
clear(assertiveness) {
|
|
32
|
+
this.node && ((!assertiveness || assertiveness === "assertive") && this.assertiveLog && (this.assertiveLog.innerHTML = ""), (!assertiveness || assertiveness === "polite") && this.politeLog && (this.politeLog.innerHTML = ""));
|
|
33
|
+
}
|
|
34
|
+
constructor() {
|
|
35
|
+
this.node = null, this.assertiveLog = null, this.politeLog = null, typeof document < "u" && (this.node = document.createElement("div"), this.node.dataset.liveAnnouncer = "true", Object.assign(this.node.style, {
|
|
36
|
+
border: 0,
|
|
37
|
+
clip: "rect(0 0 0 0)",
|
|
38
|
+
clipPath: "inset(50%)",
|
|
39
|
+
height: "1px",
|
|
40
|
+
margin: "-1px",
|
|
41
|
+
overflow: "hidden",
|
|
42
|
+
padding: 0,
|
|
43
|
+
position: "absolute",
|
|
44
|
+
width: "1px",
|
|
45
|
+
whiteSpace: "nowrap"
|
|
46
|
+
}), this.assertiveLog = this.createLog("assertive"), this.node.appendChild(this.assertiveLog), this.politeLog = this.createLog("polite"), this.node.appendChild(this.politeLog), document.body.prepend(this.node));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
$319e236875307eab$export$a9b970dcc4ae71a9,
|
|
52
|
+
$319e236875307eab$export$d10ae4f68404609a
|
|
53
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorybookError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2HVKLHKJ.js";
|
|
4
4
|
import {
|
|
5
5
|
dedent
|
|
6
6
|
} from "./chunk-3LY4VQVK.js";
|
|
@@ -301,6 +301,15 @@ This is deprecated and won't work in Storybook 8 anymore.
|
|
|
301
301
|
});
|
|
302
302
|
this.data = data;
|
|
303
303
|
}
|
|
304
|
+
}, InvalidBlockOfPropError = class extends StorybookError {
|
|
305
|
+
constructor() {
|
|
306
|
+
super({
|
|
307
|
+
name: "InvalidBlockOfPropError",
|
|
308
|
+
category: "BLOCKS" /* BLOCKS */,
|
|
309
|
+
code: 1,
|
|
310
|
+
message: "Unexpected `of={undefined}`, did you mistype a CSF file reference?"
|
|
311
|
+
});
|
|
312
|
+
}
|
|
304
313
|
}, UnsupportedViewportDimensionError = class extends StorybookError {
|
|
305
314
|
constructor(data) {
|
|
306
315
|
super({
|
|
@@ -352,6 +361,7 @@ export {
|
|
|
352
361
|
NextJsSharpError,
|
|
353
362
|
NextjsRouterMocksNotAvailable,
|
|
354
363
|
UnknownArgTypesError,
|
|
364
|
+
InvalidBlockOfPropError,
|
|
355
365
|
UnsupportedViewportDimensionError,
|
|
356
366
|
ElementA11yParameterError
|
|
357
367
|
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StatusTypeIdMismatchError
|
|
3
|
+
} from "./chunk-C3TKC4WX.js";
|
|
4
|
+
import {
|
|
5
|
+
StatusTypeIdMismatchError as StatusTypeIdMismatchError2
|
|
6
|
+
} from "./chunk-MFQQ5L5I.js";
|
|
7
|
+
import {
|
|
8
|
+
StorybookError
|
|
9
|
+
} from "./chunk-2HVKLHKJ.js";
|
|
10
|
+
import {
|
|
11
|
+
require_picocolors_browser
|
|
12
|
+
} from "./chunk-7YGTGCDG.js";
|
|
13
|
+
import {
|
|
14
|
+
__toESM
|
|
15
|
+
} from "./chunk-A242L54C.js";
|
|
16
|
+
|
|
17
|
+
// src/server-errors.ts
|
|
18
|
+
var import_picocolors = __toESM(require_picocolors_browser(), 1);
|
|
19
|
+
var StatusTypeIdMismatchError3 = class extends StorybookError {
|
|
20
|
+
constructor(data) {
|
|
21
|
+
super({
|
|
22
|
+
name: "StatusTypeIdMismatchError",
|
|
23
|
+
category: "CORE-SERVER" /* CORE_SERVER */,
|
|
24
|
+
code: 16,
|
|
25
|
+
message: `Status has typeId "${data.status.typeId}" but was added to store with typeId "${data.typeId}". Full status: ${JSON.stringify(
|
|
26
|
+
data.status,
|
|
27
|
+
null,
|
|
28
|
+
2
|
|
29
|
+
)}`
|
|
30
|
+
});
|
|
31
|
+
this.data = data;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/shared/status-store/index.ts
|
|
36
|
+
var STATUS_VALUE_PREFIX = "status-value:", STATUS_VALUES = [
|
|
37
|
+
"status-value:pending",
|
|
38
|
+
"status-value:success",
|
|
39
|
+
"status-value:new",
|
|
40
|
+
"status-value:modified",
|
|
41
|
+
"status-value:affected",
|
|
42
|
+
"status-value:warning",
|
|
43
|
+
"status-value:error",
|
|
44
|
+
"status-value:unknown"
|
|
45
|
+
], toStatusValue = (shortName) => {
|
|
46
|
+
if (shortName === "related") return "status-value:affected";
|
|
47
|
+
let candidate = `${STATUS_VALUE_PREFIX}${shortName}`;
|
|
48
|
+
return STATUS_VALUES.includes(candidate) ? candidate : void 0;
|
|
49
|
+
}, statusValueShortName = (value) => value === "status-value:affected" ? "related" : value.slice(STATUS_VALUE_PREFIX.length);
|
|
50
|
+
var CHANGE_DETECTION_STATUS_TYPE_ID = "storybook/change-detection", UNIVERSAL_STATUS_STORE_OPTIONS = {
|
|
51
|
+
id: "storybook/status",
|
|
52
|
+
leader: !0,
|
|
53
|
+
initialState: {}
|
|
54
|
+
}, StatusStoreEventType = {
|
|
55
|
+
SELECT: "select"
|
|
56
|
+
};
|
|
57
|
+
function countStatusesByValue(allStatuses) {
|
|
58
|
+
let counts = {};
|
|
59
|
+
for (let statusByTypeId of Object.values(allStatuses))
|
|
60
|
+
for (let status of Object.values(statusByTypeId))
|
|
61
|
+
counts[status.value] = (counts[status.value] ?? 0) + 1;
|
|
62
|
+
return counts;
|
|
63
|
+
}
|
|
64
|
+
function createStatusStore({
|
|
65
|
+
universalStatusStore,
|
|
66
|
+
useUniversalStore,
|
|
67
|
+
environment
|
|
68
|
+
}) {
|
|
69
|
+
let fullStatusStore = {
|
|
70
|
+
getAll() {
|
|
71
|
+
return universalStatusStore.getState();
|
|
72
|
+
},
|
|
73
|
+
set(statuses) {
|
|
74
|
+
universalStatusStore.setState((state) => {
|
|
75
|
+
let newState = { ...state };
|
|
76
|
+
for (let status of statuses) {
|
|
77
|
+
let { storyId, typeId } = status;
|
|
78
|
+
newState[storyId] = { ...newState[storyId] ?? {}, [typeId]: status };
|
|
79
|
+
}
|
|
80
|
+
return newState;
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
onAllStatusChange(listener) {
|
|
84
|
+
return universalStatusStore.onStateChange((state, prevState) => {
|
|
85
|
+
listener(state, prevState);
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
onSelect(listener) {
|
|
89
|
+
return universalStatusStore.subscribe(StatusStoreEventType.SELECT, (event) => {
|
|
90
|
+
listener(event.payload);
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
selectStatuses: (statuses) => {
|
|
94
|
+
universalStatusStore.send({ type: StatusStoreEventType.SELECT, payload: statuses });
|
|
95
|
+
},
|
|
96
|
+
unset(storyIds) {
|
|
97
|
+
if (!storyIds) {
|
|
98
|
+
universalStatusStore.setState({});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
universalStatusStore.setState((state) => {
|
|
102
|
+
let newState = { ...state };
|
|
103
|
+
for (let storyId of storyIds)
|
|
104
|
+
delete newState[storyId];
|
|
105
|
+
return newState;
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
typeId: void 0
|
|
109
|
+
}, getStatusStoreByTypeId = (typeId) => ({
|
|
110
|
+
getAll: fullStatusStore.getAll,
|
|
111
|
+
set(statuses) {
|
|
112
|
+
universalStatusStore.setState((state) => {
|
|
113
|
+
let newState = { ...state };
|
|
114
|
+
for (let status of statuses) {
|
|
115
|
+
let { storyId } = status;
|
|
116
|
+
if (status.typeId !== typeId)
|
|
117
|
+
switch (environment) {
|
|
118
|
+
case "server":
|
|
119
|
+
throw new StatusTypeIdMismatchError3({
|
|
120
|
+
status,
|
|
121
|
+
typeId
|
|
122
|
+
});
|
|
123
|
+
case "manager":
|
|
124
|
+
throw new StatusTypeIdMismatchError({
|
|
125
|
+
status,
|
|
126
|
+
typeId
|
|
127
|
+
});
|
|
128
|
+
case "preview":
|
|
129
|
+
default:
|
|
130
|
+
throw new StatusTypeIdMismatchError2({
|
|
131
|
+
status,
|
|
132
|
+
typeId
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
newState[storyId] = { ...newState[storyId] ?? {}, [typeId]: status };
|
|
136
|
+
}
|
|
137
|
+
return newState;
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
onAllStatusChange: fullStatusStore.onAllStatusChange,
|
|
141
|
+
onSelect(listener) {
|
|
142
|
+
return universalStatusStore.subscribe(StatusStoreEventType.SELECT, (event) => {
|
|
143
|
+
event.payload.some((status) => status.typeId === typeId) && listener(event.payload);
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
unset(storyIds) {
|
|
147
|
+
universalStatusStore.setState((state) => {
|
|
148
|
+
let newState = { ...state };
|
|
149
|
+
for (let storyId in newState)
|
|
150
|
+
if (newState[storyId]?.[typeId] && (!storyIds || storyIds?.includes(storyId))) {
|
|
151
|
+
let { [typeId]: omittedStatus, ...storyStatusesWithoutTypeId } = newState[storyId];
|
|
152
|
+
newState[storyId] = storyStatusesWithoutTypeId;
|
|
153
|
+
}
|
|
154
|
+
return newState;
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
typeId
|
|
158
|
+
});
|
|
159
|
+
return useUniversalStore ? {
|
|
160
|
+
getStatusStoreByTypeId,
|
|
161
|
+
fullStatusStore,
|
|
162
|
+
universalStatusStore,
|
|
163
|
+
useStatusStore: (selector) => useUniversalStore(universalStatusStore, selector)[0]
|
|
164
|
+
} : { getStatusStoreByTypeId, fullStatusStore, universalStatusStore };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
toStatusValue,
|
|
169
|
+
statusValueShortName,
|
|
170
|
+
CHANGE_DETECTION_STATUS_TYPE_ID,
|
|
171
|
+
UNIVERSAL_STATUS_STORE_OPTIONS,
|
|
172
|
+
countStatusesByValue,
|
|
173
|
+
createStatusStore
|
|
174
|
+
};
|