@styleflow.app/flowpress-astro-core 1.0.0-beta.26 → 1.0.0-beta.27

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 (66) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/astro/BaseLayout.astro +3 -3
  3. package/dist/astro/DefaultTemplate.astro +6 -6
  4. package/dist/astro/GutenbergRenderer.astro +33 -33
  5. package/dist/astro/StyleflowElement.astro +19 -0
  6. package/dist/astro/blocks/CarouselBlock.astro +5 -5
  7. package/dist/astro/blocks/CarouselItemBlock.astro +3 -3
  8. package/dist/astro/blocks/ColumnBlock.astro +3 -3
  9. package/dist/astro/blocks/CoverBlock.astro +6 -6
  10. package/dist/astro/blocks/FormBlock.astro +6 -6
  11. package/dist/astro/blocks/GridBlock.astro +3 -3
  12. package/dist/astro/blocks/HeroBlock.astro +3 -3
  13. package/dist/astro/blocks/ImageBlock.astro +3 -3
  14. package/dist/astro/blocks/ListItemFallback.astro +5 -5
  15. package/dist/astro/blocks/NumberSpinnerBlock.astro +3 -3
  16. package/dist/astro/blocks/SemanticElement.astro +19 -19
  17. package/dist/astro/blocks/SiteLogoBlock.astro +3 -3
  18. package/dist/astro/blocks/TextBlock.astro +8 -8
  19. package/dist/astro/blocks/ThemeToggleBlock.astro +4 -4
  20. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  21. package/dist/astro/blocks/helpers.js +4 -3
  22. package/dist/astro/blocks/helpers.js.map +1 -1
  23. package/dist/astro/blocks/helpers.ts +4 -3
  24. package/dist/astro/native/Blob.astro +6 -6
  25. package/dist/astro/native/CustomFieldValue.astro +21 -21
  26. package/dist/astro/native/LevelTag.astro +10 -10
  27. package/dist/astro/native/MapBlock.astro +5 -5
  28. package/dist/astro/native/NativeHtmlBlock.astro +2 -2
  29. package/dist/astro/native/NativeIconBlock.astro +2 -2
  30. package/dist/astro/native/ResolvedBlocks.astro +6 -6
  31. package/dist/astro/native/SyncedPatternContent.astro +6 -6
  32. package/dist/astro/native/TermFieldValue.astro +4 -4
  33. package/dist/astro/native/Timeline.astro +12 -12
  34. package/dist/astro/native/core-block.astro +2 -2
  35. package/dist/astro/native/core-button.astro +8 -8
  36. package/dist/astro/native/core-buttons.astro +2 -2
  37. package/dist/astro/native/core-group.astro +9 -9
  38. package/dist/astro/native/core-home-link.astro +2 -2
  39. package/dist/astro/native/core-image.astro +9 -9
  40. package/dist/astro/native/core-navigation-link.astro +8 -8
  41. package/dist/astro/native/core-navigation-submenu.astro +11 -11
  42. package/dist/astro/native/core-navigation.astro +17 -17
  43. package/dist/astro/native/core-page-list-data-item.astro +6 -6
  44. package/dist/astro/native/core-page-list-item.astro +2 -2
  45. package/dist/astro/native/core-page-list.astro +3 -3
  46. package/dist/astro/native/core-post-date.astro +5 -5
  47. package/dist/astro/native/core-post-excerpt.astro +7 -7
  48. package/dist/astro/native/core-post-featured-image.astro +5 -5
  49. package/dist/astro/native/core-post-template.astro +5 -5
  50. package/dist/astro/native/core-post-terms.astro +8 -8
  51. package/dist/astro/native/core-post-title.astro +2 -2
  52. package/dist/astro/native/core-query-no-results.astro +2 -2
  53. package/dist/astro/native/core-query.astro +6 -6
  54. package/dist/astro/native/core-site-title.astro +8 -8
  55. package/dist/astro/native/core-term-description.astro +2 -2
  56. package/dist/astro/native/core-term-name.astro +2 -2
  57. package/dist/astro/native/core-term-template.astro +5 -5
  58. package/dist/astro/native/core-terms-query.astro +5 -5
  59. package/dist/astro/native/core-transparent.astro +2 -2
  60. package/dist/astro/native/sf-block-binding.astro +3 -3
  61. package/dist/astro/preferences/AccessibilityPanel.astro +17 -17
  62. package/dist/astro/preferences/Toggle.astro +7 -7
  63. package/dist/styleflow.d.ts.map +1 -1
  64. package/dist/styleflow.js +11 -2
  65. package/dist/styleflow.js.map +1 -1
  66. package/package.json +2 -2
