@stacksjs/stx 0.2.155 → 0.2.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/dist/a11y.d.ts +87 -46
  2. package/dist/animation.d.ts +96 -42
  3. package/dist/appearance-bootstrap.d.ts +49 -15
  4. package/dist/asset-roots.d.ts +32 -0
  5. package/dist/asset-roots.js +7 -0
  6. package/dist/assets.d.ts +9 -7
  7. package/dist/async-components.d.ts +78 -56
  8. package/dist/auth.d.ts +3 -0
  9. package/dist/build-externalize.d.ts +40 -0
  10. package/dist/build-externalize.js +63 -0
  11. package/dist/build-id.d.ts +22 -22
  12. package/dist/build-message.d.ts +73 -2
  13. package/dist/build-message.js +47 -8
  14. package/dist/builtins/attrs.d.ts +14 -0
  15. package/dist/builtins/drawer.d.ts +22 -0
  16. package/dist/builtins/icon.d.ts +16 -2
  17. package/dist/builtins/index.d.ts +5 -15
  18. package/dist/builtins/modal.d.ts +24 -0
  19. package/dist/builtins/safe-image.d.ts +42 -0
  20. package/dist/builtins/stx-image.d.ts +27 -0
  21. package/dist/builtins/stx-link.d.ts +9 -0
  22. package/dist/builtins/stx-loading-indicator.d.ts +11 -0
  23. package/dist/builtins/suspense.d.ts +28 -0
  24. package/dist/builtins/toast.d.ts +17 -0
  25. package/dist/builtins/transition-group.d.ts +25 -0
  26. package/dist/caching.d.ts +12 -15
  27. package/dist/cli.js +1798 -908
  28. package/dist/client/directive.d.ts +7 -0
  29. package/dist/client/index.d.ts +0 -1
  30. package/dist/client-script-bundler.d.ts +63 -5
  31. package/dist/client-script-bundler.js +30 -2
  32. package/dist/client-script.d.ts +102 -47
  33. package/dist/client-script.js +15 -3
  34. package/dist/codemod.d.ts +56 -0
  35. package/dist/codemod.js +192 -0
  36. package/dist/color-mode-boot.d.ts +83 -65
  37. package/dist/component-client-factories.d.ts +1 -6
  38. package/dist/component-processing.d.ts +58 -49
  39. package/dist/component-processing.js +1 -1
  40. package/dist/component-registry.d.ts +94 -31
  41. package/dist/component-renderer.d.ts +18 -0
  42. package/dist/composable-loader.d.ts +24 -0
  43. package/dist/composable-loader.js +12 -9
  44. package/dist/composables/index.d.ts +7 -0
  45. package/dist/composables/index.js +1 -0
  46. package/dist/composables/use-fetch.js +30 -2
  47. package/dist/composables/use-form.d.ts +91 -0
  48. package/dist/composables/use-form.js +112 -0
  49. package/dist/composables.d.ts +64 -60
  50. package/dist/computed.d.ts +86 -92
  51. package/dist/conditionals.d.ts +24 -8
  52. package/dist/conditionals.js +16 -0
  53. package/dist/config.d.ts +34 -21
  54. package/dist/config.js +35 -14
  55. package/dist/craft.js +1476 -768
  56. package/dist/crosswind-config.d.ts +58 -0
  57. package/dist/crosswind-config.js +40 -0
  58. package/dist/csp.d.ts +107 -41
  59. package/dist/defer.d.ts +24 -0
  60. package/dist/dev-server/crosswind.d.ts +35 -26
  61. package/dist/dev-server/crosswind.js +2 -18
  62. package/dist/dev-server/serve-app.js +4 -3
  63. package/dist/dev-server/terminal-colors.d.ts +32 -32
  64. package/dist/directive-api.d.ts +86 -43
  65. package/dist/document-shell.d.ts +54 -41
  66. package/dist/dynamic-components.d.ts +9 -0
  67. package/dist/error-boundaries.d.ts +47 -41
  68. package/dist/error-handling.d.ts +1 -1
  69. package/dist/errors/codes.d.ts +51 -43
  70. package/dist/errors/formatter.d.ts +58 -38
  71. package/dist/errors/index.d.ts +5 -61
  72. package/dist/errors/logger.d.ts +114 -40
  73. package/dist/errors/sanitizer.d.ts +53 -23
  74. package/dist/errors/types.d.ts +44 -31
  75. package/dist/events.d.ts +86 -25
  76. package/dist/expressions.d.ts +50 -42
  77. package/dist/forms-validation.d.ts +138 -123
  78. package/dist/forms-validation.js +1 -90
  79. package/dist/forms.d.ts +120 -66
  80. package/dist/forms.js +31 -11
  81. package/dist/fragment-container.d.ts +57 -0
  82. package/dist/fragment-container.js +109 -0
  83. package/dist/framework-composables.d.ts +32 -0
  84. package/dist/head.d.ts +156 -114
  85. package/dist/heatmap.d.ts +152 -72
  86. package/dist/html-masking.d.ts +40 -34
  87. package/dist/hydration-runtime.d.ts +20 -24
  88. package/dist/i18n.d.ts +93 -32
  89. package/dist/image-optimization/auto-sibling.d.ts +32 -4
  90. package/dist/includes.d.ts +69 -7
  91. package/dist/index.d.ts +66 -0
  92. package/dist/index.js +23 -0
  93. package/dist/internal-markdown.d.ts +12 -8
  94. package/dist/island-chunking.d.ts +30 -13
  95. package/dist/keep-alive.d.ts +72 -52
  96. package/dist/layout-types.d.ts +45 -0
  97. package/dist/layout-types.js +56 -0
  98. package/dist/lazy-module.d.ts +10 -0
  99. package/dist/loops.d.ts +66 -0
  100. package/dist/loops.js +47 -6
  101. package/dist/markdown.d.ts +0 -1
  102. package/dist/media/image/component.d.ts +25 -9
  103. package/dist/media/image/directive.d.ts +15 -1
  104. package/dist/media/image/placeholder.d.ts +20 -9
  105. package/dist/media/image/processor/cache.d.ts +40 -18
  106. package/dist/media/image/processor/index.d.ts +1 -10
  107. package/dist/media/image/processor/optimizer.d.ts +12 -1
  108. package/dist/media/image/processor/responsive.d.ts +16 -6
  109. package/dist/media/image/srcset.d.ts +47 -50
  110. package/dist/media/shared/cache.d.ts +51 -31
  111. package/dist/media/shared/hash.d.ts +7 -0
  112. package/dist/media/types.d.ts +1235 -754
  113. package/dist/media/video/directive.d.ts +15 -1
  114. package/dist/media/video/index.d.ts +39 -17
  115. package/dist/media/video/processor/cache.d.ts +42 -19
  116. package/dist/media/video/processor/index.d.ts +1 -18
  117. package/dist/media/video/processor/streaming.d.ts +17 -10
  118. package/dist/media/video/processor/thumbnail.d.ts +21 -15
  119. package/dist/media/video/processor/transcoder.d.ts +11 -1
  120. package/dist/method-spoofing.d.ts +7 -0
  121. package/dist/middleware.d.ts +60 -0
  122. package/dist/owned-routes.d.ts +42 -0
  123. package/dist/owned-routes.js +26 -0
  124. package/dist/page-meta.d.ts +38 -0
  125. package/dist/page-meta.js +16 -0
  126. package/dist/parser/directive-parser.d.ts +57 -45
  127. package/dist/parser/expression-parser.d.ts +33 -35
  128. package/dist/parser/index.d.ts +4 -39
  129. package/dist/parser/tokenizer.d.ts +61 -49
  130. package/dist/partial-hydration.d.ts +82 -50
  131. package/dist/performance-utils.d.ts +217 -124
  132. package/dist/placeholder.d.ts +18 -9
  133. package/dist/plugin-system.d.ts +264 -115
  134. package/dist/process.d.ts +11 -6
  135. package/dist/process.js +21 -4
  136. package/dist/production-builder.js +7 -0
  137. package/dist/prop-sentinels.d.ts +11 -11
  138. package/dist/public-env.d.ts +14 -0
  139. package/dist/pwa/directives.d.ts +12 -3
  140. package/dist/pwa/inject.d.ts +10 -0
  141. package/dist/pwa/precache.d.ts +22 -16
  142. package/dist/pwa/service-worker.d.ts +12 -0
  143. package/dist/pwa.js +1318 -610
  144. package/dist/reactive-bindings.d.ts +34 -11
  145. package/dist/reactive.d.ts +58 -30
  146. package/dist/reactive.js +56 -31
  147. package/dist/render.js +1 -0
  148. package/dist/route-middleware.d.ts +2 -35
  149. package/dist/route-types.d.ts +134 -0
  150. package/dist/route-types.js +24 -0
  151. package/dist/router.d.ts +5 -7
  152. package/dist/routes.d.ts +1 -3
  153. package/dist/runtime-globals.d.ts +147 -24
  154. package/dist/runtime-globals.js +16 -1
  155. package/dist/runtime-injection.d.ts +8 -0
  156. package/dist/runtime-injection.js +33 -24
  157. package/dist/script-emit.d.ts +30 -0
  158. package/dist/script-json.d.ts +36 -0
  159. package/dist/script-json.js +6 -0
  160. package/dist/script-validation.d.ts +21 -4
  161. package/dist/seo.d.ts +118 -47
  162. package/dist/server-bindings.d.ts +21 -0
  163. package/dist/sfc-template.d.ts +8 -8
  164. package/dist/signal-processing.d.ts +35 -15
  165. package/dist/signals-api.d.ts +117 -58
  166. package/dist/signals-api.js +7 -4
  167. package/dist/signals.d.ts +24 -17
  168. package/dist/signals.js +765 -60
  169. package/dist/site-builder/build.js +8 -0
  170. package/dist/site-url.d.ts +46 -0
  171. package/dist/site-url.js +70 -0
  172. package/dist/slots.d.ts +86 -20
  173. package/dist/source-signature.d.ts +45 -0
  174. package/dist/source-signature.js +20 -0
  175. package/dist/ssg.d.ts +285 -142
  176. package/dist/ssg.js +1268 -556
  177. package/dist/state-dir.d.ts +4 -4
  178. package/dist/state-management.d.ts +0 -12
  179. package/dist/state-management.js +8 -25
  180. package/dist/store-imports.d.ts +23 -0
  181. package/dist/store-imports.js +3 -0
  182. package/dist/store-loader.d.ts +10 -0
  183. package/dist/store-loader.js +10 -9
  184. package/dist/story/analytics.d.ts +138 -60
  185. package/dist/story/bookmarks.d.ts +87 -34
  186. package/dist/story/cli.d.ts +123 -69
  187. package/dist/story/collect/scanner.d.ts +4 -0
  188. package/dist/story/collect/tree.d.ts +8 -1
  189. package/dist/story/commands/build.d.ts +11 -6
  190. package/dist/story/commands/dev.d.ts +15 -8
  191. package/dist/story/commands/preview.d.ts +13 -7
  192. package/dist/story/config-watcher.d.ts +20 -13
  193. package/dist/story/config.d.ts +11 -8
  194. package/dist/story/context.d.ts +14 -8
  195. package/dist/story/hmr.d.ts +24 -26
  196. package/dist/story/hot-swap.d.ts +34 -23
  197. package/dist/story/keyboard-shortcuts.d.ts +23 -18
  198. package/dist/story/output.d.ts +46 -44
  199. package/dist/story/performance.d.ts +107 -45
  200. package/dist/story/presets.d.ts +107 -41
  201. package/dist/story/renderer.d.ts +41 -27
  202. package/dist/story/search.d.ts +23 -12
  203. package/dist/story/server.d.ts +21 -11
  204. package/dist/story/setup.d.ts +23 -15
  205. package/dist/story/testing.d.ts +65 -40
  206. package/dist/story/types.d.ts +262 -160
  207. package/dist/streaming.d.ts +119 -57
  208. package/dist/stx-virtual-ts.d.ts +165 -0
  209. package/dist/stx-virtual-ts.js +372 -0
  210. package/dist/stx.d.ts +78 -1
  211. package/dist/style-scoping.d.ts +17 -4
  212. package/dist/suspense.d.ts +67 -52
  213. package/dist/teleport.d.ts +22 -0
  214. package/dist/template-tag-balance.d.ts +22 -6
  215. package/dist/transitions.d.ts +66 -55
  216. package/dist/typecheck.d.ts +77 -0
  217. package/dist/typecheck.js +156 -0
  218. package/dist/types/component-types.d.ts +187 -122
  219. package/dist/types/config-types.d.ts +758 -297
  220. package/dist/types/context-types.d.ts +46 -24
  221. package/dist/types/csp-types.d.ts +70 -66
  222. package/dist/types/directive-types.d.ts +211 -155
  223. package/dist/types/index.d.ts +6 -109
  224. package/dist/types/pwa-types.d.ts +273 -148
  225. package/dist/types.d.ts +0 -1
  226. package/dist/typescript-templates.d.ts +11 -0
  227. package/dist/unresolved-identifiers.d.ts +24 -22
  228. package/dist/unresolved-identifiers.js +2 -0
  229. package/dist/utils.d.ts +24 -21
  230. package/dist/validator.d.ts +28 -26
  231. package/dist/variable-extractor.d.ts +48 -13
  232. package/dist/variable-extractor.js +27 -4
  233. package/dist/view-composers.d.ts +80 -81
  234. package/dist/virtual-scrolling.d.ts +101 -81
  235. package/dist/vue-template.d.ts +23 -0
  236. package/dist/web-components/css-scoping.d.ts +21 -11
  237. package/dist/web-components.d.ts +81 -58
  238. package/dist/x-element.d.ts +0 -1
  239. package/package.json +5 -5
  240. package/stx.d.ts +78 -1
