@styleflow.app/flowpress-astro-core 1.0.0-beta.5 → 1.0.0-beta.50

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 (340) hide show
  1. package/CHANGELOG.md +307 -1
  2. package/README.md +121 -6
  3. package/dist/accessibility-panel.d.ts +2 -0
  4. package/dist/accessibility-panel.d.ts.map +1 -0
  5. package/dist/accessibility-panel.js +81 -0
  6. package/dist/accessibility-panel.js.map +1 -0
  7. package/dist/astro/BaseLayout.astro +34 -17
  8. package/dist/astro/CompositionRenderer.astro +170 -0
  9. package/dist/astro/DefaultBlockAdapter.astro +37 -0
  10. package/dist/astro/EditorialMedia.astro +47 -0
  11. package/dist/astro/FontStylesheets.astro +35 -0
  12. package/dist/astro/GutenbergRenderer.astro +270 -84
  13. package/dist/astro/Media.astro +27 -0
  14. package/dist/astro/StyleflowElement.astro +25 -0
  15. package/dist/astro/ThemeRuntime.astro +26 -0
  16. package/dist/astro/blocks/CarouselBlock.astro +72 -101
  17. package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
  18. package/dist/astro/blocks/ColumnBlock.astro +4 -5
  19. package/dist/astro/blocks/CoverBlock.astro +158 -0
  20. package/dist/astro/blocks/FormBlock.astro +23 -20
  21. package/dist/astro/blocks/GridBlock.astro +5 -4
  22. package/dist/astro/blocks/HeroBlock.astro +6 -6
  23. package/dist/astro/blocks/ImageBlock.astro +6 -6
  24. package/dist/astro/blocks/ListItemFallback.astro +9 -7
  25. package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
  26. package/dist/astro/blocks/SemanticElement.astro +35 -0
  27. package/dist/astro/blocks/SiteLogoBlock.astro +54 -0
  28. package/dist/astro/blocks/TextBlock.astro +33 -28
  29. package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
  30. package/dist/astro/blocks/cover.d.ts +13 -0
  31. package/dist/astro/blocks/cover.d.ts.map +1 -0
  32. package/dist/astro/blocks/cover.js +105 -0
  33. package/dist/astro/blocks/cover.js.map +1 -0
  34. package/dist/astro/blocks/cover.ts +119 -0
  35. package/dist/astro/blocks/helpers.d.ts +10 -1
  36. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  37. package/dist/astro/blocks/helpers.js +55 -39
  38. package/dist/astro/blocks/helpers.js.map +1 -1
  39. package/dist/astro/blocks/helpers.ts +69 -44
  40. package/dist/astro/motion/AccordionRuntime.astro +9 -0
  41. package/dist/astro/motion/MotionBoot.astro +21 -0
  42. package/dist/astro/motion/MotionRuntime.astro +31 -0
  43. package/dist/astro/motion/accordion.css +163 -0
  44. package/dist/astro/motion/accordion.d.ts +3 -0
  45. package/dist/astro/motion/accordion.d.ts.map +1 -0
  46. package/dist/astro/motion/accordion.js +98 -0
  47. package/dist/astro/motion/accordion.js.map +1 -0
  48. package/dist/astro/motion/accordion.ts +109 -0
  49. package/dist/astro/motion/motion-controller.d.ts +12 -0
  50. package/dist/astro/motion/motion-controller.d.ts.map +1 -0
  51. package/dist/astro/motion/motion-controller.js +312 -0
  52. package/dist/astro/motion/motion-controller.js.map +1 -0
  53. package/dist/astro/motion/motion-controller.ts +393 -0
  54. package/dist/astro/motion/motion.css +600 -0
  55. package/dist/astro/motion/motion.d.ts +132 -0
  56. package/dist/astro/motion/motion.d.ts.map +1 -0
  57. package/dist/astro/motion/motion.js +265 -0
  58. package/dist/astro/motion/motion.js.map +1 -0
  59. package/dist/astro/motion/motion.ts +430 -0
  60. package/dist/astro/native/AccordionRuntime.astro +11 -0
  61. package/dist/astro/native/Blob.astro +113 -0
  62. package/dist/astro/native/BlobBlock.astro +52 -0
  63. package/dist/astro/native/CustomFieldValue.astro +88 -0
  64. package/dist/astro/native/LevelTag.astro +20 -0
  65. package/dist/astro/native/MapBlock.astro +41 -0
  66. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  67. package/dist/astro/native/NativeIconBlock.astro +42 -0
  68. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  69. package/dist/astro/native/ReservedLogin.astro +107 -0
  70. package/dist/astro/native/ResolvedBlocks.astro +91 -0
  71. package/dist/astro/native/SyncedPatternContent.astro +94 -0
  72. package/dist/astro/native/TermFieldValue.astro +39 -0
  73. package/dist/astro/native/Timeline.astro +22 -0
  74. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  75. package/dist/astro/native/accordion-controller.d.ts +3 -0
  76. package/dist/astro/native/accordion-controller.d.ts.map +1 -0
  77. package/dist/astro/native/accordion-controller.js +143 -0
  78. package/dist/astro/native/accordion-controller.js.map +1 -0
  79. package/dist/astro/native/accordion-controller.ts +108 -0
  80. package/dist/astro/native/accordion.css +36 -0
  81. package/dist/astro/native/accordion.d.ts +24 -0
  82. package/dist/astro/native/accordion.d.ts.map +1 -0
  83. package/dist/astro/native/accordion.js +82 -0
  84. package/dist/astro/native/accordion.js.map +1 -0
  85. package/dist/astro/native/accordion.ts +91 -0
  86. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  87. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  88. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  89. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  90. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  91. package/dist/astro/native/blob/config.d.ts +49 -0
  92. package/dist/astro/native/blob/config.d.ts.map +1 -0
  93. package/dist/astro/native/blob/config.js +86 -0
  94. package/dist/astro/native/blob/config.js.map +1 -0
  95. package/dist/astro/native/blob/config.ts +132 -0
  96. package/dist/astro/native/blob/controller.d.ts +11 -0
  97. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  98. package/dist/astro/native/blob/controller.js +240 -0
  99. package/dist/astro/native/blob/controller.js.map +1 -0
  100. package/dist/astro/native/blob/controller.ts +248 -0
  101. package/dist/astro/native/blob/geometry.d.ts +2 -0
  102. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  103. package/dist/astro/native/blob/geometry.js +2 -0
  104. package/dist/astro/native/blob/geometry.js.map +1 -0
  105. package/dist/astro/native/blob/geometry.ts +1 -0
  106. package/dist/astro/native/blob/ids.d.ts +7 -0
  107. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  108. package/dist/astro/native/blob/ids.js +11 -0
  109. package/dist/astro/native/blob/ids.js.map +1 -0
  110. package/dist/astro/native/blob/ids.ts +11 -0
  111. package/dist/astro/native/blob.css +83 -0
  112. package/dist/astro/native/block-sizing.css +34 -0
  113. package/dist/astro/native/button-template.d.ts +31 -0
  114. package/dist/astro/native/button-template.d.ts.map +1 -0
  115. package/dist/astro/native/button-template.js +54 -0
  116. package/dist/astro/native/button-template.js.map +1 -0
  117. package/dist/astro/native/button-template.ts +92 -0
  118. package/dist/astro/native/button.d.ts +13 -0
  119. package/dist/astro/native/button.d.ts.map +1 -0
  120. package/dist/astro/native/button.js +26 -0
  121. package/dist/astro/native/button.js.map +1 -0
  122. package/dist/astro/native/button.ts +26 -0
  123. package/dist/astro/native/carousel.css +323 -0
  124. package/dist/astro/native/core-accordion-heading.astro +23 -0
  125. package/dist/astro/native/core-accordion-item.astro +8 -0
  126. package/dist/astro/native/core-accordion-panel.astro +8 -0
  127. package/dist/astro/native/core-accordion.astro +8 -0
  128. package/dist/astro/native/core-block.astro +18 -0
  129. package/dist/astro/native/core-button-fallback.astro +43 -0
  130. package/dist/astro/native/core-button.astro +65 -0
  131. package/dist/astro/native/core-buttons.astro +14 -0
  132. package/dist/astro/native/core-group.astro +25 -0
  133. package/dist/astro/native/core-home-link.astro +12 -0
  134. package/dist/astro/native/core-html.astro +8 -0
  135. package/dist/astro/native/core-icon.astro +7 -0
  136. package/dist/astro/native/core-image.astro +136 -0
  137. package/dist/astro/native/core-navigation-link.astro +71 -0
  138. package/dist/astro/native/core-navigation-submenu.astro +33 -0
  139. package/dist/astro/native/core-navigation.astro +101 -0
  140. package/dist/astro/native/core-page-list-data-item.astro +19 -0
  141. package/dist/astro/native/core-page-list-item.astro +8 -0
  142. package/dist/astro/native/core-page-list.astro +40 -0
  143. package/dist/astro/native/core-post-date.astro +21 -0
  144. package/dist/astro/native/core-post-excerpt.astro +26 -0
  145. package/dist/astro/native/core-post-featured-image.astro +40 -0
  146. package/dist/astro/native/core-post-template-fallback.astro +30 -0
  147. package/dist/astro/native/core-post-template.astro +23 -0
  148. package/dist/astro/native/core-post-terms.astro +47 -0
  149. package/dist/astro/native/core-post-title.astro +23 -0
  150. package/dist/astro/native/core-query-no-results.astro +12 -0
  151. package/dist/astro/native/core-query.astro +22 -0
  152. package/dist/astro/native/core-separator.astro +18 -0
  153. package/dist/astro/native/core-site-title.astro +16 -0
  154. package/dist/astro/native/core-term-description.astro +12 -0
  155. package/dist/astro/native/core-term-name.astro +21 -0
  156. package/dist/astro/native/core-term-template.astro +30 -0
  157. package/dist/astro/native/core-terms-query.astro +19 -0
  158. package/dist/astro/native/core-transparent.astro +11 -0
  159. package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
  160. package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
  161. package/dist/astro/native/flowpress-navigation-controller.js +217 -0
  162. package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
  163. package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
  164. package/dist/astro/native/flowpress-navigation.css +18 -0
  165. package/dist/astro/native/grid-bleed.d.ts +2 -0
  166. package/dist/astro/native/grid-bleed.d.ts.map +1 -0
  167. package/dist/astro/native/grid-bleed.js +123 -0
  168. package/dist/astro/native/grid-bleed.js.map +1 -0
  169. package/dist/astro/native/grid.css +180 -0
  170. package/dist/astro/native/grid.d.ts +17 -0
  171. package/dist/astro/native/grid.d.ts.map +1 -0
  172. package/dist/astro/native/grid.js +108 -0
  173. package/dist/astro/native/grid.js.map +1 -0
  174. package/dist/astro/native/grid.ts +132 -0
  175. package/dist/astro/native/group.css +36 -0
  176. package/dist/astro/native/group.d.ts +15 -0
  177. package/dist/astro/native/group.d.ts.map +1 -0
  178. package/dist/astro/native/group.js +66 -0
  179. package/dist/astro/native/group.js.map +1 -0
  180. package/dist/astro/native/group.ts +61 -0
  181. package/dist/astro/native/html.d.ts +6 -0
  182. package/dist/astro/native/html.d.ts.map +1 -0
  183. package/dist/astro/native/html.js +10 -0
  184. package/dist/astro/native/html.js.map +1 -0
  185. package/dist/astro/native/html.ts +9 -0
  186. package/dist/astro/native/icon.d.ts +3 -0
  187. package/dist/astro/native/icon.d.ts.map +1 -0
  188. package/dist/astro/native/icon.js +23 -0
  189. package/dist/astro/native/icon.js.map +1 -0
  190. package/dist/astro/native/icon.ts +21 -0
  191. package/dist/astro/native/image.d.ts +5 -0
  192. package/dist/astro/native/image.d.ts.map +1 -0
  193. package/dist/astro/native/image.js +65 -0
  194. package/dist/astro/native/image.js.map +1 -0
  195. package/dist/astro/native/image.ts +56 -0
  196. package/dist/astro/native/inline-text.css +15 -0
  197. package/dist/astro/native/map.d.ts +14 -0
  198. package/dist/astro/native/map.d.ts.map +1 -0
  199. package/dist/astro/native/map.js +60 -0
  200. package/dist/astro/native/map.js.map +1 -0
  201. package/dist/astro/native/map.ts +70 -0
  202. package/dist/astro/native/motion-preference.d.ts +50 -0
  203. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  204. package/dist/astro/native/motion-preference.js +132 -0
  205. package/dist/astro/native/motion-preference.js.map +1 -0
  206. package/dist/astro/native/motion-preference.ts +158 -0
  207. package/dist/astro/native/motion.d.ts +101 -0
  208. package/dist/astro/native/motion.d.ts.map +1 -0
  209. package/dist/astro/native/motion.js +168 -0
  210. package/dist/astro/native/motion.js.map +1 -0
  211. package/dist/astro/native/motion.ts +312 -0
  212. package/dist/astro/native/query-carousel.d.ts +13 -0
  213. package/dist/astro/native/query-carousel.d.ts.map +1 -0
  214. package/dist/astro/native/query-carousel.js +36 -0
  215. package/dist/astro/native/query-carousel.js.map +1 -0
  216. package/dist/astro/native/query-carousel.ts +60 -0
  217. package/dist/astro/native/query-loop.d.ts +38 -0
  218. package/dist/astro/native/query-loop.d.ts.map +1 -0
  219. package/dist/astro/native/query-loop.js +20 -0
  220. package/dist/astro/native/query-loop.js.map +1 -0
  221. package/dist/astro/native/query-loop.ts +67 -0
  222. package/dist/astro/native/registry.d.ts +3 -0
  223. package/dist/astro/native/registry.d.ts.map +1 -0
  224. package/dist/astro/native/registry.js +91 -0
  225. package/dist/astro/native/registry.js.map +1 -0
  226. package/dist/astro/native/registry.ts +93 -0
  227. package/dist/astro/native/sf-block-binding.astro +20 -0
  228. package/dist/astro/native/sf-post-field.astro +9 -0
  229. package/dist/astro/native/sf-slot.astro +6 -0
  230. package/dist/astro/native/sf-term-field.astro +9 -0
  231. package/dist/astro/native/timeline.css +4 -0
  232. package/dist/astro/native/timeline.d.ts +28 -0
  233. package/dist/astro/native/timeline.d.ts.map +1 -0
  234. package/dist/astro/native/timeline.js +43 -0
  235. package/dist/astro/native/timeline.js.map +1 -0
  236. package/dist/astro/native/timeline.ts +79 -0
  237. package/dist/astro/preferences/AccessibilityPanel.astro +105 -0
  238. package/dist/astro/preferences/ColorModeToggle.astro +26 -0
  239. package/dist/astro/preferences/MotionToggle.astro +27 -0
  240. package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
  241. package/dist/astro/preferences/ThemeToggle.astro +30 -0
  242. package/dist/astro/preferences/Toggle.astro +50 -0
  243. package/dist/astro/preferences/preferences.css +125 -0
  244. package/dist/block-renderers.d.ts +23 -3
  245. package/dist/block-renderers.d.ts.map +1 -1
  246. package/dist/block-renderers.js.map +1 -1
  247. package/dist/build-cache.d.ts +8 -0
  248. package/dist/build-cache.d.ts.map +1 -0
  249. package/dist/build-cache.js +82 -0
  250. package/dist/build-cache.js.map +1 -0
  251. package/dist/carousel.d.ts +56 -6
  252. package/dist/carousel.d.ts.map +1 -1
  253. package/dist/carousel.js +183 -27
  254. package/dist/carousel.js.map +1 -1
  255. package/dist/client.d.ts +34 -2
  256. package/dist/client.d.ts.map +1 -1
  257. package/dist/client.js +124 -42
  258. package/dist/client.js.map +1 -1
  259. package/dist/composition.d.ts +14 -0
  260. package/dist/composition.d.ts.map +1 -0
  261. package/dist/composition.js +125 -0
  262. package/dist/composition.js.map +1 -0
  263. package/dist/default-blocks.d.ts +9 -0
  264. package/dist/default-blocks.d.ts.map +1 -0
  265. package/dist/default-blocks.js +122 -0
  266. package/dist/default-blocks.js.map +1 -0
  267. package/dist/env.d.ts +21 -0
  268. package/dist/env.d.ts.map +1 -1
  269. package/dist/env.js +53 -0
  270. package/dist/env.js.map +1 -1
  271. package/dist/index.d.ts +7 -0
  272. package/dist/index.d.ts.map +1 -1
  273. package/dist/index.js +6 -0
  274. package/dist/index.js.map +1 -1
  275. package/dist/media.d.ts +20 -0
  276. package/dist/media.d.ts.map +1 -0
  277. package/dist/media.js +106 -0
  278. package/dist/media.js.map +1 -0
  279. package/dist/motion-preference.d.ts +50 -0
  280. package/dist/motion-preference.d.ts.map +1 -0
  281. package/dist/motion-preference.js +132 -0
  282. package/dist/motion-preference.js.map +1 -0
  283. package/dist/preferences-runtime.d.ts +3 -0
  284. package/dist/preferences-runtime.d.ts.map +1 -0
  285. package/dist/preferences-runtime.js +23 -0
  286. package/dist/preferences-runtime.js.map +1 -0
  287. package/dist/preferences-styleflow.d.ts +3 -0
  288. package/dist/preferences-styleflow.d.ts.map +1 -0
  289. package/dist/preferences-styleflow.js +14 -0
  290. package/dist/preferences-styleflow.js.map +1 -0
  291. package/dist/preferences.d.ts +4 -0
  292. package/dist/preferences.d.ts.map +1 -0
  293. package/dist/preferences.js +4 -0
  294. package/dist/preferences.js.map +1 -0
  295. package/dist/reserved-area.d.ts +10 -0
  296. package/dist/reserved-area.d.ts.map +1 -0
  297. package/dist/reserved-area.js +93 -0
  298. package/dist/reserved-area.js.map +1 -0
  299. package/dist/styleflow.d.ts +18 -1
  300. package/dist/styleflow.d.ts.map +1 -1
  301. package/dist/styleflow.js +82 -11
  302. package/dist/styleflow.js.map +1 -1
  303. package/dist/svg-media-runtime.d.ts +3 -0
  304. package/dist/svg-media-runtime.d.ts.map +1 -0
  305. package/dist/svg-media-runtime.js +33 -0
  306. package/dist/svg-media-runtime.js.map +1 -0
  307. package/dist/svg-media-types.d.ts +11 -0
  308. package/dist/svg-media-types.d.ts.map +1 -0
  309. package/dist/svg-media-types.js +2 -0
  310. package/dist/svg-media-types.js.map +1 -0
  311. package/dist/svg-media.d.ts +13 -0
  312. package/dist/svg-media.d.ts.map +1 -0
  313. package/dist/svg-media.js +47 -0
  314. package/dist/svg-media.js.map +1 -0
  315. package/dist/template-hierarchy.d.ts +0 -7
  316. package/dist/template-hierarchy.d.ts.map +1 -1
  317. package/dist/template-hierarchy.js +0 -21
  318. package/dist/template-hierarchy.js.map +1 -1
  319. package/dist/text.d.ts +3 -0
  320. package/dist/text.d.ts.map +1 -0
  321. package/dist/text.js +6 -0
  322. package/dist/text.js.map +1 -0
  323. package/dist/theme-runtime.d.ts +16 -0
  324. package/dist/theme-runtime.d.ts.map +1 -0
  325. package/dist/theme-runtime.js +100 -0
  326. package/dist/theme-runtime.js.map +1 -0
  327. package/dist/tsconfig.tsbuildinfo +1 -1
  328. package/dist/types.d.ts +75 -1
  329. package/dist/types.d.ts.map +1 -1
  330. package/dist/types.js.map +1 -1
  331. package/dist/vivid-colors-preference.d.ts +31 -0
  332. package/dist/vivid-colors-preference.d.ts.map +1 -0
  333. package/dist/vivid-colors-preference.js +102 -0
  334. package/dist/vivid-colors-preference.js.map +1 -0
  335. package/package.json +58 -7
  336. package/dist/astro/DefaultTemplate.astro +0 -42
  337. package/dist/templates.d.ts +0 -19
  338. package/dist/templates.d.ts.map +0 -1
  339. package/dist/templates.js +0 -20
  340. package/dist/templates.js.map +0 -1
