@stacksjs/stx 0.2.0 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/a11y.d.ts +109 -5
  2. package/dist/analytics.d.ts +40 -0
  3. package/dist/animation.d.ts +90 -0
  4. package/dist/app.d.ts +51 -0
  5. package/dist/ast.d.ts +286 -0
  6. package/dist/async-components.d.ts +101 -0
  7. package/dist/auth.d.ts +1 -3
  8. package/dist/browser-composables.d.ts +314 -0
  9. package/dist/build-optimizer.d.ts +126 -0
  10. package/dist/build-views.d.ts +37 -0
  11. package/dist/bundle-analyzer/collector.d.ts +66 -0
  12. package/dist/bundle-analyzer/index.d.ts +60 -0
  13. package/dist/bundle-analyzer/report.d.ts +39 -0
  14. package/dist/bundle-analyzer/treemap.d.ts +19 -0
  15. package/dist/bundle-analyzer.js +499 -0
  16. package/dist/caching.d.ts +7 -0
  17. package/dist/cli.js +10880 -1199
  18. package/dist/client/directive.d.ts +10 -0
  19. package/dist/client/index.d.ts +7 -0
  20. package/dist/client/router.d.ts +36 -0
  21. package/dist/client/stx-router.browser.d.ts +0 -0
  22. package/dist/client-script.d.ts +22 -0
  23. package/dist/component-hmr.d.ts +120 -0
  24. package/dist/components.d.ts +23 -1
  25. package/dist/composables/index.d.ts +277 -0
  26. package/dist/composables/use-battery.d.ts +46 -0
  27. package/dist/composables/use-broadcast-channel.d.ts +58 -0
  28. package/dist/composables/use-clipboard.d.ts +34 -0
  29. package/dist/composables/use-cookie.d.ts +70 -0
  30. package/dist/composables/use-device-orientation.d.ts +109 -0
  31. package/dist/composables/use-event-source.d.ts +77 -0
  32. package/dist/composables/use-eye-dropper.d.ts +107 -0
  33. package/dist/composables/use-fetch.d.ts +84 -0
  34. package/dist/composables/use-fullscreen.d.ts +47 -0
  35. package/dist/composables/use-geolocation.d.ts +62 -0
  36. package/dist/composables/use-idle.d.ts +84 -0
  37. package/dist/composables/use-intersection-observer.d.ts +81 -0
  38. package/dist/composables/use-keyboard.d.ts +100 -0
  39. package/dist/composables/use-media-query.d.ts +56 -0
  40. package/dist/composables/use-mouse.d.ts +64 -0
  41. package/dist/composables/use-mutation-observer.d.ts +101 -0
  42. package/dist/composables/use-network.d.ts +40 -0
  43. package/dist/composables/use-notification.d.ts +89 -0
  44. package/dist/composables/use-permissions.d.ts +109 -0
  45. package/dist/composables/use-resize-observer.d.ts +60 -0
  46. package/dist/composables/use-share.d.ts +70 -0
  47. package/dist/composables/use-speech.d.ts +117 -0
  48. package/dist/composables/use-storage.d.ts +64 -0
  49. package/dist/composables/use-text-selection.d.ts +97 -0
  50. package/dist/composables/use-wake-lock.d.ts +85 -0
  51. package/dist/composables/use-websocket.d.ts +69 -0
  52. package/dist/composables/use-window.d.ts +84 -0
  53. package/dist/composables.d.ts +268 -0
  54. package/dist/composition-api.d.ts +190 -0
  55. package/dist/computed.d.ts +137 -0
  56. package/dist/conditionals.d.ts +14 -2
  57. package/dist/config.d.ts +35 -2
  58. package/dist/craft-bridge.d.ts +319 -0
  59. package/dist/craft-compiler.d.ts +229 -0
  60. package/dist/craft-components.d.ts +411 -0
  61. package/dist/craft-entry.d.ts +5 -0
  62. package/dist/craft-ssr.d.ts +134 -0
  63. package/dist/craft.js +1553 -0
  64. package/dist/csp.d.ts +229 -0
  65. package/dist/database.d.ts +407 -0
  66. package/dist/database.js +5 -0
  67. package/dist/defer.d.ts +4 -0
  68. package/dist/deploy/config-generators.d.ts +75 -0
  69. package/dist/deploy/index.d.ts +84 -0
  70. package/dist/deploy/netlify.d.ts +109 -0
  71. package/dist/dev-server/crosswind.d.ts +54 -0
  72. package/dist/dev-server/index.d.ts +7 -0
  73. package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
  74. package/dist/dev-server/native-window.d.ts +40 -0
  75. package/dist/dev-server/port-utils.d.ts +27 -0
  76. package/dist/dev-server/terminal-colors.d.ts +60 -0
  77. package/dist/dev-server/theme-selector.d.ts +32 -0
  78. package/dist/dev-server/types.d.ts +92 -0
  79. package/dist/dev-server.d.ts +21 -0
  80. package/dist/devtools.d.ts +142 -0
  81. package/dist/directive-api.d.ts +111 -0
  82. package/dist/dynamic-components.d.ts +14 -0
  83. package/dist/edge-runtime.d.ts +200 -0
  84. package/dist/env.d.ts +9 -0
  85. package/dist/error-boundaries.d.ts +71 -0
  86. package/dist/error-handling.d.ts +1 -101
  87. package/dist/errors/codes.d.ts +99 -0
  88. package/dist/errors/formatter.d.ts +64 -0
  89. package/dist/errors/index.d.ts +56 -0
  90. package/dist/errors/logger.d.ts +74 -0
  91. package/dist/errors/sanitizer.d.ts +43 -0
  92. package/dist/errors/types.d.ts +79 -0
  93. package/dist/events.d.ts +106 -0
  94. package/dist/expressions.d.ts +86 -11
  95. package/dist/forms-validation.d.ts +173 -0
  96. package/dist/forms.d.ts +157 -8
  97. package/dist/head.d.ts +225 -0
  98. package/dist/heatmap.d.ts +125 -0
  99. package/dist/hot-reload.d.ts +87 -0
  100. package/dist/hydration-runtime.d.ts +47 -0
  101. package/dist/hydration.d.ts +161 -0
  102. package/dist/i18n.d.ts +239 -3
  103. package/dist/image-optimization/build-plugin.d.ts +53 -0
  104. package/dist/image-optimization/component.d.ts +46 -0
  105. package/dist/image-optimization/directive.d.ts +30 -0
  106. package/dist/image-optimization/index.d.ts +86 -0
  107. package/dist/image-optimization/processor.d.ts +112 -0
  108. package/dist/includes.d.ts +94 -9
  109. package/dist/index.d.ts +63 -3
  110. package/dist/index.js +11603 -1318
  111. package/dist/init.d.ts +32 -2
  112. package/dist/interactive.d.ts +14 -0
  113. package/dist/internal-markdown.d.ts +22 -0
  114. package/dist/jsx-runtime.d.ts +110 -0
  115. package/dist/keep-alive.d.ts +87 -0
  116. package/dist/lazy-loader.d.ts +122 -0
  117. package/dist/loading-indicator.d.ts +40 -0
  118. package/dist/loops.d.ts +22 -1
  119. package/dist/media/client/blur-up.d.ts +65 -0
  120. package/dist/media/client/index.d.ts +77 -0
  121. package/dist/media/client/lazy-load.d.ts +73 -0
  122. package/dist/media/client/upload-handler.d.ts +79 -0
  123. package/dist/media/image/component.d.ts +46 -0
  124. package/dist/media/image/directive.d.ts +9 -0
  125. package/dist/media/image/editing.d.ts +212 -0
  126. package/dist/media/image/index.d.ts +118 -0
  127. package/dist/media/image/placeholder.d.ts +78 -0
  128. package/dist/media/image/processor/cache.d.ts +32 -0
  129. package/dist/media/image/processor/index.d.ts +12 -0
  130. package/dist/media/image/processor/optimizer.d.ts +13 -0
  131. package/dist/media/image/processor/responsive.d.ts +17 -0
  132. package/dist/media/image/srcset.d.ts +158 -0
  133. package/dist/media/index.d.ts +295 -0
  134. package/dist/media/manager/embed.d.ts +25 -0
  135. package/dist/media/protected/component.d.ts +34 -0
  136. package/dist/media/protected/index.d.ts +34 -0
  137. package/dist/media/protected/signature.d.ts +72 -0
  138. package/dist/media/shared/cache.d.ts +54 -0
  139. package/dist/media/shared/hash.d.ts +24 -0
  140. package/dist/media/shared/index.d.ts +2 -0
  141. package/dist/media/types.d.ts +1051 -0
  142. package/dist/media/upload/component.d.ts +23 -0
  143. package/dist/media/upload/index.d.ts +1 -0
  144. package/dist/media/video/directive.d.ts +9 -0
  145. package/dist/media/video/index.d.ts +47 -0
  146. package/dist/media/video/processor/cache.d.ts +33 -0
  147. package/dist/media/video/processor/index.d.ts +21 -0
  148. package/dist/media/video/processor/streaming.d.ts +19 -0
  149. package/dist/media/video/processor/thumbnail.d.ts +28 -0
  150. package/dist/media/video/processor/transcoder.d.ts +9 -0
  151. package/dist/middleware.d.ts +42 -3
  152. package/dist/native-build.d.ts +74 -0
  153. package/dist/parser/directive-parser.d.ts +79 -0
  154. package/dist/parser/expression-parser.d.ts +59 -0
  155. package/dist/parser/index.d.ts +35 -0
  156. package/dist/parser/tokenizer.d.ts +81 -0
  157. package/dist/partial-hydration.d.ts +88 -0
  158. package/dist/performance-utils.d.ts +146 -3
  159. package/dist/plugin-system.d.ts +128 -0
  160. package/dist/precompiler.d.ts +108 -0
  161. package/dist/production-build.d.ts +199 -0
  162. package/dist/props.d.ts +199 -0
  163. package/dist/pwa/audit.d.ts +42 -0
  164. package/dist/pwa/directives.d.ts +29 -0
  165. package/dist/pwa/icons.d.ts +39 -0
  166. package/dist/pwa/index.d.ts +59 -0
  167. package/dist/pwa/inject.d.ts +22 -0
  168. package/dist/pwa/manifest.d.ts +104 -0
  169. package/dist/pwa/offline.d.ts +8 -0
  170. package/dist/pwa/precache.d.ts +29 -0
  171. package/dist/pwa/service-worker.d.ts +21 -0
  172. package/dist/pwa/workbox-strategies.d.ts +100 -0
  173. package/dist/pwa/workbox.d.ts +52 -0
  174. package/dist/pwa.d.ts +51 -0
  175. package/dist/pwa.js +8124 -0
  176. package/dist/reactive-bindings.d.ts +24 -0
  177. package/dist/reactive.d.ts +100 -0
  178. package/dist/reactivity.d.ts +253 -0
  179. package/dist/route-middleware.d.ts +232 -0
  180. package/dist/router.d.ts +31 -0
  181. package/dist/routes.d.ts +0 -7
  182. package/dist/runtime.d.ts +140 -0
  183. package/dist/safe-evaluator.d.ts +117 -3
  184. package/dist/scaffolding.d.ts +113 -0
  185. package/dist/seo.d.ts +120 -7
  186. package/dist/server-components.d.ts +134 -0
  187. package/dist/signals.d.ts +501 -0
  188. package/dist/slots.d.ts +63 -0
  189. package/dist/source-maps.d.ts +117 -0
  190. package/dist/ssg.d.ts +157 -0
  191. package/dist/ssg.js +6831 -0
  192. package/dist/ssr.d.ts +107 -0
  193. package/dist/state-management.d.ts +324 -0
  194. package/dist/stores-client.d.ts +70 -0
  195. package/dist/story/addons.d.ts +123 -0
  196. package/dist/story/analytics.d.ts +92 -0
  197. package/dist/story/auto-stories.d.ts +38 -0
  198. package/dist/story/bookmarks.d.ts +53 -0
  199. package/dist/story/bun-test.d.ts +44 -0
  200. package/dist/story/cli.d.ts +34 -0
  201. package/dist/story/collect/analyzer.d.ts +33 -0
  202. package/dist/story/collect/index.d.ts +27 -0
  203. package/dist/story/collect/parser.d.ts +17 -0
  204. package/dist/story/collect/scanner.d.ts +13 -0
  205. package/dist/story/collect/tree.d.ts +17 -0
  206. package/dist/story/commands/build.d.ts +14 -0
  207. package/dist/story/commands/dev.d.ts +16 -0
  208. package/dist/story/commands/index.d.ts +6 -0
  209. package/dist/story/commands/preview.d.ts +15 -0
  210. package/dist/story/compiled-output.d.ts +26 -0
  211. package/dist/story/composition.d.ts +47 -0
  212. package/dist/story/config-watcher.d.ts +26 -0
  213. package/dist/story/config.d.ts +26 -0
  214. package/dist/story/context.d.ts +21 -0
  215. package/dist/story/controls/index.d.ts +54 -0
  216. package/dist/story/crosswind.d.ts +29 -0
  217. package/dist/story/desktop-preview.d.ts +34 -0
  218. package/dist/story/docs-generator.d.ts +30 -0
  219. package/dist/story/errors.d.ts +47 -0
  220. package/dist/story/figma-export.d.ts +169 -0
  221. package/dist/story/generator.d.ts +21 -0
  222. package/dist/story/hmr.d.ts +64 -0
  223. package/dist/story/hot-swap.d.ts +35 -0
  224. package/dist/story/index.d.ts +51 -0
  225. package/dist/story/interactions.d.ts +52 -0
  226. package/dist/story/keyboard-shortcuts.d.ts +34 -0
  227. package/dist/story/output.d.ts +85 -0
  228. package/dist/story/performance.d.ts +76 -0
  229. package/dist/story/presets.d.ts +62 -0
  230. package/dist/story/props-validation.d.ts +45 -0
  231. package/dist/story/renderer.d.ts +53 -0
  232. package/dist/story/search-index.d.ts +47 -0
  233. package/dist/story/search.d.ts +45 -0
  234. package/dist/story/server.d.ts +21 -0
  235. package/dist/story/setup.d.ts +47 -0
  236. package/dist/story/snapshots.d.ts +65 -0
  237. package/dist/story/testing.d.ts +58 -0
  238. package/dist/story/theme.d.ts +68 -0
  239. package/dist/story/types.d.ts +249 -0
  240. package/dist/story/ui/code-panel.d.ts +42 -0
  241. package/dist/story/ui/controls-panel.d.ts +25 -0
  242. package/dist/story/ui/index.d.ts +4 -0
  243. package/dist/story/ui/navigation.d.ts +55 -0
  244. package/dist/story/ui/preview.d.ts +46 -0
  245. package/dist/story/visual-testing.d.ts +45 -0
  246. package/dist/streaming.d.ts +82 -2
  247. package/dist/suspense.d.ts +83 -0
  248. package/dist/teleport.d.ts +9 -0
  249. package/dist/testing.d.ts +289 -0
  250. package/dist/transitions.d.ts +87 -0
  251. package/dist/type-checker.d.ts +109 -0
  252. package/dist/types/component-types.d.ts +129 -0
  253. package/dist/types/config-types.d.ts +336 -0
  254. package/dist/types/context-types.d.ts +99 -0
  255. package/dist/types/csp-types.d.ts +79 -0
  256. package/dist/types/directive-types.d.ts +259 -0
  257. package/dist/types/index.d.ts +98 -0
  258. package/dist/types/pwa-types.d.ts +218 -0
  259. package/dist/types.d.ts +1 -315
  260. package/dist/typescript-templates.d.ts +178 -0
  261. package/dist/utils.d.ts +52 -6
  262. package/dist/validator.d.ts +77 -0
  263. package/dist/variable-extractor.d.ts +39 -0
  264. package/dist/view-composers.d.ts +154 -9
  265. package/dist/virtual-scrolling.d.ts +103 -0
  266. package/dist/visual-editor.d.ts +209 -0
  267. package/dist/visual-testing.d.ts +109 -0
  268. package/dist/visual-testing.js +126 -0
  269. package/dist/vue-template.d.ts +16 -0
  270. package/dist/web-components/css-scoping.d.ts +54 -0
  271. package/dist/web-components/index.d.ts +20 -0
  272. package/dist/web-components/reactive-generator.d.ts +72 -0
  273. package/dist/web-components.d.ts +222 -2
  274. package/dist/x-element.d.ts +35 -0
  275. package/package.json +41 -11
