@styleflow.app/flowpress-astro-core 1.0.0-beta.30 → 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 (112) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/astro/CompositionRenderer.astro +13 -2
  3. package/dist/astro/DefaultBlockAdapter.astro +1 -0
  4. package/dist/astro/FontStylesheets.astro +35 -0
  5. package/dist/astro/GutenbergRenderer.astro +58 -19
  6. package/dist/astro/Media.astro +24 -0
  7. package/dist/astro/StyleflowElement.astro +1 -0
  8. package/dist/astro/blocks/CarouselBlock.astro +3 -0
  9. package/dist/astro/blocks/CoverBlock.astro +2 -1
  10. package/dist/astro/blocks/HeroBlock.astro +2 -1
  11. package/dist/astro/blocks/ImageBlock.astro +2 -1
  12. package/dist/astro/blocks/ListItemFallback.astro +2 -1
  13. package/dist/astro/blocks/SiteLogoBlock.astro +3 -2
  14. package/dist/astro/blocks/helpers.d.ts +3 -1
  15. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  16. package/dist/astro/blocks/helpers.js +5 -3
  17. package/dist/astro/blocks/helpers.js.map +1 -1
  18. package/dist/astro/blocks/helpers.ts +7 -4
  19. package/dist/astro/motion/AccordionRuntime.astro +9 -0
  20. package/dist/astro/motion/MotionBoot.astro +21 -0
  21. package/dist/astro/motion/MotionRuntime.astro +31 -0
  22. package/dist/astro/motion/accordion.css +163 -0
  23. package/dist/astro/motion/accordion.d.ts +3 -0
  24. package/dist/astro/motion/accordion.d.ts.map +1 -0
  25. package/dist/astro/motion/accordion.js +98 -0
  26. package/dist/astro/motion/accordion.js.map +1 -0
  27. package/dist/astro/motion/accordion.ts +109 -0
  28. package/dist/astro/motion/motion-controller.d.ts +12 -0
  29. package/dist/astro/motion/motion-controller.d.ts.map +1 -0
  30. package/dist/astro/motion/motion-controller.js +293 -0
  31. package/dist/astro/motion/motion-controller.js.map +1 -0
  32. package/dist/astro/motion/motion-controller.ts +377 -0
  33. package/dist/astro/motion/motion.css +546 -0
  34. package/dist/astro/motion/motion.d.ts +127 -0
  35. package/dist/astro/motion/motion.d.ts.map +1 -0
  36. package/dist/astro/motion/motion.js +255 -0
  37. package/dist/astro/motion/motion.js.map +1 -0
  38. package/dist/astro/motion/motion.ts +419 -0
  39. package/dist/astro/native/CustomFieldValue.astro +2 -1
  40. package/dist/astro/native/ReservedLogin.astro +107 -0
  41. package/dist/astro/native/ResolvedBlocks.astro +2 -0
  42. package/dist/astro/native/SyncedPatternContent.astro +2 -0
  43. package/dist/astro/native/TermFieldValue.astro +2 -1
  44. package/dist/astro/native/Timeline.astro +2 -1
  45. package/dist/astro/native/blob.css +1 -1
  46. package/dist/astro/native/button-template.d.ts +31 -0
  47. package/dist/astro/native/button-template.d.ts.map +1 -0
  48. package/dist/astro/native/button-template.js +54 -0
  49. package/dist/astro/native/button-template.js.map +1 -0
  50. package/dist/astro/native/button-template.ts +92 -0
  51. package/dist/astro/native/core-button-fallback.astro +43 -0
  52. package/dist/astro/native/core-button.astro +48 -26
  53. package/dist/astro/native/core-group.astro +3 -1
  54. package/dist/astro/native/core-image.astro +3 -2
  55. package/dist/astro/native/core-navigation.astro +9 -2
  56. package/dist/astro/native/core-post-featured-image.astro +3 -2
  57. package/dist/astro/native/core-post-template-fallback.astro +30 -0
  58. package/dist/astro/native/core-post-template.astro +17 -24
  59. package/dist/astro/native/grid-bleed.d.ts +2 -0
  60. package/dist/astro/native/grid-bleed.d.ts.map +1 -0
  61. package/dist/astro/native/grid-bleed.js +24 -7
  62. package/dist/astro/native/grid-bleed.js.map +1 -0
  63. package/dist/astro/native/group.css +36 -0
  64. package/dist/astro/native/group.d.ts +15 -0
  65. package/dist/astro/native/group.d.ts.map +1 -0
  66. package/dist/astro/native/group.js +66 -0
  67. package/dist/astro/native/group.js.map +1 -0
  68. package/dist/astro/native/group.ts +61 -0
  69. package/dist/astro/native/inline-text.css +15 -0
  70. package/dist/astro/native/query-carousel.d.ts +12 -0
  71. package/dist/astro/native/query-carousel.d.ts.map +1 -0
  72. package/dist/astro/native/query-carousel.js +36 -0
  73. package/dist/astro/native/query-carousel.js.map +1 -0
  74. package/dist/astro/native/query-carousel.ts +56 -0
  75. package/dist/astro/native/registry.d.ts.map +1 -1
  76. package/dist/astro/native/registry.js +3 -0
  77. package/dist/astro/native/registry.js.map +1 -1
  78. package/dist/astro/native/registry.ts +4 -0
  79. package/dist/astro/native/timeline.css +1 -1
  80. package/dist/astro/preferences/AccessibilityPanel.astro +73 -86
  81. package/dist/block-renderers.d.ts +2 -0
  82. package/dist/block-renderers.d.ts.map +1 -1
  83. package/dist/block-renderers.js.map +1 -1
  84. package/dist/composition.d.ts.map +1 -1
  85. package/dist/composition.js +2 -1
  86. package/dist/composition.js.map +1 -1
  87. package/dist/default-blocks.d.ts +1 -1
  88. package/dist/default-blocks.d.ts.map +1 -1
  89. package/dist/default-blocks.js +3 -1
  90. package/dist/default-blocks.js.map +1 -1
  91. package/dist/reserved-area.d.ts +10 -0
  92. package/dist/reserved-area.d.ts.map +1 -0
  93. package/dist/reserved-area.js +93 -0
  94. package/dist/reserved-area.js.map +1 -0
  95. package/dist/styleflow.d.ts +2 -0
  96. package/dist/styleflow.d.ts.map +1 -1
  97. package/dist/styleflow.js +6 -4
  98. package/dist/styleflow.js.map +1 -1
  99. package/dist/svg-media-runtime.d.ts +3 -0
  100. package/dist/svg-media-runtime.d.ts.map +1 -0
  101. package/dist/svg-media-runtime.js +33 -0
  102. package/dist/svg-media-runtime.js.map +1 -0
  103. package/dist/svg-media-types.d.ts +11 -0
  104. package/dist/svg-media-types.d.ts.map +1 -0
  105. package/dist/svg-media-types.js +2 -0
  106. package/dist/svg-media-types.js.map +1 -0
  107. package/dist/svg-media.d.ts +10 -0
  108. package/dist/svg-media.d.ts.map +1 -0
  109. package/dist/svg-media.js +34 -0
  110. package/dist/svg-media.js.map +1 -0
  111. package/dist/tsconfig.tsbuildinfo +1 -1
  112. package/package.json +30 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0-beta.31 — 2026-10-14