@@ -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 {
@@ -28,7 +28,7 @@ const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));
28
28
  const headingTag = `h${level}` as "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
29
29
  const defaults = textBlockSemanticDefaults(name, attributes, contract);
30
30
  const semantic = semanticProps(attributes, contract, defaults);
31
- const htmlAttributes = blockHtmlAttributes(attributes);
31
+ const htmlAttributes = blockHtmlAttributes(attributes, name === "core/list" ? "wp-block-list" : "");
32
32
  const alignmentStyle = textAlignmentStyle(attributes);
33
33
  const coreHtml = String(
34
34
  attributes.content
@@ -64,24 +64,24 @@ const listTag = Boolean(attributes.ordered) ? "ol" : "ul";
64
64
  {hasChildren ? <slot /> : null}
65
65
  </SemanticElement>
66
66
  ) : name === "core/list-item" ? (
67
- <S.li {...semantic} {...htmlAttributes} style={alignmentStyle}>
67
+ <StyleflowElement as="li" {...semantic} {...htmlAttributes} style={alignmentStyle}>
68
68
  <span set:html={html}></span>
69
69
  {hasChildren ? <slot /> : null}
70
- </S.li>
70
+ </StyleflowElement>
71
71
  ) : name === "quote" || name === "core/quote" ? (
72
- <S.blockquote {...semantic} {...htmlAttributes} style={alignmentStyle}>
72
+ <StyleflowElement as="blockquote" {...semantic} {...htmlAttributes} style={alignmentStyle}>
73
73
  {hasChildren ? <slot /> : <div set:html={html}></div>}
74
74
  {attributes.citation ? <cite>{String(attributes.citation)}</cite> : null}
75
- </S.blockquote>
75
+ </StyleflowElement>
76
76
  ) : name === "core/paragraph" ? (
77
- <S.p
77
+ <StyleflowElement as="p"
78
78
  {...semantic}
79
79
  {...htmlAttributes}
80
80
  style={alignmentStyle}
81
81
  set:html={html}
82
82
  />
83
83
  ) : (
84
- <S.div
84
+ <StyleflowElement as="div"
85
85
  {...semantic}
86
86
  {...htmlAttributes}
87
87
  style={alignmentStyle}
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import ThemeToggle from "../preferences/ThemeToggle.astro";
4
4
  import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
5
5
  const { block, styleflowProps, htmlProps } = Astro.props as FlowpressBlockRendererProps;
@@ -7,7 +7,7 @@ const label = typeof block.attributes.label === "string" && block.attributes.lab
7
7
  ? block.attributes.label.trim() : "Change color theme";
8
8
  const showThemeName = block.attributes.showThemeName !== false;
9
9
  ---
10
- <S.span {...styleflowProps} class="flowpress-theme-control">
10
+ <StyleflowElement as="span" {...styleflowProps} class="flowpress-theme-control">
11
11
  <ThemeToggle {...htmlProps} label={label} />
12
- {showThemeName && <S.span data-styleflow-theme-label aria-hidden="true" />}
13
- </S.span>
12
+ {showThemeName && <StyleflowElement as="span" data-styleflow-theme-label aria-hidden="true" />}
13
+ </StyleflowElement>
@@ -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;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AE,cAAc,EAAE,GAAG,SAAS,GAAG,MAAM,CAErE;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EAAE,SAAS,GAAG,MAAM,EAC1B,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,EAAE,MAAM,CAAC,CAe5D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -80,17 +80,18 @@ export function textBlockSemanticDefaults(blockName, attributes, contract) {
80
80
  const heading = name === "heading" || name === "core/heading";
81
81
  const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));
82
82
  const defaultType = heading ? "heading" : "body";
83
- const activeType = String(attributes.ty ?? defaultType);
83
+ const authored = (...values) => values.find((value) => value !== undefined && value !== null && value !== "");
84
+ const activeType = String(authored(attributes.ty) ?? defaultType);
84
85
  const nativeVariant = heading
85
86
  ? String(level)
86
87
  : name.includes("quote") ? "lg" : "md";