@@ -0,0 +1,23 @@
1
+ import type { MediaUploadProps, } from '../types';
2
+ /**
3
+ * Render a file upload component
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const html = renderMediaUpload({
8
+ * endpoint: '/api/upload',
9
+ * accept: 'image/*',
10
+ * maxSize: 10 * 1024 * 1024, // 10MB
11
+ * preview: true,
12
+ * dropzone: true,
13
+ * })
14
+ * ```
15
+ */
16
+ /*',
17
+ * maxSize: 10 * 1024 * 1024, // 10MB
18
+ * preview: true,
19
+ * dropzone: true,
20
+ * })
21
+ * ```
22
+ */
23
+ export declare function renderMediaUpload(props: MediaUploadProps): { html: string; script: string; css: string };
@@ -0,0 +1 @@
1
+ export { renderMediaUpload } from './component';
@@ -0,0 +1,9 @@
1
+ import type { CustomDirective } from '../../types';
2
+ /**
3
+ * Create the @video directive
4
+ */
5
+ export declare function createVideoDirective(): CustomDirective;
6
+ /**
7
+ * The @video directive instance
8
+ */
9
+ export declare const videoDirective: unknown;
@@ -0,0 +1,47 @@
1
+ import type { VideoProps, VideoRenderResult, EnhancedVideoProps, TsVideosConfig, ProcessedVideoResult, } from '../types';
2
+ /**
3
+ * Render a video component
4
+ *
5
+ * Supports both standard VideoProps and EnhancedVideoProps with ts-videos integration.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Native HTML5 video
10
+ * const result = await renderVideoComponent({
11
+ * src: '/videos/intro.mp4',
12
+ * poster: '/images/poster.jpg',
13
+ * controls: true,
14
+ * lazy: true,
15
+ * })
16
+ *
17
+ * // With ts-video-player for advanced features
18
+ * const result = await renderVideoComponent({
19
+ * src: 'https://youtube.com/watch?v=xxx',
20
+ * player: 'ts-video',
21
+ * lazy: true,
22
+ * })
23
+ *
24
+ * // With ts-videos processing
25
+ * const result = await renderVideoComponent({
26
+ * src: '/videos/raw.mov',
27
+ * process: true,
28
+ * quality: 'high',
29
+ * generatePoster: { timestamp: 5 },
30
+ * streaming: { format: 'hls' },
31
+ * }, { tsVideosConfig: { enabled: true, outputDir: 'dist/videos' } })
32
+ * ```
33
+ */
34
+ export declare function renderVideoComponent(props: VideoProps | EnhancedVideoProps, context?: { isDev?: boolean } | ExtendedVideoRenderContext): Promise<VideoRenderResult>;
35
+ /**
36
+ * Parse @video directive options (legacy - use videoDirective instead)
37
+ */
38
+ export declare function parseVideoDirectiveOptions(content: string, params: Record<string, unknown>, context: Record<string, unknown>): VideoProps;
39
+ /**
40
+ * Extended video render context with ts-videos config
41
+ */
42
+ export declare interface ExtendedVideoRenderContext {
43
+ isDev?: boolean
44
+ tsVideosConfig?: TsVideosConfig
45
+ processedResult?: ProcessedVideoResult
46
+ }
47
+ export { createVideoDirective, videoDirective } from './directive';
@@ -0,0 +1,33 @@
1
+ import { } from '../../shared/cache';
2
+ import type { EnhancedVideoProps, ProcessedVideoResult, TsVideosConfig, } from '../../types';
3
+ /**
4
+ * Get cached video processing result
5
+ */
6
+ export declare function getCachedVideoResult(src: string, options: Partial<EnhancedVideoProps>, config?: TsVideosConfig): Promise<ProcessedVideoResult | null>;
7
+ /**
8
+ * Set cached video processing result
9
+ */
10
+ export declare function setCachedVideoResult(src: string, options: Partial<EnhancedVideoProps>, result: ProcessedVideoResult, config?: TsVideosConfig): Promise<void>;
11
+ /**
12
+ * Clear video processing cache
13
+ */
14
+ export declare function clearVideoCache(): Promise<void>;
15
+ /**
16
+ * Video processor cache configuration
17
+ */
18
+ export declare interface VideoCacheConfig extends CacheConfig {
19
+ cacheTranscoded?: boolean
20
+ cacheThumbnails?: boolean
21
+ cacheManifests?: boolean
22
+ }
23
+ /**
24
+ * Video processor cache class
25
+ */
26
+ export declare class VideoProcessorCache {
27
+ private config: VideoCacheConfig;
28
+ constructor(config?: Partial<VideoCacheConfig>);
29
+ get(src: string, options: Partial<EnhancedVideoProps>): Promise<ProcessedVideoResult | null>;
30
+ set(src: string, options: Partial<EnhancedVideoProps>, result: ProcessedVideoResult): Promise<void>;
31
+ clear(): Promise<void>;
32
+ updateConfig(config: Partial<VideoCacheConfig>): void;
33
+ }
@@ -0,0 +1,21 @@
1
+ export type {
2
+ EnhancedVideoProps,
3
+ ProcessedVideoResult,
4
+ TsVideosConfig,
5
+ VideoQualityPreset,
6
+ VideoPlatformPreset,
7
+ TranscodeConfig,
8
+ TranscodeResult,
9
+ ThumbnailResult,
10
+ HLSResult,
11
+ DASHResult,
12
+ StreamingConfig,
13
+ StreamingQualityLevel,
14
+ PosterGenerationConfig,
15
+ SpriteSheetConfig,
16
+ WaveformConfig,
17
+ } from '../../types';
18
+ export { processVideo, analyzeVideo } from './transcoder';
19
+ export { generatePoster, generateThumbnails, generateSpriteSheet } from './thumbnail';
20
+ export { generateHLSManifest, generateDASHManifest } from './streaming';
21
+ export { getCachedVideoResult, setCachedVideoResult, clearVideoCache, VideoProcessorCache } from './cache';
@@ -0,0 +1,19 @@
1
+ import type { HLSResult, DASHResult, StreamingQualityLevel, } from '../../types';
2
+ /**
3
+ * Generate HLS (HTTP Live Streaming) manifest and segments
4
+ */
5
+ export declare function generateHLSManifest(src: string, qualities: StreamingQualityLevel[], outputDir: string, baseUrl: string, options?: {
6
+ segmentDuration?: number
7
+ playlistType?: 'vod' | 'event'
8
+ }): Promise<HLSResult | null>;
9
+ /**
10
+ * Generate DASH (Dynamic Adaptive Streaming over HTTP) manifest
11
+ */
12
+ export declare function generateDASHManifest(src: string, qualities: StreamingQualityLevel[], outputDir: string, baseUrl: string, options?: {
13
+ segmentDuration?: number
14
+ minBufferTime?: number
15
+ }): Promise<DASHResult | null>;
16
+ /**
17
+ * Default streaming quality levels
18
+ */
19
+ export declare const DEFAULT_STREAMING_QUALITIES: StreamingQualityLevel[];
@@ -0,0 +1,28 @@
1
+ import type { ThumbnailResult, PosterGenerationConfig, SpriteSheetConfig, } from '../../types';
2
+ /**
3
+ * Generate poster/thumbnail from video at specific timestamp
4
+ */
5
+ export declare function generatePoster(src: string, options: PosterGenerationConfig, outputDir: string, baseUrl: string): Promise<ThumbnailResult | null>;
6
+ /**
7
+ * Generate multiple thumbnails at intervals
8
+ */
9
+ export declare function generateThumbnails(src: string, options: {
10
+ count?: number
11
+ interval?: number
12
+ format?: 'jpeg' | 'png' | 'webp'
13
+ width?: number
14
+ quality?: number
15
+ }, outputDir: string, baseUrl: string): Promise<ThumbnailResult[]>;
16
+ /**
17
+ * Generate sprite sheet for video scrubbing preview
18
+ */
19
+ export declare function generateSpriteSheet(src: string, options: SpriteSheetConfig, outputDir: string, baseUrl: string): Promise<{
20
+ url: string
21
+ path: string
22
+ columns: number
23
+ rows: number
24
+ thumbnailWidth: number
25
+ thumbnailHeight: number
26
+ interval: number
27
+ totalFrames: number
28
+ } | null>;
@@ -0,0 +1,9 @@
1
+ import type { EnhancedVideoProps, ProcessedVideoResult, TsVideosConfig, } from '../../types';
2
+ /**
3
+ * Analyze video to get metadata
4
+ */
5
+ export declare function analyzeVideo(src: string): Promise<ProcessedVideoResult['metadata'] | null>;
6
+ /**
7
+ * Process a video with ts-videos
8
+ */
9
+ export declare function processVideo(src: string, options: Partial<EnhancedVideoProps>, config: TsVideosConfig, onProgress?: (progress: { percentage: number; stage: string }) => void): Promise<ProcessedVideoResult>;
@@ -1,13 +1,52 @@
1
1
  import type { StxOptions } from './types';
