storybook-addon-design-system-docs 1.0.0 → 1.0.2

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 (41) hide show
  1. package/README.md +143 -15
  2. package/dist/TypographySection-D8HHJr-s.d.ts +258 -0
  3. package/dist/TypographySection-DsqZs5oA.d.cts +258 -0
  4. package/dist/TypographySection-c6k_4ZVC.d.ts +258 -0
  5. package/dist/TypographySection-lyEjSYKu.d.cts +258 -0
  6. package/dist/assets.cjs +9 -0
  7. package/dist/assets.cjs.map +1 -0
  8. package/dist/assets.d.cts +28 -0
  9. package/dist/assets.d.ts +28 -0
  10. package/dist/assets.js +7 -0
  11. package/dist/assets.js.map +1 -0
  12. package/dist/components/assets/index.cjs +634 -0
  13. package/dist/components/assets/index.cjs.map +1 -0
  14. package/dist/components/assets/index.d.cts +150 -0
  15. package/dist/components/assets/index.d.ts +150 -0
  16. package/dist/components/assets/index.js +604 -0
  17. package/dist/components/assets/index.js.map +1 -0
  18. package/dist/components/primitives/index.cjs +963 -0
  19. package/dist/components/primitives/index.cjs.map +1 -0
  20. package/dist/components/primitives/index.d.cts +194 -0
  21. package/dist/components/primitives/index.d.ts +194 -0
  22. package/dist/components/primitives/index.js +905 -0
  23. package/dist/components/primitives/index.js.map +1 -0
  24. package/dist/index.cjs +8695 -0
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.cts +136 -0
  27. package/dist/index.d.ts +136 -0
  28. package/dist/index.js +8639 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/jsx-runtime.d-kG9JzmQF.d.cts +15239 -0
  31. package/dist/jsx-runtime.d-kG9JzmQF.d.ts +15239 -0
  32. package/dist/manager.js +2 -2
  33. package/dist/manager.js.map +1 -0
  34. package/dist/preset.cjs +8185 -172
  35. package/dist/preset.cjs.map +1 -0
  36. package/dist/preset.js +8187 -8
  37. package/dist/preset.js.map +1 -0
  38. package/dist/types-BVOYHsBN.d.cts +178 -0
  39. package/dist/types-BVOYHsBN.d.ts +178 -0
  40. package/package.json +141 -143
  41. package/templates/spacing.mdx +1 -1