@@ -1,4 +1,23 @@
1
+ /**
2
+ * STX Media - Image Component
3
+ *
4
+ * Render optimized responsive images with srcset, lazy loading,
5
+ * and blur-up placeholder effects.
6
+ *
7
+ * @module media/image/component
8
+ */
1
9
  import type { ImageRenderContext, ImageRenderResult, ImgProps, EnhancedImgProps, TsImagesConfig, ProcessedImageResult, ResponsiveVariantSet } from '../types';
10
+ /**
11
+ * Extended image render context with ts-images config
12
+ */
13
+ export interface ExtendedImageRenderContext extends ImageRenderContext {
14
+ /** ts-images configuration */
15
+ tsImagesConfig?: TsImagesConfig;
16
+ /** Processed image result (pre-computed) */
17
+ processedResult?: ProcessedImageResult;
18
+ /** Responsive variants (pre-computed) */
19
+ responsiveVariants?: ResponsiveVariantSet;
20
+ }
2
21
  /**
3
22
  * Render an optimized <Img> component
4
23
  *
@@ -33,12 +52,9 @@ export declare function parseImgComponent(content: string): ImgProps | null;
33
52
  /**
34
53
  * Process all <Img> components in template content
35
54
  */
36
- export declare function processImgComponents(content: string, context?: ImageRenderContext): Promise<{ html: string; preloadLinks: string[]; styles: string[]; scripts: string[] }>;
37
- /**
38
- * Extended image render context with ts-images config
39
- */
40
- export declare interface ExtendedImageRenderContext extends ImageRenderContext {
41
- tsImagesConfig?: TsImagesConfig
42
- processedResult?: ProcessedImageResult
43
- responsiveVariants?: ResponsiveVariantSet
44
- }
55
+ export declare function processImgComponents(content: string, context?: ImageRenderContext): Promise<{
56
+ html: string;
57
+ preloadLinks: string[];
58
+ styles: string[];
59
+ scripts: string[];
60
+ }>;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * STX Media - Image Directive
3
+ *
4
+ * @img directive for declarative responsive image rendering.
5
+ *
6
+ * @module media/image/directive
7
+ *
8
+ * @example
9
+ * ```html
10
+ * @img('/images/hero.jpg', 'Hero image', { sizes: '100vw', placeholder: 'thumbhash' })
11
+ * @img('/images/photo.jpg', 'Photo')
12
+ * @img(dynamicSrc, dynamicAlt, { lazy: true })
13
+ * ```
14
+ */
1
15
  import type { CustomDirective } from '../../types';
