@stacksjs/stx 0.1.16 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/dist/a11y.d.ts +109 -5
  2. package/dist/analytics.d.ts +40 -0
  3. package/dist/animation.d.ts +91 -1
  4. package/dist/app.d.ts +51 -0
  5. package/dist/ast.d.ts +286 -0
  6. package/dist/async-components.d.ts +101 -0
  7. package/dist/auth.d.ts +1 -3
  8. package/dist/browser-composables.d.ts +314 -0
  9. package/dist/build-optimizer.d.ts +126 -0
  10. package/dist/build-views.d.ts +37 -0
  11. package/dist/bundle-analyzer/collector.d.ts +66 -0
  12. package/dist/bundle-analyzer/index.d.ts +60 -0
  13. package/dist/bundle-analyzer/report.d.ts +39 -0
  14. package/dist/bundle-analyzer/treemap.d.ts +19 -0
  15. package/dist/bundle-analyzer.js +499 -0
  16. package/dist/caching.d.ts +7 -0
  17. package/dist/cli.js +10885 -1203
  18. package/dist/client/directive.d.ts +10 -0
  19. package/dist/client/index.d.ts +7 -0
  20. package/dist/client/router.d.ts +36 -0
  21. package/dist/client/stx-router.browser.d.ts +0 -0
  22. package/dist/client-script.d.ts +22 -0
  23. package/dist/component-hmr.d.ts +120 -0
  24. package/dist/components.d.ts +23 -1
  25. package/dist/composables/index.d.ts +277 -0
  26. package/dist/composables/use-battery.d.ts +46 -0
  27. package/dist/composables/use-broadcast-channel.d.ts +58 -0
  28. package/dist/composables/use-clipboard.d.ts +34 -0
  29. package/dist/composables/use-cookie.d.ts +70 -0
  30. package/dist/composables/use-device-orientation.d.ts +109 -0
  31. package/dist/composables/use-event-source.d.ts +77 -0
  32. package/dist/composables/use-eye-dropper.d.ts +107 -0
  33. package/dist/composables/use-fetch.d.ts +84 -0
  34. package/dist/composables/use-fullscreen.d.ts +47 -0
  35. package/dist/composables/use-geolocation.d.ts +62 -0
  36. package/dist/composables/use-idle.d.ts +84 -0
  37. package/dist/composables/use-intersection-observer.d.ts +81 -0
  38. package/dist/composables/use-keyboard.d.ts +100 -0
  39. package/dist/composables/use-media-query.d.ts +56 -0
  40. package/dist/composables/use-mouse.d.ts +64 -0
  41. package/dist/composables/use-mutation-observer.d.ts +101 -0
  42. package/dist/composables/use-network.d.ts +40 -0
  43. package/dist/composables/use-notification.d.ts +89 -0
  44. package/dist/composables/use-permissions.d.ts +109 -0
  45. package/dist/composables/use-resize-observer.d.ts +60 -0
  46. package/dist/composables/use-share.d.ts +70 -0
  47. package/dist/composables/use-speech.d.ts +117 -0
  48. package/dist/composables/use-storage.d.ts +64 -0
  49. package/dist/composables/use-text-selection.d.ts +97 -0
  50. package/dist/composables/use-wake-lock.d.ts +85 -0
  51. package/dist/composables/use-websocket.d.ts +69 -0
  52. package/dist/composables/use-window.d.ts +84 -0
  53. package/dist/composables.d.ts +268 -0
  54. package/dist/composition-api.d.ts +190 -0
  55. package/dist/computed.d.ts +137 -0
  56. package/dist/conditionals.d.ts +14 -2
  57. package/dist/config.d.ts +36 -3
  58. package/dist/craft-bridge.d.ts +319 -0
  59. package/dist/craft-compiler.d.ts +229 -0
  60. package/dist/craft-components.d.ts +411 -0
  61. package/dist/craft-entry.d.ts +5 -0
  62. package/dist/craft-ssr.d.ts +134 -0
  63. package/dist/craft.js +1553 -0
  64. package/dist/csp.d.ts +229 -0
  65. package/dist/database.d.ts +407 -0
  66. package/dist/database.js +5 -0
  67. package/dist/defer.d.ts +4 -0
  68. package/dist/deploy/config-generators.d.ts +75 -0
  69. package/dist/deploy/index.d.ts +84 -0
  70. package/dist/deploy/netlify.d.ts +109 -0
  71. package/dist/dev-server/crosswind.d.ts +54 -0
  72. package/dist/dev-server/index.d.ts +7 -0
  73. package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
  74. package/dist/dev-server/native-window.d.ts +40 -0
  75. package/dist/dev-server/port-utils.d.ts +27 -0
  76. package/dist/dev-server/terminal-colors.d.ts +60 -0
  77. package/dist/dev-server/theme-selector.d.ts +32 -0
  78. package/dist/dev-server/types.d.ts +92 -0
  79. package/dist/dev-server.d.ts +21 -0
  80. package/dist/devtools.d.ts +142 -0
  81. package/dist/directive-api.d.ts +111 -0
  82. package/dist/dynamic-components.d.ts +14 -0
  83. package/dist/edge-runtime.d.ts +200 -0
  84. package/dist/env.d.ts +9 -0
  85. package/dist/error-boundaries.d.ts +71 -0
  86. package/dist/error-handling.d.ts +1 -101
  87. package/dist/errors/codes.d.ts +99 -0
  88. package/dist/errors/formatter.d.ts +64 -0
  89. package/dist/errors/index.d.ts +56 -0
  90. package/dist/errors/logger.d.ts +74 -0
  91. package/dist/errors/sanitizer.d.ts +43 -0
  92. package/dist/errors/types.d.ts +79 -0
  93. package/dist/events.d.ts +106 -0
  94. package/dist/expressions.d.ts +86 -11
  95. package/dist/formatter.d.ts +4 -0
  96. package/dist/forms-validation.d.ts +173 -0
  97. package/dist/forms.d.ts +157 -8
  98. package/dist/head.d.ts +225 -0
  99. package/dist/heatmap.d.ts +125 -0
  100. package/dist/hot-reload.d.ts +87 -0
  101. package/dist/hydration-runtime.d.ts +47 -0
  102. package/dist/hydration.d.ts +161 -0
  103. package/dist/i18n.d.ts +240 -4
  104. package/dist/image-optimization/build-plugin.d.ts +53 -0
  105. package/dist/image-optimization/component.d.ts +46 -0
  106. package/dist/image-optimization/directive.d.ts +30 -0
  107. package/dist/image-optimization/index.d.ts +86 -0
  108. package/dist/image-optimization/processor.d.ts +112 -0
  109. package/dist/includes.d.ts +94 -9
  110. package/dist/index.d.ts +63 -3
  111. package/dist/index.js +11604 -1318
  112. package/dist/init.d.ts +32 -2
  113. package/dist/interactive.d.ts +14 -0
  114. package/dist/internal-markdown.d.ts +22 -0
  115. package/dist/jsx-runtime.d.ts +110 -0
  116. package/dist/keep-alive.d.ts +87 -0
  117. package/dist/lazy-loader.d.ts +122 -0
  118. package/dist/loading-indicator.d.ts +40 -0
  119. package/dist/loops.d.ts +22 -1
  120. package/dist/media/client/blur-up.d.ts +65 -0
  121. package/dist/media/client/index.d.ts +77 -0
  122. package/dist/media/client/lazy-load.d.ts +73 -0
  123. package/dist/media/client/upload-handler.d.ts +79 -0
  124. package/dist/media/image/component.d.ts +46 -0
  125. package/dist/media/image/directive.d.ts +9 -0
  126. package/dist/media/image/editing.d.ts +212 -0
  127. package/dist/media/image/index.d.ts +118 -0
  128. package/dist/media/image/placeholder.d.ts +78 -0
  129. package/dist/media/image/processor/cache.d.ts +32 -0
  130. package/dist/media/image/processor/index.d.ts +12 -0
  131. package/dist/media/image/processor/optimizer.d.ts +13 -0
  132. package/dist/media/image/processor/responsive.d.ts +17 -0
  133. package/dist/media/image/srcset.d.ts +158 -0
  134. package/dist/media/index.d.ts +295 -0
  135. package/dist/media/manager/embed.d.ts +25 -0
  136. package/dist/media/protected/component.d.ts +34 -0
  137. package/dist/media/protected/index.d.ts +34 -0
  138. package/dist/media/protected/signature.d.ts +72 -0
  139. package/dist/media/shared/cache.d.ts +54 -0
  140. package/dist/media/shared/hash.d.ts +24 -0
  141. package/dist/media/shared/index.d.ts +2 -0
  142. package/dist/media/types.d.ts +1051 -0
  143. package/dist/media/upload/component.d.ts +23 -0
  144. package/dist/media/upload/index.d.ts +1 -0
  145. package/dist/media/video/directive.d.ts +9 -0
  146. package/dist/media/video/index.d.ts +47 -0
  147. package/dist/media/video/processor/cache.d.ts +33 -0
  148. package/dist/media/video/processor/index.d.ts +21 -0
  149. package/dist/media/video/processor/streaming.d.ts +19 -0
  150. package/dist/media/video/processor/thumbnail.d.ts +28 -0
  151. package/dist/media/video/processor/transcoder.d.ts +9 -0
  152. package/dist/middleware.d.ts +42 -3
  153. package/dist/native-build.d.ts +74 -0
  154. package/dist/parser/directive-parser.d.ts +79 -0
  155. package/dist/parser/expression-parser.d.ts +59 -0
  156. package/dist/parser/index.d.ts +35 -0
  157. package/dist/parser/tokenizer.d.ts +81 -0
  158. package/dist/partial-hydration.d.ts +88 -0
  159. package/dist/performance-utils.d.ts +146 -3
  160. package/dist/plugin-system.d.ts +128 -0
  161. package/dist/plugin.d.ts +1 -0
  162. package/dist/precompiler.d.ts +108 -0
  163. package/dist/production-build.d.ts +199 -0
  164. package/dist/props.d.ts +199 -0
  165. package/dist/pwa/audit.d.ts +42 -0
  166. package/dist/pwa/directives.d.ts +29 -0
  167. package/dist/pwa/icons.d.ts +39 -0
  168. package/dist/pwa/index.d.ts +59 -0
  169. package/dist/pwa/inject.d.ts +22 -0
  170. package/dist/pwa/manifest.d.ts +104 -0
  171. package/dist/pwa/offline.d.ts +8 -0
  172. package/dist/pwa/precache.d.ts +29 -0
  173. package/dist/pwa/service-worker.d.ts +21 -0
  174. package/dist/pwa/workbox-strategies.d.ts +100 -0
  175. package/dist/pwa/workbox.d.ts +52 -0
  176. package/dist/pwa.d.ts +51 -0
  177. package/dist/pwa.js +8124 -0
  178. package/dist/reactive-bindings.d.ts +24 -0
  179. package/dist/reactive.d.ts +100 -0
  180. package/dist/reactivity.d.ts +253 -0
  181. package/dist/route-middleware.d.ts +232 -0
  182. package/dist/router.d.ts +31 -0
  183. package/dist/routes.d.ts +0 -7
  184. package/dist/runtime.d.ts +140 -0
  185. package/dist/safe-evaluator.d.ts +117 -3
  186. package/dist/scaffolding.d.ts +113 -0
  187. package/dist/seo.d.ts +120 -7
  188. package/dist/server-components.d.ts +134 -0
  189. package/dist/signals.d.ts +501 -0
  190. package/dist/slots.d.ts +63 -0
  191. package/dist/source-maps.d.ts +117 -0
  192. package/dist/ssg.d.ts +157 -0
  193. package/dist/ssg.js +6831 -0
  194. package/dist/ssr.d.ts +107 -0
  195. package/dist/state-management.d.ts +324 -0
  196. package/dist/stores-client.d.ts +70 -0
  197. package/dist/story/addons.d.ts +123 -0
  198. package/dist/story/analytics.d.ts +92 -0
  199. package/dist/story/auto-stories.d.ts +38 -0
  200. package/dist/story/bookmarks.d.ts +53 -0
  201. package/dist/story/bun-test.d.ts +44 -0
  202. package/dist/story/cli.d.ts +34 -0
  203. package/dist/story/collect/analyzer.d.ts +33 -0
  204. package/dist/story/collect/index.d.ts +27 -0
  205. package/dist/story/collect/parser.d.ts +17 -0
  206. package/dist/story/collect/scanner.d.ts +13 -0
  207. package/dist/story/collect/tree.d.ts +17 -0
  208. package/dist/story/commands/build.d.ts +14 -0
  209. package/dist/story/commands/dev.d.ts +16 -0
  210. package/dist/story/commands/index.d.ts +6 -0
  211. package/dist/story/commands/preview.d.ts +15 -0
  212. package/dist/story/compiled-output.d.ts +26 -0
  213. package/dist/story/composition.d.ts +47 -0
  214. package/dist/story/config-watcher.d.ts +26 -0
  215. package/dist/story/config.d.ts +26 -0
  216. package/dist/story/context.d.ts +21 -0
  217. package/dist/story/controls/index.d.ts +54 -0
  218. package/dist/story/crosswind.d.ts +29 -0
  219. package/dist/story/desktop-preview.d.ts +34 -0
  220. package/dist/story/docs-generator.d.ts +30 -0
  221. package/dist/story/errors.d.ts +47 -0
  222. package/dist/story/figma-export.d.ts +169 -0
  223. package/dist/story/generator.d.ts +21 -0
  224. package/dist/story/hmr.d.ts +64 -0
  225. package/dist/story/hot-swap.d.ts +35 -0
  226. package/dist/story/index.d.ts +51 -0
  227. package/dist/story/interactions.d.ts +52 -0
  228. package/dist/story/keyboard-shortcuts.d.ts +34 -0
  229. package/dist/story/output.d.ts +85 -0
  230. package/dist/story/performance.d.ts +76 -0
  231. package/dist/story/presets.d.ts +62 -0
  232. package/dist/story/props-validation.d.ts +45 -0
  233. package/dist/story/renderer.d.ts +53 -0
  234. package/dist/story/search-index.d.ts +47 -0
  235. package/dist/story/search.d.ts +45 -0
  236. package/dist/story/server.d.ts +21 -0
  237. package/dist/story/setup.d.ts +47 -0
  238. package/dist/story/snapshots.d.ts +65 -0
  239. package/dist/story/testing.d.ts +58 -0
  240. package/dist/story/theme.d.ts +68 -0
  241. package/dist/story/types.d.ts +249 -0
  242. package/dist/story/ui/code-panel.d.ts +42 -0
  243. package/dist/story/ui/controls-panel.d.ts +25 -0
  244. package/dist/story/ui/index.d.ts +4 -0
  245. package/dist/story/ui/navigation.d.ts +55 -0
  246. package/dist/story/ui/preview.d.ts +46 -0
  247. package/dist/story/visual-testing.d.ts +45 -0
  248. package/dist/streaming.d.ts +82 -2
  249. package/dist/suspense.d.ts +83 -0
  250. package/dist/teleport.d.ts +9 -0
  251. package/dist/testing.d.ts +289 -0
  252. package/dist/transitions.d.ts +87 -0
  253. package/dist/type-checker.d.ts +109 -0
  254. package/dist/types/component-types.d.ts +129 -0
  255. package/dist/types/config-types.d.ts +336 -0
  256. package/dist/types/context-types.d.ts +99 -0
  257. package/dist/types/csp-types.d.ts +79 -0
  258. package/dist/types/directive-types.d.ts +259 -0
  259. package/dist/types/index.d.ts +98 -0
  260. package/dist/types/pwa-types.d.ts +218 -0
  261. package/dist/types.d.ts +1 -315
  262. package/dist/typescript-templates.d.ts +178 -0
  263. package/dist/utils.d.ts +52 -6
  264. package/dist/validator.d.ts +77 -0
  265. package/dist/variable-extractor.d.ts +39 -0
  266. package/dist/view-composers.d.ts +154 -9
  267. package/dist/virtual-scrolling.d.ts +103 -0
  268. package/dist/visual-editor.d.ts +209 -0
  269. package/dist/visual-testing.d.ts +109 -0
  270. package/dist/visual-testing.js +126 -0
  271. package/dist/vue-template.d.ts +16 -0
  272. package/dist/web-components/css-scoping.d.ts +54 -0
  273. package/dist/web-components/index.d.ts +20 -0
  274. package/dist/web-components/reactive-generator.d.ts +72 -0
  275. package/dist/web-components.d.ts +222 -2
  276. package/dist/x-element.d.ts +35 -0
  277. package/package.json +41 -10
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Define component props with type safety and validation.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * // Simple usage with types only
7
+ * const props = defineProps<{
8
+ * title: string
9
+ * count: number
10
+ * }>()
11
+ *
12
+ * // With validation and defaults
13
+ * const props = defineProps<{
14
+ * title: string
15
+ * count?: number
16
+ * status: 'active' | 'inactive'
17
+ * }>({
18
+ * title: { required: true },
19
+ * count: { default: 0 },
20
+ * status: {
21
+ * default: 'active',
22
+ * validator: (v) => ['active', 'inactive'].includes(v)
23
+ * }
24
+ * })
25
+ * ```
26
+ */
27
+ export declare function defineProps<T extends Record<string, unknown>>(definitions?: PropsDefinition<T>): T;
28
+ /**
29
+ * Define props with runtime validation.
30
+ * Use this when you need validation errors at runtime.
31
+ */
32
+ export declare function definePropsWithValidation<T extends Record<string, unknown>>(definitions: PropsDefinition<T>, options?: {
33
+ componentName?: string
34
+ throwOnError?: boolean
35
+ logWarnings?: boolean
36
+ }): { props: T; validation: PropValidationResult };
37
+ /**
38
+ * Define default values for props.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const props = withDefaults(defineProps<{
43
+ * title: string
44
+ * count?: number
45
+ * items?: string[]
46
+ * }>(), {
47
+ * count: 0,
48
+ * items: () => []
49
+ * })
50
+ * ```
51
+ */
52
+ export declare function withDefaults<T extends Record<string, unknown>>(props: T, defaults: Partial<{ [K in keyof T]: T[K] | (() => T[K]) }>): T;
53
+ /**
54
+ * Create a prop type definition for a specific type.
55
+ */
56
+ export declare function prop<T>(options: PropOptions<T>): PropOptions<T>;
57
+ /**
58
+ * Create a required prop.
59
+ */
60
+ export declare function required<T>(type?: PropType<T>): PropOptions<T>;
61
+ /**
62
+ * Create an optional prop with default.
63
+ */
64
+ export declare function optional<T>(defaultValue: T | (() => T), type?: PropType<T>): PropOptions<T>;
65
+ /**
66
+ * Create a prop with a validator.
67
+ */
68
+ export declare function validated<T>(validator: (value: T) => boolean, options?: Omit<PropOptions<T>, 'validator'>): PropOptions<T>;
69
+ /**
70
+ * Create a prop that accepts one of specific values.
71
+ */
72
+ export declare function oneOf<T extends string | number>(values: readonly T[], options?: Omit<PropOptions<T>, 'validator'>): PropOptions<T>;
73
+ /**
74
+ * Create a prop for array of specific type.
75
+ */
76
+ export declare function arrayOf<T>(_itemType: PropType<T>, options?: Omit<PropOptions<T[]>, 'type'>): PropOptions<T[]>;
77
+ /**
78
+ * Create a prop for object with specific shape.
79
+ */
80
+ export declare function shape<T extends Record<string, unknown>>(_shape: PropsDefinition<T>, options?: Omit<PropOptions<T>, 'type'>): PropOptions<T>;
81
+ /**
82
+ * Process props passed to a component.
83
+ * Called internally during component rendering.
84
+ */
85
+ export declare function processComponentProps(rawProps: Record<string, unknown>, definitions?: PropsDefinition<Record<string, unknown>>, componentName?: string): Record<string, unknown>;
86
+ /**
87
+ * Define component events (emits).
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const emit = defineEmits<{
92
+ * 'update:value': string
93
+ * 'submit': { data: FormData }
94
+ * 'close': void
95
+ * }>()
96
+ *
97
+ * // Usage
98
+ * emit('update:value', 'new value')
99
+ * emit('submit', { data: formData })
100
+ * emit('close', undefined)
101
+ * ```
102
+ */
103
+ export declare function defineEmits<E extends Record<string, unknown>>(): EmitFn<E>;
104
+ /**
105
+ * Expose component methods/properties to parent.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * defineExpose({
110
+ * focus: () => inputRef.value?.focus(),
111
+ * reset: () => { value = '' },
112
+ * value: computed(() => internalValue)
113
+ * })
114
+ * ```
115
+ */
116
+ export declare function defineExpose<T extends Record<string, unknown>>(exposed: T): void;
117
+ /**
118
+ * Generate TypeScript interface from prop definitions.
119
+ * Useful for documentation and type generation.
120
+ */
121
+ export declare function generatePropsInterface(componentName: string, definitions: PropsDefinition<Record<string, unknown>>): string;
122
+ /** Prop definition options */
123
+ export declare interface PropOptions<T = unknown> {
124
+ type?: PropType<T> | PropType<T>[]
125
+ required?: boolean
126
+ default?: T | (() => T)
127
+ validator?: (value: T) => boolean
128
+ description?: string
129
+ }
130
+ /** Prop validation error */
131
+ export declare interface PropValidationError {
132
+ prop: string
133
+ message: string
134
+ value: unknown
135
+ expected?: string
136
+ }
137
+ /** Prop validation result */
138
+ export declare interface PropValidationResult {
139
+ valid: boolean
140
+ errors: PropValidationError[]
141
+ warnings: string[]
142
+ }
143
+ /**
144
+ * STX Props System
145
+ *
146
+ * Provides type-safe component props with runtime validation.
147
+ *
148
+ * @module props
149
+ *
150
+ * @example
151
+ * ```html
152
+ * <script>
153
+ * import { defineProps } from 'stx'
154
+ *
155
+ * const props = defineProps<{
156
+ * title: string
157
+ * count?: number
158
+ * items: string[]
159
+ * }>({
160
+ * title: { required: true },
161
+ * count: { default: 0 },
162
+ * items: { default: () => [] }
163
+ * })
164
+ * </script>
165
+ *
166
+ * <h1>{{ props.title }}</h1>
167
+ * <p>Count: {{ props.count }}</p>
168
+ * ```
169
+ */
170
+ /** Supported prop types */
171
+ export type PropType<T> = | StringConstructor
172
+ | NumberConstructor
173
+ | BooleanConstructor
174
+ | ArrayConstructor
175
+ | ObjectConstructor
176
+ | FunctionConstructor
177
+ | DateConstructor
178
+ | SymbolConstructor
179
+ | { new (...args: unknown[]): T }
180
+ | PropType<T>[]
181
+ /** Props definition object */
182
+ export type PropsDefinition<T> = {
183
+ [K in keyof T]?: PropOptions<T[K]> | PropType<T[K]>
184
+ }
185
+ /** Extracted prop types */
186
+ export type ExtractPropTypes<T extends PropsDefinition<unknown>> = {
187
+ [K in keyof T]: T[K] extends PropOptions<infer V>
188
+ ? V
189
+ : T[K] extends PropType<infer V>
190
+ ? V
191
+ : unknown
192
+ }
193
+ /** Event handler type */
194
+ export type EventHandler<T = unknown> = (payload: T) => void
195
+ /** Emit function type */
196
+ export type EmitFn<E extends Record<string, unknown>> = <K extends keyof E>(
197
+ event: K,
198
+ payload: E[K],
199
+ ) => void
@@ -0,0 +1,42 @@
1
+ import type { StxOptions } from '../types';
2
+ /**
3
+ * Run PWA configuration audit
4
+ */
5
+ export declare function auditConfig(options: StxOptions): AuditCheck[];
6
+ /**
7
+ * Run PWA build output audit
8
+ */
9
+ export declare function auditBuildOutput(outputDir: string): AuditCheck[];
10
+ /**
11
+ * Calculate audit score and summary
12
+ */
13
+ export declare function calculateAuditResult(checks: AuditCheck[]): AuditResult;
14
+ /**
15
+ * Run full PWA audit
16
+ */
17
+ export declare function runPwaAudit(options: StxOptions, outputDir?: string): AuditResult;
18
+ /**
19
+ * Format audit result for console output
20
+ */
21
+ export declare function formatAuditResult(result: AuditResult): string;
22
+ /**
23
+ * Audit check result
24
+ */
25
+ export declare interface AuditCheck {
26
+ id: string
27
+ name: string
28
+ category: 'required' | 'recommended' | 'optional'
29
+ passed: boolean
30
+ message: string
31
+ details?: string
32
+ }
33
+ /**
34
+ * Audit result summary
35
+ */
36
+ export declare interface AuditResult {
37
+ score: number
38
+ passed: number
39
+ failed: number
40
+ warnings: number
41
+ checks: AuditCheck[]
42
+ }
@@ -0,0 +1,29 @@
1
+ import type { CustomDirective } from '../types';
2
+ /**
3
+ * Register all PWA directives with the config
4
+ */
5
+ export declare function registerPwaDirectives(customDirectives: CustomDirective[]): CustomDirective[];
6
+ /**
7
+ * PWA Install Button Directive
8
+ * Usage: @pwa.installButton ... @endpwa.installButton
9
+ */
10
+ export declare const pwaInstallDirective: CustomDirective;
11
+ /**
12
+ * PWA Update Prompt Directive
13
+ * Usage: @pwa.updatePrompt ... @endpwa.updatePrompt
14
+ */
15
+ export declare const pwaUpdateDirective: CustomDirective;
16
+ /**
17
+ * PWA Offline Indicator Directive
18
+ * Usage: @pwa.offlineIndicator ... @endpwa.offlineIndicator
19
+ */
20
+ export declare const pwaOfflineDirective: CustomDirective;
21
+ /**
22
+ * PWA Push Subscribe Directive
23
+ * Usage: @pwa.pushSubscribe ... @endpwa.pushSubscribe
24
+ */
25
+ export declare const pwaPushDirective: CustomDirective;
26
+ /**
27
+ * All PWA directives
28
+ */
29
+ export declare const pwaDirectives: CustomDirective[];
@@ -0,0 +1,39 @@
1
+ import type { PwaIconConfig, StxOptions } from '../types';
2
+ /**
3
+ * Generate PWA icons from a source image
4
+ *
5
+ * @param options - stx configuration options
6
+ * @param outputDir - Output directory for generated icons
7
+ * @returns Result object with success status and file paths
8
+ */
9
+ export declare function generatePwaIcons(options: StxOptions, outputDir: string): Promise<IconGenerationResult>;
10
+ /**
11
+ * Get list of icon paths that will be generated
12
+ * Useful for manifest generation and cache precaching
13
+ */
14
+ export declare function getExpectedIconPaths(config: PwaIconConfig): string[];
15
+ /**
16
+ * Check if sharp is available
17
+ */
18
+ export declare function isSharpAvailable(): Promise<boolean>;
19
+ /**
20
+ * Default icon sizes for PWA
21
+ */
22
+ export declare const DEFAULT_ICON_SIZES: readonly [72, 96, 128, 144, 152, 192, 384, 512];
23
+ /**
24
+ * Apple touch icon sizes
25
+ */
26
+ export declare const APPLE_TOUCH_ICON_SIZES: readonly [120, 152, 167, 180];
27
+ /**
28
+ * Favicon sizes
29
+ */
30
+ export declare const FAVICON_SIZES: readonly [16, 32];
31
+ /**
32
+ * Icon generation result
33
+ */
34
+ export declare interface IconGenerationResult {
35
+ success: boolean
36
+ generatedFiles: string[]
37
+ errors: string[]
38
+ warnings: string[]
39
+ }
@@ -0,0 +1,59 @@
1
+ export {
2
+ generateServiceWorker,
3
+ generateServiceWorkerAuto,
4
+ getServiceWorkerFileName,
5
+ isWorkboxEnabled,
6
+ } from './service-worker';
7
+ export {
8
+ generateWorkboxConfig,
9
+ generateWorkboxServiceWorker,
10
+ isWorkboxEnabled as checkWorkboxEnabled,
11
+ getServiceWorkerGenerator,
12
+ type WorkboxConfig,
13
+ type WorkboxModule,
14
+ type RuntimeCacheRule,
15
+ } from './workbox';
16
+ export {
17
+ mapStrategyToWorkbox,
18
+ getWorkboxStrategyName,
19
+ generateRuntimeCachingCode,
20
+ generatePatternMatcher,
21
+ convertRouteToWorkbox,
22
+ generateRuntimeCaching,
23
+ createExpirationPlugin,
24
+ createCacheableResponsePlugin,
25
+ createBackgroundSyncPlugin,
26
+ type StxCacheStrategy,
27
+ type WorkboxStrategy,
28
+ type WorkboxPlugin,
29
+ type WorkboxRoute,
30
+ type RuntimeCachingConfig,
31
+ } from './workbox-strategies';
32
+ export {
33
+ generateManifest,
34
+ } from './manifest';
35
+ export {
36
+ generatePwaIcons,
37
+ type IconGenerationResult,
38
+ } from './icons';
39
+ export {
40
+ generatePrecacheManifest,
41
+ generatePrecacheManifestJs,
42
+ formatSize,
43
+ type PrecacheEntry,
44
+ } from './precache';
45
+ export {
46
+ generateOfflinePage,
47
+ } from './offline';
48
+ export {
49
+ injectPwaTags,
50
+ generateSwRegistrationScript,
51
+ } from './inject';
52
+ export {
53
+ runPwaAudit,
54
+ type AuditResult,
55
+ type AuditCheck,
56
+ } from './audit';
57
+ export {
58
+ pwaDirectives,
59
+ } from './directives';
@@ -0,0 +1,22 @@
1
+ import type { StxOptions } from '../types';
2
+ /**
3
+ * Generate PWA HTML tags for injection into <head>
4
+ */
5
+ export declare function generatePwaTags(options: StxOptions): string;
6
+ /**
7
+ * Inject PWA tags into HTML document
8
+ */
9
+ export declare function injectPwaTags(html: string, options: StxOptions): string;
10
+ /**
11
+ * Generate standalone service worker registration script
12
+ * Use this if you want to manually add the registration script
13
+ */
14
+ export declare function generateSwRegistrationScript(options: StxOptions): string;
15
+ /**
16
+ * Generate manifest link tag
17
+ */
18
+ export declare function generateManifestLink(): string;
19
+ /**
20
+ * Generate theme color meta tag
21
+ */
22
+ export declare function generateThemeColorMeta(color: string): string;
@@ -0,0 +1,104 @@
1
+ import type { PwaManifestConfig, StxOptions } from '../types';
2
+ /**
3
+ * Generate a Web App Manifest object from configuration
4
+ */
5
+ export declare function generateManifest(options: StxOptions): WebAppManifest | null;
6
+ /**
7
+ * Generate manifest.json file content as a string
8
+ */
9
+ export declare function generateManifestJson(options: StxOptions): string;
10
+ /**
11
+ * Merge user manifest config with defaults
12
+ */
13
+ export declare function mergeManifestConfig(userConfig: Partial<PwaManifestConfig>, defaultConfig: PwaManifestConfig): PwaManifestConfig;
14
+ /**
15
+ * Validate manifest configuration
16
+ * Returns an array of validation errors
17
+ */
18
+ export declare function validateManifest(options: StxOptions): string[];
19
+ /**
20
+ * Manifest icon entry structure
21
+ */
22
+ export declare interface ManifestIcon {
23
+ src: string
24
+ sizes: string
25
+ type: string
26
+ purpose?: string
27
+ }
28
+ /**
29
+ * Share target entry structure
30
+ */
31
+ export declare interface ManifestShareTarget {
32
+ action: string
33
+ method?: 'GET' | 'POST'
34
+ enctype?: string
35
+ params: {
36
+ title?: string
37
+ text?: string
38
+ url?: string
39
+ files?: Array<{
40
+ name: string
41
+ accept: string[]
42
+ }>
43
+ }
44
+ }
45
+ /**
46
+ * File handler entry structure
47
+ */
48
+ export declare interface ManifestFileHandler {
49
+ action: string
50
+ accept: Record<string, string[]>
51
+ icons?: ManifestIcon[]
52
+ launch_type?: 'single-client' | 'multiple-clients'
53
+ }
54
+ /**
55
+ * Protocol handler entry structure
56
+ */
57
+ export declare interface ManifestProtocolHandler {
58
+ protocol: string
59
+ url: string
60
+ }
61
+ /**
62
+ * Complete Web App Manifest structure
63
+ */
64
+ export declare interface WebAppManifest {
65
+ name: string
66
+ short_name?: string
67
+ description?: string
68
+ start_url: string
69
+ display: string
70
+ display_override?: string[]
71
+ orientation?: string
72
+ theme_color?: string
73
+ background_color?: string
74
+ scope?: string
75
+ lang?: string
76
+ dir?: string
77
+ id?: string
78
+ categories?: string[]
79
+ icons: ManifestIcon[]
80
+ shortcuts?: Array<{
81
+ name: string
82
+ short_name?: string
83
+ description?: string
84
+ url: string
85
+ icons?: ManifestIcon[]
86
+ }>
87
+ screenshots?: Array<{
88
+ src: string
89
+ sizes: string
90
+ type?: string
91
+ label?: string
92
+ form_factor?: 'wide' | 'narrow'
93
+ }>
94
+ share_target?: ManifestShareTarget
95
+ file_handlers?: ManifestFileHandler[]
96
+ protocol_handlers?: ManifestProtocolHandler[]
97
+ launch_handler?: {
98
+ client_mode: 'auto' | 'focus-existing' | 'navigate-new' | 'navigate-existing'
99
+ }
100
+ handle_links?: 'auto' | 'preferred' | 'not-preferred'
101
+ edge_side_panel?: {
102
+ preferred_width?: number
103
+ }
104
+ }
@@ -0,0 +1,8 @@
1
+ import type { StxOptions } from '../types';
2
+ /**
3
+ * Generate offline fallback page HTML
4
+ *
5
+ * If a custom offline page is specified in config, it will be processed.
6
+ * Otherwise, a default styled offline page is generated.
7
+ */
8
+ export declare function generateOfflinePage(options: StxOptions): Promise<string>;
@@ -0,0 +1,29 @@
1
+ import type { StxOptions } from '../types';
2
+ /**
3
+ * Generate precache manifest from build output directory
4
+ */
5
+ export declare function generatePrecacheManifest(outputDir: string, options: StxOptions): PrecacheManifest;
6
+ /**
7
+ * Generate precache manifest as JavaScript array for service worker
8
+ */
9
+ export declare function generatePrecacheManifestJs(manifest: PrecacheManifest): string;
10
+ /**
11
+ * Get human-readable size
12
+ */
13
+ export declare function formatSize(bytes: number): string;
14
+ /**
15
+ * Precache manifest entry
16
+ */
17
+ export declare interface PrecacheEntry {
18
+ url: string
19
+ revision: string
20
+ size: number
21
+ }
22
+ /**
23
+ * Precache manifest result
24
+ */
25
+ export declare interface PrecacheManifest {
26
+ entries: PrecacheEntry[]
27
+ totalSize: number
28
+ fileCount: number
29
+ }
@@ -0,0 +1,21 @@
1
+ import type { StxOptions } from '../types';
2
+ /**
3
+ * Generate the service worker JavaScript code
4
+ */
5
+ export declare function generateServiceWorker(options: StxOptions, outputDir?: string): string;
6
+ /**
7
+ * Get the service worker file name from config
8
+ */
9
+ export declare function getServiceWorkerFileName(options: StxOptions): string;
10
+ /**
11
+ * Check if Workbox mode is enabled
12
+ */
13
+ export declare function isWorkboxEnabled(options: StxOptions): boolean;
14
+ /**
15
+ * Generate service worker code (auto-selects native or Workbox based on config)
16
+ *
17
+ * @param options - stx configuration options
18
+ * @param outputDir - optional output directory for precache manifest
19
+ * @returns Generated service worker JavaScript code
20
+ */
21
+ export declare function generateServiceWorkerAuto(options: StxOptions, outputDir?: string): string;
@@ -0,0 +1,100 @@
1
+ import type { StxOptions } from '../types';
2
+ /**
3
+ * Map stx strategy name to Workbox strategy
4
+ */
5
+ export declare function mapStrategyToWorkbox(strategy: StxCacheStrategy): WorkboxStrategy;
6
+ /**
7
+ * Get Workbox strategy class name
8
+ */
9
+ export declare function getWorkboxStrategyName(strategy: StxCacheStrategy): string;
10
+ /**
11
+ * Generate ExpirationPlugin config
12
+ */
13
+ export declare function createExpirationPlugin(options: {
14
+ maxEntries?: number
15
+ maxAgeSeconds?: number
16
+ purgeOnQuotaError?: boolean
17
+ }): WorkboxPlugin;
18
+ /**
19
+ * Generate CacheableResponsePlugin config
20
+ */
21
+ export declare function createCacheableResponsePlugin(options: {
22
+ statuses?: number[]
23
+ headers?: Record<string, string>
24
+ }): WorkboxPlugin;
25
+ /**
26
+ * Generate BackgroundSyncPlugin config
27
+ */
28
+ export declare function createBackgroundSyncPlugin(options: {
29
+ name: string
30
+ maxRetentionTime?: number
31
+ forceSyncFallback?: boolean
32
+ }): WorkboxPlugin;
33
+ /**
34
+ * Convert stx route config to Workbox runtime caching config
35
+ */
36
+ export declare function convertRouteToWorkbox(route: {
37
+ pattern: string
38
+ strategy: StxCacheStrategy
39
+ cacheName?: string
40
+ maxAgeSeconds?: number
41
+ maxEntries?: number
42
+ }): RuntimeCachingConfig;
43
+ /**
44
+ * Generate runtime caching configuration from stx routes
45
+ */
46
+ export declare function generateRuntimeCaching(routes: Array<{
47
+ pattern: string
48
+ strategy: StxCacheStrategy
49
+ cacheName?: string
50
+ maxAgeSeconds?: number
51
+ maxEntries?: number
52
+ }>): RuntimeCachingConfig[];
53
+ /**
54
+ * Generate runtime caching JavaScript code
55
+ */
56
+ export declare function generateRuntimeCachingCode(options: StxOptions): string;
57
+ /**
58
+ * Generate pattern matcher for Workbox registerRoute
59
+ */
60
+ export declare function generatePatternMatcher(pattern: string): string;
61
+ export declare interface WorkboxStrategy {
62
+ className: string
63
+ importFrom: 'workbox-strategies'
64
+ defaultPlugins?: WorkboxPlugin[]
65
+ }
66
+ export declare interface WorkboxPlugin {
67
+ className: string
68
+ importFrom: string
69
+ options?: Record<string, unknown>
70
+ }
71
+ export declare interface WorkboxRoute {
72
+ pattern: string
73
+ matchType: 'pathname' | 'destination' | 'custom'
74
+ strategy: WorkboxStrategy
75
+ plugins?: WorkboxPlugin[]
76
+ cacheName?: string
77
+ }
78
+ export declare interface RuntimeCachingConfig {
79
+ urlPattern: string | RegExp
80
+ handler: string
81
+ options?: {
82
+ cacheName?: string
83
+ plugins?: WorkboxPlugin[]
84
+ networkTimeoutSeconds?: number
85
+ matchOptions?: {
86
+ ignoreSearch?: boolean
87
+ ignoreMethod?: boolean
88
+ ignoreVary?: boolean
89
+ }
90
+ }
91
+ method?: string
92
+ }
93
+ // ============================================================================
94
+ // Types
95
+ // ============================================================================
96
+ export type StxCacheStrategy = | 'cache-first'
97
+ | 'network-first'
98
+ | 'stale-while-revalidate'
99
+ | 'network-only'
100
+ | 'cache-only'