@styleflow.app/flowpress-astro-core 1.0.0-beta.2 → 1.0.0-beta.21

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 (205) hide show
  1. package/CHANGELOG.md +151 -1
  2. package/README.md +111 -3
  3. package/dist/astro/BaseLayout.astro +10 -6
  4. package/dist/astro/CompositionRenderer.astro +157 -0
  5. package/dist/astro/DefaultBlockAdapter.astro +35 -0
  6. package/dist/astro/DefaultTemplate.astro +6 -1
  7. package/dist/astro/GutenbergRenderer.astro +231 -72
  8. package/dist/astro/ThemeRuntime.astro +24 -0
  9. package/dist/astro/blocks/CarouselBlock.astro +7 -9
  10. package/dist/astro/blocks/CarouselItemBlock.astro +3 -3
  11. package/dist/astro/blocks/ColumnBlock.astro +3 -4
  12. package/dist/astro/blocks/CoverBlock.astro +155 -0
  13. package/dist/astro/blocks/FormBlock.astro +18 -16
  14. package/dist/astro/blocks/GridBlock.astro +3 -3
  15. package/dist/astro/blocks/HeroBlock.astro +3 -4
  16. package/dist/astro/blocks/ImageBlock.astro +3 -4
  17. package/dist/astro/blocks/ListItemFallback.astro +7 -5
  18. package/dist/astro/blocks/NumberSpinnerBlock.astro +25 -19
  19. package/dist/astro/blocks/SemanticElement.astro +35 -0
  20. package/dist/astro/blocks/SiteLogoBlock.astro +53 -0
  21. package/dist/astro/blocks/TextBlock.astro +29 -25
  22. package/dist/astro/blocks/ThemeToggleBlock.astro +23 -0
  23. package/dist/astro/blocks/cover.d.ts +13 -0
  24. package/dist/astro/blocks/cover.d.ts.map +1 -0
  25. package/dist/astro/blocks/cover.js +105 -0
  26. package/dist/astro/blocks/cover.js.map +1 -0
  27. package/dist/astro/blocks/cover.ts +119 -0
  28. package/dist/astro/blocks/helpers.d.ts +7 -0
  29. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  30. package/dist/astro/blocks/helpers.js +51 -41
  31. package/dist/astro/blocks/helpers.js.map +1 -1
  32. package/dist/astro/blocks/helpers.ts +63 -45
  33. package/dist/astro/native/Blob.astro +113 -0
  34. package/dist/astro/native/BlobBlock.astro +52 -0
  35. package/dist/astro/native/CustomFieldValue.astro +86 -0
  36. package/dist/astro/native/LevelTag.astro +20 -0
  37. package/dist/astro/native/MapBlock.astro +41 -0
  38. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  39. package/dist/astro/native/NativeIconBlock.astro +33 -0
  40. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  41. package/dist/astro/native/ResolvedBlocks.astro +89 -0
  42. package/dist/astro/native/SyncedPatternContent.astro +92 -0
  43. package/dist/astro/native/TermFieldValue.astro +37 -0
  44. package/dist/astro/native/Timeline.astro +20 -0
  45. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  46. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  47. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  48. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  49. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  50. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  51. package/dist/astro/native/blob/config.d.ts +49 -0
  52. package/dist/astro/native/blob/config.d.ts.map +1 -0
  53. package/dist/astro/native/blob/config.js +86 -0
  54. package/dist/astro/native/blob/config.js.map +1 -0
  55. package/dist/astro/native/blob/config.ts +132 -0
  56. package/dist/astro/native/blob/controller.d.ts +11 -0
  57. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  58. package/dist/astro/native/blob/controller.js +240 -0
  59. package/dist/astro/native/blob/controller.js.map +1 -0
  60. package/dist/astro/native/blob/controller.ts +248 -0
  61. package/dist/astro/native/blob/geometry.d.ts +2 -0
  62. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  63. package/dist/astro/native/blob/geometry.js +2 -0
  64. package/dist/astro/native/blob/geometry.js.map +1 -0
  65. package/dist/astro/native/blob/geometry.ts +1 -0
  66. package/dist/astro/native/blob/ids.d.ts +7 -0
  67. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  68. package/dist/astro/native/blob/ids.js +11 -0
  69. package/dist/astro/native/blob/ids.js.map +1 -0
  70. package/dist/astro/native/blob/ids.ts +11 -0
  71. package/dist/astro/native/blob.css +83 -0
  72. package/dist/astro/native/button.d.ts +13 -0
  73. package/dist/astro/native/button.d.ts.map +1 -0
  74. package/dist/astro/native/button.js +26 -0
  75. package/dist/astro/native/button.js.map +1 -0
  76. package/dist/astro/native/button.ts +26 -0
  77. package/dist/astro/native/core-block.astro +18 -0
  78. package/dist/astro/native/core-button.astro +43 -0
  79. package/dist/astro/native/core-buttons.astro +14 -0
  80. package/dist/astro/native/core-group.astro +23 -0
  81. package/dist/astro/native/core-home-link.astro +11 -0
  82. package/dist/astro/native/core-html.astro +8 -0
  83. package/dist/astro/native/core-icon.astro +7 -0
  84. package/dist/astro/native/core-image.astro +124 -0
  85. package/dist/astro/native/core-navigation-link.astro +70 -0
  86. package/dist/astro/native/core-navigation-submenu.astro +32 -0
  87. package/dist/astro/native/core-navigation.astro +94 -0
  88. package/dist/astro/native/core-page-list-data-item.astro +18 -0
  89. package/dist/astro/native/core-page-list-item.astro +7 -0
  90. package/dist/astro/native/core-page-list.astro +40 -0
  91. package/dist/astro/native/core-post-date.astro +20 -0
  92. package/dist/astro/native/core-post-excerpt.astro +25 -0
  93. package/dist/astro/native/core-post-featured-image.astro +37 -0
  94. package/dist/astro/native/core-post-template.astro +30 -0
  95. package/dist/astro/native/core-post-terms.astro +46 -0
  96. package/dist/astro/native/core-post-title.astro +23 -0
  97. package/dist/astro/native/core-query-no-results.astro +12 -0
  98. package/dist/astro/native/core-query.astro +22 -0
  99. package/dist/astro/native/core-site-title.astro +15 -0
  100. package/dist/astro/native/core-term-description.astro +12 -0
  101. package/dist/astro/native/core-term-name.astro +20 -0
  102. package/dist/astro/native/core-term-template.astro +30 -0
  103. package/dist/astro/native/core-terms-query.astro +19 -0
  104. package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
  105. package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
  106. package/dist/astro/native/flowpress-navigation-controller.js +217 -0
  107. package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
  108. package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
  109. package/dist/astro/native/flowpress-navigation.css +17 -0
  110. package/dist/astro/native/grid-bleed.js +106 -0
  111. package/dist/astro/native/grid.css +180 -0
  112. package/dist/astro/native/grid.d.ts +17 -0
  113. package/dist/astro/native/grid.d.ts.map +1 -0
  114. package/dist/astro/native/grid.js +103 -0
  115. package/dist/astro/native/grid.js.map +1 -0
  116. package/dist/astro/native/grid.ts +118 -0
  117. package/dist/astro/native/html.d.ts +6 -0
  118. package/dist/astro/native/html.d.ts.map +1 -0
  119. package/dist/astro/native/html.js +10 -0
  120. package/dist/astro/native/html.js.map +1 -0
  121. package/dist/astro/native/html.ts +9 -0
  122. package/dist/astro/native/icon.d.ts +3 -0
  123. package/dist/astro/native/icon.d.ts.map +1 -0
  124. package/dist/astro/native/icon.js +23 -0
  125. package/dist/astro/native/icon.js.map +1 -0
  126. package/dist/astro/native/icon.ts +21 -0
  127. package/dist/astro/native/map.d.ts +14 -0
  128. package/dist/astro/native/map.d.ts.map +1 -0
  129. package/dist/astro/native/map.js +60 -0
  130. package/dist/astro/native/map.js.map +1 -0
  131. package/dist/astro/native/map.ts +70 -0
  132. package/dist/astro/native/motion-preference.d.ts +50 -0
  133. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  134. package/dist/astro/native/motion-preference.js +132 -0
  135. package/dist/astro/native/motion-preference.js.map +1 -0
  136. package/dist/astro/native/motion-preference.ts +158 -0
  137. package/dist/astro/native/motion.d.ts +101 -0
  138. package/dist/astro/native/motion.d.ts.map +1 -0
  139. package/dist/astro/native/motion.js +168 -0
  140. package/dist/astro/native/motion.js.map +1 -0
  141. package/dist/astro/native/motion.ts +312 -0
  142. package/dist/astro/native/query-loop.d.ts +38 -0
  143. package/dist/astro/native/query-loop.d.ts.map +1 -0
  144. package/dist/astro/native/query-loop.js +20 -0
  145. package/dist/astro/native/query-loop.js.map +1 -0
  146. package/dist/astro/native/query-loop.ts +67 -0
  147. package/dist/astro/native/registry.d.ts +3 -0
  148. package/dist/astro/native/registry.d.ts.map +1 -0
  149. package/dist/astro/native/registry.js +72 -0
  150. package/dist/astro/native/registry.js.map +1 -0
  151. package/dist/astro/native/registry.ts +72 -0
  152. package/dist/astro/native/sf-block-binding.astro +20 -0
  153. package/dist/astro/native/sf-post-field.astro +9 -0
  154. package/dist/astro/native/sf-term-field.astro +9 -0
  155. package/dist/astro/native/timeline.css +4 -0
  156. package/dist/astro/native/timeline.d.ts +28 -0
  157. package/dist/astro/native/timeline.d.ts.map +1 -0
  158. package/dist/astro/native/timeline.js +43 -0
  159. package/dist/astro/native/timeline.js.map +1 -0
  160. package/dist/astro/native/timeline.ts +79 -0
  161. package/dist/block-renderers.d.ts +20 -3
  162. package/dist/block-renderers.d.ts.map +1 -1
  163. package/dist/block-renderers.js.map +1 -1
  164. package/dist/client.d.ts +17 -1
  165. package/dist/client.d.ts.map +1 -1
  166. package/dist/client.js +63 -9
  167. package/dist/client.js.map +1 -1
  168. package/dist/composition.d.ts +14 -0
  169. package/dist/composition.d.ts.map +1 -0
  170. package/dist/composition.js +124 -0
  171. package/dist/composition.js.map +1 -0
  172. package/dist/default-blocks.d.ts +9 -0
  173. package/dist/default-blocks.d.ts.map +1 -0
  174. package/dist/default-blocks.js +107 -0
  175. package/dist/default-blocks.js.map +1 -0
  176. package/dist/env.d.ts +9 -0
  177. package/dist/env.d.ts.map +1 -1
  178. package/dist/env.js +20 -0
  179. package/dist/env.js.map +1 -1
  180. package/dist/index.d.ts +5 -0
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +5 -0
  183. package/dist/index.js.map +1 -1
  184. package/dist/links.d.ts +5 -0
  185. package/dist/links.d.ts.map +1 -0
  186. package/dist/links.js +32 -0
  187. package/dist/links.js.map +1 -0
  188. package/dist/media.d.ts +28 -0
  189. package/dist/media.d.ts.map +1 -0
  190. package/dist/media.js +212 -0
  191. package/dist/media.js.map +1 -0
  192. package/dist/styleflow.d.ts +16 -1
  193. package/dist/styleflow.d.ts.map +1 -1
  194. package/dist/styleflow.js +67 -7
  195. package/dist/styleflow.js.map +1 -1
  196. package/dist/templates.d.ts +16 -16
  197. package/dist/theme-runtime.d.ts +16 -0
  198. package/dist/theme-runtime.d.ts.map +1 -0
  199. package/dist/theme-runtime.js +77 -0
  200. package/dist/theme-runtime.js.map +1 -0
  201. package/dist/tsconfig.tsbuildinfo +1 -1
  202. package/dist/types.d.ts +84 -1
  203. package/dist/types.d.ts.map +1 -1
  204. package/dist/types.js.map +1 -1
  205. package/package.json +13 -4
