@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,81 @@
1
+ /**
2
+ * Observe element intersection with viewport or container
3
+ */
4
+ export declare function useIntersectionObserver(target: Element | (() => Element | null) | null, callback?: IntersectionCallback, options?: IntersectionObserverOptions): IntersectionObserverRef;
5
+ /**
6
+ * Simple visibility check - returns true when element is in viewport
7
+ */
8
+ export declare function useElementVisibility(target: Element | (() => Element | null) | null, options?: Omit<IntersectionObserverOptions, 'once'>): {
9
+ get: () => boolean
10
+ subscribe: (fn: (visible: boolean) => void) => () => void
11
+ };
12
+ /**
13
+ * Lazy load handler - triggers callback once when element becomes visible
14
+ */
15
+ export declare function useLazyLoad(target: Element | (() => Element | null) | null, onVisible: () => void, options?: Omit<IntersectionObserverOptions, 'once'>): { stop: () => void };
16
+ /**
17
+ * Infinite scroll handler - triggers callback when sentinel element is visible
18
+ */
19
+ export declare function useInfiniteScroll(sentinel: Element | (() => Element | null) | null, loadMore: () => void | Promise<void>, options?: IntersectionObserverOptions & {
20
+ /** Debounce time in ms */
21
+ debounce?: number
22
+ }): {
23
+ stop: () => void
24
+ start: () => void
25
+ isLoading: () => boolean
26
+ };
27
+ /**
28
+ * Track multiple elements' visibility
29
+ */
30
+ export declare function useIntersectionObserverMultiple(targets: Element[] | (() => Element[]), callback: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void, options?: Omit<IntersectionObserverOptions, 'once'>): {
31
+ stop: () => void
32
+ start: () => void
33
+ observe: (element: Element) => void
34
+ unobserve: (element: Element) => void
35
+ };
36
+ /**
37
+ * useIntersectionObserver - Reactive Intersection Observer API
38
+ *
39
+ * Track element visibility for lazy loading, infinite scroll, and animations.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // Basic visibility tracking
44
+ * const { isVisible, stop } = useIntersectionObserver(element)
45
+ *
46
+ * // Lazy loading images
47
+ * useIntersectionObserver(imgElement, (entry) => {
48
+ * if (entry.isIntersecting) {
49
+ * imgElement.src = imgElement.dataset.src
50
+ * }
51
+ * }, { once: true })
52
+ *
53
+ * // Infinite scroll
54
+ * useIntersectionObserver(sentinelElement, () => {
55
+ * loadMoreItems()
56
+ * }, { rootMargin: '100px' })
57
+ * ```
58
+ */
59
+ export declare interface IntersectionObserverOptions {
60
+ root?: Element | Document | null
61
+ rootMargin?: string
62
+ threshold?: number | number[]
63
+ once?: boolean
64
+ immediate?: boolean
65
+ }
66
+ export declare interface IntersectionState {
67
+ isIntersecting: boolean
68
+ intersectionRatio: number
69
+ boundingClientRect: DOMRectReadOnly | null
70
+ intersectionRect: DOMRectReadOnly | null
71
+ isVisible: boolean
72
+ entry: IntersectionObserverEntry | null
73
+ }
74
+ export declare interface IntersectionObserverRef {
75
+ get: () => IntersectionState
76
+ subscribe: (fn: (state: IntersectionState) => void) => () => void
77
+ isVisible: () => boolean
78
+ stop: () => void
79
+ start: () => void
80
+ }
81
+ declare type IntersectionCallback = (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Track keyboard state
3
+ */
4
+ export declare function useKeyboard(options?: KeyboardOptions): KeyboardRef;
5
+ /**
6
+ * Register a hotkey handler
7
+ */
8
+ export declare function useHotkey(hotkey: string | string[], callback: HotkeyCallback, options?: HotkeyOptions): () => void;
9
+ /**
10
+ * Check if a specific key is currently pressed
11
+ */
12
+ export declare function useKeyPressed(key: string, options?: KeyboardOptions): {
13
+ get: () => boolean
14
+ subscribe: (fn: (pressed: boolean) => void) => () => void
15
+ };
16
+ /**
17
+ * Detect key sequences (like Konami code)
18
+ */
19
+ export declare function useKeySequence(sequence: string[], callback: () => void, options?: { timeout?: number; target?: Window | HTMLElement | Document | null }): () => void;
20
+ /**
21
+ * Common keyboard shortcuts helper
22
+ */
23
+ export declare const shortcuts: {
24
+ save: 'ctrl+s';
25
+ undo: 'ctrl+z';
26
+ redo: 'ctrl+shift+z';
27
+ copy: 'ctrl+c';
28
+ paste: 'ctrl+v';
29
+ cut: 'ctrl+x';
30
+ selectAll: 'ctrl+a';
31
+ find: 'ctrl+f';
32
+ replace: 'ctrl+h';
33
+ newTab: 'ctrl+t';
34
+ closeTab: 'ctrl+w';
35
+ refresh: 'ctrl+r';
36
+ escape: 'escape';
37
+ enter: 'enter';
38
+ // Mac alternatives
39
+ saveMac: 'meta+s';
40
+ undoMac: 'meta+z';
41
+ redoMac: 'meta+shift+z';
42
+ copyMac: 'meta+c';
43
+ pasteMac: 'meta+v';
44
+ cutMac: 'meta+x'
45
+ };
46
+ /**
47
+ * useKeyboard - Reactive keyboard input tracking
48
+ *
49
+ * Track keyboard state, handle hotkeys, and manage keyboard shortcuts.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * // Track all keyboard state
54
+ * const keyboard = useKeyboard()
55
+ * keyboard.subscribe(state => {
56
+ * if (state.ctrl && state.pressed.has('s')) {
57
+ * console.log('Ctrl+S pressed!')
58
+ * }
59
+ * })
60
+ *
61
+ * // Simple hotkey
62
+ * useHotkey('ctrl+s', (e) => {
63
+ * e.preventDefault()
64
+ * save()
65
+ * })
66
+ *
67
+ * // Check if specific key is pressed
68
+ * const isSpacePressed = useKeyPressed('Space')
69
+ * ```
70
+ */
71
+ export declare interface KeyboardState {
72
+ pressed: Set<string>
73
+ lastKey: string | null
74
+ lastEvent: KeyboardEvent | null
75
+ ctrl: boolean
76
+ alt: boolean
77
+ shift: boolean
78
+ meta: boolean
79
+ timestamp: number
80
+ }
81
+ export declare interface KeyboardOptions {
82
+ target?: Window | HTMLElement | Document | null
83
+ capture?: boolean
84
+ passive?: boolean
85
+ }
86
+ export declare interface KeyboardRef {
87
+ get: () => KeyboardState
88
+ subscribe: (fn: (state: KeyboardState) => void) => () => void
89
+ isPressed: (key: string) => boolean
90
+ stop: () => void
91
+ }
92
+ export declare interface HotkeyOptions {
93
+ target?: Window | HTMLElement | Document | null
94
+ preventDefault?: boolean
95
+ stopPropagation?: boolean
96
+ ignoreRepeat?: boolean
97
+ keyup?: boolean
98
+ ignoreInputs?: boolean
99
+ }
100
+ declare type HotkeyCallback = (event: KeyboardEvent) => void
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Create a reactive media query
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const isDark = useMediaQuery('(prefers-color-scheme: dark)')
7
+ * const isMobile = useMediaQuery('(max-width: 768px)')
8
+ *
9
+ * isDark.subscribe((matches) => {
10
+ * console.log('Dark mode:', matches)
11
+ * })
12
+ * ```
13
+ */
14
+ export declare function useMediaQuery(query: string): MediaQueryRef;
15
+ /**
16
+ * Reactive dark mode preference
17
+ */
18
+ export declare function usePreferredDark(): MediaQueryRef;
19
+ /**
20
+ * Reactive light mode preference
21
+ */
22
+ export declare function usePreferredLight(): MediaQueryRef;
23
+ /**
24
+ * Reactive reduced motion preference
25
+ */
26
+ export declare function usePreferredReducedMotion(): MediaQueryRef;
27
+ /**
28
+ * Reactive contrast preference
29
+ */
30
+ export declare function usePreferredContrast(): MediaQueryRef;
31
+ /**
32
+ * Reactive breakpoint helpers
33
+ */
34
+ export declare function useBreakpoint(breakpoint: keyof typeof breakpoints): MediaQueryRef;
35
+ export declare function useIsMobile(): MediaQueryRef;
36
+ export declare function useIsTablet(): MediaQueryRef;
37
+ export declare function useIsDesktop(): MediaQueryRef;
38
+ /**
39
+ * Common breakpoints
40
+ */
41
+ export declare const breakpoints: {
42
+ sm: '(min-width: 640px)';
43
+ md: '(min-width: 768px)';
44
+ lg: '(min-width: 1024px)';
45
+ xl: '(min-width: 1280px)';
46
+ '2xl': '(min-width: 1536px)'
47
+ };
48
+ /**
49
+ * useMediaQuery - Reactive media query composable
50
+ *
51
+ * Provides reactive tracking of CSS media queries.
52
+ */
53
+ export declare interface MediaQueryRef {
54
+ matches: boolean
55
+ subscribe: (callback: (matches: boolean) => void) => () => void
56
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Track mouse position globally or within a target
3
+ */
4
+ export declare function useMouse(options?: MouseOptions): MouseRef;
5
+ /**
6
+ * Track mouse position relative to an element
7
+ */
8
+ export declare function useMouseInElement(element: HTMLElement | (() => HTMLElement | null) | null, options?: Omit<MouseOptions, 'target'>): ElementMouseRef;
9
+ /**
10
+ * Track pointer (unified mouse + touch + pen)
11
+ */
12
+ export declare function usePointer(options?: MouseOptions): MouseRef;
13
+ /**
14
+ * useMouse - Reactive mouse/pointer position tracking
15
+ *
16
+ * Track mouse position, movement, and button states.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const mouse = useMouse()
21
+ * mouse.subscribe(state => {
22
+ * console.log(`Mouse at ${state.x}, ${state.y}`)
23
+ * })
24
+ *
25
+ * // Track within a specific element
26
+ * const elementMouse = useMouseInElement(myElement)
27
+ * ```
28
+ */
29
+ export declare interface MouseState {
30
+ x: number
31
+ y: number
32
+ pageX: number
33
+ pageY: number
34
+ clientX: number
35
+ clientY: number
36
+ movementX: number
37
+ movementY: number
38
+ buttons: number
39
+ isPressed: boolean
40
+ isInside: boolean
41
+ }
42
+ export declare interface MouseOptions {
43
+ target?: Window | HTMLElement | null
44
+ touch?: boolean
45
+ resetOnLeave?: boolean
46
+ type?: 'page' | 'client' | 'screen' | 'movement'
47
+ }
48
+ export declare interface MouseRef {
49
+ get: () => MouseState
50
+ subscribe: (fn: (state: MouseState) => void) => () => void
51
+ stop: () => void
52
+ }
53
+ export declare interface ElementMouseState extends MouseState {
54
+ elementX: number
55
+ elementY: number
56
+ elementWidth: number
57
+ elementHeight: number
58
+ isOutside: boolean
59
+ }
60
+ export declare interface ElementMouseRef {
61
+ get: () => ElementMouseState
62
+ subscribe: (fn: (state: ElementMouseState) => void) => () => void
63
+ stop: () => void
64
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Check if MutationObserver is supported
3
+ */
4
+ export declare function isMutationObserverSupported(): boolean;
5
+ /**
6
+ * Create a reactive mutation observer
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const observer = useMutationObserver({
11
+ * attributes: true,
12
+ * childList: true,
13
+ * onMutate: (mutations) => {
14
+ * mutations.forEach(m => console.log('Mutation:', m.type))
15
+ * }
16
+ * })
17
+ *
18
+ * // Start observing an element
19
+ * observer.observe(document.getElementById('my-element'))
20
+ *
21
+ * // Subscribe to state changes
22
+ * observer.subscribe((state) => {
23
+ * console.log('Latest mutations:', state.mutations)
24
+ * })
25
+ *
26
+ * // Stop observing
27
+ * observer.disconnect()
28
+ * ```
29
+ */
30
+ export declare function useMutationObserver(options?: MutationObserverOptions): MutationObserverRef;
31
+ /**
32
+ * Watch for attribute changes on an element
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * useAttributeObserver(
37
+ * document.getElementById('my-element'),
38
+ * ['class', 'data-state'],
39
+ * (attr, oldValue, newValue) => {
40
+ * console.log(`${attr} changed from ${oldValue} to ${newValue}`)
41
+ * }
42
+ * )
43
+ * ```
44
+ */
45
+ export declare function useAttributeObserver(target: Element | null, attributeNames: string[], callback: (attributeName: string, oldValue: string | null, newValue: string | null) => void): () => void;
46
+ /**
47
+ * Watch for child node changes
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * useChildListObserver(
52
+ * document.getElementById('container'),
53
+ * (added, removed) => {
54
+ * console.log('Added:', added.length, 'Removed:', removed.length)
55
+ * }
56
+ * )
57
+ * ```
58
+ */
59
+ export declare function useChildListObserver(target: Element | null, callback: (added: Node[], removed: Node[]) => void, options?: { subtree?: boolean }): () => void;
60
+ /**
61
+ * Watch for text content changes
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * useTextObserver(
66
+ * document.getElementById('editable'),
67
+ * (oldText, newText) => {
68
+ * console.log(`Text changed from "${oldText}" to "${newText}"`)
69
+ * }
70
+ * )
71
+ * ```
72
+ */
73
+ export declare function useTextObserver(target: Element | null, callback: (oldText: string | null, newText: string) => void): () => void;
74
+ /**
75
+ * Mutation Observer Composables
76
+ *
77
+ * Reactive utilities for observing DOM mutations.
78
+ */
79
+ export declare interface MutationObserverState {
80
+ isSupported: boolean
81
+ isObserving: boolean
82
+ mutations: MutationRecord[]
83
+ }
84
+ export declare interface MutationObserverOptions {
85
+ attributes?: boolean
86
+ attributeFilter?: string[]
87
+ attributeOldValue?: boolean
88
+ characterData?: boolean
89
+ characterDataOldValue?: boolean
90
+ childList?: boolean
91
+ subtree?: boolean
92
+ onMutate?: (mutations: MutationRecord[]) => void
93
+ }
94
+ export declare interface MutationObserverRef {
95
+ get: () => MutationObserverState
96
+ subscribe: (fn: (state: MutationObserverState) => void) => () => void
97
+ observe: (target: Element | null) => void
98
+ disconnect: () => void
99
+ takeRecords: () => MutationRecord[]
100
+ isSupported: () => boolean
101
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Create a reactive network status tracker
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const network = useNetwork()
7
+ *
8
+ * network.subscribe((state) => {
9
+ * if (state.isOffline) {
10
+ * showOfflineMessage()
11
+ * }
12
+ * })
13
+ *
14
+ * if (network.effectiveType === '2g') {
15
+ * loadLowQualityImages()
16
+ * }
17
+ * ```
18
+ */
19
+ export declare function useNetwork(): NetworkRef;
20
+ /**
21
+ * Simple online/offline tracker
22
+ */
23
+ export declare function useOnline(): { isOnline: boolean; subscribe: (cb: (online: boolean) => void) => () => void };
24
+ /**
25
+ * useNetwork - Reactive network status composables
26
+ *
27
+ * Provides reactive tracking of network connectivity and information.
28
+ */
29
+ export declare interface NetworkState {
30
+ isOnline: boolean
31
+ isOffline: boolean
32
+ type: string | null
33
+ effectiveType: '2g' | '3g' | '4g' | 'slow-2g' | null
34
+ downlink: number | null
35
+ rtt: number | null
36
+ saveData: boolean
37
+ }
38
+ export declare interface NetworkRef extends NetworkState {
39
+ subscribe: (callback: (state: NetworkState) => void) => () => void
40
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Reactive notification controller
3
+ */
4
+ export declare function useNotification(): NotificationRef;
5
+ /**
6
+ * Simple notification helper
7
+ */
8
+ export declare function notify(title: string, options?: NotificationOptions): Promise<Notification | null>;
9
+ /**
10
+ * Check if notifications are supported and permitted
11
+ */
12
+ export declare function canNotify(): boolean;
13
+ /**
14
+ * Request notification permission
15
+ */
16
+ export declare function requestNotificationPermission(): Promise<NotificationPermission>;
17
+ /**
18
+ * Show notification with common patterns
19
+ */
20
+ export declare const notifications: {
21
+ /** Success notification */
22
+ success: (message: string, options?: NotificationOptions) => unknown;
23
+ /** Error notification */
24
+ error: (message: string, options?: NotificationOptions) => unknown;
25
+ /** Warning notification */
26
+ warning: (message: string, options?: NotificationOptions) => unknown;
27
+ /** Info notification */
28
+ info: (message: string, options?: NotificationOptions) => unknown
29
+ };
30
+ export declare interface NotificationState {
31
+ permission: NotificationPermission
32
+ isSupported: boolean
33
+ }
34
+ export declare interface NotificationOptions {
35
+ body?: string
36
+ icon?: string
37
+ badge?: string
38
+ image?: string
39
+ tag?: string
40
+ requireInteraction?: boolean
41
+ renotify?: boolean
42
+ silent?: boolean
43
+ vibrate?: number | number[]
44
+ data?: unknown
45
+ autoClose?: number
46
+ dir?: 'auto' | 'ltr' | 'rtl'
47
+ lang?: string
48
+ actions?: NotificationAction[]
49
+ timestamp?: number
50
+ }
51
+ export declare interface NotificationAction {
52
+ action: string
53
+ title: string
54
+ icon?: string
55
+ }
56
+ export declare interface NotificationRef {
57
+ get: () => NotificationState
58
+ subscribe: (fn: (state: NotificationState) => void) => () => void
59
+ isSupported: () => boolean
60
+ permission: () => NotificationPermission
61
+ requestPermission: () => Promise<NotificationPermission>
62
+ show: (title: string, options?: NotificationOptions) => Notification | null
63
+ close: (tag: string) => void
64
+ }
65
+ /**
66
+ * useNotification - Web Notifications API wrapper
67
+ *
68
+ * Display native browser notifications with reactive permission state.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const { permission, isSupported, show, requestPermission } = useNotification()
73
+ *
74
+ * // Request permission
75
+ * await requestPermission()
76
+ *
77
+ * // Show notification
78
+ * const notification = show('Hello!', {
79
+ * body: 'This is a notification',
80
+ * icon: '/icon.png',
81
+ * })
82
+ *
83
+ * // Handle click
84
+ * notification?.addEventListener('click', () => {
85
+ * window.focus()
86
+ * })
87
+ * ```
88
+ */
89
+ export type NotificationPermission = 'default' | 'granted' | 'denied'
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Query a single permission
3
+ */
4
+ export declare function usePermission(name: PermissionName): PermissionRef;
5
+ /**
6
+ * Query multiple permissions at once
7
+ */
8
+ export declare function usePermissions(names: PermissionName[]): MultiPermissionRef;
9
+ /**
10
+ * Check if a permission is granted
11
+ */
12
+ export declare function isPermissionGranted(name: PermissionName): Promise<boolean>;
13
+ /**
14
+ * Check if camera permission is granted
15
+ */
16
+ export declare function hasCameraPermission(): Promise<boolean>;
17
+ /**
18
+ * Check if microphone permission is granted
19
+ */
20
+ export declare function hasMicrophonePermission(): Promise<boolean>;
21
+ /**
22
+ * Check if geolocation permission is granted
23
+ */
24
+ export declare function hasGeolocationPermission(): Promise<boolean>;
25
+ /**
26
+ * Check if notifications permission is granted
27
+ */
28
+ export declare function hasNotificationPermission(): Promise<boolean>;
29
+ /**
30
+ * Request camera and microphone permissions by accessing media
31
+ */
32
+ export declare function requestMediaPermissions(options?: { video?: boolean; audio?: boolean }): Promise<{ granted: boolean; stream?: MediaStream; error?: Error }>;
33
+ /**
34
+ * Common permission groups
35
+ */
36
+ 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]
42
+ };
43
+ export declare interface PermissionStatus {
44
+ state: PermissionState
45
+ isGranted: boolean
46
+ isDenied: boolean
47
+ isPrompt: boolean
48
+ }
49
+ export declare interface PermissionRef {
50
+ get: () => PermissionStatus
51
+ subscribe: (fn: (status: PermissionStatus) => void) => () => void
52
+ query: () => Promise<PermissionStatus>
53
+ isSupported: () => boolean
54
+ }
55
+ export declare interface MultiPermissionRef {
56
+ get: () => Record<string, PermissionStatus>
57
+ subscribe: (fn: (states: Record<string, PermissionStatus>) => void) => () => void
58
+ queryAll: () => Promise<Record<string, PermissionStatus>>
59
+ isSupported: () => boolean
60
+ }
61
+ /**
62
+ * usePermissions - Permissions API wrapper
63
+ *
64
+ * Query and monitor browser permission states for various APIs.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * // Check camera permission
69
+ * const camera = usePermission('camera')
70
+ * camera.subscribe(state => {
71
+ * console.log('Camera permission:', state.state) // 'granted', 'denied', 'prompt'
72
+ * })
73
+ *
74
+ * // Check multiple permissions
75
+ * const permissions = usePermissions(['camera', 'microphone', 'geolocation'])
76
+ * permissions.subscribe(states => {
77
+ * console.log('Camera:', states.camera)
78
+ * console.log('Microphone:', states.microphone)
79
+ * })
80
+ * ```
81
+ */
82
+ export type PermissionName = | 'accelerometer'
83
+ | 'accessibility-events'
84
+ | 'ambient-light-sensor'
85
+ | 'background-fetch'
86
+ | 'background-sync'
87
+ | 'bluetooth'
88
+ | 'camera'
89
+ | 'clipboard-read'
90
+ | 'clipboard-write'
91
+ | 'device-info'
92
+ | 'display-capture'
93
+ | 'geolocation'
94
+ | 'gyroscope'
95
+ | 'magnetometer'
96
+ | 'microphone'
97
+ | 'midi'
98
+ | 'nfc'
99
+ | 'notifications'
100
+ | 'payment-handler'
101
+ | 'periodic-background-sync'
102
+ | 'persistent-storage'
103
+ | 'push'
104
+ | 'screen-wake-lock'
105
+ | 'speaker-selection'
106
+ | 'storage-access'
107
+ | 'window-management'
108
+ | 'xr-spatial-tracking'
109
+ export type PermissionState = 'granted' | 'denied' | 'prompt'
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Observe element size changes
3
+ */
4
+ export declare function useResizeObserver(target: Element | (() => Element | null) | null, callback?: (entries: ResizeObserverEntry[]) => void, options?: ResizeObserverOptions): ResizeObserverRef;
5
+ /**
6
+ * Observe multiple elements
7
+ */
8
+ export declare function useResizeObserverMultiple(targets: Element[] | (() => Element[]), callback?: (entries: ResizeObserverEntry[]) => void, options?: ResizeObserverOptions): ResizeObserverRef & { states: () => Map<Element, ResizeObserverState> };
9
+ /**
10
+ * Get element dimensions reactively
11
+ */
12
+ export declare function useElementSize(target: Element | (() => Element | null) | null): {
13
+ get: () => { width: number; height: number }
14
+ subscribe: (fn: (size: { width: number; height: number }) => void) => () => void
15
+ isSupported: () => boolean
16
+ };
17
+ /**
18
+ * Check if ResizeObserver is supported (standalone function)
19
+ */
20
+ export declare function hasResizeObserver(): boolean;
21
+ /**
22
+ * useResizeObserver - Resize Observer API wrapper
23
+ *
24
+ * Monitor element size changes reactively.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const observer = useResizeObserver(element)
29
+ * observer.subscribe(entries => {
30
+ * console.log('Size changed:', entries[0].contentRect)
31
+ * })
32
+ *
33
+ * // With callback
34
+ * useResizeObserver(element, (entries) => {
35
+ * console.log('Width:', entries[0].contentRect.width)
36
+ * })
37
+ * ```
38
+ */
39
+ export declare interface ResizeObserverSize {
40
+ width: number
41
+ height: number
42
+ inlineSize: number
43
+ blockSize: number
44
+ }
45
+ export declare interface ResizeObserverState {
46
+ contentRect: DOMRectReadOnly | null
47
+ contentBoxSize: ResizeObserverSize | null
48
+ borderBoxSize: ResizeObserverSize | null
49
+ devicePixelContentBoxSize: ResizeObserverSize | null
50
+ }
51
+ export declare interface ResizeObserverOptions {
52
+ box?: 'content-box' | 'border-box' | 'device-pixel-content-box'
53
+ }
54
+ export declare interface ResizeObserverRef {
55
+ get: () => ResizeObserverState
56
+ subscribe: (fn: (entries: ResizeObserverEntry[]) => void) => () => void
57
+ observe: () => void
58
+ disconnect: () => void
59
+ isSupported: () => boolean
60
+ }