@stacksjs/stx 0.2.4 → 0.2.6

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 (293) hide show
  1. package/dist/a11y.d.ts +2 -6
  2. package/dist/analytics.d.ts +1 -1
  3. package/dist/analyzer.d.ts +1 -1
  4. package/dist/animation.d.ts +10 -86
  5. package/dist/app.d.ts +2 -4
  6. package/dist/assets.d.ts +1 -1
  7. package/dist/ast.d.ts +3 -24
  8. package/dist/async-components.d.ts +1 -1
  9. package/dist/auth.d.ts +1 -1
  10. package/dist/browser-composables.d.ts +6 -4
  11. package/dist/build-optimizer.d.ts +4 -29
  12. package/dist/build-views.d.ts +20 -1
  13. package/dist/bundle-analyzer/collector.d.ts +1 -1
  14. package/dist/bundle-analyzer/index.d.ts +40 -4
  15. package/dist/bundle-analyzer/report.d.ts +1 -1
  16. package/dist/bundle-analyzer/treemap.d.ts +1 -1
  17. package/dist/caching.d.ts +1 -1
  18. package/dist/cli.js +1323 -511
  19. package/dist/client/directive.d.ts +1 -1
  20. package/dist/client/index.d.ts +6 -1
  21. package/dist/client/router.d.ts +3 -11
  22. package/dist/client/stx-router.browser.d.ts +1 -0
  23. package/dist/client-script.d.ts +2 -1
  24. package/dist/client.d.ts +2 -2
  25. package/dist/component-hmr.d.ts +4 -18
  26. package/dist/components.d.ts +1 -1
  27. package/dist/composables/index.d.ts +114 -1
  28. package/dist/composables/use-battery.d.ts +1 -1
  29. package/dist/composables/use-broadcast-channel.d.ts +2 -2
  30. package/dist/composables/use-clipboard.d.ts +1 -1
  31. package/dist/composables/use-color-mode.d.ts +52 -0
  32. package/dist/composables/use-cookie.d.ts +1 -1
  33. package/dist/composables/use-device-orientation.d.ts +1 -1
  34. package/dist/composables/use-event-listener.d.ts +35 -0
  35. package/dist/composables/use-event-source.d.ts +1 -1
  36. package/dist/composables/use-eye-dropper.d.ts +3 -2
  37. package/dist/composables/use-fetch.d.ts +1 -1
  38. package/dist/composables/use-fullscreen.d.ts +1 -1
  39. package/dist/composables/use-geolocation.d.ts +1 -1
  40. package/dist/composables/use-idle.d.ts +2 -2
  41. package/dist/composables/use-intersection-observer.d.ts +1 -1
  42. package/dist/composables/use-keyboard.d.ts +1 -2
  43. package/dist/composables/use-media-query.d.ts +1 -1
  44. package/dist/composables/use-meta.d.ts +35 -0
  45. package/dist/composables/use-mouse.d.ts +1 -1
  46. package/dist/composables/use-mutation-observer.d.ts +1 -1
  47. package/dist/composables/use-network.d.ts +1 -1
  48. package/dist/composables/use-notification.d.ts +10 -1
  49. package/dist/composables/use-permissions.d.ts +17 -7
  50. package/dist/composables/use-query.d.ts +43 -0
  51. package/dist/composables/use-resize-observer.d.ts +1 -1
  52. package/dist/composables/use-router.d.ts +59 -0
  53. package/dist/composables/use-share.d.ts +1 -1
  54. package/dist/composables/use-speech.d.ts +1 -1
  55. package/dist/composables/use-storage.d.ts +1 -1
  56. package/dist/composables/use-text-selection.d.ts +1 -1
  57. package/dist/composables/use-timer.d.ts +92 -0
  58. package/dist/composables/use-utilities.d.ts +103 -0
  59. package/dist/composables/use-wake-lock.d.ts +1 -1
  60. package/dist/composables/use-websocket.d.ts +3 -3
  61. package/dist/composables/use-window.d.ts +1 -1
  62. package/dist/composables.d.ts +10 -7
  63. package/dist/composition-api.d.ts +1 -14
  64. package/dist/computed.d.ts +10 -4
  65. package/dist/conditionals.d.ts +1 -1
  66. package/dist/config.d.ts +1 -1
  67. package/dist/craft-bridge.d.ts +1 -1
  68. package/dist/craft-compiler.d.ts +6 -3
  69. package/dist/craft-components.d.ts +1 -8
  70. package/dist/craft-entry.d.ts +1 -1
  71. package/dist/craft-ssr.d.ts +1 -1
  72. package/dist/csp.d.ts +2 -2
  73. package/dist/csrf.d.ts +1 -1
  74. package/dist/custom-directives.d.ts +1 -1
  75. package/dist/database.d.ts +8 -26
  76. package/dist/defer.d.ts +1 -1
  77. package/dist/deploy/config-generators.d.ts +1 -1
  78. package/dist/deploy/index.d.ts +6 -3
  79. package/dist/deploy/netlify.d.ts +1 -1
  80. package/dist/dev-server/crosswind.d.ts +11 -1
  81. package/dist/dev-server/index.d.ts +16 -1
  82. package/dist/dev-server/keyboard-shortcuts.d.ts +1 -1
  83. package/dist/dev-server/native-window.d.ts +1 -1
  84. package/dist/dev-server/port-utils.d.ts +2 -2
  85. package/dist/dev-server/terminal-colors.d.ts +1 -5
  86. package/dist/dev-server/theme-selector.d.ts +1 -1
  87. package/dist/dev-server/types.d.ts +3 -8
  88. package/dist/dev-server.d.ts +1 -4
  89. package/dist/devtools.d.ts +4 -1
  90. package/dist/directive-api.d.ts +3 -3
  91. package/dist/docs.d.ts +2 -2
  92. package/dist/dynamic-components.d.ts +1 -1
  93. package/dist/edge-runtime.d.ts +3 -3
  94. package/dist/env.d.ts +1 -1
  95. package/dist/error-boundaries.d.ts +1 -1
  96. package/dist/error-handling.d.ts +14 -1
  97. package/dist/errors/codes.d.ts +2 -17
  98. package/dist/errors/formatter.d.ts +1 -1
  99. package/dist/errors/index.d.ts +13 -1
  100. package/dist/errors/logger.d.ts +2 -15
  101. package/dist/errors/sanitizer.d.ts +1 -1
  102. package/dist/errors/types.d.ts +1 -1
  103. package/dist/events.d.ts +1 -1
  104. package/dist/expressions.d.ts +64 -90
  105. package/dist/formatter.d.ts +1 -1
  106. package/dist/forms-validation.d.ts +23 -24
  107. package/dist/forms.d.ts +5 -22
  108. package/dist/head.d.ts +5 -1
  109. package/dist/heatmap.d.ts +4 -7
  110. package/dist/hot-reload.d.ts +3 -8
  111. package/dist/hydration-runtime.d.ts +1 -1
  112. package/dist/hydration.d.ts +5 -32
  113. package/dist/i18n.d.ts +1 -9
  114. package/dist/image-optimization/build-plugin.d.ts +2 -2
  115. package/dist/image-optimization/component.d.ts +2 -2
  116. package/dist/image-optimization/directive.d.ts +2 -2
  117. package/dist/image-optimization/index.d.ts +55 -1
  118. package/dist/image-optimization/processor.d.ts +9 -4
  119. package/dist/includes.d.ts +1 -1
  120. package/dist/index.d.ts +29 -1
  121. package/dist/index.js +1387 -542
  122. package/dist/init.d.ts +1 -1
  123. package/dist/interactive.d.ts +1 -1
  124. package/dist/internal-markdown.d.ts +1 -1
  125. package/dist/js-ts.d.ts +1 -1
  126. package/dist/jsx-runtime.d.ts +1 -20
  127. package/dist/keep-alive.d.ts +1 -1
  128. package/dist/lazy-loader.d.ts +3 -35
  129. package/dist/loading-indicator.d.ts +2 -1
  130. package/dist/loops.d.ts +1 -1
  131. package/dist/markdown.d.ts +1 -1
  132. package/dist/media/client/blur-up.d.ts +1 -1
  133. package/dist/media/client/index.d.ts +17 -1
  134. package/dist/media/client/lazy-load.d.ts +1 -1
  135. package/dist/media/client/upload-handler.d.ts +1 -1
  136. package/dist/media/image/component.d.ts +2 -4
  137. package/dist/media/image/directive.d.ts +1 -1
  138. package/dist/media/image/editing.d.ts +1 -1
  139. package/dist/media/image/index.d.ts +25 -1
  140. package/dist/media/image/placeholder.d.ts +1 -1
  141. package/dist/media/image/processor/cache.d.ts +3 -4
  142. package/dist/media/image/processor/index.d.ts +9 -1
  143. package/dist/media/image/processor/optimizer.d.ts +2 -2
  144. package/dist/media/image/processor/responsive.d.ts +3 -2
  145. package/dist/media/image/srcset.d.ts +6 -4
  146. package/dist/media/index.d.ts +37 -1
  147. package/dist/media/manager/embed.d.ts +1 -1
  148. package/dist/media/protected/component.d.ts +2 -3
  149. package/dist/media/protected/index.d.ts +14 -1
  150. package/dist/media/protected/signature.d.ts +2 -2
  151. package/dist/media/shared/cache.d.ts +1 -1
  152. package/dist/media/shared/hash.d.ts +1 -1
  153. package/dist/media/shared/index.d.ts +6 -1
  154. package/dist/media/types.d.ts +16 -72
  155. package/dist/media/upload/component.d.ts +2 -16
  156. package/dist/media/upload/index.d.ts +8 -1
  157. package/dist/media/video/directive.d.ts +1 -1
  158. package/dist/media/video/index.d.ts +11 -2
  159. package/dist/media/video/processor/cache.d.ts +3 -4
  160. package/dist/media/video/processor/index.d.ts +9 -1
  161. package/dist/media/video/processor/streaming.d.ts +2 -2
  162. package/dist/media/video/processor/thumbnail.d.ts +2 -2
  163. package/dist/media/video/processor/transcoder.d.ts +2 -2
  164. package/dist/method-spoofing.d.ts +1 -1
  165. package/dist/middleware.d.ts +1 -1
  166. package/dist/native-build.d.ts +3 -6
  167. package/dist/parser/directive-parser.d.ts +1 -1
  168. package/dist/parser/expression-parser.d.ts +2 -1
  169. package/dist/parser/index.d.ts +14 -1
  170. package/dist/parser/tokenizer.d.ts +2 -18
  171. package/dist/partial-hydration.d.ts +5 -6
  172. package/dist/performance-utils.d.ts +5 -18
  173. package/dist/plugin-system.d.ts +2 -8
  174. package/dist/plugin.d.ts +1 -1
  175. package/dist/precompiler.d.ts +2 -67
  176. package/dist/process.d.ts +12 -2
  177. package/dist/production-build.d.ts +1 -37
  178. package/dist/props.d.ts +3 -30
  179. package/dist/pwa/audit.d.ts +1 -1
  180. package/dist/pwa/directives.d.ts +1 -1
  181. package/dist/pwa/icons.d.ts +7 -4
  182. package/dist/pwa/index.d.ts +46 -1
  183. package/dist/pwa/inject.d.ts +1 -1
  184. package/dist/pwa/manifest.d.ts +1 -1
  185. package/dist/pwa/offline.d.ts +1 -1
  186. package/dist/pwa/precache.d.ts +1 -1
  187. package/dist/pwa/service-worker.d.ts +1 -1
  188. package/dist/pwa/workbox-strategies.d.ts +1 -1
  189. package/dist/pwa/workbox.d.ts +1 -10
  190. package/dist/pwa.d.ts +1 -1
  191. package/dist/pwa.js +1242 -430
  192. package/dist/reactive-bindings.d.ts +1 -1
  193. package/dist/reactive.d.ts +1 -1
  194. package/dist/reactivity.d.ts +6 -50
  195. package/dist/release.d.ts +1 -1
  196. package/dist/route-middleware.d.ts +3 -3
  197. package/dist/router.d.ts +1 -1
  198. package/dist/routes.d.ts +2 -2
  199. package/dist/runtime.d.ts +4 -4
  200. package/dist/safe-evaluator.d.ts +1 -4
  201. package/dist/scaffolding.d.ts +1 -1
  202. package/dist/seo.d.ts +1 -5
  203. package/dist/serve.d.ts +1 -1
  204. package/dist/server-components.d.ts +1 -1
  205. package/dist/signals.d.ts +8 -168
  206. package/dist/slots.d.ts +2 -2
  207. package/dist/source-maps.d.ts +3 -22
  208. package/dist/spa-shell.d.ts +20 -0
  209. package/dist/ssg.d.ts +4 -6
  210. package/dist/ssg.js +1242 -430
  211. package/dist/ssr.d.ts +6 -14
  212. package/dist/state-management.d.ts +5 -45
  213. package/dist/stores-client.d.ts +3 -3
  214. package/dist/story/addons.d.ts +1 -1
  215. package/dist/story/analytics.d.ts +4 -11
  216. package/dist/story/auto-stories.d.ts +1 -1
  217. package/dist/story/bookmarks.d.ts +2 -6
  218. package/dist/story/bun-test.d.ts +1 -1
  219. package/dist/story/cli.d.ts +0 -25
  220. package/dist/story/collect/analyzer.d.ts +1 -1
  221. package/dist/story/collect/index.d.ts +5 -1
  222. package/dist/story/collect/parser.d.ts +1 -1
  223. package/dist/story/collect/scanner.d.ts +1 -1
  224. package/dist/story/collect/tree.d.ts +2 -2
  225. package/dist/story/commands/build.d.ts +1 -1
  226. package/dist/story/commands/dev.d.ts +1 -1
  227. package/dist/story/commands/index.d.ts +4 -1
  228. package/dist/story/commands/preview.d.ts +1 -1
  229. package/dist/story/compiled-output.d.ts +1 -1
  230. package/dist/story/composition.d.ts +1 -1
  231. package/dist/story/config-watcher.d.ts +1 -1
  232. package/dist/story/config.d.ts +2 -2
  233. package/dist/story/context.d.ts +1 -1
  234. package/dist/story/controls/index.d.ts +1 -1
  235. package/dist/story/crosswind.d.ts +1 -1
  236. package/dist/story/desktop-preview.d.ts +1 -1
  237. package/dist/story/docs-generator.d.ts +1 -1
  238. package/dist/story/errors.d.ts +1 -1
  239. package/dist/story/figma-export.d.ts +2 -2
  240. package/dist/story/generator.d.ts +1 -1
  241. package/dist/story/hmr.d.ts +1 -1
  242. package/dist/story/hot-swap.d.ts +1 -1
  243. package/dist/story/index.d.ts +49 -1
  244. package/dist/story/interactions.d.ts +1 -1
  245. package/dist/story/keyboard-shortcuts.d.ts +1 -1
  246. package/dist/story/output.d.ts +1 -1
  247. package/dist/story/performance.d.ts +3 -12
  248. package/dist/story/presets.d.ts +3 -8
  249. package/dist/story/props-validation.d.ts +11 -1
  250. package/dist/story/renderer.d.ts +1 -1
  251. package/dist/story/search-index.d.ts +2 -2
  252. package/dist/story/search.d.ts +2 -2
  253. package/dist/story/server.d.ts +1 -1
  254. package/dist/story/setup.d.ts +1 -1
  255. package/dist/story/snapshots.d.ts +1 -1
  256. package/dist/story/testing.d.ts +1 -1
  257. package/dist/story/theme.d.ts +1 -1
  258. package/dist/story/types.d.ts +3 -12
  259. package/dist/story/ui/code-panel.d.ts +1 -1
  260. package/dist/story/ui/controls-panel.d.ts +1 -1
  261. package/dist/story/ui/index.d.ts +5 -1
  262. package/dist/story/ui/navigation.d.ts +1 -1
  263. package/dist/story/ui/preview.d.ts +1 -1
  264. package/dist/story/visual-testing.d.ts +1 -1
  265. package/dist/streaming.d.ts +0 -59
  266. package/dist/suspense.d.ts +1 -1
  267. package/dist/teleport.d.ts +1 -1
  268. package/dist/testing.d.ts +62 -80
  269. package/dist/transitions.d.ts +1 -1
  270. package/dist/type-checker.d.ts +2 -26
  271. package/dist/types/component-types.d.ts +3 -3
  272. package/dist/types/config-types.d.ts +15 -30
  273. package/dist/types/context-types.d.ts +6 -5
  274. package/dist/types/csp-types.d.ts +2 -2
  275. package/dist/types/directive-types.d.ts +5 -5
  276. package/dist/types/index.d.ts +21 -1
  277. package/dist/types/pwa-types.d.ts +1 -6
  278. package/dist/types.d.ts +28 -1
  279. package/dist/typescript-templates.d.ts +1 -34
  280. package/dist/utils.d.ts +2 -1
  281. package/dist/validator.d.ts +1 -1
  282. package/dist/variable-extractor.d.ts +1 -1
  283. package/dist/view-composers.d.ts +1 -1
  284. package/dist/virtual-scrolling.d.ts +4 -1
  285. package/dist/visual-editor.d.ts +2 -30
  286. package/dist/visual-testing.d.ts +4 -1
  287. package/dist/vue-template.d.ts +1 -1
  288. package/dist/web-components/css-scoping.d.ts +1 -1
  289. package/dist/web-components/index.d.ts +10 -1
  290. package/dist/web-components/reactive-generator.d.ts +1 -1
  291. package/dist/web-components.d.ts +1 -1
  292. package/dist/x-element.d.ts +13 -6
  293. package/package.json +4 -4