@@ -0,0 +1,155 @@
1
+ ---
2
+ import S from "@styleflow.app/astro/S.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
+ <S 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
+ <S.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
+ <S.div class="wp-block-cover__inner-container flowpress-cover__content">
114
+ <slot />
115
+ </S.div>
116
+ </S>
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,4 +1,6 @@
1
1
  ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ type HTMLInputTypeAttribute = HTMLAttributes<"input">["type"];
2
4
  import S from "@styleflow.app/astro/S.astro";
3
5
  import type { FlowpressBlock } from "../../types.js";
4
6
  import type { StyleflowContract } from "../../styleflow.js";
@@ -7,10 +9,10 @@ import { blockHtmlAttributes, semanticProps } from "./helpers.js";
7
9
  interface FormField {
8
10
  name: string;
9
11
  type: string;
10
- required?: boolean;
11
- values?: string[];
12
- labels?: string[];
13
- options?: string[];
12
+ required?: boolean | undefined;
13
+ values?: string[] | undefined;
14
+ labels?: string[] | undefined;
15
+ options?: string[] | undefined;
14
16
  }
15
17
 
16
18
  interface FormSchema {
@@ -24,7 +26,7 @@ interface FormSchema {
24
26
 
25
27
  interface Props {
26
28
  block: FlowpressBlock;
27
- contract?: StyleflowContract;
29
+ contract?: StyleflowContract | undefined;
28
30
  }
29
31
 
30
32
  const { block, contract } = Astro.props;
@@ -39,11 +41,11 @@ const optionLabel = (field: FormField, index: number): string =>
39
41
  ---
40
42
 
41
43
  {schema?.available ? (
42
- <S as="div" {...semantic} {...htmlAttributes}>
44
+ <S.div {...semantic} {...htmlAttributes}>
43
45
  <flowpress-cf7-form>
44
46
  <form action={schema.submitUrl} method="post" enctype="multipart/form-data" novalidate>
45
47
  {block.attributes.title || schema.title ? (
46
- <S as="h2">{String(block.attributes.title || schema.title)}</S>
48
+ <S.h2>{String(block.attributes.title || schema.title)}</S.h2>
47
49
  ) : null}
48
50
  {schema.fields.map((field) => {
49
51
  if (field.type === "submit") {
@@ -63,7 +65,7 @@ const optionLabel = (field: FormField, index: number): string =>
63
65
  {(field.values || []).map((value, index) => (
64
66
  <label>
65
67
  <input
66
- type={field.type}
68
+ type={field.type as HTMLInputTypeAttribute}
67
69
  name={field.type === "checkbox" ? `${field.name}[]` : field.name}
68
70
  value={value}
69
71
  required={field.required}
@@ -114,7 +116,7 @@ const optionLabel = (field: FormField, index: number): string =>
114
116
  <label>
115
117
  {labelFor(field)}
116
118
  <input
117
- type={field.type === "file" ? "file" : field.type}
119
+ type={field.type === "file" ? "file" : field.type as HTMLInputTypeAttribute}
118
120
  name={field.name}
119
121
  required={field.required}
120
122
  />
@@ -130,11 +132,11 @@ const optionLabel = (field: FormField, index: number): string =>
130
132
  <p data-form-status role="status" aria-live="polite"></p>
131
133
  </form>
132
134
  </flowpress-cf7-form>
133
- </S>
135
+ </S.div>
134
136
  ) : (
135
- <S as="p" {...semantic} {...htmlAttributes} role="status">
137
+ <S.p {...semantic} {...htmlAttributes} role="status">
136
138
  Il modulo non è temporaneamente disponibile.
137
- </S>
139
+ </S.p>
138
140
  )}
139
141
 
140
142
  <script>
@@ -142,7 +144,7 @@ const optionLabel = (field: FormField, index: number): string =>
142
144
  interface Window {
143
145
  turnstile?: {
144
146
  render(target: Element, options: Record<string, unknown>): string;
145
- reset(widgetId?: string): void;
147
+ reset(widgetId?: string): void | undefined;
146
148
  };
147
149
  }
148
150
  }
@@ -174,7 +176,7 @@ const optionLabel = (field: FormField, index: number): string =>
174
176
 
175
177
  if (!customElements.get("flowpress-cf7-form")) {
176
178
  customElements.define("flowpress-cf7-form", class extends HTMLElement {
177
- private widgetId?: string;
179
+ private widgetId?: string | undefined;
178
180
 
179
181
  connectedCallback() {
180
182
  const form = this.querySelector<HTMLFormElement>("form");
@@ -207,8 +209,8 @@ const optionLabel = (field: FormField, index: number): string =>
207
209
  headers: { Accept: "application/json" }
208
210
  });
209
211
  const result = await response.json() as {
210
- message?: string;
211
- invalidFields?: Array<{ field?: string; into?: string; message?: string }>;
212
+ message?: string | undefined;
213
+ invalidFields?: Array<{ field?: string | undefined; into?: string | undefined; message?: string }> | undefined;
212
214
  };
213
215
  status.textContent = result.message || (response.ok ? "Messaggio inviato." : "Invio non riuscito.");
214
216
  for (const invalid of result.invalidFields || []) {
@@ -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
+ <S.div {...semantic} {...htmlAttributes} data-align={align} style={style}>
42
42
  <slot />
43
- </S>
43
+ </S.div>
44
44
 
45
45
  <style>
46
46
  .flowpress-grid {
@@ -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
+ <S.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
+ </S.section>
75
74
 
76
75
  <style>
77
76
  .flowpress-hero {
@@ -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
+ <S.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
+ </S.div>
90
89
  ) : null}
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import S from "@styleflow.app/astro/S.astro";
3
+ import { flowpressLinkHref } from "../../links.js";
3
4
 
4
5
  interface Props {
5
6
  item: Record<string, unknown>;
@@ -9,6 +10,7 @@ const { item } = Astro.props;
9
10
  const image = item.image && typeof item.image === "object" && !Array.isArray(item.image)
10
11
  ? item.image as Record<string, unknown>
11
12
  : {};
13
+ const href = flowpressLinkHref(item.uri);
12
14
  ---
13
15
 
14
16
  {image.url ? (
@@ -19,10 +21,10 @@ const image = item.image && typeof item.image === "object" && !Array.isArray(ite
19
21
  decoding="async"
20
22
  />
21
23
  ) : null}
22
- {item.uri ? (
23
- <S as="a" href={String(item.uri)}>{String(item.title ?? "")}</S>
24
+ {href ? (
25
+ <S.a href={href}>{String(item.title ?? "")}</S.a>
24
26
  ) : (
25
- <S as="span">{String(item.title ?? "")}</S>
27
+ <S.span>{String(item.title ?? "")}</S.span>
26
28
  )}
27
- {item.excerpt ? <S as="p">{String(item.excerpt)}</S> : null}
28
- {item.priceHtml ? <S as="div" set:html={String(item.priceHtml)} /> : null}
29
+ {item.excerpt ? <S.p>{String(item.excerpt)}</S.p> : null}
30
+ {item.priceHtml ? <S.div set:html={String(item.priceHtml)} /> : null}
@@ -12,10 +12,11 @@ import {
12
12
  semanticProps,
13
13
  textHtmlTag
14
14
  } from "./helpers.js";
15
+ import SemanticElement from "./SemanticElement.astro";
15
16
 
16
17
  interface Props {
17
18
  block: FlowpressBlock;
18
- contract?: StyleflowContract;
19
+ contract?: StyleflowContract | undefined;
19
20
  }
20
21
 
21
22
  const { block, contract } = Astro.props;
@@ -56,8 +57,7 @@ const numberTag = textHtmlTag(attributes.numberTag);
56
57
  const suffixTag = textHtmlTag(attributes.suffixTag);
57
58
  ---
58
59
 
59
- <S
60
- as="div"
60
+ <S.div
61
61
  {...semantic}
62
62
  {...htmlAttributes}
63
63
  data-flowpress-number-spinner
@@ -67,18 +67,22 @@ const suffixTag = textHtmlTag(attributes.suffixTag);
67
67
  data-spinner-locale={locale || undefined}
68
68
  >
69
69
  {prefix ? (
70
- <S
71
- as={prefixTag}
72
- class="flowpress-number-spinner__segment"
73
- {...prefixSemantic}
70
+ <SemanticElement
71
+ tag={prefixTag}
72
+ attributes={{
73
+ class: "flowpress-number-spinner__segment",
74
+ ...prefixSemantic
75
+ }}
74
76
  >
75
77
  {prefix}
76
- </S>
78
+ </SemanticElement>
77
79
  ) : null}
78
- <S
79
- as={numberTag}
80
- class="flowpress-number-spinner__segment flowpress-number-spinner__number"
81
- {...numberSemantic}
80
+ <SemanticElement
81
+ tag={numberTag}
82
+ attributes={{
83
+ class: "flowpress-number-spinner__segment flowpress-number-spinner__number",
84
+ ...numberSemantic
85
+ }}
82
86
  >
83
87
  <span class="flowpress-number-spinner__accessible-value">
84
88
  {numberText}
@@ -89,17 +93,19 @@ const suffixTag = textHtmlTag(attributes.suffixTag);
89
93
  >
90
94
  {numberText}
91
95
  </span>
92
- </S>
96
+ </SemanticElement>
93
97
  {suffix ? (
94
- <S
95
- as={suffixTag}
96
- class="flowpress-number-spinner__segment"
97
- {...suffixSemantic}
98
+ <SemanticElement
99
+ tag={suffixTag}
100
+ attributes={{
101
+ class: "flowpress-number-spinner__segment",
102
+ ...suffixSemantic
103
+ }}
98
104
  >
99
105
  {suffix}
100
- </S>
106
+ </SemanticElement>
101
107
  ) : null}
102
- </S>
108
+ </S.div>
103
109
 
104
110
  <script>
105
111
  import { initializeNumberSpinners } from "../../number-spinner.js";
@@ -0,0 +1,35 @@
1
+ ---
2
+ import S from "@styleflow.app/astro/S.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" ? <S.div {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.div>
19
+ : tag === "span" ? <S.span {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.span>
20
+ : tag === "p" ? <S.p {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.p>
21
+ : tag === "a" ? <S.a {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.a>
22
+ : tag === "li" ? <S.li {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.li>
23
+ : tag === "ol" ? <S.ol {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.ol>
24
+ : tag === "ul" ? <S.ul {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.ul>
25
+ : tag === "blockquote" ? <S.blockquote {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.blockquote>
26
+ : tag === "h1" ? <S.h1 {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.h1>
27
+ : tag === "h2" ? <S.h2 {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.h2>
28
+ : tag === "h3" ? <S.h3 {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.h3>
29
+ : tag === "h4" ? <S.h4 {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.h4>
30
+ : tag === "h5" ? <S.h5 {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.h5>
31
+ : tag === "h6" ? <S.h6 {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.h6>
32
+ : tag === "strong" ? <S.strong {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.strong>
33
+ : tag === "em" ? <S.em {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.em>
34
+ : tag === "small" ? <S.small {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.small>
35
+ : <S.mark {...attributes}>{html === undefined ? <slot /> : <Fragment set:html={html} />}</S.mark>}
@@ -0,0 +1,53 @@
1
+ ---
2
+ import S from "@styleflow.app/astro/S.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
4
+
5
+ type LogoImage = { url?: string | undefined; width?: number | undefined; height?: number | undefined; alt?: string } | undefined;
6
+ type LogoData = {
7
+ images?: { positive?: LogoImage | undefined; negative?: LogoImage } | undefined;
8
+ homeUrl?: string | undefined;
9
+ override?: "auto" | "positive" | "negative" | undefined;
10
+ };
11
+
12
+ const { block, styleflowProps, htmlProps } = Astro.props as FlowpressBlockRendererProps;
13
+ const data = (block.resolvedData ?? {}) as LogoData;
14
+ const positive = data.images?.positive ?? {};
15
+ const negative = data.images?.negative ?? {};
16
+ const homeUrl = typeof data.homeUrl === "string" && data.homeUrl ? data.homeUrl : "/";
17
+ const override = data.override === "positive" || data.override === "negative"
18
+ ? data.override
19
+ : "auto";
20
+ const rootHtmlProps = {
21
+ ...htmlProps,
22
+ class: ["flowpress-site-logo", htmlProps.class].filter(Boolean).join(" ")
23
+ };
24
+ ---
25
+
26
+ {positive.url || negative.url ? (
27
+ <S.a
28
+ {...rootHtmlProps}
29
+ {...styleflowProps}
30
+ href={homeUrl}
31
+ data-flowpress-logo-override={override === "auto" ? undefined : override}
32
+ aria-label="Home"
33
+ >
34
+ {positive.url ? (
35
+ <img
36
+ class="flowpress-site-logo__image flowpress-site-logo__image--positive"
37
+ src={positive.url}
38
+ width={positive.width || undefined}
39
+ height={positive.height || undefined}
40
+ alt={positive.alt ?? ""}
41
+ />
42
+ ) : null}
43
+ {negative.url ? (
44
+ <img
45
+ class="flowpress-site-logo__image flowpress-site-logo__image--negative"
46
+ src={negative.url}
47
+ width={negative.width || undefined}
48
+ height={negative.height || undefined}
49
+ alt={negative.alt ?? ""}
50
+ />
51
+ ) : null}
52
+ </S.a>
53
+ ) : null}
@@ -7,15 +7,17 @@ import {
7
7
  preserveEmptyTextBlock,
8
8
  preserveRichTextSpacing,
9
9
  semanticProps,
10
+ textBlockSemanticDefaults,
10
11
  textAlignmentStyle,
11
12
  textValue,
12
13
  unwrapCoreHtml
13
14
  } from "./helpers.js";
15
+ import SemanticElement from "./SemanticElement.astro";
14
16
 
15
17
  interface Props {
16
18
  block: FlowpressBlock;
17
- contract?: StyleflowContract;
18
- hasChildren?: boolean;
19
+ contract?: StyleflowContract | undefined;
20
+ hasChildren?: boolean | undefined;
19
21
  }
20
22
 
21
23
  const { block, contract, hasChildren = false } = Astro.props;
@@ -24,19 +26,7 @@ const attributes = block.attributes;
24
26
  const heading = name === "heading" || name === "core/heading";
25
27
  const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));
26
28
  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
- };
29
+ const defaults = textBlockSemanticDefaults(name, attributes, contract);
40
30
  const semantic = semanticProps(attributes, contract, defaults);
41
31
  const htmlAttributes = blockHtmlAttributes(attributes);
42
32
  const alignmentStyle = textAlignmentStyle(attributes);
@@ -60,24 +50,38 @@ const listTag = Boolean(attributes.ordered) ? "ol" : "ul";
60
50
  ---
61
51
 
62
52
  {heading ? (
63
- <S as={headingTag} {...semantic} {...htmlAttributes} style={alignmentStyle} set:html={html} />
53
+ <SemanticElement
54
+ tag={headingTag}
55
+ attributes={{ ...semantic, ...htmlAttributes, style: alignmentStyle }}
56
+ html={html}
57
+ />
64
58
  ) : name === "core/list" ? (
65
- <S as={listTag} {...semantic} {...htmlAttributes} style={alignmentStyle}>
66
- {hasChildren ? <slot /> : <Fragment set:html={html} />}
67
- </S>
59
+ <SemanticElement
60
+ tag={listTag}
61
+ attributes={{ ...semantic, ...htmlAttributes, style: alignmentStyle }}
62
+ html={hasChildren ? undefined : html}
63
+ >
64
+ {hasChildren ? <slot /> : null}
65
+ </SemanticElement>
68
66
  ) : name === "core/list-item" ? (
69
- <S as="li" {...semantic} {...htmlAttributes} style={alignmentStyle}>
67
+ <S.li {...semantic} {...htmlAttributes} style={alignmentStyle}>
70
68
  <span set:html={html}></span>
71
69
  {hasChildren ? <slot /> : null}
72
- </S>
70
+ </S.li>
73
71
  ) : name === "quote" || name === "core/quote" ? (
74
- <S as="blockquote" {...semantic} {...htmlAttributes} style={alignmentStyle}>
72
+ <S.blockquote {...semantic} {...htmlAttributes} style={alignmentStyle}>
75
73
  {hasChildren ? <slot /> : <div set:html={html}></div>}
76
74
  {attributes.citation ? <cite>{String(attributes.citation)}</cite> : null}
77
- </S>
75
+ </S.blockquote>
76
+ ) : name === "core/paragraph" ? (
77
+ <S.p
78
+ {...semantic}
79
+ {...htmlAttributes}
80
+ style={alignmentStyle}
81
+ set:html={html}
82
+ />
78
83
  ) : (
79
- <S
80
- as={name === "core/paragraph" ? "p" : "div"}
84
+ <S.div
81
85
  {...semantic}
82
86
  {...htmlAttributes}
83
87
  style={alignmentStyle}
@@ -0,0 +1,23 @@
1
+ ---
2
+ import S from "@styleflow.app/astro/S.astro";
3
+ import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
4
+
5
+ const { block, styleflowProps, htmlProps, composition } = Astro.props as FlowpressBlockRendererProps;
6
+ const label = typeof block.attributes.label === "string" && block.attributes.label.trim()
7
+ ? block.attributes.label.trim()
8
+ : "Change color theme";
9
+ const showThemeName = block.attributes.showThemeName !== false;
10
+ const themeName = "Theme";
11
+ ---
12
+
13
+ <S.button
14
+ {...htmlProps}
15
+ {...styleflowProps}
16
+ type="button"
17
+ aria-label={label}
18
+ data-styleflow-theme-toggle
19
+ >
20
+ <span data-styleflow-theme-label aria-hidden="true">
21
+ {showThemeName ? String(themeName) : "Theme"}
22
+ </span>
23
+ </S.button>
@@ -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"}