@fluentui/react-storybook-addon 0.4.0 → 0.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/CHANGELOG.md +12 -2
- package/dist/index.d.ts +86 -0
- package/lib/components/DirectionSwitch.js +26 -0
- package/lib/components/DirectionSwitch.js.map +1 -0
- package/lib/components/ReactStrictMode.js +23 -0
- package/lib/components/ReactStrictMode.js.map +1 -0
- package/lib/components/ThemePicker.js +61 -0
- package/lib/components/ThemePicker.js.map +1 -0
- package/lib/constants.js +4 -0
- package/lib/constants.js.map +1 -0
- package/lib/decorators/withAriaLive.js +18 -0
- package/lib/decorators/withAriaLive.js.map +1 -0
- package/lib/decorators/withFluentProvider.js +48 -0
- package/lib/decorators/withFluentProvider.js.map +1 -0
- package/lib/decorators/withReactStrictMode.js +16 -0
- package/lib/decorators/withReactStrictMode.js.map +1 -0
- package/lib/docs/DirSwitch.js +51 -0
- package/lib/docs/DirSwitch.js.map +1 -0
- package/lib/docs/FluentDocsContainer.js +24 -0
- package/lib/docs/FluentDocsContainer.js.map +1 -0
- package/lib/docs/FluentDocsPage.js +296 -0
- package/lib/docs/FluentDocsPage.js.map +1 -0
- package/lib/docs/ThemePicker.js +61 -0
- package/lib/docs/ThemePicker.js.map +1 -0
- package/lib/docs/Toc.js +130 -0
- package/lib/docs/Toc.js.map +1 -0
- package/lib/docs/index.js +2 -0
- package/lib/docs/index.js.map +1 -0
- package/lib/docs/utils.js +72 -0
- package/lib/docs/utils.js.map +1 -0
- package/lib/hooks.js +16 -0
- package/lib/hooks.js.map +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/preset/manager.js +28 -0
- package/lib/preset/manager.js.map +1 -0
- package/lib/preset/preview.js +26 -0
- package/lib/preset/preview.js.map +1 -0
- package/lib/theme.js +31 -0
- package/lib/theme.js.map +1 -0
- package/lib/utils/isDecoratorDisabled.js +6 -0
- package/lib/utils/isDecoratorDisabled.js.map +1 -0
- package/lib-commonjs/components/DirectionSwitch.js +37 -0
- package/lib-commonjs/components/DirectionSwitch.js.map +1 -0
- package/lib-commonjs/components/ReactStrictMode.js +34 -0
- package/lib-commonjs/components/ReactStrictMode.js.map +1 -0
- package/lib-commonjs/components/ThemePicker.js +72 -0
- package/lib-commonjs/components/ThemePicker.js.map +1 -0
- package/lib-commonjs/constants.js +28 -0
- package/lib-commonjs/constants.js.map +1 -0
- package/lib-commonjs/decorators/withAriaLive.js +29 -0
- package/lib-commonjs/decorators/withAriaLive.js.map +1 -0
- package/lib-commonjs/decorators/withFluentProvider.js +59 -0
- package/lib-commonjs/decorators/withFluentProvider.js.map +1 -0
- package/lib-commonjs/decorators/withReactStrictMode.js +27 -0
- package/lib-commonjs/decorators/withReactStrictMode.js.map +1 -0
- package/lib-commonjs/docs/DirSwitch.js +60 -0
- package/lib-commonjs/docs/DirSwitch.js.map +1 -0
- package/lib-commonjs/docs/FluentDocsContainer.js +33 -0
- package/lib-commonjs/docs/FluentDocsContainer.js.map +1 -0
- package/lib-commonjs/docs/FluentDocsPage.js +307 -0
- package/lib-commonjs/docs/FluentDocsPage.js.map +1 -0
- package/lib-commonjs/docs/ThemePicker.js +70 -0
- package/lib-commonjs/docs/ThemePicker.js.map +1 -0
- package/lib-commonjs/docs/Toc.js +149 -0
- package/lib-commonjs/docs/Toc.js.map +1 -0
- package/lib-commonjs/docs/index.js +20 -0
- package/lib-commonjs/docs/index.js.map +1 -0
- package/lib-commonjs/docs/utils.js +86 -0
- package/lib-commonjs/docs/utils.js.map +1 -0
- package/lib-commonjs/hooks.js +37 -0
- package/lib-commonjs/hooks.js.map +1 -0
- package/lib-commonjs/index.js +27 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/preset/manager.js +32 -0
- package/lib-commonjs/preset/manager.js.map +1 -0
- package/lib-commonjs/preset/preview.js +47 -0
- package/lib-commonjs/preset/preview.js.map +1 -0
- package/lib-commonjs/theme.js +49 -0
- package/lib-commonjs/theme.js.map +1 -0
- package/lib-commonjs/utils/isDecoratorDisabled.js +16 -0
- package/lib-commonjs/utils/isDecoratorDisabled.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
Toc: function() {
|
|
13
|
+
return Toc;
|
|
14
|
+
},
|
|
15
|
+
nameToHash: function() {
|
|
16
|
+
return nameToHash;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
20
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
21
|
+
const _previewapi = require("@storybook/preview-api");
|
|
22
|
+
const _coreevents = require("@storybook/core-events");
|
|
23
|
+
const _react1 = require("@griffel/react");
|
|
24
|
+
const useTocStyles = (0, _react1.makeStyles)({
|
|
25
|
+
root: {
|
|
26
|
+
top: '64px',
|
|
27
|
+
position: 'sticky',
|
|
28
|
+
marginLeft: '40px'
|
|
29
|
+
},
|
|
30
|
+
heading: {
|
|
31
|
+
fontSize: '11px',
|
|
32
|
+
fontWeight: 'bold',
|
|
33
|
+
textTransform: 'uppercase',
|
|
34
|
+
marginBottom: '20px'
|
|
35
|
+
},
|
|
36
|
+
ol: {
|
|
37
|
+
position: 'relative',
|
|
38
|
+
listStyleType: 'none',
|
|
39
|
+
marginLeft: 0,
|
|
40
|
+
marginTop: 0,
|
|
41
|
+
paddingInlineStart: '20px',
|
|
42
|
+
'& li': {
|
|
43
|
+
marginBottom: '15px',
|
|
44
|
+
lineHeight: '16px'
|
|
45
|
+
},
|
|
46
|
+
'& a': {
|
|
47
|
+
textDecorationLine: 'none',
|
|
48
|
+
color: '#201F1E',
|
|
49
|
+
fontSize: '14px',
|
|
50
|
+
':hover': {
|
|
51
|
+
color: '#201F1E'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
'&:before': {
|
|
55
|
+
content: '""',
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
left: 0,
|
|
58
|
+
height: '100%',
|
|
59
|
+
width: '3px',
|
|
60
|
+
backgroundColor: '#EDEBE9',
|
|
61
|
+
borderRadius: '4px'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
selected: {
|
|
65
|
+
position: 'relative',
|
|
66
|
+
'&:after': {
|
|
67
|
+
content: '""',
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
left: '-20px',
|
|
70
|
+
top: 0,
|
|
71
|
+
bottom: 0,
|
|
72
|
+
width: '3px',
|
|
73
|
+
backgroundColor: '#436DCD',
|
|
74
|
+
borderRadius: '4px'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// // Alternative approach to navigate - rerenders the iframe
|
|
79
|
+
// // Usage: selectStory({ story: s.name, kind: s.kind });
|
|
80
|
+
// const selectStory = (story: { kind: string; story: string }) => {
|
|
81
|
+
// console.log('Select Story', story);
|
|
82
|
+
// addons.getChannel().emit(SELECT_STORY, story);
|
|
83
|
+
// };
|
|
84
|
+
const navigate = (url)=>{
|
|
85
|
+
_previewapi.addons.getChannel().emit(_coreevents.NAVIGATE_URL, url);
|
|
86
|
+
};
|
|
87
|
+
const nameToHash = (id)=>id.toLowerCase().replace(/[^a-z0-9]/gi, '-');
|
|
88
|
+
const Toc = ({ stories })=>{
|
|
89
|
+
const [selected, setSelected] = _react.useState('');
|
|
90
|
+
const isNavigating = _react.useRef(false);
|
|
91
|
+
_react.useEffect(()=>{
|
|
92
|
+
// eslint-disable-next-line @nx/workspace-no-restricted-globals
|
|
93
|
+
const observer = new IntersectionObserver((entries)=>{
|
|
94
|
+
if (isNavigating.current) {
|
|
95
|
+
isNavigating.current = false;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
for (const entry of entries){
|
|
99
|
+
const { intersectionRatio, target } = entry;
|
|
100
|
+
if (intersectionRatio > 0.5) {
|
|
101
|
+
setSelected(target.id);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
threshold: [
|
|
107
|
+
0.5
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
stories.forEach((link)=>{
|
|
111
|
+
// eslint-disable-next-line @nx/workspace-no-restricted-globals
|
|
112
|
+
const element = document.getElementById(nameToHash(link.name));
|
|
113
|
+
if (element) {
|
|
114
|
+
observer.observe(element);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return ()=>observer.disconnect();
|
|
118
|
+
}, [
|
|
119
|
+
stories
|
|
120
|
+
]);
|
|
121
|
+
const tocItems = stories.map((item)=>{
|
|
122
|
+
return {
|
|
123
|
+
...item,
|
|
124
|
+
selected: nameToHash(item.name) === selected
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
const tocClasses = useTocStyles();
|
|
128
|
+
return /*#__PURE__*/ _react.createElement("nav", {
|
|
129
|
+
className: tocClasses.root
|
|
130
|
+
}, /*#__PURE__*/ _react.createElement("h3", {
|
|
131
|
+
className: tocClasses.heading
|
|
132
|
+
}, "On this page"), /*#__PURE__*/ _react.createElement("ol", {
|
|
133
|
+
className: tocClasses.ol
|
|
134
|
+
}, tocItems.map((s)=>{
|
|
135
|
+
const name = nameToHash(s.name);
|
|
136
|
+
return /*#__PURE__*/ _react.createElement("li", {
|
|
137
|
+
className: s.selected ? tocClasses.selected : '',
|
|
138
|
+
key: s.id
|
|
139
|
+
}, /*#__PURE__*/ _react.createElement("a", {
|
|
140
|
+
href: `#${name}`,
|
|
141
|
+
target: "_self",
|
|
142
|
+
onClick: (e)=>{
|
|
143
|
+
isNavigating.current = true;
|
|
144
|
+
navigate(`#${name}`);
|
|
145
|
+
setSelected(name);
|
|
146
|
+
}
|
|
147
|
+
}, s.name));
|
|
148
|
+
})));
|
|
149
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/docs/Toc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { addons } from '@storybook/preview-api';\nimport { NAVIGATE_URL } from '@storybook/core-events';\n\nimport { makeStyles } from '@griffel/react';\n\nconst useTocStyles = makeStyles({\n root: {\n top: '64px',\n position: 'sticky',\n marginLeft: '40px',\n },\n heading: {\n fontSize: '11px',\n fontWeight: 'bold',\n textTransform: 'uppercase',\n marginBottom: '20px',\n },\n ol: {\n position: 'relative',\n listStyleType: 'none',\n marginLeft: 0,\n marginTop: 0,\n paddingInlineStart: '20px',\n '& li': {\n marginBottom: '15px',\n lineHeight: '16px',\n },\n '& a': {\n textDecorationLine: 'none',\n color: '#201F1E',\n fontSize: '14px',\n ':hover': {\n color: '#201F1E',\n },\n },\n '&:before': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n height: '100%',\n width: '3px',\n backgroundColor: '#EDEBE9',\n borderRadius: '4px',\n },\n },\n selected: {\n position: 'relative',\n '&:after': {\n content: '\"\"',\n position: 'absolute',\n left: '-20px',\n top: 0,\n bottom: 0,\n width: '3px',\n backgroundColor: '#436DCD',\n borderRadius: '4px',\n },\n },\n});\n\ntype TocItem = { name: string; id: string; selected?: boolean };\n\n// // Alternative approach to navigate - rerenders the iframe\n// // Usage: selectStory({ story: s.name, kind: s.kind });\n// const selectStory = (story: { kind: string; story: string }) => {\n// console.log('Select Story', story);\n// addons.getChannel().emit(SELECT_STORY, story);\n// };\n\nconst navigate = (url: string) => {\n addons.getChannel().emit(NAVIGATE_URL, url);\n};\n\nexport const nameToHash = (id: string): string => id.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n\nexport const Toc = ({ stories }: { stories: TocItem[] }) => {\n const [selected, setSelected] = React.useState('');\n const isNavigating = React.useRef<boolean>(false);\n\n React.useEffect(() => {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n const observer = new IntersectionObserver(\n (entries: IntersectionObserverEntry[]) => {\n if (isNavigating.current) {\n isNavigating.current = false;\n return;\n }\n for (const entry of entries) {\n const { intersectionRatio, target } = entry;\n if (intersectionRatio > 0.5) {\n setSelected(target.id);\n return;\n }\n }\n },\n {\n threshold: [0.5],\n },\n );\n\n stories.forEach(link => {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n const element = document.getElementById(nameToHash(link.name));\n if (element) {\n observer.observe(element);\n }\n });\n\n return () => observer.disconnect();\n }, [stories]);\n\n const tocItems = stories.map(item => {\n return { ...item, selected: nameToHash(item.name) === selected };\n });\n const tocClasses = useTocStyles();\n return (\n <nav className={tocClasses.root}>\n <h3 className={tocClasses.heading}>On this page</h3>\n <ol className={tocClasses.ol}>\n {tocItems.map(s => {\n const name = nameToHash(s.name);\n return (\n <li className={s.selected ? tocClasses.selected : ''} key={s.id}>\n <a\n href={`#${name}`}\n target=\"_self\"\n onClick={e => {\n isNavigating.current = true;\n navigate(`#${name}`);\n setSelected(name);\n }}\n >\n {s.name}\n </a>\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n"],"names":["Toc","nameToHash","useTocStyles","makeStyles","root","top","position","marginLeft","heading","fontSize","fontWeight","textTransform","marginBottom","ol","listStyleType","marginTop","paddingInlineStart","lineHeight","textDecorationLine","color","content","left","height","width","backgroundColor","borderRadius","selected","bottom","navigate","url","addons","getChannel","emit","NAVIGATE_URL","id","toLowerCase","replace","stories","setSelected","React","useState","isNavigating","useRef","useEffect","observer","IntersectionObserver","entries","current","entry","intersectionRatio","target","threshold","forEach","link","element","document","getElementById","name","observe","disconnect","tocItems","map","item","tocClasses","nav","className","h3","s","li","key","a","href","onClick","e"],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
FluentDocsContainer: function() {
|
|
13
|
+
return _FluentDocsContainer.FluentDocsContainer;
|
|
14
|
+
},
|
|
15
|
+
FluentDocsPage: function() {
|
|
16
|
+
return _FluentDocsPage.FluentDocsPage;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _FluentDocsContainer = require("./FluentDocsContainer");
|
|
20
|
+
const _FluentDocsPage = require("./FluentDocsPage");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/docs/index.ts"],"sourcesContent":["export { FluentDocsContainer } from './FluentDocsContainer';\nexport { FluentDocsPage } from './FluentDocsPage';\n"],"names":["FluentDocsContainer","FluentDocsPage"],"mappings":";;;;;;;;;;;IAASA,mBAAmB;eAAnBA,wCAAmB;;IACnBC,cAAc;eAAdA,8BAAc;;;qCADa;gCACL"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getDocsPageConfig: function() {
|
|
13
|
+
return getDocsPageConfig;
|
|
14
|
+
},
|
|
15
|
+
isDocsEnabled: function() {
|
|
16
|
+
return isDocsEnabled;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const docsDefaults = {
|
|
20
|
+
tableOfContents: true,
|
|
21
|
+
dirSwitcher: true,
|
|
22
|
+
themePicker: true,
|
|
23
|
+
argTable: {
|
|
24
|
+
slotsApi: true,
|
|
25
|
+
nativePropsApi: true
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function getDocsParametersConfig(context) {
|
|
29
|
+
var _context_projectAnnotations_parameters_reactStorybookAddon, _context_projectAnnotations_parameters, _context_projectAnnotations;
|
|
30
|
+
return context === null || context === void 0 ? void 0 : (_context_projectAnnotations = context.projectAnnotations) === null || _context_projectAnnotations === void 0 ? void 0 : (_context_projectAnnotations_parameters = _context_projectAnnotations.parameters) === null || _context_projectAnnotations_parameters === void 0 ? void 0 : (_context_projectAnnotations_parameters_reactStorybookAddon = _context_projectAnnotations_parameters.reactStorybookAddon) === null || _context_projectAnnotations_parameters_reactStorybookAddon === void 0 ? void 0 : _context_projectAnnotations_parameters_reactStorybookAddon.docs;
|
|
31
|
+
}
|
|
32
|
+
function isDocsEnabled(context) {
|
|
33
|
+
const docsConfig = getDocsParametersConfig(context);
|
|
34
|
+
// If docs is true, enable page
|
|
35
|
+
if (docsConfig === true) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
// If docs is an object, page is enabled
|
|
39
|
+
if (typeof docsConfig === 'object' && docsConfig !== null) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
// Default: disabled
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
function getDocsPageConfig(context) {
|
|
46
|
+
const docsConfig = getDocsParametersConfig(context);
|
|
47
|
+
// If docs is true, return default config (all enabled)
|
|
48
|
+
if (docsConfig === true) {
|
|
49
|
+
return docsDefaults;
|
|
50
|
+
}
|
|
51
|
+
// If docs is an object, extract the configuration directly
|
|
52
|
+
if (typeof docsConfig === 'object' && docsConfig !== null) {
|
|
53
|
+
return {
|
|
54
|
+
tableOfContents: docsConfig.tableOfContents !== false,
|
|
55
|
+
dirSwitcher: docsConfig.dirSwitcher !== false,
|
|
56
|
+
themePicker: docsConfig.themePicker !== false,
|
|
57
|
+
argTable: getArgTableConfig(docsConfig.argTable)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Fallback
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets the argTable configuration with early exit pattern
|
|
65
|
+
*/ function getArgTableConfig(argTableConfig) {
|
|
66
|
+
if (argTableConfig === false) {
|
|
67
|
+
return {
|
|
68
|
+
slotsApi: false,
|
|
69
|
+
nativePropsApi: false
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (argTableConfig === true || argTableConfig === undefined) {
|
|
73
|
+
return {
|
|
74
|
+
slotsApi: true,
|
|
75
|
+
nativePropsApi: true
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (typeof argTableConfig === 'object' && argTableConfig !== null) {
|
|
79
|
+
return {
|
|
80
|
+
slotsApi: argTableConfig.slotsApi !== false,
|
|
81
|
+
nativePropsApi: argTableConfig.nativePropsApi !== false
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Fallback to default
|
|
85
|
+
return docsDefaults.argTable;
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/docs/utils.ts"],"sourcesContent":["import { type DocsContextProps } from '@storybook/addon-docs';\n\nimport { type FluentParameters } from '../hooks';\n\nconst docsDefaults = {\n tableOfContents: true,\n dirSwitcher: true,\n themePicker: true,\n argTable: {\n slotsApi: true,\n nativePropsApi: true,\n },\n};\n\nfunction getDocsParametersConfig(\n context: DocsContextProps,\n): NonNullable<FluentParameters['reactStorybookAddon']>['docs'] {\n return context?.projectAnnotations?.parameters?.reactStorybookAddon?.docs;\n}\n\n/**\n * Checks if the docs page is enabled\n */\nexport function isDocsEnabled(context: DocsContextProps): boolean {\n const docsConfig = getDocsParametersConfig(context);\n\n // If docs is true, enable page\n if (docsConfig === true) {\n return true;\n }\n\n // If docs is an object, page is enabled\n if (typeof docsConfig === 'object' && docsConfig !== null) {\n return true;\n }\n\n // Default: disabled\n return false;\n}\n\n/**\n * Gets the docs page configuration from context\n */\nexport function getDocsPageConfig(context: DocsContextProps) {\n const docsConfig = getDocsParametersConfig(context);\n\n // If docs is true, return default config (all enabled)\n if (docsConfig === true) {\n return docsDefaults;\n }\n\n // If docs is an object, extract the configuration directly\n if (typeof docsConfig === 'object' && docsConfig !== null) {\n return {\n tableOfContents: docsConfig.tableOfContents !== false,\n dirSwitcher: docsConfig.dirSwitcher !== false,\n themePicker: docsConfig.themePicker !== false,\n argTable: getArgTableConfig(docsConfig.argTable),\n };\n }\n\n // Fallback\n return null;\n}\n\n/**\n * Gets the argTable configuration with early exit pattern\n */\nfunction getArgTableConfig(argTableConfig: boolean | { slotsApi?: boolean; nativePropsApi?: boolean } | undefined) {\n if (argTableConfig === false) {\n return {\n slotsApi: false,\n nativePropsApi: false,\n };\n }\n\n if (argTableConfig === true || argTableConfig === undefined) {\n return {\n slotsApi: true,\n nativePropsApi: true,\n };\n }\n\n if (typeof argTableConfig === 'object' && argTableConfig !== null) {\n return {\n slotsApi: argTableConfig.slotsApi !== false,\n nativePropsApi: argTableConfig.nativePropsApi !== false,\n };\n }\n\n // Fallback to default\n return docsDefaults.argTable;\n}\n"],"names":["getDocsPageConfig","isDocsEnabled","docsDefaults","tableOfContents","dirSwitcher","themePicker","argTable","slotsApi","nativePropsApi","getDocsParametersConfig","context","projectAnnotations","parameters","reactStorybookAddon","docs","docsConfig","getArgTableConfig","argTableConfig","undefined"],"mappings":";;;;;;;;;;;IA2CgBA,iBAAiB;eAAjBA;;IApBAC,aAAa;eAAbA;;;AAnBhB,MAAMC,eAAe;IACnBC,iBAAiB;IACjBC,aAAa;IACbC,aAAa;IACbC,UAAU;QACRC,UAAU;QACVC,gBAAgB;IAClB;AACF;AAEA,SAASC,wBACPC,OAAyB;QAElBA,4DAAAA,wCAAAA;IAAP,OAAOA,oBAAAA,+BAAAA,8BAAAA,QAASC,kBAAkB,cAA3BD,mDAAAA,yCAAAA,4BAA6BE,UAAU,cAAvCF,8DAAAA,6DAAAA,uCAAyCG,mBAAmB,cAA5DH,iFAAAA,2DAA8DI,IAAI;AAC3E;AAKO,SAASb,cAAcS,OAAyB;IACrD,MAAMK,aAAaN,wBAAwBC;IAE3C,+BAA+B;IAC/B,IAAIK,eAAe,MAAM;QACvB,OAAO;IACT;IAEA,wCAAwC;IACxC,IAAI,OAAOA,eAAe,YAAYA,eAAe,MAAM;QACzD,OAAO;IACT;IAEA,oBAAoB;IACpB,OAAO;AACT;AAKO,SAASf,kBAAkBU,OAAyB;IACzD,MAAMK,aAAaN,wBAAwBC;IAE3C,uDAAuD;IACvD,IAAIK,eAAe,MAAM;QACvB,OAAOb;IACT;IAEA,2DAA2D;IAC3D,IAAI,OAAOa,eAAe,YAAYA,eAAe,MAAM;QACzD,OAAO;YACLZ,iBAAiBY,WAAWZ,eAAe,KAAK;YAChDC,aAAaW,WAAWX,WAAW,KAAK;YACxCC,aAAaU,WAAWV,WAAW,KAAK;YACxCC,UAAUU,kBAAkBD,WAAWT,QAAQ;QACjD;IACF;IAEA,WAAW;IACX,OAAO;AACT;AAEA;;CAEC,GACD,SAASU,kBAAkBC,cAAsF;IAC/G,IAAIA,mBAAmB,OAAO;QAC5B,OAAO;YACLV,UAAU;YACVC,gBAAgB;QAClB;IACF;IAEA,IAAIS,mBAAmB,QAAQA,mBAAmBC,WAAW;QAC3D,OAAO;YACLX,UAAU;YACVC,gBAAgB;QAClB;IACF;IAEA,IAAI,OAAOS,mBAAmB,YAAYA,mBAAmB,MAAM;QACjE,OAAO;YACLV,UAAUU,eAAeV,QAAQ,KAAK;YACtCC,gBAAgBS,eAAeT,cAAc,KAAK;QACpD;IACF;IAEA,sBAAsB;IACtB,OAAON,aAAaI,QAAQ;AAC9B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getParametersConfig: function() {
|
|
13
|
+
return getParametersConfig;
|
|
14
|
+
},
|
|
15
|
+
parameters: function() {
|
|
16
|
+
return parameters;
|
|
17
|
+
},
|
|
18
|
+
useGlobals: function() {
|
|
19
|
+
return useGlobals;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _managerapi = require("@storybook/manager-api");
|
|
23
|
+
function useGlobals() {
|
|
24
|
+
return (0, _managerapi.useGlobals)();
|
|
25
|
+
}
|
|
26
|
+
function parameters(options) {
|
|
27
|
+
return {
|
|
28
|
+
dir: 'ltr',
|
|
29
|
+
fluentTheme: 'web-light',
|
|
30
|
+
mode: 'default',
|
|
31
|
+
...options
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function getParametersConfig(context) {
|
|
35
|
+
var _context_parameters;
|
|
36
|
+
return context === null || context === void 0 ? void 0 : (_context_parameters = context.parameters) === null || _context_parameters === void 0 ? void 0 : _context_parameters.reactStorybookAddon;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks.ts"],"sourcesContent":["import { useGlobals as useStorybookGlobals } from '@storybook/manager-api';\nimport { Args as StorybookArgs, StoryContext as StorybookContext, Parameters } from '@storybook/react';\n\nimport { DIR_ID, STRICT_MODE_ID, THEME_ID } from './constants';\nimport type { ThemeIds } from './theme';\n\nexport interface FluentStoryContext extends StorybookContext {\n globals: FluentGlobals;\n parameters: FluentParameters;\n}\n\n/**\n * Extends the storybook globals object to include fluent specific properties\n */\nexport interface FluentGlobals extends StorybookArgs {\n [DIR_ID]?: 'ltr' | 'rtl';\n [THEME_ID]?: ThemeIds;\n [STRICT_MODE_ID]?: boolean;\n}\n\n/**\n * Extends the storybook parameters object to include fluent specific properties\n */\nexport interface FluentParameters extends Parameters {\n dir?: 'ltr' | 'rtl';\n fluentTheme?: ThemeIds;\n mode?: 'default' | 'vr-test';\n reactStorybookAddon?: {\n disabledDecorators?: ['AriaLive' | 'FluentProvider' | 'ReactStrictMode'];\n docs?: FluentDocsConfig;\n };\n}\n\n/**\n * Configuration for docs components\n */\ntype FluentDocsConfig =\n | boolean\n | {\n tableOfContents?: boolean;\n dirSwitcher?: boolean;\n themePicker?: boolean;\n argTable?:\n | boolean\n | {\n slotsApi?: boolean;\n nativePropsApi?: boolean;\n };\n };\n\nexport function useGlobals(): [FluentGlobals, (newGlobals: FluentGlobals) => void] {\n return useStorybookGlobals();\n}\n\nexport function parameters(options?: FluentParameters) {\n return { dir: 'ltr', fluentTheme: 'web-light', mode: 'default', ...options };\n}\nexport function getParametersConfig(context: FluentStoryContext) {\n return context?.parameters?.reactStorybookAddon;\n}\n"],"names":["getParametersConfig","parameters","useGlobals","useStorybookGlobals","options","dir","fluentTheme","mode","context","reactStorybookAddon"],"mappings":";;;;;;;;;;;IAyDgBA,mBAAmB;eAAnBA;;IAHAC,UAAU;eAAVA;;IAJAC,UAAU;eAAVA;;;4BAlDkC;AAkD3C,SAASA;IACd,OAAOC,IAAAA,sBAAmB;AAC5B;AAEO,SAASF,WAAWG,OAA0B;IACnD,OAAO;QAAEC,KAAK;QAAOC,aAAa;QAAaC,MAAM;QAAW,GAAGH,OAAO;IAAC;AAC7E;AACO,SAASJ,oBAAoBQ,OAA2B;QACtDA;IAAP,OAAOA,oBAAAA,+BAAAA,sBAAAA,QAASP,UAAU,cAAnBO,0CAAAA,oBAAqBC,mBAAmB;AACjD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
DIR_ID: function() {
|
|
13
|
+
return _constants.DIR_ID;
|
|
14
|
+
},
|
|
15
|
+
THEME_ID: function() {
|
|
16
|
+
return _constants.THEME_ID;
|
|
17
|
+
},
|
|
18
|
+
parameters: function() {
|
|
19
|
+
return _hooks.parameters;
|
|
20
|
+
},
|
|
21
|
+
themes: function() {
|
|
22
|
+
return _theme.themes;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _theme = require("./theme");
|
|
26
|
+
const _constants = require("./constants");
|
|
27
|
+
const _hooks = require("./hooks");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { FluentGlobals, FluentParameters, FluentStoryContext } from './hooks';\nexport type { ThemeIds } from './theme';\nexport { themes } from './theme';\nexport { DIR_ID, THEME_ID } from './constants';\nexport { parameters } from './hooks';\n"],"names":["DIR_ID","THEME_ID","parameters","themes"],"mappings":";;;;;;;;;;;IAGSA,MAAM;eAANA,iBAAM;;IAAEC,QAAQ;eAARA,mBAAQ;;IAChBC,UAAU;eAAVA,iBAAU;;IAFVC,MAAM;eAANA,aAAM;;;uBAAQ;2BACU;uBACN"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _managerapi = require("@storybook/manager-api");
|
|
6
|
+
const _constants = require("../constants");
|
|
7
|
+
const _ThemePicker = require("../components/ThemePicker");
|
|
8
|
+
const _ReactStrictMode = require("../components/ReactStrictMode");
|
|
9
|
+
const _DirectionSwitch = require("../components/DirectionSwitch");
|
|
10
|
+
_managerapi.addons.register(_constants.ADDON_ID, ()=>{
|
|
11
|
+
_managerapi.addons.add(_constants.THEME_ID, {
|
|
12
|
+
title: 'Fluent Theme Picker',
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
14
|
+
type: _managerapi.types.TOOL,
|
|
15
|
+
match: ({ viewMode })=>!!(viewMode && viewMode.match(/^(story|docs)$/)),
|
|
16
|
+
render: _ThemePicker.ThemePicker
|
|
17
|
+
});
|
|
18
|
+
_managerapi.addons.add(_constants.DIR_ID, {
|
|
19
|
+
title: 'Direction Switch',
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
21
|
+
type: _managerapi.types.TOOL,
|
|
22
|
+
match: ({ viewMode })=>!!(viewMode && viewMode.match(/^(story|docs)$/)),
|
|
23
|
+
render: _DirectionSwitch.DirectionSwitch
|
|
24
|
+
});
|
|
25
|
+
_managerapi.addons.add(_constants.STRICT_MODE_ID, {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
27
|
+
type: _managerapi.types.TOOL,
|
|
28
|
+
title: 'React Strict Mode',
|
|
29
|
+
match: ({ viewMode })=>!!(viewMode && viewMode.match(/^(story|docs)$/)),
|
|
30
|
+
render: _ReactStrictMode.ReactStrictMode
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/preset/manager.ts"],"sourcesContent":["import { addons, types } from '@storybook/manager-api';\n\nimport { ADDON_ID, DIR_ID, STRICT_MODE_ID, THEME_ID } from '../constants';\nimport { ThemePicker } from '../components/ThemePicker';\nimport { ReactStrictMode } from '../components/ReactStrictMode';\nimport { DirectionSwitch } from '../components/DirectionSwitch';\n\naddons.register(ADDON_ID, () => {\n addons.add(THEME_ID, {\n title: 'Fluent Theme Picker',\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n type: types.TOOL,\n match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),\n render: ThemePicker,\n });\n addons.add(DIR_ID, {\n title: 'Direction Switch',\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n type: types.TOOL,\n match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),\n render: DirectionSwitch,\n });\n addons.add(STRICT_MODE_ID, {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n type: types.TOOL,\n title: 'React Strict Mode',\n match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),\n render: ReactStrictMode,\n });\n});\n"],"names":["addons","register","ADDON_ID","add","THEME_ID","title","type","types","TOOL","match","viewMode","render","ThemePicker","DIR_ID","DirectionSwitch","STRICT_MODE_ID","ReactStrictMode"],"mappings":";;;;4BAA8B;2BAE6B;6BAC/B;iCACI;iCACA;AAEhCA,kBAAM,CAACC,QAAQ,CAACC,mBAAQ,EAAE;IACxBF,kBAAM,CAACG,GAAG,CAACC,mBAAQ,EAAE;QACnBC,OAAO;QACP,4DAA4D;QAC5DC,MAAMC,iBAAK,CAACC,IAAI;QAChBC,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAAK,CAAC,CAAEA,CAAAA,YAAYA,SAASD,KAAK,CAAC,iBAAgB;QACvEE,QAAQC,wBAAW;IACrB;IACAZ,kBAAM,CAACG,GAAG,CAACU,iBAAM,EAAE;QACjBR,OAAO;QACP,4DAA4D;QAC5DC,MAAMC,iBAAK,CAACC,IAAI;QAChBC,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAAK,CAAC,CAAEA,CAAAA,YAAYA,SAASD,KAAK,CAAC,iBAAgB;QACvEE,QAAQG,gCAAe;IACzB;IACAd,kBAAM,CAACG,GAAG,CAACY,yBAAc,EAAE;QACzB,4DAA4D;QAC5DT,MAAMC,iBAAK,CAACC,IAAI;QAChBH,OAAO;QACPI,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAAK,CAAC,CAAEA,CAAAA,YAAYA,SAASD,KAAK,CAAC,iBAAgB;QACvEE,QAAQK,gCAAe;IACzB;AACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
decorators: function() {
|
|
13
|
+
return decorators;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
},
|
|
18
|
+
globals: function() {
|
|
19
|
+
return globals;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _withFluentProvider = require("../decorators/withFluentProvider");
|
|
23
|
+
const _withReactStrictMode = require("../decorators/withReactStrictMode");
|
|
24
|
+
const _withAriaLive = require("../decorators/withAriaLive");
|
|
25
|
+
const _docs = require("../docs");
|
|
26
|
+
const _constants = require("../constants");
|
|
27
|
+
const decorators = [
|
|
28
|
+
_withFluentProvider.withFluentProvider,
|
|
29
|
+
_withAriaLive.withAriaLive,
|
|
30
|
+
_withReactStrictMode.withReactStrictMode
|
|
31
|
+
];
|
|
32
|
+
const globals = {
|
|
33
|
+
[_constants.THEME_ID]: undefined,
|
|
34
|
+
[_constants.DIR_ID]: undefined,
|
|
35
|
+
[_constants.STRICT_MODE_ID]: undefined
|
|
36
|
+
}; // allow theme to be set by URL query param
|
|
37
|
+
const preview = {
|
|
38
|
+
decorators,
|
|
39
|
+
globals,
|
|
40
|
+
parameters: {
|
|
41
|
+
docs: {
|
|
42
|
+
container: _docs.FluentDocsContainer,
|
|
43
|
+
page: _docs.FluentDocsPage
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const _default = preview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/preset/preview.ts"],"sourcesContent":["import type { Renderer, ProjectAnnotations } from '@storybook/types';\n\nimport { withFluentProvider } from '../decorators/withFluentProvider';\nimport { withReactStrictMode } from '../decorators/withReactStrictMode';\nimport { withAriaLive } from '../decorators/withAriaLive';\nimport { FluentDocsContainer, FluentDocsPage } from '../docs';\n\nimport { DIR_ID, STRICT_MODE_ID, THEME_ID } from '../constants';\n\nexport const decorators = [\n withFluentProvider,\n withAriaLive,\n withReactStrictMode,\n] as ProjectAnnotations<Renderer>['decorators'];\nexport const globals = { [THEME_ID]: undefined, [DIR_ID]: undefined, [STRICT_MODE_ID]: undefined }; // allow theme to be set by URL query param\n\nconst preview: ProjectAnnotations<Renderer> = {\n decorators,\n globals,\n parameters: {\n docs: {\n container: FluentDocsContainer,\n page: FluentDocsPage,\n },\n },\n};\n\nexport default preview;\n"],"names":["decorators","globals","withFluentProvider","withAriaLive","withReactStrictMode","THEME_ID","undefined","DIR_ID","STRICT_MODE_ID","preview","parameters","docs","container","FluentDocsContainer","page","FluentDocsPage"],"mappings":";;;;;;;;;;;IASaA,UAAU;eAAVA;;IAkBb,OAAuB;eAAvB;;IAbaC,OAAO;eAAPA;;;oCAZsB;qCACC;8BACP;sBACuB;2BAEH;AAE1C,MAAMD,aAAa;IACxBE,sCAAkB;IAClBC,0BAAY;IACZC,wCAAmB;CACpB;AACM,MAAMH,UAAU;IAAE,CAACI,mBAAQ,CAAC,EAAEC;IAAW,CAACC,iBAAM,CAAC,EAAED;IAAW,CAACE,yBAAc,CAAC,EAAEF;AAAU,GAAG,2CAA2C;AAE/I,MAAMG,UAAwC;IAC5CT;IACAC;IACAS,YAAY;QACVC,MAAM;YACJC,WAAWC,yBAAmB;YAC9BC,MAAMC,oBAAc;QACtB;IACF;AACF;MAEA,WAAeN"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
defaultTheme: function() {
|
|
13
|
+
return defaultTheme;
|
|
14
|
+
},
|
|
15
|
+
themes: function() {
|
|
16
|
+
return themes;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const themes = [
|
|
20
|
+
{
|
|
21
|
+
id: 'web-light',
|
|
22
|
+
label: 'Web Light'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'web-dark',
|
|
26
|
+
label: 'Web Dark'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'teams-light',
|
|
30
|
+
label: 'Teams Light'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'teams-dark',
|
|
34
|
+
label: 'Teams Dark'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'teams-light-v21',
|
|
38
|
+
label: 'Teams Light V2.1'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'teams-dark-v21',
|
|
42
|
+
label: 'Teams Dark V2.1'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'teams-high-contrast',
|
|
46
|
+
label: 'Teams High Contrast'
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
const defaultTheme = themes[0];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/theme.ts"],"sourcesContent":["export const themes = [\n { id: 'web-light', label: 'Web Light' },\n { id: 'web-dark', label: 'Web Dark' },\n { id: 'teams-light', label: 'Teams Light' },\n { id: 'teams-dark', label: 'Teams Dark' },\n { id: 'teams-light-v21', label: 'Teams Light V2.1' },\n { id: 'teams-dark-v21', label: 'Teams Dark V2.1' },\n { id: 'teams-high-contrast', label: 'Teams High Contrast' },\n] as const;\n\nexport const defaultTheme = themes[0];\n\nexport type ThemeIds = (typeof themes)[number]['id'];\nexport type ThemeLabels = (typeof themes)[number]['label'];\n"],"names":["defaultTheme","themes","id","label"],"mappings":";;;;;;;;;;;IAUaA,YAAY;eAAZA;;IAVAC,MAAM;eAANA;;;AAAN,MAAMA,SAAS;IACpB;QAAEC,IAAI;QAAaC,OAAO;IAAY;IACtC;QAAED,IAAI;QAAYC,OAAO;IAAW;IACpC;QAAED,IAAI;QAAeC,OAAO;IAAc;IAC1C;QAAED,IAAI;QAAcC,OAAO;IAAa;IACxC;QAAED,IAAI;QAAmBC,OAAO;IAAmB;IACnD;QAAED,IAAI;QAAkBC,OAAO;IAAkB;IACjD;QAAED,IAAI;QAAuBC,OAAO;IAAsB;CAC3D;AAEM,MAAMH,eAAeC,MAAM,CAAC,EAAE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isDecoratorDisabled", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return isDecoratorDisabled;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _hooks = require("../hooks");
|
|
12
|
+
function isDecoratorDisabled(context, decoratorName) {
|
|
13
|
+
var _getParametersConfig_disabledDecorators, _getParametersConfig;
|
|
14
|
+
var _getParametersConfig_disabledDecorators_includes;
|
|
15
|
+
return (_getParametersConfig_disabledDecorators_includes = (_getParametersConfig = (0, _hooks.getParametersConfig)(context)) === null || _getParametersConfig === void 0 ? void 0 : (_getParametersConfig_disabledDecorators = _getParametersConfig.disabledDecorators) === null || _getParametersConfig_disabledDecorators === void 0 ? void 0 : _getParametersConfig_disabledDecorators.includes(decoratorName)) !== null && _getParametersConfig_disabledDecorators_includes !== void 0 ? _getParametersConfig_disabledDecorators_includes : false;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/isDecoratorDisabled.ts"],"sourcesContent":["import { getParametersConfig, type FluentParameters, type FluentStoryContext } from '../hooks';\n\ntype DecoratorName = NonNullable<NonNullable<FluentParameters['reactStorybookAddon']>['disabledDecorators']>[number];\n\nexport function isDecoratorDisabled(context: FluentStoryContext, decoratorName: DecoratorName): boolean {\n return getParametersConfig(context)?.disabledDecorators?.includes(decoratorName) ?? false;\n}\n"],"names":["isDecoratorDisabled","context","decoratorName","getParametersConfig","disabledDecorators","includes"],"mappings":";;;;+BAIgBA;;;eAAAA;;;uBAJoE;AAI7E,SAASA,oBAAoBC,OAA2B,EAAEC,aAA4B;QACpFC,yCAAAA;QAAAA;IAAP,OAAOA,CAAAA,oDAAAA,uBAAAA,IAAAA,0BAAmB,EAACF,sBAApBE,4CAAAA,0CAAAA,qBAA8BC,kBAAkB,cAAhDD,8DAAAA,wCAAkDE,QAAQ,CAACH,4BAA3DC,8DAAAA,mDAA6E;AACtF"}
|