@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
@@ -1,54 +1,3 @@
1
- /**
2
- * Register a custom filter
3
- *
4
- * @param name - Filter name (used in templates as {{ value | filterName }})
5
- * @param fn - Filter function
6
- *
7
- * @example
8
- * ```typescript
9
- * // Register a custom filter
10
- * registerFilter('reverse', (value) => {
11
- * return String(value).split('').reverse().join('')
12
- * })
13
- *
14
- * // Use in template: {{ name | reverse }}
15
- * ```
16
- */
17
- export declare function registerFilter(name: string, fn: FilterFunction): void;
18
- /**
19
- * Register multiple custom filters at once
20
- *
21
- * @param filters - Object mapping filter names to functions
22
- *
23
- * @example
24
- * ```typescript
25
- * registerFilters({
26
- * reverse: (value) => String(value).split('').reverse().join(''),
27
- * double: (value) => Number(value) * 2,
28
- * })
29
- * ```
30
- */
31
- export declare function registerFilters(filters: Record<string, FilterFunction>): void;
32
- /**
33
- * Get all available filters (built-in + custom)
34
- */
35
- export declare function getAllFilters(): Record<string, FilterFunction>;
36
- /**
37
- * Clear all custom filters (useful for testing)
38
- */
39
- export declare function clearCustomFilters(): void;
40
- /**
41
- * HTML escape function to prevent XSS
42
- */
43
- export declare function escapeHtml(unsafe: string): string;
44
- /**
45
- * Process template expressions including variables, filters, and operations
46
- */
47
- export declare function processExpressions(template: string, context: Record<string, any>, filePath: string): string;
48
- /**
49
- * Apply filters to a value
50
- */
51
- export declare function applyFilters(value: any, filterExpression: string, context: Record<string, any>): any;
52
1
  /**
53
2
  * Evaluate an expression within the given context
54
3
  * @param {string} expression - The expression to evaluate
@@ -65,59 +14,84 @@ export declare function unescapeHtml(html: string): string;
65
14
  // Built-in Filters
66
15
  // =============================================================================
67
16
  export declare const defaultFilters: {
68
- // String transformation filters
69
17
  uppercase: (value: any, _context: Record<string, any>) => unknown;
70
18
  lowercase: (value: any, _context: Record<string, any>) => unknown;
71
19
  capitalize: (value: any, _context: Record<string, any>) => unknown;
72
- // Number filters
73
- number: (value: any, _context: Record<string, any>, decimals: number?) => unknown;
74
- // Array filters
75
- join: () => unknown;
76
- // Safety filters
20
+ number: (value: any, _context: Record<string, any>, decimals?: number) => unknown;
21
+ fmt: (value: any, _context: Record<string, any>, locale?: string) => unknown;
22
+ join: (value: any, _context: Record<string, any>, separator?: string) => unknown;
77
23
  escape: (value: any, _context: Record<string, any>) => unknown;
78
- // Translation filter - uses context parameter instead of global state
79
- translate: (value: any, context: Record<string, any>, params: Record<string, any> = {}) => unknown;
80
- // Short alias for translate
81
- t: (value: any, context: Record<string, any>, params: Record<string, any> = {}) => unknown;
82
- // =========================================================================
83
- // Additional Utility Filters
84
- // =========================================================================
85
-
86
- // Truncate string to specified length with ellipsis
87
- truncate: (value: any, _context: Record<string, any>, length: number?, suffix: string?) => unknown;
88
- // Format date using Intl.DateTimeFormat
89
- date: (value: any, _context: Record<string, any>, format: string?, locale: string?) => unknown;
90
- // Format number as currency
91
- currency: (value: any, _context: Record<string, any>, currencyCode: string?, locale: string?) => unknown;
92
- // Pluralize word based on count
24
+ translate: (value: any, context: Record<string, any>, params?: Record<string, any>) => unknown;
25
+ t: (value: any, context: Record<string, any>, params?: Record<string, any>) => unknown;
26
+ truncate: (value: any, _context: Record<string, any>, length?: number, suffix?: string) => unknown;
27
+ date: (value: any, _context: Record<string, any>, format?: string, locale?: string) => unknown;
28
+ currency: (value: any, _context: Record<string, any>, currencyCode?: string, locale?: string) => unknown;
93
29
  pluralize: (value: any, _context: Record<string, any>, singular: string, plural?: string) => unknown;
94
- // Get first item from array or first character from string
95
30
  first: (value: any, _context: Record<string, any>) => unknown;
96
- // Get last item from array or last character from string
97
31
  last: (value: any, _context: Record<string, any>) => unknown;
98
- // Get length of array or string
99
32
  length: (value: any, _context: Record<string, any>) => unknown;
100
- // Convert to JSON string
101
- json: (value: any, _context: Record<string, any>, pretty: boolean?) => unknown;
102
- // Default value if null/undefined
103
- default: (value: any, _context: Record<string, any>, defaultValue: any?) => unknown;
104
- // Reverse string or array
33
+ json: (value: any, _context: Record<string, any>, pretty?: boolean) => unknown;
34
+ default: (value: any, _context: Record<string, any>, defaultValue?: any) => unknown;
105
35
  reverse: (value: any, _context: Record<string, any>) => unknown;
106
- // Slice array or string
107
- slice: (value: any, _context: Record<string, any>, start: number?, end?: number) => unknown;
108
- // Replace text
109
- replace: (value: any, _context: Record<string, any>, search: string, replacement: string?) => unknown;
110
- // Strip HTML tags
36
+ slice: (value: any, _context: Record<string, any>, start?: number, end?: number) => unknown;
37
+ replace: (value: any, _context: Record<string, any>, search: string, replacement?: string) => unknown;
111
38
  stripTags: (value: any, _context: Record<string, any>) => unknown;
112
- // URL encode
113
39
  urlencode: (value: any, _context: Record<string, any>) => unknown;
114
- // Absolute value
115
40
  abs: (value: any, _context: Record<string, any>) => unknown;
116
- // Round number
117
- round: (value: any, _context: Record<string, any>, decimals: number?) => unknown
41
+ round: (value: any, _context: Record<string, any>, decimals?: number) => unknown;
42
+ }
43
+
44
+
45
+ /**
46
+ * Register a custom filter
47
+ *
48
+ * @param name - Filter name (used in templates as {{ value | filterName }})
49
+ * @param fn - Filter function
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // Register a custom filter
54
+ * registerFilter('reverse', (value) => {
55
+ * return String(value).split('').reverse().join('')
56
+ * })
57
+ *
58
+ * // Use in template: {{ name | reverse }}
59
+ * ```
60
+ */
61
+ export function registerFilter(name: unknown;
62
+ fn: () => unknown;
63
+ FilterFunction>): void {
64
+ for: (const [name, fn] of Object.entries(filters)) => unknown;
65
+ 'console']
66
+
67
+ let exprWithoutStrings = expr
68
+ .replace(/'[^']*'/g, '') // Remove single-quoted strings
69
+ .replace(/"[^"]*"/g, '') // Remove double-quoted strings
70
+ .replace(/`[^`]*`/g, '') // Remove template literals
71
+
72
+ // Find all identifiers (variable names at the start of property access chains)
73
+ const identifierRegex = /\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g
74
+ let identifierMatch: RegExpExecArray | null
75
+
76
+ while ((identifierMatch = identifierRegex.exec(exprWithoutStrings)) !== null) {
77
+ const identifier = identifierMatch[1]
78
+ // Check if this identifier is a property access (preceded by a dot)
79
+ const beforeIdentifier = exprWithoutStrings.substring(0, identifierMatch.index)
80
+ const isPropAccess = beforeIdentifier.trimEnd().endsWith('.')
81
+
82
+ // Only check top-level identifiers (not property accesses like .foo)
83
+ if (!isPropAccess) {
84
+ // If this identifier is not a JS built-in and not in context, it's a runtime variable
85
+ if (!jsBuiltins.includes: (identifier) => unknown;
86
+ 'undefined']
87
+
88
+ const identifierPattern = /^([a-zA-Z_$][a-zA-Z0-9_$]*)/
89
+ const identifierMatch = trimmedExpr.match(identifierPattern)
90
+ const firstVarName = identifierMatch?.[1]
91
+ const firstVarInContext = firstVarName && (firstVarName in context || jsBuiltins.includes: (firstVarName) => unknown
118
92
  };
119
93
  /**
120
94
  * Add basic filter support to expressions
121
95
  * Filter functions receive the value to transform, optional args, and the context object
122
96
  */
123
- export type FilterFunction = (value: any, context: Record<string, any>, ...args: any[]) => any
97
+ export type FilterFunction = (value: any, context: Record<string, any>, ...args: any[]) => any;
@@ -16,4 +16,4 @@ export declare interface FormatterOptions {
16
16
  normalizeWhitespace?: boolean
17
17
  sortAttributes?: boolean
18
18
  trimTrailingWhitespace?: boolean
19
- }
19
+ }
@@ -125,44 +125,40 @@ declare interface FormState<T extends Record<string, Validator>> {
125
125
  // =============================================================================
126
126
  // Types
127
127
  // =============================================================================
128
- declare type ValidatorFn = (value: unknown, formValues?: Record<string, unknown>) => true | string
129
- declare type AsyncValidatorFn = (value: unknown, formValues?: Record<string, unknown>) => Promise<true | string>
128
+ declare type ValidatorFn = (value: unknown, formValues?: Record<string, unknown>) => true | string;
129
+ declare type AsyncValidatorFn = (value: unknown, formValues?: Record<string, unknown>) => Promise<true | string>;
130
130
  // =============================================================================
131
131
  // Validator Class
132
132
  // =============================================================================
133
133
  declare class Validator {
134
- private rules: ValidatorRule[];
135
- private defaultValue: unknown;
136
- private addRule(rule: ValidatorRule): Validator;
137
- required(message?: any): Validator;
138
- email(message?: any): Validator;
139
- url(message?: any): Validator;
134
+ required(message?: string): Validator;
135
+ email(message?: string): Validator;
136
+ url(message?: string): Validator;
140
137
  min(length: number, message?: string): Validator;
141
138
  max(length: number, message?: string): Validator;
142
139
  length(min: number, max: number, message?: string): Validator;
143
- pattern(regex: RegExp, message?: any): Validator;
144
- hasUppercase(message?: any): Validator;
145
- hasLowercase(message?: any): Validator;
146
- hasNumber(message?: any): Validator;
147
- hasSpecial(message?: any): Validator;
148
- alphanumeric(message?: any): Validator;
149
- startsWithLetter(message?: any): Validator;
150
- noSpaces(message?: any): Validator;
151
- number(message?: any): Validator;
152
- integer(message?: any): Validator;
153
- positive(message?: any): Validator;
154
- negative(message?: any): Validator;
140
+ pattern(regex: RegExp, message?: string): Validator;
141
+ hasUppercase(message?: string): Validator;
142
+ hasLowercase(message?: string): Validator;
143
+ hasNumber(message?: string): Validator;
144
+ hasSpecial(message?: string): Validator;
145
+ alphanumeric(message?: string): Validator;
146
+ startsWithLetter(message?: string): Validator;
147
+ noSpaces(message?: string): Validator;
148
+ number(message?: string): Validator;
149
+ integer(message?: string): Validator;
150
+ positive(message?: string): Validator;
151
+ negative(message?: string): Validator;
155
152
  minValue(min: number, message?: string): Validator;
156
153
  maxValue(max: number, message?: string): Validator;
157
154
  between(min: number, max: number, message?: string): Validator;
158
155
  matches(fieldName: string, message?: string): Validator;
159
156
  oneOf(values: unknown[], message?: string): Validator;
160
157
  notOneOf(values: unknown[], message?: string): Validator;
161
- date(message?: any): Validator;
158
+ date(message?: string): Validator;
162
159
  before(date: Date | string, message?: string): Validator;
163
160
  after(date: Date | string, message?: string): Validator;
164
- custom(fn: ValidatorFn, message?: any): Validator;
165
- async(fn: AsyncValidatorFn, message?: any): Validator;
161
+ custom(fn: ValidatorFn, message?: string): Validator;
166
162
  when(condition: (value: unknown, formValues: Record<string, unknown>) => boolean, thenValidator: Validator): Validator;
167
163
  getRules(): ValidatorRule[];
168
164
  getDefaultValue(): unknown;
@@ -170,4 +166,7 @@ declare class Validator {
170
166
  validate(value: unknown, formValues?: Record<string, unknown>): Promise<string[]>;
171
167
  validateSync(value: unknown, formValues?: Record<string, unknown>): string[];
172
168
  }
173
- export { Validator };
169
+ // =============================================================================
170
+ // Re-exports
171
+ // =============================================================================
172
+ export { Validator };
package/dist/forms.d.ts CHANGED
@@ -111,27 +111,10 @@ export declare const defaultFormClasses: FormClassConfig;
111
111
  /**
112
112
  * Enhanced validation rules registry with full validation support
113
113
  */
114
- export declare const enhancedValidationRules: {
115
- required: { name: 'required'; validate: (value) => unknown; toHtml5: () => unknown; message: 'This field is required' };
116
- email: { name: 'email'; validate: (value) => unknown };
117
- url: { name: 'url'; validate: (value) => unknown };
118
- numeric: { name: 'numeric'; validate: (value) => unknown; toHtml5: () => unknown };
119
- integer: { name: 'integer'; validate: (value) => unknown; message: 'Please enter a whole number' };
120
- alpha: { name: 'alpha'; validate: (value) => unknown; toHtml5: () => unknown };
121
- alphanumeric: { name: 'alphanumeric'; validate: (value) => unknown; toHtml5: () => unknown };
122
- min: { name: 'min'; validate: (value, params) => unknown };
123
- max: { name: 'max'; validate: (value, params) => unknown };
124
- between: { name: 'between'; validate: (value, params) => unknown; toHtml5: unknown };
125
- confirmed: { name: 'confirmed'; validate: (value, _params, allValues) => unknown };
126
- in: { name: 'in'; validate: (value, params) => unknown; message: 'Must be one of: {{values}}' };
127
- notIn: { name: 'notIn'; validate: (value, params) => unknown; message: 'Must not be: {{values}}' };
128
- regex: { name: 'regex'; validate: (value, params) => unknown };
129
- date: { name: 'date'; validate: (value) => unknown };
130
- before: { name: 'before'; validate: (value, params) => unknown };
131
- after: { name: 'after'; validate: (value, params) => unknown };
132
- size: { name: 'size'; validate: (value, params) => unknown };
133
- phone: { name: 'phone'; validate: (value) => unknown }
134
- };
114
+ export declare const enhancedValidationRules: ({
115
+ required: {
116
+ name: 'required',
117
+ validate: (value)) => unknown;
135
118
  /**
136
119
  * Default CSS class names for form elements.
137
120
  * Based on Bootstrap conventions but fully customizable.
@@ -167,4 +150,4 @@ export declare interface EnhancedValidationRule {
167
150
  validate: (value: unknown, params: string[], allValues: Record<string, unknown>) => true | string
168
151
  toHtml5?: (params: string[]) => string[]
169
152
  message: string
170
- }
153
+ }
package/dist/head.d.ts CHANGED
@@ -219,7 +219,11 @@ export declare interface PageMeta {
219
219
  transition?: string | { name: string; mode?: string }
220
220
  keepAlive?: boolean
221
221
  key?: string | ((route: unknown) => string)
222
+ [key: string]: unknown
222
223
  }
224
+ // =============================================================================
225
+ // Exports
226
+ // =============================================================================
223
227
  export {
224
228
  usePageTitle as useTitle
225
- };
229
+ };
package/dist/heatmap.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CustomDirective, StxOptions } from './types';
1
+ import type { StxOptions } from './types';
2
2
  /**
3
3
  * Generate heatmap tracking script based on configuration
4
4
  */
@@ -16,10 +16,6 @@ export declare function createHeatmapAggregator(): HeatmapAggregator;
16
16
  * Default heatmap configuration
17
17
  */
18
18
  export declare const defaultHeatmapConfig: HeatmapConfig;
19
- /**
20
- * Custom @heatmap directive for explicit placement
21
- */
22
- export declare const heatmapDirective: CustomDirective;
23
19
  /**
24
20
  * Heatmap Module
25
21
  *
@@ -112,7 +108,6 @@ export declare interface HeatmapSession {
112
108
  * For processing collected heatmap data into visualizations
113
109
  */
114
110
  export declare class HeatmapAggregator {
115
- private sessions: Map<string, HeatmapSession>;
116
111
  addSession(data: HeatmapSession): void;
117
112
  getPageData(page: string): HeatmapDataPoint[];
118
113
  getClickData(page: string): HeatmapDataPoint[];
@@ -122,4 +117,6 @@ export declare class HeatmapAggregator {
122
117
  generateGridData(page: string, gridSize?: number): { x: number, y: number, intensity: number }[][];
123
118
  exportJSON(): string;
124
119
  clear(): void;
125
- }
120
+ get sessionCount(): number;
121
+ get totalPoints(): number;
122
+ }
@@ -2,10 +2,6 @@
2
2
  * Generate the hot reload client script to inject into HTML
3
3
  */
4
4
  export declare function generateHotReloadScript(wsPort: number, options?: HotReloadOptions): string;
5
- /**
6
- * Inject hot reload script into HTML content
7
- */
8
- export declare function injectHotReload(html: string, wsPort: number, options?: HotReloadOptions): string;
9
5
  /**
10
6
  * Determine if a file change should trigger a CSS-only update
11
7
  */
@@ -74,9 +70,6 @@ export declare interface HotReloadMessage {
74
70
  * Manages WebSocket connections and broadcasts reload messages to browsers.
75
71
  */
76
72
  export declare class HotReloadServer {
77
- private clients: Set<WebSocketClient>;
78
- private server: ReturnType<typeof Bun.serve> | null;
79
- private options: Required<HotReloadOptions>;
80
73
  constructor(options?: HotReloadOptions);
81
74
  start(port?: number): number;
82
75
  stop(): void;
@@ -84,4 +77,6 @@ export declare class HotReloadServer {
84
77
  reload(filePath?: string): void;
85
78
  updateCss(filePath: string, content?: string): void;
86
79
  error(message: string): void;
87
- }
80
+ get clientCount(): number;
81
+ get port(): number;
82
+ }
@@ -44,4 +44,4 @@ export declare interface IslandMeta {
44
44
  component: string
45
45
  strategy: string
46
46
  props: Record<string, unknown>
47
- }
47
+ }
@@ -113,42 +113,15 @@ export declare interface ComponentHydrationConfig {
113
113
  * Main hydration class
114
114
  */
115
115
  export declare class HydrationRuntime {
116
- private state: HydrationState | null;
117
- private options: Required<HydrationOptions>;
118
- private root: HTMLElement | null;
119
- private isHydrated: any;
120
- private pendingComponents: Map<string, ComponentHydrationConfig>;
121
- private hydratedComponents: Set<string>;
122
116
  constructor(options?: HydrationOptions);
123
117
  hydrate(): Promise<void>;
124
- private runHydration(): Promise<void>;
125
- private restoreGlobalState(): void;
126
- private hydrateComponents(): Promise<void>;
127
- private hydrateComponent(el: HTMLElement, config: ComponentHydrationConfig): Promise<void>;
128
- private restoreComponentState(el: HTMLElement, state: unknown): void;
129
- private setupVisibleHydration(el: HTMLElement, config: ComponentHydrationConfig): void;
130
- private setupIdleHydration(el: HTMLElement, config: ComponentHydrationConfig): void;
131
- private setupInteractionHydration(el: HTMLElement, config: ComponentHydrationConfig): void;
132
- private bindEventHandlers(): void;
133
- private bindElementEvents(el: HTMLElement): void;
134
- private bindDirectiveEvents(): void;
135
- private parseModifiers(el: HTMLElement, eventType: string): string[];
136
- private bindSingleEvent(el: HTMLElement, event: EventBinding): void;
137
- private resolveHandler(handlerStr: string): ((e: Event) => void) | null;
138
- private bindComponentEvents(el: HTMLElement): void;
139
- private initializeComponentReactivity(el: HTMLElement, config: ComponentHydrationConfig): void;
140
- private initializeReactiveBindings(): void;
141
- private getTextNodesWithExpressions(root: HTMLElement): Array<{
142
- node: Text
143
- expressions: string[]
144
- }>;
145
- private setupTextNodeBinding(node: Text, expression: string): void;
146
- private setupAttributeBinding(el: HTMLElement, attr: string, expression: string): void;
147
- private setupReactiveBinding(el: HTMLElement, expression: string): void;
148
- private setupRouterIntegration(): void;
118
+ get hydrated(): boolean;
149
119
  getState(): HydrationState | null;
150
120
  hydrateById(componentId: string): Promise<void>;
151
121
  }
122
+ // =============================================================================
123
+ // Exports
124
+ // =============================================================================
152
125
  export default {
153
126
  HydrationRuntime,
154
127
  serializeState,
@@ -158,4 +131,4 @@ export default {
158
131
  extractState,
159
132
  getHydrationRuntime,
160
133
  hydrate,
161
- };
134
+ };
package/dist/i18n.d.ts CHANGED
@@ -230,14 +230,6 @@ export declare function createTranslateFilter(translations: Record<string, any>,
230
230
  // =============================================================================
231
231
  // Default i18n configuration
232
232
  export declare const defaultI18nConfig: I18nConfig;
233
- /**
234
- * Pending load tracking for deduplication
235
- */
236
- declare interface PendingLoad {
237
- promise: Promise<Record<string, any>>
238
- state: LoadingState
239
- error?: Error
240
- }
241
233
  /**
242
234
  * Preload configuration
243
235
  */
@@ -252,4 +244,4 @@ export declare interface PreloadConfig {
252
244
  /**
253
245
  * Loading state for async translation loading
254
246
  */
255
- declare type LoadingState = 'idle' | 'loading' | 'loaded' | 'error'
247
+ declare type LoadingState = 'idle' | 'loading' | 'loaded' | 'error';
@@ -1,4 +1,4 @@
1
- import { type ImageOptions, } from './processor';
1
+ import { type ImageOptions, type ImageFormat, type ProcessedImage, type ImageVariant } from './processor';
2
2
  import type { BuildPlugin } from '../production-build';
3
3
  /**
4
4
  * Create the image optimization build plugin
@@ -50,4 +50,4 @@ export declare interface ImageBuildContext {
50
50
  savedBytes: number
51
51
  variants: number
52
52
  }
53
- }
53
+ }
@@ -1,4 +1,4 @@
1
- import { type ImageFormat, } from './processor';
1
+ import { type ImageFormat, type ImageVariant, type ProcessedImage } from './processor';
2
2
  /**
3
3
  * Render an optimized <Image> component
4
4
  */
@@ -43,4 +43,4 @@ export declare interface ImageRenderResult {
43
43
  html: string
44
44
  preloadLink?: string
45
45
  placeholderCss?: string
46
- }
46
+ }
@@ -1,4 +1,4 @@
1
- import { type ImageFormat, } from './processor';
1
+ import { type ImageFormat } from './processor';
2
2
  import type { CustomDirective } from '../types';
3
3
  /**
4
4
  * Clear the image cache
@@ -27,4 +27,4 @@ export declare interface ImageDirectiveOptions {
27
27
  style?: string
28
28
  priority?: boolean
29
29
  placeholder?: 'blur' | 'color' | 'none'
30
- }
30
+ }
@@ -17,6 +17,51 @@ export declare interface ImageConfig {
17
17
  outputDir?: string
18
18
  baseUrl?: string
19
19
  }
20
+ /**
21
+ * STX Image Optimization
22
+ *
23
+ * Comprehensive image optimization for improved Core Web Vitals (LCP).
24
+ *
25
+ * Features:
26
+ * - Responsive images with srcset/sizes
27
+ * - Modern format conversion (WebP, AVIF)
28
+ * - Lazy loading with blur placeholders
29
+ * - Build-time optimization
30
+ * - <Image> component and @image directive
31
+ *
32
+ * @module image-optimization
33
+ *
34
+ * @example
35
+ * ```html
36
+ * <!-- Image Component -->
37
+ * <Image
38
+ * src="/images/hero.jpg"
39
+ * alt="Hero image"
40
+ * width="1200"
41
+ * height="600"
42
+ * sizes="(max-width: 768px) 100vw, 50vw"
43
+ * priority
44
+ * />
45
+ *
46
+ * <!-- @image Directive -->
47
+ * @image('/images/photo.jpg', 'A photo', { width: 800, lazy: true })
48
+ * ```
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Build plugin
53
+ * import { createImagePlugin } from 'stx/image-optimization'
54
+ *
55
+ * const plugin = createImagePlugin({
56
+ * formats: ['webp', 'avif', 'jpeg'],
57
+ * widths: [320, 640, 1024, 1920],
58
+ * quality: 80,
59
+ * })
60
+ * ```
61
+ */
62
+ // ============================================================================
63
+ // Processor Exports
64
+ // ============================================================================
20
65
  export {
21
66
  // Core processing
22
67
  processImage,
@@ -50,6 +95,9 @@ export {
50
95
  type ImageVariant,
51
96
  type ImageMetadata,
52
97
  } from './processor';
98
+ // ============================================================================
99
+ // Component Exports
100
+ // ============================================================================
53
101
  export {
54
102
  // Rendering
55
103
  renderImageComponent,
@@ -61,6 +109,9 @@ export {
61
109
  type ImageRenderContext,
62
110
  type ImageRenderResult,
63
111
  } from './component';
112
+ // ============================================================================
113
+ // Directive Exports
114
+ // ============================================================================
64
115
  export {
65
116
  // Directive
66
117
  imageDirective,
@@ -70,6 +121,9 @@ export {
70
121
  // Types
71
122
  type ImageDirectiveOptions,
72
123
  } from './directive';
124
+ // ============================================================================
125
+ // Build Plugin Exports
126
+ // ============================================================================
73
127
  export {
74
128
  // Plugin
75
129
  createImagePlugin,
@@ -83,4 +137,4 @@ export {
83
137
  // Types
84
138
  type ImageBuildOptions,
85
139
  type ImageBuildContext,
86
- } from './build-plugin';
140
+ } from './build-plugin';
@@ -43,10 +43,13 @@ export declare function getTotalSize(variants: ImageVariant[]): number;
43
43
  * Format file size for display
44
44
  */
45
45
  export declare function formatSize(bytes: number): string;
46
- // ============================================================================
46
+ /**
47
+ * ============================================================================
47
48
  // Constants
48
49
  // ============================================================================
49
- export declare const DEFAULT_WIDTHS: readonly [320, 640, 768, 1024, 1280, 1536, 1920];
50
+ * @defaultValue `[320, 640, 768, 1024, 1280, 1536, 1920]`
51
+ */
52
+ export declare const DEFAULT_WIDTHS: number[];
50
53
  export declare const DEFAULT_FORMATS: ImageFormat[];
51
54
  export declare const DEFAULT_QUALITY: 80;
52
55
  // ============================================================================
@@ -84,7 +87,7 @@ export declare interface ImageMetadata {
84
87
  format: string
85
88
  hasAlpha?: boolean
86
89
  }
87
- export type ImageFormat = 'webp' | 'avif' | 'jpeg' | 'png'
90
+ export type ImageFormat = 'webp' | 'avif' | 'jpeg' | 'png';
88
91
  // ============================================================================
89
92
  // Sharp Integration
90
93
  // ============================================================================
@@ -103,10 +106,12 @@ declare type SharpModule = {
103
106
  (input: Buffer | string): SharpInstance
104
107
  default?: (input: Buffer | string) => SharpInstance
105
108
  }
109
+ declare type = : 'blur' | 'dominant-color',
110
+ ): Promise<string> {;
106
111
  // ============================================================================
107
112
  // Error Handling
108
113
  // ============================================================================
109
114
  export declare class ImageProcessingError extends Error {
110
115
  code: string;
111
116
  constructor(message: string, code: string);
112
- }
117
+ }
@@ -106,4 +106,4 @@ export declare const partialsCache: LRUCache<string, string>;
106
106
  // Global store to track what has been included via @once
107
107
  // WARNING: This persists across requests in long-running servers!
108
108
  // Use clearOnceStore() at the start of each request, or use request-scoped tracking via context.__onceStore
109
- export declare const onceStore: Set<string>;
109
+ export declare const onceStore: Set<string>;