@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,249 @@
1
+ /**
2
+ * STX Story - Component showcase and testing
3
+ * Type definitions for the story feature
4
+ */
5
+ /**
6
+ * Tree group configuration for organizing stories
7
+ */
8
+ export declare interface TreeGroupConfig {
9
+ title: string
10
+ id?: string
11
+ include?: (file: StoryTreeFile) => boolean
12
+ }
13
+ /**
14
+ * Responsive viewport preset
15
+ */
16
+ export declare interface ResponsivePreset {
17
+ label: string
18
+ width: number
19
+ height?: number
20
+ }
21
+ /**
22
+ * Background preset for story canvas
23
+ */
24
+ export declare interface BackgroundPreset {
25
+ label: string
26
+ color: string
27
+ contrastColor?: string
28
+ }
29
+ /**
30
+ * Story theme configuration
31
+ */
32
+ export declare interface StoryThemeConfig {
33
+ title?: string
34
+ logo?: {
35
+ /** Square logo (for favicon/small displays) */
36
+ square?: string
37
+ /** Light theme logo */
38
+ light?: string
39
+ /** Dark theme logo */
40
+ dark?: string
41
+ }
42
+ favicon?: string
43
+ colors?: {
44
+ /** Primary accent color shades */
45
+ primary?: Record<string, string>
46
+ /** Gray color shades */
47
+ gray?: Record<string, string>
48
+ }
49
+ defaultColorScheme?: 'light' | 'dark' | 'auto'
50
+ hideColorSchemeSwitch?: boolean
51
+ darkClass?: string
52
+ }
53
+ /**
54
+ * Story tree configuration
55
+ */
56
+ export declare interface StoryTreeConfig {
57
+ file?: 'title' | 'path' | ((file: StoryTreeFile) => string[])
58
+ order?: 'asc' | ((a: string, b: string) => number)
59
+ groups?: TreeGroupConfig[]
60
+ }
61
+ /**
62
+ * Story configuration (part of StxConfig)
63
+ */
64
+ export declare interface StoryConfig {
65
+ enabled?: boolean
66
+ outDir?: string
67
+ storyMatch?: string[]
68
+ storyIgnored?: string[]
69
+ tree?: StoryTreeConfig
70
+ theme?: StoryThemeConfig
71
+ responsivePresets?: ResponsivePreset[]
72
+ backgroundPresets?: BackgroundPreset[]
73
+ autoApplyContrastColor?: boolean
74
+ setupFile?: string
75
+ port?: number
76
+ autoPropsDisabled?: boolean
77
+ }
78
+ /**
79
+ * File information for tree configuration
80
+ */
81
+ export declare interface StoryTreeFile {
82
+ title: string
83
+ path: string
84
+ }
85
+ /**
86
+ * Server-side story file representation
87
+ */
88
+ export declare interface ServerStoryFile {
89
+ id: string
90
+ path: string
91
+ relativePath: string
92
+ fileName: string
93
+ treePath?: string[]
94
+ treeFile?: StoryTreeFile
95
+ story?: ServerStory
96
+ }
97
+ /**
98
+ * Server-side story representation
99
+ */
100
+ export declare interface ServerStory {
101
+ id: string
102
+ title: string
103
+ group?: string
104
+ variants: ServerVariant[]
105
+ layout?: StoryLayout
106
+ icon?: string
107
+ iconColor?: string
108
+ docsOnly?: boolean
109
+ autoPropsDisabled?: boolean
110
+ }
111
+ /**
112
+ * Server-side variant representation
113
+ */
114
+ export declare interface ServerVariant {
115
+ id: string
116
+ title: string
117
+ icon?: string
118
+ iconColor?: string
119
+ state?: Record<string, any>
120
+ source?: string
121
+ responsiveDisabled?: boolean
122
+ }
123
+ /**
124
+ * Tree leaf node (story)
125
+ */
126
+ export declare interface ServerTreeLeaf {
127
+ title: string
128
+ index: number
129
+ }
130
+ /**
131
+ * Tree folder node
132
+ */
133
+ export declare interface ServerTreeFolder {
134
+ title: string
135
+ children: ServerTreeNode[]
136
+ }
137
+ /**
138
+ * Tree group node
139
+ */
140
+ export declare interface ServerTreeGroup {
141
+ group: true
142
+ id: string
143
+ title: string
144
+ children: ServerTreeNode[]
145
+ }
146
+ /**
147
+ * Analyzed component prop for story
148
+ */
149
+ export declare interface StoryAnalyzedProp {
150
+ name: string
151
+ type: string
152
+ required: boolean
153
+ default?: any
154
+ description?: string
155
+ options?: any[]
156
+ }
157
+ /**
158
+ * Analyzed component slot
159
+ */
160
+ export declare interface AnalyzedSlot {
161
+ name: string
162
+ description?: string
163
+ }
164
+ /**
165
+ * Directive usage in a component
166
+ */
167
+ export declare interface DirectiveUsage {
168
+ name: string
169
+ count: number
170
+ }
171
+ /**
172
+ * Analyzed component metadata
173
+ */
174
+ export declare interface AnalyzedComponent {
175
+ name: string
176
+ path: string
177
+ description?: string
178
+ props: StoryAnalyzedProp[]
179
+ slots: AnalyzedSlot[]
180
+ dependencies: string[]
181
+ cssClasses: string[]
182
+ directives?: DirectiveUsage[]
183
+ category?: string
184
+ tags?: string[]
185
+ }
186
+ /**
187
+ * Control configuration
188
+ */
189
+ export declare interface ControlConfig {
190
+ type: ControlType
191
+ title?: string
192
+ options?: { value: any, label: string }[] | string[] | Record<string, string>
193
+ min?: number
194
+ max?: number
195
+ step?: number
196
+ }
197
+ /**
198
+ * Story context for server operations
199
+ */
200
+ export declare interface StoryContext {
201
+ root: string
202
+ config: ResolvedStoryConfig
203
+ storyFiles: ServerStoryFile[]
204
+ tree?: ServerTree
205
+ mode: 'dev' | 'build'
206
+ }
207
+ /**
208
+ * Resolved story configuration with all defaults applied
209
+ */
210
+ export declare interface ResolvedStoryConfig {
211
+ enabled: boolean
212
+ outDir: string
213
+ storyMatch: string[]
214
+ storyIgnored: string[]
215
+ tree: Required<StoryTreeConfig>
216
+ theme: StoryThemeConfig
217
+ responsivePresets: ResponsivePreset[]
218
+ backgroundPresets: BackgroundPreset[]
219
+ autoApplyContrastColor: boolean
220
+ setupFile?: string
221
+ port: number
222
+ }
223
+ /**
224
+ * Story layout configuration
225
+ */
226
+ export type StoryLayout = | { type: 'single', iframe?: boolean }
227
+ | { type: 'grid', width?: number | string }
228
+ /**
229
+ * Any tree node type
230
+ */
231
+ export type ServerTreeNode = ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf
232
+ /**
233
+ * Complete server tree
234
+ */
235
+ export type ServerTree = ServerTreeNode[]
236
+ /**
237
+ * Control type for prop editing
238
+ */
239
+ export type ControlType = | 'text'
240
+ | 'number'
241
+ | 'boolean'
242
+ | 'select'
243
+ | 'radio'
244
+ | 'color'
245
+ | 'date'
246
+ | 'json'
247
+ | 'textarea'
248
+ | 'slider'
249
+ | 'buttongroup'
@@ -0,0 +1,42 @@
1
+ import type { AnalyzedComponent, ServerStoryFile } from '../types';
2
+ /**
3
+ * Generate code panel HTML
4
+ */
5
+ export declare function generateCodePanel(story: ServerStoryFile, component: AnalyzedComponent | null, activeTab?: CodePanelTab): string;
6
+ /**
7
+ * Get source code for a component
8
+ */
9
+ export declare function getComponentSource(filePath: string): Promise<string>;
10
+ /**
11
+ * Get story code with current props
12
+ */
13
+ export declare function getStoryCode(componentName: string, props: Record<string, any>): string;
14
+ /**
15
+ * Get props as JSON
16
+ */
17
+ export declare function getPropsJson(props: Record<string, any>): string;
18
+ /**
19
+ * Apply syntax highlighting to code
20
+ * Uses simple regex-based highlighting without external deps
21
+ */
22
+ export declare function highlightCode(code: string, language: string): string;
23
+ /**
24
+ * Get syntax highlighting styles
25
+ */
26
+ export declare function getHighlightStyles(): string;
27
+ /**
28
+ * Get code panel styles
29
+ */
30
+ export declare function getCodePanelStyles(): string;
31
+ /**
32
+ * Copy code to clipboard (client-side)
33
+ */
34
+ export declare function getCopyCodeScript(): string;
35
+ /**
36
+ * Open in VS Code (client-side)
37
+ */
38
+ export declare function getOpenInVSCodeScript(filePath: string): string;
39
+ /**
40
+ * Code panel tabs
41
+ */
42
+ export type CodePanelTab = 'source' | 'story' | 'compiled' | 'props'
@@ -0,0 +1,25 @@
1
+ import type { AnalyzedComponent } from '../types';
2
+ /**
3
+ * Create initial controls panel state
4
+ */
5
+ export declare function createControlsPanelState(component: AnalyzedComponent | null): ControlsPanelState;
6
+ /**
7
+ * Generate controls panel HTML
8
+ */
9
+ export declare function generateControlsPanel(component: AnalyzedComponent | null, state: ControlsPanelState): string;
10
+ /**
11
+ * Generate auto props disabled message
12
+ */
13
+ export declare function generateAutoPropsDisabled(): string;
14
+ /**
15
+ * Get controls panel styles
16
+ */
17
+ export declare function getControlsPanelStyles(): string;
18
+ /**
19
+ * Controls panel state
20
+ */
21
+ export declare interface ControlsPanelState {
22
+ collapsed: boolean
23
+ values: Record<string, any>
24
+ filter: string
25
+ }
@@ -0,0 +1,4 @@
1
+ export * from './code-panel';
2
+ export * from './controls-panel';
3
+ export * from './navigation';
4
+ export * from './preview';
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Create initial navigation state
3
+ */
4
+ export declare function createNavigationState(): NavigationState;
5
+ /**
6
+ * Parse hash from URL for routing
7
+ */
8
+ export declare function parseHash(hash: string): { storyId: string | null, variantId: string | null };
9
+ /**
10
+ * Generate hash for URL
11
+ */
12
+ export declare function generateHash(storyId: string | null, variantId: string | null): string;
13
+ /**
14
+ * Add story to recent list
15
+ */
16
+ export declare function addToRecent(state: NavigationState, storyId: string): void;
17
+ /**
18
+ * Get keyboard navigation script
19
+ */
20
+ export declare function getKeyboardNavigationScript(): string;
21
+ /**
22
+ * Get navigation styles
23
+ */
24
+ export declare function getNavigationStyles(): string;
25
+ /**
26
+ * Generate recent stories list HTML
27
+ */
28
+ export declare function generateRecentList(recentStories: string[], storyMap: Map<string, string>): string;
29
+ /**
30
+ * State persistence helpers
31
+ */
32
+ export declare function saveNavigationState(state: NavigationState): void;
33
+ /**
34
+ * Load navigation state from storage
35
+ */
36
+ export declare function loadNavigationState(): Partial<NavigationState>;
37
+ /**
38
+ * Get state persistence script
39
+ */
40
+ export declare function getStatePersistenceScript(): string;
41
+ /**
42
+ * STX Story - Navigation
43
+ * Keyboard navigation, hash routing, and recent components
44
+ */
45
+ /**
46
+ * Navigation state
47
+ */
48
+ export declare interface NavigationState {
49
+ selectedStoryId: string | null
50
+ selectedVariantId: string | null
51
+ recentStories: string[]
52
+ maxRecent: number
53
+ searchQuery: string
54
+ focusedIndex: number
55
+ }
@@ -0,0 +1,46 @@
1
+ import type { ResponsivePreset, ServerStoryFile, StoryContext } from '../types';
2
+ /**
3
+ * Create initial preview state
4
+ */
5
+ export declare function createPreviewState(): PreviewState;
6
+ /**
7
+ * Generate iframe HTML for component preview
8
+ */
9
+ export declare function generatePreviewIframe(story: ServerStoryFile, variantId: string, state: PreviewState, ctx: StoryContext): string;
10
+ /**
11
+ * Generate viewport selector HTML
12
+ */
13
+ export declare function generateViewportSelector(presets: ResponsivePreset[], currentWidth: number | null): string;
14
+ /**
15
+ * Generate zoom controls HTML
16
+ */
17
+ export declare function generateZoomControls(currentZoom: number): string;
18
+ /**
19
+ * Generate background selector HTML
20
+ */
21
+ export declare function generateBackgroundSelector(presets: { label: string, color: string }[], currentColor: string): string;
22
+ /**
23
+ * Generate toolbar overlay buttons
24
+ */
25
+ export declare function generateOverlayButtons(state: PreviewState): string;
26
+ /**
27
+ * Generate side-by-side comparison view
28
+ */
29
+ export declare function generateComparisonView(story: ServerStoryFile, variantId1: string, variantId2: string, ctx: StoryContext): string;
30
+ /**
31
+ * Get preview styles
32
+ */
33
+ export declare function getPreviewStyles(): string;
34
+ /**
35
+ * Preview state
36
+ */
37
+ export declare interface PreviewState {
38
+ viewportWidth: number | null
39
+ viewportHeight: number | null
40
+ zoom: number
41
+ background: string
42
+ showGrid: boolean
43
+ showRuler: boolean
44
+ showOutline: boolean
45
+ props: Record<string, any>
46
+ }
@@ -0,0 +1,45 @@
1
+ import type { StoryContext } from './types';
2
+ /**
3
+ * Run visual regression tests
4
+ */
5
+ export declare function runScreenshotTests(ctx: StoryContext, options?: VisualTestOptions): Promise<VisualTestResult>;
6
+ /**
7
+ * Generate visual test report HTML
8
+ */
9
+ export declare function generateVisualTestReport(result: VisualTestResult): string;
10
+ /**
11
+ * Visual test options
12
+ */
13
+ export declare interface VisualTestOptions {
14
+ update?: boolean
15
+ threshold?: number
16
+ snapshotDir?: string
17
+ width?: number
18
+ height?: number
19
+ deviceScaleFactor?: number
20
+ filter?: string[]
21
+ }
22
+ /**
23
+ * Visual test result
24
+ */
25
+ export declare interface VisualTestResult {
26
+ total: number
27
+ passed: number
28
+ failed: number
29
+ new: number
30
+ failures: VisualTestFailure[]
31
+ duration: number
32
+ }
33
+ /**
34
+ * Visual test failure
35
+ */
36
+ export declare interface VisualTestFailure {
37
+ storyId: string
38
+ variantId: string
39
+ component: string
40
+ message: string
41
+ baselinePath?: string
42
+ actualPath?: string
43
+ diffPath?: string
44
+ diffPercentage?: number
45
+ }
@@ -1,11 +1,27 @@
1
1
  import type { CustomDirective, StreamRenderer, StxOptions } from './types';
