@stacksjs/stx 0.2.5 → 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
@@ -37,4 +37,4 @@ export declare interface NetworkState {
37
37
  }
38
38
  export declare interface NetworkRef extends NetworkState {
39
39
  subscribe: (callback: (state: NetworkState) => void) => () => void
40
- }
40
+ }
@@ -16,6 +16,15 @@ export declare function canNotify(): boolean;
16
16
  export declare function requestNotificationPermission(): Promise<NotificationPermission>;
17
17
  /**
18
18
  * Show notification with common patterns
19
+ * @defaultValue
20
+ * ```ts
21
+ * {
22
+ * success: (message: string, options?: NotificationOptions) => unknown,
23
+ * error: (message: string, options?: NotificationOptions) => unknown,
24
+ * warning: (message: string, options?: NotificationOptions) => unknown,
25
+ * info: (message: string, options?: NotificationOptions) => unknown
26
+ * }
27
+ * ```
19
28
  */
20
29
  export declare const notifications: {
21
30
  /** Success notification */
@@ -86,4 +95,4 @@ export declare interface NotificationRef {
86
95
  * })
87
96
  * ```
88
97
  */
89
- export type NotificationPermission = 'default' | 'granted' | 'denied'
98
+ export type NotificationPermission = 'default' | 'granted' | 'denied';
@@ -32,13 +32,23 @@ export declare function hasNotificationPermission(): Promise<boolean>;
32
32
  export declare function requestMediaPermissions(options?: { video?: boolean; audio?: boolean }): Promise<{ granted: boolean; stream?: MediaStream; error?: Error }>;
33
33
  /**
34
34
  * Common permission groups
35
+ * @defaultValue
36
+ * ```ts
37
+ * {
38
+ * media: ['camera', 'microphone'] as PermissionName[],
39
+ * location: ['geolocation'] as PermissionName[],
40
+ * notifications: ['notifications', 'push'] as PermissionName[],
41
+ * sensors: ['accelerometer', 'gyroscope', 'magnetometer'] as PermissionName[],
42
+ * clipboard: ['clipboard-read', 'clipboard-write'] as PermissionName[]
43
+ * }
44
+ * ```
35
45
  */
36
46
  export declare const permissionGroups: {
37
- media: readonly ['camera', unknown];
38
- location: readonly [unknown];
39
- notifications: readonly ['notifications', unknown];
40
- sensors: readonly ['accelerometer', 'gyroscope', unknown];
41
- clipboard: readonly ['clipboard-read', unknown]
47
+ media: (string | unknown)[];
48
+ location: unknown[];
49
+ notifications: (string | unknown)[];
50
+ sensors: (string | unknown)[];
51
+ clipboard: (string | unknown)[]
42
52
  };
43
53
  export declare interface PermissionStatus {
44
54
  state: PermissionState
@@ -105,5 +115,5 @@ export type PermissionName = | 'accelerometer'
105
115
  | 'speaker-selection'
106
116
  | 'storage-access'
107
117
  | 'window-management'
108
- | 'xr-spatial-tracking'
109
- export type PermissionState = 'granted' | 'denied' | 'prompt'
118
+ | 'xr-spatial-tracking';
119
+ export type PermissionState = 'granted' | 'denied' | 'prompt';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * useQuery / useMutation - Data fetching composable types for STX
3
+ *
4
+ * Runtime implementations live in signals.ts. These are TypeScript interfaces
5
+ * and server-safe stubs.
6
+ */
7
+ export declare interface UseQueryOptions<T = unknown> {
8
+ initialData?: T
9
+ staleTime?: number
10
+ cacheTime?: number
11
+ cacheKey?: string
12
+ headers?: Record<string, string>
13
+ transform?: (data: unknown) => T
14
+ refetchOnFocus?: boolean
15
+ refetchInterval?: number
16
+ immediate?: boolean
17
+ onSuccess?: (data: T) => void
18
+ onError?: (error: Error) => void
19
+ }
20
+ export declare interface UseQueryResult<T = unknown> {
21
+ data: { (): T | null, set: (v: T | null) => void }
22
+ loading: { (): boolean, set: (v: boolean) => void }
23
+ error: { (): string | null, set: (v: string | null) => void }
24
+ isStale: { (): boolean, set: (v: boolean) => void }
25
+ refetch: () => Promise<void>
26
+ invalidate: () => Promise<void>
27
+ }
28
+ export declare interface UseMutationOptions<T = unknown> {
29
+ method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE'
30
+ headers?: Record<string, string>
31
+ transform?: (data: unknown) => T
32
+ optimisticData?: T | ((body: unknown) => T)
33
+ invalidateQueries?: string[]
34
+ onSuccess?: (data: T) => void
35
+ onError?: (error: Error) => void
36
+ }
37
+ export declare interface UseMutationResult<T = unknown> {
38
+ data: { (): T | null, set: (v: T | null) => void }
39
+ loading: { (): boolean, set: (v: boolean) => void }
40
+ error: { (): string | null, set: (v: string | null) => void }
41
+ mutate: (body?: unknown) => Promise<T>
42
+ reset: () => void
43
+ }
@@ -57,4 +57,4 @@ export declare interface ResizeObserverRef {
57
57
  observe: () => void
58
58
  disconnect: () => void
59
59
  isSupported: () => boolean
60
- }
60
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Navigate to a URL. Uses stxRouter if available, otherwise falls back to location.href.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * navigate('/about')
7
+ * navigate('https://example.com')
8
+ * ```
9
+ */
10
+ export declare function navigate(url: string): void;
11
+ /**
12
+ * Go back in browser history.
13
+ */
14
+ export declare function goBack(): void;
15
+ /**
16
+ * Go forward in browser history.
17
+ */
18
+ export declare function goForward(): void;
19
+ /**
20
+ * Get reactive route information.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const route = useRoute()
25
+ * console.log(route.path) // '/about'
26
+ * console.log(route.query) // { page: '2' }
27
+ * ```
28
+ */
29
+ export declare function useRoute(): RouteInfo;
30
+ /**
31
+ * Reactive URL search parameters with get/set/setAll methods.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const search = useSearchParams()
36
+ * search.set('page', '2')
37
+ * console.log(search.get('page')) // '2'
38
+ * ```
39
+ */
40
+ export declare function useSearchParams(): SearchParamsRef;
41
+ /**
42
+ * useRouter - Navigation composable for STX applications
43
+ *
44
+ * Provides clean APIs for navigation without raw `window.location` or `window.history`.
45
+ * These are server-safe stubs; the actual runtime implementations live in signals.ts.
46
+ */
47
+ export declare interface RouteInfo {
48
+ path: string
49
+ fullPath: string
50
+ hash: string
51
+ query: Record<string, string>
52
+ params: Record<string, string>
53
+ }
54
+ export declare interface SearchParamsRef {
55
+ data: { (): Record<string, string>, set: (v: Record<string, string>) => void }
56
+ get: (key: string) => string | undefined
57
+ set: (key: string, value: string) => void
58
+ setAll: (obj: Record<string, string>) => void
59
+ }
@@ -67,4 +67,4 @@ export declare interface ShareRef {
67
67
  isFileShareSupported: () => boolean
68
68
  canShare: (data?: ShareData) => boolean
69
69
  share: (data: ShareData) => Promise<ShareResult>
70
- }
70
+ }
@@ -114,4 +114,4 @@ export declare interface SpeechSynthesisRef {
114
114
  getVoices: () => SpeechSynthesisVoice[]
115
115
  isSupported: () => boolean
116
116
  on: (event: 'start' | 'end' | 'pause' | 'resume' | 'error', callback: (data?: any) => void) => () => void
117
- }
117
+ }
@@ -61,4 +61,4 @@ export declare interface StorageRef<T> {
61
61
  * Similar to Nuxt's useStorage but for STX applications.
62
62
  * Provides a reactive, type-safe wrapper around Web Storage APIs.
63
63
  */
64
- export type StorageType = 'local' | 'session'
64
+ export type StorageType = 'local' | 'session';
@@ -94,4 +94,4 @@ export declare interface TextSelectionRef {
94
94
  clear: () => void
95
95
  selectAll: (element?: Element) => void
96
96
  getRects: () => DOMRect[]
97
- }
97
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Wrap a function so it is only invoked after `delay` ms of inactivity.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const save = useDebounce(() => api.save(form), 300)
7
+ * save() // debounced
8
+ * save.cancel() // abort pending
9
+ * save.flush() // fire immediately
10
+ * ```
11
+ */
12
+ export declare function useDebounce<T extends (...args: any[]) => any>(fn: T, delay?: number): DebouncedFn<T>;
13
+ /**
14
+ * Create a debounced read-only value that updates after `delay` ms of inactivity.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const debouncedSearch = useDebouncedValue(() => searchInput.value, 300)
19
+ * debouncedSearch.subscribe(val => console.log('Searching:', val))
20
+ * ```
21
+ */
22
+ export declare function useDebouncedValue<T>(getter: () => T, delay?: number): DebouncedValueRef<T>;
23
+ /**
24
+ * Wrap a function so it fires at most once every `limit` ms.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const onScroll = useThrottle(() => recalcLayout(), 100)
29
+ * window.addEventListener('scroll', onScroll)
30
+ * ```
31
+ */
32
+ export declare function useThrottle<T extends (...args: any[]) => any>(fn: T, limit?: number): ThrottledFn<T>;
33
+ /**
34
+ * Reactive interval that auto-cleans up.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const { counter, pause, resume, reset } = useInterval(1000)
39
+ * // counter increments every second
40
+ * ```
41
+ */
42
+ export declare function useInterval(interval?: number, options?: IntervalOptions): IntervalRef;
43
+ /**
44
+ * One-shot timeout with start/stop control and auto-cleanup.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const { isPending, start, stop } = useTimeout(() => showToast(), 3000)
49
+ * start() // begin countdown
50
+ * stop() // cancel
51
+ * ```
52
+ */
53
+ export declare function useTimeout(callback: () => void, delay?: number): TimeoutRef;
54
+ /**
55
+ * useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout
56
+ *
57
+ * Timer composables with auto-cleanup via onDestroy.
58
+ * SSR-safe — all functions return no-op stubs when `window` is unavailable.
59
+ */
60
+ // =============================================================================
61
+ // Types
62
+ // =============================================================================
63
+ export declare interface DebouncedFn<T extends (...args: any[]) => any> {
64
+ (...args: Parameters<T>): void
65
+ cancel: () => void
66
+ flush: () => void
67
+ pending: () => boolean
68
+ }
69
+ export declare interface ThrottledFn<T extends (...args: any[]) => any> {
70
+ (...args: Parameters<T>): void
71
+ cancel: () => void
72
+ }
73
+ export declare interface DebouncedValueRef<T> {
74
+ readonly value: T
75
+ subscribe: (fn: (value: T) => void) => () => void
76
+ }
77
+ export declare interface IntervalOptions {
78
+ immediate?: boolean
79
+ }
80
+ export declare interface IntervalRef {
81
+ readonly counter: number
82
+ pause: () => void
83
+ resume: () => void
84
+ reset: () => void
85
+ subscribe: (fn: (counter: number) => void) => () => void
86
+ }
87
+ export declare interface TimeoutRef {
88
+ readonly isPending: boolean
89
+ start: () => void
90
+ stop: () => void
91
+ subscribe: (fn: (isPending: boolean) => void) => () => void
92
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Boolean toggle with reactive subscription.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const [open, toggle, setOpen] = useToggle(false)
7
+ * toggle() // true
8
+ * setOpen(false) // false
9
+ * open.subscribe(v => console.log('open:', v))
10
+ * ```
11
+ */
12
+ export declare function useToggle(initial?: boolean): [ToggleRef, () => void, (v: boolean) => void];
13
+ /**
14
+ * Numeric counter with min/max bounds.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const counter = useCounter(0, { min: 0, max: 10 })
19
+ * counter.inc() // 1
20
+ * counter.dec(3) // 0 (clamped to min)
21
+ * counter.set(5) // 5
22
+ * counter.reset() // 0
23
+ * ```
24
+ */
25
+ export declare function useCounter(initial?: number, options?: CounterOptions): CounterRef;
26
+ /**
27
+ * Run a handler when clicking outside a target element.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * useClickOutside('#dropdown', () => closeDropdown())
32
+ * useClickOutside(menuElement, () => closeMenu())
33
+ * ```
34
+ */
35
+ export declare function useClickOutside(target: string | Element, handler: (event: MouseEvent) => void): ClickOutsideRef;
36
+ /**
37
+ * Track and control focus state of an element.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const { isFocused, focus, blur } = useFocus('#search-input')
42
+ * focus()
43
+ * ```
44
+ */
45
+ export declare function useFocus(target: string | Element): FocusRef;
46
+ /**
47
+ * Wrap an async function with reactive loading/error/data state.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const { data, isLoading, error, execute } = useAsync(
52
+ * () => fetch('/api/users').then(r => r.json()),
53
+ * { immediate: true }
54
+ * )
55
+ * ```
56
+ */
57
+ export declare function useAsync<T>(fn: (...args: any[]) => Promise<T>, options?: AsyncOptions): AsyncRef<T>;
58
+ /**
59
+ * useToggle, useCounter, useClickOutside, useFocus, useAsync
60
+ *
61
+ * General-purpose utility composables with auto-cleanup.
62
+ * SSR-safe — DOM-dependent composables return no-op stubs when `window` is unavailable.
63
+ */
64
+ // =============================================================================
65
+ // Types
66
+ // =============================================================================
67
+ export declare interface ToggleRef {
68
+ readonly value: boolean
69
+ subscribe: (fn: (value: boolean) => void) => () => void
70
+ }
71
+ export declare interface CounterOptions {
72
+ min?: number
73
+ max?: number
74
+ }
75
+ export declare interface CounterRef {
76
+ readonly count: number
77
+ inc: (step?: number) => void
78
+ dec: (step?: number) => void
79
+ set: (value: number) => void
80
+ reset: () => void
81
+ subscribe: (fn: (count: number) => void) => () => void
82
+ }
83
+ export declare interface ClickOutsideRef {
84
+ remove: () => void
85
+ }
86
+ export declare interface FocusRef {
87
+ readonly isFocused: boolean
88
+ focus: () => void
89
+ blur: () => void
90
+ subscribe: (fn: (isFocused: boolean) => void) => () => void
91
+ }
92
+ export declare interface AsyncRef<T> {
93
+ readonly state: AsyncState
94
+ readonly isLoading: boolean
95
+ readonly error: Error | null
96
+ readonly data: T | null
97
+ execute: (...args: any[]) => Promise<T | null>
98
+ subscribe: (fn: (snapshot: { state: AsyncState, data: T | null, error: Error | null }) => void) => () => void
99
+ }
100
+ export declare interface AsyncOptions {
101
+ immediate?: boolean
102
+ }
103
+ export type AsyncState = 'idle' | 'loading' | 'success' | 'error';
@@ -82,4 +82,4 @@ export declare interface WakeLockRef {
82
82
  toggle: () => Promise<boolean>
83
83
  isSupported: () => boolean
84
84
  isActive: () => boolean
85
- }
85
+ }
@@ -64,6 +64,6 @@ export declare interface WebSocketRef<T = unknown> {
64
64
  *
65
65
  * Reactive utilities for WebSocket communication with auto-reconnect support.
66
66
  */
67
- export type WebSocketStatus = 'connecting' | 'open' | 'closing' | 'closed'
68
- declare type WebSocketEventType = 'open' | 'message' | 'close' | 'error'
69
- declare type WebSocketEventCallback = (event: Event | MessageEvent | CloseEvent) => void
67
+ export type WebSocketStatus = 'connecting' | 'open' | 'closing' | 'closed';
68
+ declare type WebSocketEventType = 'open' | 'message' | 'close' | 'error';
69
+ declare type WebSocketEventCallback = (event: Event | MessageEvent | CloseEvent) => void;
@@ -81,4 +81,4 @@ export declare interface ScrollRef extends ScrollPosition {
81
81
  export declare interface VisibilityRef {
82
82
  isVisible: boolean
83
83
  subscribe: (callback: (visible: boolean) => void) => () => void
84
- }
84
+ }
@@ -190,7 +190,6 @@ export declare function provide<T>(key: string | InjectionKey<T>, value: T): voi
190
190
  */
191
191
  export declare function inject<T>(key: string | InjectionKey<T>): T | undefined;
192
192
  export declare function inject<T>(key: string | InjectionKey<T>, defaultValue: T): T;
193
- export declare function inject<T>(key: string | InjectionKey<T>, defaultValue?: T): T | undefined;
194
193
  /**
195
194
  * Create a new injection scope.
196
195
  * Called internally when entering a component.
@@ -234,7 +233,7 @@ export declare const I18nKey: (createInjectionKey<{
234
233
  t: (key: string)) => unknown;
235
234
  export declare interface Ref<T> {
236
235
  value: T | null
237
- current: T | null
236
+ readonly current: T | null
238
237
  }
239
238
  export declare interface ComponentInstance {
240
239
  id: string
@@ -259,10 +258,14 @@ export declare interface ComponentInstance {
259
258
  // =============================================================================
260
259
  // Types
261
260
  // =============================================================================
262
- export type LifecycleHook = () => void | (() => void)
263
- export type CleanupFn = () => void
264
- export type WatchCallback<T> = (newValue: T, oldValue: T | undefined) => void | CleanupFn
265
- export type WatchSource<T> = () => T
261
+ export type LifecycleHook = () => void | (() => void);
262
+ export type CleanupFn = () => void;
263
+ export type WatchCallback<T> = (newValue: T, oldValue: T | undefined) => void | CleanupFn;
264
+ export type WatchSource<T> = () => T;
266
265
  /** Symbol for injection keys */
267
266
  export type InjectionKey<T> = symbol & { __type?: T }
268
- export { ref as createRef };
267
+ // =============================================================================
268
+ // Export helpers for client-side usage
269
+ // =============================================================================
270
+ // Re-export for convenient importing
271
+ export { ref as createRef };
@@ -158,19 +158,6 @@ export declare function createProvideContext(parentContext: Record<string, any>)
158
158
  * @internal
159
159
  */
160
160
  export declare function generateCompositionRuntime(): string;
161
- /**
162
- * STX Composition API
163
- *
164
- * Provides Vue-compatible Composition API features:
165
- * - provide() / inject() for dependency injection across components
166
- * - defineEmits() for typed event emission
167
- * - defineExpose() for exposing component internals to template refs
168
- * - nextTick() for waiting on DOM updates
169
- * - getCurrentInstance() for accessing the current component instance
170
- * - onErrorCaptured() for error boundary handling
171
- *
172
- * @module composition-api
173
- */
174
161
  /** Represents a component instance in the stx component tree */
175
162
  export declare interface StxComponentInstance {
176
163
  scopeId: string
@@ -187,4 +174,4 @@ export declare interface StxComponentInstance {
187
174
  isMounted: boolean
188
175
  }
189
176
  /** Type-safe emit function */
190
- export type EmitFn<T extends string = string> = (event: T, ...args: any[]) => void
177
+ export type EmitFn<T extends string = string> = (event: T, ...args: any[]) => void;
@@ -23,7 +23,6 @@ export declare function shallowRef<T>(initialValue: T): Ref<T>;
23
23
  */
24
24
  export declare function computed<T>(getter: () => T): ComputedRef<T>;
25
25
  export declare function computed<T>(options: ComputedOptions<T>): WritableComputedRef<T>;
26
- export declare function computed<T>(getterOrOptions: (() => T) | ComputedOptions<T>): ComputedRef<T> | WritableComputedRef<T>;
27
26
  /**
28
27
  * Watch a reactive source and run a callback when it changes
29
28
  */
@@ -84,8 +83,8 @@ export declare interface Ref<T> {
84
83
  }
85
84
  export declare interface ComputedRef<T> extends Ref<T> {
86
85
  invalidate: () => void
87
- dirty: boolean
88
- deps: Set<Ref<unknown>>
86
+ readonly dirty: boolean
87
+ readonly deps: Set<Ref<unknown>>
89
88
  }
90
89
  export declare interface WritableComputedRef<T> extends ComputedRef<T> {
91
90
  value: T
@@ -107,6 +106,10 @@ export declare interface WatchStopHandle {
107
106
  pause: () => void
108
107
  resume: () => void
109
108
  }
109
+ // ============================================================================
110
+ // Aliased Exports (to avoid conflicts with other modules)
111
+ // ============================================================================
112
+ // Export with 'stx' prefix to avoid naming conflicts
110
113
  export {
111
114
  ref as stxRef,
112
115
  computed as stxComputed,
@@ -120,6 +123,9 @@ export {
120
123
  debouncedComputed as stxDebouncedComputed,
121
124
  throttledComputed as stxThrottledComputed,
122
125
  };
126
+ // ============================================================================
127
+ // Exports
128
+ // ============================================================================
123
129
  export default {
124
130
  ref,
125
131
  computed,
@@ -134,4 +140,4 @@ export default {
134
140
  throttledComputed,
135
141
  processComputedDirectives,
136
142
  processWatchDirectives,
137
- };
143
+ };
@@ -29,4 +29,4 @@ export declare function processIssetEmptyDirectives(template: string, context: R
29
29
  /**
30
30
  * Process @env directive to conditionally render content based on environment
31
31
  */
32
- export declare function processEnvDirective(template: string, _context: Record<string, any>, _filePath?: string): string;
32
+ export declare function processEnvDirective(template: string, _context: Record<string, any>, _filePath?: string): string;
package/dist/config.d.ts CHANGED
@@ -38,4 +38,4 @@ export declare interface ConfigValidationResult {
38
38
  valid: boolean
39
39
  errors: ConfigValidationError[]
40
40
  warnings: ConfigValidationError[]
41
- }
41
+ }
@@ -316,4 +316,4 @@ export declare interface CraftBridgeConfig {
316
316
  timeout?: number
317
317
  enableOfflineQueue?: boolean
318
318
  }
319
- export default craftBridge;
319
+ export default craftBridge;
@@ -211,11 +211,11 @@ export declare interface HotReloadConfig {
211
211
  /**
212
212
  * Target platform for compilation
213
213
  */
214
- export type CompilationTarget = 'macos' | 'windows' | 'linux' | 'ios' | 'android' | 'universal'
214
+ export type CompilationTarget = 'macos' | 'windows' | 'linux' | 'ios' | 'android' | 'universal';
215
215
  /**
216
216
  * Output format for compiled code
217
217
  */
218
- export type CompilationFormat = 'zig' | 'typescript' | 'json' | 'binary'
218
+ export type CompilationFormat = 'zig' | 'typescript' | 'json' | 'binary';
219
219
  /**
220
220
  * IR value types
221
221
  */
@@ -223,7 +223,10 @@ export type IRValue = | { type: 'literal'; value: string | number | boolean }
223
223
  | { type: 'binding'; path: string }
224
224
  | { type: 'expression'; code: string }
225
225
  | { type: 'callback'; handler: string }
226
+ // ============================================================================
227
+ // Exports
228
+ // ============================================================================
226
229
  export {
227
230
  NATIVE_COMPONENTS,
228
231
  };
229
- export default craftCompiler;
232
+ export default craftCompiler;
@@ -14,7 +14,6 @@ export declare function getCraftComponents(): Record<string, CraftComponentDefin
14
14
  * Built-in Craft component definitions
15
15
  */
16
16
  export declare const CRAFT_COMPONENTS: {
17
- // Input Components
18
17
  button: {
19
18
  nativeType: 'craft-button';
20
19
  fallbackTag: 'button';
@@ -47,7 +46,6 @@ export declare const CRAFT_COMPONENTS: {
47
46
  nativeProps: readonly ['value', 'disabled', 'options', 'placeholder']
48
47
  };
49
48
  slider: { nativeType: 'craft-slider'; fallbackTag: 'input'; fallbackClasses: 'craft-slider'; nativeProps: readonly ['value', 'min', 'max', 'step', 'disabled']; render: (props, _children) => unknown };
50
- // Display Components
51
49
  label: {
52
50
  nativeType: 'craft-label';
53
51
  fallbackTag: 'span';
@@ -63,7 +61,6 @@ export declare const CRAFT_COMPONENTS: {
63
61
  avatar: { nativeType: 'craft-avatar'; fallbackTag: 'div'; fallbackClasses: 'craft-avatar'; nativeProps: readonly ['src', 'alt', 'size', 'fallback']; render: (props, _children) => unknown };
64
62
  progress: { nativeType: 'craft-progress'; fallbackTag: 'div'; fallbackClasses: 'craft-progress'; nativeProps: readonly ['value', 'max', 'variant']; render: (props, _children) => unknown };
65
63
  spinner: { nativeType: 'craft-spinner'; fallbackTag: 'div'; fallbackClasses: 'craft-spinner'; nativeProps: readonly ['size']; render: (props, _children) => unknown };
66
- // Layout Components
67
64
  card: {
68
65
  nativeType: 'craft-card';
69
66
  fallbackTag: 'div';
@@ -84,7 +81,6 @@ export declare const CRAFT_COMPONENTS: {
84
81
  fallbackClasses: 'craft-divider';
85
82
  nativeProps: readonly ['orientation', 'variant']
86
83
  };
87
- // Data Components
88
84
  table: {
89
85
  nativeType: 'craft-table';
90
86
  fallbackTag: 'table';
@@ -103,7 +99,6 @@ export declare const CRAFT_COMPONENTS: {
103
99
  fallbackClasses: 'craft-tree';
104
100
  nativeProps: readonly ['nodes', 'expandable', 'selectable']
105
101
  };
106
- // Feedback Components
107
102
  alert: { nativeType: 'craft-alert'; fallbackTag: 'div'; fallbackClasses: 'craft-alert'; nativeProps: readonly ['variant', 'title', 'dismissible']; render: (props, children) => unknown };
108
103
  toast: {
109
104
  nativeType: 'craft-toast';
@@ -112,7 +107,6 @@ export declare const CRAFT_COMPONENTS: {
112
107
  nativeProps: readonly ['variant', 'duration', 'position']
113
108
  };
114
109
  tooltip: { nativeType: 'craft-tooltip'; fallbackTag: 'span'; fallbackClasses: 'craft-tooltip'; nativeProps: readonly ['content', 'position']; render: (props, children) => unknown };
115
- // Navigation Components
116
110
  menu: {
117
111
  nativeType: 'craft-menu';
118
112
  fallbackTag: 'nav';
@@ -131,7 +125,6 @@ export declare const CRAFT_COMPONENTS: {
131
125
  fallbackClasses: 'craft-pagination';
132
126
  nativeProps: readonly ['total', 'page', 'pageSize']
133
127
  };
134
- // Advanced Components
135
128
  'code-editor': {
136
129
  nativeType: 'craft-code-editor';
137
130
  fallbackTag: 'textarea';
@@ -408,4 +401,4 @@ export declare interface CraftComponentDefinition {
408
401
  nativeProps?: string[]
409
402
  render?: (props: Record<string, unknown>, children: string) => string
410
403
  }
411
- export default craftComponents;
404
+ export default craftComponents;
@@ -2,4 +2,4 @@ export * from './craft-bridge';
2
2
  export * from './craft-compiler';
3
3
  export * from './craft-components';
4
4
  export * from './craft-ssr';
5
- export * from './native-build';
5
+ export * from './native-build';
@@ -131,4 +131,4 @@ export declare interface NativeWidgetSuggestion {
131
131
  confidence: number
132
132
  reason: string
133
133
  }
134
- export default craftSSR;
134
+ export default craftSSR;