@styleflow.app/flowpress-astro-core 1.0.0-beta.4 → 1.0.0-beta.41

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 (317) hide show
  1. package/CHANGELOG.md +249 -1
  2. package/README.md +104 -5
  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 +168 -0
  9. package/dist/astro/DefaultBlockAdapter.astro +37 -0
  10. package/dist/astro/FontStylesheets.astro +35 -0
  11. package/dist/astro/GutenbergRenderer.astro +267 -80
  12. package/dist/astro/Media.astro +27 -0
  13. package/dist/astro/StyleflowElement.astro +25 -0
  14. package/dist/astro/ThemeRuntime.astro +26 -0
  15. package/dist/astro/blocks/CarouselBlock.astro +11 -10
  16. package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
  17. package/dist/astro/blocks/ColumnBlock.astro +4 -5
  18. package/dist/astro/blocks/CoverBlock.astro +158 -0
  19. package/dist/astro/blocks/FormBlock.astro +23 -20
  20. package/dist/astro/blocks/GridBlock.astro +5 -4
  21. package/dist/astro/blocks/HeroBlock.astro +6 -6
  22. package/dist/astro/blocks/ImageBlock.astro +6 -6
  23. package/dist/astro/blocks/ListItemFallback.astro +9 -7
  24. package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
  25. package/dist/astro/blocks/SemanticElement.astro +35 -0
  26. package/dist/astro/blocks/SiteLogoBlock.astro +54 -0
  27. package/dist/astro/blocks/TextBlock.astro +33 -28
  28. package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
  29. package/dist/astro/blocks/cover.d.ts +13 -0
  30. package/dist/astro/blocks/cover.d.ts.map +1 -0
  31. package/dist/astro/blocks/cover.js +105 -0
  32. package/dist/astro/blocks/cover.js.map +1 -0
  33. package/dist/astro/blocks/cover.ts +119 -0
  34. package/dist/astro/blocks/helpers.d.ts +10 -1
  35. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  36. package/dist/astro/blocks/helpers.js +55 -39
  37. package/dist/astro/blocks/helpers.js.map +1 -1
  38. package/dist/astro/blocks/helpers.ts +69 -44
  39. package/dist/astro/motion/AccordionRuntime.astro +9 -0
  40. package/dist/astro/motion/MotionBoot.astro +21 -0
  41. package/dist/astro/motion/MotionRuntime.astro +31 -0
  42. package/dist/astro/motion/accordion.css +163 -0
  43. package/dist/astro/motion/accordion.d.ts +3 -0
  44. package/dist/astro/motion/accordion.d.ts.map +1 -0
  45. package/dist/astro/motion/accordion.js +98 -0
  46. package/dist/astro/motion/accordion.js.map +1 -0
  47. package/dist/astro/motion/accordion.ts +109 -0
  48. package/dist/astro/motion/motion-controller.d.ts +12 -0
  49. package/dist/astro/motion/motion-controller.d.ts.map +1 -0
  50. package/dist/astro/motion/motion-controller.js +293 -0
  51. package/dist/astro/motion/motion-controller.js.map +1 -0
  52. package/dist/astro/motion/motion-controller.ts +377 -0
  53. package/dist/astro/motion/motion.css +546 -0
  54. package/dist/astro/motion/motion.d.ts +127 -0
  55. package/dist/astro/motion/motion.d.ts.map +1 -0
  56. package/dist/astro/motion/motion.js +255 -0
  57. package/dist/astro/motion/motion.js.map +1 -0
  58. package/dist/astro/motion/motion.ts +419 -0
  59. package/dist/astro/native/Blob.astro +113 -0
  60. package/dist/astro/native/BlobBlock.astro +52 -0
  61. package/dist/astro/native/CustomFieldValue.astro +88 -0
  62. package/dist/astro/native/LevelTag.astro +20 -0
  63. package/dist/astro/native/MapBlock.astro +41 -0
  64. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  65. package/dist/astro/native/NativeIconBlock.astro +42 -0
  66. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  67. package/dist/astro/native/ReservedLogin.astro +107 -0
  68. package/dist/astro/native/ResolvedBlocks.astro +91 -0
  69. package/dist/astro/native/SyncedPatternContent.astro +94 -0
  70. package/dist/astro/native/TermFieldValue.astro +39 -0
  71. package/dist/astro/native/Timeline.astro +22 -0
  72. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  73. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  74. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  75. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  76. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  77. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  78. package/dist/astro/native/blob/config.d.ts +49 -0
  79. package/dist/astro/native/blob/config.d.ts.map +1 -0
  80. package/dist/astro/native/blob/config.js +86 -0
  81. package/dist/astro/native/blob/config.js.map +1 -0
  82. package/dist/astro/native/blob/config.ts +132 -0
  83. package/dist/astro/native/blob/controller.d.ts +11 -0
  84. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  85. package/dist/astro/native/blob/controller.js +240 -0
  86. package/dist/astro/native/blob/controller.js.map +1 -0
  87. package/dist/astro/native/blob/controller.ts +248 -0
  88. package/dist/astro/native/blob/geometry.d.ts +2 -0
  89. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  90. package/dist/astro/native/blob/geometry.js +2 -0
  91. package/dist/astro/native/blob/geometry.js.map +1 -0
  92. package/dist/astro/native/blob/geometry.ts +1 -0
  93. package/dist/astro/native/blob/ids.d.ts +7 -0
  94. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  95. package/dist/astro/native/blob/ids.js +11 -0
  96. package/dist/astro/native/blob/ids.js.map +1 -0
  97. package/dist/astro/native/blob/ids.ts +11 -0
  98. package/dist/astro/native/blob.css +83 -0
  99. package/dist/astro/native/block-sizing.css +34 -0
  100. package/dist/astro/native/button-template.d.ts +31 -0
  101. package/dist/astro/native/button-template.d.ts.map +1 -0
  102. package/dist/astro/native/button-template.js +54 -0
  103. package/dist/astro/native/button-template.js.map +1 -0
  104. package/dist/astro/native/button-template.ts +92 -0
  105. package/dist/astro/native/button.d.ts +13 -0
  106. package/dist/astro/native/button.d.ts.map +1 -0
  107. package/dist/astro/native/button.js +26 -0
  108. package/dist/astro/native/button.js.map +1 -0
  109. package/dist/astro/native/button.ts +26 -0
  110. package/dist/astro/native/core-block.astro +18 -0
  111. package/dist/astro/native/core-button-fallback.astro +43 -0
  112. package/dist/astro/native/core-button.astro +65 -0
  113. package/dist/astro/native/core-buttons.astro +14 -0
  114. package/dist/astro/native/core-group.astro +25 -0
  115. package/dist/astro/native/core-home-link.astro +12 -0
  116. package/dist/astro/native/core-html.astro +8 -0
  117. package/dist/astro/native/core-icon.astro +7 -0
  118. package/dist/astro/native/core-image.astro +137 -0
  119. package/dist/astro/native/core-navigation-link.astro +71 -0
  120. package/dist/astro/native/core-navigation-submenu.astro +33 -0
  121. package/dist/astro/native/core-navigation.astro +101 -0
  122. package/dist/astro/native/core-page-list-data-item.astro +19 -0
  123. package/dist/astro/native/core-page-list-item.astro +8 -0
  124. package/dist/astro/native/core-page-list.astro +40 -0
  125. package/dist/astro/native/core-post-date.astro +21 -0
  126. package/dist/astro/native/core-post-excerpt.astro +26 -0
  127. package/dist/astro/native/core-post-featured-image.astro +40 -0
  128. package/dist/astro/native/core-post-template-fallback.astro +30 -0
  129. package/dist/astro/native/core-post-template.astro +23 -0
  130. package/dist/astro/native/core-post-terms.astro +47 -0
  131. package/dist/astro/native/core-post-title.astro +23 -0
  132. package/dist/astro/native/core-query-no-results.astro +12 -0
  133. package/dist/astro/native/core-query.astro +22 -0
  134. package/dist/astro/native/core-separator.astro +18 -0
  135. package/dist/astro/native/core-site-title.astro +16 -0
  136. package/dist/astro/native/core-term-description.astro +12 -0
  137. package/dist/astro/native/core-term-name.astro +21 -0
  138. package/dist/astro/native/core-term-template.astro +30 -0
  139. package/dist/astro/native/core-terms-query.astro +19 -0
  140. package/dist/astro/native/core-transparent.astro +11 -0
  141. package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
  142. package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
  143. package/dist/astro/native/flowpress-navigation-controller.js +217 -0
  144. package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
  145. package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
  146. package/dist/astro/native/flowpress-navigation.css +17 -0
  147. package/dist/astro/native/grid-bleed.d.ts +2 -0
  148. package/dist/astro/native/grid-bleed.d.ts.map +1 -0
  149. package/dist/astro/native/grid-bleed.js +123 -0
  150. package/dist/astro/native/grid-bleed.js.map +1 -0
  151. package/dist/astro/native/grid.css +180 -0
  152. package/dist/astro/native/grid.d.ts +17 -0
  153. package/dist/astro/native/grid.d.ts.map +1 -0
  154. package/dist/astro/native/grid.js +103 -0
  155. package/dist/astro/native/grid.js.map +1 -0
  156. package/dist/astro/native/grid.ts +118 -0
  157. package/dist/astro/native/group.css +36 -0
  158. package/dist/astro/native/group.d.ts +15 -0
  159. package/dist/astro/native/group.d.ts.map +1 -0
  160. package/dist/astro/native/group.js +66 -0
  161. package/dist/astro/native/group.js.map +1 -0
  162. package/dist/astro/native/group.ts +61 -0
  163. package/dist/astro/native/html.d.ts +6 -0
  164. package/dist/astro/native/html.d.ts.map +1 -0
  165. package/dist/astro/native/html.js +10 -0
  166. package/dist/astro/native/html.js.map +1 -0
  167. package/dist/astro/native/html.ts +9 -0
  168. package/dist/astro/native/icon.d.ts +3 -0
  169. package/dist/astro/native/icon.d.ts.map +1 -0
  170. package/dist/astro/native/icon.js +23 -0
  171. package/dist/astro/native/icon.js.map +1 -0
  172. package/dist/astro/native/icon.ts +21 -0
  173. package/dist/astro/native/image.d.ts +5 -0
  174. package/dist/astro/native/image.d.ts.map +1 -0
  175. package/dist/astro/native/image.js +65 -0
  176. package/dist/astro/native/image.js.map +1 -0
  177. package/dist/astro/native/image.ts +56 -0
  178. package/dist/astro/native/inline-text.css +15 -0
  179. package/dist/astro/native/map.d.ts +14 -0
  180. package/dist/astro/native/map.d.ts.map +1 -0
  181. package/dist/astro/native/map.js +60 -0
  182. package/dist/astro/native/map.js.map +1 -0
  183. package/dist/astro/native/map.ts +70 -0
  184. package/dist/astro/native/motion-preference.d.ts +50 -0
  185. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  186. package/dist/astro/native/motion-preference.js +132 -0
  187. package/dist/astro/native/motion-preference.js.map +1 -0
  188. package/dist/astro/native/motion-preference.ts +158 -0
  189. package/dist/astro/native/motion.d.ts +101 -0
  190. package/dist/astro/native/motion.d.ts.map +1 -0
  191. package/dist/astro/native/motion.js +168 -0
  192. package/dist/astro/native/motion.js.map +1 -0
  193. package/dist/astro/native/motion.ts +312 -0
  194. package/dist/astro/native/query-carousel.d.ts +12 -0
  195. package/dist/astro/native/query-carousel.d.ts.map +1 -0
  196. package/dist/astro/native/query-carousel.js +36 -0
  197. package/dist/astro/native/query-carousel.js.map +1 -0
  198. package/dist/astro/native/query-carousel.ts +56 -0
  199. package/dist/astro/native/query-loop.d.ts +38 -0
  200. package/dist/astro/native/query-loop.d.ts.map +1 -0
  201. package/dist/astro/native/query-loop.js +20 -0
  202. package/dist/astro/native/query-loop.js.map +1 -0
  203. package/dist/astro/native/query-loop.ts +67 -0
  204. package/dist/astro/native/registry.d.ts +3 -0
  205. package/dist/astro/native/registry.d.ts.map +1 -0
  206. package/dist/astro/native/registry.js +81 -0
  207. package/dist/astro/native/registry.js.map +1 -0
  208. package/dist/astro/native/registry.ts +82 -0
  209. package/dist/astro/native/sf-block-binding.astro +20 -0
  210. package/dist/astro/native/sf-post-field.astro +9 -0
  211. package/dist/astro/native/sf-term-field.astro +9 -0
  212. package/dist/astro/native/timeline.css +4 -0
  213. package/dist/astro/native/timeline.d.ts +28 -0
  214. package/dist/astro/native/timeline.d.ts.map +1 -0
  215. package/dist/astro/native/timeline.js +43 -0
  216. package/dist/astro/native/timeline.js.map +1 -0
  217. package/dist/astro/native/timeline.ts +79 -0
  218. package/dist/astro/preferences/AccessibilityPanel.astro +105 -0
  219. package/dist/astro/preferences/ColorModeToggle.astro +26 -0
  220. package/dist/astro/preferences/MotionToggle.astro +27 -0
  221. package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
  222. package/dist/astro/preferences/ThemeToggle.astro +30 -0
  223. package/dist/astro/preferences/Toggle.astro +50 -0
  224. package/dist/astro/preferences/preferences.css +125 -0
  225. package/dist/block-renderers.d.ts +23 -3
  226. package/dist/block-renderers.d.ts.map +1 -1
  227. package/dist/block-renderers.js.map +1 -1
  228. package/dist/build-cache.d.ts +8 -0
  229. package/dist/build-cache.d.ts.map +1 -0
  230. package/dist/build-cache.js +81 -0
  231. package/dist/build-cache.js.map +1 -0
  232. package/dist/client.d.ts +23 -2
  233. package/dist/client.d.ts.map +1 -1
  234. package/dist/client.js +78 -39
  235. package/dist/client.js.map +1 -1
  236. package/dist/composition.d.ts +14 -0
  237. package/dist/composition.d.ts.map +1 -0
  238. package/dist/composition.js +125 -0
  239. package/dist/composition.js.map +1 -0
  240. package/dist/default-blocks.d.ts +9 -0
  241. package/dist/default-blocks.d.ts.map +1 -0
  242. package/dist/default-blocks.js +117 -0
  243. package/dist/default-blocks.js.map +1 -0
  244. package/dist/env.d.ts +9 -0
  245. package/dist/env.d.ts.map +1 -1
  246. package/dist/env.js +20 -0
  247. package/dist/env.js.map +1 -1
  248. package/dist/index.d.ts +7 -0
  249. package/dist/index.d.ts.map +1 -1
  250. package/dist/index.js +6 -0
  251. package/dist/index.js.map +1 -1
  252. package/dist/media.d.ts +20 -0
  253. package/dist/media.d.ts.map +1 -0
  254. package/dist/media.js +106 -0
  255. package/dist/media.js.map +1 -0
  256. package/dist/motion-preference.d.ts +50 -0
  257. package/dist/motion-preference.d.ts.map +1 -0
  258. package/dist/motion-preference.js +132 -0
  259. package/dist/motion-preference.js.map +1 -0
  260. package/dist/preferences-runtime.d.ts +3 -0
  261. package/dist/preferences-runtime.d.ts.map +1 -0
  262. package/dist/preferences-runtime.js +23 -0
  263. package/dist/preferences-runtime.js.map +1 -0
  264. package/dist/preferences-styleflow.d.ts +3 -0
  265. package/dist/preferences-styleflow.d.ts.map +1 -0
  266. package/dist/preferences-styleflow.js +14 -0
  267. package/dist/preferences-styleflow.js.map +1 -0
  268. package/dist/preferences.d.ts +4 -0
  269. package/dist/preferences.d.ts.map +1 -0
  270. package/dist/preferences.js +4 -0
  271. package/dist/preferences.js.map +1 -0
  272. package/dist/reserved-area.d.ts +10 -0
  273. package/dist/reserved-area.d.ts.map +1 -0
  274. package/dist/reserved-area.js +93 -0
  275. package/dist/reserved-area.js.map +1 -0
  276. package/dist/styleflow.d.ts +18 -1
  277. package/dist/styleflow.d.ts.map +1 -1
  278. package/dist/styleflow.js +82 -11
  279. package/dist/styleflow.js.map +1 -1
  280. package/dist/svg-media-runtime.d.ts +3 -0
  281. package/dist/svg-media-runtime.d.ts.map +1 -0
  282. package/dist/svg-media-runtime.js +33 -0
  283. package/dist/svg-media-runtime.js.map +1 -0
  284. package/dist/svg-media-types.d.ts +11 -0
  285. package/dist/svg-media-types.d.ts.map +1 -0
  286. package/dist/svg-media-types.js +2 -0
  287. package/dist/svg-media-types.js.map +1 -0
  288. package/dist/svg-media.d.ts +13 -0
  289. package/dist/svg-media.d.ts.map +1 -0
  290. package/dist/svg-media.js +47 -0
  291. package/dist/svg-media.js.map +1 -0
  292. package/dist/template-hierarchy.d.ts +0 -7
  293. package/dist/template-hierarchy.d.ts.map +1 -1
  294. package/dist/template-hierarchy.js +0 -21
  295. package/dist/template-hierarchy.js.map +1 -1
  296. package/dist/text.d.ts +3 -0
  297. package/dist/text.d.ts.map +1 -0
  298. package/dist/text.js +6 -0
  299. package/dist/text.js.map +1 -0
  300. package/dist/theme-runtime.d.ts +16 -0
  301. package/dist/theme-runtime.d.ts.map +1 -0
  302. package/dist/theme-runtime.js +100 -0
  303. package/dist/theme-runtime.js.map +1 -0
  304. package/dist/tsconfig.tsbuildinfo +1 -1
  305. package/dist/types.d.ts +75 -1
  306. package/dist/types.d.ts.map +1 -1
  307. package/dist/types.js.map +1 -1
  308. package/dist/vivid-colors-preference.d.ts +31 -0
  309. package/dist/vivid-colors-preference.d.ts.map +1 -0
  310. package/dist/vivid-colors-preference.js +102 -0
  311. package/dist/vivid-colors-preference.js.map +1 -0
  312. package/package.json +58 -7
  313. package/dist/astro/DefaultTemplate.astro +0 -42
  314. package/dist/templates.d.ts +0 -19
  315. package/dist/templates.d.ts.map +0 -1
  316. package/dist/templates.js +0 -20
  317. package/dist/templates.js.map +0 -1