2
16
  /**
3
17
  * Create the @img directive
@@ -6,4 +20,4 @@ export declare function createImgDirective(): CustomDirective;
6
20
  /**
7
21
  * The @img directive instance
8
22
  */
9
- export declare const imgDirective: unknown;
23
+ export declare const imgDirective: CustomDirective;
@@ -1,4 +1,20 @@
1
+ /**
2
+ * STX Media - Placeholder Generation
3
+ *
4
+ * Generate low-quality image placeholders (LQIP) for blur-up lazy loading effects.
5
+ * Supports multiple strategies: blur, thumbhash, blurhash, pixelate, dominant-color.
6
+ *
7
+ * @module media/image/placeholder
8
+ */
1
9
  import type { PlaceholderOptions, PlaceholderResult } from '../types';
10
+ /**
11
+ * Default placeholder options
12
+ */
13
+ export declare const DEFAULT_PLACEHOLDER_OPTIONS: PlaceholderOptions;
14
+ /**
15
+ * CSS for blur-up transition
16
+ */
17
+ export declare const BLUR_UP_CSS: string;
2
18
  /**
3
19
  * Generate a placeholder for an image using the specified strategy
4
20
  *
@@ -67,12 +83,7 @@ export declare function clearPlaceholderCache(): void;
67
83
  /**
68
84
  * Get cache statistics
69
85
  */
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;
86
+ export declare function getPlaceholderCacheStats(): {
87
+ size: number;
88
+ keys: string[];
89
+ };
@@ -1,5 +1,44 @@
1
- import { type CacheConfig } from '../../shared/cache';
1
+ /**
2
+ * STX Media - Image Processing Cache
3
+ *
4
+ * Specialized cache for image processing results.
5
+ *
6
+ * @module media/image/processor/cache
7
+ */
2
8
  import type { EnhancedImgProps, ProcessedImageResult, TsImagesConfig } from '../../types';
