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

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 (304) hide show
  1. package/CHANGELOG.md +197 -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 +168 -0
  9. package/dist/astro/DefaultBlockAdapter.astro +36 -0
  10. package/dist/astro/DefaultTemplate.astro +12 -7
  11. package/dist/astro/FontStylesheets.astro +35 -0
  12. package/dist/astro/GutenbergRenderer.astro +280 -81
  13. package/dist/astro/Media.astro +24 -0
  14. package/dist/astro/StyleflowElement.astro +24 -0
  15. package/dist/astro/ThemeRuntime.astro +26 -0
  16. package/dist/astro/blocks/CarouselBlock.astro +11 -10
  17. package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
  18. package/dist/astro/blocks/ColumnBlock.astro +4 -5
  19. package/dist/astro/blocks/CoverBlock.astro +156 -0
  20. package/dist/astro/blocks/FormBlock.astro +23 -20
  21. package/dist/astro/blocks/GridBlock.astro +4 -4
  22. package/dist/astro/blocks/HeroBlock.astro +6 -6
  23. package/dist/astro/blocks/ImageBlock.astro +6 -6
  24. package/dist/astro/blocks/ListItemFallback.astro +12 -8
  25. package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
  26. package/dist/astro/blocks/SemanticElement.astro +35 -0
  27. package/dist/astro/blocks/SiteLogoBlock.astro +54 -0
  28. package/dist/astro/blocks/TextBlock.astro +33 -28
  29. package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
  30. package/dist/astro/blocks/cover.d.ts +13 -0
  31. package/dist/astro/blocks/cover.d.ts.map +1 -0
  32. package/dist/astro/blocks/cover.js +105 -0
  33. package/dist/astro/blocks/cover.js.map +1 -0
  34. package/dist/astro/blocks/cover.ts +119 -0
  35. package/dist/astro/blocks/helpers.d.ts +10 -1
  36. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  37. package/dist/astro/blocks/helpers.js +57 -44
  38. package/dist/astro/blocks/helpers.js.map +1 -1
  39. package/dist/astro/blocks/helpers.ts +71 -49
  40. package/dist/astro/motion/AccordionRuntime.astro +9 -0
  41. package/dist/astro/motion/MotionBoot.astro +21 -0
  42. package/dist/astro/motion/MotionRuntime.astro +31 -0
  43. package/dist/astro/motion/accordion.css +163 -0
  44. package/dist/astro/motion/accordion.d.ts +3 -0
  45. package/dist/astro/motion/accordion.d.ts.map +1 -0
  46. package/dist/astro/motion/accordion.js +98 -0
  47. package/dist/astro/motion/accordion.js.map +1 -0
  48. package/dist/astro/motion/accordion.ts +109 -0
  49. package/dist/astro/motion/motion-controller.d.ts +12 -0
  50. package/dist/astro/motion/motion-controller.d.ts.map +1 -0
  51. package/dist/astro/motion/motion-controller.js +293 -0
  52. package/dist/astro/motion/motion-controller.js.map +1 -0
  53. package/dist/astro/motion/motion-controller.ts +377 -0
  54. package/dist/astro/motion/motion.css +546 -0
  55. package/dist/astro/motion/motion.d.ts +127 -0
  56. package/dist/astro/motion/motion.d.ts.map +1 -0
  57. package/dist/astro/motion/motion.js +255 -0
  58. package/dist/astro/motion/motion.js.map +1 -0
  59. package/dist/astro/motion/motion.ts +419 -0
  60. package/dist/astro/native/Blob.astro +113 -0
  61. package/dist/astro/native/BlobBlock.astro +52 -0
  62. package/dist/astro/native/CustomFieldValue.astro +88 -0
  63. package/dist/astro/native/LevelTag.astro +20 -0
  64. package/dist/astro/native/MapBlock.astro +41 -0
  65. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  66. package/dist/astro/native/NativeIconBlock.astro +42 -0
  67. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  68. package/dist/astro/native/ReservedLogin.astro +107 -0
  69. package/dist/astro/native/ResolvedBlocks.astro +91 -0
  70. package/dist/astro/native/SyncedPatternContent.astro +94 -0
  71. package/dist/astro/native/TermFieldValue.astro +39 -0
  72. package/dist/astro/native/Timeline.astro +22 -0
  73. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  74. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  75. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  76. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  77. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  78. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  79. package/dist/astro/native/blob/config.d.ts +49 -0
  80. package/dist/astro/native/blob/config.d.ts.map +1 -0
  81. package/dist/astro/native/blob/config.js +86 -0
  82. package/dist/astro/native/blob/config.js.map +1 -0
  83. package/dist/astro/native/blob/config.ts +132 -0
  84. package/dist/astro/native/blob/controller.d.ts +11 -0
  85. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  86. package/dist/astro/native/blob/controller.js +240 -0
  87. package/dist/astro/native/blob/controller.js.map +1 -0
  88. package/dist/astro/native/blob/controller.ts +248 -0
  89. package/dist/astro/native/blob/geometry.d.ts +2 -0
  90. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  91. package/dist/astro/native/blob/geometry.js +2 -0
  92. package/dist/astro/native/blob/geometry.js.map +1 -0
  93. package/dist/astro/native/blob/geometry.ts +1 -0
  94. package/dist/astro/native/blob/ids.d.ts +7 -0
  95. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  96. package/dist/astro/native/blob/ids.js +11 -0
  97. package/dist/astro/native/blob/ids.js.map +1 -0
  98. package/dist/astro/native/blob/ids.ts +11 -0
  99. package/dist/astro/native/blob.css +83 -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 +125 -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 +38 -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 +20 -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/inline-text.css +15 -0
  174. package/dist/astro/native/map.d.ts +14 -0
  175. package/dist/astro/native/map.d.ts.map +1 -0
  176. package/dist/astro/native/map.js +60 -0
  177. package/dist/astro/native/map.js.map +1 -0
  178. package/dist/astro/native/map.ts +70 -0
  179. package/dist/astro/native/motion-preference.d.ts +50 -0
  180. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  181. package/dist/astro/native/motion-preference.js +132 -0
  182. package/dist/astro/native/motion-preference.js.map +1 -0
  183. package/dist/astro/native/motion-preference.ts +158 -0
  184. package/dist/astro/native/motion.d.ts +101 -0
  185. package/dist/astro/native/motion.d.ts.map +1 -0
  186. package/dist/astro/native/motion.js +168 -0
  187. package/dist/astro/native/motion.js.map +1 -0
  188. package/dist/astro/native/motion.ts +312 -0
  189. package/dist/astro/native/query-carousel.d.ts +12 -0
  190. package/dist/astro/native/query-carousel.d.ts.map +1 -0
  191. package/dist/astro/native/query-carousel.js +36 -0
  192. package/dist/astro/native/query-carousel.js.map +1 -0
  193. package/dist/astro/native/query-carousel.ts +56 -0
  194. package/dist/astro/native/query-loop.d.ts +38 -0
  195. package/dist/astro/native/query-loop.d.ts.map +1 -0
  196. package/dist/astro/native/query-loop.js +20 -0
  197. package/dist/astro/native/query-loop.js.map +1 -0
  198. package/dist/astro/native/query-loop.ts +67 -0
  199. package/dist/astro/native/registry.d.ts +3 -0
  200. package/dist/astro/native/registry.d.ts.map +1 -0
  201. package/dist/astro/native/registry.js +84 -0
  202. package/dist/astro/native/registry.js.map +1 -0
  203. package/dist/astro/native/registry.ts +85 -0
  204. package/dist/astro/native/sf-block-binding.astro +20 -0
  205. package/dist/astro/native/sf-post-field.astro +9 -0
  206. package/dist/astro/native/sf-term-field.astro +9 -0
  207. package/dist/astro/native/timeline.css +4 -0
  208. package/dist/astro/native/timeline.d.ts +28 -0
  209. package/dist/astro/native/timeline.d.ts.map +1 -0
  210. package/dist/astro/native/timeline.js +43 -0
  211. package/dist/astro/native/timeline.js.map +1 -0
  212. package/dist/astro/native/timeline.ts +79 -0
  213. package/dist/astro/preferences/AccessibilityPanel.astro +105 -0
  214. package/dist/astro/preferences/ColorModeToggle.astro +26 -0
  215. package/dist/astro/preferences/MotionToggle.astro +27 -0
  216. package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
  217. package/dist/astro/preferences/ThemeToggle.astro +30 -0
  218. package/dist/astro/preferences/Toggle.astro +50 -0
  219. package/dist/astro/preferences/preferences.css +125 -0
  220. package/dist/block-renderers.d.ts +22 -3
  221. package/dist/block-renderers.d.ts.map +1 -1
  222. package/dist/block-renderers.js.map +1 -1
  223. package/dist/client.d.ts +17 -1
  224. package/dist/client.d.ts.map +1 -1
  225. package/dist/client.js +63 -9
  226. package/dist/client.js.map +1 -1
  227. package/dist/composition.d.ts +14 -0
  228. package/dist/composition.d.ts.map +1 -0
  229. package/dist/composition.js +125 -0
  230. package/dist/composition.js.map +1 -0
  231. package/dist/default-blocks.d.ts +9 -0
  232. package/dist/default-blocks.d.ts.map +1 -0
  233. package/dist/default-blocks.js +120 -0
  234. package/dist/default-blocks.js.map +1 -0
  235. package/dist/env.d.ts +9 -0
  236. package/dist/env.d.ts.map +1 -1
  237. package/dist/env.js +20 -0
  238. package/dist/env.js.map +1 -1
  239. package/dist/index.d.ts +8 -0
  240. package/dist/index.d.ts.map +1 -1
  241. package/dist/index.js +7 -0
  242. package/dist/index.js.map +1 -1
  243. package/dist/links.d.ts +5 -0
  244. package/dist/links.d.ts.map +1 -0
  245. package/dist/links.js +32 -0
  246. package/dist/links.js.map +1 -0
  247. package/dist/media.d.ts +28 -0
  248. package/dist/media.d.ts.map +1 -0
  249. package/dist/media.js +212 -0
  250. package/dist/media.js.map +1 -0
  251. package/dist/motion-preference.d.ts +50 -0
  252. package/dist/motion-preference.d.ts.map +1 -0
  253. package/dist/motion-preference.js +132 -0
  254. package/dist/motion-preference.js.map +1 -0
  255. package/dist/preferences-runtime.d.ts +3 -0
  256. package/dist/preferences-runtime.d.ts.map +1 -0
  257. package/dist/preferences-runtime.js +23 -0
  258. package/dist/preferences-runtime.js.map +1 -0
  259. package/dist/preferences-styleflow.d.ts +3 -0
  260. package/dist/preferences-styleflow.d.ts.map +1 -0
  261. package/dist/preferences-styleflow.js +14 -0
  262. package/dist/preferences-styleflow.js.map +1 -0
  263. package/dist/preferences.d.ts +4 -0
  264. package/dist/preferences.d.ts.map +1 -0
  265. package/dist/preferences.js +4 -0
  266. package/dist/preferences.js.map +1 -0
  267. package/dist/reserved-area.d.ts +10 -0
  268. package/dist/reserved-area.d.ts.map +1 -0
  269. package/dist/reserved-area.js +93 -0
  270. package/dist/reserved-area.js.map +1 -0
  271. package/dist/styleflow.d.ts +18 -1
  272. package/dist/styleflow.d.ts.map +1 -1
  273. package/dist/styleflow.js +82 -11
  274. package/dist/styleflow.js.map +1 -1
  275. package/dist/svg-media-runtime.d.ts +3 -0
  276. package/dist/svg-media-runtime.d.ts.map +1 -0
  277. package/dist/svg-media-runtime.js +33 -0
  278. package/dist/svg-media-runtime.js.map +1 -0
  279. package/dist/svg-media-types.d.ts +11 -0
  280. package/dist/svg-media-types.d.ts.map +1 -0
  281. package/dist/svg-media-types.js +2 -0
  282. package/dist/svg-media-types.js.map +1 -0
  283. package/dist/svg-media.d.ts +10 -0
  284. package/dist/svg-media.d.ts.map +1 -0
  285. package/dist/svg-media.js +34 -0
  286. package/dist/svg-media.js.map +1 -0
  287. package/dist/templates.d.ts +16 -16
  288. package/dist/text.d.ts +3 -0
  289. package/dist/text.d.ts.map +1 -0
  290. package/dist/text.js +6 -0
  291. package/dist/text.js.map +1 -0
  292. package/dist/theme-runtime.d.ts +16 -0
  293. package/dist/theme-runtime.d.ts.map +1 -0
  294. package/dist/theme-runtime.js +100 -0
  295. package/dist/theme-runtime.js.map +1 -0
  296. package/dist/tsconfig.tsbuildinfo +1 -1
  297. package/dist/types.d.ts +84 -1
  298. package/dist/types.d.ts.map +1 -1
  299. package/dist/types.js.map +1 -1
  300. package/dist/vivid-colors-preference.d.ts +31 -0
  301. package/dist/vivid-colors-preference.d.ts.map +1 -0
  302. package/dist/vivid-colors-preference.js +102 -0
  303. package/dist/vivid-colors-preference.js.map +1 -0
  304. package/package.json +53 -4