@@ -42,4 +42,14 @@ export declare interface ValidationError {
42
42
  export declare interface ValidationWarning {
43
43
  prop: string
44
44
  message: string
45
- }
45
+ }
46
+ declare type = : string,
47
+ options?: string[],
48
+ ): string | null {
49
+ // Handle null/undefined
50
+ if (value === null || value === undefined) {
51
+ if (type.includes('null') || type.includes('undefined') || type.includes('?')) {
52
+ return null
53
+ }
54
+ return `Expected ${type}, got ${value === null ? 'null' : 'undefined'}`
55
+ }
@@ -50,4 +50,4 @@ export declare interface StoryRenderResult {
50
50
  js: string
51
51
  errors: string[]
52
52
  duration: number
53
- }
53
+ }
@@ -23,7 +23,7 @@ export declare function searchIndex(index: PersistedSearchIndex, query: string):
23
23
  /**
24
24
  * Get or build search index
25
25
  */
26
- export declare function getOrBuildSearchIndex(ctx: StoryContext, storyFiles: ServerStoryFile[], components: Map<string, AnalyzedComponent>, forceRebuild?: any): Promise<SearchIndexEntry[]>;
26
+ export declare function getOrBuildSearchIndex(ctx: StoryContext, storyFiles: ServerStoryFile[], components: Map<string, AnalyzedComponent>, forceRebuild?: boolean): Promise<SearchIndexEntry[]>;
27
27
  /**
28
28
  * Search index entry
29
29
  */