9
+ import { type CacheConfig } from '../../shared/cache';
10
+ /**
11
+ * Image processor cache configuration
12
+ */
13
+ export interface ImageCacheConfig extends CacheConfig {
14
+ /** Cache variants separately */
15
+ cacheVariants?: boolean;
16
+ /** Cache placeholders separately */
17
+ cachePlaceholders?: boolean;
18
+ }
19
+ /**
20
+ * Image processor cache class
21
+ */
22
+ export declare class ImageProcessorCache {
23
+ private config;
24
+ constructor(config?: Partial<ImageCacheConfig>);
25
+ /**
26
+ * Get cached processing result
27
+ */
28
+ get(src: string, options: Partial<EnhancedImgProps>): Promise<ProcessedImageResult | null>;
29
+ /**
30
+ * Set cached processing result
31
+ */
32
+ set(src: string, options: Partial<EnhancedImgProps>, result: ProcessedImageResult): Promise<void>;
33
+ /**
34
+ * Clear the entire image cache
35
+ */
36
+ clear(): Promise<void>;
37
+ /**
38
+ * Update cache configuration
39
+ */
40
+ updateConfig(config: Partial<ImageCacheConfig>): void;
41
+ }
3
42
  /**
4
43
  * Get cached image processing result
5
44
  */
