@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
@@ -46,7 +46,7 @@ export declare interface PermissionsContext {
46
46
  * Translation context for @translate, @t directives
47
47
  */
48
48
  export declare interface TranslationContext {
49
-
49
+ [locale: string]: Record<string, string>
50
50
  }
51
51
  /**
52
52
  * Base template context with common properties
@@ -62,12 +62,13 @@ export declare interface BaseTemplateContext {
62
62
  loop?: LoopContext
63
63
  $loop?: LoopContext
64
64
  slot?: string
65
+ [key: string]: unknown
65
66
  }
66
67
  /**
67
68
  * Template context type alias for backward compatibility
68
69
  * Use BaseTemplateContext for new code
69
70
  */
70
- export type TemplateContext = BaseTemplateContext
71
+ export type TemplateContext = BaseTemplateContext;
71
72
  /**
72
73
  * Generic template context that allows specifying custom typed properties
73
74
  *
@@ -88,12 +89,12 @@ export type TemplateContext = BaseTemplateContext
88
89
  * }
89
90
  * ```
90
91
  */
91
- export type TypedContext<T extends Record<string, unknown>> = BaseTemplateContext & T
92
+ export type TypedContext<T extends Record<string, unknown>> = BaseTemplateContext & T;
92
93
  /**
93
94
  * Utility type to extract the value type from a context key
94
95
  */
95
- export type ContextValue<C extends BaseTemplateContext, K extends keyof C> = C[K]
96
+ export type ContextValue<C extends BaseTemplateContext, K extends keyof C> = C[K];
96
97
  /**
97
98
  * Utility type to make certain context properties required
98
99
  */
99
- export type RequireContextKeys<C extends BaseTemplateContext, K extends keyof C> = Required<Pick<C, K>> & Omit<C, K>
100
+ export type RequireContextKeys<C extends BaseTemplateContext, K extends keyof C> = Required<Pick<C, K>> & Omit<C, K>;
@@ -72,8 +72,8 @@ export type CspSourceValue = | '\'self\''
72
72
  | 'http:'
73
73
  | 'ws:'
74
74
  | 'wss:'
75
- | string
75
+ | string // Allow custom URLs and nonces like 'nonce-xxx' or 'sha256-xxx';
76
76
  /**
77
77
  * Preset CSP configurations for common use cases
78
78
  */
79
- export type CspPreset = 'strict' | 'moderate' | 'relaxed' | 'api'
79
+ export type CspPreset = 'strict' | 'moderate' | 'relaxed' | 'api';
@@ -9,7 +9,7 @@ export declare function isDirectiveKind<K extends Directive['kind']>(directive:
9
9
  * Base directive type with common properties
10
10
  */
11
11
  declare interface BaseDirective {
12
- kind: string
12
+ readonly kind: string
13
13
  raw: string
14
14
  start: number
15
15
  end: number
@@ -234,11 +234,11 @@ export type Directive = | ConditionalDirective
234
234
  | ScriptDirective
235
235
  | EnvDirective
236
236
  | I18nDirective
237
- | UserCustomDirective
237
+ | UserCustomDirective;
238
238
  /**
239
239
  * Helper type to extract directive by kind
240
240
  */
241
- export type DirectiveOfKind<K extends Directive['kind']> = Extract<Directive, { kind: K }>
241
+ export type DirectiveOfKind<K extends Directive['kind']> = Extract<Directive, { kind: K }>;
242
242
  /**
243
243
  * Custom directive handler function
244
244
  */
@@ -247,7 +247,7 @@ export type CustomDirectiveHandler = (
247
247
  params: string[],
248
248
  context: Record<string, unknown>,
249
249
  filePath: string
250
- ) => string | Promise<string>
250
+ ) => string | Promise<string>;
251
251
  /**
252
252
  * Middleware handler function
253
253
  */
@@ -256,4 +256,4 @@ export type MiddlewareHandler = (
256
256
  context: Record<string, unknown>,
257
257
  filePath: string,
258
258
  options: import('./config-types').StxOptions
259
- ) => string | Promise<string>
259
+ ) => string | Promise<string>;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * stx Types
3
+ *
4
+ * This file re-exports all types from domain-specific type files.
5
+ * For new code, prefer importing from specific type files for better code organization.
6
+ *
7
+ * @example
8
+ * // Import from specific file (preferred)
9
+ * import type { StxConfig } from './types/config-types'
10
+ *
11
+ * // Or import from index (backward compatible)
12
+ * import type { StxConfig } from './types'
13
+ */
14
+ // Context types
1
15
  export type {
2
16
  AuthContext,
3
17
  BaseTemplateContext,
@@ -9,6 +23,7 @@ export type {
9
23
  TranslationContext,
10
24
  TypedContext,
11
25
  } from './context-types';
26
+ // Directive types
12
27
  export type {
13
28
  A11yDirective,
14
29
  AuthDirective,
@@ -33,6 +48,7 @@ export type {
33
48
  SwitchDirective,
34
49
  UserCustomDirective,
35
50
  } from './directive-types';
51
+ // Component types
36
52
  export type {
37
53
  ComponentConfig,
38
54
  ComponentDefinition,
@@ -48,6 +64,7 @@ export type {
48
64
  WebComponent,
49
65
  WebComponentConfig,
50
66
  } from './component-types';
67
+ // Config types
51
68
  export type {
52
69
  A11yConfig,
53
70
  AnalyticsConfig,
@@ -64,12 +81,14 @@ export type {
64
81
  SeoFeatureConfig,
65
82
  StreamingConfig,
66
83
  StreamRenderer,
84
+ StrictModeConfig,
67
85
  StxConfig,
68
86
  StxOptions,
69
87
  SyntaxHighlightingConfig,
70
88
  SyntaxHighlightTheme,
71
89
  TwitterConfig,
72
90
  } from './config-types';
91
+ // PWA types
73
92
  export type {
74
93
  PwaBackgroundSyncConfig,
75
94
  PwaCacheStorageConfig,
@@ -89,10 +108,11 @@ export type {
89
108
  PwaShortcut,
90
109
  PwaUpdateConfig,
91
110
  } from './pwa-types';
111
+ // CSP types
92
112
  export type {
93
113
  CspConfig,
94
114
  CspDirectives,
95
115
  CspPreset,
96
116
  CspSourceValue,
97
117
  } from './csp-types';
98
- export { isDirectiveKind } from './directive-types';
118
+ export { isDirectiveKind } from './directive-types';
@@ -100,9 +100,7 @@ export declare interface PwaPushConfig {
100
100
  defaultIcon?: string
101
101
  defaultBadge?: string
102
102
  defaultOptions?: {
103
- /** Enable vibration */
104
103
  vibrate?: number[]
105
- /** Require interaction to dismiss */
106
104
  requireInteraction?: boolean
107
105
  }
108
106
  }
@@ -127,11 +125,8 @@ export declare interface PwaShareTargetConfig {
127
125
  method?: 'GET' | 'POST'
128
126
  enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data'
129
127
  params?: {
130
- /** Parameter name for shared title */
131
128
  title?: string
132
- /** Parameter name for shared text */
133
129
  text?: string
134
- /** Parameter name for shared URL */
135
130
  url?: string
136
131
  }
137
132
  acceptFiles?: Array<{
@@ -215,4 +210,4 @@ export declare interface PwaConfig {
215
210
  /**
216
211
  * PWA caching strategy for service worker routes
217
212
  */
218
- export type PwaCacheStrategy = 'cache-first' | 'network-first' | 'stale-while-revalidate' | 'network-only' | 'cache-only'
213
+ export type PwaCacheStrategy = 'cache-first' | 'network-first' | 'stale-while-revalidate' | 'network-only' | 'cache-only';
package/dist/types.d.ts CHANGED
@@ -1 +1,28 @@
1
- export * from './types/index';
1
+ /**
2
+ * stx Types
3
+ *
4
+ * This file re-exports all types from the modular types directory.
5
+ * The types have been split into domain-specific files for better organization:
6
+ *
7
+ * - types/context-types.ts - Template context and authentication types
8
+ * - types/directive-types.ts - All directive types (discriminated unions)
9
+ * - types/component-types.ts - Component system and documentation types
10
+ * - types/config-types.ts - Configuration types for stx options
11
+ * - types/pwa-types.ts - Progressive Web App configuration types
12
+ * - types/csp-types.ts - Content Security Policy types
13
+ *
14
+ * For new code, prefer importing from specific type files:
15
+ * @example
16
+ * ```typescript
17
+ * import type { StxConfig } from './types/config-types'
18
+ * import type { ConditionalDirective } from './types/directive-types'
19
+ * ```
20
+ *
21
+ * For backward compatibility, you can still import from this file:
22
+ * @example
23
+ * ```typescript
24
+ * import type { StxConfig, ConditionalDirective } from './types'
25
+ * ```
26
+ */
27
+ // Re-export everything from the modular types
28
+ export * from './types/index';
@@ -141,38 +141,5 @@ export declare interface GeneratedTypes {
141
141
  content: string
142
142
  filename: string
143
143
  }
144
- /**
145
- * TypeScript-First Templates Module
146
- *
147
- * Provides compile-time type checking and TypeScript support for stx templates.
148
- *
149
- * ## Features
150
- *
151
- * 1. **Type-Safe Context** - Define typed interfaces for template context
152
- * 2. **Compile-Time Checking** - Validate expressions against context types
153
- * 3. **Type Inference** - Infer types from script blocks
154
- * 4. **Type Generation** - Generate TypeScript definitions from templates
155
- * 5. **IDE Support** - Enable autocomplete and type hints in editors
156
- *
157
- * ## Usage
158
- *
159
- * ```html
160
- * <!-- Define context type at top of template -->
161
- * @types
162
- * interface PageContext {
163
- * title: string
164
- * items: Array<{ id: number; name: string }>
165
- * user?: { name: string; role: 'admin' | 'user' }
166
- * }
167
- * @endtypes
168
- *
169
- * <h1>{{ title }}</h1>
170
- * @foreach(items as item)
171
- * <p>{{ item.name }}</p> <!-- Type-checked! -->
172
- * @endforeach
173
- * ```
174
- *
175
- * @module typescript-templates
176
- */
177
144
  /** Supported TypeScript primitive types */
178
- export type TSPrimitiveType = 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'any' | 'unknown' | 'never' | 'void'
145
+ export type TSPrimitiveType = 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'any' | 'unknown' | 'never' | 'void';
package/dist/utils.d.ts CHANGED
@@ -58,6 +58,7 @@ export declare function clearComponentCache(): void;
58
58
  * Get component cache statistics
59
59
  */
60
60
  export declare function getComponentCacheStats(): { size: number, maxSize: number };
61
+ // Re-export from extracted modules for backward compatibility
61
62
  export {
62
63
  extractDirectiveNames,
63
64
  getPositionInfo,
@@ -70,4 +71,4 @@ export {
70
71
  extractScriptFromTemplate,
71
72
  extractVariables,
72
73
  hasVariables,
73
- } from './variable-extractor';
74
+ } from './variable-extractor';
@@ -74,4 +74,4 @@ export declare interface TemplateValidationResult {
74
74
  valid: boolean
75
75
  errors: TemplateValidationError[]
76
76
  warnings: TemplateValidationError[]
77
- }
77
+ }
@@ -36,4 +36,4 @@ export declare function extractScriptFromTemplate(template: string): {
36
36
  * @param scriptContent - The script content
37
37
  * @returns Whether variables are present
38
38
  */
39
- export declare function hasVariables(scriptContent: string): boolean;
39
+ export declare function hasVariables(scriptContent: string): boolean;
@@ -168,4 +168,4 @@ export declare function clearComposers(): void;
168
168
  * }
169
169
  * ```
170
170
  */
171
- export type ViewComposerCallback = (context: Record<string, any>, filePath: string) => void | Promise<void>
171
+ export type ViewComposerCallback = (context: Record<string, any>, filePath: string) => void | Promise<void>;
@@ -93,6 +93,9 @@ export declare interface VirtualGridOptions {
93
93
  gap?: number
94
94
  overscan?: number
95
95
  }
96
+ // ============================================================================
97
+ // Exports
98
+ // ============================================================================
96
99
  export default {
97
100
  createVirtualList,
98
101
  processVirtualListDirectives,
@@ -100,4 +103,4 @@ export default {
100
103
  processVirtualGridDirectives,
101
104
  generateVirtualListCSS,
102
105
  useVirtualList,
103
- };
106
+ };
@@ -157,34 +157,6 @@ export declare interface InsertResult {
157
157
  content: string
158
158
  cursorPosition: EditorPosition
159
159
  }
160
- /**
161
- * Visual Editor Integration Module
162
- *
163
- * Provides APIs for visual template editing in IDEs and editors.
164
- * This module enables:
165
- * - Template AST visualization
166
- * - Component outline/structure view
167
- * - Drag-and-drop component editing
168
- * - Live preview support
169
- * - Template property inspection
170
- *
171
- * ## Usage
172
- *
173
- * ```typescript
174
- * import { analyzeTemplate, getTemplateOutline, generatePreview } from 'stx/visual-editor'
175
- *
176
- * // Analyze template structure
177
- * const analysis = analyzeTemplate(templateContent)
178
- *
179
- * // Get hierarchical outline
180
- * const outline = getTemplateOutline(templateContent)
181
- *
182
- * // Generate preview HTML
183
- * const preview = await generatePreview(templateContent, context)
184
- * ```
185
- *
186
- * @module visual-editor
187
- */
188
160
  /** Node types in template outline */
189
161
  export type OutlineNodeType = | 'document'
190
162
  | 'element'
@@ -196,7 +168,7 @@ export type OutlineNodeType = | 'document'
196
168
  | 'script'
197
169
  | 'style'
198
170
  | 'comment'
199
- | 'text'
171
+ | 'text';
200
172
  /** Directive category for visual grouping */
201
173
  export type DirectiveCategory = | 'control-flow'
202
174
  | 'loop'
@@ -206,4 +178,4 @@ export type DirectiveCategory = | 'control-flow'
206
178
  | 'form'
207
179
  | 'seo'
208
180
  | 'i18n'
209
- | 'custom'
181
+ | 'custom';
@@ -98,6 +98,9 @@ export declare interface ReportConfig {
98
98
  title?: string
99
99
  includeScreenshots?: boolean
100
100
  }
101
+ // =============================================================================
102
+ // Exports
103
+ // =============================================================================
101
104
  export default {
102
105
  createSnapshotTester,
103
106
  createVisualRegressionTester,
@@ -106,4 +109,4 @@ export default {
106
109
  snapshot,
107
110
  snapshotJson,
108
111
  defaultViewports,
109
- };
112
+ };
@@ -13,4 +13,4 @@ export declare function hasVueTemplateSyntax(template: string): boolean;
13
13
  * @param template - The template string potentially containing Vue directives
14
14
  * @returns The template with Vue directives converted to stx equivalents
15
15
  */
16
- export declare function processVueTemplate(template: string): string;
16
+ export declare function processVueTemplate(template: string): string;
@@ -51,4 +51,4 @@ export declare interface CssScopingOptions {
51
51
  preserveHost?: boolean
52
52
  scopeKeyframes?: boolean
53
53
  scopeCustomProperties?: boolean
54
- }
54
+ }
@@ -5,6 +5,15 @@ export type {
5
5
  ReactiveProperty,
6
6
  WatchDefinition,
7
7
  } from './reactive-generator';
8
+ /**
9
+ * Web Components Module
10
+ *
11
+ * Provides utilities for building web components from stx templates.
12
+ * This module has been split into focused sub-modules:
13
+ *
14
+ * - css-scoping.ts - CSS scoping and style isolation
15
+ * - reactive-generator.ts - Reactive component code generation
16
+ */
8
17
  export {
9
18
  extractStyleFromTemplate,
10
19
  generateComponentId,
@@ -17,4 +26,4 @@ export {
17
26
  generateReactiveComponentTS,
18
27
  generateReactiveMixin,
19
28
  generateReactiveRuntime,
20
- } from './reactive-generator';
29
+ } from './reactive-generator';
@@ -69,4 +69,4 @@ export declare interface ReactiveComponentOptions {
69
69
  adopted?: string
70
70
  attributeChanged?: string
71
71
  }
72
- }
72
+ }
@@ -226,4 +226,4 @@ export declare interface ParsedSFCComponent {
226
226
  /**
227
227
  * CSS scoping strategy
228
228
  */
229
- export type CssScopingStrategy = 'shadow' | 'prefix' | 'attribute' | 'bem'
229
+ export type CssScopingStrategy = 'shadow' | 'prefix' | 'attribute' | 'bem';
@@ -5,17 +5,24 @@
5
5
  * - x-data: Define reactive data scope
6
6
  * - x-model: Two-way binding for inputs
7
7
  * - x-text: Reactive text content
8
- * - @event: Event handling (e.g., @click, @submit)
8
+ * - x-show: Toggle visibility based on expression
9
+ * - :class: Bind CSS classes from object expression
10
+ * - :disabled, :href, :src, etc.: Bind any attribute
11
+ * - @event: Event handling (e.g., @click, @submit.prevent)
9
12
  *
10
13
  * Note: Use @if, @for, @foreach for server-side rendering.
11
14
  * x-element is only for client-side interactivity that SSR can't handle.
12
15
  *
13
16
  * @example
14
17
  * ```html
15
- * <div x-data="{ name: '', count: 0 }">
16
- * <input x-model="name" />
17
- * <p>Hello, <span x-text="name"></span>!</p>
18
- * <button @click="count++">Count: <span x-text="count"></span></button>
18
+ * <div x-data="{ email: '', loading: false, success: false }">
19
+ * <form @submit.prevent="subscribe()">
20
+ * <input x-model="email" type="email" />
21
+ * <button type="submit" :disabled="loading">
22
+ * <span x-text="loading ? 'Sending...' : 'Subscribe'"></span>
23
+ * </button>
24
+ * </form>
25
+ * <p x-show="success" x-text="'Thanks for subscribing!'"></p>
19
26
  * </div>
20
27
  * ```
21
28
  */
@@ -32,4 +39,4 @@ export declare function hasXElementDirectives(template: string): boolean;
32
39
  * Process x-element directives in template
33
40
  * Injects the runtime if x-* directives are found
34
41
  */
35
- export declare function processXElementDirectives(template: string): string;
42
+ export declare function processXElementDirectives(template: string): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.4",
4
+ "version": "0.2.6",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -104,9 +104,9 @@
104
104
  },
105
105
  "dependencies": {
106
106
  "@stacksjs/clapp": "^0.2.0",
107
- "@stacksjs/desktop": "0.2.4",
108
- "@stacksjs/sanitizer": "0.2.4",
109
- "bun-plugin-stx": "0.2.4",
107
+ "@stacksjs/desktop": "0.2.6",
108
+ "@stacksjs/sanitizer": "0.2.6",
109
+ "bun-plugin-stx": "0.2.6",
110
110
  "bunfig": "^0.15.6",
111
111
  "ts-syntax-highlighter": "^0.2.1"
112
112
  }