@@ -0,0 +1,122 @@
1
+ export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "8";
2
+ const blockNames = [
3
+ "core/accordion",
4
+ "core/accordion-item",
5
+ "core/accordion-heading",
6
+ "core/accordion-panel",
7
+ "core/separator",
8
+ "core/post-content",
9
+ "core/site-logo",
10
+ "core/template-part",
11
+ "sf/accordion",
12
+ "sf/collection",
13
+ "sf/flex",
14
+ "sf/group",
15
+ "sf/marquee",
16
+ "sf/media-text",
17
+ "sf/theme-toggle",
18
+ "core/term-name",
19
+ "core/post-terms",
20
+ "core/button",
21
+ "flowpress/login",
22
+ "flowpress/reserved-pagination",
23
+ "core/post-date",
24
+ "core/icon",
25
+ "core/post-excerpt",
26
+ "core/term-description",
27
+ "core/post-template",
28
+ "core/html",
29
+ "core/block",
30
+ "core/site-title",
31
+ "core/post-featured-image",
32
+ "core/page-list",
33
+ "core/terms-query",
34
+ "core/buttons",
35
+ "core/image",
36
+ "core/query-no-results",
37
+ "core/term-template",
38
+ "core/navigation",
39
+ "core/navigation-submenu",
40
+ "core/query",
41
+ "core/home-link",
42
+ "core/page-list-item",
43
+ "core/navigation-link",
44
+ "core/post-title",
45
+ "sf/post-field",
46
+ "sf/block-binding",
47
+ "sf/term-field",
48
+ "sf/timeline",
49
+ "core/cover",
50
+ "core/group",
51
+ "core/heading",
52
+ "core/list",
53
+ "core/list-item",
54
+ "core/paragraph",
55
+ "core/quote",
56
+ "sf/accordion-item",
57
+ "sf/button",
58
+ "sf/card",
59
+ "sf/carousel",
60
+ "sf/carousel-item",
61
+ "sf/chip",
62
+ "sf/code",
63
+ "sf/column",
64
+ "sf/content-list",
65
+ "sf/form",
66
+ "sf/gallery",
67
+ "sf/grid",
68
+ "sf/heading",
69
+ "sf/hero",
70
+ "sf/icon",
71
+ "sf/image",
72
+ "sf/blob",
73
+ "sf/timeline-card",
74
+ "sf/map",
75
+ "sf/number-spinner",
76
+ "sf/quote",
77
+ "sf/rich-text",
78
+ "sf/section",
79
+ "sf/slot",
80
+ "sf/template",
81
+ "sf/term-list",
82
+ "sf/video",
83
+ "sf/video-youtube"
84
+ ];
85
+ export const flowpressDefaultBlockCatalog = [...blockNames].sort().map((blockName) => ({ blockName, template: "DefaultBlockAdapter.astro" }));
86
+ const supported = new Set(blockNames);
87
+ export function hasFlowpressDefaultBlockAdapter(blockName) {
88
+ return supported.has(blockName);
89
+ }
90
+ export function createFlowpressDefaultBlockAdapterSource(blockName) {
91
+ if (!hasFlowpressDefaultBlockAdapter(blockName)) {
92
+ throw new Error(`FlowPress has no official default adapter for ${blockName}.`);
93
+ }
94
+ if (blockName === "core/cover") {
95
+ return `---
96
+ import CoverBlock from "@styleflow.app/flowpress-astro-core/blocks/CoverBlock.astro";
97
+ import type { FlowpressBlockRendererProps } from "@styleflow.app/flowpress-astro-core";
98
+
99
+ const { block, contract, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
100
+ ---
101
+
102
+ <CoverBlock
103
+ block={block}
104
+ contract={contract}
105
+ htmlProps={htmlProps}
106
+ styleflowProps={styleflowProps}
107
+ >
108
+ <slot />
109
+ </CoverBlock>
110
+ `;
111
+ }
112
+ return `---
113
+ import DefaultBlockAdapter from "@styleflow.app/flowpress-astro-core/DefaultBlockAdapter.astro";
114
+ import type { FlowpressBlockRendererProps } from "@styleflow.app/flowpress-astro-core";
115
+
116
+ const props = Astro.props as FlowpressBlockRendererProps;
117
+ ---
118
+
119
+ <DefaultBlockAdapter {...props} />
120
+ `;
121
+ }
122
+ //# sourceMappingURL=default-blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-blocks.js","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAY,CAAC;AAOpE,MAAM,UAAU,GAAG;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,wBAAwB;IACxB,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,SAAS;IACT,UAAU;IACV,YAAY;IACZ,eAAe;IACf,iBAAiB;IAEjB,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,+BAA+B;IAC/B,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,oBAAoB;IACpB,WAAW;IAC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D,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;QAC/B,OAAO;;;;;;;;;;;;;;;CAeV,CAAC;IACA,CAAC;IACD,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC","sourcesContent":["export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = \"8\" as const;\n\nexport interface FlowpressDefaultBlockCatalogEntry {\n blockName: string;\n template: \"DefaultBlockAdapter.astro\";\n}\n\nconst blockNames = [\n \"core/accordion\",\n \"core/accordion-item\",\n \"core/accordion-heading\",\n \"core/accordion-panel\",\n \"core/separator\",\n \"core/post-content\",\n \"core/site-logo\",\n \"core/template-part\",\n \"sf/accordion\",\n \"sf/collection\",\n \"sf/flex\",\n \"sf/group\",\n \"sf/marquee\",\n \"sf/media-text\",\n \"sf/theme-toggle\",\n\n \"core/term-name\",\n \"core/post-terms\",\n \"core/button\",\n \"flowpress/login\",\n \"flowpress/reserved-pagination\",\n \"core/post-date\",\n \"core/icon\",\n \"core/post-excerpt\",\n \"core/term-description\",\n \"core/post-template\",\n \"core/html\",\n \"core/block\",\n \"core/site-title\",\n \"core/post-featured-image\",\n \"core/page-list\",\n \"core/terms-query\",\n \"core/buttons\",\n \"core/image\",\n \"core/query-no-results\",\n \"core/term-template\",\n \"core/navigation\",\n \"core/navigation-submenu\",\n \"core/query\",\n \"core/home-link\",\n \"core/page-list-item\",\n \"core/navigation-link\",\n \"core/post-title\",\n \"sf/post-field\",\n \"sf/block-binding\",\n \"sf/term-field\",\n \"sf/timeline\",\n \"core/cover\",\n \"core/group\",\n \"core/heading\",\n \"core/list\",\n \"core/list-item\",\n \"core/paragraph\",\n \"core/quote\",\n \"sf/accordion-item\",\n \"sf/button\",\n \"sf/card\",\n \"sf/carousel\",\n \"sf/carousel-item\",\n \"sf/chip\",\n \"sf/code\",\n \"sf/column\",\n \"sf/content-list\",\n \"sf/form\",\n \"sf/gallery\",\n \"sf/grid\",\n \"sf/heading\",\n \"sf/hero\",\n \"sf/icon\",\n \"sf/image\",\n \"sf/blob\",\n \"sf/timeline-card\",\n \"sf/map\",\n \"sf/number-spinner\",\n \"sf/quote\",\n \"sf/rich-text\",\n \"sf/section\",\n \"sf/slot\",\n \"sf/template\",\n \"sf/term-list\",\n \"sf/video\",\n \"sf/video-youtube\"\n] as const;\n\nexport const flowpressDefaultBlockCatalog: readonly FlowpressDefaultBlockCatalogEntry[] =\n [...blockNames].sort().map((blockName) => ({ blockName, template: \"DefaultBlockAdapter.astro\" }));\n\nconst supported = new Set<string>(blockNames);\n\nexport function hasFlowpressDefaultBlockAdapter(blockName: string): boolean {\n return supported.has(blockName);\n}\n\nexport function createFlowpressDefaultBlockAdapterSource(blockName: string): string {\n if (!hasFlowpressDefaultBlockAdapter(blockName)) {\n throw new Error(`FlowPress has no official default adapter for ${blockName}.`);\n }\n if (blockName === \"core/cover\") {\n return `---\nimport CoverBlock from \"@styleflow.app/flowpress-astro-core/blocks/CoverBlock.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst { block, contract, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;\n---\n\n<CoverBlock\n block={block}\n contract={contract}\n htmlProps={htmlProps}\n styleflowProps={styleflowProps}\n>\n <slot />\n</CoverBlock>\n`;\n }\n return `---\nimport DefaultBlockAdapter from \"@styleflow.app/flowpress-astro-core/DefaultBlockAdapter.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst props = Astro.props as FlowpressBlockRendererProps;\n---\n\n<DefaultBlockAdapter {...props} />\n`;\n}\n"]}
package/dist/env.d.ts CHANGED
@@ -6,8 +6,29 @@ export interface FlowpressEnvironment {
6
6
  outputMode: AstroOutputMode;
7
7
  siteUrl: string;
8
8
  backendUrl: string;
9
+ mediaUrl: string;
9
10
  graphqlUrl: string;
10
11
  localAstroPort: number;
11
12
  }