87
- const authoredVariant = attributes.v ?? attributes.variant;
88
+ const authoredVariant = authored(attributes.v, attributes.variant);
88
89
  return {
89
90
  ty: defaultType,
90
91
  v: authoredVariant === undefined
91
92
  ? compatibleTypographyVariant(activeType, nativeVariant, contract)
92
93
  : String(authoredVariant),
93
- w: String(attributes.w ?? attributes.weight ?? (heading ? "strong" : "default")),
94
+ w: String(authored(attributes.w, attributes.weight) ?? (heading ? "strong" : "default")),
94
95
  foreground: "primary"
95
96
  };
96
97
  }
@@ -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,GA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ressBlockStyleflowProps,\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 activeType = String(attributes.ty ?? defaultType);\n const nativeVariant = heading\n ? String(level)\n : name.includes(\"quote\") ? \"lg\" : \"md\";\n const authoredVariant = 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(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"],"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,OA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AC,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 {\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"]}
@@ -112,18 +112,19 @@ export function textBlockSemanticDefaults(
112
112
  const heading = name === "heading" || name === "core/heading";
113
113
  const level = Math.min(6, Math.max(1, Number(attributes.level ?? 2)));
114
114
  const defaultType = heading ? "heading" : "body";
115
- const activeType = String(attributes.ty ?? defaultType);
115
+ const authored = (...values: unknown[]) => values.find((value) => value !== undefined && value !== null && value !== "");
116
+ const activeType = String(authored(attributes.ty) ?? defaultType);
116
117
  const nativeVariant = heading
117
118
  ? String(level)
118
119
  : name.includes("quote") ? "lg" : "md";
119
- const authoredVariant = attributes.v ?? attributes.variant;
120
+ const authoredVariant = authored(attributes.v, attributes.variant);
120
121
 
121
122
  return {
122
123
  ty: defaultType,
123
124
  v: authoredVariant === undefined
124
125
  ? compatibleTypographyVariant(activeType, nativeVariant, contract)
125
126
  : String(authoredVariant),
126
- w: String(attributes.w ?? attributes.weight ?? (heading ? "strong" : "default")),
127
+ w: String(authored(attributes.w, attributes.weight) ?? (heading ? "strong" : "default")),
127
128
  foreground: "primary"
128
129
  };
129
130
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import "./blob.css";
3
- import S from "@styleflow.app/astro/S.astro";
3
+ import StyleflowElement from "../StyleflowElement.astro";
4
4
  import { BLOB_BOX, BLOB_VARIANTS } from "./blob/blob-shapes.generated.js";
5
5
  import {
6
6
  morphDataAttributes,
@@ -79,7 +79,7 @@ const rootClass = ["sf-blob", typeof rootClassName === "string" ? rootClassName
79
79
  const clipStyle = `clip-path:url(#${clipId})`;
80
80
  ---
81
81
 
82
- <S.div
82
+ <StyleflowElement as="div"
83
83
  {...rootAttributes}
84
84
  class={rootClass}
85
85
  layoutRole="none"
@@ -94,15 +94,15 @@ const clipStyle = `clip-path:url(#${clipId})`;
94
94
  </clipPath>
95
95
  </svg>
96
96
  <!-- styleflow-ignore-next-line rule=sf-inline-style reason="Per-instance reference to the blob's SVG clip path" scope="project" -->
97
- <S.div class="sf-blob__shape" {...shapeProps} data-blob-shape style={clipStyle}><slot /></S.div>
97
+ <StyleflowElement as="div" class="sf-blob__shape" {...shapeProps} data-blob-shape style={clipStyle}><slot /></StyleflowElement>
98
98
  {strokeWidth > 0 ? (
99
- <S.span class="sf-blob__ring" {...(outlineTone !== "inherit" ? {tone:outlineTone} : {})} {...(outlineIntensity !== "inherit" ? {intensity:outlineIntensity} : {})} aria-hidden="true">
99
+ <StyleflowElement as="span" class="sf-blob__ring" {...(outlineTone !== "inherit" ? {tone:outlineTone} : {})} {...(outlineIntensity !== "inherit" ? {intensity:outlineIntensity} : {})} aria-hidden="true">
100
100
  <svg viewBox="0 0 1 1" preserveAspectRatio="none" focusable="false">
101
101
  <path data-blob-ring-path d={ringPath} fill="none" stroke-width={strokeWidth} vector-effect="non-scaling-stroke"></path>
102
102
  </svg>
103
- </S.span>
103
+ </StyleflowElement>
104
104
  ) : null}
105
- </S.div>
105
+ </StyleflowElement>
106
106
 
107
107
  <script>
108
108
  // The static shape is complete without JavaScript: load the controller only
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
  import LevelTag from "./LevelTag.astro";
5
5
  import { classNames, text, type ResolvedImage } from "./query-loop.js";
@@ -46,41 +46,41 @@ const list = as === "list" && Array.isArray(resolved.value) ? resolved.value.map
46
46
  {as === "" ? null
47
47
  : as === "image" ? (
48
48
  imageProps.src ? (
49
- <S.figure {...rootProps} {...styleflowProps} data-aspect-ratio={aspectRatio || undefined}>
50
- {resolved.href ? <S.a href={resolved.href}><S.img {...imageProps} /></S.a> : <S.img {...imageProps} />}
51
- </S.figure>
49
+ <StyleflowElement as="figure" {...rootProps} {...styleflowProps} data-aspect-ratio={aspectRatio || undefined}>
50
+ {resolved.href ? <StyleflowElement as="a" href={resolved.href}><StyleflowElement as="img" {...imageProps} /></StyleflowElement> : <StyleflowElement as="img" {...imageProps} />}
51
+ </StyleflowElement>
52
52
  ) : null
53
53
  )
54
54
  : as === "richtext" ? (
55
- <S.div {...rootProps} {...styleflowProps}>
56
- {prefix ? <S.span class="project-field__prefix">{prefix}</S.span> : null}
55
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}>
56
+ {prefix ? <StyleflowElement as="span" class="project-field__prefix">{prefix}</StyleflowElement> : null}
57
57
  <Fragment set:html={text(resolved.value)} />
58
- {suffix ? <S.span class="project-field__suffix">{suffix}</S.span> : null}
59
- </S.div>
58
+ {suffix ? <StyleflowElement as="span" class="project-field__suffix">{suffix}</StyleflowElement> : null}
59
+ </StyleflowElement>
60
60
  )
61
61
  : as === "link" ? (
62
- <S.p {...rootProps} {...styleflowProps}>
63
- {prefix ? <S.span class="project-field__prefix">{prefix}</S.span> : null}
64
- <S.a
62
+ <StyleflowElement as="p" {...rootProps} {...styleflowProps}>
63
+ {prefix ? <StyleflowElement as="span" class="project-field__prefix">{prefix}</StyleflowElement> : null}
64
+ <StyleflowElement as="a"
65
65
  href={link.url}
66
66
  class={options.variant === "button" ? "wp-element-button" : undefined}
67
67
  target={link.target === "_blank" ? "_blank" : undefined}
68
68
  rel={link.target === "_blank" ? "noopener noreferrer" : undefined}
69
- >{link.label || link.url}</S.a>
70
- {suffix ? <S.span class="project-field__suffix">{suffix}</S.span> : null}
71
- </S.p>
69
+ >{link.label || link.url}</StyleflowElement>
70
+ {suffix ? <StyleflowElement as="span" class="project-field__suffix">{suffix}</StyleflowElement> : null}
71
+ </StyleflowElement>
72
72
  )
73
73
  : as === "list" ? (
74
- <S.div {...rootProps} {...styleflowProps}>
75
- {prefix ? <S.span class="project-field__prefix">{prefix}</S.span> : null}
74
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}>
75
+ {prefix ? <StyleflowElement as="span" class="project-field__prefix">{prefix}</StyleflowElement> : null}
76
76
  {options.ordered
77
- ? <S.ol class="wp-block-list">{list.map((item) => <S.li>{item}</S.li>)}</S.ol>
78
- : <S.ul class="wp-block-list">{list.map((item) => <S.li>{item}</S.li>)}</S.ul>}
79
- {suffix ? <S.span class="project-field__suffix">{suffix}</S.span> : null}
80
- </S.div>
77
+ ? <StyleflowElement as="ol" class="wp-block-list">{list.map((item) => <StyleflowElement as="li">{item}</StyleflowElement>)}</StyleflowElement>
78
+ : <StyleflowElement as="ul" class="wp-block-list">{list.map((item) => <StyleflowElement as="li">{item}</StyleflowElement>)}</StyleflowElement>}
79
+ {suffix ? <StyleflowElement as="span" class="project-field__suffix">{suffix}</StyleflowElement> : null}
80
+ </StyleflowElement>
81
81
  )
82
82
  : (
83
83
  <LevelTag tag={textTag} {...rootProps} {...styleflowProps}>
84
- {prefix}{as === "date" ? <S.time datetime={date.datetime}>{date.formatted}</S.time> : text(resolved.value)}{suffix}
84
+ {prefix}{as === "date" ? <StyleflowElement as="time" datetime={date.datetime}>{date.formatted}</StyleflowElement> : text(resolved.value)}{suffix}
85
85
  </LevelTag>
86
86
  )}
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
 
