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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/CHANGELOG.md +190 -1
  2. package/README.md +111 -3
  3. package/dist/accessibility-panel.d.ts +2 -0
  4. package/dist/accessibility-panel.d.ts.map +1 -0
  5. package/dist/accessibility-panel.js +81 -0
  6. package/dist/accessibility-panel.js.map +1 -0
  7. package/dist/astro/BaseLayout.astro +34 -17
  8. package/dist/astro/CompositionRenderer.astro +157 -0
  9. package/dist/astro/DefaultBlockAdapter.astro +35 -0
  10. package/dist/astro/DefaultTemplate.astro +12 -7
  11. package/dist/astro/GutenbergRenderer.astro +240 -80
  12. package/dist/astro/StyleflowElement.astro +23 -0
  13. package/dist/astro/ThemeRuntime.astro +26 -0
  14. package/dist/astro/blocks/CarouselBlock.astro +8 -10
  15. package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
  16. package/dist/astro/blocks/ColumnBlock.astro +4 -5
  17. package/dist/astro/blocks/CoverBlock.astro +155 -0
  18. package/dist/astro/blocks/FormBlock.astro +23 -20
  19. package/dist/astro/blocks/GridBlock.astro +4 -4
  20. package/dist/astro/blocks/HeroBlock.astro +4 -5
  21. package/dist/astro/blocks/ImageBlock.astro +4 -5
  22. package/dist/astro/blocks/ListItemFallback.astro +10 -7
  23. package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
  24. package/dist/astro/blocks/SemanticElement.astro +35 -0
  25. package/dist/astro/blocks/SiteLogoBlock.astro +53 -0
  26. package/dist/astro/blocks/TextBlock.astro +33 -28
  27. package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
  28. package/dist/astro/blocks/cover.d.ts +13 -0
  29. package/dist/astro/blocks/cover.d.ts.map +1 -0
  30. package/dist/astro/blocks/cover.js +105 -0
  31. package/dist/astro/blocks/cover.js.map +1 -0
  32. package/dist/astro/blocks/cover.ts +119 -0
  33. package/dist/astro/blocks/helpers.d.ts +7 -0
  34. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  35. package/dist/astro/blocks/helpers.js +52 -41
  36. package/dist/astro/blocks/helpers.js.map +1 -1
  37. package/dist/astro/blocks/helpers.ts +64 -45
  38. package/dist/astro/native/Blob.astro +113 -0
  39. package/dist/astro/native/BlobBlock.astro +52 -0
  40. package/dist/astro/native/CustomFieldValue.astro +87 -0
  41. package/dist/astro/native/LevelTag.astro +20 -0
  42. package/dist/astro/native/MapBlock.astro +41 -0
  43. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  44. package/dist/astro/native/NativeIconBlock.astro +42 -0
  45. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  46. package/dist/astro/native/ResolvedBlocks.astro +89 -0
  47. package/dist/astro/native/SyncedPatternContent.astro +92 -0
  48. package/dist/astro/native/TermFieldValue.astro +38 -0
  49. package/dist/astro/native/Timeline.astro +21 -0
  50. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  51. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  52. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  53. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  54. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  55. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  56. package/dist/astro/native/blob/config.d.ts +49 -0
  57. package/dist/astro/native/blob/config.d.ts.map +1 -0
  58. package/dist/astro/native/blob/config.js +86 -0
  59. package/dist/astro/native/blob/config.js.map +1 -0
  60. package/dist/astro/native/blob/config.ts +132 -0
  61. package/dist/astro/native/blob/controller.d.ts +11 -0
  62. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  63. package/dist/astro/native/blob/controller.js +240 -0
  64. package/dist/astro/native/blob/controller.js.map +1 -0
  65. package/dist/astro/native/blob/controller.ts +248 -0
  66. package/dist/astro/native/blob/geometry.d.ts +2 -0
  67. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  68. package/dist/astro/native/blob/geometry.js +2 -0
  69. package/dist/astro/native/blob/geometry.js.map +1 -0
  70. package/dist/astro/native/blob/geometry.ts +1 -0
  71. package/dist/astro/native/blob/ids.d.ts +7 -0
  72. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  73. package/dist/astro/native/blob/ids.js +11 -0
  74. package/dist/astro/native/blob/ids.js.map +1 -0
  75. package/dist/astro/native/blob/ids.ts +11 -0
  76. package/dist/astro/native/blob.css +83 -0
  77. package/dist/astro/native/button.d.ts +13 -0
  78. package/dist/astro/native/button.d.ts.map +1 -0
  79. package/dist/astro/native/button.js +26 -0
  80. package/dist/astro/native/button.js.map +1 -0
  81. package/dist/astro/native/button.ts +26 -0
  82. package/dist/astro/native/core-block.astro +18 -0
  83. package/dist/astro/native/core-button.astro +43 -0
  84. package/dist/astro/native/core-buttons.astro +14 -0
  85. package/dist/astro/native/core-group.astro +23 -0
  86. package/dist/astro/native/core-home-link.astro +12 -0
  87. package/dist/astro/native/core-html.astro +8 -0
  88. package/dist/astro/native/core-icon.astro +7 -0
  89. package/dist/astro/native/core-image.astro +124 -0
  90. package/dist/astro/native/core-navigation-link.astro +71 -0
  91. package/dist/astro/native/core-navigation-submenu.astro +33 -0
  92. package/dist/astro/native/core-navigation.astro +94 -0
  93. package/dist/astro/native/core-page-list-data-item.astro +19 -0
  94. package/dist/astro/native/core-page-list-item.astro +8 -0
  95. package/dist/astro/native/core-page-list.astro +40 -0
  96. package/dist/astro/native/core-post-date.astro +21 -0
  97. package/dist/astro/native/core-post-excerpt.astro +26 -0
  98. package/dist/astro/native/core-post-featured-image.astro +37 -0
  99. package/dist/astro/native/core-post-template.astro +30 -0
  100. package/dist/astro/native/core-post-terms.astro +47 -0
  101. package/dist/astro/native/core-post-title.astro +23 -0
  102. package/dist/astro/native/core-query-no-results.astro +12 -0
  103. package/dist/astro/native/core-query.astro +22 -0
  104. package/dist/astro/native/core-separator.astro +20 -0
  105. package/dist/astro/native/core-site-title.astro +16 -0
  106. package/dist/astro/native/core-term-description.astro +12 -0
  107. package/dist/astro/native/core-term-name.astro +21 -0
  108. package/dist/astro/native/core-term-template.astro +30 -0
  109. package/dist/astro/native/core-terms-query.astro +19 -0
  110. package/dist/astro/native/core-transparent.astro +11 -0
  111. package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
  112. package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
  113. package/dist/astro/native/flowpress-navigation-controller.js +217 -0
  114. package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
  115. package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
  116. package/dist/astro/native/flowpress-navigation.css +17 -0
  117. package/dist/astro/native/grid-bleed.js +106 -0
  118. package/dist/astro/native/grid.css +180 -0
  119. package/dist/astro/native/grid.d.ts +17 -0
  120. package/dist/astro/native/grid.d.ts.map +1 -0
  121. package/dist/astro/native/grid.js +103 -0
  122. package/dist/astro/native/grid.js.map +1 -0
  123. package/dist/astro/native/grid.ts +118 -0
  124. package/dist/astro/native/html.d.ts +6 -0
  125. package/dist/astro/native/html.d.ts.map +1 -0
  126. package/dist/astro/native/html.js +10 -0
  127. package/dist/astro/native/html.js.map +1 -0
  128. package/dist/astro/native/html.ts +9 -0
  129. package/dist/astro/native/icon.d.ts +3 -0
  130. package/dist/astro/native/icon.d.ts.map +1 -0
  131. package/dist/astro/native/icon.js +23 -0
  132. package/dist/astro/native/icon.js.map +1 -0
  133. package/dist/astro/native/icon.ts +21 -0
  134. package/dist/astro/native/map.d.ts +14 -0
  135. package/dist/astro/native/map.d.ts.map +1 -0
  136. package/dist/astro/native/map.js +60 -0
  137. package/dist/astro/native/map.js.map +1 -0
  138. package/dist/astro/native/map.ts +70 -0
  139. package/dist/astro/native/motion-preference.d.ts +50 -0
  140. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  141. package/dist/astro/native/motion-preference.js +132 -0
  142. package/dist/astro/native/motion-preference.js.map +1 -0
  143. package/dist/astro/native/motion-preference.ts +158 -0
  144. package/dist/astro/native/motion.d.ts +101 -0
  145. package/dist/astro/native/motion.d.ts.map +1 -0
  146. package/dist/astro/native/motion.js +168 -0
  147. package/dist/astro/native/motion.js.map +1 -0
  148. package/dist/astro/native/motion.ts +312 -0
  149. package/dist/astro/native/query-loop.d.ts +38 -0
  150. package/dist/astro/native/query-loop.d.ts.map +1 -0
  151. package/dist/astro/native/query-loop.js +20 -0
  152. package/dist/astro/native/query-loop.js.map +1 -0
  153. package/dist/astro/native/query-loop.ts +67 -0
  154. package/dist/astro/native/registry.d.ts +3 -0
  155. package/dist/astro/native/registry.d.ts.map +1 -0
  156. package/dist/astro/native/registry.js +81 -0
  157. package/dist/astro/native/registry.js.map +1 -0
  158. package/dist/astro/native/registry.ts +81 -0
  159. package/dist/astro/native/sf-block-binding.astro +20 -0
  160. package/dist/astro/native/sf-post-field.astro +9 -0
  161. package/dist/astro/native/sf-term-field.astro +9 -0
  162. package/dist/astro/native/timeline.css +4 -0
  163. package/dist/astro/native/timeline.d.ts +28 -0
  164. package/dist/astro/native/timeline.d.ts.map +1 -0
  165. package/dist/astro/native/timeline.js +43 -0
  166. package/dist/astro/native/timeline.js.map +1 -0
  167. package/dist/astro/native/timeline.ts +79 -0
  168. package/dist/astro/preferences/AccessibilityPanel.astro +118 -0
  169. package/dist/astro/preferences/ColorModeToggle.astro +26 -0
  170. package/dist/astro/preferences/MotionToggle.astro +27 -0
  171. package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
  172. package/dist/astro/preferences/ThemeToggle.astro +30 -0
  173. package/dist/astro/preferences/Toggle.astro +50 -0
  174. package/dist/astro/preferences/preferences.css +125 -0
  175. package/dist/block-renderers.d.ts +20 -3
  176. package/dist/block-renderers.d.ts.map +1 -1
  177. package/dist/block-renderers.js.map +1 -1
  178. package/dist/client.d.ts +17 -1
  179. package/dist/client.d.ts.map +1 -1
  180. package/dist/client.js +63 -9
  181. package/dist/client.js.map +1 -1
  182. package/dist/composition.d.ts +14 -0
  183. package/dist/composition.d.ts.map +1 -0
  184. package/dist/composition.js +124 -0
  185. package/dist/composition.js.map +1 -0
  186. package/dist/default-blocks.d.ts +9 -0
  187. package/dist/default-blocks.d.ts.map +1 -0
  188. package/dist/default-blocks.js +118 -0
  189. package/dist/default-blocks.js.map +1 -0
  190. package/dist/env.d.ts +9 -0
  191. package/dist/env.d.ts.map +1 -1
  192. package/dist/env.js +20 -0
  193. package/dist/env.js.map +1 -1
  194. package/dist/index.d.ts +8 -0
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/index.js +7 -0
  197. package/dist/index.js.map +1 -1
  198. package/dist/links.d.ts +5 -0
  199. package/dist/links.d.ts.map +1 -0
  200. package/dist/links.js +32 -0
  201. package/dist/links.js.map +1 -0
  202. package/dist/media.d.ts +28 -0
  203. package/dist/media.d.ts.map +1 -0
  204. package/dist/media.js +212 -0
  205. package/dist/media.js.map +1 -0
  206. package/dist/motion-preference.d.ts +50 -0
  207. package/dist/motion-preference.d.ts.map +1 -0
  208. package/dist/motion-preference.js +132 -0
  209. package/dist/motion-preference.js.map +1 -0
  210. package/dist/preferences-runtime.d.ts +3 -0
  211. package/dist/preferences-runtime.d.ts.map +1 -0
  212. package/dist/preferences-runtime.js +23 -0
  213. package/dist/preferences-runtime.js.map +1 -0
  214. package/dist/preferences-styleflow.d.ts +3 -0
  215. package/dist/preferences-styleflow.d.ts.map +1 -0
  216. package/dist/preferences-styleflow.js +14 -0
  217. package/dist/preferences-styleflow.js.map +1 -0
  218. package/dist/preferences.d.ts +4 -0
  219. package/dist/preferences.d.ts.map +1 -0
  220. package/dist/preferences.js +4 -0
  221. package/dist/preferences.js.map +1 -0
  222. package/dist/styleflow.d.ts +16 -1
  223. package/dist/styleflow.d.ts.map +1 -1
  224. package/dist/styleflow.js +76 -7
  225. package/dist/styleflow.js.map +1 -1
  226. package/dist/templates.d.ts +16 -16
  227. package/dist/text.d.ts +3 -0
  228. package/dist/text.d.ts.map +1 -0
  229. package/dist/text.js +6 -0
  230. package/dist/text.js.map +1 -0
  231. package/dist/theme-runtime.d.ts +16 -0
  232. package/dist/theme-runtime.d.ts.map +1 -0
  233. package/dist/theme-runtime.js +100 -0
  234. package/dist/theme-runtime.js.map +1 -0
  235. package/dist/tsconfig.tsbuildinfo +1 -1
  236. package/dist/types.d.ts +84 -1
  237. package/dist/types.d.ts.map +1 -1
  238. package/dist/types.js.map +1 -1
  239. package/dist/vivid-colors-preference.d.ts +31 -0
  240. package/dist/vivid-colors-preference.d.ts.map +1 -0
  241. package/dist/vivid-colors-preference.js +102 -0
  242. package/dist/vivid-colors-preference.js.map +1 -0
  243. package/package.json +26 -4
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import "@splidejs/splide/css/core";
3
- import S from "@styleflow.app/astro/S.astro";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
4
  import { carouselOptions, carouselSettings } from "../../carousel.js";
