@styleflow.app/flowpress-astro-core 1.0.0-beta.3 → 1.0.0-beta.30

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 (243) hide show
  1. package/CHANGELOG.md +190 -1
  2. package/README.md +111 -3
  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 +157 -0
  9. package/dist/astro/DefaultBlockAdapter.astro +35 -0
  10. package/dist/astro/DefaultTemplate.astro +12 -7
  11. package/dist/astro/GutenbergRenderer.astro +240 -80
  12. package/dist/astro/StyleflowElement.astro +23 -0
  13. package/dist/astro/ThemeRuntime.astro +26 -0
  14. package/dist/astro/blocks/CarouselBlock.astro +8 -10
  15. package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
  16. package/dist/astro/blocks/ColumnBlock.astro +4 -5
  17. package/dist/astro/blocks/CoverBlock.astro +155 -0
  18. package/dist/astro/blocks/FormBlock.astro +23 -20
  19. package/dist/astro/blocks/GridBlock.astro +4 -4
  20. package/dist/astro/blocks/HeroBlock.astro +4 -5
  21. package/dist/astro/blocks/ImageBlock.astro +4 -5
  22. package/dist/astro/blocks/ListItemFallback.astro +10 -7
  23. package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
  24. package/dist/astro/blocks/SemanticElement.astro +35 -0
  25. package/dist/astro/blocks/SiteLogoBlock.astro +53 -0
  26. package/dist/astro/blocks/TextBlock.astro +33 -28
  27. package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
  28. package/dist/astro/blocks/cover.d.ts +13 -0
  29. package/dist/astro/blocks/cover.d.ts.map +1 -0
  30. package/dist/astro/blocks/cover.js +105 -0
  31. package/dist/astro/blocks/cover.js.map +1 -0
  32. package/dist/astro/blocks/cover.ts +119 -0
  33. package/dist/astro/blocks/helpers.d.ts +7 -0
  34. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  35. package/dist/astro/blocks/helpers.js +52 -41
  36. package/dist/astro/blocks/helpers.js.map +1 -1
  37. package/dist/astro/blocks/helpers.ts +64 -45
  38. package/dist/astro/native/Blob.astro +113 -0
  39. package/dist/astro/native/BlobBlock.astro +52 -0
  40. package/dist/astro/native/CustomFieldValue.astro +87 -0
  41. package/dist/astro/native/LevelTag.astro +20 -0
  42. package/dist/astro/native/MapBlock.astro +41 -0
  43. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  44. package/dist/astro/native/NativeIconBlock.astro +42 -0
  45. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  46. package/dist/astro/native/ResolvedBlocks.astro +89 -0
  47. package/dist/astro/native/SyncedPatternContent.astro +92 -0
  48. package/dist/astro/native/TermFieldValue.astro +38 -0
  49. package/dist/astro/native/Timeline.astro +21 -0
  50. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  51. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  52. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  53. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  54. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  55. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  56. package/dist/astro/native/blob/config.d.ts +49 -0
  57. package/dist/astro/native/blob/config.d.ts.map +1 -0
  58. package/dist/astro/native/blob/config.js +86 -0
  59. package/dist/astro/native/blob/config.js.map +1 -0
  60. package/dist/astro/native/blob/config.ts +132 -0
  61. package/dist/astro/native/blob/controller.d.ts +11 -0
  62. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  63. package/dist/astro/native/blob/controller.js +240 -0
  64. package/dist/astro/native/blob/controller.js.map +1 -0
  65. package/dist/astro/native/blob/controller.ts +248 -0
  66. package/dist/astro/native/blob/geometry.d.ts +2 -0
  67. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  68. package/dist/astro/native/blob/geometry.js +2 -0
  69. package/dist/astro/native/blob/geometry.js.map +1 -0
  70. package/dist/astro/native/blob/geometry.ts +1 -0
  71. package/dist/astro/native/blob/ids.d.ts +7 -0
  72. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  73. package/dist/astro/native/blob/ids.js +11 -0
  74. package/dist/astro/native/blob/ids.js.map +1 -0
  75. package/dist/astro/native/blob/ids.ts +11 -0
  76. package/dist/astro/native/blob.css +83 -0
  77. package/dist/astro/native/button.d.ts +13 -0
  78. package/dist/astro/native/button.d.ts.map +1 -0
  79. package/dist/astro/native/button.js +26 -0
  80. package/dist/astro/native/button.js.map +1 -0
  81. package/dist/astro/native/button.ts +26 -0
  82. package/dist/astro/native/core-block.astro +18 -0
  83. package/dist/astro/native/core-button.astro +43 -0
  84. package/dist/astro/native/core-buttons.astro +14 -0
  85. package/dist/astro/native/core-group.astro +23 -0
  86. package/dist/astro/native/core-home-link.astro +12 -0
  87. package/dist/astro/native/core-html.astro +8 -0
  88. package/dist/astro/native/core-icon.astro +7 -0
  89. package/dist/astro/native/core-image.astro +124 -0
  90. package/dist/astro/native/core-navigation-link.astro +71 -0
  91. package/dist/astro/native/core-navigation-submenu.astro +33 -0
  92. package/dist/astro/native/core-navigation.astro +94 -0
  93. package/dist/astro/native/core-page-list-data-item.astro +19 -0
  94. package/dist/astro/native/core-page-list-item.astro +8 -0
  95. package/dist/astro/native/core-page-list.astro +40 -0
  96. package/dist/astro/native/core-post-date.astro +21 -0
  97. package/dist/astro/native/core-post-excerpt.astro +26 -0
  98. package/dist/astro/native/core-post-featured-image.astro +37 -0
  99. package/dist/astro/native/core-post-template.astro +30 -0
  100. package/dist/astro/native/core-post-terms.astro +47 -0
  101. package/dist/astro/native/core-post-title.astro +23 -0
  102. package/dist/astro/native/core-query-no-results.astro +12 -0
  103. package/dist/astro/native/core-query.astro +22 -0
  104. package/dist/astro/native/core-separator.astro +20 -0
  105. package/dist/astro/native/core-site-title.astro +16 -0
  106. package/dist/astro/native/core-term-description.astro +12 -0
  107. package/dist/astro/native/core-term-name.astro +21 -0
  108. package/dist/astro/native/core-term-template.astro +30 -0
  109. package/dist/astro/native/core-terms-query.astro +19 -0
  110. package/dist/astro/native/core-transparent.astro +11 -0
  111. package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
  112. package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
  113. package/dist/astro/native/flowpress-navigation-controller.js +217 -0
  114. package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
  115. package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
  116. package/dist/astro/native/flowpress-navigation.css +17 -0
  117. package/dist/astro/native/grid-bleed.js +106 -0
  118. package/dist/astro/native/grid.css +180 -0
  119. package/dist/astro/native/grid.d.ts +17 -0
  120. package/dist/astro/native/grid.d.ts.map +1 -0
  121. package/dist/astro/native/grid.js +103 -0
  122. package/dist/astro/native/grid.js.map +1 -0
  123. package/dist/astro/native/grid.ts +118 -0
  124. package/dist/astro/native/html.d.ts +6 -0
  125. package/dist/astro/native/html.d.ts.map +1 -0
  126. package/dist/astro/native/html.js +10 -0
  127. package/dist/astro/native/html.js.map +1 -0
  128. package/dist/astro/native/html.ts +9 -0
  129. package/dist/astro/native/icon.d.ts +3 -0
  130. package/dist/astro/native/icon.d.ts.map +1 -0
  131. package/dist/astro/native/icon.js +23 -0
  132. package/dist/astro/native/icon.js.map +1 -0
  133. package/dist/astro/native/icon.ts +21 -0
  134. package/dist/astro/native/map.d.ts +14 -0
  135. package/dist/astro/native/map.d.ts.map +1 -0
  136. package/dist/astro/native/map.js +60 -0
  137. package/dist/astro/native/map.js.map +1 -0
  138. package/dist/astro/native/map.ts +70 -0
  139. package/dist/astro/native/motion-preference.d.ts +50 -0
  140. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  141. package/dist/astro/native/motion-preference.js +132 -0
  142. package/dist/astro/native/motion-preference.js.map +1 -0
  143. package/dist/astro/native/motion-preference.ts +158 -0
  144. package/dist/astro/native/motion.d.ts +101 -0
  145. package/dist/astro/native/motion.d.ts.map +1 -0
  146. package/dist/astro/native/motion.js +168 -0
  147. package/dist/astro/native/motion.js.map +1 -0
  148. package/dist/astro/native/motion.ts +312 -0
  149. package/dist/astro/native/query-loop.d.ts +38 -0
  150. package/dist/astro/native/query-loop.d.ts.map +1 -0
  151. package/dist/astro/native/query-loop.js +20 -0
  152. package/dist/astro/native/query-loop.js.map +1 -0
  153. package/dist/astro/native/query-loop.ts +67 -0
  154. package/dist/astro/native/registry.d.ts +3 -0
  155. package/dist/astro/native/registry.d.ts.map +1 -0
  156. package/dist/astro/native/registry.js +81 -0
  157. package/dist/astro/native/registry.js.map +1 -0
  158. package/dist/astro/native/registry.ts +81 -0
  159. package/dist/astro/native/sf-block-binding.astro +20 -0
  160. package/dist/astro/native/sf-post-field.astro +9 -0
  161. package/dist/astro/native/sf-term-field.astro +9 -0
  162. package/dist/astro/native/timeline.css +4 -0
  163. package/dist/astro/native/timeline.d.ts +28 -0
  164. package/dist/astro/native/timeline.d.ts.map +1 -0
  165. package/dist/astro/native/timeline.js +43 -0
  166. package/dist/astro/native/timeline.js.map +1 -0
  167. package/dist/astro/native/timeline.ts +79 -0
  168. package/dist/astro/preferences/AccessibilityPanel.astro +118 -0
  169. package/dist/astro/preferences/ColorModeToggle.astro +26 -0
  170. package/dist/astro/preferences/MotionToggle.astro +27 -0
  171. package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
  172. package/dist/astro/preferences/ThemeToggle.astro +30 -0
  173. package/dist/astro/preferences/Toggle.astro +50 -0
  174. package/dist/astro/preferences/preferences.css +125 -0
  175. package/dist/block-renderers.d.ts +20 -3
  176. package/dist/block-renderers.d.ts.map +1 -1
  177. package/dist/block-renderers.js.map +1 -1
  178. package/dist/client.d.ts +17 -1
  179. package/dist/client.d.ts.map +1 -1
  180. package/dist/client.js +63 -9
  181. package/dist/client.js.map +1 -1
  182. package/dist/composition.d.ts +14 -0
  183. package/dist/composition.d.ts.map +1 -0
  184. package/dist/composition.js +124 -0
  185. package/dist/composition.js.map +1 -0
  186. package/dist/default-blocks.d.ts +9 -0
  187. package/dist/default-blocks.d.ts.map +1 -0
  188. package/dist/default-blocks.js +118 -0
  189. package/dist/default-blocks.js.map +1 -0
  190. package/dist/env.d.ts +9 -0
  191. package/dist/env.d.ts.map +1 -1
  192. package/dist/env.js +20 -0
  193. package/dist/env.js.map +1 -1
  194. package/dist/index.d.ts +8 -0
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/index.js +7 -0
  197. package/dist/index.js.map +1 -1
  198. package/dist/links.d.ts +5 -0
  199. package/dist/links.d.ts.map +1 -0
  200. package/dist/links.js +32 -0
  201. package/dist/links.js.map +1 -0
  202. package/dist/media.d.ts +28 -0
  203. package/dist/media.d.ts.map +1 -0
  204. package/dist/media.js +212 -0
  205. package/dist/media.js.map +1 -0
  206. package/dist/motion-preference.d.ts +50 -0
  207. package/dist/motion-preference.d.ts.map +1 -0
  208. package/dist/motion-preference.js +132 -0
  209. package/dist/motion-preference.js.map +1 -0
  210. package/dist/preferences-runtime.d.ts +3 -0
  211. package/dist/preferences-runtime.d.ts.map +1 -0
  212. package/dist/preferences-runtime.js +23 -0
  213. package/dist/preferences-runtime.js.map +1 -0
  214. package/dist/preferences-styleflow.d.ts +3 -0
  215. package/dist/preferences-styleflow.d.ts.map +1 -0
  216. package/dist/preferences-styleflow.js +14 -0
  217. package/dist/preferences-styleflow.js.map +1 -0
  218. package/dist/preferences.d.ts +4 -0
  219. package/dist/preferences.d.ts.map +1 -0
  220. package/dist/preferences.js +4 -0
  221. package/dist/preferences.js.map +1 -0
  222. package/dist/styleflow.d.ts +16 -1
  223. package/dist/styleflow.d.ts.map +1 -1
  224. package/dist/styleflow.js +76 -7
  225. package/dist/styleflow.js.map +1 -1
  226. package/dist/templates.d.ts +16 -16
  227. package/dist/text.d.ts +3 -0
  228. package/dist/text.d.ts.map +1 -0
  229. package/dist/text.js +6 -0
  230. package/dist/text.js.map +1 -0
  231. package/dist/theme-runtime.d.ts +16 -0
  232. package/dist/theme-runtime.d.ts.map +1 -0
  233. package/dist/theme-runtime.js +100 -0
  234. package/dist/theme-runtime.js.map +1 -0
  235. package/dist/tsconfig.tsbuildinfo +1 -1
  236. package/dist/types.d.ts +84 -1
  237. package/dist/types.d.ts.map +1 -1
  238. package/dist/types.js.map +1 -1
  239. package/dist/vivid-colors-preference.d.ts +31 -0
  240. package/dist/vivid-colors-preference.d.ts.map +1 -0
  241. package/dist/vivid-colors-preference.js +102 -0
  242. package/dist/vivid-colors-preference.js.map +1 -0
  243. package/package.json +26 -4