2
2
  /**
3
- * Stream a template with data
3
+ * Stream a template with data using chunked transfer encoding.
4
+ *
5
+ * This implements actual progressive streaming by:
6
+ * 1. Sending the shell (content before suspense) immediately
7
+ * 2. Processing suspense boundaries in parallel
8
+ * 3. Streaming each resolved suspense content as it completes
9
+ * 4. Using out-of-order streaming with client-side reordering
10
+ *
4
11
  * @param templatePath Path to the template
5
12
  * @param data Data to render with the template
6
13
  * @param options stx options
7
14
  */
8
15
  export declare function streamTemplate(templatePath: string, data?: Record<string, any>, options?: StxOptions): Promise<ReadableStream<string>>;
16
+ /**
17
+ * Stream a template with data (simple version without suspense).
18
+ * Returns full content in chunks based on buffer size.
19
+ *
20
+ * @param templatePath Path to the template
21
+ * @param data Data to render with the template
22
+ * @param options stx options
23
+ */
24
+ export declare function streamTemplateSimple(templatePath: string, data?: Record<string, any>, options?: StxOptions): Promise<ReadableStream<string>>;
9
25
  /**
10
26
  * Create a stream renderer for progressive loading
11
27
  * @param templatePath Path to the template
@@ -24,7 +40,71 @@ export declare function registerStreamingDirectives(options?: StxOptions): Custo
24
40
  * @param _options stx options
25
41
  */