13
+ export interface FlowpressMediaRemotePattern {
14
+ protocol: "http" | "https";
15
+ hostname: string;
16
+ port?: string;
17
+ pathname: string;
18
+ }
19
+ export declare function resolveFlowpressMediaUrl(env: NodeJS.ProcessEnv): string;
20
+ export declare function flowpressMediaRemotePattern(env: NodeJS.ProcessEnv): FlowpressMediaRemotePattern;
12
21
  export declare function readFlowpressEnvironment(env?: NodeJS.ProcessEnv): FlowpressEnvironment;
22
+ /** Node build stores wait this long on another process before giving up. */
23
+ export declare const FLOWPRESS_BUILD_STORE_LOCK_MS = 120000;
24
+ export interface FlowpressGraphqlOptions {
25
+ timeoutMs?: number;
26
+ retries?: number;
27
+ }
28
+ /**
29
+ * Optional client tuning from FLOWPRESS_GRAPHQL_TIMEOUT_MS and
30
+ * FLOWPRESS_GRAPHQL_RETRIES. The worst case (every attempt timing out plus
31
+ * backoff) must end before a waiting build process abandons the shared store.
32
+ */
33
+ export declare function readFlowpressGraphqlOptions(env?: NodeJS.ProcessEnv): FlowpressGraphqlOptions;
13
34
  //# sourceMappingURL=env.d.ts.map
