@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,34 @@
|
|
|
1
|
+
import type { ServerStoryFile, StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if desktop preview is available
|
|
4
|
+
*/
|
|
5
|
+
export declare function isDesktopPreviewAvailable(): Promise<boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* Open a story in a native desktop window
|
|
8
|
+
*/
|
|
9
|
+
export declare function openDesktopPreview(ctx: StoryContext, story: ServerStoryFile, variantId: string, options?: DesktopPreviewOptions): Promise<DesktopPreviewInstance | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Get desktop preview button HTML
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDesktopPreviewButton(storyId: string, variantId: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get desktop preview styles
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDesktopPreviewStyles(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Desktop preview options
|
|
20
|
+
*/
|
|
21
|
+
export declare interface DesktopPreviewOptions {
|
|
22
|
+
width?: number
|
|
23
|
+
height?: number
|
|
24
|
+
title?: string
|
|
25
|
+
devTools?: boolean
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Desktop preview instance
|
|
29
|
+
*/
|
|
30
|
+
export declare interface DesktopPreviewInstance {
|
|
31
|
+
close: () => void
|
|
32
|
+
reload: () => void
|
|
33
|
+
update: (html: string) => void
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AnalyzedComponent, ServerStoryFile, StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate documentation for all components
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateStoryDocs(ctx: StoryContext, components: AnalyzedComponent[], options?: DocsOptions): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Generate documentation index
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateDocsIndex(components: AnalyzedComponent[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Generate documentation for a single component
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateComponentDocs(component: AnalyzedComponent, storyFile?: ServerStoryFile, options?: DocsOptions): string;
|
|
14
|
+
/**
|
|
15
|
+
* Generate JSON catalog of all components
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateComponentCatalog(components: AnalyzedComponent[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Export design tokens from components
|
|
20
|
+
*/
|
|
21
|
+
export declare function exportDesignTokens(components: AnalyzedComponent[]): Record<string, any>;
|
|
22
|
+
/**
|
|
23
|
+
* Documentation options
|
|
24
|
+
*/
|
|
25
|
+
export declare interface DocsOptions {
|
|
26
|
+
outDir?: string
|
|
27
|
+
includeStories?: boolean
|
|
28
|
+
includeSource?: boolean
|
|
29
|
+
template?: string
|
|
30
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a story error
|
|
3
|
+
*/
|
|
4
|
+
export declare function createStoryError(type: StoryErrorType, message: string, details?: Partial<StoryError>): StoryError;
|
|
5
|
+
/**
|
|
6
|
+
* Format error for display
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatStoryError(error: StoryError): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate error display HTML
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateErrorHTML(error: StoryError): string;
|
|
13
|
+
/**
|
|
14
|
+
* Get error styles
|
|
15
|
+
*/
|
|
16
|
+
export declare function getErrorStyles(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Create error boundary wrapper
|
|
19
|
+
*/
|
|
20
|
+
export declare function createErrorBoundary(content: string, componentName: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Story error
|
|
23
|
+
*/
|
|
24
|
+
export declare interface StoryError {
|
|
25
|
+
type: StoryErrorType
|
|
26
|
+
message: string
|
|
27
|
+
file?: string
|
|
28
|
+
line?: number
|
|
29
|
+
column?: number
|
|
30
|
+
stack?: string
|
|
31
|
+
suggestions?: string[]
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* STX Story - Error Handling
|
|
35
|
+
* Graceful error display and recovery suggestions
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Story error types
|
|
39
|
+
*/
|
|
40
|
+
export type StoryErrorType = | 'parse_error'
|
|
41
|
+
| 'component_error'
|
|
42
|
+
| 'render_error'
|
|
43
|
+
| 'config_error'
|
|
44
|
+
| 'file_not_found'
|
|
45
|
+
| 'circular_dependency'
|
|
46
|
+
| 'prop_type_error'
|
|
47
|
+
| 'unknown'
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { AnalyzedComponent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Export components to Figma format
|
|
4
|
+
*/
|
|
5
|
+
export declare function exportToFigma(components: AnalyzedComponent[], options?: FigmaExportOptions): FigmaDocument;
|
|
6
|
+
/**
|
|
7
|
+
* Export to Figma JSON file
|
|
8
|
+
*/
|
|
9
|
+
export declare function exportToFigmaFile(components: AnalyzedComponent[], outputPath: string, options?: FigmaExportOptions): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Convert CSS color to Figma color
|
|
12
|
+
*/
|
|
13
|
+
export declare function cssColorToFigma(cssColor: string): FigmaColor;
|
|
14
|
+
/**
|
|
15
|
+
* Convert Figma color to CSS
|
|
16
|
+
*/
|
|
17
|
+
export declare function figmaColorToCss(color: FigmaColor): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate Figma plugin manifest
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateFigmaPluginManifest(name: string): object;
|
|
22
|
+
/**
|
|
23
|
+
* Generate Figma import code snippet
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateFigmaImportCode(components: AnalyzedComponent[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Figma color
|
|
28
|
+
*/
|
|
29
|
+
export declare interface FigmaColor {
|
|
30
|
+
r: number
|
|
31
|
+
g: number
|
|
32
|
+
b: number
|
|
33
|
+
a: number
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Figma paint (fill/stroke)
|
|
37
|
+
*/
|
|
38
|
+
export declare interface FigmaPaint {
|
|
39
|
+
type: 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'IMAGE'
|
|
40
|
+
color?: FigmaColor
|
|
41
|
+
opacity?: number
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Figma text style
|
|
45
|
+
*/
|
|
46
|
+
export declare interface FigmaTextStyle {
|
|
47
|
+
fontFamily: string
|
|
48
|
+
fontWeight: number
|
|
49
|
+
fontSize: number
|
|
50
|
+
lineHeight?: { value: number, unit: 'PIXELS' | 'PERCENT' | 'AUTO' }
|
|
51
|
+
letterSpacing?: { value: number, unit: 'PIXELS' | 'PERCENT' }
|
|
52
|
+
textAlign?: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Figma node base
|
|
56
|
+
*/
|
|
57
|
+
export declare interface FigmaNodeBase {
|
|
58
|
+
id: string
|
|
59
|
+
name: string
|
|
60
|
+
type: FigmaNodeType
|
|
61
|
+
visible?: boolean
|
|
62
|
+
locked?: boolean
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Figma frame node
|
|
66
|
+
*/
|
|
67
|
+
export declare interface FigmaFrameNode extends FigmaNodeBase {
|
|
68
|
+
type: 'FRAME' | 'COMPONENT' | 'COMPONENT_SET'
|
|
69
|
+
children: FigmaNode[]
|
|
70
|
+
absoluteBoundingBox?: { x: number, y: number, width: number, height: number }
|
|
71
|
+
constraints?: { horizontal: string, vertical: string }
|
|
72
|
+
fills?: FigmaPaint[]
|
|
73
|
+
strokes?: FigmaPaint[]
|
|
74
|
+
strokeWeight?: number
|
|
75
|
+
cornerRadius?: number
|
|
76
|
+
paddingLeft?: number
|
|
77
|
+
paddingRight?: number
|
|
78
|
+
paddingTop?: number
|
|
79
|
+
paddingBottom?: number
|
|
80
|
+
itemSpacing?: number
|
|
81
|
+
layoutMode?: 'NONE' | 'HORIZONTAL' | 'VERTICAL'
|
|
82
|
+
primaryAxisAlignItems?: 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN'
|
|
83
|
+
counterAxisAlignItems?: 'MIN' | 'CENTER' | 'MAX'
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Figma text node
|
|
87
|
+
*/
|
|
88
|
+
export declare interface FigmaTextNode extends FigmaNodeBase {
|
|
89
|
+
type: 'TEXT'
|
|
90
|
+
characters: string
|
|
91
|
+
style?: FigmaTextStyle
|
|
92
|
+
fills?: FigmaPaint[]
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Figma rectangle node
|
|
96
|
+
*/
|
|
97
|
+
export declare interface FigmaRectangleNode extends FigmaNodeBase {
|
|
98
|
+
type: 'RECTANGLE'
|
|
99
|
+
absoluteBoundingBox?: { x: number, y: number, width: number, height: number }
|
|
100
|
+
fills?: FigmaPaint[]
|
|
101
|
+
strokes?: FigmaPaint[]
|
|
102
|
+
strokeWeight?: number
|
|
103
|
+
cornerRadius?: number
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Figma document
|
|
107
|
+
*/
|
|
108
|
+
export declare interface FigmaDocument {
|
|
109
|
+
name: string
|
|
110
|
+
lastModified: string
|
|
111
|
+
version: string
|
|
112
|
+
document: {
|
|
113
|
+
id: string
|
|
114
|
+
name: string
|
|
115
|
+
type: 'DOCUMENT'
|
|
116
|
+
children: FigmaNode[]
|
|
117
|
+
}
|
|
118
|
+
components: Record<string, FigmaComponentMeta>
|
|
119
|
+
styles: Record<string, FigmaStyleMeta>
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Figma component metadata
|
|
123
|
+
*/
|
|
124
|
+
export declare interface FigmaComponentMeta {
|
|
125
|
+
key: string
|
|
126
|
+
name: string
|
|
127
|
+
description: string
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Figma style metadata
|
|
131
|
+
*/
|
|
132
|
+
export declare interface FigmaStyleMeta {
|
|
133
|
+
key: string
|
|
134
|
+
name: string
|
|
135
|
+
styleType: 'FILL' | 'TEXT' | 'EFFECT' | 'GRID'
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Export options
|
|
139
|
+
*/
|
|
140
|
+
export declare interface FigmaExportOptions {
|
|
141
|
+
includeVariants?: boolean
|
|
142
|
+
includeProps?: boolean
|
|
143
|
+
frameWidth?: number
|
|
144
|
+
frameHeight?: number
|
|
145
|
+
componentSpacing?: number
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Figma node types
|
|
149
|
+
*/
|
|
150
|
+
export type FigmaNodeType = | 'DOCUMENT'
|
|
151
|
+
| 'CANVAS'
|
|
152
|
+
| 'FRAME'
|
|
153
|
+
| 'GROUP'
|
|
154
|
+
| 'VECTOR'
|
|
155
|
+
| 'BOOLEAN_OPERATION'
|
|
156
|
+
| 'STAR'
|
|
157
|
+
| 'LINE'
|
|
158
|
+
| 'ELLIPSE'
|
|
159
|
+
| 'REGULAR_POLYGON'
|
|
160
|
+
| 'RECTANGLE'
|
|
161
|
+
| 'TEXT'
|
|
162
|
+
| 'SLICE'
|
|
163
|
+
| 'COMPONENT'
|
|
164
|
+
| 'COMPONENT_SET'
|
|
165
|
+
| 'INSTANCE'
|
|
166
|
+
/**
|
|
167
|
+
* Union of all Figma node types
|
|
168
|
+
*/
|
|
169
|
+
export type FigmaNode = FigmaFrameNode | FigmaTextNode | FigmaRectangleNode | FigmaNodeBase
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AnalyzedComponent, ControlConfig, ServerStory, StoryAnalyzedProp } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a story from analyzed component metadata
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateAutoStory(component: AnalyzedComponent): ServerStory;
|
|
6
|
+
/**
|
|
7
|
+
* Infer control configuration from a prop
|
|
8
|
+
*/
|
|
9
|
+
export declare function inferControl(prop: StoryAnalyzedProp): ControlConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Generate controls for all props
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateControls(props: StoryAnalyzedProp[]): ControlConfig[];
|
|
14
|
+
/**
|
|
15
|
+
* Generate story source code from component and state
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateStorySource(componentName: string, state: Record<string, any>): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a complete story file content
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateStoryFileContent(component: AnalyzedComponent): string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ServerWebSocket } from 'bun';
|
|
2
|
+
export declare function createHmrHandler(): HmrWebSocketHandler;
|
|
3
|
+
/**
|
|
4
|
+
* Broadcast a message to all connected clients
|
|
5
|
+
*/
|
|
6
|
+
export declare function broadcast(message: HmrMessage): void;
|
|
7
|
+
/**
|
|
8
|
+
* Notify clients of a story update
|
|
9
|
+
*/
|
|
10
|
+
export declare function notifyStoryUpdate(storyId: string, data?: any): void;
|
|
11
|
+
/**
|
|
12
|
+
* Notify clients of a new story
|
|
13
|
+
*/
|
|
14
|
+
export declare function notifyStoryAdd(storyId: string, data?: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* Notify clients of a removed story
|
|
17
|
+
*/
|
|
18
|
+
export declare function notifyStoryRemove(storyId: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Notify clients of a config change
|
|
21
|
+
*/
|
|
22
|
+
export declare function notifyConfigChange(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Notify clients to do a full reload
|
|
25
|
+
*/
|
|
26
|
+
export declare function notifyFullReload(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Notify clients of an error
|
|
29
|
+
*/
|
|
30
|
+
export declare function notifyError(error: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get the number of connected clients
|
|
33
|
+
*/
|
|
34
|
+
export declare function getClientCount(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Get HMR client script to inject into the page
|
|
37
|
+
*/
|
|
38
|
+
export declare function getHmrClientScript(wsUrl: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* HMR message structure
|
|
41
|
+
*/
|
|
42
|
+
export declare interface HmrMessage {
|
|
43
|
+
type: HmrMessageType
|
|
44
|
+
data?: any
|
|
45
|
+
timestamp?: number
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create WebSocket upgrade handler for HMR
|
|
49
|
+
*/
|
|
50
|
+
export declare interface HmrWebSocketHandler {
|
|
51
|
+
open: (ws: ServerWebSocket<unknown>) => void
|
|
52
|
+
close: (ws: ServerWebSocket<unknown>) => void
|
|
53
|
+
message: (ws: ServerWebSocket<unknown>, message: string | ArrayBuffer) => void
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* HMR message types
|
|
57
|
+
*/
|
|
58
|
+
export type HmrMessageType = | 'connected'
|
|
59
|
+
| 'story-update'
|
|
60
|
+
| 'story-add'
|
|
61
|
+
| 'story-remove'
|
|
62
|
+
| 'config-change'
|
|
63
|
+
| 'full-reload'
|
|
64
|
+
| 'error'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate hot swap client script
|
|
3
|
+
* Injects into the story UI for seamless variant switching
|
|
4
|
+
*/
|
|
5
|
+
export declare function getHotSwapScript(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Generate variant selector UI
|
|
8
|
+
*/
|
|
9
|
+
export declare function getVariantSelectorHtml(variants: Array<{ id: string, title: string }>, currentVariantId: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Generate variant selector styles
|
|
12
|
+
*/
|
|
13
|
+
export declare function getVariantSelectorStyles(): string;
|
|
14
|
+
/**
|
|
15
|
+
* STX Story - Hot Swap
|
|
16
|
+
* Switch story variants without full page reload
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Hot swap state
|
|
20
|
+
*/
|
|
21
|
+
export declare interface HotSwapState {
|
|
22
|
+
storyId: string | null
|
|
23
|
+
variantId: string | null
|
|
24
|
+
props: Record<string, any>
|
|
25
|
+
iframe: HTMLIFrameElement | null
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hot swap options
|
|
29
|
+
*/
|
|
30
|
+
export declare interface HotSwapOptions {
|
|
31
|
+
animationDuration?: number
|
|
32
|
+
preserveScroll?: boolean
|
|
33
|
+
onBeforeSwap?: (state: HotSwapState) => void
|
|
34
|
+
onAfterSwap?: (state: HotSwapState) => void
|
|
35
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type { CreateContextOptions } from './context';
|
|
2
|
+
export type { ServerOptions, StoryServer } from './server';
|
|
3
|
+
export * from './addons';
|
|
4
|
+
export * from './analytics';
|
|
5
|
+
export * from './auto-stories';
|
|
6
|
+
export * from './bookmarks';
|
|
7
|
+
export * from './bun-test';
|
|
8
|
+
export * from './cli';
|
|
9
|
+
export * from './collect';
|
|
10
|
+
export * from './commands';
|
|
11
|
+
export * from './compiled-output';
|
|
12
|
+
export * from './composition';
|
|
13
|
+
export {
|
|
14
|
+
defaultBackgroundPresets,
|
|
15
|
+
defaultResponsivePresets,
|
|
16
|
+
defaultStoryConfig,
|
|
17
|
+
getDefaultStoryConfig,
|
|
18
|
+
resolveStoryConfig,
|
|
19
|
+
} from './config';
|
|
20
|
+
export * from './config-watcher';
|
|
21
|
+
export {
|
|
22
|
+
createContext,
|
|
23
|
+
updateContextStoryFiles,
|
|
24
|
+
updateContextTree,
|
|
25
|
+
} from './context';
|
|
26
|
+
export * from './controls';
|
|
27
|
+
export * from './desktop-preview';
|
|
28
|
+
export * from './docs-generator';
|
|
29
|
+
export * from './errors';
|
|
30
|
+
export * from './figma-export';
|
|
31
|
+
export * from './generator';
|
|
32
|
+
export * from './crosswind';
|
|
33
|
+
export * from './hmr';
|
|
34
|
+
export * from './hot-swap';
|
|
35
|
+
export * from './interactions';
|
|
36
|
+
export * from './keyboard-shortcuts';
|
|
37
|
+
export * from './output';
|
|
38
|
+
export * from './performance';
|
|
39
|
+
export * from './presets';
|
|
40
|
+
export * from './props-validation';
|
|
41
|
+
export * from './renderer';
|
|
42
|
+
export * from './search';
|
|
43
|
+
export * from './search-index';
|
|
44
|
+
export { createStoryServer } from './server';
|
|
45
|
+
export * from './setup';
|
|
46
|
+
export * from './snapshots';
|
|
47
|
+
export * from './testing';
|
|
48
|
+
export * from './theme';
|
|
49
|
+
export * from './types';
|
|
50
|
+
export * from './ui';
|
|
51
|
+
export * from './visual-testing';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ServerStoryFile, StoryContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse @interaction blocks from story content
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseInteractionBlocks(content: string): InteractionTest[];
|
|
6
|
+
/**
|
|
7
|
+
* Run interaction tests for a story
|
|
8
|
+
*/
|
|
9
|
+
export declare function runInteractionTests(_ctx: StoryContext, story: ServerStoryFile, tests: InteractionTest[]): Promise<InteractionTestResult[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Generate interaction test helpers script (for browser)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getInteractionHelpersScript(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format interaction test results
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatInteractionResults(results: InteractionTestResult[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Interaction step
|
|
20
|
+
*/
|
|
21
|
+
export declare interface InteractionStep {
|
|
22
|
+
action: 'click' | 'type' | 'select' | 'hover' | 'focus' | 'blur' | 'wait' | 'assert'
|
|
23
|
+
selector?: string
|
|
24
|
+
value?: string
|
|
25
|
+
duration?: number
|
|
26
|
+
assertion?: {
|
|
27
|
+
type: 'text' | 'value' | 'visible' | 'hidden' | 'class' | 'attribute'
|
|
28
|
+
expected: any
|
|
29
|
+
attribute?: string
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interaction test definition
|
|
34
|
+
*/
|
|
35
|
+
export declare interface InteractionTest {
|
|
36
|
+
name: string
|
|
37
|
+
storyId: string
|
|
38
|
+
variantId: string
|
|
39
|
+
steps: InteractionStep[]
|
|
40
|
+
setup?: () => Promise<void>
|
|
41
|
+
teardown?: () => Promise<void>
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Interaction test result
|
|
45
|
+
*/
|
|
46
|
+
export declare interface InteractionTestResult {
|
|
47
|
+
name: string
|
|
48
|
+
passed: boolean
|
|
49
|
+
error?: string
|
|
50
|
+
duration: number
|
|
51
|
+
failedStep?: number
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format shortcut key for display
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatShortcutKey(shortcut: KeyboardShortcut): string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate keyboard shortcuts modal HTML
|
|
7
|
+
*/
|
|
8
|
+
export declare function getShortcutsModalHtml(shortcuts?: KeyboardShortcut[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate keyboard shortcuts styles
|
|
11
|
+
*/
|
|
12
|
+
export declare function getShortcutsStyles(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Generate keyboard shortcuts handler script
|
|
15
|
+
*/
|
|
16
|
+
export declare function getShortcutsScript(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Default keyboard shortcuts
|
|
19
|
+
*/
|
|
20
|
+
export declare const defaultShortcuts: KeyboardShortcut[];
|
|
21
|
+
/**
|
|
22
|
+
* STX Story - Keyboard Shortcuts
|
|
23
|
+
* Keyboard shortcuts panel and handler
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Keyboard shortcut definition
|
|
27
|
+
*/
|
|
28
|
+
export declare interface KeyboardShortcut {
|
|
29
|
+
key: string
|
|
30
|
+
modifiers?: ('ctrl' | 'alt' | 'shift' | 'meta')[]
|
|
31
|
+
description: string
|
|
32
|
+
category: string
|
|
33
|
+
action: string
|
|
34
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply color to text
|
|
3
|
+
*/
|
|
4
|
+
export declare function color(text: string, colorName: keyof typeof colors): string;
|
|
5
|
+
/**
|
|
6
|
+
* Apply style to text
|
|
7
|
+
*/
|
|
8
|
+
export declare function style(text: string, styleName: keyof typeof styles): string;
|
|
9
|
+
/**
|
|
10
|
+
* Print the STX Story banner
|
|
11
|
+
*/
|
|
12
|
+
export declare function printBanner(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Print server URLs
|
|
15
|
+
*/
|
|
16
|
+
export declare function printServerUrls(url: string, networkUrl?: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Print story count
|
|
19
|
+
*/
|
|
20
|
+
export declare function printStoryCount(count: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Print file change event
|
|
23
|
+
*/
|
|
24
|
+
export declare function printFileChange(event: string, file: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Print error message
|
|
27
|
+
*/
|
|
28
|
+
export declare function printError(message: string, details?: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Print warning message
|
|
31
|
+
*/
|
|
32
|
+
export declare function printWarning(message: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Print success message
|
|
35
|
+
*/
|
|
36
|
+
export declare function printSuccess(message: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Print info message
|
|
39
|
+
*/
|
|
40
|
+
export declare function printInfo(message: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Print build summary
|
|
43
|
+
*/
|
|
44
|
+
export declare function printBuildSummary(storyCount: number, outDir: string, duration: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Print test summary
|
|
47
|
+
*/
|
|
48
|
+
export declare function printTestSummary(total: number, passed: number, failed: number, duration: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Print keyboard shortcuts help
|
|
51
|
+
*/
|
|
52
|
+
export declare function printHelp(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Clear the console
|
|
55
|
+
*/
|
|
56
|
+
export declare function clearConsole(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Create a spinner
|
|
59
|
+
*/
|
|
60
|
+
export declare function createSpinner(text: string): {
|
|
61
|
+
start: () => void
|
|
62
|
+
stop: (success?: boolean) => void
|
|
63
|
+
update: (newText: string) => void
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Format duration in human-readable format
|
|
67
|
+
*/
|
|
68
|
+
export declare function formatDuration(ms: number): string;
|
|
69
|
+
/**
|
|
70
|
+
* Format file size in human-readable format
|
|
71
|
+
*/
|
|
72
|
+
export declare function formatSize(bytes: number): string;
|
|
73
|
+
// Convenience functions
|
|
74
|
+
export declare const red: (text: string) => string;
|
|
75
|
+
export declare const green: (text: string) => string;
|
|
76
|
+
export declare const yellow: (text: string) => string;
|
|
77
|
+
export declare const blue: (text: string) => string;
|
|
78
|
+
export declare const magenta: (text: string) => string;
|
|
79
|
+
export declare const cyan: (text: string) => string;
|
|
80
|
+
export declare const white: (text: string) => string;
|
|
81
|
+
export declare const gray: (text: string) => string;
|
|
82
|
+
export declare const bold: (text: string) => string;
|
|
83
|
+
export declare const dim: (text: string) => string;
|
|
84
|
+
export declare const italic: (text: string) => string;
|
|
85
|
+
export declare const underline: (text: string) => string;
|