@@ -0,0 +1,13 @@
1
+ /** WordPress resolves the RichText; Astro restricts URL and control semantics. */
2
+ export declare function nativeButtonData(data?: Record<string, unknown> | null): {
3
+ empty: boolean;
4
+ tag: string;
5
+ label: string;
6
+ href: string | undefined;
7
+ target: string | undefined;
8
+ rel: string | undefined;
9
+ title: string | undefined;
10
+ type: "button" | "submit" | "reset";
11
+ };
12
+ export declare function nativeButtonsLayout(layout?: Record<string, unknown>): string;
13
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/astro/native/button.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;;;;;;;;UAgBwB,QAAQ,GAAG,QAAQ,GAAG,OAAO;EAE1H;AAED,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,UAIvE"}
@@ -0,0 +1,26 @@
1
+ /** WordPress resolves the RichText; Astro restricts URL and control semantics. */
2
+ export function nativeButtonData(data) {
3
+ const value = data ?? {};
4
+ const text = (key) => typeof value[key] === "string" ? String(value[key]) : "";
5
+ const url = text("href").trim();
6
+ const href = /^(?:\/(?!\/)|#[^\s]*|https?:\/\/|mailto:|tel:)/i.test(url)
7
+ && !/[\u0000-\u0020\u007f]/u.test(url) ? url : undefined;
8
+ const target = ["_blank", "_self", "_parent", "_top"].includes(text("target")) ? text("target") : undefined;
9
+ const rel = [...new Set([
10
+ ...text("rel").split(/\s+/).filter(Boolean),
11
+ ...(target === "_blank" ? ["noopener", "noreferrer"] : []),
12
+ ])].join(" ") || undefined;
13
+ return {
14
+ empty: value.empty !== false,
15
+ tag: value.tag === "button" ? "button" : "a",
16
+ label: text("label"), href, target, rel,
17
+ title: text("title") || undefined,
18
+ type: (["button", "submit", "reset"].includes(text("type")) ? text("type") : "button"),
19
+ };
20
+ }
21
+ export function nativeButtonsLayout(layout = {}) {
22
+ const justify = { left: "flex-start", center: "center", right: "flex-end", "space-between": "space-between" }[String(layout.justifyContent ?? "left")] ?? "flex-start";
23
+ const vertical = layout.orientation === "vertical";
24
+ return `flex-direction:${vertical ? "column" : "row"};justify-content:${justify};align-items:${vertical ? justify === "space-between" ? "stretch" : justify : "center"};flex-wrap:${layout.flexWrap === "nowrap" ? "nowrap" : "wrap"}`;
25
+ }
26
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/astro/native/button.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,UAAU,gBAAgB,CAAC,IAAqC;IACpE,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvF,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,iDAAiD,CAAC,IAAI,CAAC,GAAG,CAAC;WACnE,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5G,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC;YACtB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;YAC3C,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3D,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;IAC3B,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,KAAK;QAC5B,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG;QAC5C,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG;QACvC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS;QACjC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAkC;KACxH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,SAAkC,EAAE;IACtE,MAAM,OAAO,GAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAA6B,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,CAAC,IAAI,YAAY,CAAC;IACnM,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,KAAK,UAAU,CAAC;IACnD,OAAO,kBAAkB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,oBAAoB,OAAO,gBAAgB,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,cAAc,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACzO,CAAC","sourcesContent":["/** WordPress resolves the RichText; Astro restricts URL and control semantics. */\nexport function nativeButtonData(data?: Record<string, unknown> | null) {\n const value = data ?? {};\n const text = (key: string) => typeof value[key] === \"string\" ? String(value[key]) : \"\";\n const url = text(\"href\").trim();\n const href = /^(?:\\/(?!\\/)|#[^\\s]*|https?:\\/\\/|mailto:|tel:)/i.test(url)\n && !/[\\u0000-\\u0020\\u007f]/u.test(url) ? url : undefined;\n const target = [\"_blank\", \"_self\", \"_parent\", \"_top\"].includes(text(\"target\")) ? text(\"target\") : undefined;\n const rel = [...new Set([\n ...text(\"rel\").split(/\\s+/).filter(Boolean),\n ...(target === \"_blank\" ? [\"noopener\", \"noreferrer\"] : []),\n ])].join(\" \") || undefined;\n return {\n empty: value.empty !== false,\n tag: value.tag === \"button\" ? \"button\" : \"a\",\n label: text(\"label\"), href, target, rel,\n title: text(\"title\") || undefined,\n type: ([\"button\", \"submit\", \"reset\"].includes(text(\"type\")) ? text(\"type\") : \"button\") as \"button\" | \"submit\" | \"reset\",\n };\n}\n\nexport function nativeButtonsLayout(layout: Record<string, unknown> = {}) {\n const justify = ({ left: \"flex-start\", center: \"center\", right: \"flex-end\", \"space-between\": \"space-between\" } as Record<string, string>)[String(layout.justifyContent ?? \"left\")] ?? \"flex-start\";\n const vertical = layout.orientation === \"vertical\";\n return `flex-direction:${vertical ? \"column\" : \"row\"};justify-content:${justify};align-items:${vertical ? justify === \"space-between\" ? \"stretch\" : justify : \"center\"};flex-wrap:${layout.flexWrap === \"nowrap\" ? \"nowrap\" : \"wrap\"}`;\n}\n"]}
@@ -0,0 +1,26 @@
1
+ /** WordPress resolves the RichText; Astro restricts URL and control semantics. */
2
+ export function nativeButtonData(data?: Record<string, unknown> | null) {
3
+ const value = data ?? {};
4
+ const text = (key: string) => typeof value[key] === "string" ? String(value[key]) : "";
5
+ const url = text("href").trim();
6
+ const href = /^(?:\/(?!\/)|#[^\s]*|https?:\/\/|mailto:|tel:)/i.test(url)
7
+ && !/[\u0000-\u0020\u007f]/u.test(url) ? url : undefined;
8
+ const target = ["_blank", "_self", "_parent", "_top"].includes(text("target")) ? text("target") : undefined;
9
+ const rel = [...new Set([
10
+ ...text("rel").split(/\s+/).filter(Boolean),
11
+ ...(target === "_blank" ? ["noopener", "noreferrer"] : []),
12
+ ])].join(" ") || undefined;
13
+ return {
14
+ empty: value.empty !== false,
15
+ tag: value.tag === "button" ? "button" : "a",
16
+ label: text("label"), href, target, rel,
17
+ title: text("title") || undefined,
18
+ type: (["button", "submit", "reset"].includes(text("type")) ? text("type") : "button") as "button" | "submit" | "reset",
19
+ };
20
+ }
21
+
22
+ export function nativeButtonsLayout(layout: Record<string, unknown> = {}) {
23
+ const justify = ({ left: "flex-start", center: "center", right: "flex-end", "space-between": "space-between" } as Record<string, string>)[String(layout.justifyContent ?? "left")] ?? "flex-start";
24
+ const vertical = layout.orientation === "vertical";
25
+ return `flex-direction:${vertical ? "column" : "row"};justify-content:${justify};align-items:${vertical ? justify === "space-between" ? "stretch" : justify : "center"};flex-wrap:${layout.flexWrap === "nowrap" ? "nowrap" : "wrap"}`;
26
+ }
@@ -0,0 +1,18 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../index.js";
4
+ import SyncedPatternContent from "./SyncedPatternContent.astro";
5
+
6
+ // WordPress renders a synced pattern without a wrapper: keep the root only
7
+ // when the block authors something beyond the reference itself (anchor, class,
8
+ // Styleflow axes). Computed props are not enough, because the semantic
9
+ // renderer adds defaults to every block.
10
+ const props = Astro.props as FlowpressBlockRendererProps;
11
+ const { block, htmlProps, styleflowProps } = props;
12
+ const structural = new Set(["ref", "content", "lock", "metadata"]);
13
+ const ownsSemanticContext = Object.keys(block.attributes ?? {}).some((name) => !structural.has(name));
14
+ ---
15
+
16
+ {ownsSemanticContext
17
+ ? <StyleflowElement as="div" {...htmlProps} {...styleflowProps}><SyncedPatternContent {...props} selfRenderer={Astro.self}><slot /></SyncedPatternContent></StyleflowElement>
18
+ : <SyncedPatternContent {...props} selfRenderer={Astro.self}><slot /></SyncedPatternContent>}
@@ -0,0 +1,43 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../index.js";
4
+ import { nativeButtonData } from "./button.js";
5
+
6
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
7
+ const button = nativeButtonData(block.resolvedData);
8
+ const resolved = typeof block.resolvedData?.empty === "boolean";
9
+ const width = Number(block.attributes.width);
10
+ const rootProps = {
11
+ ...htmlProps,
12
+ class: ["wp-block-button", htmlProps.class].filter(Boolean).join(" "),
13
+ style: [htmlProps.style, [25, 50, 75, 100].includes(width) ? `width:${width}%` : ""].filter(Boolean).join(";"),
14
+ };
15
+ const controlProps = {
16
+ ...styleflowProps,
17
+ ...(!block.attributes.layoutRole ? { layoutRole: "control" as const } : {}),
18
+ ...(!block.attributes.density ? { density: "regular" as const } : {}),
19
+ class: "wp-block-button__link wp-element-button",
20
+ title: button.title,
21
+ };
22
+ ---
23
+
24
+ {!resolved ? (
25
+ block.innerHtml ? <StyleflowElement as="div" {...htmlProps} {...styleflowProps} data-flowpress-button-legacy set:html={block.innerHtml} /> : null
26
+ ) : !button.empty ? (
27
+ <StyleflowElement as="div" {...rootProps}>
28
+ {button.tag === "button" ? (
29
+ <StyleflowElement as="button" {...controlProps} type={button.type}><Fragment set:html={button.label} /></StyleflowElement>
30
+ ) : button.href ? (
31
+ <StyleflowElement as="a" {...controlProps} href={button.href} target={button.target} rel={button.rel}>
32
+ <Fragment set:html={button.label} />
33
+ </StyleflowElement>
34
+ ) : (
35
+ <StyleflowElement as="span" {...controlProps} aria-disabled="true"><Fragment set:html={button.label} /></StyleflowElement>
36
+ )}
37
+ </StyleflowElement>
38
+ ) : null}
39
+
40
+ <style>
41
+ .wp-block-button__link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
42
+ .wp-block-button[style*="width:"] .wp-block-button__link { width: 100%; }
43
+ </style>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../index.js";
4
+ import { nativeButtonsLayout } from "./button.js";
5
+
6
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
7
+ const layout = block.attributes.layout as Record<string, unknown> | undefined;
8
+ const rootProps = {
9
+ ...htmlProps,
10
+ class: ["wp-block-buttons flex flex-wrap gap-4", htmlProps.class].filter(Boolean).join(" "),
11
+ style: [htmlProps.style, nativeButtonsLayout(layout)].filter(Boolean).join(";"),
12
+ };
13
+ ---
14
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
@@ -0,0 +1,23 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../index.js";
4
+
5
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
6
+ const authored = String(block.attributes.tagName ?? "div");
7
+ const tag = (["div", "section", "article", "header", "footer", "main", "aside", "nav"].includes(authored)
8
+ ? authored
9
+ : "div");
10
+ const rootProps = {
11
+ ...htmlProps,
12
+ id: htmlProps.id || (tag === "main" ? "main-content" : undefined),
13
+ };
14
+ ---
15
+
16
+ {tag === "section" ? <StyleflowElement as="section" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
17
+ : tag === "article" ? <StyleflowElement as="article" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
18
+ : tag === "header" ? <StyleflowElement as="header" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
19
+ : tag === "footer" ? <StyleflowElement as="footer" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
20
+ : tag === "main" ? <StyleflowElement as="main" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
21
+ : tag === "aside" ? <StyleflowElement as="aside" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
22
+ : tag === "nav" ? <StyleflowElement as="nav" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
23
+ : <StyleflowElement as="div" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>}
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../index.js";
5
+
6
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
7
+ const href = String(block.resolvedData?.url ?? block.attributes.url ?? "/");
8
+ const label = decodeFlowpressText(block.resolvedData?.label ?? block.attributes.label ?? "Home");
9
+ const rootProps = { ...htmlProps, class: ["wp-block-navigation-item", htmlProps.class].filter(Boolean).join(" ") };
10
+ ---
11
+
12
+ <StyleflowElement as="li" {...rootProps} {...styleflowProps}><StyleflowElement as="a" class="wp-block-navigation-item__content" href={href}><StyleflowElement as="span" class="wp-block-navigation-item__label">{label}</StyleflowElement></StyleflowElement></StyleflowElement>
@@ -0,0 +1,8 @@
1
+ ---
2
+ import type { FlowpressBlockRendererProps } from "../../index.js";
3
+ import NativeHtmlBlock from "./NativeHtmlBlock.astro";
4
+
5
+ const { htmlProps, styleflowProps, ...props } = Astro.props as FlowpressBlockRendererProps;
6
+ ---
7
+
8
+ <NativeHtmlBlock {...props} htmlProps={htmlProps} styleflowProps={styleflowProps} />
@@ -0,0 +1,7 @@
1
+ ---
2
+ import type { FlowpressBlockRendererProps } from "../../index.js";
3
+ import NativeIconBlock from "./NativeIconBlock.astro";
4
+ const { htmlProps, styleflowProps, ...props } = Astro.props as FlowpressBlockRendererProps;
5
+ ---
6
+
7
+ <NativeIconBlock {...props} htmlProps={htmlProps} styleflowProps={styleflowProps} />
@@ -0,0 +1,124 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../index.js";
4
+
5
+ type ImageResolvedData = {
6
+ id?: number | undefined;
7
+ url?: string | undefined;
8
+ fullUrl?: string | undefined;
9
+ alt?: string | undefined;
10
+ width?: number | undefined;
11
+ height?: number | undefined;
12
+ srcSet?: string | undefined;
13
+ sizes?: string | undefined;
14
+ caption?: string | undefined;
15
+ figureClass?: string | undefined;
16
+ href?: string | undefined;
17
+ imageClass?: string | undefined;
18
+ linkClass?: string | undefined;
19
+ linkTarget?: string | undefined;
20
+ lightboxEnabled?: boolean | undefined;
21
+ rel?: string | undefined;
22
+ title?: string | undefined;
23
+ };
24
+
25
+ const { block, htmlProps, styleflowProps: rendererStyleflowProps } = Astro.props as FlowpressBlockRendererProps;
26
+ const attributes = block.attributes;
27
+ const media = (block.resolvedData ?? {}) as ImageResolvedData;
28
+ // A native image is not a stack container. The semantic renderer supplies
29
+ // stack/regular defaults inside sf/* layouts, which override authored image
30
+ // utilities such as rounded-lg. Only apply layout coordinates it authors.
31
+ const { layoutRole: inheritedRole, density: inheritedDensity, ...remainingSemantic } = rendererStyleflowProps;
32
+ const styleflowProps = attributes.layoutRole ? rendererStyleflowProps : remainingSemantic;
33
+
34
+ function text(value: unknown): string {
35
+ return typeof value === "string" ? value.trim() : "";
36
+ }
37
+
38
+ function positiveInteger(value: unknown): number | undefined {
39
+ const match = String(value ?? "").trim().match(/^(\d+)(?:px)?$/);
40
+ const number = match ? Number(match[1]) : Number(value);
41
+ return Number.isInteger(number) && number > 0 ? number : undefined;
42
+ }
43
+
44
+ function classNames(...values: unknown[]): string | undefined {
45
+ const className = [...new Set(
46
+ values
47
+ .flatMap((value) => String(value ?? "").split(/\s+/))
48
+ .filter(Boolean),
49
+ )].join(" ");
50
+ return className || undefined;
51
+ }
52
+
53
+ const src = text(media.url) || text(attributes.url);
54
+ const id = positiveInteger(media.id) ?? positiveInteger(attributes.id);
55
+ const width = positiveInteger(attributes.width) ?? positiveInteger(media.width);
56
+ const height = positiveInteger(attributes.height) ?? positiveInteger(media.height);
57
+ const alt = typeof attributes.alt === "string"
58
+ ? attributes.alt
59
+ : typeof media.alt === "string"
60
+ ? media.alt
61
+ : "";
62
+ const caption = text(attributes.caption) || text(media.caption);
63
+ const title = text(attributes.title) || text(media.title) || undefined;
64
+ const srcSet = text(media.srcSet) || undefined;
65
+ const sizes = srcSet ? text(media.sizes) || undefined : undefined;
66
+ const authoredHref = text(attributes.href) || text(media.href);
67
+ const lightbox = attributes.lightbox && typeof attributes.lightbox === "object"
68
+ ? attributes.lightbox as Record<string, unknown>
69
+ : {};
70
+ const lightboxEnabled = lightbox.enabled === true || media.lightboxEnabled === true;
71
+ const lightboxHref = lightboxEnabled && !authoredHref ? text(media.fullUrl) || src : "";
72
+ const href = authoredHref || lightboxHref || undefined;
73
+ const external = (attributes.linkTarget ?? media.linkTarget) === "_blank";
74
+ const authoredRel = text(attributes.rel) || text(media.rel);
75
+ const rel = external
76
+ ? [...new Set([...authoredRel.split(/\s+/).filter(Boolean), "noopener", "noreferrer"])].join(" ")
77
+ : authoredRel || undefined;
78
+ const align = ["left", "center", "right", "wide", "full"].includes(String(attributes.align))
79
+ ? `align${String(attributes.align)}`
80
+ : "";
81
+ const sizeSlug = text(attributes.sizeSlug).replace(/[^a-z0-9_-]/gi, "");
82
+ const sizeClass = sizeSlug ? `size-${sizeSlug}` : "";
83
+ const rootProps = {
84
+ ...htmlProps,
85
+ class: classNames("wp-block-image", align, sizeClass, media.figureClass, htmlProps.class) ?? "",
86
+ };
87
+ const imageClass = classNames(
88
+ id ? `wp-image-${id}` : "",
89
+ media.imageClass,
90
+ attributes.imageClassName,
91
+ );
92
+ const imageProps = {
93
+ src,
94
+ srcset: srcSet,
95
+ sizes,
96
+ width,
97
+ height,
98
+ alt,
99
+ title,
100
+ class: imageClass,
101
+ loading: "lazy" as const,
102
+ decoding: "async" as const,
103
+ };
104
+ ---
105
+
106
+ {src ? (
107
+ <StyleflowElement as="figure" {...rootProps} {...styleflowProps} data-flowpress-image-lightbox={lightboxHref ? "link" : undefined}>
108
+ {href ? (
109
+ <StyleflowElement as="a"
110
+ href={href}
111
+ class={text(attributes.linkClass) || text(media.linkClass) || undefined}
112
+ target={external ? "_blank" : undefined}
113
+ rel={rel}
114
+ >
115
+ <StyleflowElement as="img" {...imageProps} />
116
+ </StyleflowElement>
117
+ ) : <StyleflowElement as="img" {...imageProps} />}
118
+ {caption ? (
119
+ <StyleflowElement as="figcaption" class="wp-element-caption">
120
+ <Fragment set:html={caption} />
121
+ </StyleflowElement>
122
+ ) : null}
123
+ </StyleflowElement>
124
+ ) : null}
@@ -0,0 +1,71 @@
1
+ ---
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../index.js";
5
+
6
+ const { block, htmlProps, styleflowProps } =
7
+ Astro.props as FlowpressBlockRendererProps;
8
+ const href = String(block.attributes.url ?? "").trim() || "#";
9
+ const label = decodeFlowpressText(block.attributes.label ?? block.attributes.title ?? href);
10
+ const external = block.attributes.opensInNewTab === true;
11
+ const authoredRel = String(block.attributes.rel ?? "").trim();
12
+ const rel = external
13
+ ? [
14
+ ...new Set([
15
+ ...authoredRel.split(/\s+/).filter(Boolean),
16
+ "noopener",
17
+ "noreferrer",
18
+ ]),
19
+ ].join(" ")
20
+ : authoredRel || undefined;
21
+ const rootProps = {
22
+ ...htmlProps,
23
+ class: ["wp-block-navigation-item", htmlProps.class]
24
+ .filter(Boolean)
25
+ .join(" "),
26
+ };
27
+
28
+ // aria-current only for a link to this very page on this very site. The label of that link sits
29
+ // on the marker, so it takes the marker's own paired foreground (see the label below).
30
+ const withoutTrailingSlash = (path: string) => path.replace(/\/+$/, "") || "/";
31
+ let current = false;
32
+ try {
33
+ const target = new URL(href, Astro.url);
34
+ current =
35
+ !external &&
36
+ target.hostname === Astro.url.hostname &&
37
+ withoutTrailingSlash(target.pathname) ===
38
+ withoutTrailingSlash(Astro.url.pathname);
39
+ } catch {
40
+ current = false;
41
+ }
42
+ ---
43
+
44
+ <StyleflowElement as="li" {...rootProps} {...styleflowProps}>
45
+ <StyleflowElement as="a"
46
+ class="wp-block-navigation-item__content site-nav__link"
47
+ href={href}
48
+ title={String(block.attributes.title ?? "").trim() || undefined}
49
+ target={external ? "_blank" : undefined}
50
+ rel={rel}
51
+ aria-current={current ? "page" : undefined}
52
+ layoutRole="control"
53
+ density="compact"
54
+ {...(!current ? { interactivePriority: "tertiary" } : {})}
55
+ >
56
+ {
57
+ current ? (
58
+ <StyleflowElement as="span"
59
+ class="wp-block-navigation-item__label"
60
+ surface="default"
61
+ foreground="accent"
62
+ noBackground
63
+ >
64
+ {label}
65
+ </StyleflowElement>
66
+ ) : (
67
+ <StyleflowElement as="span" class="wp-block-navigation-item__label">{label}</StyleflowElement>
68
+ )
69
+ }
70
+ </StyleflowElement>
71
+ </StyleflowElement>
@@ -0,0 +1,33 @@
1
+ ---
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../index.js";
5
+
6
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
7
+ const label = decodeFlowpressText(block.attributes.label ?? block.attributes.title ?? "Submenu");
8
+ const rootProps = { ...htmlProps, class: ["wp-block-navigation-item has-child", htmlProps.class].filter(Boolean).join(" ") };
9
+ ---
10
+
11
+ <StyleflowElement as="li" {...rootProps} {...styleflowProps}>
12
+ <StyleflowElement as="details" data-navigation-disclosure class="site-nav__disclosure">
13
+ <StyleflowElement as="summary"
14
+ class="site-nav__link site-nav__summary"
15
+ layoutRole="control"
16
+ density="regular"
17
+ interactivePriority="tertiary"
18
+ noBackground
19
+ noBorder
20
+ >
21
+ <StyleflowElement as="span" class="wp-block-navigation-item__label">{label}</StyleflowElement>
22
+ <StyleflowElement as="span" aria-hidden="true" class="site-nav__chevron"></StyleflowElement>
23
+ </StyleflowElement>
24
+ <StyleflowElement as="ul"
25
+ class="wp-block-navigation__submenu-container site-nav__submenu"
26
+
27
+
28
+ surface="default"
29
+ layoutRole="panel"
30
+ density="compact"
31
+ ><slot /></StyleflowElement>
32
+ </StyleflowElement>
33
+ </StyleflowElement>
@@ -0,0 +1,94 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import "./flowpress-navigation.css";
4
+ import type { FlowpressBlockRendererProps } from "../../index.js";
5
+
6
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
7
+ const ref = Number(block.resolvedData?.ref ?? block.attributes.ref ?? 0);
8
+ const anchor = String(block.attributes.anchor ?? "").trim();
9
+ // A navigation can be inserted twice with the same ref (or without one).
10
+ const navigationId = anchor || `flowpress-navigation-${Number.isFinite(ref) ? ref : 0}-${crypto.randomUUID()}`;
11
+ const label = String(
12
+ block.resolvedData?.ariaLabel ?? block.attributes.ariaLabel ?? "Menu principale",
13
+ );
14
+ const authoredOverlay = String(block.attributes.overlayMenu ?? block.attributes.overlay ?? "mobile");
15
+ const overlay = ["always", "never", "mobile"].includes(authoredOverlay) ? authoredOverlay : "mobile";
16
+ const layout = block.attributes.layout as { orientation?: string } | undefined;
17
+ const vertical = layout?.orientation === "vertical";
18
+ const openLabel = String(block.attributes.openMenuLabel ?? "Open menu");
19
+ const closeLabel = String(block.attributes.closeMenuLabel ?? "Close menu");
20
+ ---
21
+
22
+ <!--
23
+ A disclosure, not a dialog: below the breakpoint the list opens as a card
24
+ under the header, from the breakpoint up it is the plain inline list.
25
+ Behaviour (focus, Escape, scroll lock, inert, motion preference) lives in
26
+ the shared navigation controller; the look in navigation.css.
27
+ -->
28
+ <!-- styleflow-ignore-next-line rule=sf-raw-html reason="Certified navigation custom element owns behavior without visual values" scope="framework" -->
29
+ <flowpress-navigation
30
+ class="site-nav"
31
+ data-overlay={overlay}
32
+ data-orientation={vertical ? "vertical" : "horizontal"}
33
+ data-overlay-breakpoint={String(block.attributes.overlayBreakpoint ?? "64rem")}
34
+ data-open-label={openLabel}
35
+ data-close-label={closeLabel}
36
+ >
37
+ <StyleflowElement as="nav" {...htmlProps} {...styleflowProps} layoutRole="none" aria-label={label}>
38
+ <StyleflowElement as="button"
39
+ type="button"
40
+ data-navigation-toggle
41
+ aria-expanded="false"
42
+ aria-controls={`${navigationId}-panel`}
43
+ aria-label={openLabel}
44
+
45
+
46
+ surface="default"
47
+ foreground="primary"
48
+ layoutRole="control"
49
+ density="compact"
50
+ interactivePriority="tertiary"
51
+ class="site-nav__toggle sf-motion-menu-toggle"
52
+ hidden
53
+ >
54
+ <StyleflowElement as="span" class="sr-only">{openLabel}</StyleflowElement>
55
+ <StyleflowElement as="span" aria-hidden="true" class="sf-motion-menu-toggle__icon relative block size-5">
56
+ <StyleflowElement as="span" class="sf-motion-menu-toggle__line"></StyleflowElement>
57
+ <StyleflowElement as="span" class="sf-motion-menu-toggle__line"></StyleflowElement>
58
+ </StyleflowElement>
59
+ </StyleflowElement>
60
+ <StyleflowElement as="div"
61
+ data-navigation-backdrop
62
+ data-sf-motion-state="closed"
63
+
64
+
65
+ surface="default"
66
+ layoutRole="none"
67
+ class="sf-motion-backdrop site-nav__backdrop"
68
+ hidden
69
+ ></StyleflowElement>
70
+ <StyleflowElement as="div"
71
+ id={`${navigationId}-panel`}
72
+ data-navigation-panel
73
+ data-sf-motion-state="closed"
74
+ layoutRole="none"
75
+ class="site-nav__panel"
76
+ >
77
+ <StyleflowElement as="span"
78
+ aria-hidden="true"
79
+
80
+
81
+ surface="default"
82
+ layoutRole="panel"
83
+ density="regular"
84
+ class="site-nav__sheet"
85
+ ></StyleflowElement>
86
+ <StyleflowElement as="ul" layoutRole="stack" density="regular" class="site-nav__list"><slot /></StyleflowElement>
87
+ </StyleflowElement>
88
+ </StyleflowElement>
89
+ </flowpress-navigation>
90
+
91
+ <script>
92
+ import { registerFlowpressNavigation } from "./flowpress-navigation-controller.js";
93
+ registerFlowpressNavigation();
94
+ </script>
@@ -0,0 +1,19 @@
1
+ ---
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+
5
+ interface Props { item: Record<string, unknown>; styleflowProps?: Record<string, unknown> | undefined; htmlProps?: { id?: string | undefined; class?: string } | undefined; }
6
+ const { item, styleflowProps = {}, htmlProps = {} } = Astro.props;
7
+ const children = Array.isArray(item.children)
8
+ ? item.children as Record<string, unknown>[]
9
+ : [];
10
+ ---
11
+
12
+ <StyleflowElement as="li" {...htmlProps} class={["wp-block-pages-list__item", htmlProps.class].filter(Boolean).join(" ")} {...styleflowProps}>
13
+ <StyleflowElement as="a" href={String(item.url ?? "#")}>{decodeFlowpressText(item.label)}</StyleflowElement>
14
+ {children.length > 0 && (
15
+ <StyleflowElement as="ul">
16
+ {children.map((child) => <Astro.self item={child} />)}
17
+ </StyleflowElement>
18
+ )}
19
+ </StyleflowElement>
@@ -0,0 +1,8 @@
1
+ ---
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../index.js";
5
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
6
+ const rootProps = { ...htmlProps, class: ["wp-block-pages-list__item", htmlProps.class].filter(Boolean).join(" ") };
7
+ ---
8
+ <StyleflowElement as="li" {...rootProps} {...styleflowProps}><StyleflowElement as="a" href={String(block.attributes.url ?? "#")}>{decodeFlowpressText(block.attributes.label)}</StyleflowElement><slot /></StyleflowElement>
@@ -0,0 +1,40 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../index.js";
4
+ import PageListItem from "./core-page-list-data-item.astro";
5
+
6
+ const { block, parentBlockName, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
7
+ const items = Array.isArray(block.resolvedData?.items)
8
+ ? block.resolvedData.items as Record<string, unknown>[]
9
+ : [];
10
+ interface PageListNode extends Record<string, unknown> {
11
+ id?: unknown | undefined;
12
+ parentId?: unknown | undefined;
13
+ children: PageListNode[];
14
+ }
15
+ const nodes = new Map<number, PageListNode>(items.map((item) => {
16
+ const node = { ...item, children: [] } as PageListNode;
17
+ return [Number(node.id), node];
18
+ }));
19
+ const roots: PageListNode[] = [];
20
+ for (const item of nodes.values()) {
21
+ const id = Number(item.id);
22
+ const parent = nodes.get(Number(item.parentId));
23
+ if (parent && Number(parent.id) !== id) {
24
+ parent.children.push(item);
25
+ } else {
26
+ roots.push(item);
27
+ }
28
+ }
29
+ const nestedInNavigation = ["core/navigation", "core/navigation-submenu"]
30
+ .includes(parentBlockName ?? "");
31
+ ---
32
+
33
+ {nestedInNavigation
34
+ ? roots.map((item, index) => <PageListItem item={item} styleflowProps={styleflowProps} htmlProps={index === 0 ? htmlProps : undefined} />)
35
+ : (
36
+ <StyleflowElement as="ul" {...htmlProps} class={["wp-block-page-list", htmlProps.class].filter(Boolean).join(" ")} {...styleflowProps}>
37
+ {roots.map((item) => <PageListItem item={item} />)}
38
+ </StyleflowElement>
39
+ )}
40
+ <slot />
@@ -0,0 +1,21 @@
1
+ ---
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../index.js";
5
+ import { classNames, text } from "./query-loop.js";
6
+
7
+ // Publication (or modification) date of the current loop item.
8
+ const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
9
+ const datetime = text(block.resolvedData?.datetime);
10
+ const formatted = decodeFlowpressText(block.resolvedData?.formatted);
11
+ const url = text(block.resolvedData?.url);
12
+ const rootProps = { ...htmlProps, class: classNames("wp-block-post-date", htmlProps.class) };
13
+ ---
14
+
15
+ {formatted ? (
16
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}>
17
+ {block.attributes.isLink && url
18
+ ? <StyleflowElement as="a" href={url}><StyleflowElement as="time" datetime={datetime}>{formatted}</StyleflowElement></StyleflowElement>
19
+ : <StyleflowElement as="time" datetime={datetime}>{formatted}</StyleflowElement>}
20
+ </StyleflowElement>
21
+ ) : null}