@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
@@ -1,14 +1,32 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import "./native/inline-text.css";
3
+ import { registerFlowpressRenderSvgMedia, type FlowpressSvgMediaLocals } from "../svg-media.js";
4
+ import Media from "./Media.astro";
5
+ import { decodeFlowpressText } from "../text.js";
6
+ import "./native/grid.css";
7
+ import "./native/group.css";
8
+ import StyleflowElement from "./StyleflowElement.astro";
3
9
  import type {
10
+ FlowpressBlockAdapters,
4
11
  FlowpressBlockRenderers,
5
12
  FlowpressIconRenderer
6
13
  } from "../block-renderers.js";
14
+ import {
15
+ flowpressAdapterCompatibilityIssue,
16
+ flowpressBlockTypeDescriptors
17
+ } from "../composition.js";
7
18
  import type { StyleflowContract } from "../styleflow.js";
8
- import type { FlowpressBlock } from "../types.js";
19
+ import type {
20
+ FlowpressBlock,
21
+ FlowpressBlockHtmlProps,
22
+ FlowpressCompositionV1,
23
+ FlowpressBlockTypeDescriptor
24
+ } from "../types.js";
25
+ import type { DynamicStyleflowProps } from "../styleflow.js";
9
26
  import ColumnBlock from "./blocks/ColumnBlock.astro";
10
27
  import CarouselBlock from "./blocks/CarouselBlock.astro";
11
28
  import CarouselItemBlock from "./blocks/CarouselItemBlock.astro";
29
+ import CoverBlock from "./blocks/CoverBlock.astro";
12
30
  import FormBlock from "./blocks/FormBlock.astro";
13
31
  import GridBlock from "./blocks/GridBlock.astro";
14
32
  import HeroBlock from "./blocks/HeroBlock.astro";