package/dist/env.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AA0BD,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,oBAAoB,CAsBtB"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAQvE;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,2BAA2B,CAS7B;AA0BD,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,oBAAoB,CAuBtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,uBAAuB,CAgBzB"}
package/dist/env.js CHANGED
@@ -1,3 +1,23 @@
1
+ import { DEFAULT_GRAPHQL_RETRIES, DEFAULT_GRAPHQL_RETRY_DELAY_MS, DEFAULT_GRAPHQL_TIMEOUT_MS } from "./client.js";
2
+ export function resolveFlowpressMediaUrl(env) {
3
+ const key = env.FLOWPRESS_MEDIA?.trim() ? "FLOWPRESS_MEDIA" : "BACKEND_URL";
4
+ const value = validUrl(required(env, key), key);
5
+ const url = new URL(value);
6
+ if (url.username || url.password || url.search || url.hash) {
7
+ throw new Error(`${key} must not contain credentials, query, or fragment.`);
8
+ }
9
+ return url.toString().replace(/\/+$/, "");
10
+ }
11
+ export function flowpressMediaRemotePattern(env) {
12
+ const url = new URL(resolveFlowpressMediaUrl(env));
13
+ const basePath = url.pathname.replace(/\/+$/, "");
14
+ return {
15
+ protocol: url.protocol.slice(0, -1),
16
+ hostname: url.hostname,
17
+ ...(url.port ? { port: url.port } : {}),
18
+ pathname: basePath ? `${basePath}/**` : "/**"
19
+ };
20
+ }
1
21
  function required(env, key) {
2
22
  const value = env[key]?.trim();
3
23
  if (!value) {
@@ -32,8 +52,41 @@ export function readFlowpressEnvironment(env = process.env) {
32
52
  outputMode,
33
53
  siteUrl: validUrl(required(env, "SITE_URL"), "SITE_URL"),
34
54
  backendUrl: validUrl(required(env, "BACKEND_URL"), "BACKEND_URL"),
55
+ mediaUrl: resolveFlowpressMediaUrl(env),
35
56
  graphqlUrl: validUrl(required(env, "BACKEND_GRAPHQL_URL"), "BACKEND_GRAPHQL_URL"),
36
57
  localAstroPort: port(required(env, "LOCAL_ASTRO_PORT"), "LOCAL_ASTRO_PORT")
37
58
  };
38
59
  }
60
+ /** Node build stores wait this long on another process before giving up. */
61
+ export const FLOWPRESS_BUILD_STORE_LOCK_MS = 120_000;
62
+ /**
63
+ * Optional client tuning from FLOWPRESS_GRAPHQL_TIMEOUT_MS and
64
+ * FLOWPRESS_GRAPHQL_RETRIES. The worst case (every attempt timing out plus
65
+ * backoff) must end before a waiting build process abandons the shared store.
66
+ */
67
+ export function readFlowpressGraphqlOptions(env = process.env) {
68
+ const timeoutMs = optionalInteger(env, "FLOWPRESS_GRAPHQL_TIMEOUT_MS", 1_000, 60_000);
69
+ const retries = optionalInteger(env, "FLOWPRESS_GRAPHQL_RETRIES", 0, 5);
70
+ const attempts = (retries ?? DEFAULT_GRAPHQL_RETRIES) + 1;
71
+ const worstCase = (timeoutMs ?? DEFAULT_GRAPHQL_TIMEOUT_MS) * attempts
72
+ + DEFAULT_GRAPHQL_RETRY_DELAY_MS * (2 ** (attempts - 1) - 1);
73
+ if (worstCase >= FLOWPRESS_BUILD_STORE_LOCK_MS) {
74
+ throw new Error(`FLOWPRESS_GRAPHQL_TIMEOUT_MS x attempts reaches ${worstCase}ms; `
75
+ + `keep it below the ${FLOWPRESS_BUILD_STORE_LOCK_MS}ms build store lock.`);
76
+ }
77
+ return {
78
+ ...(timeoutMs === undefined ? {} : { timeoutMs }),
79
+ ...(retries === undefined ? {} : { retries })
80
+ };
81
+ }
82
+ function optionalInteger(env, key, min, max) {
83
+ const value = env[key]?.trim();
84
+ if (!value)
85
+ return undefined;
86
+ const parsed = Number(value);
87
+ if (!/^\d+$/.test(value) || parsed < min || parsed > max) {
88
+ throw new Error(`${key} must be an integer between ${min} and ${max}.`);
89
+ }
90
+ return parsed;
91
+ }
39
92
  //# sourceMappingURL=env.js.map
package/dist/env.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAaA,SAAS,QAAQ,CAAC,GAAsB,EAAE,GAAW;IACnD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,GAAG,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa,EAAE,GAAW;IAC1C,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,2BAA2B,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;A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Env: string;\n projectName: string;\n projectSlug: string;\n outputMode: AstroOutputMode;\n siteUrl: string;\n backendUrl: string;\n graphqlUrl: string;\n localAstroPort: number;\n}\n\nfunction required(env: NodeJS.ProcessEnv, key: string): string {\n const value = env[key]?.trim();\n if (!value) {\n throw new Error(`Missing required environment variable ${key}.`);\n }\n return value;\n}\n\nfunction validUrl(value: string, key: string): string {\n try {\n return new URL(value).toString().replace(/\\/$/, \"\");\n } catch {\n throw new Error(`${key} must be an absolute URL.`);\n }\n}\n\nfunction port(value: string, key: string): number {\n const parsed = Number.parseInt(value, 10);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65_535) {\n throw new Error(`${key} must be a valid TCP port.`);\n }\n return parsed;\n}\n\nexport function readFlowpressEnvironment(\n env: NodeJS.ProcessEnv = process.env\n): FlowpressEnvironment {\n const outputMode = required(env, \"ASTRO_OUTPUT_MODE\");\n if (outputMode !== \"static\" && outputMode !== \"server\") {\n throw new Error(\"ASTRO_OUTPUT_MODE must be static or server.\");\n }\n\n return {\n appEnv: required(env, \"APP_ENV\"),\n projectName: required(env, \"PROJECT_NAME\"),\n projectSlug: required(env, \"PROJECT_SLUG\"),\n outputMode,\n siteUrl: validUrl(required(env, \"SITE_URL\"), \"SITE_URL\"),\n backendUrl: validUrl(required(env, \"BACKEND_URL\"), \"BACKEND_URL\"),\n graphqlUrl: validUrl(\n required(env, \"BACKEND_GRAPHQL_URL\"),\n \"BACKEND_GRAPHQL_URL\"\n ),\n localAstroPort: port(\n required(env, \"LOCAL_ASTRO_PORT\"),\n \"LOCAL_ASTRO_PORT\"\n )\n };\n}\n"]}
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AAuBrB,MAAM,UAAU,wBAAwB,CAAC,GAAsB;IAC7D,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,EA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AE,CAAC;QACjD,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,GAAsB,EACtB,GAAW,EACX,GAAW,EACX,GAAW;IAEX,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,+BAA+B,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n DEFAULT_GRAPHQL_RETRIES,\n DEFAULT_GRAPHQL_RETRY_DELAY_MS,\n DEFAULT_GRAPHQL_TIMEOUT_MS\n} from \"./client.js\";\n\nexport type AstroOutputMode = \"static\" | \"server\";\n\nexport interface FlowpressEnvironment {\n appEnv: string;\n projectName: string;\n projectSlug: string;\n outputMode: AstroOutputMode;\n siteUrl: string;\n backendUrl: string;\n mediaUrl: string;\n graphqlUrl: string;\n localAstroPort: number;\n}\n\nexport interface FlowpressMediaRemotePattern {\n protocol: \"http\" | \"https\";\n hostname: string;\n port?: string;\n pathname: string;\n}\n\nexport function resolveFlowpressMediaUrl(env: NodeJS.ProcessEnv): string {\n const key = env.FLOWPRESS_MEDIA?.trim() ? \"FLOWPRESS_MEDIA\" : \"BACKEND_URL\";\n const value = validUrl(required(env, key), key);\n const url = new URL(value);\n if (url.username || url.password || url.search || url.hash) {\n throw new Error(`${key} must not contain credentials, query, or fragment.`);\n }\n return url.toString().replace(/\\/+$/, \"\");\n}\n\nexport function flowpressMediaRemotePattern(\n env: NodeJS.ProcessEnv\n): FlowpressMediaRemotePattern {\n const url = new URL(resolveFlowpressMediaUrl(env));\n const basePath = url.pathname.replace(/\\/+$/, \"\");\n return {\n protocol: url.protocol.slice(0, -1) as \"http\" | \"https\",\n hostname: url.hostname,\n ...(url.port ? { port: url.port } : {}),\n pathname: basePath ? `${basePath}/**` : \"/**\"\n };\n}\n\nfunction required(env: NodeJS.ProcessEnv, key: string): string {\n const value = env[key]?.trim();\n if (!value) {\n throw new Error(`Missing required environment variable ${key}.`);\n }\n return value;\n}\n\nfunction validUrl(value: string, key: string): string {\n try {\n return new URL(value).toString().replace(/\\/$/, \"\");\n } catch {\n throw new Error(`${key} must be an absolute URL.`);\n }\n}\n\nfunction port(value: string, key: string): number {\n const parsed = Number.parseInt(value, 10);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65_535) {\n throw new Error(`${key} must be a valid TCP port.`);\n }\n return parsed;\n}\n\nexport function readFlowpressEnvironment(\n env: NodeJS.ProcessEnv = process.env\n): FlowpressEnvironment {\n const outputMode = required(env, \"ASTRO_OUTPUT_MODE\");\n if (outputMode !== \"static\" && outputMode !== \"server\") {\n throw new Error(\"ASTRO_OUTPUT_MODE must be static or server.\");\n }\n\n return {\n appEnv: required(env, \"APP_ENV\"),\n projectName: required(env, \"PROJECT_NAME\"),\n projectSlug: required(env, \"PROJECT_SLUG\"),\n outputMode,\n siteUrl: validUrl(required(env, \"SITE_URL\"), \"SITE_URL\"),\n backendUrl: validUrl(required(env, \"BACKEND_URL\"), \"BACKEND_URL\"),\n mediaUrl: resolveFlowpressMediaUrl(env),\n graphqlUrl: validUrl(\n required(env, \"BACKEND_GRAPHQL_URL\"),\n \"BACKEND_GRAPHQL_URL\"\n ),\n localAstroPort: port(\n required(env, \"LOCAL_ASTRO_PORT\"),\n \"LOCAL_ASTRO_PORT\"\n )\n };\n}\n\n/** Node build stores wait this long on another process before giving up. */\nexport const FLOWPRESS_BUILD_STORE_LOCK_MS = 120_000;\n\nexport interface FlowpressGraphqlOptions {\n timeoutMs?: number;\n retries?: number;\n}\n\n/**\n * Optional client tuning from FLOWPRESS_GRAPHQL_TIMEOUT_MS and\n * FLOWPRESS_GRAPHQL_RETRIES. The worst case (every attempt timing out plus\n * backoff) must end before a waiting build process abandons the shared store.\n */\nexport function readFlowpressGraphqlOptions(\n env: NodeJS.ProcessEnv = process.env\n): FlowpressGraphqlOptions {\n const timeoutMs = optionalInteger(env, \"FLOWPRESS_GRAPHQL_TIMEOUT_MS\", 1_000, 60_000);\n const retries = optionalInteger(env, \"FLOWPRESS_GRAPHQL_RETRIES\", 0, 5);\n const attempts = (retries ?? DEFAULT_GRAPHQL_RETRIES) + 1;\n const worstCase = (timeoutMs ?? DEFAULT_GRAPHQL_TIMEOUT_MS) * attempts\n + DEFAULT_GRAPHQL_RETRY_DELAY_MS * (2 ** (attempts - 1) - 1);\n if (worstCase >= FLOWPRESS_BUILD_STORE_LOCK_MS) {\n throw new Error(\n `FLOWPRESS_GRAPHQL_TIMEOUT_MS x attempts reaches ${worstCase}ms; `\n + `keep it below the ${FLOWPRESS_BUILD_STORE_LOCK_MS}ms build store lock.`\n );\n }\n return {\n ...(timeoutMs === undefined ? {} : { timeoutMs }),\n ...(retries === undefined ? {} : { retries })\n };\n}\n\nfunction optionalInteger(\n env: NodeJS.ProcessEnv,\n key: string,\n min: number,\n max: number\n): number | undefined {\n const value = env[key]?.trim();\n if (!value) return undefined;\n const parsed = Number(value);\n if (!/^\\d+$/.test(value) || parsed < min || parsed > max) {\n throw new Error(`${key} must be an integer between ${min} and ${max}.`);\n }\n return parsed;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  export * from "./client.js";
2
2
  export * from "./carousel.js";