@@ -44,4 +44,4 @@ export declare interface PersistedSearchIndex {
44
44
  created: number
45
45
  updated: number
46
46
  entries: SearchIndexEntry[]
47
- }
47
+ }
@@ -10,7 +10,7 @@ export declare function buildComponentSearchIndex(components: AnalyzedComponent[
10
10
  /**
11
11
  * Search the index
12
12
  */
13
- export declare function search(query: string, limit?: any): SearchResult[];
13
+ export declare function search(query: string, limit?: number): SearchResult[];
14
14
  /**
15
15
  * Get recent searches from localStorage (client-side)
16
16
  */
@@ -42,4 +42,4 @@ export declare interface SearchResult {
42
42
  variantId?: string
43
43
  score: number
44
44
  match: string
45
- }
45
+ }
@@ -18,4 +18,4 @@ export declare interface StoryServer {
18
18
  server: ReturnType<typeof Bun.serve>
19
19
  url: string
20
20
  close: () => Promise<void>
21
- }
21
+ }
@@ -44,4 +44,4 @@ export declare interface SetupContext {
44
44
  /**
45
45
  * Setup function signature
46
46
  */
47
- export type SetupFunction = (ctx: SetupContext) => void | Promise<void>
47
+ export type SetupFunction = (ctx: SetupContext) => void | Promise<void>;
@@ -62,4 +62,4 @@ export declare interface DiffResult {
62
62
  diffImagePath?: string
63
63
  changedPixels: number
64
64
  totalPixels: number
65
- }
65
+ }
@@ -55,4 +55,4 @@ export declare interface SnapshotMeta {
55
55
  component: string
56
56
  timestamp: number
57
57
  hash: string
58
- }
58
+ }
@@ -65,4 +65,4 @@ export declare interface ThemeConfig {
65
65
  fontFamily: string
66
66
  codeFontFamily: string
67
67
  borderRadius: string
68
- }
68
+ }
@@ -1,7 +1,3 @@
1
- /**
2
- * STX Story - Component showcase and testing
3
- * Type definitions for the story feature
4
- */
5
1
  /**
6
2
  * Tree group configuration for organizing stories
7
3
  */
