@stacksjs/stx 0.2.154 → 0.2.156

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 (240) hide show
  1. package/dist/a11y.d.ts +87 -46
  2. package/dist/animation.d.ts +96 -42
  3. package/dist/appearance-bootstrap.d.ts +49 -15
  4. package/dist/asset-roots.d.ts +32 -0
  5. package/dist/asset-roots.js +7 -0
  6. package/dist/assets.d.ts +9 -7
  7. package/dist/async-components.d.ts +78 -56
  8. package/dist/auth.d.ts +3 -0
  9. package/dist/build-externalize.d.ts +40 -0
  10. package/dist/build-externalize.js +63 -0
  11. package/dist/build-id.d.ts +22 -22
  12. package/dist/build-message.d.ts +73 -2
  13. package/dist/build-message.js +47 -8
  14. package/dist/builtins/attrs.d.ts +14 -0
  15. package/dist/builtins/drawer.d.ts +22 -0
  16. package/dist/builtins/icon.d.ts +16 -2
  17. package/dist/builtins/index.d.ts +5 -15
  18. package/dist/builtins/modal.d.ts +24 -0
  19. package/dist/builtins/safe-image.d.ts +42 -0
  20. package/dist/builtins/stx-image.d.ts +27 -0
  21. package/dist/builtins/stx-link.d.ts +9 -0
  22. package/dist/builtins/stx-loading-indicator.d.ts +11 -0
  23. package/dist/builtins/suspense.d.ts +28 -0
  24. package/dist/builtins/toast.d.ts +17 -0
  25. package/dist/builtins/transition-group.d.ts +25 -0
  26. package/dist/caching.d.ts +12 -15
  27. package/dist/cli.js +1798 -908
  28. package/dist/client/directive.d.ts +7 -0
  29. package/dist/client/index.d.ts +0 -1
  30. package/dist/client-script-bundler.d.ts +63 -5
  31. package/dist/client-script-bundler.js +30 -2
  32. package/dist/client-script.d.ts +102 -47
  33. package/dist/client-script.js +15 -3
  34. package/dist/codemod.d.ts +56 -0
  35. package/dist/codemod.js +192 -0
  36. package/dist/color-mode-boot.d.ts +83 -65
  37. package/dist/component-client-factories.d.ts +1 -6
  38. package/dist/component-processing.d.ts +58 -49
  39. package/dist/component-processing.js +1 -1
  40. package/dist/component-registry.d.ts +94 -31
  41. package/dist/component-renderer.d.ts +18 -0
  42. package/dist/composable-loader.d.ts +24 -0
  43. package/dist/composable-loader.js +12 -9
  44. package/dist/composables/index.d.ts +7 -0
  45. package/dist/composables/index.js +1 -0
  46. package/dist/composables/use-fetch.js +30 -2
  47. package/dist/composables/use-form.d.ts +91 -0
  48. package/dist/composables/use-form.js +112 -0
  49. package/dist/composables.d.ts +64 -60
  50. package/dist/computed.d.ts +86 -92
  51. package/dist/conditionals.d.ts +24 -8
  52. package/dist/conditionals.js +16 -0
  53. package/dist/config.d.ts +34 -21
  54. package/dist/config.js +35 -14
  55. package/dist/craft.js +1476 -768
  56. package/dist/crosswind-config.d.ts +58 -0
  57. package/dist/crosswind-config.js +40 -0
  58. package/dist/csp.d.ts +107 -41
  59. package/dist/defer.d.ts +24 -0
  60. package/dist/dev-server/crosswind.d.ts +35 -26
  61. package/dist/dev-server/crosswind.js +2 -18
  62. package/dist/dev-server/serve-app.js +4 -3
  63. package/dist/dev-server/terminal-colors.d.ts +32 -32
  64. package/dist/directive-api.d.ts +86 -43
  65. package/dist/document-shell.d.ts +54 -41
  66. package/dist/dynamic-components.d.ts +9 -0
  67. package/dist/error-boundaries.d.ts +47 -41
  68. package/dist/error-handling.d.ts +1 -1
  69. package/dist/errors/codes.d.ts +51 -43
  70. package/dist/errors/formatter.d.ts +58 -38
  71. package/dist/errors/index.d.ts +5 -61
  72. package/dist/errors/logger.d.ts +114 -40
  73. package/dist/errors/sanitizer.d.ts +53 -23
  74. package/dist/errors/types.d.ts +44 -31
  75. package/dist/events.d.ts +86 -25
  76. package/dist/expressions.d.ts +50 -42
  77. package/dist/forms-validation.d.ts +138 -123
  78. package/dist/forms-validation.js +1 -90
  79. package/dist/forms.d.ts +120 -66
  80. package/dist/forms.js +31 -11
  81. package/dist/fragment-container.d.ts +57 -0
  82. package/dist/fragment-container.js +109 -0
  83. package/dist/framework-composables.d.ts +32 -0
  84. package/dist/head.d.ts +156 -114
  85. package/dist/heatmap.d.ts +152 -72
  86. package/dist/html-masking.d.ts +40 -34
  87. package/dist/hydration-runtime.d.ts +20 -24
  88. package/dist/i18n.d.ts +93 -32
  89. package/dist/image-optimization/auto-sibling.d.ts +32 -4
  90. package/dist/includes.d.ts +69 -7
  91. package/dist/index.d.ts +66 -0
  92. package/dist/index.js +23 -0
  93. package/dist/internal-markdown.d.ts +12 -8
  94. package/dist/island-chunking.d.ts +30 -13
  95. package/dist/keep-alive.d.ts +72 -52
  96. package/dist/layout-types.d.ts +45 -0
  97. package/dist/layout-types.js +56 -0
  98. package/dist/lazy-module.d.ts +10 -0
  99. package/dist/loops.d.ts +66 -0
  100. package/dist/loops.js +47 -6
  101. package/dist/markdown.d.ts +0 -1
  102. package/dist/media/image/component.d.ts +25 -9
  103. package/dist/media/image/directive.d.ts +15 -1
  104. package/dist/media/image/placeholder.d.ts +20 -9
  105. package/dist/media/image/processor/cache.d.ts +40 -18
  106. package/dist/media/image/processor/index.d.ts +1 -10
  107. package/dist/media/image/processor/optimizer.d.ts +12 -1
  108. package/dist/media/image/processor/responsive.d.ts +16 -6
  109. package/dist/media/image/srcset.d.ts +47 -50
  110. package/dist/media/shared/cache.d.ts +51 -31
  111. package/dist/media/shared/hash.d.ts +7 -0
  112. package/dist/media/types.d.ts +1235 -754
  113. package/dist/media/video/directive.d.ts +15 -1
  114. package/dist/media/video/index.d.ts +39 -17
  115. package/dist/media/video/processor/cache.d.ts +42 -19
  116. package/dist/media/video/processor/index.d.ts +1 -18
  117. package/dist/media/video/processor/streaming.d.ts +17 -10
  118. package/dist/media/video/processor/thumbnail.d.ts +21 -15
  119. package/dist/media/video/processor/transcoder.d.ts +11 -1
  120. package/dist/method-spoofing.d.ts +7 -0
  121. package/dist/middleware.d.ts +60 -0
  122. package/dist/owned-routes.d.ts +42 -0
  123. package/dist/owned-routes.js +26 -0
  124. package/dist/page-meta.d.ts +38 -0
  125. package/dist/page-meta.js +16 -0
  126. package/dist/parser/directive-parser.d.ts +57 -45
  127. package/dist/parser/expression-parser.d.ts +33 -35
  128. package/dist/parser/index.d.ts +4 -39
  129. package/dist/parser/tokenizer.d.ts +61 -49
  130. package/dist/partial-hydration.d.ts +82 -50
  131. package/dist/performance-utils.d.ts +217 -124
  132. package/dist/placeholder.d.ts +18 -9
  133. package/dist/plugin-system.d.ts +264 -115
  134. package/dist/process.d.ts +11 -6
  135. package/dist/process.js +21 -4
  136. package/dist/production-builder.js +7 -0
  137. package/dist/prop-sentinels.d.ts +11 -11
  138. package/dist/public-env.d.ts +14 -0
  139. package/dist/pwa/directives.d.ts +12 -3
  140. package/dist/pwa/inject.d.ts +10 -0
  141. package/dist/pwa/precache.d.ts +22 -16
  142. package/dist/pwa/service-worker.d.ts +12 -0
  143. package/dist/pwa.js +1318 -610
  144. package/dist/reactive-bindings.d.ts +34 -11
  145. package/dist/reactive.d.ts +58 -30
  146. package/dist/reactive.js +56 -31
  147. package/dist/render.js +1 -0
  148. package/dist/route-middleware.d.ts +2 -35
  149. package/dist/route-types.d.ts +134 -0
  150. package/dist/route-types.js +24 -0
  151. package/dist/router.d.ts +5 -7
  152. package/dist/routes.d.ts +1 -3
  153. package/dist/runtime-globals.d.ts +147 -24
  154. package/dist/runtime-globals.js +16 -1
  155. package/dist/runtime-injection.d.ts +8 -0
  156. package/dist/runtime-injection.js +33 -24
  157. package/dist/script-emit.d.ts +30 -0
  158. package/dist/script-json.d.ts +36 -0
  159. package/dist/script-json.js +6 -0
  160. package/dist/script-validation.d.ts +21 -4
  161. package/dist/seo.d.ts +118 -47
  162. package/dist/server-bindings.d.ts +21 -0
  163. package/dist/sfc-template.d.ts +8 -8
  164. package/dist/signal-processing.d.ts +35 -15
  165. package/dist/signals-api.d.ts +117 -58
  166. package/dist/signals-api.js +7 -4
  167. package/dist/signals.d.ts +24 -17
  168. package/dist/signals.js +765 -60
  169. package/dist/site-builder/build.js +8 -0
  170. package/dist/site-url.d.ts +46 -0
  171. package/dist/site-url.js +70 -0
  172. package/dist/slots.d.ts +86 -20
  173. package/dist/source-signature.d.ts +45 -0
  174. package/dist/source-signature.js +20 -0
  175. package/dist/ssg.d.ts +285 -142
  176. package/dist/ssg.js +1268 -556
  177. package/dist/state-dir.d.ts +4 -4
  178. package/dist/state-management.d.ts +0 -12
  179. package/dist/state-management.js +8 -25
  180. package/dist/store-imports.d.ts +23 -0
  181. package/dist/store-imports.js +3 -0
  182. package/dist/store-loader.d.ts +10 -0
  183. package/dist/store-loader.js +10 -9
  184. package/dist/story/analytics.d.ts +138 -60
  185. package/dist/story/bookmarks.d.ts +87 -34
  186. package/dist/story/cli.d.ts +123 -69
  187. package/dist/story/collect/scanner.d.ts +4 -0
  188. package/dist/story/collect/tree.d.ts +8 -1
  189. package/dist/story/commands/build.d.ts +11 -6
  190. package/dist/story/commands/dev.d.ts +15 -8
  191. package/dist/story/commands/preview.d.ts +13 -7
  192. package/dist/story/config-watcher.d.ts +20 -13
  193. package/dist/story/config.d.ts +11 -8
  194. package/dist/story/context.d.ts +14 -8
  195. package/dist/story/hmr.d.ts +24 -26
  196. package/dist/story/hot-swap.d.ts +34 -23
  197. package/dist/story/keyboard-shortcuts.d.ts +23 -18
  198. package/dist/story/output.d.ts +46 -44
  199. package/dist/story/performance.d.ts +107 -45
  200. package/dist/story/presets.d.ts +107 -41
  201. package/dist/story/renderer.d.ts +41 -27
  202. package/dist/story/search.d.ts +23 -12
  203. package/dist/story/server.d.ts +21 -11
  204. package/dist/story/setup.d.ts +23 -15
  205. package/dist/story/testing.d.ts +65 -40
  206. package/dist/story/types.d.ts +262 -160
  207. package/dist/streaming.d.ts +119 -57
  208. package/dist/stx-virtual-ts.d.ts +165 -0
  209. package/dist/stx-virtual-ts.js +372 -0
  210. package/dist/stx.d.ts +78 -1
  211. package/dist/style-scoping.d.ts +17 -4
  212. package/dist/suspense.d.ts +67 -52
  213. package/dist/teleport.d.ts +22 -0
  214. package/dist/template-tag-balance.d.ts +22 -6
  215. package/dist/transitions.d.ts +66 -55
  216. package/dist/typecheck.d.ts +77 -0
  217. package/dist/typecheck.js +156 -0
  218. package/dist/types/component-types.d.ts +187 -122
  219. package/dist/types/config-types.d.ts +758 -297
  220. package/dist/types/context-types.d.ts +46 -24
  221. package/dist/types/csp-types.d.ts +70 -66
  222. package/dist/types/directive-types.d.ts +211 -155
  223. package/dist/types/index.d.ts +6 -109
  224. package/dist/types/pwa-types.d.ts +273 -148
  225. package/dist/types.d.ts +0 -1
  226. package/dist/typescript-templates.d.ts +11 -0
  227. package/dist/unresolved-identifiers.d.ts +24 -22
  228. package/dist/unresolved-identifiers.js +2 -0
  229. package/dist/utils.d.ts +24 -21
  230. package/dist/validator.d.ts +28 -26
  231. package/dist/variable-extractor.d.ts +48 -13
  232. package/dist/variable-extractor.js +27 -4
  233. package/dist/view-composers.d.ts +80 -81
  234. package/dist/virtual-scrolling.d.ts +101 -81
  235. package/dist/vue-template.d.ts +23 -0
  236. package/dist/web-components/css-scoping.d.ts +21 -11
  237. package/dist/web-components.d.ts +81 -58
  238. package/dist/x-element.d.ts +0 -1
  239. package/package.json +5 -5
  240. package/stx.d.ts +78 -1