4
+
5
+ - Official renderers, inline SVG, inherited color validation, preferences, portable motion and accordion runtimes.
6
+ - Preserve inline typography and explicit inherited tones; provide readable uninitialized carousels.
7
+ - [Canonical integration report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-10-14-consolidamento-tessari.md).
8
+
9
+
3
10
  ## 1.0.0-beta.30 — 2026-10-09
4
11
 
5
12
  - Ship native `core/icon` structural CSS with the Astro renderer: apply validated WordPress widths, proportional SVG dimensions and alignment, and paint icons from the StyleFlow foreground through `currentColor`.
@@ -1,5 +1,8 @@
1
1
  ---
2
+ import "./native/inline-text.css";
3
+ import { registerFlowpressSvgMedia, type FlowpressSvgMediaLocals } from "../svg-media.js";
2
4
  import "./native/grid.css";
5
+ import "./native/group.css";
3
6
  import { decorateGridBlocks } from "./native/grid.js";
4
7
  import type { FlowpressBlockAdapters } from "../block-renderers.js";
5
8
  import {
@@ -23,6 +26,7 @@ interface Props {
23
26
  parentBlockName?: string | undefined;
24
27
  production?: boolean | undefined;
25
28
  depth?: number | undefined;
29
+ inheritedTone?: string | undefined;
26
30
  media?: FlowpressFrontendMediaOptions | undefined;
27
31
  prepared?: { descriptors: ReadonlyMap<string, FlowpressBlockTypeDescriptor>; blocking: FlowpressCompositionV1["diagnostics"] } | undefined;
28
32
  }
@@ -34,9 +38,12 @@ const {
34
38
  contract,
35
39
  parentBlockName,
36
40
  production = import.meta.env.PROD,
37
- depth = 0
41
+ depth = 0,
42
+ inheritedTone
38
43
  } = Astro.props;
39
44
 
45
+ registerFlowpressSvgMedia(sourceComposition, Astro.locals as FlowpressSvgMediaLocals);
46
+
40
47
  const mediaOptions: FlowpressFrontendMediaOptions = Astro.props.media ?? {
41
48
  frontendOrigin: Astro.url.origin,
42
49
  backendUrl: import.meta.env.BACKEND_URL,
@@ -109,6 +116,7 @@ const logoStyles = parentBlockName === undefined
109
116
  {},
110
117
  {
111
118
  strict: production,
119
+ effectiveTone: inheritedTone,
112
120
  onDiagnostic: (diagnostic) => console.warn(
113
121
  `[${diagnostic.code}] ${diagnostic.message}`
114
122
  )
@@ -133,7 +141,9 @@ const logoStyles = parentBlockName === undefined
133
141
  context={{
134
142
  ...(parentBlockName ? { parentBlockName } : {}),
135
143
  depth,
136
- production
144
+ production,
145
+ inheritedTone,
146
+ effectiveTone: typeof styleflowProps.tone === "string" ? styleflowProps.tone : inheritedTone
137
147
  }}
138
148
  adapters={adapters}
139
149
  >
@@ -145,6 +155,7 @@ const logoStyles = parentBlockName === undefined
145
155
  parentBlockName={block.name}
146
156
  production={production}
147
157
  depth={depth + 1}
158
+ inheritedTone={typeof styleflowProps.tone === "string" ? styleflowProps.tone : inheritedTone}
148
159
  prepared={prepared}
149
160
  />
150
161
  </Adapter>
@@ -30,6 +30,7 @@ const blockRenderers = Object.fromEntries(
30
30
  parentBlockName={context.parentBlockName}
31
31
  production={context.production}
32
32
  depth={context.depth}
33
+ inheritedTone={context.effectiveTone}
33
34
  skipCustomRendererFor={block.name}
34
35
  requireRegisteredAdapters={Boolean(composition)}
35
36
  />
@@ -0,0 +1,35 @@
1
+ ---
2
+ /**
3
+ * CDN font stylesheets from the generated font manifest, as head links rather
4
+ * than the `@import url()` of the generated fonts.css: an import inside the
5
+ * site bundle chains bundle → provider CSS → fonts. Render it once with
6
+ * `preconnect` early in the head (hints only) and once without at the end of
7
+ * the head, after the inline scripts a pending stylesheet would block.
8
+ * Self-hosted fonts are not handled here: re-import fonts.css if one is added.
9
+ * Portabile in FlowPress: docs/pilots/primo-paint-stabile.md
10
+ */
11
+
12
+
13
+ export interface Props { preconnect?: boolean; manifest?: { fonts: Array<{ source: {type: string; provider?: string; stylesheetUrl?: string} }> }; }
14
+
15
+ const { preconnect = false, manifest = {fonts: []} } = Astro.props;
16
+ const stylesheets = manifest.fonts.flatMap((font) =>
17
+ font.source.type === "cdn" && font.source.stylesheetUrl ? [{provider:font.source.provider,stylesheetUrl:font.source.stylesheetUrl}] : []
18
+ );
19
+ // Provider CSS loads without CORS and its font files with it: separate connections.
20
+ const hints = [...new Map(stylesheets.flatMap(({ provider, stylesheetUrl }) => {
21
+ const origin = new URL(stylesheetUrl).origin;
22
+ return [
23
+ { href: origin, crossorigin: false },
24
+ { href: origin, crossorigin: true },
25
+ // Adobe Fonts imports its usage-tracking CSS from a second origin.
26
+ ...(provider === "adobe-fonts" ? [{ href: "https://p.typekit.net", crossorigin: false }] : []),
27
+ ];
28
+ }).map((hint) => [`${hint.href} ${hint.crossorigin}`, hint] as const)).values()];
29
+ ---
30
+
31
+ {preconnect ? hints.map(({ href, crossorigin }) => (
32
+ <link rel="preconnect" href={href} crossorigin={crossorigin ? "anonymous" : undefined} />
33
+ )) : stylesheets.map(({ stylesheetUrl }) => (
34
+ <link rel="stylesheet" href={stylesheetUrl} />
35
+ ))}
@@ -1,6 +1,10 @@
1
1
  ---
2
+ import "./native/inline-text.css";
3
+ import { registerFlowpressSvgMedia, type FlowpressSvgMediaLocals } from "../svg-media.js";
4
+ import Media from "./Media.astro";
2
5
  import { decodeFlowpressText } from "../text.js";
3
6
  import "./native/grid.css";
7
+ import "./native/group.css";
4
8
  import StyleflowElement from "./StyleflowElement.astro";
5
9
  import type {
6
10
  FlowpressBlockAdapters,
@@ -51,8 +55,10 @@ interface Props {
51
55
  parentBlockName?: string | undefined;
52
56
  production?: boolean | undefined;
53
57
  depth?: number | undefined;
58
+ inheritedTone?: string | undefined;
54
59
  skipCustomRendererFor?: string | undefined;
55
60
  requireRegisteredAdapters?: boolean | undefined;
61
+ interactiveAncestor?: boolean | undefined;
56
62
  }
57
63
 
58
64
  const {
@@ -67,9 +73,13 @@ const {
67
73
  parentBlockName,
68
74
  production = import.meta.env.PROD,
69
75
  depth = 0,
76
+ inheritedTone,
70
77
  skipCustomRendererFor,
78
+ interactiveAncestor = false,
71
79
  requireRegisteredAdapters = false
72
80
  } = Astro.props;
81
+ registerFlowpressSvgMedia(rawBlocks, Astro.locals as FlowpressSvgMediaLocals);
82
+
73
83
  const { decorateGridBlocks } = await import("./native/grid.js");
74
84
  const blocks = decorateGridBlocks(rawBlocks);
75
85
  const { nativeBlockRenderers } = await import("./native/registry.js");
@@ -97,8 +107,10 @@ function youtubeEmbedUrl(value: unknown): string | null {
97
107
  }
98
108
  }
99
109
 
100
- function nestedRendererProps(nextParentBlockName: string) {
110
+ function nestedRendererProps(nextParentBlockName: string, attrs: Record<string, unknown> = {}) {
101
111
  return {
112
+ interactiveAncestor: interactiveAncestor || Boolean(attrs.interactivePriority && !["none", "inherit"].includes(String(attrs.interactivePriority))),
113
+ inheritedTone: typeof attrs.tone === "string" && attrs.tone !== "inherit" ? attrs.tone : inheritedTone,
102
114
  adapterDefinitions,
103
115
  composition,
104
116
  parentBlockName: nextParentBlockName,
@@ -112,9 +124,10 @@ function nestedRendererProps(nextParentBlockName: string) {
112
124
  {blocks.map((block, index) => {
113
125
  const name = block.name.replace(/^sf\//, "");
114
126
  const children = decorateGridBlocks(block.innerBlocks ?? []);
127
+ if (interactiveAncestor && /^(?:core|sf)\/(?:paragraph|heading)$/.test(block.name) && !block.attributes.foreground) block = {...block, attributes:{...block.attributes, foreground:"inherit"}};
115
128
  const semantic = index === 0 && blocks.length === 1 && rootStyleflowProps
116
129
  ? rootStyleflowProps
117
- : semanticProps(block.attributes, contract);
130
+ : semanticProps(block.attributes, contract, undefined, inheritedTone);
118
131
  const htmlAttributes = index === 0 && blocks.length === 1 && rootHtmlProps
119
132
  ? { ...rootHtmlProps, class: Array.from(new Set([rootHtmlProps.class, block.attributes.className].filter(Boolean).join(" ").split(/\s+/))).join(" ") }
120
133
  : blockHtmlAttributes(block.attributes);
@@ -159,13 +172,15 @@ function nestedRendererProps(nextParentBlockName: string) {
159
172
  contract={contract}
160
173
  composition={composition}
161
174
  adapters={adapterDefinitions ?? {}}
162
- htmlProps={htmlAttributes}
175
+ htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
163
176
  styleflowProps={semantic}
164
177
  parentBlockName={parentBlockName}
165
178
  context={{
166
179
  ...(parentBlockName ? { parentBlockName } : {}),
167
180
  depth,
168
- production
181
+ production,
182
+ inheritedTone,
183
+ effectiveTone: typeof semantic.tone === "string" ? semantic.tone : inheritedTone
169
184
  }}
170
185
  >
171
186
  <Astro.self descriptorIndex={descriptors}
@@ -178,6 +193,8 @@ function nestedRendererProps(nextParentBlockName: string) {
178
193
  parentBlockName={block.name}
179
194
  production={production}
180
195
  depth={depth + 1}
196
+ inheritedTone={typeof semantic.tone === "string" ? semantic.tone : inheritedTone}
197
+ interactiveAncestor={interactiveAncestor || Boolean(block.attributes.interactivePriority && !["none", "inherit"].includes(String(block.attributes.interactivePriority)))}
181
198
  requireRegisteredAdapters={requireRegisteredAdapters}
182
199
  />
183
200
  </CustomBlockRenderer>
@@ -193,7 +210,7 @@ function nestedRendererProps(nextParentBlockName: string) {
193
210
  contract={contract}
194
211
  blockRenderers={blockRenderers}
195
212
  iconRenderer={IconRenderer}
196
- {...nestedRendererProps(block.name)}
213
+ {...nestedRendererProps(block.name, block.attributes)}
197
214
  />
198
215
  </HeroBlock>
199
216
  );
@@ -207,7 +224,7 @@ function nestedRendererProps(nextParentBlockName: string) {
207
224
  contract={contract}
208
225
  blockRenderers={blockRenderers}
209
226
  iconRenderer={IconRenderer}
210
- {...nestedRendererProps(block.name)}
227
+ {...nestedRendererProps(block.name, block.attributes)}
211
228
  />
212
229
  </GridBlock>
213
230
  );
@@ -221,7 +238,7 @@ function nestedRendererProps(nextParentBlockName: string) {
221
238
  contract={contract}
222
239
  blockRenderers={blockRenderers}
223
240
  iconRenderer={IconRenderer}
224
- {...nestedRendererProps(block.name)}
241
+ {...nestedRendererProps(block.name, block.attributes)}
225
242
  />
226
243
  </ColumnBlock>
227
244
  );
@@ -243,7 +260,7 @@ function nestedRendererProps(nextParentBlockName: string) {
243
260
  contract={contract}
244
261
  blockRenderers={blockRenderers}
245
262
  iconRenderer={IconRenderer}
246
- {...nestedRendererProps(block.name)}
263
+ {...nestedRendererProps(block.name, block.attributes)}
247
264
  />
248
265
  </CarouselBlock>
249
266
  );
@@ -257,7 +274,7 @@ function nestedRendererProps(nextParentBlockName: string) {
257
274
  contract={contract}
258
275
  blockRenderers={blockRenderers}
259
276
  iconRenderer={IconRenderer}
260
- {...nestedRendererProps(block.name)}
277
+ {...nestedRendererProps(block.name, block.attributes)}
261
278
  />
262
279
  </CarouselItemBlock>
263
280
  );
@@ -272,7 +289,7 @@ function nestedRendererProps(nextParentBlockName: string) {
272
289
  <CoverBlock
273
290
  block={block}
274
291
  contract={contract}
275
- htmlProps={htmlAttributes}
292
+ htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
276
293
  styleflowProps={semantic}
277
294
  >
278
295
  <Astro.self descriptorIndex={descriptors}
@@ -280,7 +297,7 @@ function nestedRendererProps(nextParentBlockName: string) {
280
297
  contract={contract}
281
298
  blockRenderers={blockRenderers}
282
299
  iconRenderer={IconRenderer}
283
- {...nestedRendererProps(block.name)}
300
+ {...nestedRendererProps(block.name, block.attributes)}
284
301
  />
285
302
  </CoverBlock>
286
303
  );
@@ -303,7 +320,7 @@ function nestedRendererProps(nextParentBlockName: string) {
303
320
  contract={contract}
304
321
  blockRenderers={blockRenderers}
305
322
  iconRenderer={IconRenderer}
306
- {...nestedRendererProps(block.name)}
323
+ {...nestedRendererProps(block.name, block.attributes)}
307
324
  />
308
325
  </TextBlock>
309
326
  );
@@ -398,7 +415,7 @@ function nestedRendererProps(nextParentBlockName: string) {
398
415
  return (
399
416
  <StyleflowElement as="div" {...semantic} {...htmlAttributes}>
400
417
  {images.map((image) => image.url ? (
401
- <img
418
+ <Media
402
419
  src={String(image.url)}
403
420
  alt={decodeFlowpressText(image.alt)}
404
421
  loading="lazy"
@@ -441,6 +458,19 @@ function nestedRendererProps(nextParentBlockName: string) {
441
458
  ) : null;
442
459
  }
443
460
 
461
+ if (name === "media-text") {
462
+ const media = objectValue(block, "media");
463
+ const mediaNode = media.url ? <Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} width={media.width} height={media.height} loading="lazy" /> : null;
464
+ const contentNode = <StyleflowElement as="div">
465
+ <Astro.self descriptorIndex={descriptors} blocks={children} contract={contract} blockRenderers={blockRenderers} iconRenderer={IconRenderer} {...nestedRendererProps(block.name, block.attributes)} />
466
+ </StyleflowElement>;
467
+ return (
468
+ <StyleflowElement as="div" {...semantic} {...htmlAttributes} data-flowpress-media-text>
469
+ {block.attributes.mediaPosition === "right" ? [contentNode, mediaNode] : [mediaNode, contentNode]}
470
+ </StyleflowElement>
471
+ );
472
+ }
473
+
444
474
  if (name === "chip") {
445
475
  return (
446
476
  <StyleflowElement as="span" {...semantic} {...htmlAttributes}>
@@ -455,7 +485,7 @@ function nestedRendererProps(nextParentBlockName: string) {
455
485
  return (
456
486
  <StyleflowElement as="article" {...semantic} {...htmlAttributes}>
457
487
  {media.url && (
458
- <img src={String(media.url)} alt={decodeFlowpressText(media.alt)} loading="lazy" />
488
+ <Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} loading="lazy" />
459
489
  )}
460
490
  {block.attributes.title && <StyleflowElement as="h3">{decodeFlowpressText(block.attributes.title)}</StyleflowElement>}
461
491
  {block.attributes.text && <StyleflowElement as="p">{decodeFlowpressText(block.attributes.text)}</StyleflowElement>}
@@ -481,7 +511,7 @@ function nestedRendererProps(nextParentBlockName: string) {
481
511
  contract={contract}
482
512
  blockRenderers={blockRenderers}
483
513
  iconRenderer={IconRenderer}
484
- {...nestedRendererProps(block.name)}
514
+ {...nestedRendererProps(block.name, block.attributes)}
485
515
  />
486
516
  ) : (
487
517
  <ListItemFallback item={item} />
@@ -500,7 +530,7 @@ function nestedRendererProps(nextParentBlockName: string) {
500
530
  contract={contract}
501
531
  blockRenderers={blockRenderers}
502
532
  iconRenderer={IconRenderer}
503
- {...nestedRendererProps(block.name)}
533
+ {...nestedRendererProps(block.name, block.attributes)}
504
534
  />
505
535
  </div>
506
536
  ) : (
@@ -509,7 +539,7 @@ function nestedRendererProps(nextParentBlockName: string) {
509
539
  contract={contract}
510
540
  blockRenderers={blockRenderers}
511
541
  iconRenderer={IconRenderer}
512
- {...nestedRendererProps(block.name)}
542
+ {...nestedRendererProps(block.name, block.attributes)}
513
543
  />
514
544
  );
515
545
  }
@@ -528,7 +558,7 @@ function nestedRendererProps(nextParentBlockName: string) {
528
558
  contract={contract}
529
559
  blockRenderers={blockRenderers}
530
560
  iconRenderer={IconRenderer}
531
- {...nestedRendererProps(block.name)}
561
+ {...nestedRendererProps(block.name, block.attributes)}
532
562
  />
533
563
  </details>
534
564
  </StyleflowElement>
@@ -582,7 +612,7 @@ function nestedRendererProps(nextParentBlockName: string) {
582
612
  contract={contract}
583
613
  blockRenderers={blockRenderers}
584
614
  iconRenderer={IconRenderer}
585
- {...nestedRendererProps(block.name)}
615
+ {...nestedRendererProps(block.name, block.attributes)}
586
616
  />
587
617
  );
588
618
  return name === "section" ? (
@@ -595,3 +625,12 @@ function nestedRendererProps(nextParentBlockName: string) {
595
625
  <script>
596
626
  import "./native/grid-bleed.js";
597
627
  </script>
628
+
629
+ <style is:global>
630
+ [data-flowpress-media-text] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
631
+ @media (max-width: 40rem) { [data-flowpress-media-text] { grid-template-columns: minmax(0, 1fr); } }
632
+ </style>
633
+
634
+ <style is:global>
635
+ .flowpress-carousel:not(.is-initialized), .sf-carousel:not(.is-initialized), .flowpress-query-carousel:not(.is-initialized) { visibility: visible; }
636
+ </style>
@@ -0,0 +1,24 @@
1
+ ---
2
+ import StyleflowElement from "./StyleflowElement.astro";
3
+ import { resolveStyleFlowAstroPrimitive } from "@styleflow.app/astro";
4
+ import { decodeFlowpressText } from "../text.js";
5
+ import { flowpressSvgMediaProps, type FlowpressSvgMediaLocals } from "../svg-media.js";
6
+ interface Props { src?: unknown; [key: string]: unknown; }
7
+ const props = { ...Astro.props };
8
+ if (typeof props.alt === "string") props.alt = decodeFlowpressText(props.alt);
9
+ if (typeof props["aria-label"] === "string") props["aria-label"] = decodeFlowpressText(props["aria-label"]);
10
+ const svg = flowpressSvgMediaProps(props.src, props, Astro.locals as FlowpressSvgMediaLocals);
11
+ const svgAttributes = svg ? resolveStyleFlowAstroPrimitive({ ...svg.attributes, as: "img" }).attributes : {};
12
+ ---
13
+ {svg ? (
14
+ <svg {...svgAttributes}><Fragment set:html={svg.content} /></svg>
15
+ ) : (
16
+ <StyleflowElement as="img" {...props} />
17
+ )}
18
+ <script>
19
+ import { initializeFlowpressSvgMedia } from "../svg-media-runtime.js";
20
+ initializeFlowpressSvgMedia();
21
+ </script>
22
+ <style is:global>
23
+ :where(.flowpress-svg-media) { max-inline-size: 100%; block-size: auto; overflow: hidden; vertical-align: middle; }
24
+ </style>
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import "./native/inline-text.css";
2
3
  import { decodeFlowpressText } from "../text.js";
3
4
  import { resolveStyleFlowAstroPrimitive } from "@styleflow.app/astro";
4
5
 
@@ -125,6 +125,7 @@ if (!validChildren && import.meta.env.DEV) {
125
125
  <style>
126
126
  flowpress-carousel { display: block; }
127
127
  .flowpress-carousel { min-width: 0; }
128
+ .flowpress-carousel:not(.is-initialized) { visibility: visible; }
128
129
  .flowpress-carousel:not(.is-initialized) .splide__list {
129
130
  display: grid;
130
131
  grid-template-columns: repeat(var(--flowpress-carousel-base), minmax(0, 1fr));
@@ -196,3 +197,5 @@ if (!validChildren && import.meta.env.DEV) {
196
197
  .flowpress-carousel * { scroll-behavior: auto !important; }
197
198
  }
198
199
  </style>
200
+
201
+ <style is:global>.flowpress-carousel:not(.is-initialized) { visibility: visible; }</style>
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import Media from "../Media.astro";
2
3
  import StyleflowElement from "../StyleflowElement.astro";
3
4
  import type { DynamicStyleflowProps, StyleflowContract } from "../../styleflow.js";
4
5
  import { resolvePrefixedFlowpressBlockStyleflowProps } from "../../styleflow.js";
@@ -77,7 +78,7 @@ const tagName = coverTagName(attributes.tagName);
77
78
 
78
79
  <StyleflowElement as={tagName} {...rootStyleflowProps} {...rootHtmlProps} style={rootStyle}>
79
80
  {backgroundType === "image" && source ? (
80
- <img
81
+ <Media
81
82
  class="wp-block-cover__image-background flowpress-cover__media"
82
83
  src={source}
83
84
  width={width}
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import Media from "../Media.astro";
2
3
  import StyleflowElement from "../StyleflowElement.astro";
3
4
  import type { FlowpressBlock } from "../../types.js";
4
5
  import type { StyleflowContract } from "../../styleflow.js";
@@ -43,7 +44,7 @@ const scrimIntensity = Math.min(10, Math.max(1, Number(attributes.scrimIntensity
43
44
  ].join(";")}
44
45
  >
45
46
  {backgroundType === "image" && imageSrc ? (
46
- <img
47
+ <Media
47
48
  class="flowpress-hero__media"
48
49
  src={imageSrc}
49
50
  alt=""
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import Media from "../Media.astro";
2
3
  import StyleflowElement from "../StyleflowElement.astro";
3
4
  import type { StyleflowContract } from "../../styleflow.js";
4
5
  import type { FlowpressBlock } from "../../types.js";
@@ -73,7 +74,7 @@ const fetchPriority = fetchPriorityValue(attributes.fetchPriority);
73
74
  {...semanticProps(attributes, contract)}
74
75
  {...blockHtmlAttributes(attributes)}
75
76
  >
76
- <img
77
+ <Media
77
78
  src={src}
78
79
  srcset={srcSet || undefined}
79
80
  sizes={sizes}
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import Media from "../Media.astro";
2
3
  import { decodeFlowpressText } from "../../text.js";
3
4
  import StyleflowElement from "../StyleflowElement.astro";
4
5
  import { flowpressLinkHref } from "../../links.js";
@@ -15,7 +16,7 @@ const href = flowpressLinkHref(item.uri);
15
16
  ---
16
17
 
17
18
  {image.url ? (
18
- <img
19
+ <Media
19
20
  src={String(image.url)}
20
21
  alt={decodeFlowpressText(image.alt)}
21
22
  loading="lazy"
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import Media from "../Media.astro";
2
3
  import StyleflowElement from "../StyleflowElement.astro";
3
4
  import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
4
5
 
@@ -32,7 +33,7 @@ const rootHtmlProps = {
32
33
  aria-label="Home"
33
34
  >
34
35
  {positive.url ? (
35
- <img
36
+ <Media
36
37
  class="flowpress-site-logo__image flowpress-site-logo__image--positive"
37
38
  src={positive.url}
38
39
  width={positive.width || undefined}
@@ -41,7 +42,7 @@ const rootHtmlProps = {
41
42
  />
42
43
  ) : null}
43
44
  {negative.url ? (
44
- <img
45
+ <Media
45
46
  class="flowpress-site-logo__image flowpress-site-logo__image--negative"
46
47
  src={negative.url}
47
48
  width={negative.width || undefined}
@@ -10,6 +10,8 @@ export declare function heroObjectPosition(value: unknown): string;
10
10
  export declare function blockHtmlAttributes(attributes: Record<string, unknown>, baseClass?: string): {
11
11
  id?: string;
12
12
  class?: string;
13
+ style?: string;
14
+ [key: string]: unknown;
13
15
  };
14
16
  export declare const TEXT_HTML_TAGS: readonly ["span", "p", "h1", "h2", "h3", "h4", "h5", "h6", "strong", "em", "small", "mark"];
15
17
  export type TextHtmlTag = (typeof TEXT_HTML_TAGS)[number];
@@ -21,7 +23,7 @@ export type TextHtmlTag = (typeof TEXT_HTML_TAGS)[number];
21
23
  export declare function compatibleTypographyVariant(type: string, preferred: string, contract?: StyleflowContract): string;
22
24
  export declare function textBlockSemanticDefaults(blockName: string, attributes: Record<string, unknown>, contract?: StyleflowContract): Record<string, unknown>;
23
25
  export declare function textHtmlTag(value: unknown): TextHtmlTag;
24
- export declare function semanticProps(attributes: Record<string, unknown>, contract?: StyleflowContract, defaults?: Record<string, unknown>): Record<string, unknown>;
26
+ export declare function semanticProps(attributes: Record<string, unknown>, contract?: StyleflowContract, defaults?: Record<string, unknown>, effectiveTone?: string): Record<string, unknown>;
25
27
  /** Resolve only Gutenberg's supported text-alignment values to inline CSS. */
26
28
  export declare function textAlignmentStyle(attributes: Record<string, unknown>): string | undefined;
27
29
  export declare function prefixedTextSemanticProps(attributes: Record<string, unknown>, prefix: string, contract?: StyleflowContract, defaults?: Record<string, unknown>): Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/astro/blocks/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,4BAA4B,YAAY,CAAC;AAEtD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmBzD;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,SAAS,SAAK,GACb;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAgBjC;AAED,eAAO,MAAM,cAAc,6FAajB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAQ1D;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,MAAM,CAcR;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,W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GAAG,IAAI,GAAG,KAAK,EAAE,MAAM,CAAC,CAe5D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -1,3 +1,4 @@
1
+ import { nativeFlexItemProps } from "../native/group.js";
1
2
  import { resolveFlowpressBlockStyleflowProps } from "../../styleflow.js";
2
3
  import { flowpressLinkHref } from "../../links.js";
3
4
  export const DEFAULT_SEMANTIC_PROPS = {
@@ -31,10 +32,10 @@ export function blockHtmlAttributes(attributes, baseClass = "") {
31
32
  .filter(Boolean)
32
33
  .join(" ")
33
34
  .replace(/\s+/g, " ");
34
- return {
35
+ return nativeFlexItemProps(attributes, {
35
36
  ...(anchor ? { id: anchor } : {}),
36
37
  ...(className ? { class: className } : {})
37
- };
38
+ });
38
39
  }
39
40
  export const TEXT_HTML_TAGS = [
40
41
  "span",
@@ -101,8 +102,9 @@ export function textHtmlTag(value) {
101
102
  ? candidate
102
103
  : "span";
103
104
  }
104
- export function semanticProps(attributes, contract, defaults = DEFAULT_SEMANTIC_PROPS) {
105
+ export function semanticProps(attributes, contract, defaults = DEFAULT_SEMANTIC_PROPS, effectiveTone) {
105
106
  return resolveFlowpressBlockStyleflowProps(attributes, contract, defaults, {
107
+ effectiveTone,
106
108
  strict: process.env.NODE_ENV === "production" || process.env.STYLEFLOW_STRICT === "1",
107
109
  onDiagnostic: (diagnostic) => console.warn(`[${diagnostic.code}] ${diagnostic.message}`)
108
110
  });
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/astro/blocks/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EAEpC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,OAAO;IACnB,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,M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AAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAC7B,+DAA+D,CAChE,CAAC;IACF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC","sourcesContent":["import {\n resolveFlowpressBlockStyleflowProps,\n type StyleflowContract\n} from \"../../styleflow.js\";\nimport type { FlowpressBlock } from \"../../types.js\";\nimport { flowpressLinkHref } from \"../../links.js\";\n\nexport const DEFAULT_SEMANTIC_PROPS = {\n surface: \"default\",\n layoutRole: \"stack\",\n density: \"regular\"\n};\n\nexport const DEFAULT_HERO_OBJECT_POSITION = \"50% 50%\";\n\nexport function heroObjectPosition(value: unknown): string {\n if (typeof value !== \"string\") {\n return DEFAULT_HERO_OBJECT_POSITION;\n }\n\n const match = value.trim().match(\n /^(\\d+(?:\\.\\d+)?|\\.\\d+)%\\s+(\\d+(?:\\.\\d+)?|\\.\\d+)%$/\n );\n if (\n !match\n || [match[1], match[2]].some((coordinate) => {\n const numeric = Number(coordinate);\n return !Number.isFinite(numeric) || numeric < 0 || numeric > 100;\n })\n ) {\n return DEFAULT_HERO_OBJECT_POSITION;\n }\n\n return `${match[1]}% ${match[2]}%`;\n}\n\nexport function blockHtmlAttributes(\n attributes: Record<string, unknown>,\n baseClass = \"\"\n): { id?: string; class?: string } {\n const anchor = typeof attributes.anchor === \"string\"\n ? attributes.anchor.trim()\n : \"\";\n const customClass = typeof attributes.className === \"string\"\n ? attributes.className.trim()\n : \"\";\n const className = [baseClass.trim(), customClass]\n .filter(Boolean)\n .join(\" \")\n .replace(/\\s+/g, \" \");\n\n return {\n ...(anchor ? { id: anchor } : {}),\n ...(className ? { class: className } : {})\n };\n}\n\nexport const TEXT_HTML_TAGS = [\n \"span\",\n \"p\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"strong\",\n \"em\",\n \"small\",\n \"mark\"\n] as const;\n\nexport type TextHtmlTag = (typeof TEXT_HTML_TAGS)[number];\n\nfunction preferredTypographyVariant(type: string): string | undefined {\n if (type === \"heading\") return \"2\";\n if (type === \"body\" || type === \"label\" || type === \"code\") return \"md\";\n return undefined;\n}\n\n/**\n * Derive a variant only when Gutenberg omitted it. The selected typography\n * type can differ from the block's native type, so a paragraph styled as a\n * heading must not inherit the paragraph-only `md` variant.\n */\nexport function compatibleTypographyVariant(\n type: string,\n preferred: string,\n contract?: StyleflowContract\n): string {\n const variants = contract?.semantic.axes.typography.variantsByType[type];\n if (!variants?.length) return preferred;\n\n return [\n preferredTypographyVariant(type),\n preferred,\n contract?.semantic.agentPolicy.defaults.typography.ty === type\n ? contract.semantic.agentPolicy.defaults.typography.v\n : undefined,\n variants[0]\n ].find((candidate): candidate is string => (\n typeof candidate === \"string\" && variants.includes(candidate)\n )) ?? preferred;\n}\n\nexport function textBlockSemanticDefaults(\n blockName: string,\n attributes: Record<string, unknown>,\n contract?: StyleflowContract\n): Record<string, unknown> {\n const name = blockName.replace(/^sf\\//, \"\");\n const heading = name === \"heading\" || name === \"core/heading\";\n const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));\n const defaultType = heading ? \"heading\" : \"body\";\n const authored = (...values: unknown[]) => values.find((value) => value !== undefined && value !== null && value !== \"\");\n const activeType = String(authored(attributes.ty) ?? defaultType);\n const nativeVariant = heading\n ? String(level)\n : name.includes(\"quote\") ? \"lg\" : \"md\";\n const authoredVariant = authored(attributes.v, attributes.variant);\n\n return {\n ty: defaultType,\n v: authoredVariant === undefined\n ? compatibleTypographyVariant(activeType, nativeVariant, contract)\n : String(authoredVariant),\n w: String(authored(attributes.w, attributes.weight) ?? (heading ? \"strong\" : \"default\")),\n foreground: \"primary\"\n };\n}\n\nexport function textHtmlTag(value: unknown): TextHtmlTag {\n const candidate = String(value ?? \"span\");\n return TEXT_HTML_TAGS.includes(candidate as TextHtmlTag)\n ? candidate as TextHtmlTag\n : \"span\";\n}\n\nexport function semanticProps(\n attributes: Record<string, unknown>,\n contract?: StyleflowContract,\n defaults: Record<string, unknown> = DEFAULT_SEMANTIC_PROPS\n): Record<string, unknown> {\n return resolveFlowpressBlockStyleflowProps(attributes, contract, defaults, {\n strict: process.env.NODE_ENV === \"production\" || process.env.STYLEFLOW_STRICT === \"1\",\n onDiagnostic: (diagnostic) => console.warn(`[${diagnostic.code}] ${diagnostic.message}`)\n });\n}\n\nconst TEXT_ALIGNMENTS = new Set([\n \"left\",\n \"center\",\n \"right\",\n \"justify\",\n \"start\",\n \"end\"\n]);\n\n/** Resolve only Gutenberg's supported text-alignment values to inline CSS. */\nexport function textAlignmentStyle(\n attributes: Record<string, unknown>\n): string | undefined {\n const style = attributes.style && typeof attributes.style === \"object\"\n && !Array.isArray(attributes.style)\n ? attributes.style as Record<string, unknown>\n : {};\n const typography = style.typography && typeof style.typography === \"object\"\n && !Array.isArray(style.typography)\n ? style.typography as Record<string, unknown>\n : {};\n const candidate = typography.textAlign ?? attributes.textAlign;\n const alignment = String(candidate ?? \"\");\n return TEXT_ALIGNMENTS.has(alignment) ? `text-align: ${alignment};` : undefined;\n}\n\nexport function prefixedTextSemanticProps(\n attributes: Record<string, unknown>,\n prefix: string,\n contract?: StyleflowContract,\n defaults: Record<string, unknown> = {}\n): Record<string, unknown> {\n const attributeName = (name: string) =>\n `${prefix}${name.charAt(0).toUpperCase()}${name.slice(1)}`;\n return semanticProps({\n ty: attributes[attributeName(\"ty\")],\n v: attributes[attributeName(\"v\")],\n w: attributes[attributeName(\"w\")],\n foreground: attributes[attributeName(\"foreground\")]\n }, contract, defaults);\n}\n\nexport function objectValue(\n block: FlowpressBlock,\n key: string\n): Record<string, unknown> {\n const value = block.attributes[key];\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? value as Record<string, unknown>\n : {};\n}\n\nexport function textValue(block: FlowpressBlock, key = \"text\"): string {\n return String(block.attributes[key] ?? \"\");\n}\n\n/**\n * Keep intentional blank lines visible across current and legacy RichText\n * serializations. Gutenberg can represent them either as repeated `<br>` tags,\n * empty paragraph elements, or literal newlines in an attribute value.\n */\nexport function preserveRichTextSpacing(html: string): string {\n const visibleEmptyBlocks = html\n .replace(/\\r\\n?/g, \"\\n\")\n .replace(\n /<(p|div)(\\s[^>]*)?>(?:\\s|&nbsp;|&#160;)*<\\/\\1>/gi,\n (_match, tag: string, attributes = \"\") =>\n `<${tag}${attributes}>&nbsp;</${tag}>`\n );\n\n return visibleEmptyBlocks\n .split(/(<[^>]+>)/g)\n .map((part) => {\n if (part.startsWith(\"<\") || part.trim() === \"\") {\n return part;\n }\n return part.replace(/\\n(?:[ \\t]*\\n)+/g, (newlines) =>\n \"<br>\".repeat((newlines.match(/\\n/g) || []).length)\n );\n })\n .join(\"\");\n}\n\n/** Keep an empty text element at its typographic line height without visible text. */\nexport function preserveEmptyTextBlock(html: string): string {\n return html.trim() === \"\" ? \"&nbsp;\" : html;\n}\n\nexport function linkValue(block: FlowpressBlock, key = \"link\"): string {\n return flowpressLinkHref(block.attributes[key]);\n}\n\nexport function responsiveValues(\n attributes: Record<string, unknown>,\n prefix: \"columns\" | \"span\",\n fallback: number\n): Record<\"base\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\", number> {\n const keys = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\n const result = {} as Record<(typeof keys)[number], number>;\n let inherited = fallback;\n for (const key of keys) {\n const suffix = key === \"base\"\n ? \"Base\"\n : key === \"2xl\" ? \"2xl\" : key.charAt(0).toUpperCase() + key.slice(1);\n const candidate = Number(attributes[`${prefix}${suffix}`]);\n if (Number.isInteger(candidate) && candidate >= 1 && candidate <= 12) {\n inherited = candidate;\n }\n result[key] = inherited;\n }\n return result;\n}\n\nexport function unwrapCoreHtml(html: string): string {\n const match = html.trim().match(\n /^<(p|h[1-6]|ul|ol|li|blockquote)(?:\\s[^>]*)?>([\\s\\S]*)<\\/\\1>$/\n );\n return match?.[2] ?? html;\n}\n"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/astro/blocks/helpers.ts"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U,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,IAAI,SAAS,IAAI,EAAE,EAAE,CAAC;YACrE,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAC7B,+DAA+D,CAChE,CAAC;IACF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC","sourcesContent":["import { nativeFlexItemProps } from \"../native/group.js\";\nimport {\n resolveFlowpressBlockStyleflowProps,\n type StyleflowContract\n} from \"../../styleflow.js\";\nimport type { FlowpressBlock } from \"../../types.js\";\nimport { flowpressLinkHref } from \"../../links.js\";\n\nexport const DEFAULT_SEMANTIC_PROPS = {\n surface: \"default\",\n layoutRole: \"stack\",\n density: \"regular\"\n};\n\nexport const DEFAULT_HERO_OBJECT_POSITION = \"50% 50%\";\n\nexport function heroObjectPosition(value: unknown): string {\n if (typeof value !== \"string\") {\n return DEFAULT_HERO_OBJECT_POSITION;\n }\n\n const match = value.trim().match(\n /^(\\d+(?:\\.\\d+)?|\\.\\d+)%\\s+(\\d+(?:\\.\\d+)?|\\.\\d+)%$/\n );\n if (\n !match\n || [match[1], match[2]].some((coordinate) => {\n const numeric = Number(coordinate);\n return !Number.isFinite(numeric) || numeric < 0 || numeric > 100;\n })\n ) {\n return DEFAULT_HERO_OBJECT_POSITION;\n }\n\n return `${match[1]}% ${match[2]}%`;\n}\n\nexport function blockHtmlAttributes(\n attributes: Record<string, unknown>,\n baseClass = \"\"\n): { id?: string; class?: string; style?: string; [key: string]: unknown } {\n const anchor = typeof attributes.anchor === \"string\"\n ? attributes.anchor.trim()\n : \"\";\n const customClass = typeof attributes.className === \"string\"\n ? attributes.className.trim()\n : \"\";\n const className = [baseClass.trim(), customClass]\n .filter(Boolean)\n .join(\" \")\n .replace(/\\s+/g, \" \");\n\n return nativeFlexItemProps(attributes, {\n ...(anchor ? { id: anchor } : {}),\n ...(className ? { class: className } : {})\n });\n}\n\nexport const TEXT_HTML_TAGS = [\n \"span\",\n \"p\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"strong\",\n \"em\",\n \"small\",\n \"mark\"\n] as const;\n\nexport type TextHtmlTag = (typeof TEXT_HTML_TAGS)[number];\n\nfunction preferredTypographyVariant(type: string): string | undefined {\n if (type === \"heading\") return \"2\";\n if (type === \"body\" || type === \"label\" || type === \"code\") return \"md\";\n return undefined;\n}\n\n/**\n * Derive a variant only when Gutenberg omitted it. The selected typography\n * type can differ from the block's native type, so a paragraph styled as a\n * heading must not inherit the paragraph-only `md` variant.\n */\nexport function compatibleTypographyVariant(\n type: string,\n preferred: string,\n contract?: StyleflowContract\n): string {\n const variants = contract?.semantic.axes.typography.variantsByType[type];\n if (!variants?.length) return preferred;\n\n return [\n preferredTypographyVariant(type),\n preferred,\n contract?.semantic.agentPolicy.defaults.typography.ty === type\n ? contract.semantic.agentPolicy.defaults.typography.v\n : undefined,\n variants[0]\n ].find((candidate): candidate is string => (\n typeof candidate === \"string\" && variants.includes(candidate)\n )) ?? preferred;\n}\n\nexport function textBlockSemanticDefaults(\n blockName: string,\n attributes: Record<string, unknown>,\n contract?: StyleflowContract\n): Record<string, unknown> {\n const name = blockName.replace(/^sf\\//, \"\");\n const heading = name === \"heading\" || name === \"core/heading\";\n const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));\n const defaultType = heading ? \"heading\" : \"body\";\n const authored = (...values: unknown[]) => values.find((value) => value !== undefined && value !== null && value !== \"\");\n const activeType = String(authored(attributes.ty) ?? defaultType);\n const nativeVariant = heading\n ? String(level)\n : name.includes(\"quote\") ? \"lg\" : \"md\";\n const authoredVariant = authored(attributes.v, attributes.variant);\n\n return {\n ty: defaultType,\n v: authoredVariant === undefined\n ? compatibleTypographyVariant(activeType, nativeVariant, contract)\n : String(authoredVariant),\n w: String(authored(attributes.w, attributes.weight) ?? (heading ? \"strong\" : \"default\")),\n foreground: \"primary\"\n };\n}\n\nexport function textHtmlTag(value: unknown): TextHtmlTag {\n const candidate = String(value ?? \"span\");\n return TEXT_HTML_TAGS.includes(candidate as TextHtmlTag)\n ? candidate as TextHtmlTag\n : \"span\";\n}\n\nexport function semanticProps(\n attributes: Record<string, unknown>,\n contract?: StyleflowContract,\n defaults: Record<string, unknown> = DEFAULT_SEMANTIC_PROPS,\n effectiveTone?: string\n): Record<string, unknown> {\n return resolveFlowpressBlockStyleflowProps(attributes, contract, defaults, {\n effectiveTone,\n strict: process.env.NODE_ENV === \"production\" || process.env.STYLEFLOW_STRICT === \"1\",\n onDiagnostic: (diagnostic) => console.warn(`[${diagnostic.code}] ${diagnostic.message}`)\n });\n}\n\nconst TEXT_ALIGNMENTS = new Set([\n \"left\",\n \"center\",\n \"right\",\n \"justify\",\n \"start\",\n \"end\"\n]);\n\n/** Resolve only Gutenberg's supported text-alignment values to inline CSS. */\nexport function textAlignmentStyle(\n attributes: Record<string, unknown>\n): string | undefined {\n const style = attributes.style && typeof attributes.style === \"object\"\n && !Array.isArray(attributes.style)\n ? attributes.style as Record<string, unknown>\n : {};\n const typography = style.typography && typeof style.typography === \"object\"\n && !Array.isArray(style.typography)\n ? style.typography as Record<string, unknown>\n : {};\n const candidate = typography.textAlign ?? attributes.textAlign;\n const alignment = String(candidate ?? \"\");\n return TEXT_ALIGNMENTS.has(alignment) ? `text-align: ${alignment};` : undefined;\n}\n\nexport function prefixedTextSemanticProps(\n attributes: Record<string, unknown>,\n prefix: string,\n contract?: StyleflowContract,\n defaults: Record<string, unknown> = {}\n): Record<string, unknown> {\n const attributeName = (name: string) =>\n `${prefix}${name.charAt(0).toUpperCase()}${name.slice(1)}`;\n return semanticProps({\n ty: attributes[attributeName(\"ty\")],\n v: attributes[attributeName(\"v\")],\n w: attributes[attributeName(\"w\")],\n foreground: attributes[attributeName(\"foreground\")]\n }, contract, defaults);\n}\n\nexport function objectValue(\n block: FlowpressBlock,\n key: string\n): Record<string, unknown> {\n const value = block.attributes[key];\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? value as Record<string, unknown>\n : {};\n}\n\nexport function textValue(block: FlowpressBlock, key = \"text\"): string {\n return String(block.attributes[key] ?? \"\");\n}\n\n/**\n * Keep intentional blank lines visible across current and legacy RichText\n * serializations. Gutenberg can represent them either as repeated `<br>` tags,\n * empty paragraph elements, or literal newlines in an attribute value.\n */\nexport function preserveRichTextSpacing(html: string): string {\n const visibleEmptyBlocks = html\n .replace(/\\r\\n?/g, \"\\n\")\n .replace(\n /<(p|div)(\\s[^>]*)?>(?:\\s|&nbsp;|&#160;)*<\\/\\1>/gi,\n (_match, tag: string, attributes = \"\") =>\n `<${tag}${attributes}>&nbsp;</${tag}>`\n );\n\n return visibleEmptyBlocks\n .split(/(<[^>]+>)/g)\n .map((part) => {\n if (part.startsWith(\"<\") || part.trim() === \"\") {\n return part;\n }\n return part.replace(/\\n(?:[ \\t]*\\n)+/g, (newlines) =>\n \"<br>\".repeat((newlines.match(/\\n/g) || []).length)\n );\n })\n .join(\"\");\n}\n\n/** Keep an empty text element at its typographic line height without visible text. */\nexport function preserveEmptyTextBlock(html: string): string {\n return html.trim() === \"\" ? \"&nbsp;\" : html;\n}\n\nexport function linkValue(block: FlowpressBlock, key = \"link\"): string {\n return flowpressLinkHref(block.attributes[key]);\n}\n\nexport function responsiveValues(\n attributes: Record<string, unknown>,\n prefix: \"columns\" | \"span\",\n fallback: number\n): Record<\"base\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\", number> {\n const keys = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\n const result = {} as Record<(typeof keys)[number], number>;\n let inherited = fallback;\n for (const key of keys) {\n const suffix = key === \"base\"\n ? \"Base\"\n : key === \"2xl\" ? \"2xl\" : key.charAt(0).toUpperCase() + key.slice(1);\n const candidate = Number(attributes[`${prefix}${suffix}`]);\n if (Number.isInteger(candidate) && candidate >= 1 && candidate <= 12) {\n inherited = candidate;\n }\n result[key] = inherited;\n }\n return result;\n}\n\nexport function unwrapCoreHtml(html: string): string {\n const match = html.trim().match(\n /^<(p|h[1-6]|ul|ol|li|blockquote)(?:\\s[^>]*)?>([\\s\\S]*)<\\/\\1>$/\n );\n return match?.[2] ?? html;\n}\n"]}