@@ -1,5 +1,6 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
3
4
  import {
4
5
  clampSpinnerDuration,
5
6
  spinnerFractionDigits
@@ -12,16 +13,17 @@ import {
12
13
  semanticProps,
13
14
  textHtmlTag
14
15
  } from "./helpers.js";
16
+ import SemanticElement from "./SemanticElement.astro";
15
17
 
16
18
  interface Props {
17
19
  block: FlowpressBlock;
18
- contract?: StyleflowContract;
20
+ contract?: StyleflowContract | undefined;
19
21
  }
20
22
 
21
23
  const { block, contract } = Astro.props;
22
24
  const attributes = block.attributes;
23
- const prefix = String(attributes.prefix ?? "");
24
- const suffix = String(attributes.suffix ?? "");
25
+ const prefix = decodeFlowpressText(attributes.prefix);
26
+ const suffix = decodeFlowpressText(attributes.suffix);
25
27
  const candidateNumber = Number(attributes.number);
26
28
  const number = Number.isFinite(candidateNumber) ? candidateNumber : 0;
27
29
  const duration = clampSpinnerDuration(attributes.duration);
@@ -56,8 +58,7 @@ const numberTag = textHtmlTag(attributes.numberTag);
56
58
  const suffixTag = textHtmlTag(attributes.suffixTag);
57
59
  ---
58
60
 
59
- <S
60
- as="div"
61
+ <StyleflowElement as="div"
61
62
  {...semantic}
62
63
  {...htmlAttributes}
63
64
  data-flowpress-number-spinner
@@ -67,18 +68,22 @@ const suffixTag = textHtmlTag(attributes.suffixTag);
67
68
  data-spinner-locale={locale || undefined}
68
69
  >
69
70
  {prefix ? (
70
- <S
71
- as={prefixTag}
72
- class="flowpress-number-spinner__segment"
73
- {...prefixSemantic}
71
+ <SemanticElement
72
+ tag={prefixTag}
73
+ attributes={{
74
+ class: "flowpress-number-spinner__segment",
75
+ ...prefixSemantic
76
+ }}
74
77
  >
75
78
  {prefix}
76
- </S>
79
+ </SemanticElement>
77
80
  ) : null}
78
- <S
79
- as={numberTag}
80
- class="flowpress-number-spinner__segment flowpress-number-spinner__number"
81
- {...numberSemantic}
81
+ <SemanticElement
82
+ tag={numberTag}
83
+ attributes={{
84
+ class: "flowpress-number-spinner__segment flowpress-number-spinner__number",
85
+ ...numberSemantic
86
+ }}
82
87
  >
83
88
  <span class="flowpress-number-spinner__accessible-value">
84
89
  {numberText}
@@ -89,17 +94,19 @@ const suffixTag = textHtmlTag(attributes.suffixTag);
89
94
  >
90
95
  {numberText}
91
96
  </span>
92
- </S>
97
+ </SemanticElement>
93
98
  {suffix ? (
94
- <S
95
- as={suffixTag}
96
- class="flowpress-number-spinner__segment"
97
- {...suffixSemantic}
99
+ <SemanticElement
100
+ tag={suffixTag}
101
+ attributes={{
102
+ class: "flowpress-number-spinner__segment",
103
+ ...suffixSemantic
104
+ }}
98
105
  >
99
106
  {suffix}
100
- </S>
107
+ </SemanticElement>
101
108
  ) : null}
102
- </S>
109
+ </StyleflowElement>
103
110
 
104
111
  <script>
105
112
  import { initializeNumberSpinners } from "../../number-spinner.js";
@@ -0,0 +1,35 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+
4
+ type SemanticElementTag =
5
+ | "div" | "span" | "p" | "a" | "li" | "ol" | "ul" | "blockquote"
6
+ | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "strong" | "em"
7
+ | "small" | "mark";
8
+
9
+ interface Props {
10
+ tag: SemanticElementTag;
11
+ attributes?: Record<string, unknown> | undefined;
12
+ html?: string | undefined;
13
+ }
14
+
15
+ const { tag, attributes = {}, html } = Astro.props;
16
+ ---
17
+
18
+ {tag === "div" ? <StyleflowElement as="div" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
19
+ : tag === "span" ? <StyleflowElement as="span" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
20
+ : tag === "p" ? <StyleflowElement as="p" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
21
+ : tag === "a" ? <StyleflowElement as="a" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
22
+ : tag === "li" ? <StyleflowElement as="li" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
23
+ : tag === "ol" ? <StyleflowElement as="ol" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
24
+ : tag === "ul" ? <StyleflowElement as="ul" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
25
+ : tag === "blockquote" ? <StyleflowElement as="blockquote" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
26
+ : tag === "h1" ? <StyleflowElement as="h1" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
27
+ : tag === "h2" ? <StyleflowElement as="h2" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
28
+ : tag === "h3" ? <StyleflowElement as="h3" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
29
+ : tag === "h4" ? <StyleflowElement as="h4" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
30
+ : tag === "h5" ? <StyleflowElement as="h5" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
31
+ : tag === "h6" ? <StyleflowElement as="h6" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
32
+ : tag === "strong" ? <StyleflowElement as="strong" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
33
+ : tag === "em" ? <StyleflowElement as="em" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
34
+ : tag === "small" ? <StyleflowElement as="small" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>
35
+ : <StyleflowElement as="mark" {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</StyleflowElement>}
@@ -0,0 +1,54 @@
1
+ ---
2
+ import Media from "../Media.astro";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
5
+
6
+ type LogoImage = { url?: string | undefined; width?: number | undefined; height?: number | undefined; alt?: string } | undefined;
7
+ type LogoData = {
8
+ images?: { positive?: LogoImage | undefined; negative?: LogoImage } | undefined;
9
+ homeUrl?: string | undefined;
10
+ override?: "auto" | "positive" | "negative" | undefined;
11
+ };
12
+
13
+ const { block, styleflowProps, htmlProps } = Astro.props as FlowpressBlockRendererProps;
14
+ const data = (block.resolvedData ?? {}) as LogoData;
15
+ const positive = data.images?.positive ?? {};
16
+ const negative = data.images?.negative ?? {};
17
+ const homeUrl = typeof data.homeUrl === "string" && data.homeUrl ? data.homeUrl : "/";
18
+ const override = data.override === "positive" || data.override === "negative"
19
+ ? data.override
20
+ : "auto";
21
+ const rootHtmlProps = {
22
+ ...htmlProps,
23
+ class: ["flowpress-site-logo", htmlProps.class].filter(Boolean).join(" ")
24
+ };
25
+ ---
26
+
27
+ {positive.url || negative.url ? (
28
+ <StyleflowElement as="a"
29
+ {...rootHtmlProps}
30
+ {...styleflowProps}
31
+ href={homeUrl}
32
+ data-flowpress-logo-override={override === "auto" ? undefined : override}
33
+ aria-label="Home"
34
+ >
35
+ {positive.url ? (
36
+ <Media
37
+ class="flowpress-site-logo__image flowpress-site-logo__image--positive"
38
+ src={positive.url}
39
+ width={positive.width || undefined}
40
+ height={positive.height || undefined}
41
+ alt={positive.alt ?? ""}
42
+ />
43
+ ) : null}
44
+ {negative.url ? (
45
+ <Media
46
+ class="flowpress-site-logo__image flowpress-site-logo__image--negative"
47
+ src={negative.url}
48
+ width={negative.width || undefined}
49
+ height={negative.height || undefined}
50
+ alt={negative.alt ?? ""}
51
+ />
52
+ ) : null}
53
+ </StyleflowElement>
54
+ ) : null}
@@ -1,5 +1,6 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
3
4
  import type { FlowpressBlock } from "../../types.js";
4
5
  import type { StyleflowContract } from "../../styleflow.js";
5
6
  import {
@@ -7,15 +8,17 @@ import {
7
8
  preserveEmptyTextBlock,
8
9
  preserveRichTextSpacing,
9
10
  semanticProps,
11
+ textBlockSemanticDefaults,
10
12
  textAlignmentStyle,
11
13
  textValue,
12
14
  unwrapCoreHtml
13
15
  } from "./helpers.js";
16
+ import SemanticElement from "./SemanticElement.astro";
14
17
 
15
18
  interface Props {
16
19
  block: FlowpressBlock;
17
- contract?: StyleflowContract;
18
- hasChildren?: boolean;
20
+ contract?: StyleflowContract | undefined;
21
+ hasChildren?: boolean | undefined;
19
22
  }
20
23
 
21
24
  const { block, contract, hasChildren = false } = Astro.props;
@@ -24,21 +27,9 @@ const attributes = block.attributes;
24
27
  const heading = name === "heading" || name === "core/heading";
25
28
  const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));
26
29
  const headingTag = `h${level}` as "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
27
- const defaults = heading
28
- ? {
29
- ty: "heading",
30
- v: String(attributes.v ?? attributes.variant ?? level),
31
- w: String(attributes.w ?? attributes.weight ?? "strong"),
32
- foreground: "primary"
33
- }
34
- : {
35
- ty: "body",
36
- v: String(attributes.v ?? (name.includes("quote") ? "lg" : "md")),
37
- w: String(attributes.w ?? "default"),
38
- foreground: "primary"
39
- };
30
+ const defaults = textBlockSemanticDefaults(name, attributes, contract);
40
31
  const semantic = semanticProps(attributes, contract, defaults);
41
- const htmlAttributes = blockHtmlAttributes(attributes);
32
+ const htmlAttributes = blockHtmlAttributes(attributes, name === "core/list" ? "wp-block-list" : "");
42
33
  const alignmentStyle = textAlignmentStyle(attributes);
43
34
  const coreHtml = String(
44
35
  attributes.content
@@ -60,24 +51,38 @@ const listTag = Boolean(attributes.ordered) ? "ol" : "ul";
60
51
  ---
61
52
 
62
53
  {heading ? (
63
- <S as={headingTag} {...semantic} {...htmlAttributes} style={alignmentStyle} set:html={html} />
54
+ <SemanticElement
55
+ tag={headingTag}
56
+ attributes={{ ...semantic, ...htmlAttributes, style: alignmentStyle }}
57
+ html={html}
58
+ />
64
59
  ) : name === "core/list" ? (
65
- <S as={listTag} {...semantic} {...htmlAttributes} style={alignmentStyle}>
66
- {hasChildren ? <slot /> : <Fragment set:html={html} />}
67
- </S>
60
+ <SemanticElement
61
+ tag={listTag}
62
+ attributes={{ ...semantic, ...htmlAttributes, style: alignmentStyle }}
63
+ html={hasChildren ? undefined : html}
64
+ >
65
+ {hasChildren ? <slot /> : null}
66
+ </SemanticElement>
68
67
  ) : name === "core/list-item" ? (
69
- <S as="li" {...semantic} {...htmlAttributes} style={alignmentStyle}>
68
+ <StyleflowElement as="li" {...semantic} {...htmlAttributes} style={alignmentStyle}>
70
69
  <span set:html={html}></span>
71
70
  {hasChildren ? <slot /> : null}
72
- </S>
71
+ </StyleflowElement>
73
72
  ) : name === "quote" || name === "core/quote" ? (
74
- <S as="blockquote" {...semantic} {...htmlAttributes} style={alignmentStyle}>
73
+ <StyleflowElement as="blockquote" {...semantic} {...htmlAttributes} style={alignmentStyle}>
75
74
  {hasChildren ? <slot /> : <div set:html={html}></div>}
76
- {attributes.citation ? <cite>{String(attributes.citation)}</cite> : null}
77
- </S>
75
+ {attributes.citation ? <cite>{decodeFlowpressText(attributes.citation)}</cite> : null}
76
+ </StyleflowElement>
77
+ ) : name === "core/paragraph" ? (
78
+ <StyleflowElement as="p"
79
+ {...semantic}
80
+ {...htmlAttributes}
81
+ style={alignmentStyle}
82
+ set:html={html}
83
+ />
78
84
  ) : (
79
- <S
80
- as={name === "core/paragraph" ? "p" : "div"}
85
+ <StyleflowElement as="div"
81
86
  {...semantic}
82
87
  {...htmlAttributes}
83
88
  style={alignmentStyle}
@@ -0,0 +1,13 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import ThemeToggle from "../preferences/ThemeToggle.astro";
4
+ import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
5
+ const { block, styleflowProps, htmlProps } = Astro.props as FlowpressBlockRendererProps;
6
+ const label = typeof block.attributes.label === "string" && block.attributes.label.trim()
7
+ ? block.attributes.label.trim() : "Change color theme";
8
+ const showThemeName = block.attributes.showThemeName !== false;
9
+ ---
10
+ <StyleflowElement as="span" {...styleflowProps} class="flowpress-theme-control">
11
+ <ThemeToggle {...htmlProps} label={label} />
12
+ {showThemeName && <StyleflowElement as="span" data-styleflow-theme-label aria-hidden="true" />}
13
+ </StyleflowElement>
@@ -0,0 +1,13 @@
1
+ import type { FlowpressBlock } from "../../types.js";
2
+ export type CoverBackgroundType = "color" | "image" | "video";
3
+ export type CoverTagName = "article" | "aside" | "div" | "footer" | "header" | "main" | "section";
4
+ export declare function coverTagName(value: unknown): CoverTagName;
5
+ export declare function coverMediaSource(block: FlowpressBlock): string;
6
+ export declare function coverPosterSource(block: FlowpressBlock): string | undefined;
7
+ export declare function coverBackgroundType(block: FlowpressBlock): CoverBackgroundType;
8
+ export declare function coverObjectPosition(value: unknown): string;
9
+ export declare function coverMinimumHeight(value: unknown, unitValue: unknown): string | undefined;
10
+ export declare function coverContentPosition(value: unknown): [string, string];
11
+ export declare function coverScrimEnabled(attributes: Record<string, unknown>): boolean;
12
+ export declare function coverScrimOpacity(attributes: Record<string, unknown>): number;
13
+ //# sourceMappingURL=cover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../../src/astro/blocks/cover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAwC9D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAClG,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAGzD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAE9D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAI3E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,mBAAmB,CAK9E;AAUD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQ1D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAGrE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAM9E;AAQD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAK7E"}
@@ -0,0 +1,105 @@
1
+ const COVER_TAGS = new Set([
2
+ "article",
3
+ "aside",
4
+ "div",
5
+ "footer",
6
+ "header",
7
+ "main",
8
+ "section"
9
+ ]);
10
+ const HEIGHT_UNITS = new Set([
11
+ "px",
12
+ "%",
13
+ "em",
14
+ "rem",
15
+ "vh",
16
+ "svh",
17
+ "lvh",
18
+ "dvh",
19
+ "vw"
20
+ ]);
21
+ const CONTENT_POSITIONS = {
22
+ "top left": ["start", "start"],
23
+ "top center": ["start", "center"],
24
+ "top right": ["start", "end"],
25
+ "center left": ["center", "start"],
26
+ "center center": ["center", "center"],
27
+ "center right": ["center", "end"],
28
+ "bottom left": ["end", "start"],
29
+ "bottom center": ["end", "center"],
30
+ "bottom right": ["end", "end"]
31
+ };
32
+ function text(value) {
33
+ return typeof value === "string" ? value.trim() : "";
34
+ }
35
+ export function coverTagName(value) {
36
+ const candidate = text(value).toLowerCase();
37
+ return COVER_TAGS.has(candidate) ? candidate : "div";
38
+ }
39
+ export function coverMediaSource(block) {
40
+ return text(block.attributes.url) || text(block.resolvedData?.url);
41
+ }
42
+ export function coverPosterSource(block) {
43
+ return text(block.attributes.poster)
44
+ || text(block.resolvedData?.poster)
45
+ || undefined;
46
+ }
47
+ export function coverBackgroundType(block) {
48
+ const requested = text(block.attributes.backgroundType).toLowerCase();
49
+ if (requested === "video")
50
+ return "video";
51
+ if (requested === "color")
52
+ return "color";
53
+ return coverMediaSource(block) ? "image" : "color";
54
+ }
55
+ function percentage(value) {
56
+ const numeric = typeof value === "number" ? value : Number(value);
57
+ if (!Number.isFinite(numeric))
58
+ return undefined;
59
+ if (numeric >= 0 && numeric <= 1)
60
+ return numeric * 100;
61
+ if (numeric >= 0 && numeric <= 100)
62
+ return numeric;
63
+ return undefined;
64
+ }
65
+ export function coverObjectPosition(value) {
66
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
67
+ return "50% 50%";
68
+ }
69
+ const focalPoint = value;
70
+ const x = percentage(focalPoint.x);
71
+ const y = percentage(focalPoint.y);
72
+ return x === undefined || y === undefined ? "50% 50%" : `${x}% ${y}%`;
73
+ }
74
+ export function coverMinimumHeight(value, unitValue) {
75
+ const numeric = typeof value === "number" ? value : Number(value);
76
+ if (!Number.isFinite(numeric) || numeric < 0)
77
+ return undefined;
78
+ const requestedUnit = text(unitValue).toLowerCase();
79
+ const unit = HEIGHT_UNITS.has(requestedUnit) ? requestedUnit : "px";
80
+ return `${numeric}${unit}`;
81
+ }
82
+ export function coverContentPosition(value) {
83
+ return CONTENT_POSITIONS[text(value).toLowerCase()]
84
+ ?? ["center", "center"];
85
+ }
86
+ export function coverScrimEnabled(attributes) {
87
+ if (typeof attributes.scrimEnabled === "boolean") {
88
+ return attributes.scrimEnabled;
89
+ }
90
+ const nativeDimRatio = Number(attributes.dimRatio);
91
+ return Number.isFinite(nativeDimRatio) && nativeDimRatio > 0;
92
+ }
93
+ function clampedPercentage(value) {
94
+ const numeric = typeof value === "number" ? value : Number(value);
95
+ if (!Number.isFinite(numeric))
96
+ return undefined;
97
+ return Math.min(100, Math.max(0, numeric));
98
+ }
99
+ export function coverScrimOpacity(attributes) {
100
+ const explicitOpacity = clampedPercentage(attributes.scrimOpacity);
101
+ if (explicitOpacity !== undefined)
102
+ return explicitOpacity;
103
+ return clampedPercentage(attributes.dimRatio) ?? 100;
104
+ }
105
+ //# sourceMappingURL=cover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cover.js","sourceRoot":"","sources":["../../../src/astro/blocks/cover.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,IAAI;CACL,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAqC;IAC1D,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;IAC9B,YAAY,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IACjC,WAAW,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IAC7B,aAAa,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;IAClC,eAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACrC,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjC,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;IAClC,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;CAC/B,CAAC;AAEF,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAGD,MAAM,UAAU,YAAY,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,CAAC;WAC9C,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAmC;IACnE,IAAI,OAAO,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACjD,OAAO,UAAU,CAAC,YAAY,CAAC;IACjC,CAAC;IACD,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,cAAc,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAmC;IACnE,MAAM,eAAe,GAAG,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACnE,IAAI,eAAe,KAAK,SAAS;QAAE,OAAO,eAAe,CAAC;IAE1D,OAAO,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC;AACvD,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../types.js\";\n\nexport type CoverBackgroundType = \"color\" | \"image\" | \"video\";\n\nconst COVER_TAGS = new Set([\n \"article\",\n \"aside\",\n \"div\",\n \"footer\",\n \"header\",\n \"main\",\n \"section\"\n]);\n\nconst HEIGHT_UNITS = new Set([\n \"px\",\n \"%\",\n \"em\",\n \"rem\",\n \"vh\",\n \"svh\",\n \"lvh\",\n \"dvh\",\n \"vw\"\n]);\n\nconst CONTENT_POSITIONS: Record<string, [string, string]> = {\n \"top left\": [\"start\", \"start\"],\n \"top center\": [\"start\", \"center\"],\n \"top right\": [\"start\", \"end\"],\n \"center left\": [\"center\", \"start\"],\n \"center center\": [\"center\", \"center\"],\n \"center right\": [\"center\", \"end\"],\n \"bottom left\": [\"end\", \"start\"],\n \"bottom center\": [\"end\", \"center\"],\n \"bottom right\": [\"end\", \"end\"]\n};\n\nfunction text(value: unknown): string {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nexport type CoverTagName = \"article\" | \"aside\" | \"div\" | \"footer\" | \"header\" | \"main\" | \"section\";\nexport function coverTagName(value: unknown): CoverTagName {\n const candidate = text(value).toLowerCase();\n return COVER_TAGS.has(candidate) ? candidate as CoverTagName : \"div\";\n}\n\nexport function coverMediaSource(block: FlowpressBlock): string {\n return text(block.attributes.url) || text(block.resolvedData?.url);\n}\n\nexport function coverPosterSource(block: FlowpressBlock): string | undefined {\n return text(block.attributes.poster)\n || text(block.resolvedData?.poster)\n || undefined;\n}\n\nexport function coverBackgroundType(block: FlowpressBlock): CoverBackgroundType {\n const requested = text(block.attributes.backgroundType).toLowerCase();\n if (requested === \"video\") return \"video\";\n if (requested === \"color\") return \"color\";\n return coverMediaSource(block) ? \"image\" : \"color\";\n}\n\nfunction percentage(value: unknown): number | undefined {\n const numeric = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(numeric)) return undefined;\n if (numeric >= 0 && numeric <= 1) return numeric * 100;\n if (numeric >= 0 && numeric <= 100) return numeric;\n return undefined;\n}\n\nexport function coverObjectPosition(value: unknown): string {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"50% 50%\";\n }\n const focalPoint = value as Record<string, unknown>;\n const x = percentage(focalPoint.x);\n const y = percentage(focalPoint.y);\n return x === undefined || y === undefined ? \"50% 50%\" : `${x}% ${y}%`;\n}\n\nexport function coverMinimumHeight(\n value: unknown,\n unitValue: unknown\n): string | undefined {\n const numeric = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(numeric) || numeric < 0) return undefined;\n const requestedUnit = text(unitValue).toLowerCase();\n const unit = HEIGHT_UNITS.has(requestedUnit) ? requestedUnit : \"px\";\n return `${numeric}${unit}`;\n}\n\nexport function coverContentPosition(value: unknown): [string, string] {\n return CONTENT_POSITIONS[text(value).toLowerCase()]\n ?? [\"center\", \"center\"];\n}\n\nexport function coverScrimEnabled(attributes: Record<string, unknown>): boolean {\n if (typeof attributes.scrimEnabled === \"boolean\") {\n return attributes.scrimEnabled;\n }\n const nativeDimRatio = Number(attributes.dimRatio);\n return Number.isFinite(nativeDimRatio) && nativeDimRatio > 0;\n}\n\nfunction clampedPercentage(value: unknown): number | undefined {\n const numeric = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(numeric)) return undefined;\n return Math.min(100, Math.max(0, numeric));\n}\n\nexport function coverScrimOpacity(attributes: Record<string, unknown>): number {\n const explicitOpacity = clampedPercentage(attributes.scrimOpacity);\n if (explicitOpacity !== undefined) return explicitOpacity;\n\n return clampedPercentage(attributes.dimRatio) ?? 100;\n}\n"]}
@@ -0,0 +1,119 @@
1
+ import type { FlowpressBlock } from "../../types.js";
2
+
3
+ export type CoverBackgroundType = "color" | "image" | "video";
4
+
5
+ const COVER_TAGS = new Set([
6
+ "article",
7
+ "aside",
8
+ "div",
9
+ "footer",
10
+ "header",
11
+ "main",
12
+ "section"
13
+ ]);
14
+
15
+ const HEIGHT_UNITS = new Set([
16
+ "px",
17
+ "%",
18
+ "em",
19
+ "rem",
20
+ "vh",
21
+ "svh",
22
+ "lvh",
23
+ "dvh",
24
+ "vw"
25
+ ]);
26
+
27
+ const CONTENT_POSITIONS: Record<string, [string, string]> = {
28
+ "top left": ["start", "start"],
29
+ "top center": ["start", "center"],
30
+ "top right": ["start", "end"],
31
+ "center left": ["center", "start"],
32
+ "center center": ["center", "center"],
33
+ "center right": ["center", "end"],
34
+ "bottom left": ["end", "start"],
35
+ "bottom center": ["end", "center"],
36
+ "bottom right": ["end", "end"]
37
+ };
38
+
39
+ function text(value: unknown): string {
40
+ return typeof value === "string" ? value.trim() : "";
41
+ }
42
+
43
+ export type CoverTagName = "article" | "aside" | "div" | "footer" | "header" | "main" | "section";
44
+ export function coverTagName(value: unknown): CoverTagName {
45
+ const candidate = text(value).toLowerCase();
46
+ return COVER_TAGS.has(candidate) ? candidate as CoverTagName : "div";
47
+ }
48
+
49
+ export function coverMediaSource(block: FlowpressBlock): string {
50
+ return text(block.attributes.url) || text(block.resolvedData?.url);
51
+ }
52
+
53
+ export function coverPosterSource(block: FlowpressBlock): string | undefined {
54
+ return text(block.attributes.poster)
55
+ || text(block.resolvedData?.poster)
56
+ || undefined;
57
+ }
58
+
59
+ export function coverBackgroundType(block: FlowpressBlock): CoverBackgroundType {
60
+ const requested = text(block.attributes.backgroundType).toLowerCase();
61
+ if (requested === "video") return "video";
62
+ if (requested === "color") return "color";
63
+ return coverMediaSource(block) ? "image" : "color";
64
+ }
65
+
66
+ function percentage(value: unknown): number | undefined {
67
+ const numeric = typeof value === "number" ? value : Number(value);
68
+ if (!Number.isFinite(numeric)) return undefined;
69
+ if (numeric >= 0 && numeric <= 1) return numeric * 100;
70
+ if (numeric >= 0 && numeric <= 100) return numeric;
71
+ return undefined;
72
+ }
73
+
74
+ export function coverObjectPosition(value: unknown): string {
75
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
76
+ return "50% 50%";
77
+ }
78
+ const focalPoint = value as Record<string, unknown>;
79
+ const x = percentage(focalPoint.x);
80
+ const y = percentage(focalPoint.y);
81
+ return x === undefined || y === undefined ? "50% 50%" : `${x}% ${y}%`;
82
+ }
83
+
84
+ export function coverMinimumHeight(
85
+ value: unknown,
86
+ unitValue: unknown
87
+ ): string | undefined {
88
+ const numeric = typeof value === "number" ? value : Number(value);
89
+ if (!Number.isFinite(numeric) || numeric < 0) return undefined;
90
+ const requestedUnit = text(unitValue).toLowerCase();
91
+ const unit = HEIGHT_UNITS.has(requestedUnit) ? requestedUnit : "px";
92
+ return `${numeric}${unit}`;
93
+ }
94
+
95
+ export function coverContentPosition(value: unknown): [string, string] {
96
+ return CONTENT_POSITIONS[text(value).toLowerCase()]
97
+ ?? ["center", "center"];
98
+ }
99
+
100
+ export function coverScrimEnabled(attributes: Record<string, unknown>): boolean {
101
+ if (typeof attributes.scrimEnabled === "boolean") {
102
+ return attributes.scrimEnabled;
103
+ }
104
+ const nativeDimRatio = Number(attributes.dimRatio);
105
+ return Number.isFinite(nativeDimRatio) && nativeDimRatio > 0;
106
+ }
107
+
108
+ function clampedPercentage(value: unknown): number | undefined {
109
+ const numeric = typeof value === "number" ? value : Number(value);
110
+ if (!Number.isFinite(numeric)) return undefined;
111
+ return Math.min(100, Math.max(0, numeric));
112
+ }
113
+
114
+ export function coverScrimOpacity(attributes: Record<string, unknown>): number {
115
+ const explicitOpacity = clampedPercentage(attributes.scrimOpacity);
116
+ if (explicitOpacity !== undefined) return explicitOpacity;
117
+
118
+ return clampedPercentage(attributes.dimRatio) ?? 100;
119
+ }
@@ -10,11 +10,20 @@ export declare function heroObjectPosition(value: unknown): string;
10
10
  export declare function blockHtmlAttributes(attributes: Record<string, unknown>, baseClass?: string): {
11
11
  id?: string;
12
12
  class?: string;
13
+ style?: string;
14
+ [key: string]: unknown;
13
15
  };
14
16
  export declare const TEXT_HTML_TAGS: readonly ["span", "p", "h1", "h2", "h3", "h4", "h5", "h6", "strong", "em", "small", "mark"];
15
17
  export type TextHtmlTag = (typeof TEXT_HTML_TAGS)[number];
18
+ /**
19
+ * Derive a variant only when Gutenberg omitted it. The selected typography
20
+ * type can differ from the block's native type, so a paragraph styled as a
21
+ * heading must not inherit the paragraph-only `md` variant.
22
+ */
23
+ export declare function compatibleTypographyVariant(type: string, preferred: string, contract?: StyleflowContract): string;
24
+ export declare function textBlockSemanticDefaults(blockName: string, attributes: Record<string, unknown>, contract?: StyleflowContract): Record<string, unknown>;
16
25
  export declare function textHtmlTag(value: unknown): TextHtmlTag;
17
- export declare function semanticProps(attributes: Record<string, unknown>, contract?: StyleflowContract, defaults?: Record<string, unknown>): Record<string, unknown>;
26
+ export declare function semanticProps(attributes: Record<string, unknown>, contract?: StyleflowContract, defaults?: Record<string, unknown>, effectiveTone?: string): Record<string, unknown>;
18
27
  /** Resolve only Gutenberg's supported text-alignment values to inline CSS. */
19
28
  export declare function textAlignmentStyle(attributes: Record<string, unknown>): string | undefined;
20
29
  export declare function prefixedTextSemanticProps(attributes: Record<string, unknown>, prefix: string, contract?: StyleflowContract, defaults?: Record<string, unknown>): Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/astro/blocks/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,4BAA4B,YAAY,CAAC;AAEtD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmBzD;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,SAAS,SAAK,GACb;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAgBjC;AAsBD,eAAO,MAAM,cAAc,6FAajB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAKvD;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,QAAQ,GAAE,MAAM,CA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