3
3
  export * from "./block-renderers.js";
4
+ export * from "./composition.js";
5
+ export * from "./default-blocks.js";
4
6
  export * from "./env.js";
5
7
  export * from "./links.js";
8
+ export * from "./media.js";
6
9
  export * from "./number-spinner.js";
7
10
  export * from "./styleflow.js";
8
11
  export * from "./style-classes.js";
9
12
  export * from "./template-hierarchy.js";
13
+ export * from "./theme-runtime.js";
14
+ export { resolveFlowpressSiteDesign, flowpressSiteDesignAttributes } from "@styleflow.app/flowpress-components/site-design";
15
+ export type { FlowpressSiteDesign, FlowpressSiteDesignDefaults } from "@styleflow.app/flowpress-components/site-design";
10
16
  export * from "./types.js";
17
+ export * from "./text.js";
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAC5H,YAAY,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AACxH,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,17 @@
1
1
  export * from "./client.js";
2
2
  export * from "./carousel.js";
3
3
  export * from "./block-renderers.js";
4
+ export * from "./composition.js";
5
+ export * from "./default-blocks.js";
4
6
  export * from "./env.js";
5
7
  export * from "./links.js";
8
+ export * from "./media.js";
6
9
  export * from "./number-spinner.js";
7
10
  export * from "./styleflow.js";
