@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,180 @@
1
+ /* Shared by Gutenberg, WordPress output and Astro. Geometry only; Styleflow owns spacing. */
2
+ [data-layout-role="container"], .sf-container { container: sf-container / inline-size; }
3
+ .fp-grid { display: grid !important; --fp-current-cols: 1; grid-template-columns: repeat(var(--fp-current-cols), minmax(0, 1fr)) !important; }
4
+ .fp-grid > .fp-grid-item { min-width: 0; --fp-used-span: 1; grid-column: span var(--fp-used-span) !important; }
5
+ .fp-align-start { align-items: start; }
6
+ .fp-align-center { align-items: center; }
7
+ .fp-align-end { align-items: end; }
8
+ .fp-align-stretch { align-items: stretch; }
9
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
10
+ .fp-cols-base-1 { --fp-current-cols: 1; }
11
+ .fp-grid > .fp-used-span-base-1 { --fp-used-span: 1; }
12
+ .fp-cols-base-2 { --fp-current-cols: 2; }
13
+ .fp-grid > .fp-used-span-base-2 { --fp-used-span: 2; }
14
+ .fp-cols-base-3 { --fp-current-cols: 3; }
15
+ .fp-grid > .fp-used-span-base-3 { --fp-used-span: 3; }
16
+ .fp-cols-base-4 { --fp-current-cols: 4; }
17
+ .fp-grid > .fp-used-span-base-4 { --fp-used-span: 4; }
18
+ .fp-cols-base-5 { --fp-current-cols: 5; }
19
+ .fp-grid > .fp-used-span-base-5 { --fp-used-span: 5; }
20
+ .fp-cols-base-6 { --fp-current-cols: 6; }
21
+ .fp-grid > .fp-used-span-base-6 { --fp-used-span: 6; }
22
+ .fp-cols-base-7 { --fp-current-cols: 7; }
23
+ .fp-grid > .fp-used-span-base-7 { --fp-used-span: 7; }
24
+ .fp-cols-base-8 { --fp-current-cols: 8; }
25
+ .fp-grid > .fp-used-span-base-8 { --fp-used-span: 8; }
26
+ .fp-cols-base-9 { --fp-current-cols: 9; }
27
+ .fp-grid > .fp-used-span-base-9 { --fp-used-span: 9; }
28
+ .fp-cols-base-10 { --fp-current-cols: 10; }
29
+ .fp-grid > .fp-used-span-base-10 { --fp-used-span: 10; }
30
+ .fp-cols-base-11 { --fp-current-cols: 11; }
31
+ .fp-grid > .fp-used-span-base-11 { --fp-used-span: 11; }
32
+ .fp-cols-base-12 { --fp-current-cols: 12; }
33
+ .fp-grid > .fp-used-span-base-12 { --fp-used-span: 12; }
34
+ @media (width < 640px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-base-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
35
+ @media (width < 640px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-base-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
36
+ @media (min-width: 640px) {
37
+ .fp-cols-sm-1 { --fp-current-cols: 1; }
38
+ .fp-grid > .fp-used-span-sm-1 { --fp-used-span: 1; }
39
+ .fp-cols-sm-2 { --fp-current-cols: 2; }
40
+ .fp-grid > .fp-used-span-sm-2 { --fp-used-span: 2; }
41
+ .fp-cols-sm-3 { --fp-current-cols: 3; }
42
+ .fp-grid > .fp-used-span-sm-3 { --fp-used-span: 3; }
43
+ .fp-cols-sm-4 { --fp-current-cols: 4; }
44
+ .fp-grid > .fp-used-span-sm-4 { --fp-used-span: 4; }
45
+ .fp-cols-sm-5 { --fp-current-cols: 5; }
46
+ .fp-grid > .fp-used-span-sm-5 { --fp-used-span: 5; }
47
+ .fp-cols-sm-6 { --fp-current-cols: 6; }
48
+ .fp-grid > .fp-used-span-sm-6 { --fp-used-span: 6; }
49
+ .fp-cols-sm-7 { --fp-current-cols: 7; }
50
+ .fp-grid > .fp-used-span-sm-7 { --fp-used-span: 7; }
51
+ .fp-cols-sm-8 { --fp-current-cols: 8; }
52
+ .fp-grid > .fp-used-span-sm-8 { --fp-used-span: 8; }
53
+ .fp-cols-sm-9 { --fp-current-cols: 9; }
54
+ .fp-grid > .fp-used-span-sm-9 { --fp-used-span: 9; }
55
+ .fp-cols-sm-10 { --fp-current-cols: 10; }
56
+ .fp-grid > .fp-used-span-sm-10 { --fp-used-span: 10; }
57
+ .fp-cols-sm-11 { --fp-current-cols: 11; }
58
+ .fp-grid > .fp-used-span-sm-11 { --fp-used-span: 11; }
59
+ .fp-cols-sm-12 { --fp-current-cols: 12; }
60
+ .fp-grid > .fp-used-span-sm-12 { --fp-used-span: 12; }
61
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
62
+ @media (width < 768px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-sm-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
63
+ @media (width < 768px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-sm-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
64
+ }
65
+ @media (min-width: 768px) {
66
+ .fp-cols-md-1 { --fp-current-cols: 1; }
67
+ .fp-grid > .fp-used-span-md-1 { --fp-used-span: 1; }
68
+ .fp-cols-md-2 { --fp-current-cols: 2; }
69
+ .fp-grid > .fp-used-span-md-2 { --fp-used-span: 2; }
70
+ .fp-cols-md-3 { --fp-current-cols: 3; }
71
+ .fp-grid > .fp-used-span-md-3 { --fp-used-span: 3; }
72
+ .fp-cols-md-4 { --fp-current-cols: 4; }
73
+ .fp-grid > .fp-used-span-md-4 { --fp-used-span: 4; }
74
+ .fp-cols-md-5 { --fp-current-cols: 5; }
75
+ .fp-grid > .fp-used-span-md-5 { --fp-used-span: 5; }
76
+ .fp-cols-md-6 { --fp-current-cols: 6; }
77
+ .fp-grid > .fp-used-span-md-6 { --fp-used-span: 6; }
78
+ .fp-cols-md-7 { --fp-current-cols: 7; }
79
+ .fp-grid > .fp-used-span-md-7 { --fp-used-span: 7; }
80
+ .fp-cols-md-8 { --fp-current-cols: 8; }
81
+ .fp-grid > .fp-used-span-md-8 { --fp-used-span: 8; }
82
+ .fp-cols-md-9 { --fp-current-cols: 9; }
83
+ .fp-grid > .fp-used-span-md-9 { --fp-used-span: 9; }
84
+ .fp-cols-md-10 { --fp-current-cols: 10; }
85
+ .fp-grid > .fp-used-span-md-10 { --fp-used-span: 10; }
86
+ .fp-cols-md-11 { --fp-current-cols: 11; }
87
+ .fp-grid > .fp-used-span-md-11 { --fp-used-span: 11; }
88
+ .fp-cols-md-12 { --fp-current-cols: 12; }
89
+ .fp-grid > .fp-used-span-md-12 { --fp-used-span: 12; }
90
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
91
+ @media (width < 1024px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-md-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
92
+ @media (width < 1024px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-md-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
93
+ }
94
+ @media (min-width: 1024px) {
95
+ .fp-cols-lg-1 { --fp-current-cols: 1; }
96
+ .fp-grid > .fp-used-span-lg-1 { --fp-used-span: 1; }
97
+ .fp-cols-lg-2 { --fp-current-cols: 2; }
98
+ .fp-grid > .fp-used-span-lg-2 { --fp-used-span: 2; }
99
+ .fp-cols-lg-3 { --fp-current-cols: 3; }
100
+ .fp-grid > .fp-used-span-lg-3 { --fp-used-span: 3; }
101
+ .fp-cols-lg-4 { --fp-current-cols: 4; }
102
+ .fp-grid > .fp-used-span-lg-4 { --fp-used-span: 4; }
103
+ .fp-cols-lg-5 { --fp-current-cols: 5; }
104
+ .fp-grid > .fp-used-span-lg-5 { --fp-used-span: 5; }
105
+ .fp-cols-lg-6 { --fp-current-cols: 6; }
106
+ .fp-grid > .fp-used-span-lg-6 { --fp-used-span: 6; }
107
+ .fp-cols-lg-7 { --fp-current-cols: 7; }
108
+ .fp-grid > .fp-used-span-lg-7 { --fp-used-span: 7; }
109
+ .fp-cols-lg-8 { --fp-current-cols: 8; }
110
+ .fp-grid > .fp-used-span-lg-8 { --fp-used-span: 8; }
111
+ .fp-cols-lg-9 { --fp-current-cols: 9; }
112
+ .fp-grid > .fp-used-span-lg-9 { --fp-used-span: 9; }
113
+ .fp-cols-lg-10 { --fp-current-cols: 10; }
114
+ .fp-grid > .fp-used-span-lg-10 { --fp-used-span: 10; }
115
+ .fp-cols-lg-11 { --fp-current-cols: 11; }
116
+ .fp-grid > .fp-used-span-lg-11 { --fp-used-span: 11; }
117
+ .fp-cols-lg-12 { --fp-current-cols: 12; }
118
+ .fp-grid > .fp-used-span-lg-12 { --fp-used-span: 12; }
119
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
120
+ @media (width < 1280px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-lg-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
121
+ @media (width < 1280px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-lg-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
122
+ }
123
+ @media (min-width: 1280px) {
124
+ .fp-cols-xl-1 { --fp-current-cols: 1; }
125
+ .fp-grid > .fp-used-span-xl-1 { --fp-used-span: 1; }
126
+ .fp-cols-xl-2 { --fp-current-cols: 2; }
127
+ .fp-grid > .fp-used-span-xl-2 { --fp-used-span: 2; }
128
+ .fp-cols-xl-3 { --fp-current-cols: 3; }
129
+ .fp-grid > .fp-used-span-xl-3 { --fp-used-span: 3; }
130
+ .fp-cols-xl-4 { --fp-current-cols: 4; }
131
+ .fp-grid > .fp-used-span-xl-4 { --fp-used-span: 4; }
132
+ .fp-cols-xl-5 { --fp-current-cols: 5; }
133
+ .fp-grid > .fp-used-span-xl-5 { --fp-used-span: 5; }
134
+ .fp-cols-xl-6 { --fp-current-cols: 6; }
135
+ .fp-grid > .fp-used-span-xl-6 { --fp-used-span: 6; }
136
+ .fp-cols-xl-7 { --fp-current-cols: 7; }
137
+ .fp-grid > .fp-used-span-xl-7 { --fp-used-span: 7; }
138
+ .fp-cols-xl-8 { --fp-current-cols: 8; }
139
+ .fp-grid > .fp-used-span-xl-8 { --fp-used-span: 8; }
140
+ .fp-cols-xl-9 { --fp-current-cols: 9; }
141
+ .fp-grid > .fp-used-span-xl-9 { --fp-used-span: 9; }
142
+ .fp-cols-xl-10 { --fp-current-cols: 10; }
143
+ .fp-grid > .fp-used-span-xl-10 { --fp-used-span: 10; }
144
+ .fp-cols-xl-11 { --fp-current-cols: 11; }
145
+ .fp-grid > .fp-used-span-xl-11 { --fp-used-span: 11; }
146
+ .fp-cols-xl-12 { --fp-current-cols: 12; }
147
+ .fp-grid > .fp-used-span-xl-12 { --fp-used-span: 12; }
148
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
149
+ @media (width < 1536px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-xl-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
150
+ @media (width < 1536px) { @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-xl-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } } }
151
+ }
152
+ @media (min-width: 1536px) {
153
+ .fp-cols-2xl-1 { --fp-current-cols: 1; }
154
+ .fp-grid > .fp-used-span-2xl-1 { --fp-used-span: 1; }
155
+ .fp-cols-2xl-2 { --fp-current-cols: 2; }
156
+ .fp-grid > .fp-used-span-2xl-2 { --fp-used-span: 2; }
157
+ .fp-cols-2xl-3 { --fp-current-cols: 3; }
158
+ .fp-grid > .fp-used-span-2xl-3 { --fp-used-span: 3; }
159
+ .fp-cols-2xl-4 { --fp-current-cols: 4; }
160
+ .fp-grid > .fp-used-span-2xl-4 { --fp-used-span: 4; }
161
+ .fp-cols-2xl-5 { --fp-current-cols: 5; }
162
+ .fp-grid > .fp-used-span-2xl-5 { --fp-used-span: 5; }
163
+ .fp-cols-2xl-6 { --fp-current-cols: 6; }
164
+ .fp-grid > .fp-used-span-2xl-6 { --fp-used-span: 6; }
165
+ .fp-cols-2xl-7 { --fp-current-cols: 7; }
166
+ .fp-grid > .fp-used-span-2xl-7 { --fp-used-span: 7; }
167
+ .fp-cols-2xl-8 { --fp-current-cols: 8; }
168
+ .fp-grid > .fp-used-span-2xl-8 { --fp-used-span: 8; }
169
+ .fp-cols-2xl-9 { --fp-current-cols: 9; }
170
+ .fp-grid > .fp-used-span-2xl-9 { --fp-used-span: 9; }
171
+ .fp-cols-2xl-10 { --fp-current-cols: 10; }
172
+ .fp-grid > .fp-used-span-2xl-10 { --fp-used-span: 10; }
173
+ .fp-cols-2xl-11 { --fp-current-cols: 11; }
174
+ .fp-grid > .fp-used-span-2xl-11 { --fp-used-span: 11; }
175
+ .fp-cols-2xl-12 { --fp-current-cols: 12; }
176
+ .fp-grid > .fp-used-span-2xl-12 { --fp-used-span: 12; }
177
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
178
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-2xl-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } }
179
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-2xl-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); inline-size: auto; max-inline-size: none; justify-self: stretch; } }
180
+ }
@@ -0,0 +1,17 @@
1
+ import type { FlowpressBlock } from "../../index.js";
2
+ export declare const gridBreakpoints: readonly ["base", "sm", "md", "lg", "xl", "2xl"];
3
+ export type GridBreakpoint = typeof gridBreakpoints[number];
4
+ type Values = Partial<Record<GridBreakpoint, number>>;
5
+ type GridAttributes = Record<string, any>;
6
+ export declare const isGrid: (name: string, attributes?: GridAttributes) => boolean;
7
+ export declare const gridValues: (attributes: GridAttributes) => Values;
8
+ export declare const spanValues: (attributes: GridAttributes) => Values;
9
+ export declare const effectiveValues: (values: Values) => Record<GridBreakpoint, number>;
10
+ export declare const gridClasses: (attributes: GridAttributes) => string[];
11
+ export declare const spanClasses: (attributes: GridAttributes) => string[];
12
+ export declare const usedSpanClasses: (parent: GridAttributes, child: GridAttributes) => string[];
13
+ export declare const bleedClasses: (parent: GridAttributes, children: GridAttributes[]) => string[][];
14
+ /** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
15
+ export declare const decorateGridBlocks: (blocks: FlowpressBlock[]) => FlowpressBlock[];
16
+ export {};
17
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/astro/native/grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,eAAe,kDAAmD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAC5D,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAO1C,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,aAAY,cAAmB,KAAG,OAEhC,CAAC;AAExC,eAAO,MAAM,UAAU,GAAI,YAAY,cAAc,KAAG,MAQvD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,YAAY,cAAc,KAAG,MAQvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,cAAc,EAAE,MAAM,CAM7E,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,YAAY,cAAc,KAAG,MAAM,EAQ9D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,YAAY,cAAc,KAAG,MAAM,EAK9D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,cAAc,EAAE,OAAO,cAAc,KAAG,MAAM,EAMrF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,QAAQ,cAAc,EAAE,UAAU,cAAc,EAAE,KAAG,MAAM,EAAE,EAsBzF,CAAC;AAOF,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,cAAc,EAAE,KAAG,cAAc,EAkB1E,CAAC"}
@@ -0,0 +1,103 @@
1
+ export const gridBreakpoints = ["base", "sm", "md", "lg", "xl", "2xl"];
2
+ const count = (value, fallback) => {
3
+ const n = Number(value);
4
+ return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;
5
+ };
6
+ export const isGrid = (name, attributes = {}) => (name === "core/group" || name === "core/post-template" || name === "core/term-template")
7
+ && attributes.layout?.type === "grid";
8
+ export const gridValues = (attributes) => {
9
+ const layout = attributes.layout || {};
10
+ const values = { base: count(layout.columnCount, 1) };
11
+ for (const breakpoint of gridBreakpoints.slice(1)) {
12
+ const value = layout.flowpressColumns?.[breakpoint];
13
+ if (value !== undefined)
14
+ values[breakpoint] = count(value, values.base);
15
+ }
16
+ return values;
17
+ };
18
+ export const spanValues = (attributes) => {
19
+ const layout = attributes.style?.layout || {};
20
+ const values = { base: count(layout.columnSpan, 1) };
21
+ for (const breakpoint of gridBreakpoints.slice(1)) {
22
+ const value = layout.flowpressGridSpan?.[breakpoint];
23
+ if (value !== undefined)
24
+ values[breakpoint] = count(value, values.base);
25
+ }
26
+ return values;
27
+ };
28
+ export const effectiveValues = (values) => {
29
+ let current = values.base ?? 1;
30
+ return Object.fromEntries(gridBreakpoints.map((breakpoint) => {
31
+ current = values[breakpoint] ?? current;
32
+ return [breakpoint, current];
33
+ }));
34
+ };
35
+ export const gridClasses = (attributes) => {
36
+ const values = gridValues(attributes);
37
+ const align = attributes.layout?.flowpressAlign;
38
+ return [
39
+ "fp-grid",
40
+ ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),
41
+ ...(["start", "center", "end", "stretch"].includes(align) ? [`fp-align-${align}`] : []),
42
+ ];
43
+ };
44
+ export const spanClasses = (attributes) => {
45
+ const values = spanValues(attributes);
46
+ return ["fp-grid-item", ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : [])];
47
+ };
48
+ export const usedSpanClasses = (parent, child) => {
49
+ const columns = effectiveValues(gridValues(parent));
50
+ const spans = effectiveValues(spanValues(child));
51
+ return gridBreakpoints.map((breakpoint) => `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`);
52
+ };
53
+ export const bleedClasses = (parent, children) => {
54
+ const columns = effectiveValues(gridValues(parent));
55
+ const spans = children.map((child) => effectiveValues(spanValues(child)));
56
+ const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? ["fp-bleed-managed"] : []);
57
+ for (const breakpoint of gridBreakpoints) {
58
+ let position = 0;
59
+ children.forEach((child, index) => {
60
+ const width = Math.min(spans[index][breakpoint], columns[breakpoint]);
61
+ if (position + width > columns[breakpoint])
62
+ position = 0;
63
+ const start = position === 0;
64
+ const end = position + width === columns[breakpoint];
65
+ const bleed = child.style?.layout?.flowpressGridBleed;
66
+ const from = gridBreakpoints.indexOf(bleed?.from || "base");
67
+ if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&
68
+ ((bleed.side === "start" && start) || (bleed.side === "end" && end))) {
69
+ result[index].push(`fp-bleed-${breakpoint}-${bleed.side}`);
70
+ }
71
+ position += width;
72
+ if (position === columns[breakpoint])
73
+ position = 0;
74
+ });
75
+ }
76
+ return result;
77
+ };
78
+ const appendClasses = (attributes, classes) => ({
79
+ ...attributes,
80
+ className: [...new Set([...(attributes.className || "").split(/\s+/), ...classes].filter(Boolean))].join(" "),
81
+ });
82
+ /** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
83
+ export const decorateGridBlocks = (blocks) => blocks.map((block) => {
84
+ const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;
85
+ const attributes = (block.attributes || {});
86
+ if (!isGrid(block.name, attributes))
87
+ return innerBlocks ? { ...block, innerBlocks } : block;
88
+ const children = innerBlocks ?? [];
89
+ const bleed = bleedClasses(attributes, children.map((child) => child.attributes || {}));
90
+ return {
91
+ ...block,
92
+ attributes: appendClasses({ layoutRole: "stack", density: "regular", ...attributes }, gridClasses(attributes)),
93
+ innerBlocks: children.map((child, index) => ({
94
+ ...child,
95
+ attributes: appendClasses(child.attributes || {}, [
96
+ ...spanClasses(child.attributes || {}),
97
+ ...usedSpanClasses(attributes, child.attributes || {}),
98
+ ...(bleed[index] ?? []),
99
+ ]),
100
+ })),
101
+ };
102
+ });
103
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/astro/native/grid.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAKhF,MAAM,KAAK,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAU,EAAE;IACzD,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjE,CA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KAAK,CAAC,UAA4B,IAAI,EAAE,EAAE;gBAClE,GAAG,WAAW,CAAC,KAAK,CAAC,UAA4B,IAAI,EAAE,CAAC;gBACxD,GAAG,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,UAA4B,IAAI,EAAE,CAAC;gBACxE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;aACxB,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../index.js\";\n\nexport const gridBreakpoints = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\nexport type GridBreakpoint = typeof gridBreakpoints[number];\ntype Values = Partial<Record<GridBreakpoint, number>>;\ntype GridAttributes = Record<string, any>;\n\nconst count = (value: unknown, fallback: number): number => {\n const n = Number(value);\n return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;\n};\n\nexport const isGrid = (name: string, attributes: GridAttributes = {}): boolean =>\n (name === \"core/group\" || name === \"core/post-template\" || name === \"core/term-template\")\n && attributes.layout?.type === \"grid\";\n\nexport const gridValues = (attributes: GridAttributes): Values => {\n const layout = attributes.layout || {};\n const values: Values = { base: count(layout.columnCount, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressColumns?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const spanValues = (attributes: GridAttributes): Values => {\n const layout = attributes.style?.layout || {};\n const values: Values = { base: count(layout.columnSpan, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressGridSpan?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const effectiveValues = (values: Values): Record<GridBreakpoint, number> => {\n let current = values.base ?? 1;\n return Object.fromEntries(gridBreakpoints.map((breakpoint) => {\n current = values[breakpoint] ?? current;\n return [breakpoint, current];\n })) as Record<GridBreakpoint, number>;\n};\n\nexport const gridClasses = (attributes: GridAttributes): string[] => {\n const values = gridValues(attributes);\n const align = attributes.layout?.flowpressAlign;\n return [\n \"fp-grid\",\n ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),\n ...( [\"start\", \"center\", \"end\", \"stretch\"].includes(align) ? [`fp-align-${align}`] : []),\n ];\n};\n\nexport const spanClasses = (attributes: GridAttributes): string[] => {\n const values = spanValues(attributes);\n return [\"fp-grid-item\", ...gridBreakpoints.flatMap((breakpoint) =>\n values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : []\n )];\n};\n\nexport const usedSpanClasses = (parent: GridAttributes, child: GridAttributes): string[] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = effectiveValues(spanValues(child));\n return gridBreakpoints.map((breakpoint) =>\n `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`\n );\n};\n\nexport const bleedClasses = (parent: GridAttributes, children: GridAttributes[]): string[][] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = children.map((child) => effectiveValues(spanValues(child)));\n const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? [\"fp-bleed-managed\"] : [] as string[]);\n for (const breakpoint of gridBreakpoints) {\n let position = 0;\n children.forEach((child, index) => {\n const width = Math.min(spans[index]![breakpoint], columns[breakpoint]);\n if (position + width > columns[breakpoint]) position = 0;\n const start = position === 0;\n const end = position + width === columns[breakpoint];\n const bleed = child.style?.layout?.flowpressGridBleed;\n const from = gridBreakpoints.indexOf(bleed?.from || \"base\");\n if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&\n ((bleed.side === \"start\" && start) || (bleed.side === \"end\" && end))) {\n result[index]!.push(`fp-bleed-${breakpoint}-${bleed.side}`);\n }\n position += width;\n if (position === columns[breakpoint]) position = 0;\n });\n }\n return result;\n};\n\nconst appendClasses = (attributes: GridAttributes, classes: string[]): GridAttributes => ({\n ...attributes,\n className: [...new Set([...(attributes.className || \"\").split(/\\s+/), ...classes].filter(Boolean))].join(\" \"),\n});\n\n/** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */\nexport const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {\n const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;\n const attributes = (block.attributes || {}) as GridAttributes;\n if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;\n const children = innerBlocks ?? [];\n const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));\n return {\n ...block,\n attributes: appendClasses({ layoutRole: \"stack\", density: \"regular\", ...attributes }, gridClasses(attributes)),\n innerBlocks: children.map((child, index) => ({\n ...child,\n attributes: appendClasses(child.attributes as GridAttributes || {}, [\n ...spanClasses(child.attributes as GridAttributes || {}),\n ...usedSpanClasses(attributes, child.attributes as GridAttributes || {}),\n ...(bleed[index] ?? []),\n ]),\n })),\n };\n});\n"]}
@@ -0,0 +1,118 @@
1
+ import type { FlowpressBlock } from "../../index.js";
2
+
3
+ export const gridBreakpoints = ["base", "sm", "md", "lg", "xl", "2xl"] as const;
4
+ export type GridBreakpoint = typeof gridBreakpoints[number];
5
+ type Values = Partial<Record<GridBreakpoint, number>>;
6
+ type GridAttributes = Record<string, any>;
7
+
8
+ const count = (value: unknown, fallback: number): number => {
9
+ const n = Number(value);
10
+ return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;
11
+ };
12
+
13
+ export const isGrid = (name: string, attributes: GridAttributes = {}): boolean =>
14
+ (name === "core/group" || name === "core/post-template" || name === "core/term-template")
15
+ && attributes.layout?.type === "grid";
16
+
17
+ export const gridValues = (attributes: GridAttributes): Values => {
18
+ const layout = attributes.layout || {};
19
+ const values: Values = { base: count(layout.columnCount, 1) };
20
+ for (const breakpoint of gridBreakpoints.slice(1)) {
21
+ const value = layout.flowpressColumns?.[breakpoint];
22
+ if (value !== undefined) values[breakpoint] = count(value, values.base!);
23
+ }
24
+ return values;
25
+ };
26
+
27
+ export const spanValues = (attributes: GridAttributes): Values => {
28
+ const layout = attributes.style?.layout || {};
29
+ const values: Values = { base: count(layout.columnSpan, 1) };
30
+ for (const breakpoint of gridBreakpoints.slice(1)) {
31
+ const value = layout.flowpressGridSpan?.[breakpoint];
32
+ if (value !== undefined) values[breakpoint] = count(value, values.base!);
33
+ }
34
+ return values;
35
+ };
36
+
37
+ export const effectiveValues = (values: Values): Record<GridBreakpoint, number> => {
38
+ let current = values.base ?? 1;
39
+ return Object.fromEntries(gridBreakpoints.map((breakpoint) => {
40
+ current = values[breakpoint] ?? current;
41
+ return [breakpoint, current];
42
+ })) as Record<GridBreakpoint, number>;
43
+ };
44
+
45
+ export const gridClasses = (attributes: GridAttributes): string[] => {
46
+ const values = gridValues(attributes);
47
+ const align = attributes.layout?.flowpressAlign;
48
+ return [
49
+ "fp-grid",
50
+ ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),
51
+ ...( ["start", "center", "end", "stretch"].includes(align) ? [`fp-align-${align}`] : []),
52
+ ];
53
+ };
54
+
55
+ export const spanClasses = (attributes: GridAttributes): string[] => {
56
+ const values = spanValues(attributes);
57
+ return ["fp-grid-item", ...gridBreakpoints.flatMap((breakpoint) =>
58
+ values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : []
59
+ )];
60
+ };
61
+
62
+ export const usedSpanClasses = (parent: GridAttributes, child: GridAttributes): string[] => {
63
+ const columns = effectiveValues(gridValues(parent));
64
+ const spans = effectiveValues(spanValues(child));
65
+ return gridBreakpoints.map((breakpoint) =>
66
+ `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`
67
+ );
68
+ };
69
+
70
+ export const bleedClasses = (parent: GridAttributes, children: GridAttributes[]): string[][] => {
71
+ const columns = effectiveValues(gridValues(parent));
72
+ const spans = children.map((child) => effectiveValues(spanValues(child)));
73
+ const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? ["fp-bleed-managed"] : [] as string[]);
74
+ for (const breakpoint of gridBreakpoints) {
75
+ let position = 0;
76
+ children.forEach((child, index) => {
77
+ const width = Math.min(spans[index]![breakpoint], columns[breakpoint]);
78
+ if (position + width > columns[breakpoint]) position = 0;
79
+ const start = position === 0;
80
+ const end = position + width === columns[breakpoint];
81
+ const bleed = child.style?.layout?.flowpressGridBleed;
82
+ const from = gridBreakpoints.indexOf(bleed?.from || "base");
83
+ if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&
84
+ ((bleed.side === "start" && start) || (bleed.side === "end" && end))) {
85
+ result[index]!.push(`fp-bleed-${breakpoint}-${bleed.side}`);
86
+ }
87
+ position += width;
88
+ if (position === columns[breakpoint]) position = 0;
89
+ });
90
+ }
91
+ return result;
92
+ };
93
+
94
+ const appendClasses = (attributes: GridAttributes, classes: string[]): GridAttributes => ({
95
+ ...attributes,
96
+ className: [...new Set([...(attributes.className || "").split(/\s+/), ...classes].filter(Boolean))].join(" "),
97
+ });
98
+
99
+ /** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
100
+ export const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {
101
+ const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;
102
+ const attributes = (block.attributes || {}) as GridAttributes;
103
+ if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;
104
+ const children = innerBlocks ?? [];
105
+ const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));
106
+ return {
107
+ ...block,
108
+ attributes: appendClasses({ layoutRole: "stack", density: "regular", ...attributes }, gridClasses(attributes)),
109
+ innerBlocks: children.map((child, index) => ({
110
+ ...child,
111
+ attributes: appendClasses(child.attributes as GridAttributes || {}, [
112
+ ...spanClasses(child.attributes as GridAttributes || {}),
113
+ ...usedSpanClasses(attributes, child.attributes as GridAttributes || {}),
114
+ ...(bleed[index] ?? []),
115
+ ]),
116
+ })),
117
+ };
118
+ });
@@ -0,0 +1,36 @@
1
+ /* Native layout selectors have zero specificity. Authored classes win.
2
+ StyleFlow recipes belong in the styleflow layer; utilities are unlayered. */
3
+ :where(.fp-native-group) { gap: var(--fp-group-default-gap, normal); }
4
+ /* No gap also cancels Gutenberg layout rules and inline gaps. */
5
+ .fp-native-group[data-sf-no-gap="true"] { gap: 0 !important; }
6
+ :where(.fp-native-group:not([data-fp-group-layout="grid"])) { display: flex; flex-direction: column; flex-wrap: nowrap; }
7
+ :where(.fp-native-group[data-fp-group-layout="horizontal"]) { flex-direction: row; align-items: center; }
8
+ :where(.fp-native-group[data-fp-group-layout="vertical"]) { align-items: flex-start; }
9
+ :where(.fp-native-group[data-fp-group-wrap="wrap"]) { flex-wrap: wrap; }
10
+ :where(.fp-native-group[data-fp-group-wrap="nowrap"]) { flex-wrap: nowrap; }
11
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-justify="left"]) { justify-content: flex-start; }
12
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-justify="center"]) { justify-content: center; }
13
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-justify="right"]) { justify-content: flex-end; }
14
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-justify="space-between"]) { justify-content: space-between; }
15
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-align="top"]) { align-items: flex-start; }
16
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-align="center"]) { align-items: center; }
17
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-align="bottom"]) { align-items: flex-end; }
18
+ :where(.fp-native-group[data-fp-group-layout="horizontal"][data-fp-group-align="stretch"]) { align-items: stretch; }
19
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-justify="left"]) { align-items: flex-start; }
20
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-justify="center"]) { align-items: center; }
21
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-justify="right"]) { align-items: flex-end; }
22
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-justify="stretch"]) { align-items: stretch; }
23
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-align="top"]) { justify-content: flex-start; }
24
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-align="center"]) { justify-content: center; }
25
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-align="bottom"]) { justify-content: flex-end; }
26
+ :where(.fp-native-group[data-fp-group-layout="vertical"][data-fp-group-align="space-between"]) { justify-content: space-between; }
27
+ :where(.fp-native-group[data-fp-group-row-gap="true"]) { row-gap: var(--fp-group-row-gap); }
28
+ :where(.fp-native-group[data-fp-group-column-gap="true"]) { column-gap: var(--fp-group-column-gap); }
29
+ :where(.fp-native-group[data-fp-group-layout="constrained"]) > :where(:not(.alignwide):not(.alignfull)) { max-width: var(--fp-group-content-size, var(--wp--style--global--content-size, revert-layer)); }
30
+ :where(.fp-native-group[data-fp-group-layout="constrained"]) > :where(.alignwide) { max-width: var(--fp-group-wide-size, var(--wp--style--global--wide-size, revert-layer)); }
31
+
32
+ :where([data-fp-flex-size="fill"]) { flex-grow: 1; }
33
+ :where([data-fp-flex-size="fixed"]) { flex-basis: var(--fp-flex-basis, auto); box-sizing: border-box; }
34
+ :where(.fp-native-group[data-fp-group-layout="constrained"][data-fp-group-justify="left"], .fp-native-group[data-fp-group-layout="default"][data-fp-group-justify="left"]) { align-items: flex-start; }
35
+ :where(.fp-native-group[data-fp-group-layout="constrained"][data-fp-group-justify="center"], .fp-native-group[data-fp-group-layout="default"][data-fp-group-justify="center"]) { align-items: center; }
36
+ :where(.fp-native-group[data-fp-group-layout="constrained"][data-fp-group-justify="right"], .fp-native-group[data-fp-group-layout="default"][data-fp-group-justify="right"]) { align-items: flex-end; }
@@ -0,0 +1,15 @@
1
+ /** Gutenberg Group, Row and Stack use the same core/group block. */
2
+ export declare function groupLength(value: unknown): string | undefined;
3
+ export declare function nativeGroupProps(attributes?: Record<string, any>, htmlProps?: Record<string, any>, styleflowProps?: Record<string, any>): {
4
+ class: string;
5
+ "data-fp-group-layout": any;
6
+ "data-fp-group-justify": any;
7
+ "data-fp-group-align": any;
8
+ "data-fp-group-wrap": string | undefined;
9
+ "data-fp-group-row-gap": string | undefined;
10
+ "data-fp-group-column-gap": string | undefined;
11
+ style: string | undefined;
12
+ };
13
+ /** Native sizing controls on children of a flex Group. */
14
+ export declare function nativeFlexItemProps(attributes: Record<string, any>, htmlProps: Record<string, any>): Record<string, any>;
15
+ //# sourceMappingURL=group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/astro/native/group.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAU9D;AAED,wBAAgB,gBAAgB,CAAC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;;;;;;;;;EAiCnJ;AAED,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,uBAWlG"}
@@ -0,0 +1,66 @@
1
+ /** Gutenberg Group, Row and Stack use the same core/group block. */
2
+ export function groupLength(value) {
3
+ if (value === 0 || value === "0")
4
+ return "0";
5
+ if (typeof value !== "string")
6
+ return undefined;
7
+ const preset = /^var:preset\|spacing\|([a-zA-Z0-9_-]+)$/.exec(value);
8
+ if (preset)
9
+ return `var(--wp--preset--spacing--${preset[1]})`;
10
+ const length = value.trim();
11
+ if (/^(?:\d+(?:\.\d+)?|\.\d+)(?:px|rem|em|%|vw|vh|svw|svh|dvw|dvh|ch|ex|cqw|cqh)$/.test(length))
12
+ return length;
13
+ // Accept CSS math and custom properties, never declarations or URLs.
14
+ if (/^(?:var|calc|min|max|clamp)\([\w\s.,%()+*/-]+\)$/.test(length))
15
+ return length;
16
+ return undefined;
17
+ }
18
+ export function nativeGroupProps(attributes = {}, htmlProps = {}, styleflowProps = {}) {
19
+ const layout = attributes.layout ?? {};
20
+ const type = ["flex", "grid", "constrained", "default"].includes(layout.type) ? layout.type : "constrained";
21
+ const vertical = layout.orientation === "vertical";
22
+ const justify = ["left", "center", "right", "space-between", "stretch"].includes(layout.justifyContent) ? layout.justifyContent : undefined;
23
+ const align = ["top", "center", "bottom", "space-between", "stretch"].includes(layout.verticalAlignment) ? layout.verticalAlignment : undefined;
24
+ const gap = attributes.noGap ? undefined : attributes.style?.spacing?.blockGap;
25
+ const rowGap = groupLength(typeof gap === "object" && gap !== null ? gap.top : gap);
26
+ const columnGap = groupLength(typeof gap === "object" && gap !== null ? gap.left : gap);
27
+ const contentSize = groupLength(layout.contentSize);
28
+ const wideSize = groupLength(layout.wideSize);
29
+ const role = String(styleflowProps.layoutRole ?? attributes.layoutRole ?? "none");
30
+ const density = String(styleflowProps.density ?? attributes.density ?? "regular");
31
+ const defaultGap = attributes.noGap ? "0" : /^[a-zA-Z0-9_-]+$/.test(role) && /^[a-zA-Z0-9_-]+$/.test(density)
32
+ ? `var(--sf-layout-${role}-${density}-gap, normal)` : "normal";
33
+ const variables = [
34
+ `--fp-group-default-gap:${defaultGap}`,
35
+ rowGap !== undefined ? `--fp-group-row-gap:${rowGap}` : "",
36
+ columnGap !== undefined ? `--fp-group-column-gap:${columnGap}` : "",
37
+ contentSize ? `--fp-group-content-size:${contentSize}` : "",
38
+ wideSize ? `--fp-group-wide-size:${wideSize}` : "",
39
+ ].filter(Boolean);
40
+ return {
41
+ ...htmlProps,
42
+ class: ["wp-block-group", "fp-native-group", htmlProps.class].filter(Boolean).join(" "),
43
+ "data-fp-group-layout": type === "flex" ? (vertical ? "vertical" : "horizontal") : type,
44
+ "data-fp-group-justify": justify,
45
+ "data-fp-group-align": align,
46
+ "data-fp-group-wrap": type === "flex" ? (layout.flexWrap === "nowrap" ? "nowrap" : "wrap") : undefined,
47
+ "data-fp-group-row-gap": rowGap !== undefined ? "true" : undefined,
48
+ "data-fp-group-column-gap": columnGap !== undefined ? "true" : undefined,
49
+ style: [htmlProps.style, ...variables].filter(Boolean).join(";") || undefined,
50
+ };
51
+ }
52
+ /** Native sizing controls on children of a flex Group. */
53
+ export function nativeFlexItemProps(attributes, htmlProps) {
54
+ const layout = attributes.style?.layout;
55
+ if (!layout || !["fit", "fill", "fixed"].includes(layout.selfStretch))
56
+ return htmlProps;
57
+ const size = groupLength(layout.flexSize);
58
+ return {
59
+ ...htmlProps,
60
+ "data-fp-flex-size": layout.selfStretch,
61
+ ...(layout.selfStretch === "fixed" && size !== undefined ? {
62
+ style: [htmlProps.style, `--fp-flex-basis:${size}`].filter(Boolean).join(";")
63
+ } : {}),
64
+ };
65
+ }
66
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/astro/native/group.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,GAAG,CAAC;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,MAAM,GAAG,yCAAyC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrE,IAAI,MAAM;QAAE,OAAO,8BAA8B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,8EAA8E,CAAC,IAAI,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mB,EAAE,MAAM,CAAC,WAAW;QACvC,GAAG,CAAC,MAAM,CAAC,WAAW,KAAK,OAAO,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACzD,KAAK,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,mBAAmB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SAC9E,CAAC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC","sourcesContent":["/** Gutenberg Group, Row and Stack use the same core/group block. */\nexport function groupLength(value: unknown): string | undefined {\n if (value === 0 || value === \"0\") return \"0\";\n if (typeof value !== \"string\") return undefined;\n const preset = /^var:preset\\|spacing\\|([a-zA-Z0-9_-]+)$/.exec(value);\n if (preset) return `var(--wp--preset--spacing--${preset[1]})`;\n const length = value.trim();\n if (/^(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:px|rem|em|%|vw|vh|svw|svh|dvw|dvh|ch|ex|cqw|cqh)$/.test(length)) return length;\n // Accept CSS math and custom properties, never declarations or URLs.\n if (/^(?:var|calc|min|max|clamp)\\([\\w\\s.,%()+*/-]+\\)$/.test(length)) return length;\n return undefined;\n}\n\nexport function nativeGroupProps(attributes: Record<string, any> = {}, htmlProps: Record<string, any> = {}, styleflowProps: Record<string, any> = {}) {\n const layout = attributes.layout ?? {};\n const type = [\"flex\", \"grid\", \"constrained\", \"default\"].includes(layout.type) ? layout.type : \"constrained\";\n const vertical = layout.orientation === \"vertical\";\n const justify = [\"left\", \"center\", \"right\", \"space-between\", \"stretch\"].includes(layout.justifyContent) ? layout.justifyContent : undefined;\n const align = [\"top\", \"center\", \"bottom\", \"space-between\", \"stretch\"].includes(layout.verticalAlignment) ? layout.verticalAlignment : undefined;\n const gap = attributes.noGap ? undefined : attributes.style?.spacing?.blockGap;\n const rowGap = groupLength(typeof gap === \"object\" && gap !== null ? gap.top : gap);\n const columnGap = groupLength(typeof gap === \"object\" && gap !== null ? gap.left : gap);\n const contentSize = groupLength(layout.contentSize);\n const wideSize = groupLength(layout.wideSize);\n const role = String(styleflowProps.layoutRole ?? attributes.layoutRole ?? \"none\");\n const density = String(styleflowProps.density ?? attributes.density ?? \"regular\");\n const defaultGap = attributes.noGap ? \"0\" : /^[a-zA-Z0-9_-]+$/.test(role) && /^[a-zA-Z0-9_-]+$/.test(density)\n ? `var(--sf-layout-${role}-${density}-gap, normal)` : \"normal\";\n const variables = [\n `--fp-group-default-gap:${defaultGap}`,\n rowGap !== undefined ? `--fp-group-row-gap:${rowGap}` : \"\",\n columnGap !== undefined ? `--fp-group-column-gap:${columnGap}` : \"\",\n contentSize ? `--fp-group-content-size:${contentSize}` : \"\",\n wideSize ? `--fp-group-wide-size:${wideSize}` : \"\",\n ].filter(Boolean);\n return {\n ...htmlProps,\n class: [\"wp-block-group\", \"fp-native-group\", htmlProps.class].filter(Boolean).join(\" \"),\n \"data-fp-group-layout\": type === \"flex\" ? (vertical ? \"vertical\" : \"horizontal\") : type,\n \"data-fp-group-justify\": justify,\n \"data-fp-group-align\": align,\n \"data-fp-group-wrap\": type === \"flex\" ? (layout.flexWrap === \"nowrap\" ? \"nowrap\" : \"wrap\") : undefined,\n \"data-fp-group-row-gap\": rowGap !== undefined ? \"true\" : undefined,\n \"data-fp-group-column-gap\": columnGap !== undefined ? \"true\" : undefined,\n style: [htmlProps.style, ...variables].filter(Boolean).join(\";\") || undefined,\n };\n}\n\n/** Native sizing controls on children of a flex Group. */\nexport function nativeFlexItemProps(attributes: Record<string, any>, htmlProps: Record<string, any>) {\n const layout = attributes.style?.layout;\n if (!layout || ![\"fit\", \"fill\", \"fixed\"].includes(layout.selfStretch)) return htmlProps;\n const size = groupLength(layout.flexSize);\n return {\n ...htmlProps,\n \"data-fp-flex-size\": layout.selfStretch,\n ...(layout.selfStretch === \"fixed\" && size !== undefined ? {\n style: [htmlProps.style, `--fp-flex-basis:${size}`].filter(Boolean).join(\";\")\n } : {}),\n };\n}\n"]}