@stacksjs/stx 0.1.16 → 0.2.3
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 +109 -5
- package/dist/analytics.d.ts +40 -0
- package/dist/animation.d.ts +91 -1
- package/dist/app.d.ts +51 -0
- package/dist/ast.d.ts +286 -0
- package/dist/async-components.d.ts +101 -0
- package/dist/auth.d.ts +1 -3
- package/dist/browser-composables.d.ts +314 -0
- package/dist/build-optimizer.d.ts +126 -0
- package/dist/build-views.d.ts +37 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/index.d.ts +60 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +7 -0
- package/dist/cli.js +10885 -1203
- package/dist/client/directive.d.ts +10 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/router.d.ts +36 -0
- package/dist/client/stx-router.browser.d.ts +0 -0
- package/dist/client-script.d.ts +22 -0
- package/dist/component-hmr.d.ts +120 -0
- package/dist/components.d.ts +23 -1
- package/dist/composables/index.d.ts +277 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-broadcast-channel.d.ts +58 -0
- package/dist/composables/use-clipboard.d.ts +34 -0
- package/dist/composables/use-cookie.d.ts +70 -0
- package/dist/composables/use-device-orientation.d.ts +109 -0
- package/dist/composables/use-event-source.d.ts +77 -0
- package/dist/composables/use-eye-dropper.d.ts +107 -0
- package/dist/composables/use-fetch.d.ts +84 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-idle.d.ts +84 -0
- package/dist/composables/use-intersection-observer.d.ts +81 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-mouse.d.ts +64 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-notification.d.ts +89 -0
- package/dist/composables/use-permissions.d.ts +109 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-share.d.ts +70 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-storage.d.ts +64 -0
- package/dist/composables/use-text-selection.d.ts +97 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-websocket.d.ts +69 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables.d.ts +268 -0
- package/dist/composition-api.d.ts +190 -0
- package/dist/computed.d.ts +137 -0
- package/dist/conditionals.d.ts +14 -2
- package/dist/config.d.ts +36 -3
- package/dist/craft-bridge.d.ts +319 -0
- package/dist/craft-compiler.d.ts +229 -0
- package/dist/craft-components.d.ts +411 -0
- package/dist/craft-entry.d.ts +5 -0
- package/dist/craft-ssr.d.ts +134 -0
- package/dist/craft.js +1553 -0
- package/dist/csp.d.ts +229 -0
- package/dist/database.d.ts +407 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +4 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/index.d.ts +84 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/dev-server/crosswind.d.ts +54 -0
- package/dist/dev-server/index.d.ts +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/native-window.d.ts +40 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/terminal-colors.d.ts +60 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/types.d.ts +92 -0
- package/dist/dev-server.d.ts +21 -0
- package/dist/devtools.d.ts +142 -0
- package/dist/directive-api.d.ts +111 -0
- package/dist/dynamic-components.d.ts +14 -0
- package/dist/edge-runtime.d.ts +200 -0
- package/dist/env.d.ts +9 -0
- package/dist/error-boundaries.d.ts +71 -0
- package/dist/error-handling.d.ts +1 -101
- package/dist/errors/codes.d.ts +99 -0
- package/dist/errors/formatter.d.ts +64 -0
- package/dist/errors/index.d.ts +56 -0
- package/dist/errors/logger.d.ts +74 -0
- package/dist/errors/sanitizer.d.ts +43 -0
- package/dist/errors/types.d.ts +79 -0
- package/dist/events.d.ts +106 -0
- package/dist/expressions.d.ts +86 -11
- package/dist/formatter.d.ts +4 -0
- package/dist/forms-validation.d.ts +173 -0
- package/dist/forms.d.ts +157 -8
- package/dist/head.d.ts +225 -0
- package/dist/heatmap.d.ts +125 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hydration-runtime.d.ts +47 -0
- package/dist/hydration.d.ts +161 -0
- package/dist/i18n.d.ts +240 -4
- package/dist/image-optimization/build-plugin.d.ts +53 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/index.d.ts +86 -0
- package/dist/image-optimization/processor.d.ts +112 -0
- package/dist/includes.d.ts +94 -9
- package/dist/index.d.ts +63 -3
- package/dist/index.js +11604 -1318
- package/dist/init.d.ts +32 -2
- package/dist/interactive.d.ts +14 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/jsx-runtime.d.ts +110 -0
- package/dist/keep-alive.d.ts +87 -0
- package/dist/lazy-loader.d.ts +122 -0
- package/dist/loading-indicator.d.ts +40 -0
- package/dist/loops.d.ts +22 -1
- package/dist/media/client/blur-up.d.ts +65 -0
- package/dist/media/client/index.d.ts +77 -0
- package/dist/media/client/lazy-load.d.ts +73 -0
- package/dist/media/client/upload-handler.d.ts +79 -0
- package/dist/media/image/component.d.ts +46 -0
- package/dist/media/image/directive.d.ts +9 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/index.d.ts +118 -0
- package/dist/media/image/placeholder.d.ts +78 -0
- package/dist/media/image/processor/cache.d.ts +32 -0
- package/dist/media/image/processor/index.d.ts +12 -0
- package/dist/media/image/processor/optimizer.d.ts +13 -0
- package/dist/media/image/processor/responsive.d.ts +17 -0
- package/dist/media/image/srcset.d.ts +158 -0
- package/dist/media/index.d.ts +295 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/protected/component.d.ts +34 -0
- package/dist/media/protected/index.d.ts +34 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/shared/cache.d.ts +54 -0
- package/dist/media/shared/hash.d.ts +24 -0
- package/dist/media/shared/index.d.ts +2 -0
- package/dist/media/types.d.ts +1051 -0
- package/dist/media/upload/component.d.ts +23 -0
- package/dist/media/upload/index.d.ts +1 -0
- package/dist/media/video/directive.d.ts +9 -0
- package/dist/media/video/index.d.ts +47 -0
- package/dist/media/video/processor/cache.d.ts +33 -0
- package/dist/media/video/processor/index.d.ts +21 -0
- package/dist/media/video/processor/streaming.d.ts +19 -0
- package/dist/media/video/processor/thumbnail.d.ts +28 -0
- package/dist/media/video/processor/transcoder.d.ts +9 -0
- package/dist/middleware.d.ts +42 -3
- package/dist/native-build.d.ts +74 -0
- package/dist/parser/directive-parser.d.ts +79 -0
- package/dist/parser/expression-parser.d.ts +59 -0
- package/dist/parser/index.d.ts +35 -0
- package/dist/parser/tokenizer.d.ts +81 -0
- package/dist/partial-hydration.d.ts +88 -0
- package/dist/performance-utils.d.ts +146 -3
- package/dist/plugin-system.d.ts +128 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/precompiler.d.ts +108 -0
- package/dist/production-build.d.ts +199 -0
- package/dist/props.d.ts +199 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/directives.d.ts +29 -0
- package/dist/pwa/icons.d.ts +39 -0
- package/dist/pwa/index.d.ts +59 -0
- package/dist/pwa/inject.d.ts +22 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/precache.d.ts +29 -0
- package/dist/pwa/service-worker.d.ts +21 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox.d.ts +52 -0
- package/dist/pwa.d.ts +51 -0
- package/dist/pwa.js +8124 -0
- package/dist/reactive-bindings.d.ts +24 -0
- package/dist/reactive.d.ts +100 -0
- package/dist/reactivity.d.ts +253 -0
- package/dist/route-middleware.d.ts +232 -0
- package/dist/router.d.ts +31 -0
- package/dist/routes.d.ts +0 -7
- package/dist/runtime.d.ts +140 -0
- package/dist/safe-evaluator.d.ts +117 -3
- package/dist/scaffolding.d.ts +113 -0
- package/dist/seo.d.ts +120 -7
- package/dist/server-components.d.ts +134 -0
- package/dist/signals.d.ts +501 -0
- package/dist/slots.d.ts +63 -0
- package/dist/source-maps.d.ts +117 -0
- package/dist/ssg.d.ts +157 -0
- package/dist/ssg.js +6831 -0
- package/dist/ssr.d.ts +107 -0
- package/dist/state-management.d.ts +324 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/analytics.d.ts +92 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/bookmarks.d.ts +53 -0
- package/dist/story/bun-test.d.ts +44 -0
- package/dist/story/cli.d.ts +34 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/index.d.ts +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/scanner.d.ts +13 -0
- package/dist/story/collect/tree.d.ts +17 -0
- package/dist/story/commands/build.d.ts +14 -0
- package/dist/story/commands/dev.d.ts +16 -0
- package/dist/story/commands/index.d.ts +6 -0
- package/dist/story/commands/preview.d.ts +15 -0
- package/dist/story/compiled-output.d.ts +26 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/config-watcher.d.ts +26 -0
- package/dist/story/config.d.ts +26 -0
- package/dist/story/context.d.ts +21 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/crosswind.d.ts +29 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/hmr.d.ts +64 -0
- package/dist/story/hot-swap.d.ts +35 -0
- package/dist/story/index.d.ts +51 -0
- package/dist/story/interactions.d.ts +52 -0
- package/dist/story/keyboard-shortcuts.d.ts +34 -0
- package/dist/story/output.d.ts +85 -0
- package/dist/story/performance.d.ts +76 -0
- package/dist/story/presets.d.ts +62 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/renderer.d.ts +53 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search.d.ts +45 -0
- package/dist/story/server.d.ts +21 -0
- package/dist/story/setup.d.ts +47 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/testing.d.ts +58 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/types.d.ts +249 -0
- package/dist/story/ui/code-panel.d.ts +42 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/index.d.ts +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/streaming.d.ts +82 -2
- package/dist/suspense.d.ts +83 -0
- package/dist/teleport.d.ts +9 -0
- package/dist/testing.d.ts +289 -0
- package/dist/transitions.d.ts +87 -0
- package/dist/type-checker.d.ts +109 -0
- package/dist/types/component-types.d.ts +129 -0
- package/dist/types/config-types.d.ts +336 -0
- package/dist/types/context-types.d.ts +99 -0
- package/dist/types/csp-types.d.ts +79 -0
- package/dist/types/directive-types.d.ts +259 -0
- package/dist/types/index.d.ts +98 -0
- package/dist/types/pwa-types.d.ts +218 -0
- package/dist/types.d.ts +1 -315
- package/dist/typescript-templates.d.ts +178 -0
- package/dist/utils.d.ts +52 -6
- package/dist/validator.d.ts +77 -0
- package/dist/variable-extractor.d.ts +39 -0
- package/dist/view-composers.d.ts +154 -9
- package/dist/virtual-scrolling.d.ts +103 -0
- package/dist/visual-editor.d.ts +209 -0
- package/dist/visual-testing.d.ts +109 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +16 -0
- package/dist/web-components/css-scoping.d.ts +54 -0
- package/dist/web-components/index.d.ts +20 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components.d.ts +222 -2
- package/dist/x-element.d.ts +35 -0
- package/package.json +41 -10
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate performance panel HTML
|
|
3
|
+
*/
|
|
4
|
+
export declare function getPerformancePanelHtml(metrics: ComponentMetrics[]): string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate performance panel styles
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPerformancePanelStyles(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate performance client script
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPerformanceScript(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Global profiler instance
|
|
15
|
+
*/
|
|
16
|
+
export declare const profiler: PerformanceProfiler;
|
|
17
|
+
/**
|
|
18
|
+
* STX Story - Component Performance Profiling
|
|
19
|
+
* Track render times, re-render counts, and memory usage
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Performance metrics for a component
|
|
23
|
+
*/
|
|
24
|
+
export declare interface ComponentMetrics {
|
|
25
|
+
componentId: string
|
|
26
|
+
componentName: string
|
|
27
|
+
renderCount: number
|
|
28
|
+
totalRenderTime: number
|
|
29
|
+
avgRenderTime: number
|
|
30
|
+
minRenderTime: number
|
|
31
|
+
maxRenderTime: number
|
|
32
|
+
lastRenderTime: number
|
|
33
|
+
memoryUsage?: number
|
|
34
|
+
history: RenderRecord[]
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Single render record
|
|
38
|
+
*/
|
|
39
|
+
export declare interface RenderRecord {
|
|
40
|
+
timestamp: number
|
|
41
|
+
duration: number
|
|
42
|
+
props?: Record<string, any>
|
|
43
|
+
memory?: number
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Performance profiler
|
|
47
|
+
*/
|
|
48
|
+
export declare class PerformanceProfiler {
|
|
49
|
+
private metrics: any;
|
|
50
|
+
private maxHistorySize: any;
|
|
51
|
+
private enabled: any;
|
|
52
|
+
setEnabled(enabled: boolean): void;
|
|
53
|
+
recordRender(componentId: string, componentName: string, duration: number, props?: Record<string, any>): void;
|
|
54
|
+
getMetrics(componentId: string): ComponentMetrics | undefined;
|
|
55
|
+
getAllMetrics(): ComponentMetrics[];
|
|
56
|
+
getSlowestComponents(limit?: any): ComponentMetrics[];
|
|
57
|
+
getMostRenderedComponents(limit?: any): ComponentMetrics[];
|
|
58
|
+
clear(): void;
|
|
59
|
+
clearComponent(componentId: string): void;
|
|
60
|
+
private getMemoryUsage(): number | undefined;
|
|
61
|
+
exportMetrics(): string;
|
|
62
|
+
createTimer(componentId: string, componentName: string): RenderTimer;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Render timer helper
|
|
66
|
+
*/
|
|
67
|
+
export declare class RenderTimer {
|
|
68
|
+
private startTime: number;
|
|
69
|
+
private props?: Record<string, any>;
|
|
70
|
+
private profiler: PerformanceProfiler;
|
|
71
|
+
private componentId: string;
|
|
72
|
+
private componentName: string;
|
|
73
|
+
constructor(profiler: PerformanceProfiler, componentId: string, componentName: string);
|
|
74
|
+
setProps(props: Record<string, any>): this;
|
|
75
|
+
end(): number;
|
|
76
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate presets panel HTML
|
|
3
|
+
*/
|
|
4
|
+
export declare function getPresetsPanelHtml(presets: PropPreset[]): string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate presets panel styles
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPresetsPanelStyles(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate presets client script
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPresetsScript(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Prop preset
|
|
15
|
+
*/
|
|
16
|
+
export declare interface PropPreset {
|
|
17
|
+
id: string
|
|
18
|
+
name: string
|
|
19
|
+
description?: string
|
|
20
|
+
props: Record<string, any>
|
|
21
|
+
componentId?: string
|
|
22
|
+
created: number
|
|
23
|
+
lastUsed?: number
|
|
24
|
+
usageCount: number
|
|
25
|
+
tags?: string[]
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Presets storage
|
|
29
|
+
*/
|
|
30
|
+
export declare interface PresetsStorage {
|
|
31
|
+
version: number
|
|
32
|
+
presets: PropPreset[]
|
|
33
|
+
recentIds: string[]
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Presets manager
|
|
37
|
+
*/
|
|
38
|
+
export declare class PresetsManager {
|
|
39
|
+
private storage: PresetsStorage;
|
|
40
|
+
private storagePath: string;
|
|
41
|
+
private dirty: any;
|
|
42
|
+
constructor(rootDir: string);
|
|
43
|
+
private loadStorage(): PresetsStorage;
|
|
44
|
+
private migrateStorage(data: any): PresetsStorage;
|
|
45
|
+
save(): Promise<void>;
|
|
46
|
+
createPreset(name: string, props: Record<string, any>, options?: {
|
|
47
|
+
description?: string
|
|
48
|
+
componentId?: string
|
|
49
|
+
tags?: string[]
|
|
50
|
+
}): PropPreset;
|
|
51
|
+
getPreset(id: string): PropPreset | undefined;
|
|
52
|
+
getAllPresets(): PropPreset[];
|
|
53
|
+
getPresetsForComponent(componentId: string): PropPreset[];
|
|
54
|
+
getRecentPresets(): PropPreset[];
|
|
55
|
+
usePreset(id: string): PropPreset | undefined;
|
|
56
|
+
updatePreset(id: string, updates: Partial<Omit<PropPreset, 'id' | 'created'>>): PropPreset | undefined;
|
|
57
|
+
deletePreset(id: string): boolean;
|
|
58
|
+
searchPresets(query: string): PropPreset[];
|
|
59
|
+
getMostUsedPresets(limit?: any): PropPreset[];
|
|
60
|
+
exportPresets(ids?: string[]): string;
|
|
61
|
+
importPresets(json: string, overwrite?: any): number;
|
|
62
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StoryAnalyzedProp } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate props against their definitions
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateProps(props: Record<string, any>, definitions: StoryAnalyzedProp[]): ValidationResult;
|
|
6
|
+
/**
|
|
7
|
+
* Generate validation script for client-side
|
|
8
|
+
*/
|
|
9
|
+
export declare function getValidationScript(definitions: StoryAnalyzedProp[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Format validation result for display
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatValidationResult(result: ValidationResult): string;
|
|
14
|
+
/**
|
|
15
|
+
* Generate HTML for validation errors display
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateValidationErrorsHTML(result: ValidationResult): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get validation panel styles
|
|
20
|
+
*/
|
|
21
|
+
export declare function getValidationStyles(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Validation result
|
|
24
|
+
*/
|
|
25
|
+
export declare interface ValidationResult {
|
|
26
|
+
valid: boolean
|
|
27
|
+
errors: ValidationError[]
|
|
28
|
+
warnings: ValidationWarning[]
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validation error
|
|
32
|
+
*/
|
|
33
|
+
export declare interface ValidationError {
|
|
34
|
+
prop: string
|
|
35
|
+
message: string
|
|
36
|
+
expected?: string
|
|
37
|
+
actual?: string
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validation warning
|
|
41
|
+
*/
|
|
42
|
+
export declare interface ValidationWarning {
|
|
43
|
+
prop: string
|
|
44
|
+
message: string
|
|
45
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ServerStoryFile, StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Render a story component with props
|
|
4
|
+
*/
|
|
5
|
+
export declare function renderStoryComponent(ctx: StoryContext, componentPath: string, options?: StoryRenderOptions): Promise<StoryRenderResult>;
|
|
6
|
+
/**
|
|
7
|
+
* Render a story variant
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderStoryVariant(ctx: StoryContext, story: ServerStoryFile, variantId: string, props?: Record<string, any>): Promise<StoryRenderResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Render an inline template string
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderInlineTemplate(ctx: StoryContext, template: string, props?: Record<string, any>): Promise<StoryRenderResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Clear the story component cache
|
|
16
|
+
*/
|
|
17
|
+
export declare function clearStoryCache(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get cache statistics
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCacheStats(): { size: number, entries: string[] };
|
|
22
|
+
/**
|
|
23
|
+
* Preload components into cache
|
|
24
|
+
*/
|
|
25
|
+
export declare function preloadComponents(paths: string[]): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Generate preview HTML document
|
|
28
|
+
*/
|
|
29
|
+
export declare function generatePreviewDocument(result: StoryRenderResult, options?: {
|
|
30
|
+
title?: string
|
|
31
|
+
theme?: 'light' | 'dark'
|
|
32
|
+
background?: string
|
|
33
|
+
crosswindCss?: string
|
|
34
|
+
}): string;
|
|
35
|
+
/**
|
|
36
|
+
* Story render options
|
|
37
|
+
*/
|
|
38
|
+
export declare interface StoryRenderOptions {
|
|
39
|
+
props?: Record<string, any>
|
|
40
|
+
slots?: Record<string, string>
|
|
41
|
+
includeStyles?: boolean
|
|
42
|
+
includeCrosswind?: boolean
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Story render result
|
|
46
|
+
*/
|
|
47
|
+
export declare interface StoryRenderResult {
|
|
48
|
+
html: string
|
|
49
|
+
css: string
|
|
50
|
+
js: string
|
|
51
|
+
errors: string[]
|
|
52
|
+
duration: number
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import type { AnalyzedComponent, ServerStoryFile, StoryContext } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Load search index from disk
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadSearchIndex(ctx: StoryContext): Promise<PersistedSearchIndex | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Save search index to disk
|
|
9
|
+
*/
|
|
10
|
+
export declare function saveSearchIndex(ctx: StoryContext, entries: SearchIndexEntry[]): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Build persisted search index from story files
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildPersistedSearchIndex(storyFiles: ServerStoryFile[], components: Map<string, AnalyzedComponent>): SearchIndexEntry[];
|
|
15
|
+
/**
|
|
16
|
+
* Check if index is stale (any file modified since index was built)
|
|
17
|
+
*/
|
|
18
|
+
export declare function isIndexStale(ctx: StoryContext, index: PersistedSearchIndex): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Search the index
|
|
21
|
+
*/
|
|
22
|
+
export declare function searchIndex(index: PersistedSearchIndex, query: string): SearchIndexEntry[];
|
|
23
|
+
/**
|
|
24
|
+
* Get or build search index
|
|
25
|
+
*/
|
|
26
|
+
export declare function getOrBuildSearchIndex(ctx: StoryContext, storyFiles: ServerStoryFile[], components: Map<string, AnalyzedComponent>, forceRebuild?: any): Promise<SearchIndexEntry[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Search index entry
|
|
29
|
+
*/
|
|
30
|
+
export declare interface SearchIndexEntry {
|
|
31
|
+
id: string
|
|
32
|
+
name: string
|
|
33
|
+
path: string
|
|
34
|
+
searchText: string
|
|
35
|
+
props: string[]
|
|
36
|
+
tags: string[]
|
|
37
|
+
mtime: number
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Persisted search index
|
|
41
|
+
*/
|
|
42
|
+
export declare interface PersistedSearchIndex {
|
|
43
|
+
version: number
|
|
44
|
+
created: number
|
|
45
|
+
updated: number
|
|
46
|
+
entries: SearchIndexEntry[]
|
|
47
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AnalyzedComponent, StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Build search index from story files
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildSearchIndex(ctx: StoryContext): void;
|
|
6
|
+
/**
|
|
7
|
+
* Build search index from analyzed components
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildComponentSearchIndex(components: AnalyzedComponent[]): void;
|
|
10
|
+
/**
|
|
11
|
+
* Search the index
|
|
12
|
+
*/
|
|
13
|
+
export declare function search(query: string, limit?: any): SearchResult[];
|
|
14
|
+
/**
|
|
15
|
+
* Get recent searches from localStorage (client-side)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getRecentSearches(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Clear the search index
|
|
20
|
+
*/
|
|
21
|
+
export declare function clearSearchIndex(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Get search index size
|
|
24
|
+
*/
|
|
25
|
+
export declare function getSearchIndexSize(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Generate search index JSON for static builds
|
|
28
|
+
*/
|
|
29
|
+
export declare function exportSearchIndex(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Import search index from JSON
|
|
32
|
+
*/
|
|
33
|
+
export declare function importSearchIndex(json: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Search result item
|
|
36
|
+
*/
|
|
37
|
+
export declare interface SearchResult {
|
|
38
|
+
type: 'story' | 'component' | 'prop' | 'slot'
|
|
39
|
+
title: string
|
|
40
|
+
description?: string
|
|
41
|
+
storyId: string
|
|
42
|
+
variantId?: string
|
|
43
|
+
score: number
|
|
44
|
+
match: string
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create and start the story server
|
|
4
|
+
*/
|
|
5
|
+
export declare function createStoryServer(ctx: StoryContext, options: ServerOptions): Promise<StoryServer>;
|
|
6
|
+
/**
|
|
7
|
+
* Server options
|
|
8
|
+
*/
|
|
9
|
+
export declare interface ServerOptions {
|
|
10
|
+
port: number
|
|
11
|
+
open?: boolean
|
|
12
|
+
host?: string | boolean
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Story server instance
|
|
16
|
+
*/
|
|
17
|
+
export declare interface StoryServer {
|
|
18
|
+
server: ReturnType<typeof Bun.serve>
|
|
19
|
+
url: string
|
|
20
|
+
close: () => Promise<void>
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Load and execute the setup file
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadSetupFile(ctx: StoryContext): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Get all registered global components
|
|
8
|
+
*/
|
|
9
|
+
export declare function getGlobalComponents(): Map<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* Get all global CSS
|
|
12
|
+
*/
|
|
13
|
+
export declare function getGlobalCSS(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get all global scripts
|
|
16
|
+
*/
|
|
17
|
+
export declare function getGlobalScripts(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get global state
|
|
20
|
+
*/
|
|
21
|
+
export declare function getGlobalState(): Map<string, any>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a specific global state value
|
|
24
|
+
*/
|
|
25
|
+
export declare function getState<T = any>(key: string): T | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Reset all global setup (for testing)
|
|
28
|
+
*/
|
|
29
|
+
export declare function resetSetup(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Generate HTML for global setup (CSS + scripts)
|
|
32
|
+
*/
|
|
33
|
+
export declare function getSetupHTML(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Context passed to setup function
|
|
36
|
+
*/
|
|
37
|
+
export declare interface SetupContext {
|
|
38
|
+
storyContext: StoryContext
|
|
39
|
+
registerComponent: (name: string, component: any) => void
|
|
40
|
+
addCSS: (css: string) => void
|
|
41
|
+
addScript: (script: string) => void
|
|
42
|
+
setState: (key: string, value: any) => void
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Setup function signature
|
|
46
|
+
*/
|
|
47
|
+
export type SetupFunction = (ctx: SetupContext) => void | Promise<void>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Get snapshot directory
|
|
4
|
+
*/
|
|
5
|
+
export declare function getSnapshotDir(ctx: StoryContext): string;
|
|
6
|
+
/**
|
|
7
|
+
* Load snapshot versions
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadSnapshotVersions(ctx: StoryContext, storyId: string): Promise<VersionedSnapshot | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Save snapshot version
|
|
12
|
+
*/
|
|
13
|
+
export declare function saveSnapshotVersion(ctx: StoryContext, storyId: string, description?: string): Promise<SnapshotVersion>;
|
|
14
|
+
/**
|
|
15
|
+
* Restore snapshot to a previous version
|
|
16
|
+
*/
|
|
17
|
+
export declare function restoreSnapshotVersion(ctx: StoryContext, storyId: string, version: number): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Generate diff between two HTML snapshots
|
|
20
|
+
* Returns a simple text-based diff (for actual image diff, you'd need canvas/image processing)
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateTextDiff(oldHtml: string, newHtml: string): DiffResult;
|
|
23
|
+
/**
|
|
24
|
+
* Generate visual diff HTML
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateDiffHTML(oldHtml: string, newHtml: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get diff styles
|
|
29
|
+
*/
|
|
30
|
+
export declare function getDiffStyles(): string;
|
|
31
|
+
/**
|
|
32
|
+
* List all snapshot versions for a story
|
|
33
|
+
*/
|
|
34
|
+
export declare function listSnapshotVersions(ctx: StoryContext, storyId: string): Promise<SnapshotVersion[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete old snapshot versions
|
|
37
|
+
*/
|
|
38
|
+
export declare function pruneSnapshotVersions(ctx: StoryContext, storyId: string, keepCount?: number): Promise<number>;
|
|
39
|
+
/**
|
|
40
|
+
* Snapshot version info
|
|
41
|
+
*/
|
|
42
|
+
export declare interface SnapshotVersion {
|
|
43
|
+
version: number
|
|
44
|
+
timestamp: number
|
|
45
|
+
commit?: string
|
|
46
|
+
description?: string
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Snapshot with version history
|
|
50
|
+
*/
|
|
51
|
+
export declare interface VersionedSnapshot {
|
|
52
|
+
current: SnapshotVersion
|
|
53
|
+
history: SnapshotVersion[]
|
|
54
|
+
maxVersions: number
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Diff result
|
|
58
|
+
*/
|
|
59
|
+
export declare interface DiffResult {
|
|
60
|
+
hasDiff: boolean
|
|
61
|
+
percentage: number
|
|
62
|
+
diffImagePath?: string
|
|
63
|
+
changedPixels: number
|
|
64
|
+
totalPixels: number
|
|
65
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
/**
|
|
15
|
+
* Run accessibility tests on stories
|
|
16
|
+
*/
|
|
17
|
+
export declare function runA11yTests(ctx: StoryContext, _options?: TestOptions): Promise<TestResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Test options
|
|
20
|
+
*/
|
|
21
|
+
export declare interface TestOptions {
|
|
22
|
+
update?: boolean
|
|
23
|
+
filter?: string[]
|
|
24
|
+
threshold?: number
|
|
25
|
+
snapshotDir?: string
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Test result
|
|
29
|
+
*/
|
|
30
|
+
export declare interface TestResult {
|
|
31
|
+
total: number
|
|
32
|
+
passed: number
|
|
33
|
+
failed: number
|
|
34
|
+
new: number
|
|
35
|
+
failures: TestFailure[]
|
|
36
|
+
duration: number
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Test failure details
|
|
40
|
+
*/
|
|
41
|
+
export declare interface TestFailure {
|
|
42
|
+
storyId: string
|
|
43
|
+
variantId: string
|
|
44
|
+
component: string
|
|
45
|
+
message: string
|
|
46
|
+
diffPath?: string
|
|
47
|
+
difference?: number
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Snapshot metadata
|
|
51
|
+
*/
|
|
52
|
+
export declare interface SnapshotMeta {
|
|
53
|
+
storyId: string
|
|
54
|
+
variantId: string
|
|
55
|
+
component: string
|
|
56
|
+
timestamp: number
|
|
57
|
+
hash: string
|
|
58
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Get current theme
|
|
4
|
+
*/
|
|
5
|
+
export declare function getCurrentTheme(): ThemeConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Check if dark mode is active
|
|
8
|
+
*/
|
|
9
|
+
export declare function isDark(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Toggle dark mode
|
|
12
|
+
*/
|
|
13
|
+
export declare function toggleDarkMode(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Set theme
|
|
16
|
+
*/
|
|
17
|
+
export declare function setTheme(theme: Partial<ThemeConfig>): void;
|
|
18
|
+
/**
|
|
19
|
+
* Initialize theme from context
|
|
20
|
+
*/
|
|
21
|
+
export declare function initializeTheme(ctx: StoryContext): void;
|
|
22
|
+
/**
|
|
23
|
+
* Generate CSS variables from theme
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateThemeCSS(theme?: ThemeConfig): string;
|
|
26
|
+
/**
|
|
27
|
+
* Generate theme toggle button HTML
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateThemeToggle(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get theme toggle script
|
|
32
|
+
*/
|
|
33
|
+
export declare function getThemeToggleScript(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Export theme tokens to JSON
|
|
36
|
+
*/
|
|
37
|
+
export declare function exportThemeTokensJSON(theme?: ThemeConfig): string;
|
|
38
|
+
/**
|
|
39
|
+
* Export theme tokens to CSS custom properties
|
|
40
|
+
*/
|
|
41
|
+
export declare function exportThemeTokensCSS(theme?: ThemeConfig): string;
|
|
42
|
+
/**
|
|
43
|
+
* Get theme styles
|
|
44
|
+
*/
|
|
45
|
+
export declare function getThemeStyles(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Default light theme
|
|
48
|
+
*/
|
|
49
|
+
export declare const lightTheme: ThemeConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Default dark theme
|
|
52
|
+
*/
|
|
53
|
+
export declare const darkTheme: ThemeConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Theme configuration
|
|
56
|
+
*/
|
|
57
|
+
export declare interface ThemeConfig {
|
|
58
|
+
colorScheme: 'light' | 'dark' | 'auto'
|
|
59
|
+
primaryColor: string
|
|
60
|
+
backgroundColor: string
|
|
61
|
+
textColor: string
|
|
62
|
+
borderColor: string
|
|
63
|
+
secondaryBackground: string
|
|
64
|
+
secondaryText: string
|
|
65
|
+
fontFamily: string
|
|
66
|
+
codeFontFamily: string
|
|
67
|
+
borderRadius: string
|
|
68
|
+
}
|