@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,79 @@
1
+ /**
2
+ * Validate a file before upload
3
+ */
4
+ export declare function validateFile(file: File, options?: Partial<UploadHandlerOptions>): FileValidationResult;
5
+ /**
6
+ * Upload a single file with progress tracking
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const result = await uploadFile(file, {
11
+ * endpoint: '/api/upload',
12
+ * onProgress: (progress) => console.log(progress.percent + '%')
13
+ * })
14
+ * ```
15
+ */
16
+ export declare function uploadFile(file: File, options: UploadHandlerOptions, onProgress?: (progress: UploadProgress) => void): Promise<UploadResult>;
17
+ /**
18
+ * Upload multiple files
19
+ */
20
+ export declare function uploadFiles(files: File[], options: UploadHandlerOptions, onProgress?: (file: File, progress: UploadProgress) => void, onComplete?: (file: File, result: UploadResult) => void): Promise<UploadResult[]>;
21
+ /**
22
+ * Generate a preview data URL for an image file
23
+ */
24
+ export declare function generateImagePreview(file: File, maxSize?: number): Promise<string>;
25
+ /**
26
+ * Generate preview for video file (first frame)
27
+ */
28
+ export declare function generateVideoPreview(file: File): Promise<string>;
29
+ /**
30
+ * Generate client-side upload handler runtime
31
+ */
32
+ export declare function generateUploadRuntime(): string;
33
+ /**
34
+ * STX Media - Client-Side Upload Handler
35
+ *
36
+ * Handle file uploads with progress tracking, validation, and preview.
37
+ *
38
+ * @module media/client/upload-handler
39
+ */
40
+ // =============================================================================
41
+ // Types
42
+ // =============================================================================
43
+ export declare interface UploadHandlerOptions {
44
+ endpoint: string
45
+ method?: 'POST' | 'PUT' | 'PATCH'
46
+ headers?: Record<string, string>
47
+ fieldName?: string
48
+ maxSize?: number
49
+ accept?: string[]
50
+ timeout?: number
51
+ withCredentials?: boolean
52
+ formData?: Record<string, string>
53
+ chunkSize?: number
54
+ }
55
+ export declare interface UploadProgress {
56
+ file: File
57
+ loaded: number
58
+ total: number
59
+ percent: number
60
+ speed?: number
61
+ timeRemaining?: number
62
+ chunk?: number
63
+ totalChunks?: number
64
+ }
65
+ export declare interface UploadResult {
66
+ success: boolean
67
+ url?: string
68
+ id?: string
69
+ name?: string
70
+ size?: number
71
+ type?: string
72
+ error?: string
73
+ data?: Record<string, unknown>
74
+ }
75
+ export declare interface FileValidationResult {
76
+ valid: boolean
77
+ error?: string
78
+ code?: 'INVALID_TYPE' | 'FILE_TOO_LARGE' | 'FILE_TOO_SMALL'
79
+ }
@@ -0,0 +1,46 @@
1
+ import { } from './placeholder';
2
+ import { } from './srcset';
3
+ import type { ImageRenderContext, ImageRenderResult, ImgProps, EnhancedImgProps, TsImagesConfig, ProcessedImageResult, ResponsiveVariantSet, } from '../types';
4
+ /**
5
+ * Render an optimized <Img> component
6
+ *
7
+ * Supports both standard ImgProps and EnhancedImgProps with ts-images integration.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Standard usage
12
+ * const result = await renderImgComponent({
13
+ * src: '/images/hero.jpg',
14
+ * alt: 'Hero image',
15
+ * sizes: '(max-width: 768px) 100vw, 50vw',
16
+ * placeholder: 'thumbhash',
17
+ * lazy: true,
18
+ * })
19
+ *
20
+ * // With ts-images processing
21
+ * const result = await renderImgComponent({
22
+ * src: '/images/hero.jpg',
23
+ * alt: 'Hero image',
24
+ * process: true,
25
+ * preset: 'web',
26
+ * responsiveWidths: [320, 640, 1024, 1920],
27
+ * }, { tsImagesConfig: { enabled: true, outputDir: 'dist/images' } })
28
+ * ```
29
+ */
30
+ export declare function renderImgComponent(props: ImgProps | EnhancedImgProps, context?: ImageRenderContext | ExtendedImageRenderContext): Promise<ImageRenderResult>;
31
+ /**
32
+ * Parse <Img> component from template content
33
+ */
34
+ export declare function parseImgComponent(content: string): ImgProps | null;
35
+ /**
36
+ * Process all <Img> components in template content
37
+ */
38
+ export declare function processImgComponents(content: string, context?: ImageRenderContext): Promise<{ html: string; preloadLinks: string[]; styles: string[]; scripts: string[] }>;
39
+ /**
40
+ * Extended image render context with ts-images config
41
+ */
42
+ export declare interface ExtendedImageRenderContext extends ImageRenderContext {
43
+ tsImagesConfig?: TsImagesConfig
44
+ processedResult?: ProcessedImageResult
45
+ responsiveVariants?: ResponsiveVariantSet
46
+ }
@@ -0,0 +1,9 @@
1
+ import type { CustomDirective } from '../../types';
2
+ /**
3
+ * Create the @img directive
4
+ */
5
+ export declare function createImgDirective(): CustomDirective;
6
+ /**
7
+ * The @img directive instance
8
+ */
9
+ export declare const imgDirective: unknown;
@@ -0,0 +1,212 @@
1
+ import type { ImageCrop, ImageFit, ImageFormat, ImageParams } from '../types';
2
+ /**
3
+ * Build an image URL with transformation parameters
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const url = buildImageUrl('/images/hero.jpg', {
8
+ * w: 800,
9
+ * h: 600,
10
+ * fit: 'crop',
11
+ * crop: 'center',
12
+ * q: 85,
13
+ * fm: 'webp'
14
+ * })
15
+ * // Result: "/images/hero.jpg?w=800&h=600&fit=crop&crop=center&q=85&fm=webp"
16
+ * ```
17
+ */
18
+ export declare function buildImageUrl(src: string, params?: ImageParams): string;
19
+ /**
20
+ * Parse image parameters from a URL
21
+ */
22
+ export declare function parseImageUrl(url: string): { src: string; params: ImageParams };
23
+ /**
24
+ * Merge image parameters, with later values overriding earlier ones
25
+ */
26
+ export declare function mergeParams(...paramSets: (ImageParams | undefined)[]): ImageParams;
27
+ /**
28
+ * Resize an image to specific dimensions
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const url = resize('/images/photo.jpg', 800, 600)
33
+ * // Result: "/images/photo.jpg?w=800&h=600"
34
+ * ```
35
+ */
36
+ export declare function resize(src: string, width: number, height?: number, fit?: ImageFit): string;
37
+ /**
38
+ * Crop an image to specific dimensions
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const url = crop('/images/photo.jpg', 800, 600, 'center')
43
+ * // Result: "/images/photo.jpg?w=800&h=600&fit=crop&crop=center"
44
+ * ```
45
+ */
46
+ export declare function crop(src: string, width: number, height: number, position?: ImageCrop): string;
47
+ /**
48
+ * Create a square thumbnail
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const url = thumbnail('/images/photo.jpg', 200)
53
+ * // Result: "/images/photo.jpg?w=200&h=200&fit=crop&crop=center"
54
+ * ```
55
+ */
56
+ export declare function thumbnail(src: string, size: number, cropPosition?: ImageCrop): string;
57
+ /**
58
+ * Scale image to fit within dimensions while maintaining aspect ratio
59
+ */
60
+ export declare function contain(src: string, maxWidth: number, maxHeight?: number): string;
61
+ /**
62
+ * Scale and crop image to cover dimensions
63
+ */
64
+ export declare function cover(src: string, width: number, height: number): string;
65
+ /**
66
+ * Apply blur effect
67
+ *
68
+ * @param radius - Blur radius (0-2000)
69
+ */
70
+ export declare function blur(src: string, radius: number): string;
71
+ /**
72
+ * Apply sharpening
73
+ *
74
+ * @param amount - Sharpen amount (0-100)
75
+ */
76
+ export declare function sharpen(src: string, amount: number): string;
77
+ /**
78
+ * Convert to grayscale
79
+ */
80
+ export declare function grayscale(src: string): string;
81
+ /**
82
+ * Apply sepia tone
83
+ *
84
+ * @param amount - Sepia intensity (0-100)
85
+ */
86
+ export declare function sepia(src: string, amount?: number): string;
87
+ /**
88
+ * Invert colors
89
+ */
90
+ export declare function invert(src: string): string;
91
+ /**
92
+ * Adjust brightness
93
+ *
94
+ * @param amount - Brightness adjustment (-100 to 100)
95
+ */
96
+ export declare function brightness(src: string, amount: number): string;
97
+ /**
98
+ * Adjust contrast
99
+ *
100
+ * @param amount - Contrast adjustment (-100 to 100)
101
+ */
102
+ export declare function contrast(src: string, amount: number): string;
103
+ /**
104
+ * Adjust saturation
105
+ *
106
+ * @param amount - Saturation adjustment (-100 to 100)
107
+ */
108
+ export declare function saturation(src: string, amount: number): string;
109
+ /**
110
+ * Rotate image
111
+ *
112
+ * @param degrees - Rotation in degrees (0-359)
113
+ */
114
+ export declare function rotate(src: string, degrees: number): string;
115
+ /**
116
+ * Flip image horizontally
117
+ */
118
+ export declare function flipHorizontal(src: string): string;
119
+ /**
120
+ * Flip image vertically
121
+ */
122
+ export declare function flipVertical(src: string): string;
123
+ /**
124
+ * Convert to specific format
125
+ */
126
+ export declare function format(src: string, fmt: ImageFormat, quality?: number): string;
127
+ /**
128
+ * Set quality
129
+ */
130
+ export declare function quality(src: string, q: number): string;
131
+ /**
132
+ * Apply auto enhancements
133
+ *
134
+ * @param enhancements - Array of enhancements: 'format', 'compress', 'enhance'
135
+ */
136
+ export declare function auto(src: string, enhancements?: string[]): string;
137
+ /**
138
+ * Add a watermark image
139
+ */
140
+ export declare function watermark(src: string, markUrl: string, options?: {
141
+ x?: number
142
+ y?: number
143
+ alpha?: number
144
+ scale?: number
145
+ align?: string
146
+ }): string;
147
+ /**
148
+ * Apply a preset to an image URL
149
+ */
150
+ export declare function applyPreset(src: string, preset: keyof typeof PRESETS, additionalParams?: ImageParams): string;
151
+ /**
152
+ * Generate srcset-compatible URLs for multiple widths
153
+ */
154
+ export declare function srcsetUrls(src: string, widths: number[], params?: ImageParams): string[];
155
+ /**
156
+ * Generate DPR-aware URLs for a fixed width
157
+ */
158
+ export declare function dprUrls(src: string, width: number, dprValues?: number[], params?: ImageParams): string[];
159
+ /**
160
+ * Validate image parameters
161
+ */
162
+ export declare function validateParams(params: ImageParams): { valid: boolean; errors: string[] };
163
+ /**
164
+ * Sanitize image parameters (clamp to valid ranges)
165
+ */
166
+ export declare function sanitizeParams(params: ImageParams): ImageParams;
167
+ /**
168
+ * Common image transformation presets
169
+ */
170
+ export declare const PRESETS: {
171
+ /** Optimized for web display */
172
+ web: {
173
+ fm: unknown;
174
+ q: 80;
175
+ auto: readonly ['format', 'compress']
176
+ };
177
+ /** High quality for print/download */
178
+ highQuality: {
179
+ q: 95
180
+ };
181
+ /** Optimized for thumbnails */
182
+ thumb: {
183
+ w: 150;
184
+ h: 150;
185
+ fit: unknown;
186
+ crop: unknown
187
+ };
188
+ /** Avatar image */
189
+ avatar: {
190
+ w: 200;
191
+ h: 200;
192
+ fit: unknown;
193
+ crop: unknown
194
+ };
195
+ /** Social media share image */
196
+ social: {
197
+ w: 1200;
198
+ h: 630;
199
+ fit: unknown
200
+ };
201
+ /** Small preview */
202
+ preview: {
203
+ w: 400;
204
+ q: 70
205
+ };
206
+ /** Blur placeholder */
207
+ placeholder: {
208
+ w: 20;
209
+ blur: 200;
210
+ q: 20
211
+ }
212
+ };
@@ -0,0 +1,118 @@
1
+ export type { ExtendedImageRenderContext } from './component';
2
+ export {
3
+ // Main render function
4
+ renderImgComponent,
5
+ // Template parser
6
+ parseImgComponent,
7
+ processImgComponents,
8
+ } from './component';
9
+ export {
10
+ // Directive factory
11
+ createImgDirective,
12
+ // Directive instance
13
+ imgDirective,
14
+ } from './directive';
15
+ export {
16
+ // Constants
17
+ DEFAULT_WIDTHS,
18
+ DEFAULT_DPR_VALUES,
19
+ DEFAULT_FORMATS,
20
+ MIME_TYPES,
21
+ FORMAT_EXTENSIONS,
22
+ COMMON_SIZES,
23
+
24
+ // Width-based srcset
25
+ generateWidthSrcset,
26
+ generateAutoWidthSrcset,
27
+ calculateOptimalWidths,
28
+
29
+ // DPR-based srcset
30
+ generateDprSrcset,
31
+ generateDprSrcsetWithVariableQuality,
32
+
33
+ // Sizes attribute
34
+ generateSizesAttribute,
35
+ generateSizesFromBreakpoints,
36
+
37
+ // URL building
38
+ buildImageUrl,
39
+ parseImageUrl,
40
+
41
+ // Full srcset generation
42
+ generateSrcsetData,
43
+ generateSourceTags,
44
+
45
+ // Utilities
46
+ getBestVariant,
47
+ getFallbackVariant,
48
+ groupVariantsByFormat,
49
+ getMimeType,
50
+ getFormatExtension,
51
+ detectFormat,
52
+ } from './srcset';
53
+ export {
54
+ // Constants
55
+ DEFAULT_PLACEHOLDER_OPTIONS,
56
+ BLUR_UP_CSS,
57
+
58
+ // Generation
59
+ generatePlaceholder,
60
+ generateThumbhashPlaceholder,
61
+ generateLQIP,
62
+ extractDominantColor,
63
+ generateColorPlaceholder,
64
+
65
+ // Thumbhash
66
+ decodeThumbhash,
67
+
68
+ // CSS
69
+ generatePlaceholderCSS,
70
+ generatePlaceholderStyle,
71
+
72
+ // Cache
73
+ getCachedPlaceholder,
74
+ clearPlaceholderCache,
75
+ getPlaceholderCacheStats,
76
+ } from './placeholder';
77
+ export {
78
+ // URL building
79
+ buildImageUrl as buildUrl,
80
+ parseImageUrl as parseUrl,
81
+ mergeParams,
82
+
83
+ // Convenience functions
84
+ resize,
85
+ crop,
86
+ thumbnail,
87
+ contain,
88
+ cover,
89
+ blur,
90
+ sharpen,
91
+ grayscale,
92
+ sepia,
93
+ invert,
94
+ brightness,
95
+ contrast,
96
+ saturation,
97
+ rotate,
98
+ flipHorizontal,
99
+ flipVertical,
100
+ format,
101
+ quality,
102
+ auto,
103
+
104
+ // Watermark
105
+ watermark,
106
+
107
+ // Presets
108
+ PRESETS,
109
+ applyPreset,
110
+
111
+ // Responsive helpers
112
+ srcsetUrls,
113
+ dprUrls,
114
+
115
+ // Validation
116
+ validateParams,
117
+ sanitizeParams,
118
+ } from './editing';
@@ -0,0 +1,78 @@
1
+ import type { PlaceholderOptions, PlaceholderResult } from '../types';
2
+ /**
3
+ * Generate a placeholder for an image using the specified strategy
4
+ *
5
+ * @param src - Image source path
6
+ * @param options - Placeholder options
7
+ * @returns Placeholder result with data URL
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const placeholder = await generatePlaceholder('/images/hero.jpg', {
12
+ * strategy: 'thumbhash',
13
+ * })
14
+ * console.log(placeholder.dataURL) // data:image/png;base64,...
15
+ * ```
16
+ */
17
+ export declare function generatePlaceholder(src: string, options?: Partial<PlaceholderOptions>): Promise<PlaceholderResult>;
18
+ /**
19
+ * Generate a thumbhash placeholder specifically
20
+ *
21
+ * @param src - Image source path
22
+ * @returns Thumbhash data URL
23
+ */
24
+ export declare function generateThumbhashPlaceholder(src: string): Promise<string>;
25
+ /**
26
+ * Decode a thumbhash string to a data URL (client-side)
27
+ *
28
+ * This is a minimal thumbhash decoder for client-side use
29
+ * Based on https://github.com/evanw/thumbhash
30
+ */
31
+ export declare function decodeThumbhash(hash: Uint8Array): string;
32
+ /**
33
+ * Generate a low-quality image placeholder with blur
34
+ *
35
+ * @param src - Image source path
36
+ * @param width - Placeholder width (default: 20)
37
+ * @param quality - JPEG quality (default: 50)
38
+ */
39
+ export declare function generateLQIP(src: string, width?: number, quality?: number): Promise<PlaceholderResult>;
40
+ /**
41
+ * Extract dominant color from an image
42
+ *
43
+ * @param src - Image source path
44
+ * @returns Hex color string
45
+ */
46
+ export declare function extractDominantColor(src: string): Promise<string>;
47
+ /**
48
+ * Generate a solid color placeholder
49
+ */
50
+ export declare function generateColorPlaceholder(color: string, width?: number, height?: number): string;
51
+ /**
52
+ * Generate CSS for placeholder with specific options
53
+ */
54
+ export declare function generatePlaceholderCSS(id: string, placeholder: PlaceholderResult, options?: Partial<PlaceholderOptions>): string;
55
+ /**
56
+ * Generate inline style for placeholder background
57
+ */
58
+ export declare function generatePlaceholderStyle(placeholder: PlaceholderResult): string;
59
+ /**
60
+ * Get placeholder from cache or generate new
61
+ */
62
+ export declare function getCachedPlaceholder(src: string, options?: Partial<PlaceholderOptions>): Promise<PlaceholderResult>;
63
+ /**
64
+ * Clear the placeholder cache
65
+ */
66
+ export declare function clearPlaceholderCache(): void;
67
+ /**
68
+ * Get cache statistics
69
+ */
70
+ export declare function getPlaceholderCacheStats(): { size: number; keys: string[] };
71
+ /**
72
+ * Default placeholder options
73
+ */
74
+ export declare const DEFAULT_PLACEHOLDER_OPTIONS: PlaceholderOptions;
75
+ /**
76
+ * CSS for blur-up transition
77
+ */
78
+ export declare const BLUR_UP_CSS: unknown;
@@ -0,0 +1,32 @@
1
+ import { } from '../../shared/cache';
2
+ import type { EnhancedImgProps, ProcessedImageResult, TsImagesConfig, } from '../../types';
3
+ /**
4
+ * Get cached image processing result
5
+ */
6
+ export declare function getCachedImageResult(src: string, options: Partial<EnhancedImgProps>, config?: TsImagesConfig): Promise<ProcessedImageResult | null>;
7
+ /**
8
+ * Set cached image processing result
9
+ */
10
+ export declare function setCachedImageResult(src: string, options: Partial<EnhancedImgProps>, result: ProcessedImageResult, config?: TsImagesConfig): Promise<void>;
11
+ /**
12
+ * Clear image processing cache
13
+ */
14
+ export declare function clearImageCache(): Promise<void>;
15
+ /**
16
+ * Image processor cache configuration
17
+ */
18
+ export declare interface ImageCacheConfig extends CacheConfig {
19
+ cacheVariants?: boolean
20
+ cachePlaceholders?: boolean
21
+ }
22
+ /**
23
+ * Image processor cache class
24
+ */
25
+ export declare class ImageProcessorCache {
26
+ private config: ImageCacheConfig;
27
+ constructor(config?: Partial<ImageCacheConfig>);
28
+ get(src: string, options: Partial<EnhancedImgProps>): Promise<ProcessedImageResult | null>;
29
+ set(src: string, options: Partial<EnhancedImgProps>, result: ProcessedImageResult): Promise<void>;
30
+ clear(): Promise<void>;
31
+ updateConfig(config: Partial<ImageCacheConfig>): void;
32
+ }
@@ -0,0 +1,12 @@
1
+ export type {
2
+ EnhancedImgProps,
3
+ ProcessedImageResult,
4
+ ResponsiveVariantSet,
5
+ TsImagesConfig,
6
+ ImageOptimizationPreset,
7
+ ImageTransformationConfig,
8
+ FormatQualitySettings,
9
+ } from '../../types';
10
+ export { processImage, optimizeImage, applyTransformations } from './optimizer';
11
+ export { generateResponsiveVariants, generateSrcset } from './responsive';
12
+ export { getCachedImageResult, setCachedImageResult, clearImageCache, ImageProcessorCache } from './cache';
@@ -0,0 +1,13 @@
1
+ import type { EnhancedImgProps, ProcessedImageResult, TsImagesConfig, ImageFormat, ImageTransformationConfig, } from '../../types';
2
+ /**
3
+ * Process a single image with ts-images
4
+ */
5
+ export declare function processImage(src: string, options: Partial<EnhancedImgProps>, config: TsImagesConfig): Promise<ProcessedImageResult>;
6
+ /**
7
+ * Optimize a single image without responsive variants
8
+ */
9
+ export declare function optimizeImage(src: string, format: ImageFormat, quality: number, outputPath: string): Promise<{ success: boolean; size?: number; error?: string }>;
10
+ /**
11
+ * Apply transformations to an image
12
+ */
13
+ export declare function applyTransformations(src: string, transformations: ImageTransformationConfig[], tsImages?: typeof import('ts-images') | null): Promise<Buffer | null>;
@@ -0,0 +1,17 @@
1
+ import type { EnhancedImgProps, ResponsiveVariantSet, TsImagesConfig, ProcessedImageResult, } from '../../types';
2
+ /**
3
+ * Generate responsive image variants using ts-images
4
+ */
5
+ export declare function generateResponsiveVariants(src: string, options: Partial<EnhancedImgProps>, config: TsImagesConfig): Promise<ResponsiveVariantSet | null>;
6
+ /**
7
+ * Generate srcset string from variants
8
+ */
9
+ export declare function generateSrcset(variants: ProcessedImageResult['variants'], type?: 'width' | 'dpr'): string;
10
+ /**
11
+ * Generate art direction sources for <picture> element
12
+ */
13
+ export declare function generateArtDirectionSources(src: string, artDirection: NonNullable<EnhancedImgProps['artDirection']>, config: TsImagesConfig): Promise<Array<{ media: string; srcset: string; type: string }>>;
14
+ /**
15
+ * Default responsive breakpoints
16
+ */
17
+ export declare const DEFAULT_RESPONSIVE_WIDTHS: readonly [320, 480, 640, 768, 1024, 1280, 1536, 1920];