@aphexcms/cms-core 9.10.0 → 10.0.0

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 (297) hide show
  1. package/dist/api/assets.d.ts +62 -7
  2. package/dist/api/assets.d.ts.map +1 -1
  3. package/dist/api/assets.js +116 -9
  4. package/dist/api/client.d.ts +1 -1
  5. package/dist/api/client.d.ts.map +1 -1
  6. package/dist/api/client.js +39 -9
  7. package/dist/api/limits.d.ts +55 -0
  8. package/dist/api/limits.d.ts.map +1 -0
  9. package/dist/api/limits.js +58 -0
  10. package/dist/api/schemas/assets.d.ts +94 -4
  11. package/dist/api/schemas/assets.d.ts.map +1 -1
  12. package/dist/api/schemas/assets.js +82 -5
  13. package/dist/api/types.d.ts +25 -0
  14. package/dist/api/types.d.ts.map +1 -1
  15. package/dist/api/upload-timeout.d.ts +17 -0
  16. package/dist/api/upload-timeout.d.ts.map +1 -0
  17. package/dist/api/upload-timeout.js +35 -0
  18. package/dist/api/upload.d.ts +42 -0
  19. package/dist/api/upload.d.ts.map +1 -0
  20. package/dist/api/upload.js +144 -0
  21. package/dist/components/AdminApp.svelte +130 -26
  22. package/dist/components/AdminApp.svelte.d.ts.map +1 -1
  23. package/dist/components/admin/AssetBrowserModal.svelte +4 -3
  24. package/dist/components/admin/AssetBrowserModal.svelte.d.ts +2 -1
  25. package/dist/components/admin/AssetBrowserModal.svelte.d.ts.map +1 -1
  26. package/dist/components/admin/MediaBrowser.svelte +1859 -281
  27. package/dist/components/admin/MediaBrowser.svelte.d.ts +21 -1
  28. package/dist/components/admin/MediaBrowser.svelte.d.ts.map +1 -1
  29. package/dist/components/admin/fields/ArrayField.svelte +21 -10
  30. package/dist/components/admin/fields/ArrayField.svelte.d.ts.map +1 -1
  31. package/dist/components/admin/fields/FileField.svelte +9 -2
  32. package/dist/components/admin/fields/FileField.svelte.d.ts.map +1 -1
  33. package/dist/components/admin/fields/ImageField.svelte +47 -12
  34. package/dist/components/admin/fields/ImageField.svelte.d.ts.map +1 -1
  35. package/dist/config.d.ts.map +1 -1
  36. package/dist/config.js +14 -0
  37. package/dist/db/interfaces/asset.d.ts +114 -5
  38. package/dist/db/interfaces/asset.d.ts.map +1 -1
  39. package/dist/db/interfaces/document.d.ts +98 -3
  40. package/dist/db/interfaces/document.d.ts.map +1 -1
  41. package/dist/hooks.d.ts.map +1 -1
  42. package/dist/hooks.js +2 -1
  43. package/dist/image/Image.svelte +72 -0
  44. package/dist/image/Image.svelte.d.ts +40 -0
  45. package/dist/image/Image.svelte.d.ts.map +1 -0
  46. package/dist/image/index.d.ts +3 -0
  47. package/dist/image/index.d.ts.map +1 -0
  48. package/dist/image/index.js +11 -0
  49. package/dist/image/types.d.ts +28 -0
  50. package/dist/image/types.d.ts.map +1 -0
  51. package/dist/image/types.js +1 -0
  52. package/dist/images/generate.d.ts +55 -0
  53. package/dist/images/generate.d.ts.map +1 -0
  54. package/dist/images/generate.js +243 -0
  55. package/dist/images/index.d.ts +2 -0
  56. package/dist/images/index.d.ts.map +1 -0
  57. package/dist/images/index.js +7 -0
  58. package/dist/images/variants.d.ts +82 -0
  59. package/dist/images/variants.d.ts.map +1 -0
  60. package/dist/images/variants.js +124 -0
  61. package/dist/jobs/asset-reference-jobs.d.ts +49 -0
  62. package/dist/jobs/asset-reference-jobs.d.ts.map +1 -0
  63. package/dist/jobs/asset-reference-jobs.js +74 -0
  64. package/dist/jobs/run-batch.d.ts.map +1 -1
  65. package/dist/jobs/run-batch.js +5 -0
  66. package/dist/lib/api/assets.d.ts +62 -7
  67. package/dist/lib/api/assets.d.ts.map +1 -1
  68. package/dist/lib/api/assets.js +116 -9
  69. package/dist/lib/api/assets.js.map +1 -1
  70. package/dist/lib/api/client.d.ts +1 -1
  71. package/dist/lib/api/client.d.ts.map +1 -1
  72. package/dist/lib/api/client.js +39 -9
  73. package/dist/lib/api/client.js.map +1 -1
  74. package/dist/lib/api/limits.d.ts +55 -0
  75. package/dist/lib/api/limits.d.ts.map +1 -0
  76. package/dist/lib/api/limits.js +59 -0
  77. package/dist/lib/api/limits.js.map +1 -0
  78. package/dist/lib/api/schemas/assets.d.ts +94 -4
  79. package/dist/lib/api/schemas/assets.d.ts.map +1 -1
  80. package/dist/lib/api/schemas/assets.js +82 -5
  81. package/dist/lib/api/schemas/assets.js.map +1 -1
  82. package/dist/lib/api/types.d.ts +25 -0
  83. package/dist/lib/api/types.d.ts.map +1 -1
  84. package/dist/lib/api/upload-timeout.d.ts +17 -0
  85. package/dist/lib/api/upload-timeout.d.ts.map +1 -0
  86. package/dist/lib/api/upload-timeout.js +36 -0
  87. package/dist/lib/api/upload-timeout.js.map +1 -0
  88. package/dist/lib/api/upload.d.ts +42 -0
  89. package/dist/lib/api/upload.d.ts.map +1 -0
  90. package/dist/lib/api/upload.js +145 -0
  91. package/dist/lib/api/upload.js.map +1 -0
  92. package/dist/lib/config.d.ts.map +1 -1
  93. package/dist/lib/config.js +14 -0
  94. package/dist/lib/config.js.map +1 -1
  95. package/dist/lib/db/interfaces/asset.d.ts +114 -5
  96. package/dist/lib/db/interfaces/asset.d.ts.map +1 -1
  97. package/dist/lib/db/interfaces/document.d.ts +98 -3
  98. package/dist/lib/db/interfaces/document.d.ts.map +1 -1
  99. package/dist/lib/hooks.d.ts.map +1 -1
  100. package/dist/lib/hooks.js +2 -1
  101. package/dist/lib/hooks.js.map +1 -1
  102. package/dist/lib/image/index.d.ts +3 -0
  103. package/dist/lib/image/index.d.ts.map +1 -0
  104. package/dist/lib/image/index.js +12 -0
  105. package/dist/lib/image/index.js.map +1 -0
  106. package/dist/lib/image/types.d.ts +28 -0
  107. package/dist/lib/image/types.d.ts.map +1 -0
  108. package/dist/lib/image/types.js +2 -0
  109. package/dist/lib/image/types.js.map +1 -0
  110. package/dist/lib/images/generate.d.ts +55 -0
  111. package/dist/lib/images/generate.d.ts.map +1 -0
  112. package/dist/lib/images/generate.js +244 -0
  113. package/dist/lib/images/generate.js.map +1 -0
  114. package/dist/lib/images/index.d.ts +2 -0
  115. package/dist/lib/images/index.d.ts.map +1 -0
  116. package/dist/lib/images/index.js +8 -0
  117. package/dist/lib/images/index.js.map +1 -0
  118. package/dist/lib/images/variants.d.ts +82 -0
  119. package/dist/lib/images/variants.d.ts.map +1 -0
  120. package/dist/lib/images/variants.js +125 -0
  121. package/dist/lib/images/variants.js.map +1 -0
  122. package/dist/lib/jobs/asset-reference-jobs.d.ts +49 -0
  123. package/dist/lib/jobs/asset-reference-jobs.d.ts.map +1 -0
  124. package/dist/lib/jobs/asset-reference-jobs.js +75 -0
  125. package/dist/lib/jobs/asset-reference-jobs.js.map +1 -0
  126. package/dist/lib/jobs/run-batch.d.ts.map +1 -1
  127. package/dist/lib/jobs/run-batch.js +5 -0
  128. package/dist/lib/jobs/run-batch.js.map +1 -1
  129. package/dist/lib/local-api/collection-api.d.ts +19 -2
  130. package/dist/lib/local-api/collection-api.d.ts.map +1 -1
  131. package/dist/lib/local-api/collection-api.js +65 -17
  132. package/dist/lib/local-api/collection-api.js.map +1 -1
  133. package/dist/lib/preview/assets.d.ts +19 -0
  134. package/dist/lib/preview/assets.d.ts.map +1 -1
  135. package/dist/lib/preview/assets.js +6 -0
  136. package/dist/lib/preview/assets.js.map +1 -1
  137. package/dist/lib/routes/assets-cdn.d.ts +19 -0
  138. package/dist/lib/routes/assets-cdn.d.ts.map +1 -1
  139. package/dist/lib/routes/assets-cdn.js +295 -17
  140. package/dist/lib/routes/assets-cdn.js.map +1 -1
  141. package/dist/lib/server/api/index.d.ts.map +1 -1
  142. package/dist/lib/server/api/index.js +87 -8
  143. package/dist/lib/server/api/index.js.map +1 -1
  144. package/dist/lib/server/api/routes/assets-bulk.d.ts.map +1 -1
  145. package/dist/lib/server/api/routes/assets-bulk.js +36 -7
  146. package/dist/lib/server/api/routes/assets-bulk.js.map +1 -1
  147. package/dist/lib/server/api/routes/assets-by-id.d.ts.map +1 -1
  148. package/dist/lib/server/api/routes/assets-by-id.js +32 -15
  149. package/dist/lib/server/api/routes/assets-by-id.js.map +1 -1
  150. package/dist/lib/server/api/routes/assets-direct-upload.d.ts +4 -0
  151. package/dist/lib/server/api/routes/assets-direct-upload.d.ts.map +1 -0
  152. package/dist/lib/server/api/routes/assets-direct-upload.js +164 -0
  153. package/dist/lib/server/api/routes/assets-direct-upload.js.map +1 -0
  154. package/dist/lib/server/api/routes/assets-poster.d.ts +4 -0
  155. package/dist/lib/server/api/routes/assets-poster.d.ts.map +1 -0
  156. package/dist/lib/server/api/routes/assets-poster.js +120 -0
  157. package/dist/lib/server/api/routes/assets-poster.js.map +1 -0
  158. package/dist/lib/server/api/routes/assets-references.d.ts.map +1 -1
  159. package/dist/lib/server/api/routes/assets-references.js +64 -5
  160. package/dist/lib/server/api/routes/assets-references.js.map +1 -1
  161. package/dist/lib/server/api/routes/assets.d.ts.map +1 -1
  162. package/dist/lib/server/api/routes/assets.js +116 -12
  163. package/dist/lib/server/api/routes/assets.js.map +1 -1
  164. package/dist/lib/server/api/routes/clear-asset-references.d.ts +18 -0
  165. package/dist/lib/server/api/routes/clear-asset-references.d.ts.map +1 -0
  166. package/dist/lib/server/api/routes/clear-asset-references.js +32 -0
  167. package/dist/lib/server/api/routes/clear-asset-references.js.map +1 -0
  168. package/dist/lib/server/api/routes/documents.d.ts.map +1 -1
  169. package/dist/lib/server/api/routes/documents.js +27 -1
  170. package/dist/lib/server/api/routes/documents.js.map +1 -1
  171. package/dist/lib/server/index.d.ts +2 -0
  172. package/dist/lib/server/index.d.ts.map +1 -1
  173. package/dist/lib/server/index.js +4 -0
  174. package/dist/lib/server/index.js.map +1 -1
  175. package/dist/lib/services/asset-references-service.d.ts +93 -0
  176. package/dist/lib/services/asset-references-service.d.ts.map +1 -0
  177. package/dist/lib/services/asset-references-service.js +198 -0
  178. package/dist/lib/services/asset-references-service.js.map +1 -0
  179. package/dist/lib/services/asset-service.d.ts +115 -14
  180. package/dist/lib/services/asset-service.d.ts.map +1 -1
  181. package/dist/lib/services/asset-service.js +312 -31
  182. package/dist/lib/services/asset-service.js.map +1 -1
  183. package/dist/lib/services/references-service.d.ts +19 -15
  184. package/dist/lib/services/references-service.d.ts.map +1 -1
  185. package/dist/lib/services/references-service.js +59 -31
  186. package/dist/lib/services/references-service.js.map +1 -1
  187. package/dist/lib/services/version-service.d.ts +10 -1
  188. package/dist/lib/services/version-service.d.ts.map +1 -1
  189. package/dist/lib/services/version-service.js +26 -4
  190. package/dist/lib/services/version-service.js.map +1 -1
  191. package/dist/lib/storage/adapters/local-storage-adapter.d.ts +38 -0
  192. package/dist/lib/storage/adapters/local-storage-adapter.d.ts.map +1 -1
  193. package/dist/lib/storage/adapters/local-storage-adapter.js +86 -19
  194. package/dist/lib/storage/adapters/local-storage-adapter.js.map +1 -1
  195. package/dist/lib/storage/index.d.ts +1 -0
  196. package/dist/lib/storage/index.d.ts.map +1 -1
  197. package/dist/lib/storage/index.js +2 -0
  198. package/dist/lib/storage/index.js.map +1 -1
  199. package/dist/lib/storage/interfaces/storage.d.ts +135 -5
  200. package/dist/lib/storage/interfaces/storage.d.ts.map +1 -1
  201. package/dist/lib/storage/keys.d.ts +96 -0
  202. package/dist/lib/storage/keys.d.ts.map +1 -0
  203. package/dist/lib/storage/keys.js +160 -0
  204. package/dist/lib/storage/keys.js.map +1 -0
  205. package/dist/lib/types/asset.d.ts +92 -12
  206. package/dist/lib/types/asset.d.ts.map +1 -1
  207. package/dist/lib/types/capabilities.d.ts +11 -0
  208. package/dist/lib/types/capabilities.d.ts.map +1 -1
  209. package/dist/lib/types/capabilities.js +20 -6
  210. package/dist/lib/types/capabilities.js.map +1 -1
  211. package/dist/lib/types/config.d.ts +127 -0
  212. package/dist/lib/types/config.d.ts.map +1 -1
  213. package/dist/lib/utils/asset-reference-walk.d.ts +44 -0
  214. package/dist/lib/utils/asset-reference-walk.d.ts.map +1 -0
  215. package/dist/lib/utils/asset-reference-walk.js +144 -0
  216. package/dist/lib/utils/asset-reference-walk.js.map +1 -0
  217. package/dist/lib/utils/image-url.d.ts +61 -26
  218. package/dist/lib/utils/image-url.d.ts.map +1 -1
  219. package/dist/lib/utils/image-url.js +143 -26
  220. package/dist/lib/utils/image-url.js.map +1 -1
  221. package/dist/lib/utils/video-metadata.d.ts +39 -0
  222. package/dist/lib/utils/video-metadata.d.ts.map +1 -0
  223. package/dist/lib/utils/video-metadata.js +161 -0
  224. package/dist/lib/utils/video-metadata.js.map +1 -0
  225. package/dist/local-api/collection-api.d.ts +19 -2
  226. package/dist/local-api/collection-api.d.ts.map +1 -1
  227. package/dist/local-api/collection-api.js +65 -17
  228. package/dist/preview/assets.d.ts +19 -0
  229. package/dist/preview/assets.d.ts.map +1 -1
  230. package/dist/preview/assets.js +6 -0
  231. package/dist/routes/assets-cdn.d.ts +19 -0
  232. package/dist/routes/assets-cdn.d.ts.map +1 -1
  233. package/dist/routes/assets-cdn.js +295 -17
  234. package/dist/server/api/index.d.ts.map +1 -1
  235. package/dist/server/api/index.js +87 -8
  236. package/dist/server/api/routes/assets-bulk.d.ts.map +1 -1
  237. package/dist/server/api/routes/assets-bulk.js +36 -7
  238. package/dist/server/api/routes/assets-by-id.d.ts.map +1 -1
  239. package/dist/server/api/routes/assets-by-id.js +32 -15
  240. package/dist/server/api/routes/assets-direct-upload.d.ts +4 -0
  241. package/dist/server/api/routes/assets-direct-upload.d.ts.map +1 -0
  242. package/dist/server/api/routes/assets-direct-upload.js +163 -0
  243. package/dist/server/api/routes/assets-poster.d.ts +4 -0
  244. package/dist/server/api/routes/assets-poster.d.ts.map +1 -0
  245. package/dist/server/api/routes/assets-poster.js +119 -0
  246. package/dist/server/api/routes/assets-references.d.ts.map +1 -1
  247. package/dist/server/api/routes/assets-references.js +64 -5
  248. package/dist/server/api/routes/assets.d.ts.map +1 -1
  249. package/dist/server/api/routes/assets.js +116 -12
  250. package/dist/server/api/routes/clear-asset-references.d.ts +18 -0
  251. package/dist/server/api/routes/clear-asset-references.d.ts.map +1 -0
  252. package/dist/server/api/routes/clear-asset-references.js +31 -0
  253. package/dist/server/api/routes/documents.d.ts.map +1 -1
  254. package/dist/server/api/routes/documents.js +27 -1
  255. package/dist/server/index.d.ts +2 -0
  256. package/dist/server/index.d.ts.map +1 -1
  257. package/dist/server/index.js +4 -0
  258. package/dist/services/asset-references-service.d.ts +93 -0
  259. package/dist/services/asset-references-service.d.ts.map +1 -0
  260. package/dist/services/asset-references-service.js +197 -0
  261. package/dist/services/asset-service.d.ts +115 -14
  262. package/dist/services/asset-service.d.ts.map +1 -1
  263. package/dist/services/asset-service.js +312 -31
  264. package/dist/services/references-service.d.ts +19 -15
  265. package/dist/services/references-service.d.ts.map +1 -1
  266. package/dist/services/references-service.js +59 -31
  267. package/dist/services/version-service.d.ts +10 -1
  268. package/dist/services/version-service.d.ts.map +1 -1
  269. package/dist/services/version-service.js +26 -4
  270. package/dist/storage/adapters/local-storage-adapter.d.ts +38 -0
  271. package/dist/storage/adapters/local-storage-adapter.d.ts.map +1 -1
  272. package/dist/storage/adapters/local-storage-adapter.js +86 -19
  273. package/dist/storage/index.d.ts +1 -0
  274. package/dist/storage/index.d.ts.map +1 -1
  275. package/dist/storage/index.js +2 -0
  276. package/dist/storage/interfaces/storage.d.ts +135 -5
  277. package/dist/storage/interfaces/storage.d.ts.map +1 -1
  278. package/dist/storage/keys.d.ts +96 -0
  279. package/dist/storage/keys.d.ts.map +1 -0
  280. package/dist/storage/keys.js +159 -0
  281. package/dist/types/asset.d.ts +92 -12
  282. package/dist/types/asset.d.ts.map +1 -1
  283. package/dist/types/capabilities.d.ts +11 -0
  284. package/dist/types/capabilities.d.ts.map +1 -1
  285. package/dist/types/capabilities.js +20 -6
  286. package/dist/types/config.d.ts +127 -0
  287. package/dist/types/config.d.ts.map +1 -1
  288. package/dist/utils/asset-reference-walk.d.ts +44 -0
  289. package/dist/utils/asset-reference-walk.d.ts.map +1 -0
  290. package/dist/utils/asset-reference-walk.js +143 -0
  291. package/dist/utils/image-url.d.ts +61 -26
  292. package/dist/utils/image-url.d.ts.map +1 -1
  293. package/dist/utils/image-url.js +143 -26
  294. package/dist/utils/video-metadata.d.ts +39 -0
  295. package/dist/utils/video-metadata.d.ts.map +1 -0
  296. package/dist/utils/video-metadata.js +160 -0
  297. package/package.json +6 -1
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import type { ImageValue } from './types';
3
+
4
+ /**
5
+ * Renders an Aphex image field as a single responsive `<img>`.
6
+ *
7
+ * Everything it needs — url, dimensions, srcset, default alt — is injected
8
+ * server-side by `assetService.injectAssetUrls`, so this component holds no
9
+ * knowledge of the width ladder, the config hash, or how a variant URL is
10
+ * built. That keeps one place responsible for addressing derivatives and
11
+ * ships nothing extra to the browser.
12
+ *
13
+ * Renders nothing at all when the value has no resolved url, rather than an
14
+ * `<img>` with an empty `src` — which browsers treat as a request for the
15
+ * current page and is a real, if quiet, waste of a round trip.
16
+ */
17
+ interface Props {
18
+ /** An image field value, after asset injection. */
19
+ value: ImageValue | null | undefined;
20
+ /**
21
+ * Overrides the alt text. Precedence is placement → asset → empty, so a
22
+ * decorative placement can pass `alt=""` and mean it.
23
+ */
24
+ alt?: string;
25
+ /**
26
+ * The `sizes` attribute. Without it a browser assumes the image occupies
27
+ * the full viewport width and will happily pick the largest candidate on
28
+ * a phone, which defeats the point of a srcset.
29
+ */
30
+ sizes?: string;
31
+ /**
32
+ * Above-the-fold hint. Switches off lazy loading and raises fetch
33
+ * priority — correct for an LCP image, wasteful for anything else.
34
+ */
35
+ priority?: boolean;
36
+ class?: string;
37
+ [key: string]: unknown;
38
+ }
39
+
40
+ let {
41
+ value,
42
+ alt,
43
+ sizes = '100vw',
44
+ priority = false,
45
+ class: className,
46
+ ...rest
47
+ }: Props = $props();
48
+
49
+ const asset = $derived(value?.asset);
50
+ const src = $derived(asset?.url);
51
+
52
+ // Placement alt wins over the asset's default; an explicitly empty string is
53
+ // preserved, since `alt=""` is the correct markup for a decorative image and
54
+ // is meaningfully different from a missing alt.
55
+ const resolvedAlt = $derived(alt ?? value?.alt ?? asset?.alt ?? '');
56
+ </script>
57
+
58
+ {#if src}
59
+ <img
60
+ {src}
61
+ alt={resolvedAlt}
62
+ srcset={asset?.srcset || undefined}
63
+ sizes={asset?.srcset ? sizes : undefined}
64
+ width={asset?.width || undefined}
65
+ height={asset?.height || undefined}
66
+ loading={priority ? 'eager' : 'lazy'}
67
+ fetchpriority={priority ? 'high' : undefined}
68
+ decoding="async"
69
+ class={className || undefined}
70
+ {...rest}
71
+ />
72
+ {/if}
@@ -0,0 +1,40 @@
1
+ import type { ImageValue } from './types.js';
2
+ /**
3
+ * Renders an Aphex image field as a single responsive `<img>`.
4
+ *
5
+ * Everything it needs — url, dimensions, srcset, default alt — is injected
6
+ * server-side by `assetService.injectAssetUrls`, so this component holds no
7
+ * knowledge of the width ladder, the config hash, or how a variant URL is
8
+ * built. That keeps one place responsible for addressing derivatives and
9
+ * ships nothing extra to the browser.
10
+ *
11
+ * Renders nothing at all when the value has no resolved url, rather than an
12
+ * `<img>` with an empty `src` — which browsers treat as a request for the
13
+ * current page and is a real, if quiet, waste of a round trip.
14
+ */
15
+ interface Props {
16
+ /** An image field value, after asset injection. */
17
+ value: ImageValue | null | undefined;
18
+ /**
19
+ * Overrides the alt text. Precedence is placement → asset → empty, so a
20
+ * decorative placement can pass `alt=""` and mean it.
21
+ */
22
+ alt?: string;
23
+ /**
24
+ * The `sizes` attribute. Without it a browser assumes the image occupies
25
+ * the full viewport width and will happily pick the largest candidate on
26
+ * a phone, which defeats the point of a srcset.
27
+ */
28
+ sizes?: string;
29
+ /**
30
+ * Above-the-fold hint. Switches off lazy loading and raises fetch
31
+ * priority — correct for an LCP image, wasteful for anything else.
32
+ */
33
+ priority?: boolean;
34
+ class?: string;
35
+ [key: string]: unknown;
36
+ }
37
+ declare const Image: import("svelte").Component<Props, {}, "">;
38
+ type Image = ReturnType<typeof Image>;
39
+ export default Image;
40
+ //# sourceMappingURL=Image.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/image/Image.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGzC;;;;;;;;;;;;GAYG;AACH,UAAU,KAAK;IACd,mDAAmD;IACnD,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AA6BF,QAAA,MAAM,KAAK,2CAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Image } from './Image.svelte';
2
+ export type { ImageValue, InjectedAsset } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/image/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ // `@aphexcms/cms-core/image` — the public rendering surface.
2
+ //
3
+ // Its own narrow entrypoint on purpose. A marketing page importing `<Image>`
4
+ // must not pull in the admin barrel and its TipTap/field-editor chunk, which is
5
+ // exactly what a shared barrel would cause: Rollup's unit is the chunk, not the
6
+ // symbol.
7
+ //
8
+ // It lives here rather than in `@aphexcms/ui` because that package is the
9
+ // shadcn design system and knows nothing about assets — putting an
10
+ // Asset-shaped component there would invert the dependency.
11
+ export { default as Image } from './Image.svelte';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The shape `<Image>` consumes: an image field value after asset injection.
3
+ *
4
+ * Declared here rather than imported from the admin types so this entrypoint
5
+ * stays free of anything server- or admin-shaped — it is imported by public
6
+ * marketing pages, and a stray import is how a barrel drags the admin bundle
7
+ * onto them. The dependency runs the other way instead: `types/asset.ts` builds
8
+ * its `ImageAsset` on top of {@link InjectedAsset}, so the set of fields
9
+ * injection produces is declared exactly once and a document's own type can't
10
+ * disagree with what `<Image>` reads off it.
11
+ */
12
+ export interface InjectedAsset {
13
+ _ref?: string;
14
+ /** Populated by `injectAssetUrls`; absent means the ref didn't resolve. */
15
+ url?: string;
16
+ /** The asset's own default alt, shared across placements. */
17
+ alt?: string;
18
+ width?: number;
19
+ height?: number;
20
+ /** Pre-built responsive candidates. Absent when the pipeline is off. */
21
+ srcset?: string;
22
+ }
23
+ export interface ImageValue {
24
+ asset?: InjectedAsset;
25
+ /** Per-placement alt override, which takes precedence over the asset's. */
26
+ alt?: string;
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/image/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IAC1B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ import type { Asset, AssetVariant } from '../types/asset.js';
2
+ import type { StorageAdapter } from '../storage/interfaces/storage.js';
3
+ import type { DatabaseAdapter } from '../db/interfaces/index.js';
4
+ import { type ImageConfig } from './variants.js';
5
+ /**
6
+ * Set how many derivatives may be produced at once.
7
+ *
8
+ * Unlike the upload timeout, this earns being configurable: it encodes a real
9
+ * decision — how much memory this deployment is willing to spend on image
10
+ * processing — and the right answer genuinely differs between a 512MB VPS and a
11
+ * 4GB function. Applied process-wide because the constraint is the process's
12
+ * memory, not any one request's.
13
+ */
14
+ export declare function setGenerationConcurrency(limit: number): void;
15
+ /** Thrown when the queue is saturated. The caller serves the original instead. */
16
+ export declare class GenerationBusyError extends Error {
17
+ constructor();
18
+ }
19
+ /**
20
+ * Thrown for a source whose animation would be destroyed by resizing.
21
+ *
22
+ * Sharp reads only the first frame unless told otherwise, so an animated GIF
23
+ * run through this pipeline comes out as a single still — the image still
24
+ * "works", which is what makes it dangerous: nothing errors, the animation is
25
+ * just silently gone.
26
+ *
27
+ * Preserving it is possible (`animated: true` out to an animated WebP) and
28
+ * deliberately not done here, because the memory cost is unbounded in the one
29
+ * dimension nothing else caps: a decoded animation is frames × width × height ×
30
+ * 4, so a couple of hundred frames at 800×600 is well over a gigabyte. That is
31
+ * exactly the out-of-memory case the concurrency gate exists to prevent, and no
32
+ * per-image pixel limit catches it. Animated sources are served as-is instead.
33
+ */
34
+ export declare class AnimatedSourceError extends Error {
35
+ constructor(pages: number);
36
+ }
37
+ export interface GeneratedVariant {
38
+ variant: AssetVariant;
39
+ buffer: Buffer;
40
+ }
41
+ /**
42
+ * Produce (or await) the derivative of `asset` at `width`.
43
+ *
44
+ * Writes the variant to storage and records it on `asset.metadata.variants`
45
+ * before resolving, so the next request is a cache hit.
46
+ */
47
+ export declare function generateVariant(opts: {
48
+ asset: Asset;
49
+ width: number;
50
+ config: ImageConfig;
51
+ configHash: string;
52
+ storage: StorageAdapter;
53
+ database: DatabaseAdapter;
54
+ }): Promise<GeneratedVariant>;
55
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/lib/images/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAkD3D;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI5D;AAaD,kFAAkF;AAClF,qBAAa,mBAAoB,SAAQ,KAAK;;CAK7C;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBACjC,KAAK,EAAE,MAAM;CAIzB;AAqBD,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAU5B"}
@@ -0,0 +1,243 @@
1
+ import sharp from 'sharp';
2
+ import { buildVariantKey, buildVariantUrl, VARIANT_FORMAT } from '../storage/keys.js';
3
+ import { getVariants } from './variants.js';
4
+ import { cmsLogger } from '../utils/logger.js';
5
+ /**
6
+ * Derivative generation. Server-only — imports Sharp.
7
+ *
8
+ * Generation happens on the first request for a width, not at upload. That
9
+ * makes backfill free (an old asset is upgraded simply by being viewed) and
10
+ * means a width nobody asks for is never produced. The cost is that the first
11
+ * request for each (asset, width) pays the resize; every later one is served
12
+ * from storage, and from the CDN after that, because a variant URL embeds the
13
+ * config hash and is therefore immutable.
14
+ */
15
+ /** Matches the upload path's guard — a decompression bomb must not reach libvips. */
16
+ const MAX_INPUT_PIXELS = 100_000_000;
17
+ /**
18
+ * In-flight generations, keyed by storage key.
19
+ *
20
+ * Ten simultaneous requests for the same cold variant would otherwise run ten
21
+ * identical resizes. This collapses them to one within a process.
22
+ *
23
+ * It is explicitly *not* a distributed lock: on serverless, separate instances
24
+ * will still duplicate work. That is acceptable because generation is
25
+ * idempotent — same source, same config, same key, same bytes — so the worst
26
+ * case is wasted CPU, never a corrupt or half-written variant.
27
+ */
28
+ const inFlight = new Map();
29
+ /**
30
+ * Cap on *simultaneous* resizes, which is the thing that actually bounds memory.
31
+ *
32
+ * The single-flight map above only dedupes requests for the same variant. It
33
+ * does nothing for twenty requests across twenty different assets, which is the
34
+ * realistic shape of traffic hitting a cold gallery — and each of those holds a
35
+ * fully decoded bitmap while it works. At `limitInputPixels` a single decode can
36
+ * approach 400MB, so unbounded concurrency is an out-of-memory kill on any
37
+ * modest container, not merely slow.
38
+ *
39
+ * Excess work waits rather than failing: an image arriving a little late is
40
+ * strictly better than a 500, and the wait is bounded by how long a resize
41
+ * takes.
42
+ */
43
+ const DEFAULT_GENERATION_CONCURRENCY = 2;
44
+ let concurrencyLimit = DEFAULT_GENERATION_CONCURRENCY;
45
+ let active = 0;
46
+ const waiting = [];
47
+ /**
48
+ * Set how many derivatives may be produced at once.
49
+ *
50
+ * Unlike the upload timeout, this earns being configurable: it encodes a real
51
+ * decision — how much memory this deployment is willing to spend on image
52
+ * processing — and the right answer genuinely differs between a 512MB VPS and a
53
+ * 4GB function. Applied process-wide because the constraint is the process's
54
+ * memory, not any one request's.
55
+ */
56
+ export function setGenerationConcurrency(limit) {
57
+ if (Number.isFinite(limit) && limit >= 1) {
58
+ concurrencyLimit = Math.floor(limit);
59
+ }
60
+ }
61
+ /**
62
+ * Cap on how many requests may *queue* for a slot.
63
+ *
64
+ * An unbounded wait queue converts a memory problem into a worse one: under a
65
+ * burst, thousands of requests each hold a connection and a decoded-image
66
+ * ambition, and the ones at the back time out having achieved nothing. Beyond
67
+ * this depth generation is refused, and the route falls back to serving the
68
+ * original — heavier bytes, but immediately, and the CDN absorbs the retry.
69
+ */
70
+ const MAX_GENERATION_QUEUE = 32;
71
+ /** Thrown when the queue is saturated. The caller serves the original instead. */
72
+ export class GenerationBusyError extends Error {
73
+ constructor() {
74
+ super('Image generation is at capacity');
75
+ this.name = 'GenerationBusyError';
76
+ }
77
+ }
78
+ /**
79
+ * Thrown for a source whose animation would be destroyed by resizing.
80
+ *
81
+ * Sharp reads only the first frame unless told otherwise, so an animated GIF
82
+ * run through this pipeline comes out as a single still — the image still
83
+ * "works", which is what makes it dangerous: nothing errors, the animation is
84
+ * just silently gone.
85
+ *
86
+ * Preserving it is possible (`animated: true` out to an animated WebP) and
87
+ * deliberately not done here, because the memory cost is unbounded in the one
88
+ * dimension nothing else caps: a decoded animation is frames × width × height ×
89
+ * 4, so a couple of hundred frames at 800×600 is well over a gigabyte. That is
90
+ * exactly the out-of-memory case the concurrency gate exists to prevent, and no
91
+ * per-image pixel limit catches it. Animated sources are served as-is instead.
92
+ */
93
+ export class AnimatedSourceError extends Error {
94
+ constructor(pages) {
95
+ super(`Refusing to flatten an animated source (${pages} frames)`);
96
+ this.name = 'AnimatedSourceError';
97
+ }
98
+ }
99
+ async function acquire() {
100
+ if (active < concurrencyLimit) {
101
+ active++;
102
+ return;
103
+ }
104
+ if (waiting.length >= MAX_GENERATION_QUEUE) {
105
+ throw new GenerationBusyError();
106
+ }
107
+ await new Promise((resolve) => waiting.push(resolve));
108
+ active++;
109
+ }
110
+ function release() {
111
+ active--;
112
+ // Wake exactly one waiter. Waking all would let them race past the limit,
113
+ // which is the bug this whole mechanism exists to prevent.
114
+ waiting.shift()?.();
115
+ }
116
+ /**
117
+ * Produce (or await) the derivative of `asset` at `width`.
118
+ *
119
+ * Writes the variant to storage and records it on `asset.metadata.variants`
120
+ * before resolving, so the next request is a cache hit.
121
+ */
122
+ export async function generateVariant(opts) {
123
+ const { asset, width, configHash } = opts;
124
+ const key = buildVariantKey(asset.id, width, configHash);
125
+ const existing = inFlight.get(key);
126
+ if (existing)
127
+ return existing;
128
+ const work = produce(opts, key).finally(() => inFlight.delete(key));
129
+ inFlight.set(key, work);
130
+ return work;
131
+ }
132
+ async function produce(opts, key) {
133
+ const { asset, width, config, configHash, storage, database } = opts;
134
+ // Acquired around the decode/encode only, and released in `finally` — a
135
+ // thrown resize must not leak the slot, or the pool bleeds capacity until
136
+ // nothing can generate at all. Everything after this point is inside the
137
+ // gate, including the storage read, since holding the source buffer is part
138
+ // of the memory being bounded.
139
+ await acquire();
140
+ try {
141
+ return await resize({ asset, width, config, configHash, storage, database }, key);
142
+ }
143
+ finally {
144
+ release();
145
+ }
146
+ }
147
+ async function resize(opts, key) {
148
+ const { asset, width, config, configHash, storage, database } = opts;
149
+ const source = await storage.getObject(asset.path);
150
+ // Header-only read, so this costs nothing next to the resize. Checked here
151
+ // rather than trusting the row, because assets uploaded before `pages` was
152
+ // recorded have no such field and would otherwise be flattened.
153
+ const sourceMeta = await sharp(source).metadata();
154
+ const pages = sourceMeta.pages ?? 1;
155
+ if (pages > 1)
156
+ throw new AnimatedSourceError(pages);
157
+ // `.rotate()` with no argument applies the EXIF orientation tag. Without it
158
+ // a photo taken in portrait on a phone comes out sideways, because the
159
+ // pixels are landscape and only the tag says otherwise — and Sharp strips
160
+ // metadata by default, so the tag doesn't survive to correct it later.
161
+ //
162
+ // Stripping metadata is also why derivatives carry no EXIF GPS: the privacy
163
+ // win is a side effect of the default, not extra work.
164
+ const pipeline = sharp(source, {
165
+ limitInputPixels: MAX_INPUT_PIXELS,
166
+ // Decode in row order instead of random access. For a downscale — which
167
+ // is all this ever does — libvips can then stream the source rather than
168
+ // holding the whole decoded image, which is the single biggest reduction
169
+ // in peak memory available here.
170
+ sequentialRead: true
171
+ })
172
+ .rotate()
173
+ .resize({
174
+ width,
175
+ // Never scale up. A variant wider than the source is a bigger file
176
+ // that looks no better than the original.
177
+ withoutEnlargement: true,
178
+ fit: 'inside'
179
+ })[VARIANT_FORMAT]({ quality: config.quality });
180
+ const { data, info } = await pipeline.toBuffer({ resolveWithObject: true });
181
+ const stored = await storage.store({
182
+ buffer: data,
183
+ filename: key.split('/').pop() || key,
184
+ mimeType: `image/${VARIANT_FORMAT}`,
185
+ size: data.length,
186
+ key
187
+ });
188
+ const variant = {
189
+ w: info.width,
190
+ h: info.height,
191
+ key: stored.key,
192
+ path: stored.path,
193
+ url: buildVariantUrl(asset.id, width, configHash),
194
+ bytes: data.length
195
+ };
196
+ await recordVariant({ asset, variant, configHash, database });
197
+ return { variant, buffer: data };
198
+ }
199
+ /**
200
+ * Merge one variant into the asset's record.
201
+ *
202
+ * Re-reads the row first because several widths of the same asset can be
203
+ * generated concurrently — writing a record built from the copy this request
204
+ * happened to load would drop whichever sibling finished in between. This is a
205
+ * read-modify-write and still races under true concurrency; the consequence is
206
+ * a lost *record*, not a lost file, and the next request for that width simply
207
+ * regenerates it. A durable fix belongs with the reference index.
208
+ *
209
+ * A failure here is logged, not thrown: the variant exists in storage and can
210
+ * be served, and failing the request because bookkeeping failed would be worse
211
+ * than serving the image and regenerating the record next time.
212
+ */
213
+ async function recordVariant(opts) {
214
+ const { asset, variant, configHash, database } = opts;
215
+ try {
216
+ const fresh = (await database.findAssetById(asset.organizationId, asset.id)) ?? asset;
217
+ const current = getVariants(fresh);
218
+ // A record from a different config is replaced wholesale rather than
219
+ // merged — its entries address keys nothing will ever request again.
220
+ const kept = current && current.config === configHash
221
+ ? current.widths.filter((v) => v.w !== variant.w)
222
+ : [];
223
+ const updated = await database.updateAsset(asset.organizationId, asset.id, {
224
+ metadata: {
225
+ ...fresh.metadata,
226
+ variants: {
227
+ config: configHash,
228
+ generatedAt: new Date().toISOString(),
229
+ widths: [...kept, variant].sort((a, b) => a.w - b.w)
230
+ }
231
+ }
232
+ });
233
+ // Both relational adapters swallow write errors and return null, so a
234
+ // silent failure here would otherwise look like success and the variant
235
+ // would be regenerated on every single request.
236
+ if (!updated) {
237
+ cmsLogger.warn('[Images]', `Variant record not saved for asset ${asset.id} at w${variant.w}; it will be regenerated on the next request`);
238
+ }
239
+ }
240
+ catch (error) {
241
+ cmsLogger.warn('[Images]', `Could not record variant for asset ${asset.id}:`, error);
242
+ }
243
+ }
@@ -0,0 +1,2 @@
1
+ export * from './variants.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/images/index.ts"],"names":[],"mappings":"AAMA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ // Variant reading/selection only — pure, browser-safe, no Sharp.
2
+ //
3
+ // `./generate` is deliberately NOT re-exported here: it imports Sharp, and a
4
+ // barrel that pulled it in would drag a native image library into any chunk
5
+ // that touched this module, including the one `<Image>` ships to the browser.
6
+ // Server callers import it by path.
7
+ export * from './variants.js';
@@ -0,0 +1,82 @@
1
+ import type { Asset, AssetVariant, AssetVariantRecord } from '../types/asset.js';
2
+ /**
3
+ * Reading and selecting image derivatives.
4
+ *
5
+ * Pure functions over an `Asset`, with no Sharp and no storage — so the
6
+ * `<Image>` component can import them in the browser. Generation lives in
7
+ * `./generate.ts`, which is server-only.
8
+ */
9
+ /** The resolved image configuration a request is served under. */
10
+ export interface ImageConfig {
11
+ widths: number[];
12
+ quality: number;
13
+ }
14
+ export declare const DEFAULT_IMAGE_WIDTHS: number[];
15
+ export declare const DEFAULT_IMAGE_QUALITY = 80;
16
+ /**
17
+ * Normalise the user's `images` config, or return null when disabled.
18
+ *
19
+ * Widths are de-duplicated and sorted so that two configs listing the same
20
+ * widths in a different order hash identically — otherwise reordering the array
21
+ * in `aphex.config.ts` would silently orphan every previously generated
22
+ * derivative and regenerate the lot.
23
+ */
24
+ export declare function resolveImageConfig(images: {
25
+ widths: number[];
26
+ quality?: number;
27
+ } | null | undefined): ImageConfig | null;
28
+ /** Hash identifying the config a derivative was generated under. */
29
+ export declare function configHashFor(config: ImageConfig): string;
30
+ /**
31
+ * The variant record for an asset, or null when there isn't a usable one.
32
+ *
33
+ * Validates rather than asserts: `metadata` is JSON that has been through a
34
+ * database and may predate this feature entirely, so a malformed or partial
35
+ * record must read as "no variants" and be regenerated, never crash a page
36
+ * render.
37
+ */
38
+ export declare function getVariants(asset: Pick<Asset, 'metadata'>): AssetVariantRecord | null;
39
+ /**
40
+ * The already-generated derivative for an exact width, under the current config.
41
+ *
42
+ * A record generated under a different config is ignored: every variant URL
43
+ * embeds the config hash, so a stale record's URLs address files that are no
44
+ * longer referenced by anything.
45
+ */
46
+ export declare function pickVariant(asset: Pick<Asset, 'metadata'>, width: number, configHash: string): AssetVariant | null;
47
+ /**
48
+ * The ladder widths worth offering for this asset.
49
+ *
50
+ * Widths at or above the original's own width are dropped — upscaling produces
51
+ * a larger file that looks no better. The original's width is always included
52
+ * as the top rung so a `srcset` still has something to offer above the last
53
+ * useful ladder step.
54
+ */
55
+ /**
56
+ * Build a `srcset` for an asset, listing every ladder width worth offering.
57
+ *
58
+ * The URLs it names may not exist yet — that's the point of generate-on-miss.
59
+ * The browser requests one, `/media` produces it on the spot, and every later
60
+ * request for that width is a cache hit. So a `srcset` is correct the moment an
61
+ * asset is uploaded, with no generation having happened at all.
62
+ */
63
+ export declare function buildSrcset(assetId: string, config: ImageConfig, configHash: string, originalWidth: number | null): string;
64
+ /**
65
+ * Whether derivatives can be produced for this asset at all.
66
+ *
67
+ * Lives here, next to the ladder, because two callers need the same answer: the
68
+ * server building a `srcset` and the admin client picking a thumbnail. A second
69
+ * copy of this rule would drift, and the failure is quiet — a thumbnail URL that
70
+ * falls back to a 14MB original renders perfectly and costs a hundred times what
71
+ * it should.
72
+ */
73
+ export declare function canGenerateVariants(asset: Pick<Asset, 'assetType' | 'mimeType' | 'metadata'>): boolean;
74
+ /**
75
+ * The smallest derivative worth requesting for a thumbnail.
76
+ *
77
+ * A grid tile is a couple of hundred pixels; the bottom rung of the ladder is
78
+ * the right answer for it, and nothing about a tile justifies more.
79
+ */
80
+ export declare function thumbnailWidth(config: ImageConfig, originalWidth: number | null): number;
81
+ export declare function usableWidths(config: ImageConfig, originalWidth: number | null): number[];
82
+ //# sourceMappingURL=variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/lib/images/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAG9E;;;;;;GAMG;AAEH,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,oBAAoB,UAA8B,CAAC;AAChE,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAC/D,WAAW,GAAG,IAAI,CAiBpB;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,kBAAkB,GAAG,IAAI,CAkBrF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAC9B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAChB,YAAY,GAAG,IAAI,CAIrB;AAED;;;;;;;GAOG;AACH;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,CAIR;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC,GACvD,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAExF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAIxF"}