@@ -12,20 +51,3 @@ export declare function setCachedImageResult(src: string, options: Partial<Enhan
12
51
  * Clear image processing cache
13
52
  */
14
53
  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
- constructor(config?: Partial<ImageCacheConfig>);
27
- get(src: string, options: Partial<EnhancedImgProps>): Promise<ProcessedImageResult | null>;
28
- set(src: string, options: Partial<EnhancedImgProps>, result: ProcessedImageResult): Promise<void>;
29
- clear(): Promise<void>;
30
- updateConfig(config: Partial<ImageCacheConfig>): void;
31
- }
@@ -1,13 +1,3 @@
1
- // Re-export types for convenience
2
- export type {
3
- EnhancedImgProps,
4
- ProcessedImageResult,
5
- ResponsiveVariantSet,
6
- TsImagesConfig,
7
- ImageOptimizationPreset,
8
- ImageTransformationConfig,
9
- FormatQualitySettings,
10
- } from '../../types';
11
1
  /**
12
2
  * STX Media - Image Processor
13
3
  *
@@ -18,3 +8,4 @@ export type {
18
8
  export { processImage, optimizeImage, applyTransformations } from './optimizer';
19
9
  export { generateResponsiveVariants, generateSrcset } from './responsive';
20
10
  export { getCachedImageResult, setCachedImageResult, clearImageCache, ImageProcessorCache } from './cache';
11
+ export type { EnhancedImgProps, ProcessedImageResult, ResponsiveVariantSet, TsImagesConfig, ImageOptimizationPreset, ImageTransformationConfig, FormatQualitySettings, } from '../../types';
@@ -1,3 +1,10 @@
1
+ /**
2
+ * STX Media - Image Optimizer
3
+ *
4
+ * Wraps ts-images for image optimization and transformation.
5
+ *
6
+ * @module media/image/processor/optimizer
7
+ */
1
8
  import type { EnhancedImgProps, ProcessedImageResult, TsImagesConfig, ImageFormat, ImageTransformationConfig } from '../../types';
