storybook 10.1.0-alpha.0 → 10.1.0-alpha.10
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/_browser-chunks/{Color-7ZNS6F6B.js → Color-FQNEU7YS.js} +79 -60
- package/dist/_browser-chunks/{chunk-BOOOPFZF.js → WithTooltip-6NHN2GXF.js} +25 -17
- package/dist/_browser-chunks/{chunk-RNE2IUTB.js → chunk-AW46NMGV.js} +9 -1
- package/dist/_browser-chunks/{chunk-C4XOKMDU.js → chunk-QMY4G4R2.js} +49 -49
- package/dist/_browser-chunks/{syntaxhighlighter-DK2ODWXH.js → syntaxhighlighter-RJZASWHL.js} +5 -5
- package/dist/_node-chunks/{builder-manager-OTO33TIA.js → builder-manager-HA7CYFCK.js} +32 -12
- package/dist/_node-chunks/camelcase-QALD4XFE.js +18 -0
- package/dist/_node-chunks/{chunk-O4KUWXD6.js → chunk-2XY53ALL.js} +8 -8
- package/dist/_node-chunks/{chunk-Q4CZSEBO.js → chunk-3CBQMG2A.js} +7 -7
- package/dist/_node-chunks/{chunk-L5WAZZY3.js → chunk-3WDAPZYQ.js} +7 -7
- package/dist/_node-chunks/{chunk-6C7OBGYG.js → chunk-4ZB555EJ.js} +7 -7
- package/dist/_node-chunks/{chunk-RKANIOER.js → chunk-52DXKXY3.js} +8 -8
- package/dist/_node-chunks/{chunk-HYNQ2IX4.js → chunk-5OVB4A6F.js} +7 -7
- package/dist/_node-chunks/chunk-AGHGNXGH.js +18 -0
- package/dist/_node-chunks/{chunk-OYGAWJQE.js → chunk-B23X5ZCK.js} +7 -7
- package/dist/_node-chunks/{chunk-HHTKRAIE.js → chunk-B2DAHWJK.js} +25 -7
- package/dist/_node-chunks/{chunk-FDDQACQD.js → chunk-CC4PW5MJ.js} +7 -7
- package/dist/_node-chunks/{chunk-Q6QFW2Y7.js → chunk-D7NIZELR.js} +67 -59
- package/dist/_node-chunks/{chunk-EFJRT54D.js → chunk-DO5Q3H4L.js} +7 -7
- package/dist/_node-chunks/{chunk-VW3GGAQI.js → chunk-ECK7WVFX.js} +12 -12
- package/dist/_node-chunks/{chunk-XI2VU32X.js → chunk-EUH3NHXA.js} +7 -7
- package/dist/_node-chunks/{chunk-YS6OLN4N.js → chunk-F3XOPI6H.js} +7 -7
- package/dist/_node-chunks/{chunk-NTB3C5XQ.js → chunk-FOQHPHCV.js} +7 -7
- package/dist/_node-chunks/{chunk-HIGKW2KB.js → chunk-G6EL47NS.js} +7 -7
- package/dist/_node-chunks/{chunk-QOI32MCO.js → chunk-GFLS4TJB.js} +7 -7
- package/dist/_node-chunks/{chunk-2WZNP46P.js → chunk-J3XZKWHE.js} +8 -8
- package/dist/_node-chunks/{chunk-LOF6SIRE.js → chunk-LE63EHJ5.js} +12 -12
- package/dist/_node-chunks/{chunk-RR6Q3657.js → chunk-M47XA42S.js} +9 -9
- package/dist/_node-chunks/{chunk-VL6WDGIU.js → chunk-OOI74AL3.js} +6 -6
- package/dist/_node-chunks/{chunk-AITYHU22.js → chunk-OVXB5GGT.js} +7 -7
- package/dist/_node-chunks/chunk-PRJHT3GJ.js +61 -0
- package/dist/_node-chunks/{chunk-SV7ZHC5Z.js → chunk-Q52PVUSU.js} +7 -7
- package/dist/_node-chunks/{chunk-NTAOH664.js → chunk-RMHAL25C.js} +9 -9
- package/dist/_node-chunks/{chunk-A6T2YN75.js → chunk-SDCF5RNN.js} +15 -15
- package/dist/_node-chunks/{chunk-3ICYWJ3N.js → chunk-UJ5SJ23M.js} +7 -7
- package/dist/_node-chunks/{chunk-FWW4IJCM.js → chunk-UPHK4ETU.js} +19 -17
- package/dist/_node-chunks/{chunk-O3OJUFKU.js → chunk-V7VURIPB.js} +8 -8
- package/dist/_node-chunks/{chunk-6M2IPO4E.js → chunk-VPR5IBMG.js} +6 -6
- package/dist/_node-chunks/{chunk-27W6KHQ2.js → chunk-X4XU27M6.js} +7 -7
- package/dist/_node-chunks/{chunk-ZFRTME73.js → chunk-ZHSCUGNP.js} +1467 -148
- package/dist/_node-chunks/{dist-BA2GAJJB.js → dist-6TXHNR5C.js} +9 -9
- package/dist/_node-chunks/{globby-4HAI4KJH.js → globby-PBTV6PX6.js} +9 -9
- package/dist/_node-chunks/{lib-ITRY6RT7.js → lib-4RTDZVGX.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-7PULFTZI.js → mdx-N42X6CFJ-COWEH7KR.js} +8 -8
- package/dist/_node-chunks/{p-limit-63FY4KTG.js → p-limit-PBVZQOFY.js} +7 -7
- package/dist/_node-chunks/{plugin-2BSKCSMA.js → plugin-6ZPCS4LI.js} +10 -10
- package/dist/_node-chunks/{plugin-JEBMTDIB.js → plugin-EOZKYZAG.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-AZ7YPMMD.js → webpack-inject-mocker-runtime-plugin-35HMSMR5.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-7IF6PA2O.js → webpack-mock-plugin-GT3MA5E2.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +50 -74
- package/dist/common/index.d.ts +210 -3
- package/dist/common/index.js +28 -20
- package/dist/components/index.d.ts +472 -280
- package/dist/components/index.js +20367 -75
- package/dist/core-server/index.js +1128 -247
- package/dist/core-server/presets/common-manager.js +1143 -2230
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +27 -27
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf/index.js +13 -6
- package/dist/csf-tools/index.d.ts +15 -4
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +40951 -26253
- package/dist/manager/runtime.js +1688 -2693
- package/dist/manager-api/index.d.ts +11 -3
- package/dist/manager-api/index.js +53 -6
- package/dist/node-logger/index.d.ts +1 -1
- package/dist/node-logger/index.js +473 -448
- package/dist/preview/runtime.js +903 -896
- package/dist/preview-api/index.d.ts +68 -67
- package/dist/preview-api/index.js +5 -5
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/test/index.js +547 -547
- package/dist/theming/create.d.ts +4 -2
- package/dist/theming/create.js +1 -1
- package/dist/theming/index.d.ts +9 -6
- package/dist/theming/index.js +13 -6
- package/dist/types/index.d.ts +50 -5
- package/package.json +14 -6
- package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
- package/dist/_browser-chunks/chunk-I74EUU5O.js +0 -5809
- package/dist/_node-chunks/camelcase-HURSU73A.js +0 -18
- package/dist/_node-chunks/chunk-P7ZABCRS.js +0 -18
- package/dist/_node-chunks/chunk-QWBT2XCX.js +0 -61
- package/dist/_browser-chunks/{chunk-W4QKLQSC.js → chunk-RW5PKMWM.js} +5 -5
|
@@ -391,17 +391,23 @@ interface SubState$5 {
|
|
|
391
391
|
settings: API_Settings;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
declare const isMacLike: () => boolean;
|
|
395
394
|
declare const controlOrMetaSymbol: () => "⌘" | "ctrl";
|
|
396
|
-
declare const controlOrMetaKey: () => "
|
|
395
|
+
declare const controlOrMetaKey: () => "meta" | "control";
|
|
397
396
|
declare const optionOrAltSymbol: () => "⌥" | "alt";
|
|
398
397
|
declare const isShortcutTaken: (arr1: string[], arr2: string[]) => boolean;
|
|
399
398
|
type KeyboardEventLike = Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'key' | 'code' | 'keyCode' | 'preventDefault'>;
|
|
400
399
|
declare const eventToShortcut: (e: KeyboardEventLike) => (string | string[])[] | null;
|
|
401
400
|
declare const shortcutMatchesShortcut: (inputShortcut: (string | string[])[], shortcut: API_KeyCollection) => boolean;
|
|
402
401
|
declare const eventMatchesShortcut: (e: KeyboardEventLike, shortcut: API_KeyCollection) => boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Returns a human-readable symbol for a keyboard key.
|
|
404
|
+
*
|
|
405
|
+
* @param key The key to convert to a symbol.
|
|
406
|
+
* @returns A string that a human could understand as that keyboard key.
|
|
407
|
+
*/
|
|
403
408
|
declare const keyToSymbol: (key: string) => string;
|
|
404
409
|
declare const shortcutToHumanString: (shortcut: API_KeyCollection) => string;
|
|
410
|
+
declare const shortcutToAriaKeyshortcuts: (shortcut: API_KeyCollection) => string;
|
|
405
411
|
|
|
406
412
|
interface SubState$4 {
|
|
407
413
|
shortcuts: API_Shortcuts;
|
|
@@ -828,6 +834,8 @@ declare class RequestResponseError<Payload extends Record<string, any> | void> e
|
|
|
828
834
|
}
|
|
829
835
|
declare const experimental_requestResponse: <RequestPayload, ResponsePayload = void, CreateNewStoryErrorPayload extends Record<string, any> | void = void>(channel: Channel, requestEvent: string, responseEvent: string, payload: RequestPayload, timeout?: number) => Promise<ResponsePayload>;
|
|
830
836
|
|
|
837
|
+
declare const isMacLike: () => boolean;
|
|
838
|
+
|
|
831
839
|
declare const _default: <TObj = any>(a: TObj, ...b: Partial<TObj>[]) => TObj;
|
|
832
840
|
|
|
833
841
|
declare const ActiveTabs: {
|
|
@@ -2026,4 +2034,4 @@ declare const getTestProviderStoreById: (testProviderId: TestProviderId) => Test
|
|
|
2026
2034
|
declare const useTestProviderStore: UseTestProviderStore;
|
|
2027
2035
|
declare const universalTestProviderStore: UniversalStore<TestProviderStateByProviderId, TestProviderStoreEvent>;
|
|
2028
2036
|
|
|
2029
|
-
export { type API, type API_EventMap, ActiveTabs, AddonStore, type Combo, ManagerConsumer as Consumer, type KeyboardEventLike, ManagerContext, type ManagerProviderProps, ManagerProvider as Provider, RequestResponseError, type State, type Options as StoreOptions, addons, combineParameters, controlOrMetaKey, controlOrMetaSymbol, eventMatchesShortcut, eventToShortcut, MockUniversalStore as experimental_MockUniversalStore, UniversalStore as experimental_UniversalStore, getStatusStoreByTypeId as experimental_getStatusStore, getTestProviderStoreById as experimental_getTestProviderStore, experimental_requestResponse, useStatusStore as experimental_useStatusStore, useTestProviderStore as experimental_useTestProviderStore, useUniversalStore as experimental_useUniversalStore, fullStatusStore as internal_fullStatusStore, fullTestProviderStore as internal_fullTestProviderStore, universalStatusStore as internal_universalStatusStore, universalTestProviderStore as internal_universalTestProviderStore, isMacLike, isShortcutTaken, keyToSymbol, _default as merge, mockChannel, optionOrAltSymbol, shortcutMatchesShortcut, shortcutToHumanString, typesX as types, useAddonState, useArgTypes, useArgs, useChannel, useGlobalTypes, useGlobals, useParameter, useSharedState, useStoryPrepared, useStorybookApi, useStorybookState };
|
|
2037
|
+
export { type API, type API_EventMap, type API_KeyCollection, ActiveTabs, AddonStore, type Combo, ManagerConsumer as Consumer, type KeyboardEventLike, ManagerContext, type ManagerProviderProps, ManagerProvider as Provider, RequestResponseError, type State, type Options as StoreOptions, addons, combineParameters, controlOrMetaKey, controlOrMetaSymbol, eventMatchesShortcut, eventToShortcut, MockUniversalStore as experimental_MockUniversalStore, UniversalStore as experimental_UniversalStore, getStatusStoreByTypeId as experimental_getStatusStore, getTestProviderStoreById as experimental_getTestProviderStore, experimental_requestResponse, useStatusStore as experimental_useStatusStore, useTestProviderStore as experimental_useTestProviderStore, useUniversalStore as experimental_useUniversalStore, fullStatusStore as internal_fullStatusStore, fullTestProviderStore as internal_fullTestProviderStore, universalStatusStore as internal_universalStatusStore, universalTestProviderStore as internal_universalTestProviderStore, isMacLike, isShortcutTaken, keyToSymbol, _default as merge, mockChannel, optionOrAltSymbol, shortcutMatchesShortcut, shortcutToAriaKeyshortcuts, shortcutToHumanString, typesX as types, useAddonState, useArgTypes, useArgs, useChannel, useGlobalTypes, useGlobals, useParameter, useSharedState, useStoryPrepared, useStorybookApi, useStorybookState };
|
|
@@ -1653,17 +1653,50 @@ var init5 = /* @__PURE__ */ __name(({ store: store2, provider, singleStory }) =>
|
|
|
1653
1653
|
{ persistence: "session" }
|
|
1654
1654
|
);
|
|
1655
1655
|
},
|
|
1656
|
+
/**
|
|
1657
|
+
* Attempts to focus (and select) an element identified by its ID. It is the responsibility of
|
|
1658
|
+
* the callee to ensure that the element is present in the DOM and that no focus trap is
|
|
1659
|
+
* available. This API polls and attempts to perform the focus for a set duration (max 500ms),
|
|
1660
|
+
* so that race conditions can be avoided with the current API design. Because this API is
|
|
1661
|
+
* historically synchronous, it cannot report errors or failure to focus. It fails silently.
|
|
1662
|
+
*
|
|
1663
|
+
* @param elementId The id of the element to focus.
|
|
1664
|
+
* @param select Whether to call select() on the element after focusing it.
|
|
1665
|
+
*/
|
|
1656
1666
|
focusOnUIElement(elementId, select) {
|
|
1657
1667
|
if (!elementId) {
|
|
1658
1668
|
return;
|
|
1659
1669
|
}
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1670
|
+
const startTime = Date.now();
|
|
1671
|
+
const maxDuration = 500;
|
|
1672
|
+
const pollInterval = 50;
|
|
1673
|
+
const attemptFocus = /* @__PURE__ */ __name(() => {
|
|
1674
|
+
const element = document2.getElementById(elementId);
|
|
1675
|
+
if (!element) {
|
|
1676
|
+
return false;
|
|
1677
|
+
}
|
|
1662
1678
|
element.focus();
|
|
1679
|
+
if (element !== document2.activeElement) {
|
|
1680
|
+
return false;
|
|
1681
|
+
}
|
|
1663
1682
|
if (select) {
|
|
1664
|
-
element.select();
|
|
1683
|
+
element.select?.();
|
|
1665
1684
|
}
|
|
1685
|
+
return true;
|
|
1686
|
+
}, "attemptFocus");
|
|
1687
|
+
if (attemptFocus()) {
|
|
1688
|
+
return;
|
|
1666
1689
|
}
|
|
1690
|
+
const intervalId = setInterval(() => {
|
|
1691
|
+
const elapsed = Date.now() - startTime;
|
|
1692
|
+
if (elapsed >= maxDuration) {
|
|
1693
|
+
clearInterval(intervalId);
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
if (attemptFocus()) {
|
|
1697
|
+
clearInterval(intervalId);
|
|
1698
|
+
}
|
|
1699
|
+
}, pollInterval);
|
|
1667
1700
|
},
|
|
1668
1701
|
getInitialOptions() {
|
|
1669
1702
|
const { theme, selectedPanel, layoutCustomisations, ...options } = provider.getConfig();
|
|
@@ -1930,16 +1963,18 @@ import {
|
|
|
1930
1963
|
} from "storybook/internal/core-events";
|
|
1931
1964
|
import { global as global5 } from "@storybook/global";
|
|
1932
1965
|
|
|
1933
|
-
// src/manager-api/lib/
|
|
1966
|
+
// src/manager-api/lib/platform.ts
|
|
1934
1967
|
import { global as global4 } from "@storybook/global";
|
|
1935
1968
|
var { navigator: navigator2 } = global4;
|
|
1936
1969
|
var isMacLike = /* @__PURE__ */ __name(() => navigator2 && navigator2.platform ? !!navigator2.platform.match(/(Mac|iPhone|iPod|iPad)/i) : false, "isMacLike");
|
|
1970
|
+
|
|
1971
|
+
// src/manager-api/lib/shortcut.ts
|
|
1937
1972
|
var controlOrMetaSymbol = /* @__PURE__ */ __name(() => isMacLike() ? "\u2318" : "ctrl", "controlOrMetaSymbol");
|
|
1938
1973
|
var controlOrMetaKey = /* @__PURE__ */ __name(() => isMacLike() ? "meta" : "control", "controlOrMetaKey");
|
|
1939
1974
|
var optionOrAltSymbol = /* @__PURE__ */ __name(() => isMacLike() ? "\u2325" : "alt", "optionOrAltSymbol");
|
|
1940
1975
|
var isShortcutTaken = /* @__PURE__ */ __name((arr1, arr2) => JSON.stringify(arr1) === JSON.stringify(arr2), "isShortcutTaken");
|
|
1941
1976
|
var eventToShortcut = /* @__PURE__ */ __name((e) => {
|
|
1942
|
-
if (["Meta", "Alt", "Control", "Shift"].includes(e.key)) {
|
|
1977
|
+
if (["Meta", "Alt", "Control", "Shift", "Tab"].includes(e.key)) {
|
|
1943
1978
|
return null;
|
|
1944
1979
|
}
|
|
1945
1980
|
const keys2 = [];
|
|
@@ -2057,6 +2092,17 @@ var keyToSymbol = /* @__PURE__ */ __name((key) => {
|
|
|
2057
2092
|
var shortcutToHumanString = /* @__PURE__ */ __name((shortcut) => {
|
|
2058
2093
|
return shortcut.map(keyToSymbol).join(" ");
|
|
2059
2094
|
}, "shortcutToHumanString");
|
|
2095
|
+
var shortcutToAriaKeyshortcuts = /* @__PURE__ */ __name((shortcut) => {
|
|
2096
|
+
return shortcut.map((shortcut2) => {
|
|
2097
|
+
if (shortcut2 === "+") {
|
|
2098
|
+
return "plus";
|
|
2099
|
+
}
|
|
2100
|
+
if (shortcut2 === " ") {
|
|
2101
|
+
return "space";
|
|
2102
|
+
}
|
|
2103
|
+
return shortcut2;
|
|
2104
|
+
}).join("+");
|
|
2105
|
+
}, "shortcutToAriaKeyshortcuts");
|
|
2060
2106
|
|
|
2061
2107
|
// src/manager-api/modules/shortcuts.ts
|
|
2062
2108
|
var { navigator: navigator3, document: document3 } = global5;
|
|
@@ -3262,7 +3308,7 @@ import { global as global8 } from "@storybook/global";
|
|
|
3262
3308
|
import semver from "semver";
|
|
3263
3309
|
|
|
3264
3310
|
// src/manager-api/version.ts
|
|
3265
|
-
var version = "10.1.0-alpha.
|
|
3311
|
+
var version = "10.1.0-alpha.10";
|
|
3266
3312
|
|
|
3267
3313
|
// src/manager-api/modules/versions.ts
|
|
3268
3314
|
var { VERSIONCHECK } = global8;
|
|
@@ -4047,6 +4093,7 @@ export {
|
|
|
4047
4093
|
mockChannel,
|
|
4048
4094
|
optionOrAltSymbol,
|
|
4049
4095
|
shortcutMatchesShortcut,
|
|
4096
|
+
shortcutToAriaKeyshortcuts,
|
|
4050
4097
|
shortcutToHumanString,
|
|
4051
4098
|
typesX as types,
|
|
4052
4099
|
useAddonState,
|
|
@@ -473,7 +473,7 @@ declare const logger: {
|
|
|
473
473
|
time: [number, number];
|
|
474
474
|
}) => void;
|
|
475
475
|
setLevel: (level?: LogLevel) => void;
|
|
476
|
-
error: (message:
|
|
476
|
+
error: (message: unknown) => void;
|
|
477
477
|
setLogLevel: (level: LogLevel) => void;
|
|
478
478
|
getLogLevel: () => LogLevel;
|
|
479
479
|
shouldLog: (level: LogLevel) => boolean;
|