@@ -32,18 +28,13 @@ export declare interface BackgroundPreset {
32
28
  export declare interface StoryThemeConfig {
33
29
  title?: string
34
30
  logo?: {
35
- /** Square logo (for favicon/small displays) */
36
31
  square?: string
37
- /** Light theme logo */
38
32
  light?: string
39
- /** Dark theme logo */
40
33
  dark?: string
41
34
  }
42
35
  favicon?: string
43
36
  colors?: {
44
- /** Primary accent color shades */
45
37
  primary?: Record<string, string>
46
- /** Gray color shades */
47
38
  gray?: Record<string, string>
48
39
  }
49
40
  defaultColorScheme?: 'light' | 'dark' | 'auto'
@@ -228,11 +219,11 @@ export type StoryLayout = | { type: 'single', iframe?: boolean }
228
219
  /**
229
220
  * Any tree node type
230
221
  */
231
- export type ServerTreeNode = ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf
222
+ export type ServerTreeNode = ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf;
232
223
  /**
233
224
  * Complete server tree
234
225
  */
235
- export type ServerTree = ServerTreeNode[]
226
+ export type ServerTree = ServerTreeNode[];
236
227
  /**
237
228
  * Control type for prop editing
238
229
  */
@@ -246,4 +237,4 @@ export type ControlType = | 'text'
246
237
  | 'json'
247
238
  | 'textarea'
248
239
  | 'slider'
249
- | 'buttongroup'
240
+ | 'buttongroup';
@@ -39,4 +39,4 @@ export declare function getOpenInVSCodeScript(filePath: string): string;
39
39
  /**
40
40
  * Code panel tabs
41
41
  */
42
- export type CodePanelTab = 'source' | 'story' | 'compiled' | 'props'
42
+ export type CodePanelTab = 'source' | 'story' | 'compiled' | 'props';
@@ -22,4 +22,4 @@ export declare interface ControlsPanelState {
22
22
  collapsed: boolean
23
23
  values: Record<string, any>
24
24
  filter: string
25
- }
25
+ }
@@ -1,4 +1,8 @@
1
+ /**
2
+ * STX Story - UI Components
3
+ * All UI-related exports
4
+ */
1
5
  export * from './code-panel';
2
6
  export * from './controls-panel';
3
7
  export * from './navigation';
4
- export * from './preview';
8
+ export * from './preview';
@@ -52,4 +52,4 @@ export declare interface NavigationState {
52
52
  maxRecent: number
53
53
  searchQuery: string
54
54
  focusedIndex: number
55
- }
55
+ }
@@ -43,4 +43,4 @@ export declare interface PreviewState {
43
43
  showRuler: boolean
44
44
  showOutline: boolean
45
45
  props: Record<string, any>
46
- }
46
+ }
@@ -42,4 +42,4 @@ export declare interface VisualTestFailure {
42
42
  actualPath?: string
43
43
  diffPath?: string
44
44
  diffPercentage?: number
45
- }
45
+ }
@@ -28,57 +28,6 @@ export declare function streamTemplateSimple(templatePath: string, data?: Record
28
28
  * @param options stx options
29
29
  */
30
30
  export declare function createStreamRenderer(templatePath: string, options?: StxOptions): Promise<StreamRenderer>;
31
- /**
32
- * Register streaming and hydration directives
33
- */
34
- export declare function registerStreamingDirectives(options?: StxOptions): CustomDirective[];
35
- /**
36
- * Process section directives
37
- * @param content Template content
38
- * @param context Data context
39
- * @param filePath Template file path
40
- * @param _options stx options
41
- */
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
31
  /**
83
32
  * Custom directive for marking suspense boundaries in streaming templates.
84
33
  *
@@ -100,11 +49,3 @@ export declare const streamingSuspenseDirective: CustomDirective;
100
49
  * Custom directive for creating islands (for partial hydration)
101
50
  */
102
51
  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
- }
@@ -80,4 +80,4 @@ export declare interface SSRSuspenseBoundary {
80
80
  id: string
81
81
  fallback: string
82
82
  content: Promise<string>
83
- }
83
+ }
@@ -6,4 +6,4 @@ export declare function processTeleportDirectives(template: string, context: Rec
6
6
  * Ensure teleport targets exist in the document
7
7
  * Call this to create common teleport targets if they don't exist
8
8
  */
9
- export declare function ensureTeleportTargets(): string;
9
+ export declare function ensureTeleportTargets(): string;
package/dist/testing.d.ts CHANGED
@@ -86,116 +86,98 @@ export declare function createTestContext(options?: {
86
86
  export declare function cleanup(): void;
87
87
  /**
88
88
  * Fire events on elements.
89
+ * @defaultValue
90
+ * ```ts
91
+ * {
92
+ * async click: (
93
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
94
+ * options?: MouseEventInit,
95
+ * ) => unknown,
96
+ * async dblClick: (
97
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
98
+ * options?: MouseEventInit,
99
+ * ) => unknown,
100
+ * async input: (
101
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
102
+ * value: string,
103
+ * ) => unknown,
104
+ * async change: (
105
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
106
+ * value?: string,
107
+ * ) => unknown,
108
+ * async submit: (
109
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
110
+ * ) => unknown,
111
+ * async focus: (
112
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
113
+ * ) => unknown,
114
+ * async blur: (
115
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
116
+ * ) => unknown,
117
+ * async keyDown: (
118
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
119
+ * key: string,
120
+ * options?: KeyboardEventInit,
121
+ * ) => unknown,
122
+ * async keyUp: (
123
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
124
+ * key: string,
125
+ * options?: KeyboardEventInit,
126
+ * ) => unknown,
127
+ * async custom: (
128
+ * target: HTMLElement | ElementWrapper | ComponentWrapper | null,
129
+ * eventName: string,
130
+ * options?: FireEventOptions,
131
+ * ) => unknown
132
+ * }
133
+ * ```
89
134
  */
90
135
  export declare const fireEvent: {
91
136
  /**
92
137
  * Fire a click event.
93
138
  */
94
- async click(
95
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
96
- options?: MouseEventInit,
97
- ): unknown;
139
+ async click: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, options?: MouseEventInit, ) => unknown;
98
140
  /**
99
141
  * Fire a double click event.
100
142
  */
101
- async dblClick(
102
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
103
- options?: MouseEventInit,
104
- ): unknown;
143
+ async dblClick: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, options?: MouseEventInit, ) => unknown;
105
144
  /**
106
145
  * Fire an input event.
107
146
  */
108
- async input(
109
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
110
- value: string,
111
- ): unknown;
147
+ async input: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, value: string, ) => unknown;
112
148
  /**
113
149
  * Fire a change event.
114
150
  */
115
- async change(
116
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
117
- value?: string,
118
- ): unknown;
151
+ async change: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, value?: string, ) => unknown;
119
152
  /**
120
153
  * Fire a submit event.
121
154
  */