@@ -0,0 +1,61 @@
1
+ /** Gutenberg Group, Row and Stack use the same core/group block. */
2
+ export function groupLength(value: unknown): string | undefined {
3
+ if (value === 0 || value === "0") return "0";
4
+ if (typeof value !== "string") return undefined;
5
+ const preset = /^var:preset\|spacing\|([a-zA-Z0-9_-]+)$/.exec(value);
6
+ if (preset) return `var(--wp--preset--spacing--${preset[1]})`;
7
+ const length = value.trim();
8
+ if (/^(?:\d+(?:\.\d+)?|\.\d+)(?:px|rem|em|%|vw|vh|svw|svh|dvw|dvh|ch|ex|cqw|cqh)$/.test(length)) return length;
9
+ // Accept CSS math and custom properties, never declarations or URLs.
10
+ if (/^(?:var|calc|min|max|clamp)\([\w\s.,%()+*/-]+\)$/.test(length)) return length;
11
+ return undefined;
12
+ }
13
+
14
+ export function nativeGroupProps(attributes: Record<string, any> = {}, htmlProps: Record<string, any> = {}, styleflowProps: Record<string, any> = {}) {
15
+ const layout = attributes.layout ?? {};
16
+ const type = ["flex", "grid", "constrained", "default"].includes(layout.type) ? layout.type : "constrained";
17
+ const vertical = layout.orientation === "vertical";
18
+ const justify = ["left", "center", "right", "space-between", "stretch"].includes(layout.justifyContent) ? layout.justifyContent : undefined;
19
+ const align = ["top", "center", "bottom", "space-between", "stretch"].includes(layout.verticalAlignment) ? layout.verticalAlignment : undefined;
20
+ const gap = attributes.noGap ? undefined : attributes.style?.spacing?.blockGap;
21
+ const rowGap = groupLength(typeof gap === "object" && gap !== null ? gap.top : gap);
22
+ const columnGap = groupLength(typeof gap === "object" && gap !== null ? gap.left : gap);
23
+ const contentSize = groupLength(layout.contentSize);
24
+ const wideSize = groupLength(layout.wideSize);
25
+ const role = String(styleflowProps.layoutRole ?? attributes.layoutRole ?? "none");
26
+ const density = String(styleflowProps.density ?? attributes.density ?? "regular");
27
+ const defaultGap = attributes.noGap ? "0" : /^[a-zA-Z0-9_-]+$/.test(role) && /^[a-zA-Z0-9_-]+$/.test(density)
28
+ ? `var(--sf-layout-${role}-${density}-gap, normal)` : "normal";
29
+ const variables = [
30
+ `--fp-group-default-gap:${defaultGap}`,
31
+ rowGap !== undefined ? `--fp-group-row-gap:${rowGap}` : "",
32
+ columnGap !== undefined ? `--fp-group-column-gap:${columnGap}` : "",
33
+ contentSize ? `--fp-group-content-size:${contentSize}` : "",
34
+ wideSize ? `--fp-group-wide-size:${wideSize}` : "",
35
+ ].filter(Boolean);
36
+ return {
37
+ ...htmlProps,
38
+ class: ["wp-block-group", "fp-native-group", htmlProps.class].filter(Boolean).join(" "),
39
+ "data-fp-group-layout": type === "flex" ? (vertical ? "vertical" : "horizontal") : type,
40
+ "data-fp-group-justify": justify,
41
+ "data-fp-group-align": align,
42
+ "data-fp-group-wrap": type === "flex" ? (layout.flexWrap === "nowrap" ? "nowrap" : "wrap") : undefined,
43
+ "data-fp-group-row-gap": rowGap !== undefined ? "true" : undefined,
44
+ "data-fp-group-column-gap": columnGap !== undefined ? "true" : undefined,
45
+ style: [htmlProps.style, ...variables].filter(Boolean).join(";") || undefined,
46
+ };
47
+ }
48
+
49
+ /** Native sizing controls on children of a flex Group. */
50
+ export function nativeFlexItemProps(attributes: Record<string, any>, htmlProps: Record<string, any>) {
51
+ const layout = attributes.style?.layout;
52
+ if (!layout || !["fit", "fill", "fixed"].includes(layout.selfStretch)) return htmlProps;
53
+ const size = groupLength(layout.flexSize);
54
+ return {
55
+ ...htmlProps,
56
+ "data-fp-flex-size": layout.selfStretch,
57
+ ...(layout.selfStretch === "fixed" && size !== undefined ? {
58
+ style: [htmlProps.style, `--fp-flex-basis:${size}`].filter(Boolean).join(";")
59
+ } : {}),
60
+ };
61
+ }
@@ -0,0 +1,6 @@
1
+ /** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */
2
+ export declare function nativeHtmlData(data?: Record<string, unknown> | null, legacyHtml?: string | null): {
3
+ html: string;
4
+ hidden: boolean;
5
+ };
6
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/astro/native/html.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAOnI"}
@@ -0,0 +1,10 @@
1
+ /** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */
2
+ export function nativeHtmlData(data, legacyHtml) {
3
+ return {
4
+ // Legacy FlowPress serialization supplies only wp_kses_post(innerHtml).
5
+ // A present resolver (including empty output) always takes precedence.
6
+ html: typeof data?.html === "string" ? data.html : data == null ? legacyHtml ?? "" : "",
7
+ hidden: data?.hidden === true,
8
+ };
9
+ }
10
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/astro/native/html.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,IAAqC,EAAE,UAA0B;IAC9F,OAAO;QACL,wEAAwE;QACxE,uEAAuE;QACvE,IAAI,EAAE,OAAO,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;QACvF,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["/** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */\nexport function nativeHtmlData(data?: Record<string, unknown> | null, legacyHtml?: string | null): { html: string; hidden: boolean } {\n return {\n // Legacy FlowPress serialization supplies only wp_kses_post(innerHtml).\n // A present resolver (including empty output) always takes precedence.\n html: typeof data?.html === \"string\" ? data.html : data == null ? legacyHtml ?? \"\" : \"\",\n hidden: data?.hidden === true,\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */
2
+ export function nativeHtmlData(data?: Record<string, unknown> | null, legacyHtml?: string | null): { html: string; hidden: boolean } {
3
+ return {
4
+ // Legacy FlowPress serialization supplies only wp_kses_post(innerHtml).
5
+ // A present resolver (including empty output) always takes precedence.
6
+ html: typeof data?.html === "string" ? data.html : data == null ? legacyHtml ?? "" : "",
7
+ hidden: data?.hidden === true,
8
+ };
9
+ }
@@ -0,0 +1,3 @@
1
+ export declare function nativeIconWidth(value: unknown): string | undefined;
2
+ export declare function nativeIconSvg(name: unknown, resolved: unknown, prefix: string): string | undefined;
3
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/astro/native/icon.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMlE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUlG"}
@@ -0,0 +1,23 @@
1
+ import { normalizeIconSvg, scopeIconSvgIds } from "@styleflow.app/flowpress-components/icon-svg";
2
+ export function nativeIconWidth(value) {
3
+ if (typeof value !== "string")
4
+ return undefined;
5
+ const match = value.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(px|rem|em|%|vw|vh)$/);
6
+ if (!match)
7
+ return undefined;
8
+ const limit = match[2] === "px" ? 1536 : ["%", "vw", "vh"].includes(match[2]) ? 100 : 96;
9
+ return Number(match[1]) > 0 && Number(match[1]) <= limit ? value.trim() : undefined;
10
+ }
11
+ export function nativeIconSvg(name, resolved, prefix) {
12
+ if (typeof name !== "string")
13
+ return undefined;
14
+ let svg;
15
+ if (!svg) {
16
+ const data = resolved && typeof resolved === "object" ? resolved : {};
17
+ if (data.name === name && data.empty === false && typeof data.svg === "string" && data.svg) {
18
+ svg = normalizeIconSvg(data.svg, name);
19
+ }
20
+ }
21
+ return svg ? scopeIconSvgIds(svg, prefix) : undefined;
22
+ }
23
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/astro/native/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAEjG,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1F,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAa,EAAE,QAAiB,EAAE,MAAc;IAC5E,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,GAAuB,CAAC;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,GAAG,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAmC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjG,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3F,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC","sourcesContent":["import { normalizeIconSvg, scopeIconSvgIds } from \"@styleflow.app/flowpress-components/icon-svg\";\n\nexport function nativeIconWidth(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?|\\.\\d+)(px|rem|em|%|vw|vh)$/);\n if (!match) return undefined;\n const limit = match[2] === \"px\" ? 1536 : [\"%\", \"vw\", \"vh\"].includes(match[2]!) ? 100 : 96;\n return Number(match[1]) > 0 && Number(match[1]) <= limit ? value.trim() : undefined;\n}\n\nexport function nativeIconSvg(name: unknown, resolved: unknown, prefix: string): string | undefined {\n if (typeof name !== \"string\") return undefined;\n let svg: string | undefined;\n if (!svg) {\n const data = resolved && typeof resolved === \"object\" ? resolved as Record<string, unknown> : {};\n if (data.name === name && data.empty === false && typeof data.svg === \"string\" && data.svg) {\n svg = normalizeIconSvg(data.svg, name);\n }\n }\n return svg ? scopeIconSvgIds(svg, prefix) : undefined;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { normalizeIconSvg, scopeIconSvgIds } from "@styleflow.app/flowpress-components/icon-svg";
2
+
3
+ export function nativeIconWidth(value: unknown): string | undefined {
4
+ if (typeof value !== "string") return undefined;
5
+ const match = value.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(px|rem|em|%|vw|vh)$/);
6
+ if (!match) return undefined;
7
+ const limit = match[2] === "px" ? 1536 : ["%", "vw", "vh"].includes(match[2]!) ? 100 : 96;
8
+ return Number(match[1]) > 0 && Number(match[1]) <= limit ? value.trim() : undefined;
9
+ }
10
+
11
+ export function nativeIconSvg(name: unknown, resolved: unknown, prefix: string): string | undefined {
12
+ if (typeof name !== "string") return undefined;
13
+ let svg: string | undefined;
14
+ if (!svg) {
15
+ const data = resolved && typeof resolved === "object" ? resolved as Record<string, unknown> : {};
16
+ if (data.name === name && data.empty === false && typeof data.svg === "string" && data.svg) {
17
+ svg = normalizeIconSvg(data.svg, name);
18
+ }
19
+ }
20
+ return svg ? scopeIconSvgIds(svg, prefix) : undefined;
21
+ }
@@ -0,0 +1,5 @@
1
+ export declare function imageAspectRatio(value: unknown): string | undefined;
2
+ export declare function imageDimension(value: unknown): string | undefined;
3
+ export declare function imageObjectPosition(value: unknown): string;
4
+ export declare function imageMediaStyle(attributes: Record<string, unknown>): Record<string, string>;
5
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/astro/native/image.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOnE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQjE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAM1D;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB3F"}
@@ -0,0 +1,65 @@
1
+ /** Presentation of the existing WordPress core/image attributes. */
2
+ const cssNumber = /^(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
3
+ const dimensionUnits = new Set(["px", "%", "em", "rem", "ex", "ch", "lh", "rlh", "vw", "vh", "vmin", "vmax", "vi", "vb", "svw", "svh", "lvw", "lvh", "dvw", "dvh", "cm", "mm", "q", "in", "pt", "pc"]);
4
+ function positiveNumber(value) {
5
+ const number = Number(value);
6
+ return cssNumber.test(value) && Number.isFinite(number) && number > 0 ? String(number) : undefined;
7
+ }
8
+ export function imageAspectRatio(value) {
9
+ if (typeof value !== "string" && typeof value !== "number")
10
+ return undefined;
11
+ const candidate = String(value).trim();
12
+ if (candidate === "auto")
13
+ return candidate;
14
+ const parts = candidate.split("/").map(part => positiveNumber(part.trim()));
15
+ if (parts.length === 1)
16
+ return parts[0];
17
+ return parts.length === 2 && parts[0] && parts[1] ? `${parts[0]} / ${parts[1]}` : undefined;
18
+ }
19
+ export function imageDimension(value) {
20
+ if (typeof value !== "string" && typeof value !== "number")
21
+ return undefined;
22
+ const candidate = String(value).trim().toLowerCase();
23
+ if (candidate === "auto")
24
+ return candidate;
25
+ const match = candidate.match(/^((?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)$/);
26
+ if (!match || !Number.isFinite(Number(match[1])))
27
+ return undefined;
28
+ const unit = match[2] || "px";
29
+ return dimensionUnits.has(unit) ? `${Number(match[1])}${unit}` : undefined;
30
+ }
31
+ export function imageObjectPosition(value) {
32
+ if (!value || typeof value !== "object" || Array.isArray(value))
33
+ return "50% 50%";
34
+ const { x, y } = value;
35
+ if (typeof x !== "number" || typeof y !== "number" || !Number.isFinite(x) || !Number.isFinite(y))
36
+ return "50% 50%";
37
+ const percentage = (coordinate) => Number((Math.min(1, Math.max(0, coordinate)) * 100).toFixed(6));
38
+ return `${percentage(x)}% ${percentage(y)}%`;
39
+ }
40
+ export function imageMediaStyle(attributes) {
41
+ const ratio = imageAspectRatio(attributes.aspectRatio);
42
+ const width = imageDimension(attributes.width);
43
+ const height = imageDimension(attributes.height);
44
+ const hasRatio = ratio !== undefined && ratio !== "auto";
45
+ const scale = ["cover", "contain", "fill"].includes(String(attributes.scale))
46
+ ? String(attributes.scale)
47
+ : hasRatio || (height !== undefined && height !== "auto") ? "cover" : undefined;
48
+ const style = {};
49
+ if (ratio)
50
+ style["aspect-ratio"] = ratio;
51
+ if (scale) {
52
+ style["object-fit"] = scale;
53
+ style["object-position"] = imageObjectPosition(attributes.focalPoint);
54
+ }
55
+ if (width !== undefined)
56
+ style.width = width;
57
+ else if (hasRatio && height !== undefined && height !== "auto")
58
+ style.width = "auto";
59
+ if (height !== undefined)
60
+ style.height = height;
61
+ else if (ratio || width !== undefined)
62
+ style.height = "auto";
63
+ return style;
64
+ }
65
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/astro/native/image.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,SAAS,GAAG,sCAAsC,CAAC;AACzD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEvM,SAAS,cAAc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M,CAAC;IAC7D,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/** Presentation of the existing WordPress core/image attributes. */\nconst cssNumber = /^(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?$/i;\nconst dimensionUnits = new Set([\"px\", \"%\", \"em\", \"rem\", \"ex\", \"ch\", \"lh\", \"rlh\", \"vw\", \"vh\", \"vmin\", \"vmax\", \"vi\", \"vb\", \"svw\", \"svh\", \"lvw\", \"lvh\", \"dvw\", \"dvh\", \"cm\", \"mm\", \"q\", \"in\", \"pt\", \"pc\"]);\n\nfunction positiveNumber(value: string): string | undefined {\n const number = Number(value);\n return cssNumber.test(value) && Number.isFinite(number) && number > 0 ? String(number) : undefined;\n}\n\nexport function imageAspectRatio(value: unknown): string | undefined {\n if (typeof value !== \"string\" && typeof value !== \"number\") return undefined;\n const candidate = String(value).trim();\n if (candidate === \"auto\") return candidate;\n const parts = candidate.split(\"/\").map(part => positiveNumber(part.trim()));\n if (parts.length === 1) return parts[0];\n return parts.length === 2 && parts[0] && parts[1] ? `${parts[0]} / ${parts[1]}` : undefined;\n}\n\nexport function imageDimension(value: unknown): string | undefined {\n if (typeof value !== \"string\" && typeof value !== \"number\") return undefined;\n const candidate = String(value).trim().toLowerCase();\n if (candidate === \"auto\") return candidate;\n const match = candidate.match(/^((?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)$/);\n if (!match || !Number.isFinite(Number(match[1]))) return undefined;\n const unit = match[2] || \"px\";\n return dimensionUnits.has(unit) ? `${Number(match[1])}${unit}` : undefined;\n}\n\nexport function imageObjectPosition(value: unknown): string {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return \"50% 50%\";\n const { x, y } = value as Record<string, unknown>;\n if (typeof x !== \"number\" || typeof y !== \"number\" || !Number.isFinite(x) || !Number.isFinite(y)) return \"50% 50%\";\n const percentage = (coordinate: number) => Number((Math.min(1, Math.max(0, coordinate)) * 100).toFixed(6));\n return `${percentage(x)}% ${percentage(y)}%`;\n}\n\nexport function imageMediaStyle(attributes: Record<string, unknown>): Record<string, string> {\n const ratio = imageAspectRatio(attributes.aspectRatio);\n const width = imageDimension(attributes.width);\n const height = imageDimension(attributes.height);\n const hasRatio = ratio !== undefined && ratio !== \"auto\";\n const scale = [\"cover\", \"contain\", \"fill\"].includes(String(attributes.scale))\n ? String(attributes.scale)\n : hasRatio || (height !== undefined && height !== \"auto\") ? \"cover\" : undefined;\n const style: Record<string, string> = {};\n if (ratio) style[\"aspect-ratio\"] = ratio;\n if (scale) {\n style[\"object-fit\"] = scale;\n style[\"object-position\"] = imageObjectPosition(attributes.focalPoint);\n }\n if (width !== undefined) style.width = width;\n else if (hasRatio && height !== undefined && height !== \"auto\") style.width = \"auto\";\n if (height !== undefined) style.height = height;\n else if (ratio || width !== undefined) style.height = \"auto\";\n return style;\n}\n"]}
@@ -0,0 +1,56 @@
1
+ /** Presentation of the existing WordPress core/image attributes. */
2
+ const cssNumber = /^(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
3
+ const dimensionUnits = new Set(["px", "%", "em", "rem", "ex", "ch", "lh", "rlh", "vw", "vh", "vmin", "vmax", "vi", "vb", "svw", "svh", "lvw", "lvh", "dvw", "dvh", "cm", "mm", "q", "in", "pt", "pc"]);
4
+
5
+ function positiveNumber(value: string): string | undefined {
6
+ const number = Number(value);
7
+ return cssNumber.test(value) && Number.isFinite(number) && number > 0 ? String(number) : undefined;
8
+ }
9
+
10
+ export function imageAspectRatio(value: unknown): string | undefined {
11
+ if (typeof value !== "string" && typeof value !== "number") return undefined;
12
+ const candidate = String(value).trim();
13
+ if (candidate === "auto") return candidate;
14
+ const parts = candidate.split("/").map(part => positiveNumber(part.trim()));
15
+ if (parts.length === 1) return parts[0];
16
+ return parts.length === 2 && parts[0] && parts[1] ? `${parts[0]} / ${parts[1]}` : undefined;
17
+ }
18
+
19
+ export function imageDimension(value: unknown): string | undefined {
20
+ if (typeof value !== "string" && typeof value !== "number") return undefined;
21
+ const candidate = String(value).trim().toLowerCase();
22
+ if (candidate === "auto") return candidate;
23
+ const match = candidate.match(/^((?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)$/);
24
+ if (!match || !Number.isFinite(Number(match[1]))) return undefined;
25
+ const unit = match[2] || "px";
26
+ return dimensionUnits.has(unit) ? `${Number(match[1])}${unit}` : undefined;
27
+ }
28
+
29
+ export function imageObjectPosition(value: unknown): string {
30
+ if (!value || typeof value !== "object" || Array.isArray(value)) return "50% 50%";
31
+ const { x, y } = value as Record<string, unknown>;
32
+ if (typeof x !== "number" || typeof y !== "number" || !Number.isFinite(x) || !Number.isFinite(y)) return "50% 50%";
33
+ const percentage = (coordinate: number) => Number((Math.min(1, Math.max(0, coordinate)) * 100).toFixed(6));
34
+ return `${percentage(x)}% ${percentage(y)}%`;
35
+ }
36
+
37
+ export function imageMediaStyle(attributes: Record<string, unknown>): Record<string, string> {
38
+ const ratio = imageAspectRatio(attributes.aspectRatio);
39
+ const width = imageDimension(attributes.width);
40
+ const height = imageDimension(attributes.height);
41
+ const hasRatio = ratio !== undefined && ratio !== "auto";
42
+ const scale = ["cover", "contain", "fill"].includes(String(attributes.scale))
43
+ ? String(attributes.scale)
44
+ : hasRatio || (height !== undefined && height !== "auto") ? "cover" : undefined;
45
+ const style: Record<string, string> = {};
46
+ if (ratio) style["aspect-ratio"] = ratio;
47
+ if (scale) {
48
+ style["object-fit"] = scale;
49
+ style["object-position"] = imageObjectPosition(attributes.focalPoint);
50
+ }
51
+ if (width !== undefined) style.width = width;
52
+ else if (hasRatio && height !== undefined && height !== "auto") style.width = "auto";
53
+ if (height !== undefined) style.height = height;
54
+ else if (ratio || width !== undefined) style.height = "auto";
55
+ return style;
56
+ }
@@ -0,0 +1,15 @@
1
+ /* Inline text inherits its typed ancestor; explicitly typed children retain their contract rules. */
2
+ @layer styleflow {
3
+ :where([data-text-style]) :is(a, strong, em) {
4
+ font-family: inherit;
5
+ font-size: inherit;
6
+ font-style: inherit;
7
+ font-weight: inherit;
8
+ line-height: inherit;
9
+ letter-spacing: inherit;
10
+ text-transform: inherit;
11
+ font-variation-settings: inherit;
12
+ }
13
+ :where([data-text-style]) strong { font-weight: var(--sf-text-body-md-strong-font-weight, bolder); }
14
+ :where([data-text-style]) em { font-style: italic; }
15
+ }
@@ -0,0 +1,14 @@
1
+ export type MapAttributes = {
2
+ address?: unknown;
3
+ latitude?: unknown;
4
+ longitude?: unknown;
5
+ provider?: unknown;
6
+ zoom?: unknown;
7
+ };
8
+ export declare function resolveMap(attributes: MapAttributes, googleKey?: string): {
9
+ address: string;
10
+ query: string;
11
+ iframeSrc: string;
12
+ linkHref: string;
13
+ };
14
+ //# sourceMappingURL=map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/astro/native/map.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAeF,wBAAgB,UAAU,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,SAAK;;;;;EAgDnE"}
@@ -0,0 +1,60 @@
1
+ const coordinate = (value, limit) => {
2
+ if (typeof value !== "string" && typeof value !== "number")
3
+ return null;
4
+ const normalized = String(value).trim().replace(",", ".");
5
+ if (!normalized)
6
+ return null;
7
+ const number = Number(normalized);
8
+ return Number.isFinite(number) && Math.abs(number) <= limit ? number : null;
9
+ };
10
+ const zoomValue = (value) => {
11
+ const number = Number(value);
12
+ return Number.isFinite(number) ? Math.max(1, Math.min(20, Math.round(number))) : 14;
13
+ };
14
+ export function resolveMap(attributes, googleKey = "") {
15
+ const address = typeof attributes.address === "string" ? attributes.address.trim() : "";
16
+ const latitude = coordinate(attributes.latitude, 90);
17
+ const longitude = coordinate(attributes.longitude, 180);
18
+ const hasCoordinates = latitude !== null && longitude !== null;
19
+ const query = hasCoordinates ? `${latitude},${longitude}` : address;
20
+ const provider = attributes.provider === "google" ? "google" : "openstreetmap";
21
+ const zoom = zoomValue(attributes.zoom);
22
+ if (!query)
23
+ return { address, query, iframeSrc: "", linkHref: "" };
24
+ if (provider === "google") {
25
+ const link = new URL("https://www.google.com/maps/search/");
26
+ link.search = new URLSearchParams({ api: "1", query }).toString();
27
+ const embed = new URL("https://www.google.com/maps/embed/v1/place");
28
+ embed.search = new URLSearchParams({ key: googleKey, q: query, zoom: String(zoom) }).toString();
29
+ return {
30
+ address,
31
+ query,
32
+ iframeSrc: googleKey.trim() ? embed.toString() : "",
33
+ linkHref: link.toString(),
34
+ };
35
+ }
36
+ if (!hasCoordinates) {
37
+ return {
38
+ address,
39
+ query,
40
+ iframeSrc: "",
41
+ linkHref: `https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`,
42
+ };
43
+ }
44
+ const halfDelta = Math.max(0.001, 180 / 2 ** zoom);
45
+ const bbox = [
46
+ Math.max(-180, longitude - halfDelta),
47
+ Math.max(-90, latitude - halfDelta),
48
+ Math.min(180, longitude + halfDelta),
49
+ Math.min(90, latitude + halfDelta),
50
+ ].join(",");
51
+ const embed = new URL("https://www.openstreetmap.org/export/embed.html");
52
+ embed.search = new URLSearchParams({ bbox, layer: "mapnik", marker: query }).toString();
53
+ return {
54
+ address,
55
+ query,
56
+ iframeSrc: embed.toString(),
57
+ linkHref: `https://www.openstreetmap.org/?mlat=${latitude}&mlon=${longitude}#map=${zoom}/${latitude}/${longitude}`,
58
+ };
59
+ }
60
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../../../src/astro/native/map.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,KAAa,EAAiB,EAAE;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,EAAE,8CAA8C,kBAAkB,CAAC,KAAK,CAAC,EAAE;SACpF,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG;QACX,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,QAAQ,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,SAAS,CAAC;KACnC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,iDAAiD,CAAC,CAAC;IACzE,KAAK,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IACxF,OAAO;QACL,OAAO;QACP,KAAK;QACL,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE;QAC3B,QAAQ,EAAE,uCAAuC,QAAQ,SAAS,SAAS,QAAQ,IAAI,IAAI,QAAQ,IAAI,SAAS,EAAE;KACnH,CAAC;AACJ,CAAC","sourcesContent":["export type MapAttributes = {\n address?: unknown;\n latitude?: unknown;\n longitude?: unknown;\n provider?: unknown;\n zoom?: unknown;\n};\n\nconst coordinate = (value: unknown, limit: number): number | null => {\n if (typeof value !== \"string\" && typeof value !== \"number\") return null;\n const normalized = String(value).trim().replace(\",\", \".\");\n if (!normalized) return null;\n const number = Number(normalized);\n return Number.isFinite(number) && Math.abs(number) <= limit ? number : null;\n};\n\nconst zoomValue = (value: unknown): number => {\n const number = Number(value);\n return Number.isFinite(number) ? Math.max(1, Math.min(20, Math.round(number))) : 14;\n};\n\nexport function resolveMap(attributes: MapAttributes, googleKey = \"\") {\n const address = typeof attributes.address === \"string\" ? attributes.address.trim() : \"\";\n const latitude = coordinate(attributes.latitude, 90);\n const longitude = coordinate(attributes.longitude, 180);\n const hasCoordinates = latitude !== null && longitude !== null;\n const query = hasCoordinates ? `${latitude},${longitude}` : address;\n const provider = attributes.provider === \"google\" ? \"google\" : \"openstreetmap\";\n const zoom = zoomValue(attributes.zoom);\n\n if (!query) return { address, query, iframeSrc: \"\", linkHref: \"\" };\n\n if (provider === \"google\") {\n const link = new URL(\"https://www.google.com/maps/search/\");\n link.search = new URLSearchParams({ api: \"1\", query }).toString();\n const embed = new URL(\"https://www.google.com/maps/embed/v1/place\");\n embed.search = new URLSearchParams({ key: googleKey, q: query, zoom: String(zoom) }).toString();\n return {\n address,\n query,\n iframeSrc: googleKey.trim() ? embed.toString() : \"\",\n linkHref: link.toString(),\n };\n }\n\n if (!hasCoordinates) {\n return {\n address,\n query,\n iframeSrc: \"\",\n linkHref: `https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`,\n };\n }\n\n const halfDelta = Math.max(0.001, 180 / 2 ** zoom);\n const bbox = [\n Math.max(-180, longitude - halfDelta),\n Math.max(-90, latitude - halfDelta),\n Math.min(180, longitude + halfDelta),\n Math.min(90, latitude + halfDelta),\n ].join(\",\");\n const embed = new URL(\"https://www.openstreetmap.org/export/embed.html\");\n embed.search = new URLSearchParams({ bbox, layer: \"mapnik\", marker: query }).toString();\n return {\n address,\n query,\n iframeSrc: embed.toString(),\n linkHref: `https://www.openstreetmap.org/?mlat=${latitude}&mlon=${longitude}#map=${zoom}/${latitude}/${longitude}`,\n };\n}\n"]}
@@ -0,0 +1,70 @@
1
+ export type MapAttributes = {
2
+ address?: unknown;
3
+ latitude?: unknown;
4
+ longitude?: unknown;
5
+ provider?: unknown;
6
+ zoom?: unknown;
7
+ };
8
+
9
+ const coordinate = (value: unknown, limit: number): number | null => {
10
+ if (typeof value !== "string" && typeof value !== "number") return null;
11
+ const normalized = String(value).trim().replace(",", ".");
12
+ if (!normalized) return null;
13
+ const number = Number(normalized);
14
+ return Number.isFinite(number) && Math.abs(number) <= limit ? number : null;
15
+ };
16
+
17
+ const zoomValue = (value: unknown): number => {
18
+ const number = Number(value);
19
+ return Number.isFinite(number) ? Math.max(1, Math.min(20, Math.round(number))) : 14;
20
+ };
21
+
22
+ export function resolveMap(attributes: MapAttributes, googleKey = "") {
23
+ const address = typeof attributes.address === "string" ? attributes.address.trim() : "";
24
+ const latitude = coordinate(attributes.latitude, 90);
25
+ const longitude = coordinate(attributes.longitude, 180);
26
+ const hasCoordinates = latitude !== null && longitude !== null;
27
+ const query = hasCoordinates ? `${latitude},${longitude}` : address;
28
+ const provider = attributes.provider === "google" ? "google" : "openstreetmap";
29
+ const zoom = zoomValue(attributes.zoom);
30
+
31
+ if (!query) return { address, query, iframeSrc: "", linkHref: "" };
32
+
33
+ if (provider === "google") {
34
+ const link = new URL("https://www.google.com/maps/search/");
35
+ link.search = new URLSearchParams({ api: "1", query }).toString();
36
+ const embed = new URL("https://www.google.com/maps/embed/v1/place");
37
+ embed.search = new URLSearchParams({ key: googleKey, q: query, zoom: String(zoom) }).toString();
38
+ return {
39
+ address,
40
+ query,
41
+ iframeSrc: googleKey.trim() ? embed.toString() : "",
42
+ linkHref: link.toString(),
43
+ };
44
+ }
45
+
46
+ if (!hasCoordinates) {
47
+ return {
48
+ address,
49
+ query,
50
+ iframeSrc: "",
51
+ linkHref: `https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`,
52
+ };
53
+ }
54
+
55
+ const halfDelta = Math.max(0.001, 180 / 2 ** zoom);
56
+ const bbox = [
57
+ Math.max(-180, longitude - halfDelta),
58
+ Math.max(-90, latitude - halfDelta),
59
+ Math.min(180, longitude + halfDelta),
60
+ Math.min(90, latitude + halfDelta),
61
+ ].join(",");
62
+ const embed = new URL("https://www.openstreetmap.org/export/embed.html");
63
+ embed.search = new URLSearchParams({ bbox, layer: "mapnik", marker: query }).toString();
64
+ return {
65
+ address,
66
+ query,
67
+ iframeSrc: embed.toString(),
68
+ linkHref: `https://www.openstreetmap.org/?mlat=${latitude}&mlon=${longitude}#map=${zoom}/${latitude}/${longitude}`,
69
+ };
70
+ }
@@ -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/astro/native/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;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