2
2
  /**
3
- * Process middleware registered in the application
3
+ * Process middleware registered in the application.
4
+ *
5
+ * Executes all middleware handlers that match the specified timing in sequence.
6
+ * Each middleware receives the current template and can modify it.
7
+ *
8
+ * @param template - The template string to process
9
+ * @param context - Template context with variables (can be modified by middleware)
10
+ * @param filePath - Path to the template file (for error messages)
11
+ * @param options - STX processing options containing middleware configuration
12
+ * @param timing - When to run: 'before' or 'after' directive processing
13
+ * @returns The processed template string
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const processed = await processMiddleware(
18
+ * '<div>{{ content }}</div>',
19
+ * { content: 'Hello' },
20
+ * '/path/to/template.stx',
21
+ * { middleware: myMiddleware },
22
+ * 'before'
23
+ * )
24
+ * ```
4
25
  */
5
26
  export declare function processMiddleware(template: string, context: Record<string, any>, filePath: string, options: StxOptions, timing: 'before' | 'after'): Promise<string>;
6
27
  /**
7
- * Run pre-processing middleware
28
+ * Run pre-processing middleware (timing: 'before').
29
+ *
30
+ * This is a convenience wrapper for `processMiddleware` with timing='before'.
31
+ * Pre-processing middleware runs before any directives are processed.
32
+ *
33
+ * @param template - The raw template string
34
+ * @param context - Template context with variables
35
+ * @param filePath - Path to the template file
36
+ * @param options - STX processing options
37
+ * @returns The pre-processed template string
8
38
  */