122
- async submit(
123
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
124
- ): unknown;
155
+ async submit: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, ) => unknown;
125
156
  /**
126
157
  * Fire a focus event.
127
158
  */
128
- async focus(
129
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
130
- ): unknown;
159
+ async focus: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, ) => unknown;
131
160
  /**
132
161
  * Fire a blur event.
133
162
  */
134
- async blur(
135
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
136
- ): unknown;
163
+ async blur: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, ) => unknown;
137
164
  /**
138
165
  * Fire a keydown event.
139
166
  */
140
- async keyDown(
141
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
142
- key: string,
143
- options?: KeyboardEventInit,
144
- ): unknown;
167
+ async keyDown: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, key: string, options?: KeyboardEventInit, ) => unknown;
145
168
  /**
146
169
  * Fire a keyup event.
147
170
  */
148
- async keyUp(
149
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
150
- key: string,
151
- options?: KeyboardEventInit,
152
- ): unknown;
171
+ async keyUp: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, key: string, options?: KeyboardEventInit, ) => unknown;
153
172
  /**
154
173
  * Fire a custom event.
155
174
  */
156
- async custom(
157
- target: HTMLElement | ElementWrapper | ComponentWrapper | null,
158
- eventName: string,
159
- options?: FireEventOptions,
160
- ): unknown
175
+ async custom: ( target: HTMLElement | ElementWrapper | ComponentWrapper | null, eventName: string, options?: FireEventOptions, ) => unknown
161
176
  };