26
42
  export declare function processSectionDirectives(content: string, context: Record<string, any>, filePath: string, _options?: StxOptions): Promise<string>;
43
+ /**
44
+ * Wrap a ReadableStream<string> in a proper Response with chunked transfer encoding headers.
45
+ *
46
+ * Makes it trivial to use streaming from a Bun server handler:
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const server = Bun.serve({
51
+ * async fetch(req) {
52
+ * const stream = await streamTemplate('index.stx', { title: 'Home' })
53
+ * return streamToResponse(stream)
54
+ * }
55
+ * })
56
+ * ```
57
+ *
58
+ * @param stream - The template ReadableStream
59
+ * @param init - Optional additional ResponseInit (headers, status, etc.)
60
+ * @returns A Response with proper streaming headers
61
+ */
62
+ export declare function streamToResponse(stream: ReadableStream<string>, init?: ResponseInit): Response;
63
+ /**
64
+ * Generate client-side hydration runtime script.
65
+ *
66
+ * This script handles:
67
+ * - Finding islands in the DOM
68
+ * - Loading island components based on priority
69
+ * - Hydrating islands with their props
70
+ *
71
+ * Usage: Include the generated script in your page, then call
72
+ * `window.__stx.hydrate()` when ready.
73
+ *
74
+ * @example
75
+ * ```html
76
+ * <script>
77
+ * {{ generateHydrationRuntime({ mode: 'full' }) }}
78
+ * </script>
79
+ * ```
80
+ */
81
+ export declare function generateHydrationRuntime(config?: HydrationRuntimeConfig): string;
82
+ /**
83
+ * Custom directive for marking suspense boundaries in streaming templates.
84
+ *
85
+ * Usage:
86
+ * ```html
87
+ * @suspense('heavy-content')
88
+ * <div>This content will stream after the shell</div>
89
+ * @endsuspense
90
+ * ```
91
+ *
92
+ * The content inside suspense boundaries will be:
93
+ * 1. Replaced with a placeholder in the initial shell
94
+ * 2. Processed in parallel with other suspense boundaries
95
+ * 3. Streamed to the client as it resolves
96
+ * 4. Injected into the placeholder via client-side JavaScript
97
+ */
98
+ export declare const streamingSuspenseDirective: CustomDirective;
27
99
  /**
28
100
  * Custom directive for creating islands (for partial hydration)
29
101
  */