@@ -26,12 +44,51 @@ import {
26
44
 
27
45
  interface Props {
28
46
  blocks: FlowpressBlock[];
29
- contract?: StyleflowContract;
30
- blockRenderers?: FlowpressBlockRenderers;
31
- iconRenderer?: FlowpressIconRenderer;
47
+ descriptorIndex?: ReadonlyMap<string, FlowpressBlockTypeDescriptor> | undefined;
48
+ contract?: StyleflowContract | undefined;
49
+ blockRenderers?: FlowpressBlockRenderers | undefined;
50
+ iconRenderer?: FlowpressIconRenderer | undefined;
51
+ rootHtmlProps?: FlowpressBlockHtmlProps | undefined;
52
+ rootStyleflowProps?: DynamicStyleflowProps | undefined;
53
+ adapterDefinitions?: FlowpressBlockAdapters | undefined;
54
+ composition?: FlowpressCompositionV1 | undefined;
55
+ parentBlockName?: string | undefined;
56
+ production?: boolean | undefined;
57
+ depth?: number | undefined;
58
+ inheritedTone?: string | undefined;
59
+ skipCustomRendererFor?: string | undefined;
60
+ requireRegisteredAdapters?: boolean | undefined;
61
+ interactiveAncestor?: boolean | undefined;
32
62
  }
33
63
 
34
- const { blocks, contract, blockRenderers = {}, iconRenderer: IconRenderer } = Astro.props;
64
+ const {
65
+ blocks: rawBlocks,
66
+ contract,
67
+ blockRenderers = {},
68
+ iconRenderer: IconRenderer,
69
+ rootHtmlProps,
70
+ rootStyleflowProps,
71
+ adapterDefinitions,
72
+ composition,
73
+ parentBlockName,
74
+ production = import.meta.env.PROD,
75
+ depth = 0,
76
+ inheritedTone,
77
+ skipCustomRendererFor,
78
+ interactiveAncestor = false,
79
+ requireRegisteredAdapters = false
80
+ } = Astro.props;
81
+ registerFlowpressRenderSvgMedia(rawBlocks, Astro.locals as FlowpressSvgMediaLocals);
82
+
83
+ const { decorateGridBlocks } = await import("./native/grid.js");
84
+ const blocks = decorateGridBlocks(rawBlocks);
85
+ const { nativeBlockRenderers } = await import("./native/registry.js");
86
+ const effectiveRenderers = { ...nativeBlockRenderers, ...blockRenderers };
87
+ const descriptors = Astro.props.descriptorIndex ?? (composition ? flowpressBlockTypeDescriptors(composition) : undefined);
88
+
89
+ function objectCollection(value: unknown): Record<string, unknown>[] {
90
+ return Array.isArray(value) ? value.filter((item): item is Record<string, unknown> => !!item && typeof item === "object") : [];
91
+ }
35
92
 
36
93
  function youtubeEmbedUrl(value: unknown): string | null {
37
94
  try {
@@ -49,36 +106,114 @@ function youtubeEmbedUrl(value: unknown): string | null {
49
106
  return null;
50
107
  }
51
108
  }
109
+
110
+ function nestedRendererProps(nextParentBlockName: string, attrs: Record<string, unknown> = {}) {
111
+ return {
112
+ interactiveAncestor: interactiveAncestor || Boolean(attrs.interactivePriority && !["none", "inherit"].includes(String(attrs.interactivePriority))),
113
+ inheritedTone: typeof attrs.tone === "string" && attrs.tone !== "inherit" ? attrs.tone : inheritedTone,
114
+ adapterDefinitions,
115
+ composition,
116
+ parentBlockName: nextParentBlockName,
117
+ production,
118
+ depth: depth + 1,
119
+ requireRegisteredAdapters
120
+ };
121
+ }
52
122
  ---
53
123
 
54
- {blocks.map((block) => {
124
+ {blocks.map((block, index) => {
55
125
  const name = block.name.replace(/^sf\//, "");
56
- const children = block.innerBlocks ?? [];
57
- const genericSemantic = () => semanticProps(block.attributes, contract);
58
- const htmlAttributes = blockHtmlAttributes(block.attributes);
59
- const CustomBlockRenderer = blockRenderers[block.name];
126
+ const children = decorateGridBlocks(block.innerBlocks ?? []);
127
+ if (interactiveAncestor && /^(?:core|sf)\/(?:paragraph|heading)$/.test(block.name) && !block.attributes.foreground) block = {...block, attributes:{...block.attributes, foreground:"inherit"}};
128
+ const semantic = index === 0 && blocks.length === 1 && rootStyleflowProps
129
+ ? rootStyleflowProps
130
+ : semanticProps(block.attributes, contract,
131
+ block.name.startsWith("core/") && block.name !== "core/group" ? {} : undefined,
132
+ inheritedTone);
133
+ const htmlAttributes = index === 0 && blocks.length === 1 && rootHtmlProps
134
+ ? { ...rootHtmlProps, class: Array.from(new Set([rootHtmlProps.class, block.attributes.className].filter(Boolean).join(" ").split(/\s+/))).join(" ") }
135
+ : blockHtmlAttributes(block.attributes);
136
+ const CustomBlockRenderer = block.name === skipCustomRendererFor
137
+ ? nativeBlockRenderers[block.name as keyof typeof nativeBlockRenderers]
138
+ : effectiveRenderers[block.name as keyof typeof effectiveRenderers];
139
+ const compatibilityIssue = descriptors && adapterDefinitions
140
+ ? flowpressAdapterCompatibilityIssue(block.name, descriptors, adapterDefinitions)
141
+ : null;
142
+
143
+ if (compatibilityIssue && production && block.name !== skipCustomRendererFor) {
144
+ throw new Error(compatibilityIssue.message);
145
+ }
146
+
147
+ if (
148
+ requireRegisteredAdapters
149
+ && block.name !== skipCustomRendererFor
150
+ && (!adapterDefinitions?.[block.name] || !CustomBlockRenderer)
151
+ ) {
152
+ const message = compatibilityIssue?.message
153
+ ?? `Missing FlowPress block adapter for "${block.name}".`;
154
+ if (production) throw new Error(message);
155
+ return (
156
+ <aside data-flowpress-compatibility="missing-adapter" data-block-name={block.name} role="status">
157
+ <strong>{message}</strong>
158
+ <code>{compatibilityIssue?.command ?? `pnpm cms:block-adapter ${block.name}`}</code>
159
+ </aside>
160
+ );
161
+ }
60
162
 
61
163
  if (CustomBlockRenderer) {
62
164
  return (
63
- <CustomBlockRenderer block={block} contract={contract}>
64
- <Astro.self
165
+ <>
166
+ {compatibilityIssue ? (
167
+ <aside data-flowpress-compatibility={compatibilityIssue.code} data-block-name={block.name} role="status">
168
+ <strong>{compatibilityIssue.message}</strong>
169
+ <code>{compatibilityIssue.command}</code>
170
+ </aside>
171
+ ) : null}
172
+ <CustomBlockRenderer
173
+ block={block}
174
+ contract={contract}
175
+ composition={composition}
176
+ adapters={adapterDefinitions ?? {}}
177
+ htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
178
+ styleflowProps={semantic}
179
+ parentBlockName={parentBlockName}
180
+ context={{
181
+ ...(parentBlockName ? { parentBlockName } : {}),
182
+ depth,
183
+ production,
184
+ blockRenderers,
185
+ inheritedTone,
186
+ effectiveTone: typeof semantic.tone === "string" ? semantic.tone : inheritedTone
187
+ }}
188
+ >
189
+ <Astro.self descriptorIndex={descriptors}
65
190
  blocks={children}
66
191
  contract={contract}
67
192
  blockRenderers={blockRenderers}
68
193
  iconRenderer={IconRenderer}
194
+ adapterDefinitions={adapterDefinitions}
195
+ composition={composition}
196
+ parentBlockName={block.name}
197
+ production={production}
198
+ depth={depth + 1}
199
+ inheritedTone={typeof semantic.tone === "string" ? semantic.tone : inheritedTone}
200
+ interactiveAncestor={interactiveAncestor || Boolean(block.attributes.interactivePriority && !["none", "inherit"].includes(String(block.attributes.interactivePriority)))}
201
+ requireRegisteredAdapters={requireRegisteredAdapters}
69
202
  />
70
203
  </CustomBlockRenderer>
204
+ </>
71
205
  );
72
206
  }
73
207
 
74
208
  if (name === "hero") {
75
209
  return (
76
210
  <HeroBlock block={block} contract={contract}>
77
- <Astro.self
211
+ <Astro.self descriptorIndex={descriptors}
78
212
  blocks={children}
79
213
  contract={contract}
80
214
  blockRenderers={blockRenderers}
81
215
  iconRenderer={IconRenderer}
216
+ {...nestedRendererProps(block.name, block.attributes)}
82
217
  />
83
218
  </HeroBlock>
84
219
  );
@@ -87,11 +222,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
87
222
  if (name === "grid") {
88
223
  return (
89
224
  <GridBlock block={block} contract={contract}>
90
- <Astro.self
225
+ <Astro.self descriptorIndex={descriptors}
91
226
  blocks={children}
92
227
  contract={contract}
93
228
  blockRenderers={blockRenderers}
94
229
  iconRenderer={IconRenderer}
230
+ {...nestedRendererProps(block.name, block.attributes)}
95
231
  />
96
232
  </GridBlock>
97
233
  );
@@ -100,11 +236,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
100
236
  if (name === "column") {
101
237
  return (
102
238
  <ColumnBlock block={block} contract={contract}>
103
- <Astro.self
239
+ <Astro.self descriptorIndex={descriptors}
104
240
  blocks={children}
105
241
  contract={contract}
106
242
  blockRenderers={blockRenderers}
107
243
  iconRenderer={IconRenderer}
244
+ {...nestedRendererProps(block.name, block.attributes)}
108
245
  />
109
246
  </ColumnBlock>
110
247
  );
@@ -121,11 +258,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
121
258
  validChildren={invalidChildNames.length === 0}
122
259
  invalidChildNames={invalidChildNames}
123
260
  >
124
- <Astro.self
261
+ <Astro.self descriptorIndex={descriptors}
125
262
  blocks={children}
126
263
  contract={contract}
127
264
  blockRenderers={blockRenderers}
128
265
  iconRenderer={IconRenderer}
266
+ {...nestedRendererProps(block.name, block.attributes)}
129
267
  />
130
268
  </CarouselBlock>
131
269
  );
@@ -134,11 +272,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
134
272
  if (name === "carousel-item") {
135
273
  return (
136
274
  <CarouselItemBlock block={block} contract={contract}>
137
- <Astro.self
275
+ <Astro.self descriptorIndex={descriptors}
138
276
  blocks={children}
139
277
  contract={contract}
140
278
  blockRenderers={blockRenderers}
141
279
  iconRenderer={IconRenderer}
280
+ {...nestedRendererProps(block.name, block.attributes)}
142
281
  />
143
282
  </CarouselItemBlock>
144
283
  );
@@ -148,6 +287,25 @@ function youtubeEmbedUrl(value: unknown): string | null {
148
287
  return <NumberSpinnerBlock block={block} contract={contract} />;
149
288
  }
150
289
 
290
+ if (block.name === "core/cover") {
291
+ return (
292
+ <CoverBlock
293
+ block={block}
294
+ contract={contract}
295
+ htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
296
+ styleflowProps={semantic}
297
+ >
298
+ <Astro.self descriptorIndex={descriptors}
299
+ blocks={children}
300
+ contract={contract}
301
+ blockRenderers={blockRenderers}
302
+ iconRenderer={IconRenderer}
303
+ {...nestedRendererProps(block.name, block.attributes)}
304
+ />
305
+ </CoverBlock>
306
+ );
307
+ }
308
+
151
309
  if ([
152
310
  "heading",
153
311
  "rich-text",
@@ -160,11 +318,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
160
318
  ].includes(name)) {
161
319
  return (
162
320
  <TextBlock block={block} contract={contract} hasChildren={children.length > 0}>
163
- <Astro.self
321
+ <Astro.self descriptorIndex={descriptors}
164
322
  blocks={children}
165
323
  contract={contract}
166
324
  blockRenderers={blockRenderers}
167
325
  iconRenderer={IconRenderer}
326
+ {...nestedRendererProps(block.name, block.attributes)}
168
327
  />
169
328
  </TextBlock>
170
329
  );
@@ -188,13 +347,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
188
347
  const buttonContent = (
189
348
  <>
190
349
  {iconPosition === "before" ? buttonIcon : null}
191
- {textValue(block, "label")}
350
+ {decodeFlowpressText(textValue(block, "label"))}
192
351
  {iconPosition === "after" ? buttonIcon : null}
193
352
  </>
194
353
  );
195
354
  return href ? (
196
- <S
197
- as="a"
355
+ <StyleflowElement as="a"
198
356
  href={href}
199
357
  target={opensInNewTab ? "_blank" : undefined}
200
358
  rel={opensInNewTab ? "noopener noreferrer" : undefined}
@@ -202,17 +360,16 @@ function youtubeEmbedUrl(value: unknown): string | null {
202
360
  {...htmlAttributes}
203
361
  >
204
362
  {buttonContent}
205
- </S>
363
+ </StyleflowElement>
206
364
  ) : (
207
- <S
208
- as="span"
365
+ <StyleflowElement as="span"
209
366
  aria-disabled="true"
210
367
  data-flowpress-link-unresolved
211
368
  {...buttonSemantic}
212
369
  {...htmlAttributes}
213
370
  >
214
371
  {buttonContent}
215
- </S>
372
+ </StyleflowElement>
216
373
  );
217
374
  }
218
375
 
@@ -233,7 +390,7 @@ function youtubeEmbedUrl(value: unknown): string | null {
233
390
  name={icon}
234
391
  display={display}
235
392
  size={size}
236
- label={String(block.attributes.label ?? "").trim() || undefined}
393
+ label={decodeFlowpressText(block.attributes.label).trim() || undefined}
237
394
  {...iconSemantic}
238
395
  {...htmlAttributes}
239
396
  />
@@ -256,19 +413,19 @@ function youtubeEmbedUrl(value: unknown): string | null {
256
413
 
257
414
  if (name === "gallery") {
258
415
  const images = Array.isArray(block.attributes.images)
259
- ? block.attributes.images as Array<Record<string, unknown>>
416
+ ? objectCollection(block.attributes.images)
260
417
  : [];
261
418
  return (
262
- <S as="div" {...genericSemantic()} {...htmlAttributes}>
419
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
263
420
  {images.map((image) => image.url ? (
264
- <img
421
+ <Media
265
422
  src={String(image.url)}
266
- alt={String(image.alt ?? "")}
423
+ alt={decodeFlowpressText(image.alt)}
267
424
  loading="lazy"
268
425
  decoding="async"
269
426
  />
270
427
  ) : null)}
271
- </S>
428
+ </StyleflowElement>
272
429
  );
273
430
  }
274
431
 
@@ -276,7 +433,7 @@ function youtubeEmbedUrl(value: unknown): string | null {
276
433
  const video = objectValue(block, "video");
277
434
  const poster = objectValue(block, "poster");
278
435
  return video.url ? (
279
- <S as="div" {...genericSemantic()} {...htmlAttributes}>
436
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
280
437
  <video
281
438
  src={String(video.url)}
282
439
  poster={poster.url ? String(poster.url) : undefined}
@@ -285,30 +442,43 @@ function youtubeEmbedUrl(value: unknown): string | null {
285
442
  muted={Boolean(block.attributes.autoplay)}
286
443
  playsinline
287
444
  />
288
- </S>
445
+ </StyleflowElement>
289
446
  ) : null;
290
447
  }
291
448
 
292
449
  if (name === "video-youtube") {
293
450
  const embed = youtubeEmbedUrl(block.attributes.url);
294
451
  return embed ? (
295
- <S as="div" {...genericSemantic()} {...htmlAttributes}>
452
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
296
453
  <iframe
297
454
  src={embed}
298
- title={String(block.attributes.title ?? "YouTube video")}
455
+ title={decodeFlowpressText(block.attributes.title ?? "YouTube video")}
299
456
  loading="lazy"
300
457
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
301
458
  allowfullscreen
302
459
  />
303
- </S>
460
+ </StyleflowElement>
304
461
  ) : null;
305
462
  }
306
463
 
464
+ if (name === "media-text") {
465
+ const media = objectValue(block, "media");
466
+ const mediaNode = media.url ? <Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} width={media.width} height={media.height} loading="lazy" /> : null;
467
+ const contentNode = <StyleflowElement as="div">
468
+ <Astro.self descriptorIndex={descriptors} blocks={children} contract={contract} blockRenderers={blockRenderers} iconRenderer={IconRenderer} {...nestedRendererProps(block.name, block.attributes)} />
469
+ </StyleflowElement>;
470
+ return (
471
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes} data-flowpress-media-text>
472
+ {block.attributes.mediaPosition === "right" ? [contentNode, mediaNode] : [mediaNode, contentNode]}
473
+ </StyleflowElement>
474
+ );
475
+ }
476
+
307
477
  if (name === "chip") {
308
478
  return (
309
- <S as="span" {...genericSemantic()} {...htmlAttributes}>
310
- {textValue(block, "label")}
311
- </S>
479
+ <StyleflowElement as="span" {...semantic} {...htmlAttributes}>
480
+ {decodeFlowpressText(textValue(block, "label"))}
481
+ </StyleflowElement>
312
482
  );
313
483
  }
314
484
 
@@ -316,60 +486,63 @@ function youtubeEmbedUrl(value: unknown): string | null {
316
486
  const media = objectValue(block, "image");
317
487
  const href = linkValue(block);
318
488
  return (
319
- <S as="article" {...genericSemantic()} {...htmlAttributes}>
489
+ <StyleflowElement as="article" {...semantic} {...htmlAttributes}>
320
490
  {media.url && (
321
- <img src={String(media.url)} alt={String(media.alt ?? "")} loading="lazy" />
491
+ <Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} loading="lazy" />
322
492
  )}
323
- {block.attributes.title && <S as="h3">{String(block.attributes.title)}</S>}
324
- {block.attributes.text && <S as="p">{String(block.attributes.text)}</S>}
325
- {href && <S as="a" href={href}>Scopri</S>}
326
- </S>
493
+ {block.attributes.title && <StyleflowElement as="h3">{decodeFlowpressText(block.attributes.title)}</StyleflowElement>}
494
+ {block.attributes.text && <StyleflowElement as="p">{decodeFlowpressText(block.attributes.text)}</StyleflowElement>}
495
+ {href && <StyleflowElement as="a" href={href}>Scopri</StyleflowElement>}
496
+ </StyleflowElement>
327
497
  );
328
498
  }
329
499
 
330
500
  if (name === "content-list" || name === "term-list") {
331
501
  const items = Array.isArray(block.attributes.resolvedItems)
332
- ? block.attributes.resolvedItems as Array<Record<string, unknown>>
502
+ ? objectCollection(block.attributes.resolvedItems)
333
503
  : [];
334
504
  const resolvedBlocks = Array.isArray(block.attributes.resolvedBlocks)
335
505
  ? block.attributes.resolvedBlocks as FlowpressBlock[][]
336
506
  : [];
337
507
  return (
338
- <S as="ul" {...genericSemantic()} {...htmlAttributes}>
508
+ <StyleflowElement as="ul" {...semantic} {...htmlAttributes}>
339
509
  {items.map((item, index) => (
340
- <S as="li">
510
+ <StyleflowElement as="li">
341
511
  {resolvedBlocks[index]?.length ? (
342
- <Astro.self
512
+ <Astro.self descriptorIndex={descriptors}
343
513
  blocks={resolvedBlocks[index]}
344
514
  contract={contract}
345
515
  blockRenderers={blockRenderers}
346
516
  iconRenderer={IconRenderer}
517
+ {...nestedRendererProps(block.name, block.attributes)}
347
518
  />
348
519
  ) : (
349
520
  <ListItemFallback item={item} />
350
521
  )}
351
- </S>
522
+ </StyleflowElement>
352
523
  ))}
353
- </S>
524
+ </StyleflowElement>
354
525
  );
355
526
  }
356
527
 
357
528
  if (name === "template") {
358
529
  return Object.keys(htmlAttributes).length > 0 ? (
359
530
  <div {...htmlAttributes}>
360
- <Astro.self
531
+ <Astro.self descriptorIndex={descriptors}
361
532
  blocks={children}
362
533
  contract={contract}
363
534
  blockRenderers={blockRenderers}
364
535
  iconRenderer={IconRenderer}
536
+ {...nestedRendererProps(block.name, block.attributes)}
365
537
  />
366
538
  </div>
367
539
  ) : (
368
- <Astro.self
540
+ <Astro.self descriptorIndex={descriptors}
369
541
  blocks={children}
370
542
  contract={contract}
371
543
  blockRenderers={blockRenderers}
372
544
  iconRenderer={IconRenderer}
545
+ {...nestedRendererProps(block.name, block.attributes)}
373
546
  />
374
547
  );
375
548
  }
@@ -380,17 +553,18 @@ function youtubeEmbedUrl(value: unknown): string | null {
380
553
 
381
554
  if (name === "accordion-item") {
382
555
  return (
383
- <S as="div" {...genericSemantic()} {...htmlAttributes}>
556
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
384
557
  <details>
385
- <summary>{String(block.attributes.title ?? "")}</summary>
386
- <Astro.self
558
+ <summary>{decodeFlowpressText(block.attributes.title)}</summary>
559
+ <Astro.self descriptorIndex={descriptors}
387
560
  blocks={children}
388
561
  contract={contract}
389
562
  blockRenderers={blockRenderers}
390
563
  iconRenderer={IconRenderer}
564
+ {...nestedRendererProps(block.name, block.attributes)}
391
565
  />
392
566
  </details>
393
- </S>
567
+ </StyleflowElement>
394
568
  );
395
569
  }
396
570
 
@@ -411,42 +585,55 @@ function youtubeEmbedUrl(value: unknown): string | null {
411
585
  + `?key=${encodeURIComponent(googleMapsApiKey)}`
412
586
  + `&q=${encodeURIComponent(query)}`;
413
587
  return (
414
- <S as="div" {...genericSemantic()} {...htmlAttributes}>
588
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
415
589
  <iframe
416
590
  src={source}
417
591
  title={address || "Map"}
418
592
  loading="lazy"
419
593
  referrerpolicy="no-referrer-when-downgrade"
420
594
  />
421
- </S>
595
+ </StyleflowElement>
422
596
  );
423
597
  }
424
598
  return query ? (
425
- <S as="div" {...genericSemantic()} {...htmlAttributes}>
426
- <S
427
- as="a"
599
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
600
+ <StyleflowElement as="a"
428
601
  href={`https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`}
429
602
  rel="noreferrer"
430
603
  >
431
- {address || query}
432
- </S>
433
- </S>
604
+ {decodeFlowpressText(address || query)}
605
+ </StyleflowElement>
606
+ </StyleflowElement>
434
607
  ) : null;
435
608
  }
436
609
 
437
- const layoutTag = name === "section" ? "section" : "div";
438
- return (
439
- <S as={layoutTag} {...genericSemantic()} {...htmlAttributes}>
440
- {block.innerHtml && children.length === 0
441
- ? <S as="div" set:html={block.innerHtml} />
442
- : (
443
- <Astro.self
444
- blocks={children}
445
- contract={contract}
446
- blockRenderers={blockRenderers}
447
- iconRenderer={IconRenderer}
448
- />
449
- )}
450
- </S>
610
+ const fallbackContent = block.innerHtml && children.length === 0
611
+ ? <StyleflowElement as="div" set:html={block.innerHtml} />
612
+ : (
613
+ <Astro.self descriptorIndex={descriptors}
614
+ blocks={children}
615
+ contract={contract}
616
+ blockRenderers={blockRenderers}
617
+ iconRenderer={IconRenderer}
618
+ {...nestedRendererProps(block.name, block.attributes)}
619
+ />
620
+ );
621
+ return name === "section" ? (
622
+ <StyleflowElement as="section" {...semantic} {...htmlAttributes} data-flowpress-structural>{fallbackContent}</StyleflowElement>
623
+ ) : (
624
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes} data-flowpress-structural={["group", "flex"].includes(name) || undefined}>{fallbackContent}</StyleflowElement>
451
625
  );
452
626
  })}
627
+
628
+ <script>
629
+ import "./native/grid-bleed.js";
630
+ </script>
631
+
632
+ <style is:global>
633
+ [data-flowpress-media-text] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
634
+ @media (max-width: 40rem) { [data-flowpress-media-text] { grid-template-columns: minmax(0, 1fr); } }
635
+ </style>
636
+
637
+ <style is:global>
638
+ .flowpress-carousel:not(.is-initialized), .sf-carousel:not(.is-initialized), .flowpress-query-carousel:not(.is-initialized) { visibility: visible; }
639
+ </style>
@@ -0,0 +1,27 @@
1
+ ---
2
+ import StyleflowElement from "./StyleflowElement.astro";
3
+ import { resolveStyleFlowAstroPrimitive } from "@styleflow.app/astro";
4
+ import { decodeFlowpressText } from "../text.js";
5
+ import { flowpressSvgMediaProps, type FlowpressSvgMediaLocals } from "../svg-media.js";
6
+ interface Props { src?: unknown; [key: string]: unknown; }
7
+ const props = { ...Astro.props };
8
+ if (typeof props.alt === "string") props.alt = decodeFlowpressText(props.alt);
9
+ if (typeof props["aria-label"] === "string") props["aria-label"] = decodeFlowpressText(props["aria-label"]);
10
+ const svg = flowpressSvgMediaProps(props.src, props, Astro.locals as FlowpressSvgMediaLocals);
11
+ const svgAttributes = svg ? resolveStyleFlowAstroPrimitive({ ...svg.attributes, as: "img" }).attributes : {};
12
+ ---
13
+ {svg ? (
14
+ <svg {...svgAttributes}><Fragment set:html={svg.content} /></svg>
15
+ ) : (
16
+ <StyleflowElement as="img" {...props} />
17
+ )}
18
+ <script>
19
+ import { initializeFlowpressSvgMedia } from "../svg-media-runtime.js";
20
+ initializeFlowpressSvgMedia();
21
+ </script>
22
+ <style is:global>
23
+ @layer base {
24
+ :where(.flowpress-svg-media) { max-inline-size: 100%; block-size: auto; }
25
+ }
26
+ :where(.flowpress-svg-media) { overflow: hidden; vertical-align: middle; }
27
+ </style>
@@ -0,0 +1,25 @@
1
+ ---
2
+ import "./native/block-sizing.css";
3
+ import "./native/inline-text.css";
4
+ import { decodeFlowpressText } from "../text.js";
5
+ import { resolveStyleFlowAstroPrimitive } from "@styleflow.app/astro";
6
+
7
+ interface Props {
8
+ as: string;
9
+ [attribute: string]: unknown;
10
+ }
11
+ const props = { ...Astro.props } as Props;
12
+ for (const key of ["ty", "v", "w"]) {
13
+ if (props[key] === "" || props[key] === null) delete props[key];
14
+ }
15
+ for (const name of ["alt", "title", "aria-label", "placeholder"]) {
16
+ if (typeof props[name] === "string") props[name] = decodeFlowpressText(props[name]);
17
+ }
18
+ const { tag, attributes } = resolveStyleFlowAstroPrimitive(props);
19
+ if (["ty", "v", "w"].every((key) => props[key] === undefined)) {
20
+ for (const name of ["type", "variant", "weight", "style"]) delete attributes[`data-text-${name}`];
21
+ }
22
+ const Element = tag;
23
+ ---
24
+
25
+ <Element {...attributes}><slot /></Element>