162
177
  /**
163
178
  * Create custom matchers for testing.
164
179
  */
165
- export declare const matchers: {
166
- /**
167
- * Check if wrapper contains text.
168
- */
169
- toContainText(wrapper: ComponentWrapper | ElementWrapper, text: string): unknown;
170
- /**
171
- * Check if wrapper has class.
172
- */
173
- toHaveClass(wrapper: ComponentWrapper | ElementWrapper, className: string): unknown;
174
- /**
175
- * Check if wrapper has attribute.
176
- */
177
- toHaveAttribute(
178
- wrapper: ComponentWrapper | ElementWrapper,
179
- name: string,
180
- value?: string,
181
- ): unknown;
182
- /**
183
- * Check if wrapper is visible.
184
- */
185
- toBeVisible(wrapper: ComponentWrapper | ElementWrapper): unknown;
186
- /**
187
- * Check if wrapper exists.
188
- */
189
- toExist(wrapper: ComponentWrapper | ElementWrapper | null): unknown;
190
- /**
191
- * Check if event was emitted.
192
- */
193
- toHaveEmitted(wrapper: ComponentWrapper, event: string, times?: number): unknown;
194
- /**
195
- * Check if event was emitted with payload.
196
- */
197
- toHaveEmittedWith(wrapper: ComponentWrapper, event: string, payload: unknown): (boolean { const emitted?) if (!emitted) return false return emitted.some((args)) => unknown
198
- };
180
+ export declare const toHaveEmittedWith: unknown;
199
181
  /** Mount options */
200
182
  export declare interface MountOptions {
201
183
  props?: Record<string, unknown>
@@ -220,8 +202,8 @@ export declare interface ComponentWrapper {
220
202
  element: HTMLElement
221
203
  html(): string
222
204
  text(): string
223
- find(selector: string): ElementWrapper<T> | null
224
- findAll(selector: string): ElementWrapper<T>[]
205
+ find<T extends HTMLElement = HTMLElement>(selector: string): ElementWrapper<T> | null
206
+ findAll<T extends HTMLElement = HTMLElement>(selector: string): ElementWrapper<T>[]
225
207
  findComponent(name: string): ComponentWrapper | null
226
208
  findAllComponents(name: string): ComponentWrapper[]
227
209
  exists(): boolean
@@ -231,7 +213,7 @@ export declare interface ComponentWrapper {
231
213
  classes(): string[]
232
214
  classes(name: string): boolean
233
215
  props(): Record<string, unknown>
234
- props(name: string): T | undefined
216
+ props<T = unknown>(name: string): T | undefined
235
217
  emitted(): Record<string, unknown[][]>
236
218
  emitted(event: string): unknown[][] | undefined
237
219
  setProps(props: Record<string, unknown>): Promise<void>
@@ -249,8 +231,8 @@ export declare interface ElementWrapper<T extends HTMLElement = HTMLElement> {
249
231
  element: T
250
232
  html(): string
251
233
  text(): string
252
- find(selector: string): ElementWrapper<E> | null
253
- findAll(selector: string): ElementWrapper<E>[]
234
+ find<E extends HTMLElement = HTMLElement>(selector: string): ElementWrapper<E> | null
235
+ findAll<E extends HTMLElement = HTMLElement>(selector: string): ElementWrapper<E>[]
254
236
  exists(): boolean
255
237
  isVisible(): boolean
256
238
  attributes(): Record<string, string>
@@ -286,4 +268,4 @@ export declare interface MockStore<T extends Record<string, unknown>> {
286
268
  reset(): void
287
269
  getHistory(): T[]
288
270
  subscribe(listener: (state: T) => void): () => void
289
- }
271
+ }
@@ -84,4 +84,4 @@ export declare interface TransitionState {
84
84
  isEntering: boolean
85
85
  isLeaving: boolean
86
86
  isCancelled: boolean
87
- }
87
+ }
@@ -72,38 +72,14 @@ export type PrimitiveType = | 'string'
72
72
  | 'any'
73
73
  | 'unknown'
74
74
  | 'void'
75
- | 'never'
75
+ | 'never';
76
76
  /**
77
77
  * Template Type Checker class
78
78
  */
79
79
  export declare class TemplateTypeChecker {
80
- private options: TypeCheckerOptions;
81
- private variables: Map<string, TypeDefinition>;
82
- private errors: TypeCheckError[];
83
- private warnings: TypeCheckError[];
84
- private currentFile: string;
85
80
  constructor(options?: TypeCheckerOptions);
86
81
  checkFile(filePath: string): TypeCheckResult;
87
82
  checkTemplate(template: string, filePath?: string): TypeCheckResult;
88
- private analyzeScript(script: string, scriptOffset: number): void;
89
- private extractTypedVariables(line: string, lineNum: number): void;
90
- private extractInterfaces(line: string, lines: string[], index: number, lineNum: number): void;
91
- private extractTypeAliases(line: string, lineNum: number): void;
92
- private parseTypeAnnotation(annotation: string): TypeDefinition;
93
- private inferType(value: string): TypeDefinition;
94
- private parseParams(paramsStr: string): Array<{ name: string, type: TypeDefinition, optional?: boolean }>;
95
- private checkExpressions(template: string): void;
96
- private checkExpression(expression: string, line: number, column: number): void;
97
- private checkDirectives(template: string): void;
98
- private resolvePropertyAccess(expr: string): TypeDefinition;
99
- private isLiteral(expr: string): boolean;
100
- private extractObjectLiteral(expr: string): Record<string, string>;
101
- private splitByComma(str: string): string[];
102
- private getLineNumber(position: number, template?: string): number;
103
- private getColumn(position: number, template: string): number;
104
- private addError(message: string, line: number, column: number, expression: string, expected?: string, received?: string): void;
105
- private addWarning(message: string, line: number, column: number, expression: string, expected?: string, received?: string): void;
106
- private getResult(): TypeCheckResult;
107
83
  addVariable(name: string, type: TypeDefinition): void;
108
84
  reset(): void;
109
- }
85
+ }
@@ -20,7 +20,7 @@ export declare interface PropDefinition {
20
20
  * ```
21
21
  */
22
22
  export declare interface ComponentPropsSchema {
23
-
23
+ [propName: string]: PropDefinition
24
24
  }
25
25
  /**
26
26
  * Component definition with metadata
@@ -122,8 +122,8 @@ export declare interface DocGeneratorConfig {
122
122
  /**
123
123
  * Prop type definition for component prop validation
124
124
  */
125
- export type PropType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'function' | 'any'
125
+ export type PropType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'function' | 'any';
126
126
  /**
127
127
  * Documentation format options
128
128
  */
129
- export type DocFormat = 'markdown' | 'html' | 'json'
129
+ export type DocFormat = 'markdown' | 'html' | 'json';
@@ -118,57 +118,35 @@ export declare interface AnalyticsConfig {
118
118
  enabled: boolean
119
119
  driver: AnalyticsDriver
120
120
  fathom?: {
121
- /** Fathom site ID */
122
121
  siteId: string
123
- /** Custom script URL (default: https://cdn.usefathom.com/script.js) */
124
122
  scriptUrl?: string
125
- /** Honor Do Not Track browser setting */
126
123
  honorDnt?: boolean
127
- /** Defer script loading (default: true) */
128
124
  defer?: boolean
129
- /** Enable SPA mode for client-side routing */
130
125
  spa?: boolean
131
- /** Canonical URL override */
132
126
  canonical?: string
133
- /** Auto-track page views (default: true) */
134
127
  auto?: boolean
135
128
  }
136
129
  googleAnalytics?: {
137
- /** GA4 Measurement ID (e.g., G-XXXXXXXXXX) */
138
130
  measurementId: string
139
- /** Enable debug mode */
140
131
  debug?: boolean
141
132
  }
142
133
  plausible?: {
143
- /** Your domain (e.g., example.com) */
144
134
  domain: string
145
- /** Custom script URL (default: https://plausible.io/js/script.js) */
146
135
  scriptUrl?: string
147
- /** Track localhost */
148
136
  trackLocalhost?: boolean
149
- /** Enable hash-based routing */
150
137
  hashMode?: boolean
151
138
  }
152
139
  selfHosted?: {
153
- /** Site ID for tracking */
154
140
  siteId: string
155
- /** API endpoint URL for collecting analytics */
156
141
  apiEndpoint: string
157
- /** Honor Do Not Track browser setting */
158
142
  honorDnt?: boolean
159
- /** Track hash changes as page views */
160
143
  trackHashChanges?: boolean
161
- /** Track outbound link clicks */
162
144
  trackOutboundLinks?: boolean
163
145
  }
164
146
  custom?: {
165
- /** Custom script URL */
166
147
  scriptUrl: string
167
- /** Script ID attribute */
168
148
  scriptId?: string
169
- /** Additional script attributes */
170
149
  attributes?: Record<string, string>
171
- /** Inline script content (instead of external URL) */
172
150
  inlineScript?: string
173
151
  }
174
152
  }
@@ -221,18 +199,23 @@ export declare interface MarkdownConfig {
221
199
  */
222
200
  export declare interface FormConfig {
223
201
  classes?: {
224
- /** Class for text inputs, textareas, and selects */
225
202
  input?: string
226
- /** Class added to inputs with validation errors */
227
203
  inputError?: string
228
- /** Class for checkboxes and radios */
229
204
  checkInput?: string
230
- /** Class for labels */
231
205
  label?: string
232
- /** Class for error message containers */
233
206
  errorFeedback?: string
234
207
  }
235
208
  }
209
+ /**
210
+ * Strict mode configuration for DOM API validation.
211
+ * When enabled, stx warns (or errors) when client scripts use raw browser APIs
212
+ * instead of framework composables.
213
+ */
214
+ export declare interface StrictModeConfig {
215
+ enabled: boolean
216
+ failOnViolation?: boolean
217
+ allowPatterns?: string[]
218
+ }
236
219
  /**
237
220
  * stx configuration options
238
221
  */
@@ -241,6 +224,7 @@ export declare interface StxConfig {
241
224
  defaultTitle?: string
242
225
  defaultDescription?: string
243
226
  defaultImage?: string
227
+ ssr?: boolean
244
228
  cache?: boolean
245
229
  cacheDir?: string
246
230
  cacheVersion?: string
@@ -276,6 +260,7 @@ export declare interface StxConfig {
276
260
  heatmap?: Partial<HeatmapConfig>
277
261
  build?: Partial<BuildConfig>
278
262
  media?: Partial<MediaConfig>
263
+ strict?: boolean | StrictModeConfig
279
264
  }
280
265
  /**
281
266
  * SSG Build configuration for static site generation
@@ -300,7 +285,7 @@ export declare interface BuildConfig {
300
285
  /**
301
286
  * Analytics driver type
302
287
  */
303
- export type AnalyticsDriver = 'fathom' | 'google-analytics' | 'plausible' | 'self-hosted' | 'custom'
288
+ export type AnalyticsDriver = 'fathom' | 'google-analytics' | 'plausible' | 'self-hosted' | 'custom';
304
289
  /**
305
290
  * Available syntax highlighting themes
306
291
  */
@@ -332,5 +317,5 @@ export type SyntaxHighlightTheme = | 'css-variables'
332
317
  | 'solarized-dark'
333
318
  | 'solarized-light'
334
319
  | 'vitesse-dark'
335
- | 'vitesse-light'
336
- export type StxOptions = Partial<StxConfig>
320
+ | 'vitesse-light';
321
+ export type StxOptions = Partial<StxConfig>;