30
- export declare const islandDirective: CustomDirective;
102
+ export declare const islandDirective: CustomDirective;
103
+ /**
104
+ * Configuration for hydration runtime generation
105
+ */
106
+ export declare interface HydrationRuntimeConfig {
107
+ mode: 'full' | 'loader'
108
+ components?: Record<string, string>
109
+ dynamicImports?: boolean
110
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Process @suspense directives in templates.
3
+ *
4
+ * Syntax:
5
+ * @suspense
6
+ * <async content>
7
+ * @fallback
8
+ * <loading fallback>
9
+ * @endsuspense
10
+ *
11
+ * With options:
12
+ * @suspense(timeout: 10000)
13
+ */
14
+ export declare function processSuspenseDirectives(template: string, _context?: Record<string, unknown>, _filePath?: string): string;
15
+ /**
16
+ * Create an SSR suspense boundary.
17
+ * Returns the fallback immediately, then streams the content when ready.
18
+ */
19
+ export declare function createSSRSuspense(id: string, contentPromise: Promise<string>, fallback: string): SSRSuspenseBoundary;
20
+ /**
21
+ * Render SSR suspense boundaries for streaming.
22
+ * Returns initial HTML with fallbacks, plus a script to replace them when content loads.
23
+ */
24
+ export declare function renderSSRSuspense(boundaries: SSRSuspenseBoundary[]): Promise<{ initial: string; streaming: AsyncGenerator<string> }>;
25
+ /**
26
+ * Generate CSS for suspense styling.
27
+ */
28
+ export declare function generateSuspenseCSS(): string;
29
+ /**
30
+ * Generate client-side runtime for suspense.
31
+ */
32
+ export declare function generateSuspenseRuntime(): string;
33
+ /**
34
+ * STX Suspense
35
+ *
36
+ * Coordinates async loading across component trees, showing a fallback
37
+ * until all async children are resolved.
38
+ *
39
+ * @module suspense
40
+ *
41
+ * @example
42
+ * ```html
43
+ * @suspense
44
+ * <UserProfile :id="userId" />
45
+ * <UserActivity :id="userId" />
46
+ * <UserStats :id="userId" />
47
+ * @fallback
48
+ * <PageSkeleton />
49
+ * @endsuspense
50
+ * ```
51
+ */
52
+ // =============================================================================
53
+ // Types
54
+ // =============================================================================
55
+ export declare interface SuspenseOptions {
56
+ id?: string
57
+ timeout?: number
58
+ onResolve?: () => void
59
+ onError?: (error: Error) => void
60
+ onPending?: () => void
61
+ }
62
+ export declare interface SuspenseState {
63
+ status: 'pending' | 'resolved' | 'rejected'
64
+ pending: Set<string>
65
+ resolved: Set<string>
66
+ error: Error | null
67
+ }
68
+ export declare interface SuspenseBoundary {
69
+ id: string
70
+ state: SuspenseState
71
+ register: (childId: string) => void
72
+ resolve: (childId: string) => void
73
+ reject: (childId: string, error: Error) => void
74
+ reset: () => void
75
+ }
76
+ /**
77
+ * Server-side suspense boundary for SSR streaming.
78
+ */
79
+ export declare interface SSRSuspenseBoundary {
80
+ id: string
81
+ fallback: string
82
+ content: Promise<string>
83
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Process @teleport directives in template
3
+ */
4
+ export declare function processTeleportDirectives(template: string, context: Record<string, unknown>, _filePath: string): string;
5
+ /**
6
+ * Ensure teleport targets exist in the document
7
+ * Call this to create common teleport targets if they don't exist
8
+ */
9
+ export declare function ensureTeleportTargets(): string;