4
4
  // Heading (h1–h6), paragraph (0 / "p") or inline span, with Styleflow props.
5
5
  interface Props {
@@ -9,12 +9,12 @@ interface Props {
9
9
  const { tag, ...rest } = Astro.props;
10
10
  ---
11
11
 
12
- {tag === "h1" ? <S.h1 {...rest}><slot /></S.h1>
13
- : tag === "h2" ? <S.h2 {...rest}><slot /></S.h2>
14
- : tag === "h3" ? <S.h3 {...rest}><slot /></S.h3>
15
- : tag === "h4" ? <S.h4 {...rest}><slot /></S.h4>
16
- : tag === "h5" ? <S.h5 {...rest}><slot /></S.h5>
17
- : tag === "h6" ? <S.h6 {...rest}><slot /></S.h6>
18
- : tag === "span" ? <S.span {...rest}><slot /></S.span>
19
- : tag === "div" ? <S.div {...rest}><slot /></S.div>
20
- : <S.p {...rest}><slot /></S.p>}
12
+ {tag === "h1" ? <StyleflowElement as="h1" {...rest}><slot /></StyleflowElement>
13
+ : tag === "h2" ? <StyleflowElement as="h2" {...rest}><slot /></StyleflowElement>
14
+ : tag === "h3" ? <StyleflowElement as="h3" {...rest}><slot /></StyleflowElement>
15
+ : tag === "h4" ? <StyleflowElement as="h4" {...rest}><slot /></StyleflowElement>
16
+ : tag === "h5" ? <StyleflowElement as="h5" {...rest}><slot /></StyleflowElement>
17
+ : tag === "h6" ? <StyleflowElement as="h6" {...rest}><slot /></StyleflowElement>
18
+ : tag === "span" ? <StyleflowElement as="span" {...rest}><slot /></StyleflowElement>
19
+ : tag === "div" ? <StyleflowElement as="div" {...rest}><slot /></StyleflowElement>
20
+ : <StyleflowElement as="p" {...rest}><slot /></StyleflowElement>}
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import {
4
4
  flowpressBlockHtmlProps,
5
5
  resolveFlowpressBlockStyleflowProps,
@@ -16,9 +16,9 @@ const label = map.address || `Mappa: ${map.query}`;
16
16
  ---
17
17
 
18
18
  {map.query ? (
19
- <S.div {...semantic} {...html}>
19
+ <StyleflowElement as="div" {...semantic} {...html}>
20
20
  {map.iframeSrc ? (
21
- <S.iframe
21
+ <StyleflowElement as="iframe"
22
22
  class="sf-map-frame"
23
23
  title={label}
24
24
  src={map.iframeSrc}
@@ -27,8 +27,8 @@ const label = map.address || `Mappa: ${map.query}`;
27
27
  allowfullscreen
28
28
  />
29
29
  ) : null}
30
- <S.a href={map.linkHref} target="_blank" rel="noopener noreferrer" layoutRole="control" density="compact" interactivePriority="tertiary">Apri la mappa</S.a>
31
- </S.div>
30
+ <StyleflowElement as="a" href={map.linkHref} target="_blank" rel="noopener noreferrer" layoutRole="control" density="compact" interactivePriority="tertiary">Apri la mappa</StyleflowElement>
31
+ </StyleflowElement>
32
32
  ) : null}
33
33
 
34
34
  <style>
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
  import { nativeHtmlData } from "./html.js";
5
5
 
@@ -8,5 +8,5 @@ const { html, hidden } = nativeHtmlData(block.resolvedData, block.innerHtml);
8
8
  ---
9
9
 
10
10
  {!hidden && html ? (
11
- <S.div {...htmlProps} {...styleflowProps} data-project-native-html set:html={html} />
11
+ <StyleflowElement as="div" {...htmlProps} {...styleflowProps} data-project-native-html set:html={html} />
12
12
  ) : null}
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
  import { nativeIconSvg, nativeIconWidth } from "./icon.js";
5
5
 
@@ -21,7 +21,7 @@ const rootProps = {
21
21
  ---
22
22
 
23
23
  <!-- styleflow-ignore-start rule=SF_INLINE_STYLE reason="Validated structural icon width from the native Gutenberg control" scope="Native icon pilot" -->
24
- {svg ? <S.div
24
+ {svg ? <StyleflowElement as="div"
25
25
  {...rootProps}
26
26
  {...semantic}
27
27
  data-icon={block.attributes.icon}
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import CompositionRenderer from "../CompositionRenderer.astro";
4
4
  import GutenbergRenderer from "../GutenbergRenderer.astro";
5
5
  import type {
@@ -59,11 +59,11 @@ const nestedComposition: FlowpressCompositionV1 | undefined = composition && ada
59
59
  <style data-flowpress-composition-style={stylesheet.id} set:html={stylesheet.css} />
60
60
  ))}
61
61
  {blocking.length > 0 ? (
62
- <S.aside data-flowpress-composition-diagnostics role="status">
63
- <S.ul>
64
- {blocking.map(({ code, message }) => <S.li data-diagnostic-code={code}>{message}</S.li>)}
65
- </S.ul>
66
- </S.aside>
62
+ <StyleflowElement as="aside" data-flowpress-composition-diagnostics role="status">
63
+ <StyleflowElement as="ul">
64
+ {blocking.map(({ code, message }) => <StyleflowElement as="li" data-diagnostic-code={code}>{message}</StyleflowElement>)}
65
+ </StyleflowElement>
66
+ </StyleflowElement>
67
67
  ) : null}
68
68
  {blocks.length > 0 ? (
69
69
  nestedComposition ? (
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import CompositionRenderer from "../CompositionRenderer.astro";
4
4
  import GutenbergRenderer from "../GutenbergRenderer.astro";
5
5
  import type {
@@ -61,11 +61,11 @@ const patternComposition: FlowpressCompositionV1 | undefined = composition && ad
61
61
  <style data-flowpress-composition-style={stylesheet.id} set:html={stylesheet.css} />
62
62
  ))}
63
63
  {blocking.length > 0 ? (
64
- <S.aside data-flowpress-composition-diagnostics role="status">
65
- <S.ul>
66
- {blocking.map(({ code, message }) => <S.li data-diagnostic-code={code}>{message}</S.li>)}
67
- </S.ul>
68
- </S.aside>
64
+ <StyleflowElement as="aside" data-flowpress-composition-diagnostics role="status">
65
+ <StyleflowElement as="ul">
66
+ {blocking.map(({ code, message }) => <StyleflowElement as="li" data-diagnostic-code={code}>{message}</StyleflowElement>)}
67
+ </StyleflowElement>
68
+ </StyleflowElement>
69
69
  ) : null}
70
70
  {patternBlocks.length > 0 ? (
71
71
  patternComposition ? (
@@ -1,5 +1,5 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import { classNames, text, type ResolvedImage } from "./query-loop.js";
4
4
 
5
5
  // Value of a term custom field inside the link of a Post Terms item
@@ -29,9 +29,9 @@ const imageProps = {
29
29
  ---
30
30
 
31
31
  {as === "image" ? (
32
- imageProps.src ? <S.img {...imageProps} /> : null
32
+ imageProps.src ? <StyleflowElement as="img" {...imageProps} /> : null
33
33
  ) : as === "date" ? (
34
- <S.time class="wp-block-post-terms__field" datetime={date.datetime}>{date.formatted}</S.time>
34
+ <StyleflowElement as="time" class="wp-block-post-terms__field" datetime={date.datetime}>{date.formatted}</StyleflowElement>
35
35
  ) : (
36
- <S.span class="wp-block-post-terms__field">{text(field.value)}</S.span>
36
+ <StyleflowElement as="span" class="wp-block-post-terms__field">{text(field.value)}</StyleflowElement>
37
37
  )}
@@ -1,20 +1,20 @@
1
1
  ---
2
- import S from "@styleflow.app/astro/S.astro";
2
+ import StyleflowElement from "../StyleflowElement.astro";
3
3
  import type { TimelineItem } from "./timeline.js";
4
4
  import "./timeline.css";
5
5
  interface Props { items:TimelineItem[]; tone?:string | undefined; intensity?:string | undefined; id?:string | undefined; class?:string | undefined; ariaLabel?:string | undefined; rootProps?:Record<string,unknown> | undefined; styleflowProps?:Record<string,unknown> | undefined; }
6
6
  const {items,tone="inherit",intensity="inherit",id,class:className="",ariaLabel="Timeline",rootProps={},styleflowProps={}}=Astro.props;
7
7
  ---
8
- <S.section {...rootProps} {...styleflowProps} id={id ?? (typeof rootProps.id === "string" ? rootProps.id : undefined)} {...(tone !== "inherit" ? {tone} : {})} {...(intensity !== "inherit" ? {intensity} : {})} layoutRole="stack" density="regular" aria-label={ariaLabel} class:list={["flowpress-timeline",rootProps.class,className]} data-flowpress-timeline>
9
- <S.ol layoutRole="stack" density="regular" class="flowpress-timeline__list">
8
+ <StyleflowElement as="section" {...rootProps} {...styleflowProps} id={id ?? (typeof rootProps.id === "string" ? rootProps.id : undefined)} {...(tone !== "inherit" ? {tone} : {})} {...(intensity !== "inherit" ? {intensity} : {})} layoutRole="stack" density="regular" aria-label={ariaLabel} class:list={["flowpress-timeline",rootProps.class,className]} data-flowpress-timeline>
9
+ <StyleflowElement as="ol" layoutRole="stack" density="regular" class="flowpress-timeline__list">
10
10
  {items.map(item=>(
11
- <S.li {...(item.tone && item.tone !== "inherit" ? {tone:item.tone} : {})} {...(item.intensity && item.intensity !== "inherit" ? {intensity:item.intensity} : {})} layoutRole="stack" density="regular" surface="default" class="flowpress-timeline__item" data-flowpress-timeline-item>
12
- {item.year && <S.h3>{item.year}</S.h3>}
13
- {item.image && <S.img src={item.image.url ?? item.image.sourceUrl} alt={item.image.alt ?? item.image.altText ?? ""} width={item.image.width} height={item.image.height} loading="lazy" />}
14
- {item.description && <S.p>{item.description}</S.p>}
15
- {item.metric && <S.p>{item.metric}</S.p>}
16
- {(item.statisticValue || item.statisticLabel) && <S.p><S.strong>{item.statisticValue}</S.strong> {item.statisticLabel}</S.p>}
17
- </S.li>
11
+ <StyleflowElement as="li" {...(item.tone && item.tone !== "inherit" ? {tone:item.tone} : {})} {...(item.intensity && item.intensity !== "inherit" ? {intensity:item.intensity} : {})} layoutRole="stack" density="regular" surface="default" class="flowpress-timeline__item" data-flowpress-timeline-item>
12
+ {item.year && <StyleflowElement as="h3">{item.year}</StyleflowElement>}
13
+ {item.image && <StyleflowElement as="img" src={item.image.url ?? item.image.sourceUrl} alt={item.image.alt ?? item.image.altText ?? ""} width={item.image.width} height={item.image.height} loading="lazy" />}
14
+ {item.description && <StyleflowElement as="p">{item.description}</StyleflowElement>}
15
+ {item.metric && <StyleflowElement as="p">{item.metric}</StyleflowElement>}
16
+ {(item.statisticValue || item.statisticLabel) && <StyleflowElement as="p"><StyleflowElement as="strong">{item.statisticValue}</StyleflowElement> {item.statisticLabel}</StyleflowElement>}
17
+ </StyleflowElement>
18
18
  ))}
19
- </S.ol>
20
- </S.section>
19
+ </StyleflowElement>
20
+ </StyleflowElement>
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
  import SyncedPatternContent from "./SyncedPatternContent.astro";
5
5
 
@@ -14,5 +14,5 @@ const ownsSemanticContext = Object.keys(block.attributes ?? {}).some((name) => !
14
14
  ---
15
15
 
16
16
  {ownsSemanticContext
17
- ? <S.div {...htmlProps} {...styleflowProps}><SyncedPatternContent {...props} selfRenderer={Astro.self}><slot /></SyncedPatternContent></S.div>
17
+ ? <StyleflowElement as="div" {...htmlProps} {...styleflowProps}><SyncedPatternContent {...props} selfRenderer={Astro.self}><slot /></SyncedPatternContent></StyleflowElement>
18
18
  : <SyncedPatternContent {...props} selfRenderer={Astro.self}><slot /></SyncedPatternContent>}
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
  import { nativeButtonData } from "./button.js";
5
5
 
@@ -22,19 +22,19 @@ const controlProps = {
22
22
  ---
23
23
 
24
24
  {!resolved ? (
25
- block.innerHtml ? <S.div {...htmlProps} {...styleflowProps} data-flowpress-button-legacy set:html={block.innerHtml} /> : null
25
+ block.innerHtml ? <StyleflowElement as="div" {...htmlProps} {...styleflowProps} data-flowpress-button-legacy set:html={block.innerHtml} /> : null
26
26
  ) : !button.empty ? (
27
- <S.div {...rootProps}>
27
+ <StyleflowElement as="div" {...rootProps}>
28
28
  {button.tag === "button" ? (
29
- <S.button {...controlProps} type={button.type}><Fragment set:html={button.label} /></S.button>
29
+ <StyleflowElement as="button" {...controlProps} type={button.type}><Fragment set:html={button.label} /></StyleflowElement>
30
30
  ) : button.href ? (
31
- <S.a {...controlProps} href={button.href} target={button.target} rel={button.rel}>
31
+ <StyleflowElement as="a" {...controlProps} href={button.href} target={button.target} rel={button.rel}>
32
32
  <Fragment set:html={button.label} />
33
- </S.a>
33
+ </StyleflowElement>
34
34
  ) : (
35
- <S.span {...controlProps} aria-disabled="true"><Fragment set:html={button.label} /></S.span>
35
+ <StyleflowElement as="span" {...controlProps} aria-disabled="true"><Fragment set:html={button.label} /></StyleflowElement>
36
36
  )}
37
- </S.div>
37
+ </StyleflowElement>
38
38
  ) : null}
39
39
 
40
40
  <style>
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
  import { nativeButtonsLayout } from "./button.js";
5
5
 
@@ -11,4 +11,4 @@ const rootProps = {
11
11
  style: [htmlProps.style, nativeButtonsLayout(layout)].filter(Boolean).join(";"),
12
12
  };
13
13
  ---
14
- <S.div {...rootProps} {...styleflowProps}><slot /></S.div>
14
+ <StyleflowElement as="div" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
@@ -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 { FlowpressBlockRendererProps } from "../../index.js";
4
4
 
5
5
  const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
@@ -13,11 +13,11 @@ const rootProps = {
13
13
  };
14
14
  ---
15
15
 
16
- {tag === "section" ? <S.section {...rootProps} {...styleflowProps}><slot /></S.section>
17
- : tag === "article" ? <S.article {...rootProps} {...styleflowProps}><slot /></S.article>
18
- : tag === "header" ? <S.header {...rootProps} {...styleflowProps}><slot /></S.header>
19
- : tag === "footer" ? <S.footer {...rootProps} {...styleflowProps}><slot /></S.footer>
20
- : tag === "main" ? <S.main {...rootProps} {...styleflowProps}><slot /></S.main>
21
- : tag === "aside" ? <S.aside {...rootProps} {...styleflowProps}><slot /></S.aside>
22
- : tag === "nav" ? <S.nav {...rootProps} {...styleflowProps}><slot /></S.nav>
23
- : <S.div {...rootProps} {...styleflowProps}><slot /></S.div>}
16
+ {tag === "section" ? <StyleflowElement as="section" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
17
+ : tag === "article" ? <StyleflowElement as="article" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
18
+ : tag === "header" ? <StyleflowElement as="header" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
19
+ : tag === "footer" ? <StyleflowElement as="footer" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
20
+ : tag === "main" ? <StyleflowElement as="main" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
21
+ : tag === "aside" ? <StyleflowElement as="aside" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
22
+ : tag === "nav" ? <StyleflowElement as="nav" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>
23
+ : <StyleflowElement as="div" {...rootProps} {...styleflowProps}><slot /></StyleflowElement>}