9
39
  export declare function runPreProcessingMiddleware(template: string, context: Record<string, any>, filePath: string, options: StxOptions): Promise<string>;
10
40
  /**
11
- * Run post-processing middleware
41
+ * Run post-processing middleware (timing: 'after').
42
+ *
43
+ * This is a convenience wrapper for `processMiddleware` with timing='after'.
44
+ * Post-processing middleware runs after all directives have been processed.
45
+ *
46
+ * @param template - The processed template string
47
+ * @param context - Template context with variables
48
+ * @param filePath - Path to the template file
49
+ * @param options - STX processing options
50
+ * @returns The post-processed template string
12
51
  */
13
52
  export declare function runPostProcessingMiddleware(template: string, context: Record<string, any>, filePath: string, options: StxOptions): Promise<string>;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Build an stx template into a native application
3
+ */
4
+ export declare function buildNative(config: NativeBuildConfig): Promise<NativeBuildResult>;
5
+ /**
6
+ * Get available targets for current platform
7
+ */
8
+ export declare function getAvailableTargets(): NativeTarget[];
9
+ /**
10
+ * Get available formats for a target
11
+ */
12
+ export declare function getAvailableFormats(target: NativeTarget): NativeFormat[];
13
+ export declare interface NativeBuildConfig {
14
+ input: string
15
+ output?: string
16
+ target?: NativeTarget
17
+ format?: NativeFormat
18
+ name?: string
19
+ version?: string
20
+ description?: string
21
+ author?: string
22
+ bundleId?: string
23
+ icon?: string
24
+ window?: {
25
+ title?: string
26
+ width?: number
27
+ height?: number
28
+ resizable?: boolean
29
+ frameless?: boolean
30
+ transparent?: boolean
31
+ alwaysOnTop?: boolean
32
+ fullscreen?: boolean
33
+ }
34
+ sidebar?: {
35
+ /** Enable native macOS sidebar */
36
+ enabled?: boolean
37
+ /** Sidebar width in pixels */
38
+ width?: number
39
+ /** Sidebar sections and items */
40
+ config?: {
41
+ sections: Array<{
42
+ id: string
43
+ title: string
44
+ items: Array<{
45
+ id: string
46
+ label: string
47
+ icon?: string
48
+ badge?: string | number
49
+ tintColor?: string
50
+ }>
51
+ }>
52
+ minWidth?: number
53
+ maxWidth?: number
54
+ canCollapse?: boolean
55
+ }
56
+ }
57
+ systemTray?: boolean
58
+ hotReload?: boolean
59
+ devTools?: boolean
60
+ craftPath?: string
61
+ env?: Record<string, string>
62
+ verbose?: boolean
63
+ }
64
+ export declare interface NativeBuildResult {
65
+ success: boolean
66
+ target: NativeTarget
67
+ format: NativeFormat
68
+ outputPath?: string
69
+ error?: string
70
+ duration?: number
71
+ }
72
+ export type NativeTarget = 'macos' | 'windows' | 'linux' | 'ios' | 'android'
73
+ export type NativeFormat = 'app' | 'dmg' | 'pkg' | 'msi' | 'zip' | 'deb' | 'rpm' | 'appimage' | 'ipa' | 'apk'
74
+ export default nativeBuild;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Extract a parenthesized expression from a string, handling nested parens
3
+ * e.g., "func(a, fn(b, c))" -> { expression: "func(a, fn(b, c))", endPos: 17 }
4
+ */
5
+ export declare function extractParenthesizedExpression(source: string, startPos: number): {
6
+ expression: string
7
+ endPos: number
8
+ } | null;
9
+ /**
10
+ * Find the matching end tag for a directive, handling nested instances
11
+ *
12
+ * @param source - The source string to search in
13
+ * @param startName - The opening directive name (e.g., "if", "foreach")
14
+ * @param endName - The closing directive name (e.g., "endif", "endforeach")
15
+ * @param startPos - Position to start searching from (after the opening directive)
16
+ * @returns The position of the matching end tag, or -1 if not found
17
+ */
18
+ export declare function findMatchingEndTag(source: string, startName: string, endName: string, startPos: number): number;
19
+ /**
20
+ * Parse a complete conditional block (@if, @elseif, @else, @endif)
21
+ *
22
+ * @param source - The source string
23
+ * @param startPos - Position where @if starts
24
+ * @returns Parsed conditional with all branches, or null if malformed
25
+ */
26
+ export declare function parseConditionalBlock(source: string, startPos: number): ParsedConditional | null;
27
+ /**
28
+ * Find all @if blocks in source (non-nested, outermost only)
29
+ */
30
+ export declare function findIfBlocks(source: string): ParsedConditional[];
31
+ /**
32
+ * Find a directive with its content
33
+ *
34
+ * @param source - Source string
35
+ * @param directiveName - Name without @ (e.g., "foreach")
36
+ * @param endDirectiveName - End name without @ (e.g., "endforeach")
37
+ * @returns All matches found
38
+ */
39
+ export declare function findDirectiveBlocks(source: string, directiveName: string, endDirectiveName: string): DirectiveMatch[];
40
+ export declare function parseSwitchBlock(source: string, startPos: number): ParsedSwitch | null;
41
+ // =============================================================================
42
+ // Types
43
+ // =============================================================================
44
+ export declare interface DirectiveMatch {
45
+ fullMatch: string
46
+ name: string
47
+ params: string
48
+ content: string
49
+ start: number
50
+ end: number
51
+ }
52
+ export declare interface ConditionalBranch {
53
+ type: 'if' | 'elseif' | 'else'
54
+ condition?: string
55
+ content: string
56
+ start: number
57
+ end: number
58
+ }
59
+ export declare interface ParsedConditional {
60
+ fullMatch: string
61
+ branches: ConditionalBranch[]
62
+ start: number
63
+ end: number
64
+ }
65
+ /**
66
+ * Parse @switch block with proper handling of nested switches
67
+ */
68
+ export declare interface SwitchCase {
69
+ type: 'case' | 'default'
70
+ value?: string
71
+ content: string
72
+ }
73
+ export declare interface ParsedSwitch {
74
+ fullMatch: string
75
+ expression: string
76
+ cases: SwitchCase[]
77
+ start: number
78
+ end: number
79
+ }
@@ -0,0 +1,59 @@
1
+ import { extractBalancedExpression, findMatchingDelimiter, splitByPipe, Tokenizer } from './tokenizer';
2
+ /**
3
+ * Find all template expressions in source ({{ }} and {!! !!})
4
+ */
5
+ export declare function findExpressions(source: string): ExpressionMatch[];
6
+ /**
7
+ * Parse an expression with optional filter chain
8
+ * e.g., "value | uppercase | truncate(10)" -> { baseExpression: "value", filters: [...] }
9
+ */
10
+ export declare function parseExpressionWithFilters(expression: string): ParsedExpression;
11
+ /**
12
+ * Parse comma-separated arguments, respecting nesting
13
+ */
14
+ export declare function parseArguments(argsString: string): string[];
15
+ /**
16
+ * Extract directive parameters from parentheses
17
+ * e.g., "@foreach($items as $item)" -> "$items as $item"
18
+ */
19
+ export declare function extractDirectiveParams(source: string, directiveEnd: number): {
20
+ params: string
21
+ endPos: number
22
+ } | null;
23
+ /**
24
+ * Parse script content and extract declarations
25
+ */
26
+ export declare function parseScriptDeclarations(scriptContent: string): ScriptDeclaration[];
27
+ // =============================================================================
28
+ // Expression Extraction
29
+ // =============================================================================
30
+ export declare interface ExpressionMatch {
31
+ fullMatch: string
32
+ expression: string
33
+ start: number
34
+ end: number
35
+ isRaw: boolean
36
+ }
37
+ // =============================================================================
38
+ // Filter Parsing
39
+ // =============================================================================
40
+ export declare interface FilterCall {
41
+ name: string
42
+ args: string[]
43
+ }
44
+ export declare interface ParsedExpression {
45
+ baseExpression: string
46
+ filters: FilterCall[]
47
+ }
48
+ // =============================================================================
49
+ // Script Parsing Utilities
50
+ // =============================================================================
51
+ export declare interface ScriptDeclaration {
52
+ type: 'variable' | 'function'
53
+ name: string
54
+ value: string
55
+ exported: boolean
56
+ start: number
57
+ end: number
58
+ }
59
+ export { extractBalancedExpression, findMatchingDelimiter, splitByPipe, Tokenizer };
@@ -0,0 +1,35 @@
1
+ export {
2
+ type ConditionalBranch,
3
+ type DirectiveMatch,
4
+ extractParenthesizedExpression,
5
+ findDirectiveBlocks,
6
+ findIfBlocks,
7
+ findMatchingEndTag,
8
+ parseConditionalBlock,
9
+ type ParsedConditional,
10
+ type ParsedSwitch,
11
+ parseSwitchBlock,
12
+ type SwitchCase,
13
+ } from './directive-parser';
14
+ export {
15
+ type ExpressionMatch,
16
+ extractDirectiveParams,
17
+ type FilterCall,
18
+ findExpressions,
19
+ parseArguments,
20
+ type ParsedExpression,
21
+ parseExpressionWithFilters,
22
+ parseScriptDeclarations,
23
+ type ScriptDeclaration,
24
+ } from './expression-parser';
25
+ export {
26
+ type Token,
27
+ Tokenizer,
28
+ type TokenizerState,
29
+ type TokenType,
30
+ } from './tokenizer';
31
+ export {
32
+ extractBalancedExpression,
33
+ findMatchingDelimiter,
34
+ splitByPipe,
35
+ } from './tokenizer';
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Find matching closing delimiter, respecting nesting and strings
3
+ */
4
+ export declare function findMatchingDelimiter(source: string, openChar: string, closeChar: string, startPos?: number): number;
5
+ /**
6
+ * Extract a balanced expression from source starting at position
7
+ */
8
+ export declare function extractBalancedExpression(source: string, startPos: number): {
9
+ expression: string
10
+ endPos: number
11
+ };
12
+ /**
13
+ * Split expression by pipe (|) for filters, respecting nesting
14
+ */
15
+ export declare function splitByPipe(expression: string): string[];
16
+ export declare interface Token {
17
+ type: TokenType
18
+ value: string
19
+ start: number
20
+ end: number
21
+ line: number
22
+ column: number
23
+ }
24
+ export declare interface TokenizerState {
25
+ pos: number
26
+ line: number
27
+ column: number
28
+ }
29
+ /**
30
+ * Tokenizer for Template Expressions
31
+ *
32
+ * A character-by-character tokenizer that properly handles:
33
+ * - Nested braces, brackets, and parentheses
34
+ * - String literals (single, double, and template)
35
+ * - Escaped characters within strings
36
+ * - Template literal expressions `${...}`
37
+ *
38
+ * @module parser/tokenizer
39
+ */
40
+ // =============================================================================
41
+ // Token Types
42
+ // =============================================================================
43
+ export type TokenType = | 'STRING' // 'string' or "string"
44
+ | 'TEMPLATE_STRING' // `template ${expr} string`
45
+ | 'NUMBER'
46
+ | 'IDENTIFIER'
47
+ | 'OPERATOR'
48
+ | 'PUNCTUATION' // ( ) [ ] { } , ; :
49
+ | 'WHITESPACE'
50
+ | 'COMMENT'
51
+ | 'EXPRESSION_START' // {{
52
+ | 'EXPRESSION_END' // }}
53
+ | 'RAW_START' // {!!
54
+ | 'RAW_END' // !!}
55
+ | 'DIRECTIVE' // @name
56
+ | 'EOF'
57
+ /**
58
+ * Tokenizer for template expressions
59
+ */
60
+ export declare class Tokenizer {
61
+ private source: string;
62
+ private pos: number;
63
+ private line: number;
64
+ private column: number;
65
+ private tokens: Token[];
66
+ constructor(source: string);
67
+ tokenize(): Token[];
68
+ private nextToken(): Token | null;
69
+ private readWhitespace(start: number, startLine: number, startColumn: number): Token;
70
+ private readLineComment(start: number, startLine: number, startColumn: number): Token;
71
+ private readBlockComment(start: number, startLine: number, startColumn: number): Token;
72
+ private readString(quote: string, start: number, startLine: number, startColumn: number): Token;
73
+ private readTemplateString(start: number, startLine: number, startColumn: number): Token;
74
+ private readNumber(start: number, startLine: number, startColumn: number): Token;
75
+ private readIdentifier(start: number, startLine: number, startColumn: number): Token;
76
+ private readDirective(start: number, startLine: number, startColumn: number): Token;
77
+ private advance(count?: number): void;
78
+ private peek(offset: number): string | undefined;
79
+ saveState(): TokenizerState;
80
+ restoreState(state: TokenizerState): void;
81
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Create a registry for managing island components
3
+ */
4
+ export declare function createIslandRegistry(): IslandRegistry;
5
+ /**
6
+ * Process all partial hydration directives
7
+ */
8
+ export declare function processPartialHydrationDirectives(template: string, context?: Record<string, unknown>, _filePath?: string): string;
9
+ /**
10
+ * Generate CSS for partial hydration
11
+ */
12
+ export declare function generatePartialHydrationCSS(): string;
13
+ /**
14
+ * Manually hydrate an island by ID
15
+ */
16
+ export declare function hydrateIsland(islandId: string): void;
17
+ /**
18
+ * Hydrate all islands with a specific strategy
19
+ */
20
+ export declare function hydrateByStrategy(strategy: HydrationStrategy): void;
21
+ /**
22
+ * Hydrate all pending islands
23
+ */
24
+ export declare function hydrateAll(): void;
25
+ /**
26
+ * Check if an island is hydrated
27
+ */
28
+ export declare function isHydrated(islandId: string): boolean;
29
+ /**
30
+ * Wait for an island to be hydrated
31
+ */
32
+ export declare function onHydrated(islandId: string): Promise<void>;
33
+ /**
34
+ * Mark content as static (never hydrate)
35
+ */
36
+ export declare function processStaticDirectives(template: string): string;
37
+ /**
38
+ * Generate island manifest for client
39
+ */
40
+ export declare function generateIslandManifest(islands: IslandComponent[]): string;
41
+ export declare interface HydrationOptions {
42
+ strategy: HydrationStrategy
43
+ priority?: 'high' | 'low'
44
+ rootMargin?: string
45
+ threshold?: number | number[]
46
+ media?: string
47
+ event?: string
48
+ timeout?: number
49
+ placeholder?: string
50
+ preserveServerHTML?: boolean
51
+ }
52
+ export declare interface IslandComponent {
53
+ id: string
54
+ component: string
55
+ props: Record<string, unknown>
56
+ options: HydrationOptions
57
+ serverHTML: string
58
+ hydrated: boolean
59
+ }
60
+ export declare interface IslandRegistry {
61
+ islands: Map<string, IslandComponent>
62
+ register: (island: IslandComponent) => void
63
+ get: (id: string) => IslandComponent | undefined
64
+ hydrate: (id: string) => Promise<void>
65
+ hydrateAll: () => Promise<void>
66
+ }
67
+ // ============================================================================
68
+ // Types
69
+ // ============================================================================
70
+ export type HydrationStrategy = | 'load'
71
+ | 'idle'
72
+ | 'visible'
73
+ | 'media'
74
+ | 'only'
75
+ | 'hover'
76
+ | 'event'
77
+ export default {
78
+ processPartialHydrationDirectives,
79
+ processStaticDirectives,
80
+ generatePartialHydrationCSS,
81
+ generateIslandManifest,
82
+ createIslandRegistry,
83
+ hydrateIsland,
84
+ hydrateByStrategy,
85
+ hydrateAll,
86
+ isHydrated,
87
+ onHydrated,
88
+ };