@stacksjs/stx 0.2.154 → 0.2.156
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/a11y.d.ts +87 -46
- package/dist/animation.d.ts +96 -42
- package/dist/appearance-bootstrap.d.ts +49 -15
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +9 -7
- package/dist/async-components.d.ts +78 -56
- package/dist/auth.d.ts +3 -0
- package/dist/build-externalize.d.ts +40 -0
- package/dist/build-externalize.js +63 -0
- package/dist/build-id.d.ts +22 -22
- package/dist/build-message.d.ts +73 -2
- package/dist/build-message.js +47 -8
- package/dist/builtins/attrs.d.ts +14 -0
- package/dist/builtins/drawer.d.ts +22 -0
- package/dist/builtins/icon.d.ts +16 -2
- package/dist/builtins/index.d.ts +5 -15
- package/dist/builtins/modal.d.ts +24 -0
- package/dist/builtins/safe-image.d.ts +42 -0
- package/dist/builtins/stx-image.d.ts +27 -0
- package/dist/builtins/stx-link.d.ts +9 -0
- package/dist/builtins/stx-loading-indicator.d.ts +11 -0
- package/dist/builtins/suspense.d.ts +28 -0
- package/dist/builtins/toast.d.ts +17 -0
- package/dist/builtins/transition-group.d.ts +25 -0
- package/dist/caching.d.ts +12 -15
- package/dist/cli.js +1798 -908
- package/dist/client/directive.d.ts +7 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client-script-bundler.d.ts +63 -5
- package/dist/client-script-bundler.js +30 -2
- package/dist/client-script.d.ts +102 -47
- package/dist/client-script.js +15 -3
- package/dist/codemod.d.ts +56 -0
- package/dist/codemod.js +192 -0
- package/dist/color-mode-boot.d.ts +83 -65
- package/dist/component-client-factories.d.ts +1 -6
- package/dist/component-processing.d.ts +58 -49
- package/dist/component-processing.js +1 -1
- package/dist/component-registry.d.ts +94 -31
- package/dist/component-renderer.d.ts +18 -0
- package/dist/composable-loader.d.ts +24 -0
- package/dist/composable-loader.js +12 -9
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.js +30 -2
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables.d.ts +64 -60
- package/dist/computed.d.ts +86 -92
- package/dist/conditionals.d.ts +24 -8
- package/dist/conditionals.js +16 -0
- package/dist/config.d.ts +34 -21
- package/dist/config.js +35 -14
- package/dist/craft.js +1476 -768
- package/dist/crosswind-config.d.ts +58 -0
- package/dist/crosswind-config.js +40 -0
- package/dist/csp.d.ts +107 -41
- package/dist/defer.d.ts +24 -0
- package/dist/dev-server/crosswind.d.ts +35 -26
- package/dist/dev-server/crosswind.js +2 -18
- package/dist/dev-server/serve-app.js +4 -3
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/directive-api.d.ts +86 -43
- package/dist/document-shell.d.ts +54 -41
- package/dist/dynamic-components.d.ts +9 -0
- package/dist/error-boundaries.d.ts +47 -41
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +51 -43
- package/dist/errors/formatter.d.ts +58 -38
- package/dist/errors/index.d.ts +5 -61
- package/dist/errors/logger.d.ts +114 -40
- package/dist/errors/sanitizer.d.ts +53 -23
- package/dist/errors/types.d.ts +44 -31
- package/dist/events.d.ts +86 -25
- package/dist/expressions.d.ts +50 -42
- package/dist/forms-validation.d.ts +138 -123
- package/dist/forms-validation.js +1 -90
- package/dist/forms.d.ts +120 -66
- package/dist/forms.js +31 -11
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +109 -0
- package/dist/framework-composables.d.ts +32 -0
- package/dist/head.d.ts +156 -114
- package/dist/heatmap.d.ts +152 -72
- package/dist/html-masking.d.ts +40 -34
- package/dist/hydration-runtime.d.ts +20 -24
- package/dist/i18n.d.ts +93 -32
- package/dist/image-optimization/auto-sibling.d.ts +32 -4
- package/dist/includes.d.ts +69 -7
- package/dist/index.d.ts +66 -0
- package/dist/index.js +23 -0
- package/dist/internal-markdown.d.ts +12 -8
- package/dist/island-chunking.d.ts +30 -13
- package/dist/keep-alive.d.ts +72 -52
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-module.d.ts +10 -0
- package/dist/loops.d.ts +66 -0
- package/dist/loops.js +47 -6
- package/dist/markdown.d.ts +0 -1
- package/dist/media/image/component.d.ts +25 -9
- package/dist/media/image/directive.d.ts +15 -1
- package/dist/media/image/placeholder.d.ts +20 -9
- package/dist/media/image/processor/cache.d.ts +40 -18
- package/dist/media/image/processor/index.d.ts +1 -10
- package/dist/media/image/processor/optimizer.d.ts +12 -1
- package/dist/media/image/processor/responsive.d.ts +16 -6
- package/dist/media/image/srcset.d.ts +47 -50
- package/dist/media/shared/cache.d.ts +51 -31
- package/dist/media/shared/hash.d.ts +7 -0
- package/dist/media/types.d.ts +1235 -754
- package/dist/media/video/directive.d.ts +15 -1
- package/dist/media/video/index.d.ts +39 -17
- package/dist/media/video/processor/cache.d.ts +42 -19
- package/dist/media/video/processor/index.d.ts +1 -18
- package/dist/media/video/processor/streaming.d.ts +17 -10
- package/dist/media/video/processor/thumbnail.d.ts +21 -15
- package/dist/media/video/processor/transcoder.d.ts +11 -1
- package/dist/method-spoofing.d.ts +7 -0
- package/dist/middleware.d.ts +60 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/parser/directive-parser.d.ts +57 -45
- package/dist/parser/expression-parser.d.ts +33 -35
- package/dist/parser/index.d.ts +4 -39
- package/dist/parser/tokenizer.d.ts +61 -49
- package/dist/partial-hydration.d.ts +82 -50
- package/dist/performance-utils.d.ts +217 -124
- package/dist/placeholder.d.ts +18 -9
- package/dist/plugin-system.d.ts +264 -115
- package/dist/process.d.ts +11 -6
- package/dist/process.js +21 -4
- package/dist/production-builder.js +7 -0
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +14 -0
- package/dist/pwa/directives.d.ts +12 -3
- package/dist/pwa/inject.d.ts +10 -0
- package/dist/pwa/precache.d.ts +22 -16
- package/dist/pwa/service-worker.d.ts +12 -0
- package/dist/pwa.js +1318 -610
- package/dist/reactive-bindings.d.ts +34 -11
- package/dist/reactive.d.ts +58 -30
- package/dist/reactive.js +56 -31
- package/dist/render.js +1 -0
- package/dist/route-middleware.d.ts +2 -35
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +5 -7
- package/dist/routes.d.ts +1 -3
- package/dist/runtime-globals.d.ts +147 -24
- package/dist/runtime-globals.js +16 -1
- package/dist/runtime-injection.d.ts +8 -0
- package/dist/runtime-injection.js +33 -24
- package/dist/script-emit.d.ts +30 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +21 -4
- package/dist/seo.d.ts +118 -47
- package/dist/server-bindings.d.ts +21 -0
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +35 -15
- package/dist/signals-api.d.ts +117 -58
- package/dist/signals-api.js +7 -4
- package/dist/signals.d.ts +24 -17
- package/dist/signals.js +765 -60
- package/dist/site-builder/build.js +8 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +86 -20
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/ssg.d.ts +285 -142
- package/dist/ssg.js +1268 -556
- package/dist/state-dir.d.ts +4 -4
- package/dist/state-management.d.ts +0 -12
- package/dist/state-management.js +8 -25
- package/dist/store-imports.d.ts +23 -0
- package/dist/store-imports.js +3 -0
- package/dist/store-loader.d.ts +10 -0
- package/dist/store-loader.js +10 -9
- package/dist/story/analytics.d.ts +138 -60
- package/dist/story/bookmarks.d.ts +87 -34
- package/dist/story/cli.d.ts +123 -69
- package/dist/story/collect/scanner.d.ts +4 -0
- package/dist/story/collect/tree.d.ts +8 -1
- package/dist/story/commands/build.d.ts +11 -6
- package/dist/story/commands/dev.d.ts +15 -8
- package/dist/story/commands/preview.d.ts +13 -7
- package/dist/story/config-watcher.d.ts +20 -13
- package/dist/story/config.d.ts +11 -8
- package/dist/story/context.d.ts +14 -8
- package/dist/story/hmr.d.ts +24 -26
- package/dist/story/hot-swap.d.ts +34 -23
- package/dist/story/keyboard-shortcuts.d.ts +23 -18
- package/dist/story/output.d.ts +46 -44
- package/dist/story/performance.d.ts +107 -45
- package/dist/story/presets.d.ts +107 -41
- package/dist/story/renderer.d.ts +41 -27
- package/dist/story/search.d.ts +23 -12
- package/dist/story/server.d.ts +21 -11
- package/dist/story/setup.d.ts +23 -15
- package/dist/story/testing.d.ts +65 -40
- package/dist/story/types.d.ts +262 -160
- package/dist/streaming.d.ts +119 -57
- package/dist/stx-virtual-ts.d.ts +165 -0
- package/dist/stx-virtual-ts.js +372 -0
- package/dist/stx.d.ts +78 -1
- package/dist/style-scoping.d.ts +17 -4
- package/dist/suspense.d.ts +67 -52
- package/dist/teleport.d.ts +22 -0
- package/dist/template-tag-balance.d.ts +22 -6
- package/dist/transitions.d.ts +66 -55
- package/dist/typecheck.d.ts +77 -0
- package/dist/typecheck.js +156 -0
- package/dist/types/component-types.d.ts +187 -122
- package/dist/types/config-types.d.ts +758 -297
- package/dist/types/context-types.d.ts +46 -24
- package/dist/types/csp-types.d.ts +70 -66
- package/dist/types/directive-types.d.ts +211 -155
- package/dist/types/index.d.ts +6 -109
- package/dist/types/pwa-types.d.ts +273 -148
- package/dist/types.d.ts +0 -1
- package/dist/typescript-templates.d.ts +11 -0
- package/dist/unresolved-identifiers.d.ts +24 -22
- package/dist/unresolved-identifiers.js +2 -0
- package/dist/utils.d.ts +24 -21
- package/dist/validator.d.ts +28 -26
- package/dist/variable-extractor.d.ts +48 -13
- package/dist/variable-extractor.js +27 -4
- package/dist/view-composers.d.ts +80 -81
- package/dist/virtual-scrolling.d.ts +101 -81
- package/dist/vue-template.d.ts +23 -0
- package/dist/web-components/css-scoping.d.ts +21 -11
- package/dist/web-components.d.ts +81 -58
- package/dist/x-element.d.ts +0 -1
- package/package.json +5 -5
- package/stx.d.ts +78 -1
package/dist/story/testing.d.ts
CHANGED
|
@@ -1,58 +1,83 @@
|
|
|
1
|
-
import type { StoryContext } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Run visual regression tests
|
|
4
|
-
*/
|
|
5
|
-
export declare function runVisualTests(ctx: StoryContext, options?: TestOptions): Promise<TestResult>;
|
|
6
|
-
/**
|
|
7
|
-
* Update all snapshots
|
|
8
|
-
*/
|
|
9
|
-
export declare function updateSnapshots(ctx: StoryContext, options?: TestOptions): Promise<number>;
|
|
10
|
-
/**
|
|
11
|
-
* Format test results for console output
|
|
12
|
-
*/
|
|
13
|
-
export declare function formatTestResults(result: TestResult): string;
|
|
14
1
|
/**
|
|
15
|
-
*
|
|
2
|
+
* STX Story - Visual Regression Testing
|
|
3
|
+
* Snapshot-based testing for component renders
|
|
16
4
|
*/
|
|
17
|
-
|
|
5
|
+
import type { StoryContext } from './types';
|
|
18
6
|
/**
|
|
19
7
|
* Test options
|
|
20
8
|
*/
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
export interface TestOptions {
|
|
10
|
+
/** Update snapshots instead of comparing */
|
|
11
|
+
update?: boolean;
|
|
12
|
+
/** Only test specific components */
|
|
13
|
+
filter?: string[];
|
|
14
|
+
/** Threshold for pixel difference (0-1) */
|
|
15
|
+
threshold?: number;
|
|
16
|
+
/** Directory to store snapshots */
|
|
17
|
+
snapshotDir?: string;
|
|
26
18
|
}
|
|
27
19
|
/**
|
|
28
20
|
* Test result
|
|
29
21
|
*/
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
export interface TestResult {
|
|
23
|
+
/** Total number of tests */
|
|
24
|
+
total: number;
|
|
25
|
+
/** Number of passed tests */
|
|
26
|
+
passed: number;
|
|
27
|
+
/** Number of failed tests */
|
|
28
|
+
failed: number;
|
|
29
|
+
/** Number of new snapshots */
|
|
30
|
+
new: number;
|
|
31
|
+
/** Test failures */
|
|
32
|
+
failures: TestFailure[];
|
|
33
|
+
/** Duration in milliseconds */
|
|
34
|
+
duration: number;
|
|
37
35
|
}
|
|
38
36
|
/**
|
|
39
37
|
* Test failure details
|
|
40
38
|
*/
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
export interface TestFailure {
|
|
40
|
+
/** Story ID */
|
|
41
|
+
storyId: string;
|
|
42
|
+
/** Variant ID */
|
|
43
|
+
variantId: string;
|
|
44
|
+
/** Component name */
|
|
45
|
+
component: string;
|
|
46
|
+
/** Error message */
|
|
47
|
+
message: string;
|
|
48
|
+
/** Path to diff image (if applicable) */
|
|
49
|
+
diffPath?: string;
|
|
50
|
+
/** Difference percentage */
|
|
51
|
+
difference?: number;
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Snapshot metadata
|
|
51
55
|
*/
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
export interface SnapshotMeta {
|
|
57
|
+
/** Story ID */
|
|
58
|
+
storyId: string;
|
|
59
|
+
/** Variant ID */
|
|
60
|
+
variantId: string;
|
|
61
|
+
/** Component name */
|
|
62
|
+
component: string;
|
|
63
|
+
/** Timestamp of snapshot creation */
|
|
64
|
+
timestamp: number;
|
|
65
|
+
/** Hash of the rendered content */
|
|
66
|
+
hash: string;
|
|
58
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Run visual regression tests
|
|
70
|
+
*/
|
|
71
|
+
export declare function runVisualTests(ctx: StoryContext, options?: TestOptions): Promise<TestResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Update all snapshots
|
|
74
|
+
*/
|
|
75
|
+
export declare function updateSnapshots(ctx: StoryContext, options?: TestOptions): Promise<number>;
|
|
76
|
+
/**
|
|
77
|
+
* Format test results for console output
|
|
78
|
+
*/
|
|
79
|
+
export declare function formatTestResults(result: TestResult): string;
|
|
80
|
+
/**
|
|
81
|
+
* Run accessibility tests on stories
|
|
82
|
+
*/
|
|
83
|
+
export declare function runA11yTests(ctx: StoryContext, _options?: TestOptions): Promise<TestResult>;
|
package/dist/story/types.d.ts
CHANGED
|
@@ -1,240 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STX Story - Component showcase and testing
|
|
3
|
+
* Type definitions for the story feature
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* Tree group configuration for organizing stories
|
|
3
7
|
*/
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
export interface TreeGroupConfig {
|
|
9
|
+
/** Display title for the group */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Unique identifier for the group */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Function to determine if a file belongs to this group */
|
|
14
|
+
include?: (file: StoryTreeFile) => boolean;
|
|
8
15
|
}
|
|
9
16
|
/**
|
|
10
17
|
* Responsive viewport preset
|
|
11
18
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
export interface ResponsivePreset {
|
|
20
|
+
/** Display label */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Viewport width in pixels */
|
|
23
|
+
width: number;
|
|
24
|
+
/** Viewport height in pixels (optional) */
|
|
25
|
+
height?: number;
|
|
16
26
|
}
|
|
17
27
|
/**
|
|
18
28
|
* Background preset for story canvas
|
|
19
29
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
export interface BackgroundPreset {
|
|
31
|
+
/** Display label */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Background color (CSS value) */
|
|
34
|
+
color: string;
|
|
35
|
+
/** Contrast color for text (optional) */
|
|
36
|
+
contrastColor?: string;
|
|
24
37
|
}
|
|
25
38
|
/**
|
|
26
39
|
* Story theme configuration
|
|
27
40
|
*/
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
export interface StoryThemeConfig {
|
|
42
|
+
/** Title displayed in the story UI */
|
|
43
|
+
title?: string;
|
|
44
|
+
/** Logo configuration */
|
|
45
|
+
logo?: {
|
|
46
|
+
/** Square logo (for favicon/small displays) */
|
|
47
|
+
square?: string;
|
|
48
|
+
/** Light theme logo */
|
|
49
|
+
light?: string;
|
|
50
|
+
/** Dark theme logo */
|
|
51
|
+
dark?: string;
|
|
52
|
+
};
|
|
53
|
+
/** Favicon path */
|
|
54
|
+
favicon?: string;
|
|
55
|
+
/** Custom colors */
|
|
56
|
+
colors?: {
|
|
57
|
+
/** Primary accent color shades */
|
|
58
|
+
primary?: Record<string, string>;
|
|
59
|
+
/** Gray color shades */
|
|
60
|
+
gray?: Record<string, string>;
|
|
61
|
+
};
|
|
62
|
+
/** Default color scheme */
|
|
63
|
+
defaultColorScheme?: 'light' | 'dark' | 'auto';
|
|
64
|
+
/** Hide the color scheme toggle */
|
|
65
|
+
hideColorSchemeSwitch?: boolean;
|
|
66
|
+
/** CSS class to apply for dark mode */
|
|
67
|
+
darkClass?: string;
|
|
43
68
|
}
|
|
44
69
|
/**
|
|
45
70
|
* Story tree configuration
|
|
46
71
|
*/
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
export interface StoryTreeConfig {
|
|
73
|
+
/** How to generate tree paths from files */
|
|
74
|
+
file?: 'title' | 'path' | ((file: StoryTreeFile) => string[]);
|
|
75
|
+
/** Sort order for tree items */
|
|
76
|
+
order?: 'asc' | ((a: string, b: string) => number);
|
|
77
|
+
/** Group configurations */
|
|
78
|
+
groups?: TreeGroupConfig[];
|
|
51
79
|
}
|
|
52
80
|
/**
|
|
53
81
|
* Story configuration (part of StxConfig)
|
|
54
82
|
*/
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
export interface StoryConfig {
|
|
84
|
+
/** Enable the story feature */
|
|
85
|
+
enabled?: boolean;
|
|
86
|
+
/** Output directory for built story site */
|
|
87
|
+
outDir?: string;
|
|
88
|
+
/** Glob patterns to match story files */
|
|
89
|
+
storyMatch?: string[];
|
|
90
|
+
/** Glob patterns to ignore */
|
|
91
|
+
storyIgnored?: string[];
|
|
92
|
+
/** Tree organization configuration */
|
|
93
|
+
tree?: StoryTreeConfig;
|
|
94
|
+
/** Theme configuration */
|
|
95
|
+
theme?: StoryThemeConfig;
|
|
96
|
+
/** Responsive viewport presets */
|
|
97
|
+
responsivePresets?: ResponsivePreset[];
|
|
98
|
+
/** Background presets */
|
|
99
|
+
backgroundPresets?: BackgroundPreset[];
|
|
100
|
+
/** Auto-apply contrast color to text */
|
|
101
|
+
autoApplyContrastColor?: boolean;
|
|
102
|
+
/** Path to setup file for global configuration */
|
|
103
|
+
setupFile?: string;
|
|
104
|
+
/** Default server port */
|
|
105
|
+
port?: number;
|
|
106
|
+
/** Disable auto-generated props controls globally */
|
|
107
|
+
autoPropsDisabled?: boolean;
|
|
68
108
|
}
|
|
69
109
|
/**
|
|
70
110
|
* File information for tree configuration
|
|
71
111
|
*/
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
112
|
+
export interface StoryTreeFile {
|
|
113
|
+
/** Story title */
|
|
114
|
+
title: string;
|
|
115
|
+
/** File path */
|
|
116
|
+
path: string;
|
|
75
117
|
}
|
|
76
118
|
/**
|
|
77
119
|
* Server-side story file representation
|
|
78
120
|
*/
|
|
79
|
-
export
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
121
|
+
export interface ServerStoryFile {
|
|
122
|
+
/** Unique identifier */
|
|
123
|
+
id: string;
|
|
124
|
+
/** Absolute file path */
|
|
125
|
+
path: string;
|
|
126
|
+
/** Relative file path */
|
|
127
|
+
relativePath: string;
|
|
128
|
+
/** File name without extension */
|
|
129
|
+
fileName: string;
|
|
130
|
+
/** Generated tree path */
|
|
131
|
+
treePath?: string[];
|
|
132
|
+
/** Tree file data for config functions */
|
|
133
|
+
treeFile?: StoryTreeFile;
|
|
134
|
+
/** Parsed story data */
|
|
135
|
+
story?: ServerStory;
|
|
87
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Story layout configuration
|
|
139
|
+
*/
|
|
140
|
+
export type StoryLayout = {
|
|
141
|
+
type: 'single';
|
|
142
|
+
iframe?: boolean;
|
|
143
|
+
} | {
|
|
144
|
+
type: 'grid';
|
|
145
|
+
width?: number | string;
|
|
146
|
+
};
|
|
88
147
|
/**
|
|
89
148
|
* Server-side story representation
|
|
90
149
|
*/
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
150
|
+
export interface ServerStory {
|
|
151
|
+
/** Unique identifier */
|
|
152
|
+
id: string;
|
|
153
|
+
/** Story title */
|
|
154
|
+
title: string;
|
|
155
|
+
/** Group this story belongs to */
|
|
156
|
+
group?: string;
|
|
157
|
+
/** Story variants */
|
|
158
|
+
variants: ServerVariant[];
|
|
159
|
+
/** Layout configuration */
|
|
160
|
+
layout?: StoryLayout;
|
|
161
|
+
/** Icon name (iconify format) */
|
|
162
|
+
icon?: string;
|
|
163
|
+
/** Icon color */
|
|
164
|
+
iconColor?: string;
|
|
165
|
+
/** Show only in docs, not in canvas */
|
|
166
|
+
docsOnly?: boolean;
|
|
167
|
+
/** Disable auto-generated props controls for this story */
|
|
168
|
+
autoPropsDisabled?: boolean;
|
|
101
169
|
}
|
|
102
170
|
/**
|
|
103
171
|
* Server-side variant representation
|
|
104
172
|
*/
|
|
105
|
-
export
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
173
|
+
export interface ServerVariant {
|
|
174
|
+
/** Unique identifier */
|
|
175
|
+
id: string;
|
|
176
|
+
/** Variant title */
|
|
177
|
+
title: string;
|
|
178
|
+
/** Icon name */
|
|
179
|
+
icon?: string;
|
|
180
|
+
/** Icon color */
|
|
181
|
+
iconColor?: string;
|
|
182
|
+
/** Initial state for controls */
|
|
183
|
+
state?: Record<string, any>;
|
|
184
|
+
/** Source code for display */
|
|
185
|
+
source?: string;
|
|
186
|
+
/** Disable responsive controls */
|
|
187
|
+
responsiveDisabled?: boolean;
|
|
113
188
|
}
|
|
114
189
|
/**
|
|
115
190
|
* Tree leaf node (story)
|
|
116
191
|
*/
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
192
|
+
export interface ServerTreeLeaf {
|
|
193
|
+
/** Display title */
|
|
194
|
+
title: string;
|
|
195
|
+
/** Index in story files array */
|
|
196
|
+
index: number;
|
|
120
197
|
}
|
|
121
198
|
/**
|
|
122
199
|
* Tree folder node
|
|
123
200
|
*/
|
|
124
|
-
export
|
|
125
|
-
|
|
126
|
-
|
|
201
|
+
export interface ServerTreeFolder {
|
|
202
|
+
/** Display title */
|
|
203
|
+
title: string;
|
|
204
|
+
/** Child nodes */
|
|
205
|
+
children: ServerTreeNode[];
|
|
127
206
|
}
|
|
128
207
|
/**
|
|
129
208
|
* Tree group node
|
|
130
209
|
*/
|
|
131
|
-
export
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
210
|
+
export interface ServerTreeGroup {
|
|
211
|
+
/** Indicates this is a group */
|
|
212
|
+
group: true;
|
|
213
|
+
/** Group identifier */
|
|
214
|
+
id: string;
|
|
215
|
+
/** Display title */
|
|
216
|
+
title: string;
|
|
217
|
+
/** Child nodes */
|
|
218
|
+
children: ServerTreeNode[];
|
|
136
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Any tree node type
|
|
222
|
+
*/
|
|
223
|
+
export type ServerTreeNode = ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf;
|
|
224
|
+
/**
|
|
225
|
+
* Complete server tree
|
|
226
|
+
*/
|
|
227
|
+
export type ServerTree = ServerTreeNode[];
|
|
137
228
|
/**
|
|
138
229
|
* Analyzed component prop for story
|
|
139
230
|
*/
|
|
140
|
-
export
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
231
|
+
export interface StoryAnalyzedProp {
|
|
232
|
+
/** Prop name */
|
|
233
|
+
name: string;
|
|
234
|
+
/** Inferred or declared type */
|
|
235
|
+
type: string;
|
|
236
|
+
/** Whether the prop is required */
|
|
237
|
+
required: boolean;
|
|
238
|
+
/** Default value if any */
|
|
239
|
+
default?: any;
|
|
240
|
+
/** Description from JSDoc */
|
|
241
|
+
description?: string;
|
|
242
|
+
/** Options for enum/select types */
|
|
243
|
+
options?: any[];
|
|
147
244
|
}
|
|
148
245
|
/**
|
|
149
246
|
* Analyzed component slot
|
|
150
247
|
*/
|
|
151
|
-
export
|
|
152
|
-
|
|
153
|
-
|
|
248
|
+
export interface AnalyzedSlot {
|
|
249
|
+
/** Slot name ('default' for main slot) */
|
|
250
|
+
name: string;
|
|
251
|
+
/** Description from comments */
|
|
252
|
+
description?: string;
|
|
154
253
|
}
|
|
155
254
|
/**
|
|
156
255
|
* Directive usage in a component
|
|
157
256
|
*/
|
|
158
|
-
export
|
|
159
|
-
|
|
160
|
-
|
|
257
|
+
export interface DirectiveUsage {
|
|
258
|
+
/** Directive name (e.g., 'if', 'foreach', 'component') */
|
|
259
|
+
name: string;
|
|
260
|
+
/** Number of times used */
|
|
261
|
+
count: number;
|
|
161
262
|
}
|
|
162
263
|
/**
|
|
163
264
|
* Analyzed component metadata
|
|
164
265
|
*/
|
|
165
|
-
export
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
266
|
+
export interface AnalyzedComponent {
|
|
267
|
+
/** Component name */
|
|
268
|
+
name: string;
|
|
269
|
+
/** File path */
|
|
270
|
+
path: string;
|
|
271
|
+
/** Component description */
|
|
272
|
+
description?: string;
|
|
273
|
+
/** Analyzed props */
|
|
274
|
+
props: StoryAnalyzedProp[];
|
|
275
|
+
/** Analyzed slots */
|
|
276
|
+
slots: AnalyzedSlot[];
|
|
277
|
+
/** Component dependencies (other components used) */
|
|
278
|
+
dependencies: string[];
|
|
279
|
+
/** CSS classes used (for Crosswind) */
|
|
280
|
+
cssClasses: string[];
|
|
281
|
+
/** Directives used in the component */
|
|
282
|
+
directives?: DirectiveUsage[];
|
|
283
|
+
/** Category/group */
|
|
284
|
+
category?: string;
|
|
285
|
+
/** Tags for filtering */
|
|
286
|
+
tags?: string[];
|
|
176
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Control type for prop editing
|
|
290
|
+
*/
|
|
291
|
+
export type ControlType = 'text' | 'number' | 'boolean' | 'select' | 'radio' | 'color' | 'date' | 'json' | 'textarea' | 'slider' | 'buttongroup';
|
|
177
292
|
/**
|
|
178
293
|
* Control configuration
|
|
179
294
|
*/
|
|
180
|
-
export
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
295
|
+
export interface ControlConfig {
|
|
296
|
+
/** Control type */
|
|
297
|
+
type: ControlType;
|
|
298
|
+
/** Display title */
|
|
299
|
+
title?: string;
|
|
300
|
+
/** Options for select/radio */
|
|
301
|
+
options?: {
|
|
302
|
+
value: any;
|
|
303
|
+
label: string;
|
|
304
|
+
}[] | string[] | Record<string, string>;
|
|
305
|
+
/** Min value for number/slider */
|
|
306
|
+
min?: number;
|
|
307
|
+
/** Max value for number/slider */
|
|
308
|
+
max?: number;
|
|
309
|
+
/** Step for number/slider */
|
|
310
|
+
step?: number;
|
|
187
311
|
}
|
|
188
312
|
/**
|
|
189
313
|
* Story context for server operations
|
|
190
314
|
*/
|
|
191
|
-
export
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
315
|
+
export interface StoryContext {
|
|
316
|
+
/** Root directory */
|
|
317
|
+
root: string;
|
|
318
|
+
/** Resolved configuration */
|
|
319
|
+
config: ResolvedStoryConfig;
|
|
320
|
+
/** Discovered story files */
|
|
321
|
+
storyFiles: ServerStoryFile[];
|
|
322
|
+
/** Built tree structure */
|
|
323
|
+
tree?: ServerTree;
|
|
324
|
+
/** Mode (dev or build) */
|
|
325
|
+
mode: 'dev' | 'build';
|
|
197
326
|
}
|
|
198
327
|
/**
|
|
199
328
|
* Resolved story configuration with all defaults applied
|
|
200
329
|
*/
|
|
201
|
-
export
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
330
|
+
export interface ResolvedStoryConfig {
|
|
331
|
+
enabled: boolean;
|
|
332
|
+
outDir: string;
|
|
333
|
+
storyMatch: string[];
|
|
334
|
+
storyIgnored: string[];
|
|
335
|
+
tree: Required<StoryTreeConfig>;
|
|
336
|
+
theme: StoryThemeConfig;
|
|
337
|
+
responsivePresets: ResponsivePreset[];
|
|
338
|
+
backgroundPresets: BackgroundPreset[];
|
|
339
|
+
autoApplyContrastColor: boolean;
|
|
340
|
+
setupFile?: string;
|
|
341
|
+
port: number;
|
|
213
342
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Story layout configuration
|
|
216
|
-
*/
|
|
217
|
-
export type StoryLayout = | { type: 'single', iframe?: boolean }
|
|
218
|
-
| { type: 'grid', width?: number | string }
|
|
219
|
-
/**
|
|
220
|
-
* Any tree node type
|
|
221
|
-
*/
|
|
222
|
-
export type ServerTreeNode = ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf;
|
|
223
|
-
/**
|
|
224
|
-
* Complete server tree
|
|
225
|
-
*/
|
|
226
|
-
export type ServerTree = ServerTreeNode[];
|
|
227
|
-
/**
|
|
228
|
-
* Control type for prop editing
|
|
229
|
-
*/
|
|
230
|
-
export type ControlType = | 'text'
|
|
231
|
-
| 'number'
|
|
232
|
-
| 'boolean'
|
|
233
|
-
| 'select'
|
|
234
|
-
| 'radio'
|
|
235
|
-
| 'color'
|
|
236
|
-
| 'date'
|
|
237
|
-
| 'json'
|
|
238
|
-
| 'textarea'
|
|
239
|
-
| 'slider'
|
|
240
|
-
| 'buttongroup';
|