@@ -0,0 +1,136 @@
1
+ import { N as NormalizedAddonOptions, D as DesignSystemData } from './TypographySection-DsqZs5oA.cjs';
2
+ export { h as ColorData, C as ColorSection, i as ColorsContext, a as ColorsPage, m as RadiusContext, R as RadiusPage, b as RadiusSection, l as ShadowsContext, S as ShadowsPage, c as ShadowsSection, k as SpacingContext, d as SpacingPage, e as SpacingSection, T as ThemeLayout, j as TypographyContext, f as TypographyPage, g as TypographySection, t as themeDecorator } from './TypographySection-DsqZs5oA.cjs';
3
+ import { b as AssetGroupConfig, N as NormalizedAssetGroup, A as AssetGroup, c as AssetVariantConfig, a as Asset, R as ResolvedConfig, T as ThemeCssVariables } from './types-BVOYHsBN.cjs';
4
+ export { D as DesignSystemAddonOptions } from './types-BVOYHsBN.cjs';
5
+ import './jsx-runtime.d-kG9JzmQF.cjs';
6
+ import 'react';
7
+
8
+ /**
9
+ * Validates that the provided configurations meet minimum requirements.
10
+ * Throws an error if any configuration is invalid.
11
+ */
12
+ declare function validateAssetConfig(configs: AssetGroupConfig[]): void;
13
+ /**
14
+ * Converts a single raw `AssetGroupConfig` into a `NormalizedAssetGroup`.
15
+ * Applies defaults for all optional fields and resolves paths.
16
+ */
17
+ declare function normalizeAssetGroup(config: AssetGroupConfig, sidebarGroup?: string, configDir?: string): NormalizedAssetGroup;
18
+ /**
19
+ * Batch normalizes a list of asset configurations.
20
+ */
21
+ declare function normalizeAssetConfigs(assetConfigs?: AssetGroupConfig[], sidebarGroup?: string, configDir?: string): NormalizedAssetGroup[];
22
+
23
+ /**
24
+ * Scans the configured source directory and returns grouped assets.
25
+ *
26
+ * This function executes the file system scan based on the `include` and `exclude`
27
+ * patterns in the configuration. It then processes the raw file list to:
28
+ * - Detect variants using `detectVariants`.
29
+ * - normalize paths.
30
+ * - Organize assets into a structured `AssetGroup` object.
31
+ *
32
+ * @param config - The normalized configuration for the asset group.
33
+ * @returns A promise resolving to the fully processed `AssetGroup`.
34
+ */
35
+ declare function scanAssetGroup(config: NormalizedAssetGroup): Promise<AssetGroup>;
36
+ /**
37
+ * Checks if a given file path belongs to the configured source directory.
38
+ *
39
+ * @param filePath - The absolute or relative path to check.
40
+ * @param source - The source directory path.
41
+ * @returns `true` if the file resides within the configured source directory.
42
+ */
43
+ declare function matchesSource(filePath: string, source: string): boolean;
44
+
45
+ interface AssetManager {
46
+ getGroup(name: string): Promise<AssetGroup | undefined>;
47
+ invalidateGroup(name: string): void;
48
+ invalidateAll(): void;
49
+ findMatchingGroup(filePath: string): string | undefined;
50
+ getGroupNames(): string[];
51
+ }
52
+ /**
53
+ * Creates an asset manager for keeping track of multiple asset groups.
54
+ *
55
+ * This factory creates a closure that manages caching and routing for asset groups.
56
+ *
57
+ * @param groups - The list of normalized asset group configurations.
58
+ * @returns An `AssetManager` interface.
59
+ */
60
+ declare function createAssetManager(groups: NormalizedAssetGroup[]): AssetManager;
61
+
62
+ /**
63
+ * Detects and groups assets with light/dark theme variants.
64
+ *
65
+ * It iterates through a list of file paths, strips extensions and configured suffixes,
66
+ * and maps them to a unique key (folder + canonical name). Files matching the proper
67
+ * suffixes are assigned to the `light` or `dark` variant slots of the resulting asset.
68
+ *
69
+ * @param files - List of absolute file paths to process.
70
+ * @param sourceDir - The root directory of the scan, used to determine relative paths.
71
+ * @param config - The variant configuration containing suffixes and enabled state.
72
+ * @returns A map where keys are unique asset identifiers and values are partial asset objects.
73
+ */
74
+ declare function detectVariants(files: string[], sourceDir: string, config: AssetVariantConfig): Map<string, Partial<Asset>>;
75
+
76
+ /**
77
+ * Validates and normalizes the user-provided addon options.
78
+ *
79
+ * @param options - The raw options object passed from the preset.
80
+ * @returns The normalized configuration object.
81
+ * @throws Error if configuration is invalid.
82
+ */
83
+ declare function normalizeAddonOptions(options: any): NormalizedAddonOptions;
84
+
85
+ /**
86
+ * Transforms the resolved Tailwind configuration into Design System Data context.
87
+ * This context is used to generate the MDX documentation.
88
+ *
89
+ * @param config - The resolved Tailwind configuration.
90
+ * @param options - The normalized addon options.
91
+ * @returns The structured Design System Data.
92
+ */
93
+ declare function createDesignSystemData(config: ResolvedConfig, options: NormalizedAddonOptions): DesignSystemData;
94
+
95
+ /**
96
+ * Loads the Tailwind configuration implementation based on the provided options.
97
+ * Selects the appropriate strategy (Config file or CSS variables) and validates version compatibility.
98
+ */
99
+ declare function loadTheme(options: NormalizedAddonOptions): Promise<ResolvedConfig>;
100
+
101
+ /**
102
+ * Checks if the file path matches the Tailwind config file pattern.
103
+ */
104
+ declare function isTwConfigPath(filePath: string): boolean;
105
+ /**
106
+ * Loads and resolves a Tailwind configuration file (v3 style).
107
+ */
108
+ declare function loadTwConfig(filePath: string): Promise<ResolvedConfig>;
109
+
110
+ /**
111
+ * Checks if the file path matches the Tailwind CSS file pattern and contains @theme.
112
+ */
113
+ declare function isTwCssPath(filePath: string): boolean;
114
+ /**
115
+ * Loads and resolves a Tailwind CSS file with @theme (v4 style).
116
+ */
117
+ declare function loadTwCss(filePath: string): Promise<ResolvedConfig>;
118
+
119
+ /**
120
+ * Result of the CSS theme parsing.
121
+ */
122
+ interface ParsedThemeConfig {
123
+ variables: ThemeCssVariables;
124
+ }
125
+ /**
126
+ * Check if the default theme is overridden globally or for a specific namespace.
127
+ */
128
+ declare function isDefaultOverridden(config: ParsedThemeConfig, namespace?: string): boolean;
129
+ /**
130
+ * Parse a CSS string for theme variables and options.
131
+ */
132
+ declare function parseThemeCss(css: string): ParsedThemeConfig;
133
+
134
+ declare const _default: {};
135
+
136
+ export { type AssetManager, DesignSystemData, NormalizedAddonOptions, type ParsedThemeConfig, createAssetManager, createDesignSystemData, _default as default, detectVariants, isDefaultOverridden, isTwConfigPath, isTwCssPath, loadTheme, loadTwConfig, loadTwCss, matchesSource, normalizeAddonOptions, normalizeAssetConfigs, normalizeAssetGroup, parseThemeCss, scanAssetGroup, validateAssetConfig };
@@ -0,0 +1,136 @@
1
+ import { N as NormalizedAddonOptions, D as DesignSystemData } from './TypographySection-D8HHJr-s.js';
2
+ export { h as ColorData, C as ColorSection, i as ColorsContext, a as ColorsPage, m as RadiusContext, R as RadiusPage, b as RadiusSection, l as ShadowsContext, S as ShadowsPage, c as ShadowsSection, k as SpacingContext, d as SpacingPage, e as SpacingSection, T as ThemeLayout, j as TypographyContext, f as TypographyPage, g as TypographySection, t as themeDecorator } from './TypographySection-D8HHJr-s.js';
3
+ import { b as AssetGroupConfig, N as NormalizedAssetGroup, A as AssetGroup, c as AssetVariantConfig, a as Asset, R as ResolvedConfig, T as ThemeCssVariables } from './types-BVOYHsBN.js';
4
+ export { D as DesignSystemAddonOptions } from './types-BVOYHsBN.js';
5
+ import './jsx-runtime.d-kG9JzmQF.js';
6
+ import 'react';
7
+
8
+ /**
9
+ * Validates that the provided configurations meet minimum requirements.
10
+ * Throws an error if any configuration is invalid.
11
+ */
12
+ declare function validateAssetConfig(configs: AssetGroupConfig[]): void;
13
+ /**
14
+ * Converts a single raw `AssetGroupConfig` into a `NormalizedAssetGroup`.
15
+ * Applies defaults for all optional fields and resolves paths.
16
+ */
17
+ declare function normalizeAssetGroup(config: AssetGroupConfig, sidebarGroup?: string, configDir?: string): NormalizedAssetGroup;
18
+ /**
19
+ * Batch normalizes a list of asset configurations.
20
+ */
21
+ declare function normalizeAssetConfigs(assetConfigs?: AssetGroupConfig[], sidebarGroup?: string, configDir?: string): NormalizedAssetGroup[];
22
+
23
+ /**
24
+ * Scans the configured source directory and returns grouped assets.
25
+ *
26
+ * This function executes the file system scan based on the `include` and `exclude`
27
+ * patterns in the configuration. It then processes the raw file list to:
28
+ * - Detect variants using `detectVariants`.
29
+ * - normalize paths.
30
+ * - Organize assets into a structured `AssetGroup` object.
31
+ *
32
+ * @param config - The normalized configuration for the asset group.
33
+ * @returns A promise resolving to the fully processed `AssetGroup`.
34
+ */
35
+ declare function scanAssetGroup(config: NormalizedAssetGroup): Promise<AssetGroup>;
36
+ /**
37
+ * Checks if a given file path belongs to the configured source directory.
38
+ *
39
+ * @param filePath - The absolute or relative path to check.
40
+ * @param source - The source directory path.
41
+ * @returns `true` if the file resides within the configured source directory.
42
+ */
43
+ declare function matchesSource(filePath: string, source: string): boolean;
44
+
45
+ interface AssetManager {
46
+ getGroup(name: string): Promise<AssetGroup | undefined>;
47
+ invalidateGroup(name: string): void;
48
+ invalidateAll(): void;
49
+ findMatchingGroup(filePath: string): string | undefined;
50
+ getGroupNames(): string[];
51
+ }
52
+ /**
53
+ * Creates an asset manager for keeping track of multiple asset groups.
54
+ *
55
+ * This factory creates a closure that manages caching and routing for asset groups.
56
+ *
57
+ * @param groups - The list of normalized asset group configurations.
58
+ * @returns An `AssetManager` interface.
59
+ */
60
+ declare function createAssetManager(groups: NormalizedAssetGroup[]): AssetManager;
61
+
62
+ /**
63
+ * Detects and groups assets with light/dark theme variants.
64
+ *
65
+ * It iterates through a list of file paths, strips extensions and configured suffixes,
66
+ * and maps them to a unique key (folder + canonical name). Files matching the proper
67
+ * suffixes are assigned to the `light` or `dark` variant slots of the resulting asset.
68
+ *
69
+ * @param files - List of absolute file paths to process.
70
+ * @param sourceDir - The root directory of the scan, used to determine relative paths.
71
+ * @param config - The variant configuration containing suffixes and enabled state.
72
+ * @returns A map where keys are unique asset identifiers and values are partial asset objects.
73
+ */
74
+ declare function detectVariants(files: string[], sourceDir: string, config: AssetVariantConfig): Map<string, Partial<Asset>>;
75
+
76
+ /**
77
+ * Validates and normalizes the user-provided addon options.
78
+ *
79
+ * @param options - The raw options object passed from the preset.
80
+ * @returns The normalized configuration object.
81
+ * @throws Error if configuration is invalid.
82
+ */
83
+ declare function normalizeAddonOptions(options: any): NormalizedAddonOptions;
84
+
85
+ /**
86
+ * Transforms the resolved Tailwind configuration into Design System Data context.
87
+ * This context is used to generate the MDX documentation.
88
+ *
89
+ * @param config - The resolved Tailwind configuration.
90
+ * @param options - The normalized addon options.
91
+ * @returns The structured Design System Data.
92
+ */
93
+ declare function createDesignSystemData(config: ResolvedConfig, options: NormalizedAddonOptions): DesignSystemData;
94
+
95
+ /**
96
+ * Loads the Tailwind configuration implementation based on the provided options.
97
+ * Selects the appropriate strategy (Config file or CSS variables) and validates version compatibility.
98
+ */
99
+ declare function loadTheme(options: NormalizedAddonOptions): Promise<ResolvedConfig>;
100
+
101
+ /**
102
+ * Checks if the file path matches the Tailwind config file pattern.
103
+ */
104
+ declare function isTwConfigPath(filePath: string): boolean;
105
+ /**
106
+ * Loads and resolves a Tailwind configuration file (v3 style).
107
+ */
108
+ declare function loadTwConfig(filePath: string): Promise<ResolvedConfig>;
109
+
110
+ /**
111
+ * Checks if the file path matches the Tailwind CSS file pattern and contains @theme.
112
+ */
113
+ declare function isTwCssPath(filePath: string): boolean;
114
+ /**
115
+ * Loads and resolves a Tailwind CSS file with @theme (v4 style).
116
+ */
117
+ declare function loadTwCss(filePath: string): Promise<ResolvedConfig>;
118
+
119
+ /**
120
+ * Result of the CSS theme parsing.
121
+ */
122
+ interface ParsedThemeConfig {
123
+ variables: ThemeCssVariables;
124
+ }
125
+ /**
126
+ * Check if the default theme is overridden globally or for a specific namespace.
127
+ */
128
+ declare function isDefaultOverridden(config: ParsedThemeConfig, namespace?: string): boolean;
129
+ /**
130
+ * Parse a CSS string for theme variables and options.
131
+ */
132
+ declare function parseThemeCss(css: string): ParsedThemeConfig;
133
+
134
+ declare const _default: {};
135
+
136
+ export { type AssetManager, DesignSystemData, NormalizedAddonOptions, type ParsedThemeConfig, createAssetManager, createDesignSystemData, _default as default, detectVariants, isDefaultOverridden, isTwConfigPath, isTwCssPath, loadTheme, loadTwConfig, loadTwCss, matchesSource, normalizeAddonOptions, normalizeAssetConfigs, normalizeAssetGroup, parseThemeCss, scanAssetGroup, validateAssetConfig };