@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
@@ -0,0 +1,419 @@
1
+ export const SF_REVEAL_SELECTOR = ".sf-reveal:not(.sf-motion-static)";
2
+
3
+ export const SF_REVEAL_CLASS = "sf-reveal";
4
+
5
+ export const SF_MOTION_STATIC_CLASS = "sf-motion-static";
6
+
7
+ export const SF_MOTION_DISABLE_CLASS = "sf-motion-disable";
8
+
9
+ export const SF_MOTION_DRAWER_EXIT_MS = 820;
10
+
11
+ export const SF_REVEAL_VISIBLE_RATIO = 0.2;
12
+
13
+ export const SF_REVEAL_STAGGER_SELECTOR = ".sf-reveal-stagger";
14
+
15
+ export const SF_REVEAL_STAGGER_STEP_MS = 90;
16
+
17
+ export const SF_REVEAL_STAGGER_MAX_MS = 450;
18
+
19
+ /** Reveals matching or containing this content always start visible. */
20
+ export const SF_MOTION_PROTECTED_CONTENT_SELECTOR = [
21
+ ".flowpress-hero",
22
+ 'img[fetchpriority="high"]',
23
+ 'img[loading="eager"]',
24
+ "video[autoplay]",
25
+ "form",
26
+ "[aria-live]",
27
+ '[role="alert"]',
28
+ '[role="status"]',
29
+ ].join(",");
30
+
31
+ const SF_REVEAL_MODIFIER_PATTERN = /^sf-reveal--\S+$/;
32
+
33
+ export type SfRevealModifier = `sf-reveal--${string}`;
34
+
35
+ export type SfDefaultReveal = false | SfRevealModifier;
36
+
37
+ export interface SfRevealRule {
38
+ /** Any selector accepted by `document.querySelectorAll`. */
39
+ selector: string;
40
+ /** Reveal modifier enforced on every matching element. */
41
+ reveal: SfRevealModifier;
42
+ }
43
+
44
+ export interface SfRevealClassChanges {
45
+ add: string[];
46
+ remove: SfRevealModifier[];
47
+ }
48
+
49
+ export interface SfMotionOptions {
50
+ /**
51
+ * Allows reveal elements already in the initial viewport to animate.
52
+ * Defaults to `false`, so initial content is immediately available.
53
+ */
54
+ revealAboveFold?: boolean;
55
+ /**
56
+ * Ordered selector-specific reveal rules. The first matching rule wins and
57
+ * enforces its modifier. Any valid CSS selector may be used.
58
+ */
59
+ revealRules?: readonly SfRevealRule[];
60
+ /**
61
+ * Preset applied to automatically selected elements. `false` keeps the
62
+ * reveal system strictly opt-in.
63
+ */
64
+ defaultReveal?: SfDefaultReveal;
65
+ /**
66
+ * Standard CSS selectors. Tags, classes, IDs, attributes and combinations
67
+ * can be mixed in the same array.
68
+ */
69
+ autoRevealSelectors?: readonly string[];
70
+ }
71
+
72
+ export interface ResolvedSfMotionOptions {
73
+ autoRevealSelectors: string[];
74
+ defaultReveal: SfDefaultReveal;
75
+ revealAboveFold: boolean;
76
+ revealRules: SfRevealRule[];
77
+ }
78
+
79
+ export type SfRevealState = "pending" | "visible" | "settled";
80
+
81
+ export interface InitialRevealStateInput {
82
+ bottom: number;
83
+ containsHashTarget: boolean;
84
+ protectedContent: boolean;
85
+ reducedMotion: boolean;
86
+ revealAboveFold: boolean;
87
+ top: number;
88
+ viewportHeight: number;
89
+ }
90
+
91
+ export interface RevealVisibilityInput {
92
+ bottom: number;
93
+ height: number;
94
+ top: number;
95
+ viewportHeight: number;
96
+ }
97
+
98
+ export function isSfRevealModifier(value: unknown): value is SfRevealModifier {
99
+ return typeof value === "string" && SF_REVEAL_MODIFIER_PATTERN.test(value);
100
+ }
101
+
102
+ function normalizeSelectors(value: unknown): string[] {
103
+ if (!Array.isArray(value)) return [];
104
+
105
+ return Array.from(
106
+ new Set(
107
+ value
108
+ .filter((selector): selector is string => typeof selector === "string")
109
+ .map((selector) => selector.trim())
110
+ .filter(Boolean),
111
+ ),
112
+ );
113
+ }
114
+
115
+ function normalizeRevealRules(value: unknown): SfRevealRule[] {
116
+ if (!Array.isArray(value)) return [];
117
+
118
+ const seenSelectors = new Set<string>();
119
+ return value.flatMap((rule: unknown) => {
120
+ if (!rule || typeof rule !== "object") return [];
121
+
122
+ const candidate = rule as Partial<SfRevealRule>;
123
+ const selector =
124
+ typeof candidate.selector === "string" ? candidate.selector.trim() : "";
125
+ if (
126
+ !selector ||
127
+ seenSelectors.has(selector) ||
128
+ !isSfRevealModifier(candidate.reveal)
129
+ ) {
130
+ return [];
131
+ }
132
+
133
+ seenSelectors.add(selector);
134
+ return [{ selector, reveal: candidate.reveal }];
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Normalizes server- or client-provided configuration. Invalid values fail
140
+ * open by disabling automatic reveals; empty and duplicate selectors are
141
+ * removed without changing their order.
142
+ */
143
+ export function resolveSfMotionOptions(
144
+ options: SfMotionOptions = {},
145
+ ): ResolvedSfMotionOptions {
146
+ const defaultReveal = isSfRevealModifier(options.defaultReveal)
147
+ ? options.defaultReveal
148
+ : false;
149
+ return {
150
+ autoRevealSelectors: normalizeSelectors(options.autoRevealSelectors),
151
+ defaultReveal,
152
+ revealAboveFold: options.revealAboveFold === true,
153
+ revealRules: normalizeRevealRules(options.revealRules),
154
+ };
155
+ }
156
+
157
+ /** Exact class mutation required by an authoritative selector rule. */
158
+ export function ruleRevealClassChanges(
159
+ existingClasses: Iterable<string>,
160
+ reveal: SfRevealModifier,
161
+ ): SfRevealClassChanges {
162
+ const classes = Array.from(existingClasses);
163
+ if (
164
+ classes.includes(SF_MOTION_STATIC_CLASS) ||
165
+ classes.includes(SF_MOTION_DISABLE_CLASS)
166
+ ) {
167
+ return { add: [], remove: [] };
168
+ }
169
+
170
+ return {
171
+ add: [
172
+ ...(classes.includes(SF_REVEAL_CLASS) ? [] : [SF_REVEAL_CLASS]),
173
+ ...(classes.includes(reveal) ? [] : [reveal]),
174
+ ],
175
+ remove: classes
176
+ .filter(isSfRevealModifier)
177
+ .filter((modifier) => modifier !== reveal),
178
+ };
179
+ }
180
+
181
+ /** Delay for a zero-based participant index in a reveal stagger group. */
182
+ export function staggerRevealDelayMs(index: number): number {
183
+ if (!Number.isFinite(index) || index <= 0) return 0;
184
+ return Math.min(
185
+ Math.floor(index) * SF_REVEAL_STAGGER_STEP_MS,
186
+ SF_REVEAL_STAGGER_MAX_MS,
187
+ );
188
+ }
189
+
190
+ /**
191
+ * Returns only the classes that automatic inheritance must add. Explicit
192
+ * modifiers win over the configured default and `sf-motion-static` remains a
193
+ * complete opt-out.
194
+ */
195
+ export function automaticRevealClasses(
196
+ existingClasses: Iterable<string>,
197
+ defaultReveal: SfDefaultReveal,
198
+ ): string[] {
199
+ if (defaultReveal === false) return [];
200
+
201
+ const classes = Array.from(existingClasses);
202
+ if (
203
+ classes.includes(SF_MOTION_STATIC_CLASS) ||
204
+ classes.includes(SF_MOTION_DISABLE_CLASS)
205
+ ) {
206
+ return [];
207
+ }
208
+
209
+ return [
210
+ ...(classes.includes(SF_REVEAL_CLASS) ? [] : [SF_REVEAL_CLASS]),
211
+ ...(classes.some(isSfRevealModifier) ? [] : [defaultReveal]),
212
+ ];
213
+ }
214
+
215
+ function cssTimeToMs(value: string): number {
216
+ const normalized = value.trim();
217
+ const amount = Number.parseFloat(normalized);
218
+ if (!Number.isFinite(amount)) return 0;
219
+
220
+ return normalized.endsWith("ms") ? amount : amount * 1000;
221
+ }
222
+
223
+ /** Returns the longest combined CSS transition duration and delay. */
224
+ export function maximumTransitionTimeMs(
225
+ transitionDuration: string,
226
+ transitionDelay: string,
227
+ ): number {
228
+ const durations = transitionDuration.split(",").map(cssTimeToMs);
229
+ const delays = transitionDelay.split(",").map(cssTimeToMs);
230
+ const itemCount = Math.max(durations.length, delays.length);
231
+
232
+ return Array.from({ length: itemCount }, (_, index) => {
233
+ const duration = durations[index % durations.length] ?? 0;
234
+ const delay = delays[index % delays.length] ?? 0;
235
+ return Math.max(0, duration + delay);
236
+ }).reduce((maximum, value) => Math.max(maximum, value), 0);
237
+ }
238
+
239
+ /**
240
+ * Initial viewport content stays static unless the project explicitly enables
241
+ * above-the-fold reveals. Deep links and protected content remain visible.
242
+ */
243
+ export function initialRevealState({
244
+ bottom,
245
+ containsHashTarget,
246
+ protectedContent,
247
+ reducedMotion,
248
+ revealAboveFold,
249
+ top,
250
+ viewportHeight,
251
+ }: InitialRevealStateInput): SfRevealState {
252
+ if (
253
+ reducedMotion ||
254
+ containsHashTarget ||
255
+ protectedContent
256
+ ) {
257
+ return "visible";
258
+ }
259
+
260
+ // reveal share of its height) waits for the scroll instead of appearing
261
+ // statically; content already scrolled past the top stays visible.
262
+ if (
263
+ !revealAboveFold &&
264
+ bottom > 0 &&
265
+ top < viewportHeight &&
266
+ (top < 0 ||
267
+ hasEnoughVisibleArea({
268
+ bottom,
269
+ height: Math.max(0, bottom - top),
270
+ top,
271
+ viewportHeight,
272
+ }))
273
+ ) {
274
+ return "visible";
275
+ }
276
+
277
+ return "pending";
278
+ }
279
+
280
+ /**
281
+ * Reveal ordinary content once 20% of its perceivable height is visible.
282
+ * For elements taller than the viewport, the viewport height is the reference.
283
+ */
284
+ export function hasEnoughVisibleArea({
285
+ bottom,
286
+ height,
287
+ top,
288
+ viewportHeight,
289
+ }: RevealVisibilityInput): boolean {
290
+ if (height <= 0 || viewportHeight <= 0) return true;
291
+
292
+ const visibleHeight = Math.max(
293
+ 0,
294
+ Math.min(bottom, viewportHeight) - Math.max(top, 0),
295
+ );
296
+ // The 1px tolerance below must not let thin elements such as a 1px <hr>
297
+ // pass while they are still entirely outside the viewport.
298
+ if (visibleHeight <= 0) return false;
299
+
300
+ const requiredHeight =
301
+ Math.min(height, viewportHeight) * SF_REVEAL_VISIBLE_RATIO;
302
+
303
+ return visibleHeight + 1 >= requiredHeight;
304
+ }
305
+
306
+ /**
307
+ * Reveal is deliberately one-way: focus and viewport entry can complete it,
308
+ * while leaving the viewport never conceals content again.
309
+ */
310
+ export function nextRevealState(
311
+ current: SfRevealState,
312
+ event: "focus" | "intersect" | "leave",
313
+ ): SfRevealState {
314
+ if (current === "settled") return "settled";
315
+
316
+ if (current === "visible" || event === "focus" || event === "intersect") {
317
+ return "visible";
318
+ }
319
+
320
+ return "pending";
321
+ }
322
+
323
+ export function shouldInitializeMotion(
324
+ initialized: string | undefined,
325
+ ): boolean {
326
+ return initialized !== "true";
327
+ }
328
+
329
+ /** `<html data-sf-motion>` value from the head bootstrap until the controller arms. */
330
+ export const SF_MOTION_BOOT_STATE = "boot";
331
+
332
+ /** Failsafe: boot-hidden content shows anyway if the controller never arms. */
333
+ export const SF_MOTION_BOOT_FAILSAFE_MS = 3000;
334
+
335
+ /**
336
+ * Modifiers whose pending state keeps the element visible and hides only a
337
+ * drawn decoration, mapped to the pseudo-element carrying it.
338
+ */
339
+ export const SF_REVEAL_DECORATION_PSEUDOS: Readonly<
340
+ Record<SfRevealModifier, "::before" | "::after">
341
+ > = {
342
+ "sf-reveal--accordion-line": "::after",
343
+ };
344
+
345
+ // Everything the controller leaves visible: opt-outs, protected content and the hash target.
346
+ // :has() makes :not() invalid where unsupported, which drops the rule: content stays visible.
347
+ const SF_MOTION_BOOT_EXCLUDED = [
348
+ `.${SF_MOTION_STATIC_CLASS}`,
349
+ `.${SF_MOTION_DISABLE_CLASS}`,
350
+ `.${SF_MOTION_DISABLE_CLASS} *`,
351
+ SF_MOTION_PROTECTED_CONTENT_SELECTOR,
352
+ `:has(${SF_MOTION_PROTECTED_CONTENT_SELECTOR})`,
353
+ ":target",
354
+ ":has(:target)",
355
+ ].join(", ");
356
+
357
+ /**
358
+ * Inline `<head>` script, placed after the motion preference bootstrap: marks
359
+ * the document as booting when the controller will arm reveals, so the CSS of
360
+ * `motionBootCss` hides them before first paint.
361
+ */
362
+ export function motionBootScript(preferenceAttribute: string): string {
363
+ const attribute = JSON.stringify(preferenceAttribute);
364
+ const state = JSON.stringify(SF_MOTION_BOOT_STATE);
365
+ return `(()=>{const r=document.documentElement;if(r.getAttribute(${attribute})==="full"&&"IntersectionObserver"in window&&!r.dataset.sfMotion)r.dataset.sfMotion=${state}})()`;
366
+ }
367
+
368
+ /**
369
+ * Pre-paint counterpart of the controller for `revealAboveFold`: hides what the
370
+ * controller will arm (authored reveals, rule and automatic selectors) while
371
+ * `<html data-sf-motion="boot">`, so content is never painted, hidden, then
372
+ * revealed. Each selector gets its own rule: an invalid one only drops itself.
373
+ * Like the controller, the first matching rule decides the modifier.
374
+ * Portabile in FlowPress: docs/pilots/primo-paint-stabile.md
375
+ */
376
+ export function motionBootCss(options: SfMotionOptions = {}): string {
377
+ const { autoRevealSelectors, defaultReveal, revealAboveFold, revealRules } =
378
+ resolveSfMotionOptions(options);
379
+ if (!revealAboveFold) return "";
380
+
381
+ const root = `html[data-sf-motion="${SF_MOTION_BOOT_STATE}"]`;
382
+ const failsafe = `${SF_MOTION_BOOT_FAILSAFE_MS}ms`;
383
+ const decorations = Object.entries(SF_REVEAL_DECORATION_PSEUDOS) as [
384
+ SfRevealModifier,
385
+ string,
386
+ ][];
387
+ const hide = (target: string, reveal: SfRevealModifier | null): string => {
388
+ const pseudo = reveal ? (SF_REVEAL_DECORATION_PSEUDOS[reveal] ?? "") : "";
389
+ return `${root} ${target}${pseudo}{opacity:0;animation:sf-motion-boot-failsafe 0s linear ${failsafe} forwards}`;
390
+ };
391
+ const rules: string[] = [];
392
+
393
+ // Authored reveals keep their own modifier; decorations hide their pseudo.
394
+ const decorationClasses = decorations.map(([modifier]) => `.${modifier}`);
395
+ rules.push(hide(
396
+ `.${SF_REVEAL_CLASS}:not(${[SF_MOTION_BOOT_EXCLUDED, ...decorationClasses].join(", ")})`,
397
+ null,
398
+ ));
399
+ decorations.forEach(([modifier]) => {
400
+ rules.push(hide(`.${SF_REVEAL_CLASS}.${modifier}:not(${SF_MOTION_BOOT_EXCLUDED})`, modifier));
401
+ });
402
+
403
+ const earlier: string[] = [];
404
+ revealRules.forEach(({ selector, reveal }) => {
405
+ const shadowed = earlier.length ? `, :is(${earlier.join(", ")})` : "";
406
+ rules.push(hide(`:is(${selector}):not(${SF_MOTION_BOOT_EXCLUDED}${shadowed})`, reveal));
407
+ earlier.push(selector);
408
+ });
409
+
410
+ if (defaultReveal !== false) {
411
+ const shadowed = earlier.length ? `, :is(${earlier.join(", ")})` : "";
412
+ autoRevealSelectors.forEach((selector) => {
413
+ rules.push(hide(`:is(${selector}):not(${SF_MOTION_BOOT_EXCLUDED}${shadowed})`, defaultReveal));
414
+ });
415
+ }
416
+
417
+ rules.push("@keyframes sf-motion-boot-failsafe{to{opacity:1}}");
418
+ return rules.join("\n");
419
+ }
@@ -0,0 +1,113 @@
1
+ ---
2
+ import "./blob.css";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import { BLOB_BOX, BLOB_VARIANTS } from "./blob/blob-shapes.generated.js";
5
+ import {
6
+ morphDataAttributes,
7
+ resolveAspectRatio,
8
+ resolveContentFit,
9
+ resolveMorphConfig,
10
+ resolveOutlineWidth,
11
+ type BlobAspectRatio,
12
+ type BlobContentFit,
13
+ type BlobMorphMode,
14
+ } from "./blob/config.js";
15
+ import { shapeToPath } from "./blob/geometry.js";
16
+ import { nextBlobClipId } from "./blob/ids.js";
17
+
18
+ /**
19
+ * Organic mask that crops its slot. The fill takes the Styleflow props passed
20
+ * to the component (tone, intensity, surface, layoutRole, density, no*); the
21
+ * outline has its own tone/intensity. Variants 1-13 can morph into each other.
22
+ */
23
+ interface Props {
24
+ /** 1-13. */
25
+ variant?: number | string | undefined;
26
+ /** `cover` stretches children over the whole shape, `center` keeps their size. */
27
+ contentFit?: BlobContentFit | undefined;
28
+ aspectRatio?: BlobAspectRatio | undefined;
29
+ /** Outline thickness in px; 0 hides it. */
30
+ outlineWidth?: number | string | undefined;
31
+ outlineTone?: string | undefined;
32
+ outlineIntensity?: string | undefined;
33
+ morph?: BlobMorphMode | undefined;
34
+ /** Variants to morph between, e.g. "2,5,9" or [2, 5, 9]; empty means all. */
35
+ morphTargets?: string | number[] | undefined;
36
+ morphDuration?: number | string | undefined;
37
+ /** Pause in ms between two automatic morphs. */
38
+ morphInterval?: number | string | undefined;
39
+ /** Attributes for the root element: id, class, aria-*, data-*. */
40
+ rootProps?: Record<string, unknown> | undefined;
41
+ [styleflowProp: string]: unknown;
42
+ }
43
+
44
+ const {
45
+ variant,
46
+ contentFit,
47
+ aspectRatio,
48
+ outlineWidth,
49
+ outlineTone = "inherit",
50
+ outlineIntensity = "inherit",
51
+ morph,
52
+ morphTargets,
53
+ morphDuration,
54
+ morphInterval,
55
+ rootProps = {},
56
+ ...fillProps
57
+ } = Astro.props;
58
+
59
+ const morphConfig = resolveMorphConfig(
60
+ { variant, morph, targets: morphTargets, duration: morphDuration, interval: morphInterval },
61
+ BLOB_VARIANTS.length,
62
+ );
63
+ const base = BLOB_VARIANTS[morphConfig.base] ?? BLOB_VARIANTS[0]!;
64
+ const fillPath = shapeToPath(base.fill, BLOB_BOX);
65
+ const ringPath = shapeToPath(base.ring, BLOB_BOX);
66
+ const strokeWidth = resolveOutlineWidth(outlineWidth);
67
+ const clipId = nextBlobClipId();
68
+
69
+ // Authors leaving a Styleflow axis on "inherit" send nothing: keep a visible fill.
70
+ const authoredFill = Object.fromEntries(
71
+ Object.entries(fillProps).filter(([, value]) => value !== undefined && value !== null && value !== ""),
72
+ );
73
+ const shapeProps = { surface: "default", layoutRole: "none", ...authoredFill };
74
+
75
+ const { class: rootClassName, ...rootAttributes } = rootProps as Record<string, unknown> & { class?: string };
76
+ const rootClass = ["sf-blob", typeof rootClassName === "string" ? rootClassName : ""]
77
+ .filter(Boolean)
78
+ .join(" ");
79
+ const clipStyle = `clip-path:url(#${clipId})`;
80
+ ---
81
+
82
+ <StyleflowElement as="div"
83
+ {...rootAttributes}
84
+ class={rootClass}
85
+ layoutRole="none"
86
+ data-sf-blob
87
+ {...morphDataAttributes(morphConfig)}
88
+ data-blob-fit={resolveContentFit(contentFit)}
89
+ data-blob-aspect={resolveAspectRatio(aspectRatio)}
90
+ >
91
+ <svg class="sf-blob__defs" width="0" height="0" aria-hidden="true" focusable="false">
92
+ <clipPath id={clipId} clipPathUnits="objectBoundingBox">
93
+ <path data-blob-clip-path d={fillPath}></path>
94
+ </clipPath>
95
+ </svg>
96
+ <!-- styleflow-ignore-next-line rule=sf-inline-style reason="Per-instance reference to the blob's SVG clip path" scope="project" -->
97
+ <StyleflowElement as="div" class="sf-blob__shape" {...shapeProps} data-blob-shape style={clipStyle}><slot /></StyleflowElement>
98
+ {strokeWidth > 0 ? (
99
+ <StyleflowElement as="span" class="sf-blob__ring" {...(outlineTone !== "inherit" ? {tone:outlineTone} : {})} {...(outlineIntensity !== "inherit" ? {intensity:outlineIntensity} : {})} aria-hidden="true">
100
+ <svg viewBox="0 0 1 1" preserveAspectRatio="none" focusable="false">
101
+ <path data-blob-ring-path d={ringPath} fill="none" stroke-width={strokeWidth} vector-effect="non-scaling-stroke"></path>
102
+ </svg>
103
+ </StyleflowElement>
104
+ ) : null}
105
+ </StyleflowElement>
106
+
107
+ <script>
108
+ // The static shape is complete without JavaScript: load the controller only
109
+ // when a blob on this page actually morphs.
110
+ if (document.querySelector('[data-sf-blob]:not([data-blob-morph="none"])')) {
111
+ void import("./blob/controller.js").then(({ initializeSfBlobs }) => initializeSfBlobs());
112
+ }
113
+ </script>
@@ -0,0 +1,52 @@
1
+ ---
2
+ import Blob from "./Blob.astro";
3
+ import {
4
+ flowpressBlockHtmlProps,
5
+ resolveFlowpressBlockStyleflowProps,
6
+ resolvePrefixedFlowpressBlockStyleflowProps,
7
+ } from "../../index.js";
8
+ import type { FlowpressBlockRendererProps } from "../../index.js";
9
+
10
+ // Renders `sf/blob` wherever the semantic renderer meets it: as a top-level
11
+ // composition block and nested inside any other sf/* block. Called from both
12
+ // paths, so it must work with only `block` and `contract` (like CoverBlock).
13
+ type Props = Pick<FlowpressBlockRendererProps, "block"> & Partial<FlowpressBlockRendererProps>;
14
+ const { block, contract, styleflowProps, htmlProps } = Astro.props as Props;
15
+ const attributes = block.attributes;
16
+ const options = {
17
+ strict: process.env.NODE_ENV === "production" || process.env.STYLEFLOW_STRICT === "1",
18
+ onDiagnostic: (diagnostic: { code: string; message: string }) =>
19
+ console.warn(`[${diagnostic.code}] ${diagnostic.message}`),
20
+ };
21
+
22
+ // Fill: the block's own Styleflow coordinates. Blob keeps a visible default
23
+ // when the author leaves tone/intensity on "inherit".
24
+ const fill = styleflowProps ?? resolveFlowpressBlockStyleflowProps(attributes, contract, {}, options);
25
+ // Outline: the same validated contract under the `outline*` attribute prefix.
26
+ const outline = resolvePrefixedFlowpressBlockStyleflowProps(
27
+ attributes,
28
+ "outline",
29
+ contract,
30
+ {},
31
+ options,
32
+ );
33
+ const text = (value: unknown): string | undefined =>
34
+ typeof value === "string" && value !== "" ? value : undefined;
35
+ ---
36
+
37
+ <Blob
38
+ {...fill}
39
+ variant={text(attributes.variant) ?? (typeof attributes.variant === "number" ? attributes.variant : undefined)}
40
+ contentFit={text(attributes.contentFit) as "cover" | "center" | undefined}
41
+ aspectRatio={text(attributes.aspectRatio) as "natural" | "square" | "portrait" | "landscape" | undefined}
42
+ outlineWidth={attributes.outlineWidth as number | string | undefined}
43
+ outlineTone={text(outline.tone)}
44
+ outlineIntensity={text(outline.intensity)}
45
+ morph={text(attributes.morph) as "none" | "auto" | "hover" | undefined}
46
+ morphTargets={text(attributes.morphTargets)}
47
+ morphDuration={attributes.morphDuration as number | string | undefined}
48
+ morphInterval={attributes.morphInterval as number | string | undefined}
49
+ rootProps={htmlProps ?? flowpressBlockHtmlProps(attributes)}
50
+ >
51
+ <slot />
52
+ </Blob>
@@ -0,0 +1,88 @@
1
+ ---
2
+ import Media from "../Media.astro";
3
+ import { decodeFlowpressText } from "../../text.js";
4
+ import StyleflowElement from "../StyleflowElement.astro";
5
+ import type { FlowpressBlockRendererProps } from "../../index.js";
6
+ import LevelTag from "./LevelTag.astro";
7
+ import { classNames, text, type ResolvedImage } from "./query-loop.js";
8
+
9
+ // Output of the project "Custom field" blocks. The value arrives already
10
+ // normalized for the chosen output (apps/cms/project/src/custom-fields.php);
11
+ // keep the output map in sync with it and with custom-field-editor.js.
12
+ type Props = Pick<FlowpressBlockRendererProps, "block" | "htmlProps" | "styleflowProps"> & {
13
+ baseClass: string;
14
+ };
15
+ const { block, htmlProps, styleflowProps, baseClass } = Astro.props;
16
+ const attributes = block.attributes;
17
+ const resolved = (block.resolvedData ?? {}) as { as?: string | undefined; value?: unknown | undefined; href?: string | undefined; isFallback?: boolean };
18
+ const options = (attributes.options && typeof attributes.options === "object" ? attributes.options : {}) as Record<string, unknown>;
19
+ const as = text(resolved.as);
20
+ const authoredAs = text(attributes.as) || "text";
21
+ const prefix = decodeFlowpressText(attributes.prefix);
22
+ const suffix = decodeFlowpressText(attributes.suffix);
23
+ const TEXT_TAGS = ["p", "span", "h1", "h2", "h3", "h4", "h5", "h6"];
24
+ const textTag = authoredAs === "text" && TEXT_TAGS.includes(text(options.tag)) ? text(options.tag) : "p";
25
+ const rootProps = {
26
+ ...htmlProps,
27
+ class: classNames(baseClass, `project-field--${as || authoredAs}`, as === "image" ? "project-field__image" : "", htmlProps.class),
28
+ };
29
+
30
+ const image = as === "image" ? (resolved.value ?? {}) as ResolvedImage : {};
31
+ const aspectRatio = text(options.aspectRatio);
32
+ const imageProps = {
33
+ src: text(image.url),
34
+ srcset: image.srcSet || undefined,
35
+ sizes: image.srcSet ? image.sizes || undefined : undefined,
36
+ width: image.width,
37
+ height: image.height,
38
+ alt: image.alt ?? "",
39
+ class: image.id ? `wp-image-${image.id}` : undefined,
40
+ loading: "lazy" as const,
41
+ decoding: "async" as const,
42
+ };
43
+ const link = as === "link" ? (resolved.value ?? {}) as { url?: string | undefined; label?: string | undefined; target?: string } : {};
44
+ const date = as === "date" ? (resolved.value ?? {}) as { datetime?: string | undefined; formatted?: string } : {};
45
+ const list = as === "list" && Array.isArray(resolved.value) ? resolved.value.map(decodeFlowpressText) : [];
46
+ ---
47
+
48
+ {as === "" ? null
49
+ : as === "image" ? (
50
+ imageProps.src ? (
51
+ <StyleflowElement as="figure" {...rootProps} {...styleflowProps} data-aspect-ratio={aspectRatio || undefined}>
52
+ {resolved.href ? <StyleflowElement as="a" href={resolved.href}><Media {...imageProps} /></StyleflowElement> : <Media {...imageProps} />}
53
+ </StyleflowElement>
54
+ ) : null
55
+ )
56
+ : as === "richtext" ? (
57
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}>
58
+ {prefix ? <StyleflowElement as="span" class="project-field__prefix">{prefix}</StyleflowElement> : null}
59
+ <Fragment set:html={text(resolved.value)} />
60
+ {suffix ? <StyleflowElement as="span" class="project-field__suffix">{suffix}</StyleflowElement> : null}
61
+ </StyleflowElement>
62
+ )
63
+ : as === "link" ? (
64
+ <StyleflowElement as="p" {...rootProps} {...styleflowProps}>
65
+ {prefix ? <StyleflowElement as="span" class="project-field__prefix">{prefix}</StyleflowElement> : null}
66
+ <StyleflowElement as="a"
67
+ href={link.url}
68
+ class={options.variant === "button" ? "wp-element-button" : undefined}
69
+ target={link.target === "_blank" ? "_blank" : undefined}
70
+ rel={link.target === "_blank" ? "noopener noreferrer" : undefined}
71
+ >{decodeFlowpressText(link.label || link.url)}</StyleflowElement>
72
+ {suffix ? <StyleflowElement as="span" class="project-field__suffix">{suffix}</StyleflowElement> : null}
73
+ </StyleflowElement>
74
+ )
75
+ : as === "list" ? (
76
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}>
77
+ {prefix ? <StyleflowElement as="span" class="project-field__prefix">{prefix}</StyleflowElement> : null}
78
+ {options.ordered
79
+ ? <StyleflowElement as="ol" class="wp-block-list">{list.map((item) => <StyleflowElement as="li">{item}</StyleflowElement>)}</StyleflowElement>
80
+ : <StyleflowElement as="ul" class="wp-block-list">{list.map((item) => <StyleflowElement as="li">{item}</StyleflowElement>)}</StyleflowElement>}
81
+ {suffix ? <StyleflowElement as="span" class="project-field__suffix">{suffix}</StyleflowElement> : null}
82
+ </StyleflowElement>
83
+ )
84
+ : (
85
+ <LevelTag tag={textTag} {...rootProps} {...styleflowProps}>
86
+ {prefix}{as === "date" ? <StyleflowElement as="time" datetime={date.datetime}>{decodeFlowpressText(date.formatted)}</StyleflowElement> : decodeFlowpressText(resolved.value)}{suffix}
87
+ </LevelTag>
88
+ )}
@@ -0,0 +1,20 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+
4
+ // Heading (h1–h6), paragraph (0 / "p") or inline span, with Styleflow props.
5
+ interface Props {
6
+ tag: string;
7
+ [attribute: string]: unknown;
8
+ }
9
+ const { tag, ...rest } = Astro.props;
10
+ ---
11
+
12
+ {tag === "h1" ? <StyleflowElement as="h1" {...rest}><slot /></StyleflowElement>
13
+ : tag === "h2" ? <StyleflowElement as="h2" {...rest}><slot /></StyleflowElement>
14
+ : tag === "h3" ? <StyleflowElement as="h3" {...rest}><slot /></StyleflowElement>
15
+ : tag === "h4" ? <StyleflowElement as="h4" {...rest}><slot /></StyleflowElement>
16
+ : tag === "h5" ? <StyleflowElement as="h5" {...rest}><slot /></StyleflowElement>
17
+ : tag === "h6" ? <StyleflowElement as="h6" {...rest}><slot /></StyleflowElement>
18
+ : tag === "span" ? <StyleflowElement as="span" {...rest}><slot /></StyleflowElement>
19
+ : tag === "div" ? <StyleflowElement as="div" {...rest}><slot /></StyleflowElement>
20
+ : <StyleflowElement as="p" {...rest}><slot /></StyleflowElement>}