8
11
  export * from "./style-classes.js";
9
12
  export * from "./template-hierarchy.js";
13
+ export * from "./theme-runtime.js";
14
+ export { resolveFlowpressSiteDesign, flowpressSiteDesignAttributes } from "@styleflow.app/flowpress-components/site-design";
10
15
  export * from "./types.js";
16
+ export * from "./text.js";
11
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC","sourcesContent":["export * from \"./client.js\";\nexport * from \"./carousel.js\";\nexport * from \"./block-renderers.js\";\nexport * from \"./env.js\";\nexport * from \"./links.js\";\nexport * from \"./number-spinner.js\";\nexport * from \"./styleflow.js\";\nexport * from \"./style-classes.js\";\nexport * from \"./template-hierarchy.js\";\nexport * from \"./types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAE5H,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC","sourcesContent":["export * from \"./client.js\";\nexport * from \"./carousel.js\";\nexport * from \"./block-renderers.js\";\nexport * from \"./composition.js\";\nexport * from \"./default-blocks.js\";\nexport * from \"./env.js\";\nexport * from \"./links.js\";\nexport * from \"./media.js\";\nexport * from \"./number-spinner.js\";\nexport * from \"./styleflow.js\";\nexport * from \"./style-classes.js\";\nexport * from \"./template-hierarchy.js\";\nexport * from \"./theme-runtime.js\";\nexport { resolveFlowpressSiteDesign, flowpressSiteDesignAttributes } from \"@styleflow.app/flowpress-components/site-design\";\nexport type { FlowpressSiteDesign, FlowpressSiteDesignDefaults } from \"@styleflow.app/flowpress-components/site-design\";\nexport * from \"./types.js\";\nexport * from \"./text.js\";\n"]}
@@ -0,0 +1,20 @@
1
+ export declare const FLOWPRESS_UPLOADS_PREFIX = "/app/uploads/";
2
+ export declare const FLOWPRESS_MEDIA_PREFIX = "/media/";
3
+ export interface FlowpressFrontendMediaOptions {
4
+ frontendOrigin: string;
5
+ backendUrl?: string | undefined;
6
+ mediaUrl?: string | undefined;
7
+ /** Canonical frontend URLs and aliases owned by the selected backend. */
8
+ frontendUrls?: readonly string[] | undefined;
9
+ }
10
+ export declare function rewriteFlowpressMediaUrl(value: string, options: FlowpressFrontendMediaOptions): string;
11
+ /** Normalize media data once, sharing unchanged branches and parsing origins
12
+ * once per payload. HTML, CSS and scripts remain intact.
13
+ */
14
+ export declare function rewriteFlowpressMediaUrls<T>(value: T, options: FlowpressFrontendMediaOptions): T;
15
+ export declare function isFlowpressUploadPath(pathname: string): boolean;
16
+ export declare function isFlowpressMediaPath(pathname: string): boolean;
17
+ export declare function rewriteFlowpressBackendUrl(value: string, backendUrl: string, frontendOrigin?: string): string;
18
+ /** Historical file URLs redirect to their real origin; editorial /media pages remain routes. */
19
+ export declare function redirectFlowpressMedia(request: Request, options: FlowpressFrontendMediaOptions): Response | null;
20
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,MAAM,WAAW,6BAA6B;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,yEAAyE;IACzE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC9C;AAiCD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAEtG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,6BAA6B,GAAG,CAAC,CAyBhG;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,cAAc,SAAK,GAClB,MAAM,CASR;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6BAA6B,GAAG,QAAQ,GAAG,IAAI,CAOhH"}
package/dist/media.js ADDED
@@ -0,0 +1,106 @@
1
+ export const FLOWPRESS_UPLOADS_PREFIX = "/app/uploads/";
2
+ export const FLOWPRESS_MEDIA_PREFIX = "/media/";
3
+ /** Resolve legacy frontend media aliases to their real origin. Absolute URLs
4
+ * supplied by WordPress/offload plugins remain authoritative, even in a mixed
5
+ * library. FLOWPRESS_MEDIA is only used to undo the old /media/ alias.
6
+ */
7
+ function mediaResolver(options) {
8
+ try {
9
+ const frontend = new URL(options.frontendOrigin);
10
+ const backend = options.backendUrl ? new URL(options.backendUrl) : undefined;
11
+ const media = options.mediaUrl ? new URL(options.mediaUrl) : backend;
12
+ const frontends = new Set([frontend.origin, ...(options.frontendUrls ?? []).map((url) => new URL(url).origin)]);
13
+ return (value) => {
14
+ // Most JSON strings are labels, HTML or CSS: avoid parsing these as URLs.
15
+ if (!value || /\s/.test(value) || !/^(?:https?:\/\/|\/)/i.test(value))
16
+ return value;
17
+ try {
18
+ const source = new URL(value, frontend);
19
+ if (!/^https?:$/.test(source.protocol) || source.username || source.password)
20
+ return value;
21
+ const relative = value.startsWith("/") && !value.startsWith("//");
22
+ if (!relative && !frontends.has(source.origin))
23
+ return value;
24
+ const uploads = /\/(?:wp-content\/)?uploads\//i.test(source.pathname);
25
+ if (uploads && backend)
26
+ return `${backend.origin}${source.pathname}${source.search}${source.hash}`;
27
+ // Do not mistake a page such as /media/gallery/ for an asset alias.
28
+ if (source.pathname.startsWith(FLOWPRESS_MEDIA_PREFIX) && /\.[a-z0-9]+$/i.test(source.pathname) && media) {
29
+ const base = media.pathname.replace(/\/+$/, "");
30
+ return `${media.origin}${base}/${source.pathname.slice(FLOWPRESS_MEDIA_PREFIX.length)}${source.search}${source.hash}`;
31
+ }
32
+ return value;
33
+ }
34
+ catch {
35
+ return value;
36
+ }
37
+ };
38
+ }
39
+ catch {
40
+ return (value) => value;
41
+ }
42
+ }
43
+ export function rewriteFlowpressMediaUrl(value, options) {
44
+ return mediaResolver(options)(value);
45
+ }
46
+ /** Normalize media data once, sharing unchanged branches and parsing origins
47
+ * once per payload. HTML, CSS and scripts remain intact.
48
+ */
49
+ export function rewriteFlowpressMediaUrls(value, options) {
50
+ const resolve = mediaResolver(options);
51
+ function rewrite(item, key = "") {
52
+ if (typeof item === "string") {
53
+ return /^srcset$/i.test(key) ? item.replace(/\S+/g, (token) => {
54
+ const url = token.replace(/,+$/, "");
55
+ return `${resolve(url)}${token.slice(url.length)}`;
56
+ }) : resolve(item);
57
+ }
58
+ if (Array.isArray(item)) {
59
+ const next = item.map((entry) => rewrite(entry));
60
+ return next.some((entry, i) => entry !== item[i]) ? next : item;
61
+ }
62
+ if (item && typeof item === "object") {
63
+ let changed = false;
64
+ const next = Object.fromEntries(Object.entries(item).map(([name, entry]) => {
65
+ const result = rewrite(entry, name);
66
+ changed ||= result !== entry;
67
+ return [name, result];
68
+ }));
69
+ return changed ? next : item;
70
+ }
71
+ return item;
72
+ }
73
+ return rewrite(value);
74
+ }
75
+ export function isFlowpressUploadPath(pathname) {
76
+ return pathname === FLOWPRESS_UPLOADS_PREFIX.slice(0, -1)
77
+ || pathname.startsWith(FLOWPRESS_UPLOADS_PREFIX);
78
+ }
79
+ export function isFlowpressMediaPath(pathname) {
80
+ return pathname === FLOWPRESS_MEDIA_PREFIX.slice(0, -1)
81
+ || pathname.startsWith(FLOWPRESS_MEDIA_PREFIX);
82
+ }
83
+ export function rewriteFlowpressBackendUrl(value, backendUrl, frontendOrigin = "") {
84
+ try {
85
+ const source = new URL(value);
86
+ const backend = new URL(backendUrl);
87
+ if (source.origin !== backend.origin || /\/(?:wp-content\/)?uploads\//i.test(source.pathname))
88
+ return value;
89
+ return `${frontendOrigin.replace(/\/$/, "")}${source.pathname}${source.search}${source.hash}`;
90
+ }
91
+ catch {
92
+ return value;
93
+ }
94
+ }
95
+ /** Historical file URLs redirect to their real origin; editorial /media pages remain routes. */
96
+ export function redirectFlowpressMedia(request, options) {
97
+ const url = new URL(request.url);
98
+ const file = /\.[a-z0-9]{1,8}$/i.test(url.pathname);
99
+ if (!(isFlowpressUploadPath(url.pathname) || (isFlowpressMediaPath(url.pathname) && file)))
100
+ return null;
101
+ if (!["GET", "HEAD"].includes(request.method))
102
+ return new Response("Method Not Allowed", { status: 405, headers: { allow: "GET, HEAD" } });
103
+ const target = rewriteFlowpressMediaUrl(url.href, options);
104
+ return target === url.href ? null : Response.redirect(target, 308);
105
+ }
106
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAUhD;;;GAGG;AACH,SAAS,aAAa,CAAC,OAAsC;IAC3D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACrE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAChH,OAAO,CAAC,KAAK,EAAE,EAAE;YACf,0EAA0E;YAC1E,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAA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export const FLOWPRESS_UPLOADS_PREFIX = \"/app/uploads/\";\nexport const FLOWPRESS_MEDIA_PREFIX = \"/media/\";\n\nexport interface FlowpressFrontendMediaOptions {\n frontendOrigin: string;\n backendUrl?: string | undefined;\n mediaUrl?: string | undefined;\n /** Canonical frontend URLs and aliases owned by the selected backend. */\n frontendUrls?: readonly string[] | undefined;\n}\n\n/** Resolve legacy frontend media aliases to their real origin. Absolute URLs\n * supplied by WordPress/offload plugins remain authoritative, even in a mixed\n * library. FLOWPRESS_MEDIA is only used to undo the old /media/ alias.\n */\nfunction mediaResolver(options: FlowpressFrontendMediaOptions): (value: string) => string {\n try {\n const frontend = new URL(options.frontendOrigin);\n const backend = options.backendUrl ? new URL(options.backendUrl) : undefined;\n const media = options.mediaUrl ? new URL(options.mediaUrl) : backend;\n const frontends = new Set([frontend.origin, ...(options.frontendUrls ?? []).map((url) => new URL(url).origin)]);\n return (value) => {\n // Most JSON strings are labels, HTML or CSS: avoid parsing these as URLs.\n if (!value || /\\s/.test(value) || !/^(?:https?:\\/\\/|\\/)/i.test(value)) return value;\n try {\n const source = new URL(value, frontend);\n if (!/^https?:$/.test(source.protocol) || source.username || source.password) return value;\n const relative = value.startsWith(\"/\") && !value.startsWith(\"//\");\n if (!relative && !frontends.has(source.origin)) return value;\n const uploads = /\\/(?:wp-content\\/)?uploads\\//i.test(source.pathname);\n if (uploads && backend) return `${backend.origin}${source.pathname}${source.search}${source.hash}`;\n // Do not mistake a page such as /media/gallery/ for an asset alias.\n if (source.pathname.startsWith(FLOWPRESS_MEDIA_PREFIX) && /\\.[a-z0-9]+$/i.test(source.pathname) && media) {\n const base = media.pathname.replace(/\\/+$/, \"\");\n return `${media.origin}${base}/${source.pathname.slice(FLOWPRESS_MEDIA_PREFIX.length)}${source.search}${source.hash}`;\n }\n return value;\n } catch { return value; }\n };\n } catch { return (value) => value; }\n}\n\nexport function rewriteFlowpressMediaUrl(value: string, options: FlowpressFrontendMediaOptions): string {\n return mediaResolver(options)(value);\n}\n\n/** Normalize media data once, sharing unchanged branches and parsing origins\n * once per payload. HTML, CSS and scripts remain intact.\n */\nexport function rewriteFlowpressMediaUrls<T>(value: T, options: FlowpressFrontendMediaOptions): T {\n const resolve = mediaResolver(options);\n function rewrite(item: unknown, key = \"\"): unknown {\n if (typeof item === \"string\") {\n return /^srcset$/i.test(key) ? item.replace(/\\S+/g, (token) => {\n const url = token.replace(/,+$/, \"\");\n return `${resolve(url)}${token.slice(url.length)}`;\n }) : resolve(item);\n }\n if (Array.isArray(item)) {\n const next = item.map((entry) => rewrite(entry));\n return next.some((entry, i) => entry !== item[i]) ? next : item;\n }\n if (item && typeof item === \"object\") {\n let changed = false;\n const next = Object.fromEntries(Object.entries(item).map(([name, entry]) => {\n const result = rewrite(entry, name);\n changed ||= result !== entry;\n return [name, result];\n }));\n return changed ? next : item;\n }\n return item;\n }\n return rewrite(value) as T;\n}\n\nexport function isFlowpressUploadPath(pathname: string): boolean {\n return pathname === FLOWPRESS_UPLOADS_PREFIX.slice(0, -1)\n || pathname.startsWith(FLOWPRESS_UPLOADS_PREFIX);\n}\n\nexport function isFlowpressMediaPath(pathname: string): boolean {\n return pathname === FLOWPRESS_MEDIA_PREFIX.slice(0, -1)\n || pathname.startsWith(FLOWPRESS_MEDIA_PREFIX);\n}\n\nexport function rewriteFlowpressBackendUrl(\n value: string,\n backendUrl: string,\n frontendOrigin = \"\"\n): string {\n try {\n const source = new URL(value);\n const backend = new URL(backendUrl);\n if (source.origin !== backend.origin || /\\/(?:wp-content\\/)?uploads\\//i.test(source.pathname)) return value;\n return `${frontendOrigin.replace(/\\/$/, \"\")}${source.pathname}${source.search}${source.hash}`;\n } catch {\n return value;\n }\n}\n\n/** Historical file URLs redirect to their real origin; editorial /media pages remain routes. */\nexport function redirectFlowpressMedia(request: Request, options: FlowpressFrontendMediaOptions): Response | null {\n const url = new URL(request.url);\n const file = /\\.[a-z0-9]{1,8}$/i.test(url.pathname);\n if (!(isFlowpressUploadPath(url.pathname) || (isFlowpressMediaPath(url.pathname) && file))) return null;\n if (![\"GET\", \"HEAD\"].includes(request.method)) return new Response(\"Method Not Allowed\", { status: 405, headers: { allow: \"GET, HEAD\" } });\n const target = rewriteFlowpressMediaUrl(url.href, options);\n return target === url.href ? null : Response.redirect(target, 308);\n}\n"]}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Single source of truth for "may this page animate?".
3
+ *
4
+ * The default follows the OS (`prefers-reduced-motion`). A visitor's explicit
5
+ * choice from the accessibility panel wins in both directions and is stored in
6
+ * localStorage. The resolved value is mirrored on
7
+ * `<html data-sf-motion-preference="full|reduce">`, so CSS and scripts read the
8
+ * same state, and every change is announced with `sf:motion-change`.
9
+ *
10
+ * Do not read `matchMedia("(prefers-reduced-motion)")` or write a bare
11
+ * `@media (prefers-reduced-motion)` rule elsewhere: neither can be overridden
12
+ * by the visitor.
13
+ */
14
+ export declare const MOTION_STORAGE_KEY = "sf:motion";
15
+ export declare const MOTION_ATTRIBUTE = "data-sf-motion-preference";
16
+ export declare const MOTION_CHANGE_EVENT = "sf:motion-change";
17
+ export declare const MOTION_TOGGLE_SELECTOR = "[data-sf-motion-toggle]";
18
+ export declare const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
19
+ /** `full` animates, `reduce` keeps everything still. */
20
+ export type MotionPreference = "full" | "reduce";
21
+ export declare function isMotionPreference(value: unknown): value is MotionPreference;
22
+ /** An explicit choice beats the OS; without one the OS decides. */
23
+ export declare function resolveMotionPreference(stored: unknown, systemReduces: boolean): MotionPreference;
24
+ /**
25
+ * Inline script for `<head>`: mirrors the resolved preference on `<html>`
26
+ * before first paint, so nothing starts animating and then snaps to a stop.
27
+ */
28
+ export declare function motionPreferenceBootstrapScript(): string;
29
+ /** The browser surface this module needs, injectable for tests. */
30
+ export interface MotionEnvironment {
31
+ document: Pick<Document, "documentElement" | "dispatchEvent" | "addEventListener" | "removeEventListener">;
32
+ storage: Pick<Storage, "getItem" | "setItem"> | null;
33
+ media: Pick<MediaQueryList, "matches" | "addEventListener" | "removeEventListener"> | null;
34
+ }
35
+ export declare function browserMotionEnvironment(): MotionEnvironment;
36
+ /** The mirrored value when the bootstrap ran, otherwise resolved from storage and OS. */
37
+ export declare function getMotionPreference(env?: MotionEnvironment): MotionPreference;
38
+ /** Store an explicit choice and announce it. */
39
+ export declare function setMotionPreference(preference: MotionPreference, env?: MotionEnvironment): void;
40
+ /**
41
+ * Call `listener` whenever the effective preference changes: an explicit
42
+ * choice, or the OS setting while the visitor has not made one.
43
+ */
44
+ export declare function subscribeMotionPreference(listener: (preference: MotionPreference) => void, env?: MotionEnvironment): () => void;
45
+ /**
46
+ * Wire every server-rendered `[data-sf-motion-toggle]` switch: a click flips
47
+ * the preference, `aria-checked` mirrors it (checked means animations on).
48
+ */
49
+ export declare function initializeMotionToggles(scope?: ParentNode, env?: MotionEnvironment): () => void;
50
+ //# sourceMappingURL=motion-preference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion-preference.d.ts","sourceRoot":"","sources":["../src/motion-preference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AACtD,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAEvE,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E;AAED,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,gBAAgB,CAGjG;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAKxD;AAED,mEAAmE;AACnE,MAAM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