2
9
  /**
3
10
  * Process a single image with ts-images
@@ -6,7 +13,11 @@ export declare function processImage(src: string, options: Partial<EnhancedImgPr
6
13
  /**
7
14
  * Optimize a single image without responsive variants
8
15
  */
9
- export declare function optimizeImage(src: string, format: ImageFormat, quality: number, outputPath: string): Promise<{ success: boolean; size?: number; error?: string }>;
16
+ export declare function optimizeImage(src: string, format: ImageFormat, quality: number, outputPath: string): Promise<{
17
+ success: boolean;
18
+ size?: number;
19
+ error?: string;
20
+ }>;
10
21
  /**
11
22
  * Apply transformations to an image
12
23
  */
@@ -1,4 +1,15 @@
1
+ /**
2
+ * STX Media - Responsive Image Generation
3
+ *
4
+ * Generates responsive image variants at multiple widths and formats.
5
+ *
6
+ * @module media/image/processor/responsive
7
+ */
1
8
  import type { EnhancedImgProps, ResponsiveVariantSet, TsImagesConfig, ProcessedImageResult } from '../../types';
9
+ /**
10
+ * Default responsive breakpoints
11
+ */
12
+ export declare const DEFAULT_RESPONSIVE_WIDTHS: number[];
2
13
  /**
3
14
  * Generate responsive image variants using ts-images
4
15
  */