5
5
  import type { FlowpressBlock } from "../../types.js";
6
6
  import type { StyleflowContract } from "../../styleflow.js";
@@ -8,9 +8,9 @@ import { blockHtmlAttributes, semanticProps } from "./helpers.js";
8
8
 
9
9
  interface Props {
10
10
  block: FlowpressBlock;
11
- contract?: StyleflowContract;
11
+ contract?: StyleflowContract | undefined;
12
12
  validChildren: boolean;
13
- invalidChildNames?: string[];
13
+ invalidChildNames?: string[] | undefined;
14
14
  }
15
15
 
16
16
  const { block, contract, validChildren, invalidChildNames = [] } = Astro.props;
@@ -44,8 +44,7 @@ if (!validChildren && import.meta.env.DEV) {
44
44
 
45
45
  {validChildren ? (
46
46
  <flowpress-carousel>
47
- <S
48
- as="section"
47
+ <StyleflowElement as="section"
49
48
  {...semantic}
50
49
  {...htmlAttributes}
51
50
  aria-label={settings.ariaLabel}
@@ -79,11 +78,10 @@ if (!validChildren && import.meta.env.DEV) {
79
78
  <span class="splide__toggle__pause">Pausa</span>
80
79
  </button>
81
80
  ) : null}
82
- </S>
81
+ </StyleflowElement>
83
82
  </flowpress-carousel>
84
83
  ) : (
85
- <S
86
- as="section"
84
+ <StyleflowElement as="section"
87
85
  {...semantic}
88
86
  {...htmlAttributes}
89
87
  aria-label={settings.ariaLabel}
@@ -92,7 +90,7 @@ if (!validChildren && import.meta.env.DEV) {
92
90
  style={style}
93
91
  >
94
92
  <slot />
95
- </S>
93
+ </StyleflowElement>
96
94
  )}
97
95
 
98
96
  <script>
@@ -101,7 +99,7 @@ if (!validChildren && import.meta.env.DEV) {
101
99
 
102
100
  if (!customElements.get("flowpress-carousel")) {
103
101
  customElements.define("flowpress-carousel", class extends HTMLElement {
104
- private instance?: Splide;
102
+ private instance?: Splide | undefined;
105
103
 
106
104
  connectedCallback() {
107
105
  if (this.instance) return;
@@ -1,12 +1,12 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import type { FlowpressBlock } from "../../types.js";
4
4
  import type { StyleflowContract } from "../../styleflow.js";
5
5
  import { blockHtmlAttributes, semanticProps } from "./helpers.js";
6
6
 
7
7
  interface Props {
8
8
  block: FlowpressBlock;
9
- contract?: StyleflowContract;
9
+ contract?: StyleflowContract | undefined;
10
10
  }
11
11
 
12
12
  const { block, contract } = Astro.props;
@@ -17,9 +17,9 @@ const htmlAttributes = blockHtmlAttributes(
17
17
  );
18
18
  ---
19
19
 
20
- <S as="li" {...semantic} {...htmlAttributes}>
20
+ <StyleflowElement as="li" {...semantic} {...htmlAttributes}>
21
21
  <slot />
22
- </S>
22
+ </StyleflowElement>
23
23
 
24
24
  <style>
25
25
  .flowpress-carousel-item { min-width: 0; }
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import type { FlowpressBlock } from "../../types.js";
4
4
  import type { StyleflowContract } from "../../styleflow.js";
5
5
  import {
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  interface Props {
12
12
  block: FlowpressBlock;
13
- contract?: StyleflowContract;
13
+ contract?: StyleflowContract | undefined;
14
14
  }
15
15
 
16
16
  const { block, contract } = Astro.props;
@@ -33,8 +33,7 @@ const style = [
33
33
  ].join(";");
34
34
  ---
35
35
 
36
- <S
37
- as="div"
36
+ <StyleflowElement as="div"
38
37
  {...semantic}
39
38
  {...htmlAttributes}
40
39
  data-partial={partial}
@@ -42,7 +41,7 @@ const style = [
42
41
  style={style}
43
42
  >
44
43
  <slot />
45
- </S>
44
+ </StyleflowElement>
46
45
 
47
46
  <style>
48
47
  .flowpress-column {
@@ -0,0 +1,155 @@
1
+ ---
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
+ import type { DynamicStyleflowProps, StyleflowContract } from "../../styleflow.js";
4
+ import { resolvePrefixedFlowpressBlockStyleflowProps } from "../../styleflow.js";
5
+ import type {
6
+ FlowpressBlock,
7
+ FlowpressBlockHtmlProps
8
+ } from "../../types.js";
9
+ import { blockHtmlAttributes, semanticProps } from "./helpers.js";
10
+ import {
11
+ coverBackgroundType,
12
+ coverContentPosition,
13
+ coverMediaSource,
14
+ coverMinimumHeight,
15
+ coverObjectPosition,
16
+ coverPosterSource,
17
+ coverScrimEnabled,
18
+ coverScrimOpacity,
19
+ coverTagName
20
+ } from "./cover.js";
21
+
22
+ interface Props {
23
+ block: FlowpressBlock;
24
+ contract?: StyleflowContract | undefined;
25
+ htmlProps?: FlowpressBlockHtmlProps | undefined;
26
+ styleflowProps?: DynamicStyleflowProps | undefined;
27
+ }
28
+
29
+ const { block, contract, htmlProps, styleflowProps } = Astro.props;
30
+ const attributes = block.attributes;
31
+ const rootStyleflowProps = styleflowProps ?? semanticProps(attributes, contract, {
32
+ layoutRole: "region",
33
+ density: "regular"
34
+ });
35
+ const normalizedHtmlProps = htmlProps ?? blockHtmlAttributes(attributes);
36
+ const rootHtmlProps = {
37
+ ...normalizedHtmlProps,
38
+ class: ["wp-block-cover", "flowpress-cover", normalizedHtmlProps.class]
39
+ .filter(Boolean)
40
+ .join(" ")
41
+ };
42
+ const backgroundType = coverBackgroundType(block);
43
+ const source = coverMediaSource(block);
44
+ const poster = coverPosterSource(block);
45
+ const alt = String(attributes.alt ?? block.resolvedData?.alt ?? "");
46
+ const width = Number(block.resolvedData?.width) || undefined;
47
+ const height = Number(block.resolvedData?.height) || undefined;
48
+ const objectPosition = coverObjectPosition(attributes.focalPoint);
49
+ const minimumHeight = coverMinimumHeight(
50
+ attributes.minHeight,
51
+ attributes.minHeightUnit
52
+ );
53
+ const [contentBlockPosition, contentInlinePosition] = coverContentPosition(
54
+ attributes.contentPosition
55
+ );
56
+ const scrimOpacity = coverScrimOpacity(attributes);
57
+ const rootStyle = [
58
+ `--flowpress-cover-object-position:${objectPosition}`,
59
+ minimumHeight ? `--flowpress-cover-min-height:${minimumHeight}` : "",
60
+ `--flowpress-cover-content-block:${contentBlockPosition}`,
61
+ `--flowpress-cover-content-inline:${contentInlinePosition}`,
62
+ `--flowpress-cover-scrim-opacity:${scrimOpacity / 100}`
63
+ ].filter(Boolean).join(";");
64
+ const scrimEnabled = backgroundType !== "color" && coverScrimEnabled(attributes);
65
+ const scrimStyleflowProps = resolvePrefixedFlowpressBlockStyleflowProps(
66
+ attributes,
67
+ "scrim",
68
+ contract,
69
+ {},
70
+ {
71
+ strict: process.env.NODE_ENV === "production" || process.env.STYLEFLOW_STRICT === "1",
72
+ onDiagnostic: (diagnostic) => console.warn(`[${diagnostic.code}] ${diagnostic.message}`)
73
+ }
74
+ );
75
+ const tagName = coverTagName(attributes.tagName);
76
+ ---
77
+
78
+ <StyleflowElement as={tagName} {...rootStyleflowProps} {...rootHtmlProps} style={rootStyle}>
79
+ {backgroundType === "image" && source ? (
80
+ <img
81
+ class="wp-block-cover__image-background flowpress-cover__media"
82
+ src={source}
83
+ width={width}
84
+ height={height}
85
+ alt={alt}
86
+ aria-hidden={alt ? undefined : "true"}
87
+ loading="lazy"
88
+ decoding="async"
89
+ />
90
+ ) : null}
91
+ {backgroundType === "video" && source ? (
92
+ <video
93
+ class="wp-block-cover__video-background flowpress-cover__media"
94
+ src={source}
95
+ poster={poster}
96
+ autoplay
97
+ muted
98
+ loop
99
+ playsinline
100
+ preload="metadata"
101
+ aria-hidden="true"
102
+ tabindex="-1"
103
+ />
104
+ ) : null}
105
+ {scrimEnabled ? (
106
+ <StyleflowElement as="span"
107
+ class="wp-block-cover__background flowpress-cover__scrim"
108
+ {...scrimStyleflowProps}
109
+ data-flowpress-cover-scrim
110
+ aria-hidden="true"
111
+ />
112
+ ) : null}
113
+ <StyleflowElement as="div" class="wp-block-cover__inner-container flowpress-cover__content">
114
+ <slot />
115
+ </StyleflowElement>
116
+ </StyleflowElement>
117
+
118
+ <style>
119
+ .flowpress-cover {
120
+ position: relative;
121
+ display: grid;
122
+ min-height: var(--flowpress-cover-min-height, 0);
123
+ overflow: hidden;
124
+ isolation: isolate;
125
+ }
126
+
127
+ .flowpress-cover__media,
128
+ .flowpress-cover__scrim {
129
+ position: absolute;
130
+ inset: 0;
131
+ width: 100%;
132
+ height: 100%;
133
+ }
134
+
135
+ .flowpress-cover__media {
136
+ z-index: 0;
137
+ object-fit: cover;
138
+ object-position: var(--flowpress-cover-object-position, 50% 50%);
139
+ }
140
+
141
+ .flowpress-cover__scrim {
142
+ z-index: 1;
143
+ background: var(--sf-background);
144
+ opacity: var(--flowpress-cover-scrim-opacity, 1);
145
+ pointer-events: none;
146
+ }
147
+
148
+ .flowpress-cover__content {
149
+ position: relative;
150
+ z-index: 2;
151
+ display: grid;
152
+ align-items: var(--flowpress-cover-content-block, center);
153
+ justify-items: var(--flowpress-cover-content-inline, center);
154
+ }
155
+ </style>
@@ -1,5 +1,8 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import type { HTMLAttributes } from "astro/types";
4
+ type HTMLInputTypeAttribute = HTMLAttributes<"input">["type"];
5
+ import StyleflowElement from "../StyleflowElement.astro";
3
6
  import type { FlowpressBlock } from "../../types.js";
4
7
  import type { StyleflowContract } from "../../styleflow.js";
5
8
  import { blockHtmlAttributes, semanticProps } from "./helpers.js";
@@ -7,10 +10,10 @@ import { blockHtmlAttributes, semanticProps } from "./helpers.js";
7
10
  interface FormField {
8
11
  name: string;
9
12
  type: string;
10
- required?: boolean;
11
- values?: string[];
12
- labels?: string[];
13
- options?: string[];
13
+ required?: boolean | undefined;
14
+ values?: string[] | undefined;
15
+ labels?: string[] | undefined;
16
+ options?: string[] | undefined;
14
17
  }
15
18
 
16
19
  interface FormSchema {
@@ -24,7 +27,7 @@ interface FormSchema {
24
27
 
25
28
  interface Props {
26
29
  block: FlowpressBlock;
27
- contract?: StyleflowContract;
30
+ contract?: StyleflowContract | undefined;
28
31
  }
29
32
 
30
33
  const { block, contract } = Astro.props;
@@ -35,21 +38,21 @@ const labelFor = (field: FormField): string => field.name
35
38
  .replace(/[-_]+/g, " ")
36
39
  .replace(/\b\w/g, (letter) => letter.toUpperCase());
37
40
  const optionLabel = (field: FormField, index: number): string =>
38
- field.labels?.[index] || field.values?.[index] || "";
41
+ decodeFlowpressText(field.labels?.[index] || field.values?.[index] || "");
39
42
  ---
40
43
 
41
44
  {schema?.available ? (
42
- <S as="div" {...semantic} {...htmlAttributes}>
45
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
43
46
  <flowpress-cf7-form>
44
47
  <form action={schema.submitUrl} method="post" enctype="multipart/form-data" novalidate>
45
48
  {block.attributes.title || schema.title ? (
46
- <S as="h2">{String(block.attributes.title || schema.title)}</S>
49
+ <StyleflowElement as="h2">{decodeFlowpressText(block.attributes.title || schema.title)}</StyleflowElement>
47
50
  ) : null}
48
51
  {schema.fields.map((field) => {
49
52
  if (field.type === "submit") {
50
53
  return (
51
54
  <button type="submit">
52
- {field.values?.[0] || "Invia"}
55
+ {decodeFlowpressText(field.values?.[0] || "Invia")}
53
56
  </button>
54
57
  );
55
58
  }
@@ -63,7 +66,7 @@ const optionLabel = (field: FormField, index: number): string =>
63
66
  {(field.values || []).map((value, index) => (
64
67
  <label>
65
68
  <input
66
- type={field.type}
69
+ type={field.type as HTMLInputTypeAttribute}
67
70
  name={field.type === "checkbox" ? `${field.name}[]` : field.name}
68
71
  value={value}
69
72
  required={field.required}
@@ -79,7 +82,7 @@ const optionLabel = (field: FormField, index: number): string =>
79
82
  return (
80
83
  <label>
81
84
  <input type="checkbox" name={field.name} value="1" required={field.required} />
82
- {field.values?.[0] || labelFor(field)}
85
+ {decodeFlowpressText(field.values?.[0] || labelFor(field))}
83
86
  <span data-field-error={field.name}></span>
84
87
  </label>
85
88
  );
@@ -114,7 +117,7 @@ const optionLabel = (field: FormField, index: number): string =>
114
117
  <label>
115
118
  {labelFor(field)}
116
119
  <input
117
- type={field.type === "file" ? "file" : field.type}
120
+ type={field.type === "file" ? "file" : field.type as HTMLInputTypeAttribute}
118
121
  name={field.name}
119
122
  required={field.required}
120
123
  />
@@ -130,11 +133,11 @@ const optionLabel = (field: FormField, index: number): string =>
130
133
  <p data-form-status role="status" aria-live="polite"></p>
131
134
  </form>
132
135
  </flowpress-cf7-form>
133
- </S>
136
+ </StyleflowElement>
134
137
  ) : (
135
- <S as="p" {...semantic} {...htmlAttributes} role="status">
138
+ <StyleflowElement as="p" {...semantic} {...htmlAttributes} role="status">
136
139
  Il modulo non è temporaneamente disponibile.
137
- </S>
140
+ </StyleflowElement>
138
141
  )}
139
142
 
140
143
  <script>
@@ -142,7 +145,7 @@ const optionLabel = (field: FormField, index: number): string =>
142
145
  interface Window {
143
146
  turnstile?: {
144
147
  render(target: Element, options: Record<string, unknown>): string;
145
- reset(widgetId?: string): void;
148
+ reset(widgetId?: string): void | undefined;
146
149
  };
147
150
  }
148
151
  }
@@ -174,7 +177,7 @@ const optionLabel = (field: FormField, index: number): string =>
174
177
 
175
178
  if (!customElements.get("flowpress-cf7-form")) {
176
179
  customElements.define("flowpress-cf7-form", class extends HTMLElement {
177
- private widgetId?: string;
180
+ private widgetId?: string | undefined;
178
181
 
179
182
  connectedCallback() {
180
183
  const form = this.querySelector<HTMLFormElement>("form");
@@ -207,8 +210,8 @@ const optionLabel = (field: FormField, index: number): string =>
207
210
  headers: { Accept: "application/json" }
208
211
  });
209
212
  const result = await response.json() as {
210
- message?: string;
211
- invalidFields?: Array<{ field?: string; into?: string; message?: string }>;
213
+ message?: string | undefined;
214
+ invalidFields?: Array<{ field?: string | undefined; into?: string | undefined; message?: string }> | undefined;
212
215
  };
213
216
  status.textContent = result.message || (response.ok ? "Messaggio inviato." : "Invio non riuscito.");
214
217
  for (const invalid of result.invalidFields || []) {
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import type { FlowpressBlock } from "../../types.js";
4
4
  import type { StyleflowContract } from "../../styleflow.js";
5
5
  import {
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  interface Props {
12
12
  block: FlowpressBlock;
13
- contract?: StyleflowContract;
13
+ contract?: StyleflowContract | undefined;
14
14
  }
15
15
 
16
16
  const { block, contract } = Astro.props;
@@ -38,9 +38,9 @@ const style = [
38
38
  ].join(";");
39
39
  ---
40
40
 
41
- <S as="div" {...semantic} {...htmlAttributes} data-align={align} style={style}>
41
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes} data-align={align} style={style}>
42
42
  <slot />
43
- </S>
43
+ </StyleflowElement>
44
44
 
45
45
  <style>
46
46
  .flowpress-grid {
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import type { FlowpressBlock } from "../../types.js";
4
4
  import type { StyleflowContract } from "../../styleflow.js";
5
5
  import {
@@ -11,7 +11,7 @@ import {
11
11
 
12
12
  interface Props {
13
13
  block: FlowpressBlock;
14
- contract?: StyleflowContract;
14
+ contract?: StyleflowContract | undefined;
15
15
  }
16
16
 
17
17
  const { block, contract } = Astro.props;
@@ -34,8 +34,7 @@ const scrimEnabled = Boolean(attributes.scrimEnabled) && backgroundType !== "col
34
34
  const scrimIntensity = Math.min(10, Math.max(1, Number(attributes.scrimIntensity) || 6));
35
35
  ---
36
36
 
37
- <S
38
- as="section"
37
+ <StyleflowElement as="section"
39
38
  {...semantic}
40
39
  {...htmlAttributes}
41
40
  style={[
@@ -71,7 +70,7 @@ const scrimIntensity = Math.min(10, Math.max(1, Number(attributes.scrimIntensity
71
70
  <div class="flowpress-hero__content">
72
71
  <slot />
73
72
  </div>
74
- </S>
73
+ </StyleflowElement>
75
74
 
76
75
  <style>
77
76
  .flowpress-hero {
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import type { StyleflowContract } from "../../styleflow.js";
4
4
  import type { FlowpressBlock } from "../../types.js";
5
5
  import {
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  interface Props {
11
11
  block: FlowpressBlock;
12
- contract?: StyleflowContract;
12
+ contract?: StyleflowContract | undefined;
13
13
  }
14
14
 
15
15
  type ImageLoading = "eager" | "lazy";
@@ -69,8 +69,7 @@ const fetchPriority = fetchPriorityValue(attributes.fetchPriority);
69
69
  ---
70
70
 
71
71
  {src ? (
72
- <S
73
- as="div"
72
+ <StyleflowElement as="div"
74
73
  {...semanticProps(attributes, contract)}
75
74
  {...blockHtmlAttributes(attributes)}
76
75
  >
@@ -86,5 +85,5 @@ const fetchPriority = fetchPriorityValue(attributes.fetchPriority);
86
85
  decoding={decoding}
87
86
  fetchpriority={fetchPriority}
88
87
  />
89
- </S>
88
+ </StyleflowElement>
90
89
  ) : null}
@@ -1,5 +1,7 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import { decodeFlowpressText } from "../../text.js";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
+ import { flowpressLinkHref } from "../../links.js";
3
5
 
4
6
  interface Props {
5
7
  item: Record<string, unknown>;
@@ -9,20 +11,21 @@ const { item } = Astro.props;
9
11
  const image = item.image && typeof item.image === "object" && !Array.isArray(item.image)
10
12
  ? item.image as Record<string, unknown>
11
13
  : {};
14
+ const href = flowpressLinkHref(item.uri);
12
15
  ---
13
16
 
14
17
  {image.url ? (
15
18
  <img
16
19
  src={String(image.url)}
17
- alt={String(image.alt ?? "")}
20
+ alt={decodeFlowpressText(image.alt)}
18
21
  loading="lazy"
19
22
  decoding="async"
20
23
  />
21
24
  ) : null}
22
- {item.uri ? (
23
- <S as="a" href={String(item.uri)}>{String(item.title ?? "")}</S>
25
+ {href ? (
26
+ <StyleflowElement as="a" href={href}>{decodeFlowpressText(item.title)}</StyleflowElement>
24
27
  ) : (
25
- <S as="span">{String(item.title ?? "")}</S>
28
+ <StyleflowElement as="span">{decodeFlowpressText(item.title)}</StyleflowElement>
26
29
  )}
27
- {item.excerpt ? <S as="p">{String(item.excerpt)}</S> : null}
28
- {item.priceHtml ? <S as="div" set:html={String(item.priceHtml)} /> : null}
30
+ {item.excerpt ? <StyleflowElement as="p">{decodeFlowpressText(item.excerpt)}</StyleflowElement> : null}
31
+ {item.priceHtml ? <StyleflowElement as="div" set:html={String(item.priceHtml)} /> : 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 {
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>}