@stacksjs/stx 0.2.0 → 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.
Files changed (275) hide show
  1. package/dist/a11y.d.ts +109 -5
  2. package/dist/analytics.d.ts +40 -0
  3. package/dist/animation.d.ts +90 -0
  4. package/dist/app.d.ts +51 -0
  5. package/dist/ast.d.ts +286 -0
  6. package/dist/async-components.d.ts +101 -0
  7. package/dist/auth.d.ts +1 -3
  8. package/dist/browser-composables.d.ts +314 -0
  9. package/dist/build-optimizer.d.ts +126 -0
  10. package/dist/build-views.d.ts +37 -0
  11. package/dist/bundle-analyzer/collector.d.ts +66 -0
  12. package/dist/bundle-analyzer/index.d.ts +60 -0
  13. package/dist/bundle-analyzer/report.d.ts +39 -0
  14. package/dist/bundle-analyzer/treemap.d.ts +19 -0
  15. package/dist/bundle-analyzer.js +499 -0
  16. package/dist/caching.d.ts +7 -0
  17. package/dist/cli.js +10880 -1199
  18. package/dist/client/directive.d.ts +10 -0
  19. package/dist/client/index.d.ts +7 -0
  20. package/dist/client/router.d.ts +36 -0
  21. package/dist/client/stx-router.browser.d.ts +0 -0
  22. package/dist/client-script.d.ts +22 -0
  23. package/dist/component-hmr.d.ts +120 -0
  24. package/dist/components.d.ts +23 -1
  25. package/dist/composables/index.d.ts +277 -0
  26. package/dist/composables/use-battery.d.ts +46 -0
  27. package/dist/composables/use-broadcast-channel.d.ts +58 -0
  28. package/dist/composables/use-clipboard.d.ts +34 -0
  29. package/dist/composables/use-cookie.d.ts +70 -0
  30. package/dist/composables/use-device-orientation.d.ts +109 -0
  31. package/dist/composables/use-event-source.d.ts +77 -0
  32. package/dist/composables/use-eye-dropper.d.ts +107 -0
  33. package/dist/composables/use-fetch.d.ts +84 -0
  34. package/dist/composables/use-fullscreen.d.ts +47 -0
  35. package/dist/composables/use-geolocation.d.ts +62 -0
  36. package/dist/composables/use-idle.d.ts +84 -0
  37. package/dist/composables/use-intersection-observer.d.ts +81 -0
  38. package/dist/composables/use-keyboard.d.ts +100 -0
  39. package/dist/composables/use-media-query.d.ts +56 -0
  40. package/dist/composables/use-mouse.d.ts +64 -0
  41. package/dist/composables/use-mutation-observer.d.ts +101 -0
  42. package/dist/composables/use-network.d.ts +40 -0
  43. package/dist/composables/use-notification.d.ts +89 -0
  44. package/dist/composables/use-permissions.d.ts +109 -0
  45. package/dist/composables/use-resize-observer.d.ts +60 -0
  46. package/dist/composables/use-share.d.ts +70 -0
  47. package/dist/composables/use-speech.d.ts +117 -0
  48. package/dist/composables/use-storage.d.ts +64 -0
  49. package/dist/composables/use-text-selection.d.ts +97 -0
  50. package/dist/composables/use-wake-lock.d.ts +85 -0
  51. package/dist/composables/use-websocket.d.ts +69 -0
  52. package/dist/composables/use-window.d.ts +84 -0
  53. package/dist/composables.d.ts +268 -0
  54. package/dist/composition-api.d.ts +190 -0
  55. package/dist/computed.d.ts +137 -0
  56. package/dist/conditionals.d.ts +14 -2
  57. package/dist/config.d.ts +35 -2
  58. package/dist/craft-bridge.d.ts +319 -0
  59. package/dist/craft-compiler.d.ts +229 -0
  60. package/dist/craft-components.d.ts +411 -0
  61. package/dist/craft-entry.d.ts +5 -0
  62. package/dist/craft-ssr.d.ts +134 -0
  63. package/dist/craft.js +1553 -0
  64. package/dist/csp.d.ts +229 -0
  65. package/dist/database.d.ts +407 -0
  66. package/dist/database.js +5 -0
  67. package/dist/defer.d.ts +4 -0
  68. package/dist/deploy/config-generators.d.ts +75 -0
  69. package/dist/deploy/index.d.ts +84 -0
  70. package/dist/deploy/netlify.d.ts +109 -0
  71. package/dist/dev-server/crosswind.d.ts +54 -0
  72. package/dist/dev-server/index.d.ts +7 -0
  73. package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
  74. package/dist/dev-server/native-window.d.ts +40 -0
  75. package/dist/dev-server/port-utils.d.ts +27 -0
  76. package/dist/dev-server/terminal-colors.d.ts +60 -0
  77. package/dist/dev-server/theme-selector.d.ts +32 -0
  78. package/dist/dev-server/types.d.ts +92 -0
  79. package/dist/dev-server.d.ts +21 -0
  80. package/dist/devtools.d.ts +142 -0
  81. package/dist/directive-api.d.ts +111 -0
  82. package/dist/dynamic-components.d.ts +14 -0
  83. package/dist/edge-runtime.d.ts +200 -0
  84. package/dist/env.d.ts +9 -0
  85. package/dist/error-boundaries.d.ts +71 -0
  86. package/dist/error-handling.d.ts +1 -101
  87. package/dist/errors/codes.d.ts +99 -0
  88. package/dist/errors/formatter.d.ts +64 -0
  89. package/dist/errors/index.d.ts +56 -0
  90. package/dist/errors/logger.d.ts +74 -0
  91. package/dist/errors/sanitizer.d.ts +43 -0
  92. package/dist/errors/types.d.ts +79 -0
  93. package/dist/events.d.ts +106 -0
  94. package/dist/expressions.d.ts +86 -11
  95. package/dist/forms-validation.d.ts +173 -0
  96. package/dist/forms.d.ts +157 -8
  97. package/dist/head.d.ts +225 -0
  98. package/dist/heatmap.d.ts +125 -0
  99. package/dist/hot-reload.d.ts +87 -0
  100. package/dist/hydration-runtime.d.ts +47 -0
  101. package/dist/hydration.d.ts +161 -0
  102. package/dist/i18n.d.ts +239 -3
  103. package/dist/image-optimization/build-plugin.d.ts +53 -0
  104. package/dist/image-optimization/component.d.ts +46 -0
  105. package/dist/image-optimization/directive.d.ts +30 -0
  106. package/dist/image-optimization/index.d.ts +86 -0
  107. package/dist/image-optimization/processor.d.ts +112 -0
  108. package/dist/includes.d.ts +94 -9
  109. package/dist/index.d.ts +63 -3
  110. package/dist/index.js +11603 -1318
  111. package/dist/init.d.ts +32 -2
  112. package/dist/interactive.d.ts +14 -0
  113. package/dist/internal-markdown.d.ts +22 -0
  114. package/dist/jsx-runtime.d.ts +110 -0
  115. package/dist/keep-alive.d.ts +87 -0
  116. package/dist/lazy-loader.d.ts +122 -0
  117. package/dist/loading-indicator.d.ts +40 -0
  118. package/dist/loops.d.ts +22 -1
  119. package/dist/media/client/blur-up.d.ts +65 -0
  120. package/dist/media/client/index.d.ts +77 -0
  121. package/dist/media/client/lazy-load.d.ts +73 -0
  122. package/dist/media/client/upload-handler.d.ts +79 -0
  123. package/dist/media/image/component.d.ts +46 -0
  124. package/dist/media/image/directive.d.ts +9 -0
  125. package/dist/media/image/editing.d.ts +212 -0
  126. package/dist/media/image/index.d.ts +118 -0
  127. package/dist/media/image/placeholder.d.ts +78 -0
  128. package/dist/media/image/processor/cache.d.ts +32 -0
  129. package/dist/media/image/processor/index.d.ts +12 -0
  130. package/dist/media/image/processor/optimizer.d.ts +13 -0
  131. package/dist/media/image/processor/responsive.d.ts +17 -0
  132. package/dist/media/image/srcset.d.ts +158 -0
  133. package/dist/media/index.d.ts +295 -0
  134. package/dist/media/manager/embed.d.ts +25 -0
  135. package/dist/media/protected/component.d.ts +34 -0
  136. package/dist/media/protected/index.d.ts +34 -0
  137. package/dist/media/protected/signature.d.ts +72 -0
  138. package/dist/media/shared/cache.d.ts +54 -0
  139. package/dist/media/shared/hash.d.ts +24 -0
  140. package/dist/media/shared/index.d.ts +2 -0
  141. package/dist/media/types.d.ts +1051 -0
  142. package/dist/media/upload/component.d.ts +23 -0
  143. package/dist/media/upload/index.d.ts +1 -0
  144. package/dist/media/video/directive.d.ts +9 -0
  145. package/dist/media/video/index.d.ts +47 -0
  146. package/dist/media/video/processor/cache.d.ts +33 -0
  147. package/dist/media/video/processor/index.d.ts +21 -0
  148. package/dist/media/video/processor/streaming.d.ts +19 -0
  149. package/dist/media/video/processor/thumbnail.d.ts +28 -0
  150. package/dist/media/video/processor/transcoder.d.ts +9 -0
  151. package/dist/middleware.d.ts +42 -3
  152. package/dist/native-build.d.ts +74 -0
  153. package/dist/parser/directive-parser.d.ts +79 -0
  154. package/dist/parser/expression-parser.d.ts +59 -0
  155. package/dist/parser/index.d.ts +35 -0
  156. package/dist/parser/tokenizer.d.ts +81 -0
  157. package/dist/partial-hydration.d.ts +88 -0
  158. package/dist/performance-utils.d.ts +146 -3
  159. package/dist/plugin-system.d.ts +128 -0
  160. package/dist/precompiler.d.ts +108 -0
  161. package/dist/production-build.d.ts +199 -0
  162. package/dist/props.d.ts +199 -0
  163. package/dist/pwa/audit.d.ts +42 -0
  164. package/dist/pwa/directives.d.ts +29 -0
  165. package/dist/pwa/icons.d.ts +39 -0
  166. package/dist/pwa/index.d.ts +59 -0
  167. package/dist/pwa/inject.d.ts +22 -0
  168. package/dist/pwa/manifest.d.ts +104 -0
  169. package/dist/pwa/offline.d.ts +8 -0
  170. package/dist/pwa/precache.d.ts +29 -0
  171. package/dist/pwa/service-worker.d.ts +21 -0
  172. package/dist/pwa/workbox-strategies.d.ts +100 -0
  173. package/dist/pwa/workbox.d.ts +52 -0
  174. package/dist/pwa.d.ts +51 -0
  175. package/dist/pwa.js +8124 -0
  176. package/dist/reactive-bindings.d.ts +24 -0
  177. package/dist/reactive.d.ts +100 -0
  178. package/dist/reactivity.d.ts +253 -0
  179. package/dist/route-middleware.d.ts +232 -0
  180. package/dist/router.d.ts +31 -0
  181. package/dist/routes.d.ts +0 -7
  182. package/dist/runtime.d.ts +140 -0
  183. package/dist/safe-evaluator.d.ts +117 -3
  184. package/dist/scaffolding.d.ts +113 -0
  185. package/dist/seo.d.ts +120 -7
  186. package/dist/server-components.d.ts +134 -0
  187. package/dist/signals.d.ts +501 -0
  188. package/dist/slots.d.ts +63 -0
  189. package/dist/source-maps.d.ts +117 -0
  190. package/dist/ssg.d.ts +157 -0
  191. package/dist/ssg.js +6831 -0
  192. package/dist/ssr.d.ts +107 -0
  193. package/dist/state-management.d.ts +324 -0
  194. package/dist/stores-client.d.ts +70 -0
  195. package/dist/story/addons.d.ts +123 -0
  196. package/dist/story/analytics.d.ts +92 -0
  197. package/dist/story/auto-stories.d.ts +38 -0
  198. package/dist/story/bookmarks.d.ts +53 -0
  199. package/dist/story/bun-test.d.ts +44 -0
  200. package/dist/story/cli.d.ts +34 -0
  201. package/dist/story/collect/analyzer.d.ts +33 -0
  202. package/dist/story/collect/index.d.ts +27 -0
  203. package/dist/story/collect/parser.d.ts +17 -0
  204. package/dist/story/collect/scanner.d.ts +13 -0
  205. package/dist/story/collect/tree.d.ts +17 -0
  206. package/dist/story/commands/build.d.ts +14 -0
  207. package/dist/story/commands/dev.d.ts +16 -0
  208. package/dist/story/commands/index.d.ts +6 -0
  209. package/dist/story/commands/preview.d.ts +15 -0
  210. package/dist/story/compiled-output.d.ts +26 -0
  211. package/dist/story/composition.d.ts +47 -0
  212. package/dist/story/config-watcher.d.ts +26 -0
  213. package/dist/story/config.d.ts +26 -0
  214. package/dist/story/context.d.ts +21 -0
  215. package/dist/story/controls/index.d.ts +54 -0
  216. package/dist/story/crosswind.d.ts +29 -0
  217. package/dist/story/desktop-preview.d.ts +34 -0
  218. package/dist/story/docs-generator.d.ts +30 -0
  219. package/dist/story/errors.d.ts +47 -0
  220. package/dist/story/figma-export.d.ts +169 -0
  221. package/dist/story/generator.d.ts +21 -0
  222. package/dist/story/hmr.d.ts +64 -0
  223. package/dist/story/hot-swap.d.ts +35 -0
  224. package/dist/story/index.d.ts +51 -0
  225. package/dist/story/interactions.d.ts +52 -0
  226. package/dist/story/keyboard-shortcuts.d.ts +34 -0
  227. package/dist/story/output.d.ts +85 -0
  228. package/dist/story/performance.d.ts +76 -0
  229. package/dist/story/presets.d.ts +62 -0
  230. package/dist/story/props-validation.d.ts +45 -0
  231. package/dist/story/renderer.d.ts +53 -0
  232. package/dist/story/search-index.d.ts +47 -0
  233. package/dist/story/search.d.ts +45 -0
  234. package/dist/story/server.d.ts +21 -0
  235. package/dist/story/setup.d.ts +47 -0
  236. package/dist/story/snapshots.d.ts +65 -0
  237. package/dist/story/testing.d.ts +58 -0
  238. package/dist/story/theme.d.ts +68 -0
  239. package/dist/story/types.d.ts +249 -0
  240. package/dist/story/ui/code-panel.d.ts +42 -0
  241. package/dist/story/ui/controls-panel.d.ts +25 -0
  242. package/dist/story/ui/index.d.ts +4 -0
  243. package/dist/story/ui/navigation.d.ts +55 -0
  244. package/dist/story/ui/preview.d.ts +46 -0
  245. package/dist/story/visual-testing.d.ts +45 -0
  246. package/dist/streaming.d.ts +82 -2
  247. package/dist/suspense.d.ts +83 -0
  248. package/dist/teleport.d.ts +9 -0
  249. package/dist/testing.d.ts +289 -0
  250. package/dist/transitions.d.ts +87 -0
  251. package/dist/type-checker.d.ts +109 -0
  252. package/dist/types/component-types.d.ts +129 -0
  253. package/dist/types/config-types.d.ts +336 -0
  254. package/dist/types/context-types.d.ts +99 -0
  255. package/dist/types/csp-types.d.ts +79 -0
  256. package/dist/types/directive-types.d.ts +259 -0
  257. package/dist/types/index.d.ts +98 -0
  258. package/dist/types/pwa-types.d.ts +218 -0
  259. package/dist/types.d.ts +1 -315
  260. package/dist/typescript-templates.d.ts +178 -0
  261. package/dist/utils.d.ts +52 -6
  262. package/dist/validator.d.ts +77 -0
  263. package/dist/variable-extractor.d.ts +39 -0
  264. package/dist/view-composers.d.ts +154 -9
  265. package/dist/virtual-scrolling.d.ts +103 -0
  266. package/dist/visual-editor.d.ts +209 -0
  267. package/dist/visual-testing.d.ts +109 -0
  268. package/dist/visual-testing.js +126 -0
  269. package/dist/vue-template.d.ts +16 -0
  270. package/dist/web-components/css-scoping.d.ts +54 -0
  271. package/dist/web-components/index.d.ts +20 -0
  272. package/dist/web-components/reactive-generator.d.ts +72 -0
  273. package/dist/web-components.d.ts +222 -2
  274. package/dist/x-element.d.ts +35 -0
  275. package/package.json +41 -11
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Generate analytics dashboard HTML
3
+ */
4
+ export declare function getAnalyticsDashboardHtml(mostViewed: Array<{ componentId: string, viewCount: number }>, mostChangedProps: Array<{ propName: string, changeCount: number }>): string;
5
+ /**
6
+ * Generate analytics styles
7
+ */
8
+ export declare function getAnalyticsStyles(): string;
9
+ /**
10
+ * Analytics event
11
+ */
12
+ export declare interface AnalyticsEvent {
13
+ type: AnalyticsEventType
14
+ timestamp: number
15
+ componentId?: string
16
+ variantId?: string
17
+ propName?: string
18
+ query?: string
19
+ metadata?: Record<string, any>
20
+ }
21
+ /**
22
+ * Component analytics summary
23
+ */
24
+ export declare interface ComponentAnalytics {
25
+ componentId: string
26
+ componentName: string
27
+ viewCount: number
28
+ uniqueViews: number
29
+ lastViewed?: number
30
+ propChanges: Record<string, number>
31
+ topChangedProps: string[]
32
+ variantViews: Record<string, number>
33
+ avgTimeSpent: number
34
+ }
35
+ /**
36
+ * Analytics storage
37
+ */
38
+ export declare interface AnalyticsStorage {
39
+ version: number
40
+ events: AnalyticsEvent[]
41
+ sessions: AnalyticsSession[]
42
+ }
43
+ /**
44
+ * Analytics session
45
+ */
46
+ export declare interface AnalyticsSession {
47
+ id: string
48
+ startTime: number
49
+ endTime?: number
50
+ componentViews: string[]
51
+ }
52
+ /**
53
+ * Analytics event types
54
+ */
55
+ export type AnalyticsEventType = | 'view'
56
+ | 'prop_change'
57
+ | 'variant_switch'
58
+ | 'search'
59
+ | 'bookmark'
60
+ | 'copy_code'
61
+ | 'test_run'
62
+ /**
63
+ * Analytics tracker
64
+ */
65
+ export declare class AnalyticsTracker {
66
+ private storage: AnalyticsStorage;
67
+ private storagePath: string;
68
+ private currentSession: AnalyticsSession | null;
69
+ private dirty: any;
70
+ private viewStartTimes: any;
71
+ constructor(rootDir: string);
72
+ private loadStorage(): AnalyticsStorage;
73
+ save(): Promise<void>;
74
+ startSession(): void;
75
+ endSession(): void;
76
+ track(event: Omit<AnalyticsEvent, 'timestamp'>): void;
77
+ trackView(componentId: string, variantId?: string): void;
78
+ private endViewTiming(componentId: string): void;
79
+ trackPropChange(componentId: string, propName: string, value: any): void;
80
+ trackVariantSwitch(componentId: string, variantId: string): void;
81
+ trackSearch(query: string, resultCount: number): void;
82
+ getComponentAnalytics(componentId: string, componentName: string): ComponentAnalytics;
83
+ getMostViewedComponents(limit?: any): Array<{ componentId: string, viewCount: number }>;
84
+ getMostChangedProps(limit?: any): Array<{ propName: string, changeCount: number }>;
85
+ getSearchAnalytics(): {
86
+ totalSearches: number
87
+ topQueries: Array<{ query: string, count: number }>
88
+ avgResultCount: number
89
+ };
90
+ clear(): void;
91
+ exportAnalytics(): string;
92
+ }
@@ -0,0 +1,38 @@
1
+ import type { AnalyzedComponent } from './types';
2
+ /**
3
+ * Auto-generate stories for components
4
+ */
5
+ export declare function autoGenerateStories(options: AutoGenerateOptions): Promise<GeneratedStory[]>;
6
+ /**
7
+ * Generate story content for a component
8
+ */
9
+ export declare function generateStoryContent(analysis: AnalyzedComponent, options?: { generateVariants?: boolean, includeDefaults?: boolean }): string;
10
+ /**
11
+ * Generate story for a single component
12
+ */
13
+ export declare function generateStoryForComponent(componentPath: string, options?: { generateVariants?: boolean, includeDefaults?: boolean }): Promise<string>;
14
+ /**
15
+ * CLI command for auto-generating stories
16
+ */
17
+ export declare function autoGenerateCommand(args: string[]): Promise<void>;
18
+ /**
19
+ * Auto-generation options
20
+ */
21
+ export declare interface AutoGenerateOptions {
22
+ componentsDir: string
23
+ outputDir?: string
24
+ include?: string[]
25
+ exclude?: string[]
26
+ generateVariants?: boolean
27
+ includeDefaults?: boolean
28
+ overwrite?: boolean
29
+ }
30
+ /**
31
+ * Generated story result
32
+ */
33
+ export declare interface GeneratedStory {
34
+ componentPath: string
35
+ storyPath: string
36
+ content: string
37
+ status: 'created' | 'skipped' | 'updated'
38
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Generate bookmarks panel HTML
3
+ */
4
+ export declare function getBookmarksPanelHtml(bookmarks: Bookmark[]): string;
5
+ /**
6
+ * Generate bookmarks panel styles
7
+ */
8
+ export declare function getBookmarksPanelStyles(): string;
9
+ /**
10
+ * Generate bookmarks client script
11
+ */
12
+ export declare function getBookmarksScript(): string;
13
+ /**
14
+ * Bookmark entry
15
+ */
16
+ export declare interface Bookmark {
17
+ id: string
18
+ name: string
19
+ storyId: string
20
+ variantId: string
21
+ props: Record<string, any>
22
+ created: number
23
+ notes?: string
24
+ color?: string
25
+ }
26
+ /**
27
+ * Bookmarks storage
28
+ */
29
+ export declare interface BookmarksStorage {
30
+ version: number
31
+ bookmarks: Bookmark[]
32
+ }
33
+ /**
34
+ * Bookmarks manager
35
+ */
36
+ export declare class BookmarksManager {
37
+ private storage: BookmarksStorage;
38
+ private storagePath: string;
39
+ private dirty: any;
40
+ constructor(rootDir: string);
41
+ private loadStorage(): BookmarksStorage;
42
+ save(): Promise<void>;
43
+ addBookmark(storyId: string, variantId: string, props: Record<string, any>, options?: { name?: string, notes?: string, color?: string }): Bookmark;
44
+ getAllBookmarks(): Bookmark[];
45
+ getBookmarksForStory(storyId: string): Bookmark[];
46
+ getBookmark(id: string): Bookmark | undefined;
47
+ isBookmarked(storyId: string, variantId: string): boolean;
48
+ updateBookmark(id: string, updates: Partial<Omit<Bookmark, 'id' | 'created'>>): Bookmark | undefined;
49
+ deleteBookmark(id: string): boolean;
50
+ toggleBookmark(storyId: string, variantId: string, props: Record<string, any>): { added: boolean, bookmark?: Bookmark };
51
+ exportBookmarks(): string;
52
+ importBookmarks(json: string, merge?: any): number;
53
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Create a Bun test suite for stories
3
+ * Usage in test file:
4
+ *
5
+ * ```typescript
6
+ * import { createStoryTestSuite } from '@stacksjs/stx/story'
7
+ *
8
+ * createStoryTestSuite({
9
+ * filter: ['Button', 'Card'],
10
+ * threshold: 0.01,
11
+ * })
12
+ * ```
13
+ */
14
+ export declare function createStoryTestSuite(options?: BunTestOptions): Promise<void>;
15
+ /**
16
+ * Create individual test cases for each story
17
+ */
18
+ export declare function createStoryTests(options?: BunTestOptions): Promise<void>;
19
+ /**
20
+ * Run story tests programmatically
21
+ */
22
+ export declare function runStoryTests(options?: BunTestOptions): Promise<{
23
+ passed: number
24
+ failed: number
25
+ total: number
26
+ duration: number
27
+ }>;
28
+ /**
29
+ * Generate test file content for stories
30
+ */
31
+ export declare function generateTestFile(storyNames: string[]): string;
32
+ /**
33
+ * Watch mode for story tests
34
+ */
35
+ export declare function watchStoryTests(options?: BunTestOptions): Promise<void>;
36
+ /**
37
+ * Test options for Bun integration
38
+ */
39
+ export declare interface BunTestOptions {
40
+ filter?: string[]
41
+ update?: boolean
42
+ threshold?: number
43
+ timeout?: number
44
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Register story commands with a CLI instance
3
+ * This is a helper for manual CLI integration
4
+ */
5
+ export declare function registerStoryCommands(cli: any): void;
6
+ /**
7
+ * Run story CLI directly (for standalone usage)
8
+ */
9
+ export declare function runStoryCLI(args?: string[]): Promise<void>;
10
+ /**
11
+ * CLI command definitions for integration with @stacksjs/clapp
12
+ */
13
+ export declare const storyCommands: {
14
+ /**
15
+ * Main story command (defaults to dev)
16
+ */
17
+ 'story': { description: 'Component showcase and testing'; options: { port: { alias: 'p'; type: 'number'; description: 'Server port (default: 6006)' }; open: { alias: 'o'; type: 'boolean'; description: 'Open browser automatically' }; host: { type: 'string'; description: 'Host to bind to' } }; action: (options: { port?: number, open?: boolean, host?: string }) => any };
18
+ /**
19
+ * Story dev subcommand
20
+ */
21
+ 'story:dev': { description: 'Start story development server'; options: { port: { alias: 'p'; type: 'number'; description: 'Server port (default: 6006)' }; open: { alias: 'o'; type: 'boolean'; description: 'Open browser automatically' }; host: { type: 'string'; description: 'Host to bind to' } }; action: (options: { port?: number, open?: boolean, host?: string }) => any };
22
+ /**
23
+ * Story build subcommand
24
+ */
25
+ 'story:build': { description: 'Build static story site'; options: { outDir: { alias: 'o'; type: 'string'; description: 'Output directory' } }; action: (options: { outDir?: string }) => any };
26
+ /**
27
+ * Story preview subcommand
28
+ */
29
+ 'story:preview': { description: 'Preview built story site'; options: { port: { alias: 'p'; type: 'number'; description: 'Server port (default: 4173)' }; open: { alias: 'o'; type: 'boolean'; description: 'Open browser automatically' } }; action: (options: { port?: number, open?: boolean }) => any };
30
+ /**
31
+ * Story test subcommand
32
+ */
33
+ 'story:test': { description: 'Run visual regression tests'; options: { update: { alias: 'u'; type: 'boolean'; description: 'Update snapshots' }; filter: { alias: 'f'; type: 'string'; description: 'Filter components by name' } }; action: (options: { update?: boolean, filter?: string }) => any }
34
+ };
@@ -0,0 +1,33 @@
1
+ import type { AnalyzedComponent, AnalyzedSlot, DirectiveUsage, StoryAnalyzedProp } from '../types';
2
+ /**
3
+ * Analyze a component file and extract metadata
4
+ */
5
+ export declare function analyzeComponentFile(filePath: string): Promise<AnalyzedComponent>;
6
+ /**
7
+ * Analyze component content and extract metadata
8
+ */
9
+ export declare function analyzeComponent(content: string, name: string, filePath: string): AnalyzedComponent;
10
+ /**
11
+ * Extract props from script tags using proper tokenization
12
+ */
13
+ export declare function extractProps(content: string): StoryAnalyzedProp[];
14
+ /**
15
+ * Extract slots from template
16
+ */
17
+ export declare function extractSlots(content: string): AnalyzedSlot[];
18
+ /**
19
+ * Extract component description from comments
20
+ */
21
+ export declare function extractDescription(content: string): string | undefined;
22
+ /**
23
+ * Extract component dependencies (other components used)
24
+ */
25
+ export declare function extractDependencies(content: string): string[];
26
+ /**
27
+ * Extract CSS classes from template (for Crosswind integration)
28
+ */
29
+ export declare function extractCssClasses(content: string): string[];
30
+ /**
31
+ * Extract directive usage from template
32
+ */
33
+ export declare function extractDirectives(content: string): DirectiveUsage[];
@@ -0,0 +1,27 @@
1
+ export {
2
+ analyzeComponent,
3
+ analyzeComponentFile,
4
+ extractCssClasses,
5
+ extractDependencies,
6
+ extractDescription,
7
+ extractDirectives,
8
+ extractProps,
9
+ extractSlots,
10
+ } from './analyzer';
11
+ export {
12
+ extractScriptContent,
13
+ extractTemplateContent,
14
+ parseStoryContent,
15
+ parseStoryFile,
16
+ } from './parser';
17
+ export {
18
+ isNonComponentFile,
19
+ scanStoryFiles,
20
+ watchStoryFiles,
21
+ } from './scanner';
22
+ export {
23
+ buildTree,
24
+ createTreePath,
25
+ findStoryInTree,
26
+ flattenTree,
27
+ } from './tree';
@@ -0,0 +1,17 @@
1
+ import type { ServerStory } from '../types';
2
+ /**
3
+ * Parse a story file and extract story definitions
4
+ */
5
+ export declare function parseStoryFile(filePath: string): Promise<ServerStory | null>;
6
+ /**
7
+ * Parse story content and extract story definitions
8
+ */
9
+ export declare function parseStoryContent(content: string, filePath: string): ServerStory | null;
10
+ /**
11
+ * Extract script content from a story file
12
+ */
13
+ export declare function extractScriptContent(content: string): string;
14
+ /**
15
+ * Extract template content from a story file (everything outside script tags)
16
+ */
17
+ export declare function extractTemplateContent(content: string): string;
@@ -0,0 +1,13 @@
1
+ import type { ServerStoryFile, StoryContext } from '../types';
2
+ /**
3
+ * Scan for story files matching the configured patterns
4
+ */
5
+ export declare function scanStoryFiles(ctx: StoryContext): Promise<ServerStoryFile[]>;
6
+ /**
7
+ * Check if a file is a non-component file (layout, page, partial)
8
+ */
9
+ export declare function isNonComponentFile(relativePath: string): boolean;
10
+ /**
11
+ * Watch for story file changes
12
+ */
13
+ export declare function watchStoryFiles(ctx: StoryContext, onChange: (event: 'add' | 'change' | 'unlink', file: ServerStoryFile) => void): () => void;
@@ -0,0 +1,17 @@
1
+ import type { ResolvedStoryConfig, ServerStoryFile, ServerTree, ServerTreeLeaf, } from '../types';
2
+ /**
3
+ * Create tree path from a story file
4
+ */
5
+ export declare function createTreePath(config: ResolvedStoryConfig, file: ServerStoryFile): string[];
6
+ /**
7
+ * Build the navigation tree from story files
8
+ */
9
+ export declare function buildTree(config: ResolvedStoryConfig, files: ServerStoryFile[]): ServerTree;
10
+ /**
11
+ * Flatten tree to get all leaf indices in order
12
+ */
13
+ export declare function flattenTree(tree: ServerTree): number[];
14
+ /**
15
+ * Find a story in the tree by index
16
+ */
17
+ export declare function findStoryInTree(tree: ServerTree, index: number): { path: string[], node: ServerTreeLeaf } | null;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Build static story site
3
+ */
4
+ export declare function buildCommand(options?: BuildOptions): Promise<void>;
5
+ /**
6
+ * Run build command (alias)
7
+ */
8
+ export declare const build: typeof buildCommand;
9
+ /**
10
+ * Options for the build command
11
+ */
12
+ export declare interface BuildOptions {
13
+ outDir?: string
14
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Start the story development server
3
+ */
4
+ export declare function devCommand(options?: DevOptions): Promise<void>;
5
+ /**
6
+ * Run dev command (alias for devCommand)
7
+ */
8
+ export declare const dev: typeof devCommand;
9
+ /**
10
+ * Options for the dev command
11
+ */
12
+ export declare interface DevOptions {
13
+ port?: number
14
+ open?: boolean
15
+ host?: string | boolean
16
+ }
@@ -0,0 +1,6 @@
1
+ export type { BuildOptions } from './build';
2
+ export type { DevOptions } from './dev';
3
+ export type { PreviewOptions } from './preview';
4
+ export { build, buildCommand } from './build';
5
+ export { dev, devCommand } from './dev';
6
+ export { preview, previewCommand } from './preview';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Preview the built story site
3
+ */
4
+ export declare function previewCommand(options?: PreviewOptions): Promise<void>;
5
+ /**
6
+ * Run preview command (alias)
7
+ */
8
+ export declare const preview: typeof previewCommand;
9
+ /**
10
+ * Options for the preview command
11
+ */
12
+ export declare interface PreviewOptions {
13
+ port?: number
14
+ open?: boolean
15
+ }
@@ -0,0 +1,26 @@
1
+ import type { ServerStoryFile, StoryContext } from './types';
2
+ /**
3
+ * Get compiled HTML output for a story variant
4
+ */
5
+ export declare function getCompiledOutput(ctx: StoryContext, story: ServerStoryFile, variantId: string, options?: CompiledOutputOptions): Promise<string>;
6
+ /**
7
+ * Generate compiled output panel HTML
8
+ */
9
+ export declare function generateCompiledOutputPanel(compiledHtml: string): string;
10
+ /**
11
+ * Get compiled output styles
12
+ */
13
+ export declare function getCompiledOutputStyles(): string;
14
+ /**
15
+ * Get compiled output toggle script
16
+ */
17
+ export declare function getCompiledOutputScript(): string;
18
+ /**
19
+ * Compiled output options
20
+ */
21
+ export declare interface CompiledOutputOptions {
22
+ includeStyles?: boolean
23
+ includeScripts?: boolean
24
+ minify?: boolean
25
+ format?: boolean
26
+ }
@@ -0,0 +1,47 @@
1
+ import type { AnalyzedComponent } from './types';
2
+ /**
3
+ * Build dependency graph from analyzed components
4
+ */
5
+ export declare function buildDependencyGraph(components: AnalyzedComponent[]): DependencyGraph;
6
+ /**
7
+ * Get all dependencies of a component (recursive)
8
+ */
9
+ export declare function getAllDependencies(graph: DependencyGraph, componentName: string): string[];
10
+ /**
11
+ * Get all dependents of a component (recursive)
12
+ */
13
+ export declare function getAllDependents(graph: DependencyGraph, componentName: string): string[];
14
+ /**
15
+ * Detect circular dependencies
16
+ */
17
+ export declare function detectCircularDependencies(graph: DependencyGraph): string[][];
18
+ /**
19
+ * Generate dependency graph visualization HTML
20
+ */
21
+ export declare function generateDependencyGraphHTML(graph: DependencyGraph, selectedComponent?: string): string;
22
+ /**
23
+ * Get dependency graph styles
24
+ */
25
+ export declare function getDependencyGraphStyles(): string;
26
+ /**
27
+ * Generate component detail panel HTML
28
+ */
29
+ export declare function generateComponentDetailHTML(graph: DependencyGraph, componentName: string): string;
30
+ /**
31
+ * Dependency graph node
32
+ */
33
+ export declare interface DependencyNode {
34
+ name: string
35
+ path: string
36
+ dependencies: string[]
37
+ dependents: string[]
38
+ depth: number
39
+ }
40
+ /**
41
+ * Dependency graph
42
+ */
43
+ export declare interface DependencyGraph {
44
+ nodes: Map<string, DependencyNode>
45
+ roots: string[]
46
+ leaves: string[]
47
+ }
@@ -0,0 +1,26 @@
1
+ import type { StoryContext } from './types';
2
+ /**
3
+ * Watch the config file for changes
4
+ */
5
+ export declare function watchConfigFile(ctx: StoryContext, options: ConfigWatcherOptions): ConfigWatcher;
6
+ /**
7
+ * Get the config file path if it exists
8
+ */
9
+ export declare function findConfigFile(root: string): string | null;
10
+ /**
11
+ * Get the last modified time of the config file
12
+ */
13
+ export declare function getConfigModifiedTime(root: string): Promise<number | null>;
14
+ /**
15
+ * Config watcher options
16
+ */
17
+ export declare interface ConfigWatcherOptions {
18
+ onChange: () => void | Promise<void>
19
+ debounceMs?: number
20
+ }
21
+ /**
22
+ * Config watcher instance
23
+ */
24
+ export declare interface ConfigWatcher {
25
+ stop: () => void
26
+ }
@@ -0,0 +1,26 @@
1
+ import type { BackgroundPreset, ResolvedStoryConfig, ResponsivePreset, StoryConfig, StoryTreeConfig, } from './types';
2
+ /**
3
+ * Resolve story configuration with defaults
4
+ */
5
+ export declare function resolveStoryConfig(config?: StoryConfig): ResolvedStoryConfig;
6
+ /**
7
+ * Get the default story configuration
8
+ * Useful for extending defaults in user config
9
+ */
10
+ export declare function getDefaultStoryConfig(): StoryConfig;
11
+ /**
12
+ * Default responsive presets
13
+ */
14
+ export declare const defaultResponsivePresets: ResponsivePreset[];
15
+ /**
16
+ * Default background presets
17
+ */
18
+ export declare const defaultBackgroundPresets: BackgroundPreset[];
19
+ /**
20
+ * Default tree configuration
21
+ */
22
+ export declare const defaultTreeConfig: Required<StoryTreeConfig>;
23
+ /**
24
+ * Default story configuration
25
+ */
26
+ export declare const defaultStoryConfig: StoryConfig;
@@ -0,0 +1,21 @@
1
+ import type { ServerStoryFile, ServerTree, StoryConfig, StoryContext } from './types';
2
+ /**
3
+ * Create a story context
4
+ */
5
+ export declare function createContext(options: CreateContextOptions): Promise<StoryContext>;
6
+ /**
7
+ * Update context with discovered story files
8
+ */
9
+ export declare function updateContextStoryFiles(ctx: StoryContext, storyFiles: ServerStoryFile[]): void;
10
+ /**
11
+ * Update context with built tree
12
+ */
13
+ export declare function updateContextTree(ctx: StoryContext, tree: ServerTree): void;
14
+ /**
15
+ * Options for creating a story context
16
+ */
17
+ export declare interface CreateContextOptions {
18
+ mode: 'dev' | 'build'
19
+ root?: string
20
+ config?: StoryConfig
21
+ }
@@ -0,0 +1,54 @@
1
+ import type { ControlConfig } from '../types';
2
+ /**
3
+ * Render a control component as HTML
4
+ */
5
+ export declare function renderControl(config: ControlConfig, value: any, onChange: string): string;
6
+ /**
7
+ * Text input control
8
+ */
9
+ export declare function renderTextControl(title: string, value: string, onChange: string): string;
10
+ /**
11
+ * Number input control
12
+ */
13
+ export declare function renderNumberControl(title: string, value: number, onChange: string, config: ControlConfig): string;
14
+ /**
15
+ * Checkbox control
16
+ */
17
+ export declare function renderCheckboxControl(title: string, value: boolean, onChange: string): string;
18
+ /**
19
+ * Select dropdown control
20
+ */
21
+ export declare function renderSelectControl(title: string, value: any, onChange: string, config: ControlConfig): string;
22
+ /**
23
+ * Radio button group control
24
+ */
25
+ export declare function renderRadioControl(title: string, value: any, onChange: string, config: ControlConfig): string;
26
+ /**
27
+ * Color picker control
28
+ */
29
+ export declare function renderColorControl(title: string, value: string, onChange: string): string;
30
+ /**
31
+ * Textarea control
32
+ */
33
+ export declare function renderTextareaControl(title: string, value: string, onChange: string): string;
34
+ /**
35
+ * Slider control
36
+ */
37
+ export declare function renderSliderControl(title: string, value: number, onChange: string, config: ControlConfig): string;
38
+ /**
39
+ * JSON editor control
40
+ */
41
+ export declare function renderJsonControl(title: string, value: any, onChange: string): string;
42
+ /**
43
+ * Date input control
44
+ */
45
+ export declare function renderDateControl(title: string, value: string, onChange: string): string;
46
+ /**
47
+ * Get CSS styles for controls
48
+ */
49
+ export declare function getControlStyles(): string;
50
+ /**
51
+ * Button group control
52
+ */
53
+ export declare function renderButtonGroupControl(title: string, value: any, onChange: string, config: ControlConfig): string;
54
+ declare type ControlOption = string | { value: any, label: string }
@@ -0,0 +1,29 @@
1
+ import type { StoryContext } from './types';
2
+ /**
3
+ * Check if Crosswind is available
4
+ */
5
+ export declare function isCrosswindAvailable(root: string): Promise<boolean>;
6
+ /**
7
+ * Load Crosswind CSS
8
+ */
9
+ export declare function loadCrosswindCSS(ctx: StoryContext, options?: CrosswindOptions): Promise<string>;
10
+ /**
11
+ * Generate style tag with Crosswind CSS
12
+ */
13
+ export declare function generateCrosswindStyleTag(ctx: StoryContext, options?: CrosswindOptions): Promise<string>;
14
+ /**
15
+ * Extract used utility classes from HTML
16
+ */
17
+ export declare function extractUsedClasses(html: string): string[];
18
+ /**
19
+ * Generate optimized CSS with only used classes
20
+ */
21
+ export declare function generateOptimizedCSS(fullCSS: string, usedClasses: string[]): string;
22
+ /**
23
+ * Crosswind CSS options
24
+ */
25
+ export declare interface CrosswindOptions {
26
+ cssPath?: string
27
+ includeReset?: boolean
28
+ includeBase?: boolean
29
+ }