@@ -10,9 +21,8 @@ export declare function generateSrcset(variants: ProcessedImageResult['variants'
10
21
  /**
11
22
  * Generate art direction sources for <picture> element
12
23
  */
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
- * @defaultValue `[320, 480, 640, 768, 1024, 1280, 1536, 1920]`
17
- */
18
- export declare const DEFAULT_RESPONSIVE_WIDTHS: number[];
24
+ export declare function generateArtDirectionSources(src: string, artDirection: NonNullable<EnhancedImgProps['artDirection']>, config: TsImagesConfig): Promise<Array<{
25
+ media: string;
26
+ srcset: string;
27
+ type: string;
28
+ }>>;
@@ -1,4 +1,32 @@
1
+ /**
2
+ * STX Media - Srcset Generation
3
+ *
4
+ * Generate responsive srcset attributes for images following imgix.js patterns.
5
+ * Supports both width-based srcsets and DPR-based srcsets for fixed-width images.
6
+ *
7
+ * @module media/image/srcset
8
+ */
1
9
  import type { Breakpoint, ImageFormat, ImageParams, ImageVariant, SrcsetData, SrcsetOptions } from '../types';
10
+ /**
11
+ * Default breakpoint widths for responsive images
12
+ */
13
+ export declare const DEFAULT_WIDTHS: number[];
14
+ /**
15
+ * Default DPR values for fixed-width images
16
+ */
17
+ export declare const DEFAULT_DPR_VALUES: number[];
18
+ /**
19
+ * Default output formats in order of preference
20
+ */
21
+ export declare const DEFAULT_FORMATS: ImageFormat[];
22
+ /**
23
+ * MIME types for each format
24
+ */
25
+ export declare const MIME_TYPES: Record<ImageFormat, string>;
26
+ /**
27
+ * File extensions for each format
28
+ */
29
+ export declare const FORMAT_EXTENSIONS: Record<ImageFormat, string>;
2
30
  /**
3
31
  * Generate a width-based srcset string
4
32
  *
@@ -61,6 +89,21 @@ export declare function generateSizesAttribute(breakpoints: Record<string, strin
61
89
  * Generate sizes from named breakpoints
62
90
  */
63
91
  export declare function generateSizesFromBreakpoints(breakpoints: Breakpoint[], defaultSize?: string): string;
92
+ /**
93
+ * Common responsive sizes patterns
94
+ */
95
+ export declare const COMMON_SIZES: {
96
+ /** Full width on all screens */
97
+ readonly fullWidth: '100vw';
98
+ /** Half width on desktop, full on mobile */
99
+ readonly halfDesktop: '(max-width: 768px) 100vw, 50vw';
100
+ /** Third width on desktop, full on mobile */
101
+ readonly thirdDesktop: '(max-width: 768px) 100vw, 33.33vw';
102
+ /** Quarter width on desktop, half on tablet, full on mobile */
103
+ readonly quarterDesktop: '(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw';
104
+ /** Content width (centered with max-width) */
105
+ readonly contentWidth: '(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px';
106
+ };
64
107
  /**
65
108
  * Build an image URL with transformation parameters
66
109
  *
@@ -74,7 +117,10 @@ export declare function buildImageUrl(src: string, params?: ImageParams): string
74
117
  /**
75
118
  * Parse image parameters from a URL
76
119
  */
77
- export declare function parseImageUrl(url: string): { src: string; params: ImageParams };
120
+ export declare function parseImageUrl(url: string): {
121
+ src: string;
122
+ params: ImageParams;
123
+ };
78
124
  /**
79
125
  * Generate complete srcset data for all formats
80
126
  *
@@ -109,52 +155,3 @@ export declare function getFormatExtension(format: ImageFormat): string;
109
155
  * Detect image format from file extension or URL
110
156
  */
111
157
  export declare function detectFormat(src: string): ImageFormat | undefined;
112
- /**
113
- * Default breakpoint widths for responsive images
114
- * @defaultValue `[320, 480, 640, 768, 1024, 1280, 1536, 1920, 2560]`
115
- */
116
- export declare const DEFAULT_WIDTHS: number[];
117
- /**
118
- * Default DPR values for fixed-width images
119
- * @defaultValue `[1, 1.5, 2, 3]`
120
- */
121
- export declare const DEFAULT_DPR_VALUES: number[];
122
- /**
123
- * Default output formats in order of preference
124
- */
125
- export declare const DEFAULT_FORMATS: ImageFormat[];
126
- /**
127
- * MIME types for each format
128
- */
129
- export declare const MIME_TYPES: {
130
- avif: 'image/avif';
131
- webp: 'image/webp';
132
- jpeg: 'image/jpeg';
133
- png: 'image/png';
134
- gif: 'image/gif'
135
- };
136
- /**
137
- * File extensions for each format
138
- */
139
- export declare const FORMAT_EXTENSIONS: {
140
- avif: 'avif';
141
- webp: 'webp';
142
- jpeg: 'jpg';
143
- png: 'png';
144
- gif: 'gif'
145
- };
146
- /**
147
- * Common responsive sizes patterns
148
- */
149
- export declare const COMMON_SIZES: {
150
- /** Full width on all screens */
151
- fullWidth: '100vw';
152
- /** Half width on desktop, full on mobile */
153
- halfDesktop: '(max-width: 768px) 100vw, 50vw';
154
- /** Third width on desktop, full on mobile */
155
- thirdDesktop: '(max-width: 768px) 100vw, 33.33vw';
156
- /** Quarter width on desktop, half on tablet, full on mobile */
157
- quarterDesktop: '(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw';
158
- /** Content width (centered with max-width) */
159
- contentWidth: '(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px'
160
- };
@@ -1,3 +1,48 @@
1
+ /**
2
+ * STX Media - Shared Cache Implementation
3
+ *
4
+ * Provides disk and memory caching for processed media assets.
5
+ *
6
+ * @module media/shared/cache
7
+ */
8
+ /**
9
+ * Cache entry metadata
10
+ */
11
+ export interface CacheEntry<T = unknown> {
12
+ /** Cache key */
13
+ key: string;
14
+ /** Source file path */
15
+ src: string;
16
+ /** Source file hash */
17
+ srcHash: string;
18
+ /** Source file mtime */
19
+ srcMtime: number;
20
+ /** Options hash */
21
+ optionsHash: string;
22
+ /** Cached data */
23
+ data: T;
24
+ /** When this entry was created */
25
+ createdAt: number;
26
+ /** When this entry was last accessed */
27
+ lastAccessedAt: number;
28
+ }
29
+ /**
30
+ * Cache configuration
31
+ */
32
+ export interface CacheConfig {
33
+ /** Enable caching */
34
+ enabled: boolean;
35
+ /** Cache directory */
36
+ directory: string;
37
+ /** Max cache age in days */
38
+ maxAge: number;
39
+ /** Max cache size in MB */
40
+ maxSize: number;
41
+ }
42
+ /**
43
+ * Default cache configuration
44
+ */
45
+ export declare const defaultCacheConfig: CacheConfig;
1
46
  /**
2
47
  * Get item from cache
3
48
  */
@@ -9,7 +54,6 @@ export declare function setCached<T>(src: string, options: Record<string, unknow
9
54
  /**
10
55
  * Clear cache for a specific source
11
56
  */
12
- // eslint-disable-next-line pickier/no-unused-vars
13
57
  export declare function clearCacheForSource(src: string, type: 'image' | 'video', config?: CacheConfig): Promise<void>;
14
58
  /**
15
59
  * Clear entire cache
@@ -18,39 +62,15 @@ export declare function clearCache(type: 'image' | 'video' | 'all', config?: Cac
18
62
  /**
19
63
  * Get cache statistics
20
64
  */
21
- // eslint-disable-next-line pickier/no-unused-vars
22
65
  export declare function getCacheStats(config?: CacheConfig): Promise<{
23
- memoryEntries: number
24
- diskEntries: { image: number; video: number }
25
- totalSizeMB: number
66
+ memoryEntries: number;
67
+ diskEntries: {
68
+ image: number;
69
+ video: number;
70
+ };
71
+ totalSizeMB: number;
26
72
  }>;
27
73
  /**
28
74
  * Prune old cache entries
29
75
  */
30
76
  export declare function pruneCache(config?: CacheConfig): Promise<number>;
31
- /**
32
- * Default cache configuration
33
- */
34
- export declare const defaultCacheConfig: CacheConfig;
35
- /**
36
- * Cache entry metadata
37
- */
38
- export declare interface CacheEntry<T = unknown> {
39
- key: string
40
- src: string
41
- srcHash: string
42
- srcMtime: number
43
- optionsHash: string
44
- data: T
45
- createdAt: number
46
- lastAccessedAt: number
47
- }
48
- /**
49
- * Cache configuration
50
- */
51
- export declare interface CacheConfig {
52
- enabled: boolean
53
- directory: string
54
- maxAge: number
55
- maxSize: number
56
- }
@@ -1,3 +1,10 @@
1
+ /**
2
+ * STX Media - Content Hashing Utilities
3
+ *
4
+ * Provides content hashing for cache invalidation.
5
+ *
6
+ * @module media/shared/hash
7
+ */
1
8
  /**
2
9
  * Generate SHA-256 hash of file content
3
10
  */