@@ -1,213 +1,338 @@
1
+ /**
2
+ * Progressive Web App (PWA) Types
3
+ */
4
+ /**
5
+ * PWA caching strategy for service worker routes
6
+ */
7
+ export type PwaCacheStrategy = 'cache-first' | 'network-first' | 'stale-while-revalidate' | 'network-only' | 'cache-only';
1
8
  /**
2
9
  * PWA route cache configuration
3
10
  * Defines how specific routes should be cached by the service worker
4
11
  */
5
- export declare interface PwaRouteCache {
6
- pattern: string
7
- strategy: PwaCacheStrategy
8
- cacheName?: string
9
- maxAgeSeconds?: number
10
- maxEntries?: number
12
+ export interface PwaRouteCache {
13
+ /** Route pattern (glob-style, e.g., '/api/*', '*.{js,css}') */
14
+ pattern: string;
15
+ /** Caching strategy for this route */
16
+ strategy: PwaCacheStrategy;
17
+ /** Custom cache name for this route group */
18
+ cacheName?: string;
19
+ /** Cache expiration in seconds */
20
+ maxAgeSeconds?: number;
21
+ /** Maximum number of entries in cache */
22
+ maxEntries?: number;
11
23
  }
12
24
  /**
13
25
  * PWA icon configuration for automatic generation
14
26
  */
15
- export declare interface PwaIconConfig {
16
- src: string
17
- sizes?: number[]
18
- generateWebP?: boolean
19
- generateAppleIcons?: boolean
20
- outputDir?: string
21
- purpose?: ('any' | 'maskable' | 'monochrome')[]
27
+ export interface PwaIconConfig {
28
+ /** Source icon path (512x512 PNG recommended) */
29
+ src: string;
30
+ /** Sizes to generate (default: [72, 96, 128, 144, 152, 192, 384, 512]) */
31
+ sizes?: number[];
32
+ /** Generate WebP variants alongside PNG */
33
+ generateWebP?: boolean;
34
+ /** Generate Apple touch icon variants */
35
+ generateAppleIcons?: boolean;
36
+ /** Output directory for generated icons (relative to output dir) */
37
+ outputDir?: string;
38
+ /** Icon purpose for manifest ('any', 'maskable', 'monochrome') */
39
+ purpose?: ('any' | 'maskable' | 'monochrome')[];
22
40
  }
23
41
  /**
24
42
  * PWA shortcut definition for app shortcuts menu
25
43
  */
26
- export declare interface PwaShortcut {
27
- name: string
28
- shortName?: string
29
- description?: string
30
- url: string
31
- icons?: Array<{ src: string, sizes: string, type?: string }>
44
+ export interface PwaShortcut {
45
+ /** Shortcut name */
46
+ name: string;
47
+ /** Short name (optional) */
48
+ shortName?: string;
49
+ /** Description of the shortcut */
50
+ description?: string;
51
+ /** URL to navigate to */
52
+ url: string;
53
+ /** Icons for the shortcut */
54
+ icons?: Array<{
55
+ src: string;
56
+ sizes: string;
57
+ type?: string;
58
+ }>;
32
59
  }
33
60
  /**
34
61
  * PWA screenshot definition for app store listings
35
62
  */
36
- export declare interface PwaScreenshot {
37
- src: string
38
- sizes: string
39
- type?: string
40
- label?: string
41
- platform?: 'wide' | 'narrow'
63
+ export interface PwaScreenshot {
64
+ /** Screenshot image path */
65
+ src: string;
66
+ /** Image dimensions (e.g., '1280x720') */
67
+ sizes: string;
68
+ /** Image MIME type */
69
+ type?: string;
70
+ /** Screenshot label/description */
71
+ label?: string;
72
+ /** Platform: 'wide' for desktop, 'narrow' for mobile */
73
+ platform?: 'wide' | 'narrow';
42
74
  }
43
75
  /**
44
76
  * PWA Web App Manifest configuration
45
77
  */
46
- export declare interface PwaManifestConfig {
47
- name: string
48
- shortName?: string
49
- description?: string
50
- startUrl?: string
51
- display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser'
52
- displayOverride?: string[]
53
- orientation?: 'portrait' | 'landscape' | 'any' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'
54
- themeColor?: string
55
- backgroundColor?: string
56
- scope?: string
57
- lang?: string
58
- dir?: 'ltr' | 'rtl' | 'auto'
59
- id?: string
60
- categories?: string[]
61
- shortcuts?: PwaShortcut[]
62
- screenshots?: PwaScreenshot[]
63
- launchHandler?: 'auto' | 'focus-existing' | 'navigate-new' | 'navigate-existing'
64
- handleLinks?: 'auto' | 'preferred' | 'not-preferred'
65
- edgeSidePanel?: {
66
- enabled: boolean
67
- preferredWidth?: number
68
- }
78
+ export interface PwaManifestConfig {
79
+ /** Full application name */
80
+ name: string;
81
+ /** Short name (displayed on home screen) */
82
+ shortName?: string;
83
+ /** Application description */
84
+ description?: string;
85
+ /** Start URL when app is launched */
86
+ startUrl?: string;
87
+ /** Display mode for the app */
88
+ display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser';
89
+ /** Display mode override order */
90
+ displayOverride?: string[];
91
+ /** Preferred orientation */
92
+ orientation?: 'portrait' | 'landscape' | 'any' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
93
+ /** Theme color (affects browser UI) */
94
+ themeColor?: string;
95
+ /** Background color (splash screen) */
96
+ backgroundColor?: string;
97
+ /** Scope of the PWA */
98
+ scope?: string;
99
+ /** Primary language */
100
+ lang?: string;
101
+ /** Text direction */
102
+ dir?: 'ltr' | 'rtl' | 'auto';
103
+ /** Unique app ID */
104
+ id?: string;
105
+ /** App categories for store listings */
106
+ categories?: string[];
107
+ /** App shortcuts for quick actions */
108
+ shortcuts?: PwaShortcut[];
109
+ /** Screenshots for app store listings */
110
+ screenshots?: PwaScreenshot[];
111
+ /** Launch handler behavior */
112
+ launchHandler?: 'auto' | 'focus-existing' | 'navigate-new' | 'navigate-existing';
113
+ /** How to handle links */
114
+ handleLinks?: 'auto' | 'preferred' | 'not-preferred';
115
+ /** Edge side panel configuration */
116
+ edgeSidePanel?: {
117
+ enabled: boolean;
118
+ preferredWidth?: number;
119
+ };
69
120
  }
70
121
  /**
71
122
  * PWA offline fallback page configuration
72
123
  */
73
- export declare interface PwaOfflineConfig {
74
- enabled: boolean
75
- page?: string
76
- fallbackTitle?: string
77
- fallbackMessage?: string
78
- precacheAssets?: string[]
124
+ export interface PwaOfflineConfig {
125
+ /** Enable offline support */
126
+ enabled: boolean;
127
+ /** Path to custom offline page (.stx file) */
128
+ page?: string;
129
+ /** Fallback title when offline */
130
+ fallbackTitle?: string;
131
+ /** Fallback message when offline */
132
+ fallbackMessage?: string;
133
+ /** Additional assets to precache for offline access */
134
+ precacheAssets?: string[];
79
135
  }
80
136
  /**
81
137
  * Service worker configuration
82
138
  */
83
- export declare interface PwaServiceWorkerConfig {
84
- fileName?: string
85
- cacheVersion?: string
86
- skipWaiting?: boolean
87
- clientsClaim?: boolean
88
- navigationPreload?: boolean
89
- excludeRoutes?: string[]
90
- cacheFileTypes?: string[]
91
- useWorkbox?: boolean
139
+ export interface PwaServiceWorkerConfig {
140
+ /** Service worker file name (default: 'sw.js') */
141
+ fileName?: string;
142
+ /** Cache version for cache busting */
143
+ cacheVersion?: string;
144
+ /** Skip waiting and activate immediately */
145
+ skipWaiting?: boolean;
146
+ /** Claim all clients immediately */
147
+ clientsClaim?: boolean;
148
+ /** Enable navigation preload */
149
+ navigationPreload?: boolean;
150
+ /** Routes to exclude from caching (glob patterns) */
151
+ excludeRoutes?: string[];
152
+ /** File types to cache (extensions without dot) */
153
+ cacheFileTypes?: string[];
154
+ /** Use Workbox library instead of custom SW (requires workbox-* packages) */
155
+ useWorkbox?: boolean;
92
156
  }
93
157
  /**
94
158
  * Push notification configuration
95
159
  */
96
- export declare interface PwaPushConfig {
97
- enabled: boolean
98
- vapidPublicKey?: string
99
- subscriptionEndpoint?: string
100
- defaultIcon?: string
101
- defaultBadge?: string
102
- defaultOptions?: {
103
- vibrate?: number[]
104
- requireInteraction?: boolean
105
- }
160
+ export interface PwaPushConfig {
161
+ /** Enable push notifications */
162
+ enabled: boolean;
163
+ /** VAPID public key for push subscriptions */
164
+ vapidPublicKey?: string;
165
+ /** Server endpoint for push subscription registration */
166
+ subscriptionEndpoint?: string;
167
+ /** Default notification icon path */
168
+ defaultIcon?: string;
169
+ /** Default notification badge path */
170
+ defaultBadge?: string;
171
+ /** Default notification options */
172
+ defaultOptions?: {
173
+ /** Enable vibration */
174
+ vibrate?: number[];
175
+ /** Require interaction to dismiss */
176
+ requireInteraction?: boolean;
177
+ };
106
178
  }
107
179
  /**
108
180
  * Background sync configuration
109
181
  */
110
- export declare interface PwaBackgroundSyncConfig {
111
- enabled: boolean
112
- queueName?: string
113
- maxRetentionMinutes?: number
114
- maxRetries?: number
115
- minInterval?: number
116
- forms?: string[]
117
- endpoints?: string[]
182
+ export interface PwaBackgroundSyncConfig {
183
+ /** Enable background sync */
184
+ enabled: boolean;
185
+ /** Queue name for sync operations */
186
+ queueName?: string;
187
+ /** Maximum retention time in minutes */
188
+ maxRetentionMinutes?: number;
189
+ /** Maximum retry attempts */
190
+ maxRetries?: number;
191
+ /** Minimum interval between retries in ms */
192
+ minInterval?: number;
193
+ /** Forms to enable background sync for (CSS selectors) */
194
+ forms?: string[];
195
+ /** API endpoints to queue when offline */
196
+ endpoints?: string[];
118
197
  }
119
198
  /**
120
199
  * Share target configuration for receiving shared content
121
200
  */
122
- export declare interface PwaShareTargetConfig {
123
- enabled: boolean
124
- action: string
125
- method?: 'GET' | 'POST'
126
- enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data'
127
- params?: {
128
- title?: string
129
- text?: string
130
- url?: string
131
- }
132
- acceptFiles?: Array<{
133
- name: string
134
- accept: string[]
135
- }>
201
+ export interface PwaShareTargetConfig {
202
+ /** Enable share target */
203
+ enabled: boolean;
204
+ /** Action URL to handle shared content */
205
+ action: string;
206
+ /** HTTP method for share action */
207
+ method?: 'GET' | 'POST';
208
+ /** Encoding type for POST */
209
+ enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data';
210
+ /** Parameter configuration */
211
+ params?: {
212
+ /** Parameter name for shared title */
213
+ title?: string;
214
+ /** Parameter name for shared text */
215
+ text?: string;
216
+ /** Parameter name for shared URL */
217
+ url?: string;
218
+ };
219
+ /** Accept file types for sharing */
220
+ acceptFiles?: Array<{
221
+ name: string;
222
+ accept: string[];
223
+ }>;
136
224
  }
137
225
  /**
138
226
  * File handler configuration for handling specific file types
139
227
  */
140
- export declare interface PwaFileHandlerConfig {
141
- enabled: boolean
142
- action?: string
143
- accept?: Record<string, string[]>
144
- launchType?: 'single-client' | 'multiple-clients'
145
- icons?: Array<{ src: string, sizes: string, type: string }>
228
+ export interface PwaFileHandlerConfig {
229
+ /** Enable file handling */
230
+ enabled: boolean;
231
+ /** Action URL to handle files */
232
+ action?: string;
233
+ /** Accepted MIME types and extensions (e.g., { 'text/markdown': ['.md'] }) */
234
+ accept?: Record<string, string[]>;
235
+ /** Launch type */
236
+ launchType?: 'single-client' | 'multiple-clients';
237
+ /** Icons for file handler */
238
+ icons?: Array<{
239
+ src: string;
240
+ sizes: string;
241
+ type: string;
242
+ }>;
146
243
  }
147
244
  /**
148
245
  * Protocol handler configuration
149
246
  */
150
- export declare interface PwaProtocolHandlerConfig {
151
- protocol: string
152
- url: string
247
+ export interface PwaProtocolHandlerConfig {
248
+ /** Protocol scheme (e.g., 'web+myapp') */
249
+ protocol: string;
250
+ /** URL to handle the protocol */
251
+ url: string;
153
252
  }
154
253
  /**
155
254
  * Cache storage limits configuration
156
255
  */
157
- export declare interface PwaCacheStorageConfig {
158
- maxSize?: number
159
- maxEntries?: number
160
- maxAge?: number
161
- purgeStrategy?: 'lru' | 'fifo' | 'lfu'
256
+ export interface PwaCacheStorageConfig {
257
+ /** Maximum cache size in MB */
258
+ maxSize?: number;
259
+ /** Maximum number of cached entries */
260
+ maxEntries?: number;
261
+ /** Maximum age of cached items in days */
262
+ maxAge?: number;
263
+ /** Purge strategy when limits exceeded */
264
+ purgeStrategy?: 'lru' | 'fifo' | 'lfu';
162
265
  }
163
266
  /**
164
267
  * Update notification configuration
165
268
  */
166
- export declare interface PwaUpdateConfig {
167
- enabled: boolean
168
- promptUser?: boolean
169
- autoReload?: boolean
170
- message?: string
171
- uiSelector?: string
269
+ export interface PwaUpdateConfig {
270
+ /** Enable update notifications */
271
+ enabled: boolean;
272
+ /** Show prompt when update available */
273
+ promptUser?: boolean;
274
+ /** Auto-reload after update */
275
+ autoReload?: boolean;
276
+ /** Custom update notification message */
277
+ message?: string;
278
+ /** Selector for custom update UI element */
279
+ uiSelector?: string;
172
280
  }
173
281
  /**
174
282
  * Auto-precaching configuration
175
283
  */
176
- export declare interface PwaPrecacheConfig {
177
- enabled: boolean
178
- includeHtml?: boolean
179
- includeJs?: boolean
180
- includeCss?: boolean
181
- includeImages?: boolean
182
- includeFonts?: boolean
183
- include?: string[]
184
- exclude?: string[]
185
- maxFileSizeKB?: number
284
+ export interface PwaPrecacheConfig {
285
+ /** Enable auto-precaching of build output */
286
+ enabled: boolean;
287
+ /** Include HTML files */
288
+ includeHtml?: boolean;
289
+ /** Include JS files */
290
+ includeJs?: boolean;
291
+ /** Include CSS files */
292
+ includeCss?: boolean;
293
+ /** Include images */
294
+ includeImages?: boolean;
295
+ /** Include fonts */
296
+ includeFonts?: boolean;
297
+ /** Additional glob patterns to include */
298
+ include?: string[];
299
+ /** Glob patterns to exclude */
300
+ exclude?: string[];
301
+ /** Maximum file size to precache (in KB) */
302
+ maxFileSizeKB?: number;
186
303
  }
187
304
  /**
188
305
  * Complete PWA configuration
189
306
  */
190
- export declare interface PwaConfig {
191
- enabled: boolean
192
- manifest: PwaManifestConfig
193
- icons?: PwaIconConfig
194
- routes?: PwaRouteCache[]
195
- offline?: PwaOfflineConfig
196
- serviceWorker?: PwaServiceWorkerConfig
197
- autoInject?: boolean
198
- push?: PwaPushConfig
199
- backgroundSync?: PwaBackgroundSyncConfig
200
- shareTarget?: PwaShareTargetConfig
201
- fileHandlers?: PwaFileHandlerConfig
202
- protocolHandlers?: PwaProtocolHandlerConfig[]
203
- cacheStorage?: PwaCacheStorageConfig
204
- updates?: PwaUpdateConfig
205
- precache?: PwaPrecacheConfig
307
+ export interface PwaConfig {
308
+ /** Enable PWA features */
309
+ enabled: boolean;
310
+ /** Web App Manifest configuration */
311
+ manifest: PwaManifestConfig;
312
+ /** Icon generation configuration */
313
+ icons?: PwaIconConfig;
314
+ /** Route-based caching strategies */
315
+ routes?: PwaRouteCache[];
316
+ /** Offline fallback configuration */
317
+ offline?: PwaOfflineConfig;
318
+ /** Service worker configuration */
319
+ serviceWorker?: PwaServiceWorkerConfig;
320
+ /** Auto-inject PWA meta tags and service worker registration */
321
+ autoInject?: boolean;
322
+ /** Push notification configuration */
323
+ push?: PwaPushConfig;
324
+ /** Background sync configuration */
325
+ backgroundSync?: PwaBackgroundSyncConfig;
326
+ /** Share target configuration */
327
+ shareTarget?: PwaShareTargetConfig;
328
+ /** File handler configuration */
329
+ fileHandlers?: PwaFileHandlerConfig;
330
+ /** Protocol handlers */
331
+ protocolHandlers?: PwaProtocolHandlerConfig[];
332
+ /** Cache storage limits */
333
+ cacheStorage?: PwaCacheStorageConfig;
334
+ /** Update notification configuration */
335
+ updates?: PwaUpdateConfig;
336
+ /** Auto-precaching configuration */
337
+ precache?: PwaPrecacheConfig;
206
338
  }
207
- /**
208
- * Progressive Web App (PWA) Types
209
- */
210
- /**
211
- * PWA caching strategy for service worker routes
212
- */
213
- export type PwaCacheStrategy = 'cache-first' | 'network-first' | 'stale-while-revalidate' | 'network-only' | 'cache-only';
package/dist/types.d.ts CHANGED
@@ -24,5 +24,4 @@
24
24
  * import type { StxConfig, ConditionalDirective } from './types'
25
25
  * ```
26
26
  */
27
- // Re-export everything from the modular types
28
27
  export * from './types/index';
@@ -35,6 +35,17 @@ export declare function inferTypeFromValue(value: unknown): TSType;
35
35
  /**
36
36
  * Type-check an expression against the type context.
37
37
  *
38
+ * Superseded for `.stx` files by `stx typecheck`, which hands template
39
+ * expressions to the real compiler (`stx-virtual-ts.ts` builds the buffer,
40
+ * `typecheck.ts` runs it). #1852 asked for this function to be exported and
41
+ * given a real checker; it got the real checker instead, and deliberately did
42
+ * NOT get exported — two template checkers that disagree is the failure mode
43
+ * this repo keeps hitting.
44
+ *
45
+ * This walk only understands a bare identifier and a dotted member chain, and
46
+ * returns `any` for everything else. Reach for it only where a full compiler
47
+ * pass is not available.
48
+ *
38
49
  * @returns The inferred type of the expression, or an error
39
50
  */
40
51
  export declare function typeCheckExpression(expression: string, context: TemplateTypeContext): TSType | TypeCheckError;
@@ -1,22 +1,3 @@
1
- /**
2
- * Find identifiers a script CALLS that resolve to nothing in the browser.
3
- *
4
- * Restricted to names we can name a cause for — exports of `composables/` with
5
- * no runtime counterpart. A broader "looks like a hook and is not in scope"
6
- * heuristic would fire on legitimate local helpers and app composables, and a
7
- * warning people learn to ignore is worse than no warning.
8
- *
9
- * @param source the script body, after imports have been transformed
10
- * @param provided names already in scope (runtime globals, locals, imports)
11
- */
12
- export declare function findUnresolvedIdentifiers(source: string, provided: Iterable<string>): UnresolvedIdentifier[];
13
- /**
14
- * Report unresolved identifiers against a file, once each.
15
- *
16
- * Returns the diagnostics so callers can assert on them without capturing
17
- * console output.
18
- */
19
- export declare function reportUnresolvedIdentifiers(source: string, provided: Iterable<string>, filePath: string): UnresolvedIdentifier[];
20
1
  /**
21
2
  * Diagnose an identifier a client script calls that will not exist in the browser.
22
3
  *
@@ -44,7 +25,28 @@ export declare function reportUnresolvedIdentifiers(source: string, provided: It
44
25
  * the auto-import list did (#1804).
45
26
  */
46
27
  export declare const SERVER_ONLY_COMPOSABLES: readonly string[];
47
- export declare interface UnresolvedIdentifier {
48
- name: string
49
- message: string
28
+ export interface UnresolvedIdentifier {
29
+ /** The identifier as written. */
30
+ name: string;
31
+ /** Human-readable explanation, including the fix. */
32
+ message: string;
50
33
  }
34
+ /**
35
+ * Find identifiers a script CALLS that resolve to nothing in the browser.
36
+ *
37
+ * Restricted to names we can name a cause for — exports of `composables/` with
38
+ * no runtime counterpart. A broader "looks like a hook and is not in scope"
39
+ * heuristic would fire on legitimate local helpers and app composables, and a
40
+ * warning people learn to ignore is worse than no warning.
41
+ *
42
+ * @param source the script body, after imports have been transformed
43
+ * @param provided names already in scope (runtime globals, locals, imports)
44
+ */
45
+ export declare function findUnresolvedIdentifiers(source: string, provided: Iterable<string>): UnresolvedIdentifier[];
46
+ /**
47
+ * Report unresolved identifiers against a file, once each.
48
+ *
49
+ * Returns the diagnostics so callers can assert on them without capturing
50
+ * console output.
51
+ */
52
+ export declare function reportUnresolvedIdentifiers(source: string, provided: Iterable<string>, filePath: string): UnresolvedIdentifier[];
@@ -7,6 +7,7 @@ export const SERVER_ONLY_COMPOSABLES = [
7
7
  "clearStorage",
8
8
  "copyToClipboard",
9
9
  "createShareableFile",
10
+ "defineForm",
10
11
  "getBatteryLevel",
11
12
  "getCookie",
12
13
  "getCurrentPosition",
@@ -75,6 +76,7 @@ export const SERVER_ONLY_COMPOSABLES = [
75
76
  "useEventSource",
76
77
  "useEyeDropper",
77
78
  "useFavicon",
79
+ "useForm",
78
80
  "useFullscreen",
79
81
  "useGeolocation",
80
82
  "useGeolocationWatch",
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,18 @@
1
+ /**
2
+ * Utility functions for the stx compiler
3
+ *
4
+ * This module provides core utilities for template processing.
5
+ * Some functionality has been extracted to dedicated modules:
6
+ *
7
+ * - validator.ts - Template validation utilities
8
+ * - variable-extractor.ts - Script variable extraction
9
+ *
10
+ * @module utils
11
+ */
1
12
  import type { StxOptions } from './types';
2
- export type {
3
- TemplateValidationError,
4
- TemplateValidationResult,
5
- } from './validator';
13
+ export { extractDirectiveNames, getPositionInfo, hasDirectives, validateDirective, validateTemplate, } from './validator';
14
+ export type { TemplateValidationError, TemplateValidationResult, } from './validator';
15
+ export { convertToCommonJS, extractScriptFromTemplate, extractVariables, hasVariables, } from './variable-extractor';
6
16
  /**
7
17
  * Check if script should be treated as plain JavaScript (opt-out from TypeScript)
8
18
  * By default ALL scripts are TypeScript. Use <script js> or <script lang="js"> to opt-out.
@@ -54,7 +64,7 @@ export declare function slotContentHasExpressions(slotContent: string): boolean;
54
64
  * named `title` also exists in the server context.
55
65
  */
56
66
  export declare function componentClientSignalNames(scripts: string[]): string[];
57
- export declare function renderComponentWithSlot(componentPath: string, props: Record<string, unknown>, slotContent: string, componentsDir: string, parentContext: Record<string, unknown>, parentFilePath: string, options: StxOptions, processedComponents?: Set<string> | undefined, dependencies: Set<string>): Promise<string>;
67
+ export declare function renderComponentWithSlot(componentPath: string, props: Record<string, unknown>, slotContent: string, componentsDir: string, parentContext: Record<string, unknown>, parentFilePath: string, options: StxOptions, processedComponents: Set<string> | undefined, dependencies: Set<string>): Promise<string>;
58
68
  /**
59
69
  * Check if a file exists
60
70
  */
@@ -71,7 +81,11 @@ export declare function resolveTemplatePath(templatePath: string, currentFilePat
71
81
  * @param errorPattern The pattern to locate in the template (fallback if position not available)
72
82
  * @returns Line number and context information
73
83
  */
74
- export declare function getSourceLineInfo(template: string, errorPosition?: number, errorPattern?: string): { lineNumber: number, lineContent: string, context: string };
84
+ export declare function getSourceLineInfo(template: string, errorPosition?: number, errorPattern?: string): {
85
+ lineNumber: number;
86
+ lineContent: string;
87
+ context: string;
88
+ };
75
89
  /**
76
90
  * Create a descriptive error message with line information
77
91
  * @param errorType Type of error (e.g., "Expression", "Directive")
@@ -91,18 +105,7 @@ export declare function clearComponentCache(): void;
91
105
  /**
92
106
  * Get component cache statistics
93
107
  */
94
- export declare function getComponentCacheStats(): { size: number, maxSize: number };
95
- // Re-export from extracted modules for backward compatibility
96
- export {
97
- extractDirectiveNames,
98
- getPositionInfo,
99
- hasDirectives,
100
- validateDirective,
101
- validateTemplate,
102
- } from './validator';
103
- export {
104
- convertToCommonJS,
105
- extractScriptFromTemplate,
106
- extractVariables,
107
- hasVariables,
108
- } from './variable-extractor';
108
+ export declare function getComponentCacheStats(): {
109
+ size: number;
110
+ maxSize: number;
111
+ };