@styleflow.app/flowpress-astro-core 1.0.0-beta.16 → 1.0.0-beta.19
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.
- package/CHANGELOG.md +17 -0
- package/README.md +4 -0
- package/dist/astro/BaseLayout.astro +6 -6
- package/dist/astro/CompositionRenderer.astro +14 -9
- package/dist/astro/GutenbergRenderer.astro +50 -35
- package/dist/astro/blocks/CarouselBlock.astro +3 -3
- package/dist/astro/blocks/CarouselItemBlock.astro +1 -1
- package/dist/astro/blocks/ColumnBlock.astro +1 -1
- package/dist/astro/blocks/CoverBlock.astro +3 -3
- package/dist/astro/blocks/FormBlock.astro +13 -11
- package/dist/astro/blocks/GridBlock.astro +1 -1
- package/dist/astro/blocks/HeroBlock.astro +1 -1
- package/dist/astro/blocks/ImageBlock.astro +1 -1
- package/dist/astro/blocks/NumberSpinnerBlock.astro +1 -1
- package/dist/astro/blocks/SemanticElement.astro +2 -2
- package/dist/astro/blocks/SiteLogoBlock.astro +4 -4
- package/dist/astro/blocks/TextBlock.astro +2 -2
- package/dist/astro/blocks/cover.d.ts +2 -1
- package/dist/astro/blocks/cover.d.ts.map +1 -1
- package/dist/astro/blocks/cover.js.map +1 -1
- package/dist/astro/blocks/cover.ts +3 -2
- package/dist/astro/native/Blob.astro +113 -0
- package/dist/astro/native/BlobBlock.astro +52 -0
- package/dist/astro/native/CustomFieldValue.astro +86 -0
- package/dist/astro/native/LevelTag.astro +20 -0
- package/dist/astro/native/MapBlock.astro +41 -0
- package/dist/astro/native/NativeHtmlBlock.astro +12 -0
- package/dist/astro/native/NativeIconBlock.astro +33 -0
- package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
- package/dist/astro/native/ResolvedBlocks.astro +89 -0
- package/dist/astro/native/SyncedPatternContent.astro +92 -0
- package/dist/astro/native/TermFieldValue.astro +37 -0
- package/dist/astro/native/Timeline.astro +20 -0
- package/dist/astro/native/TimelineCardBlock.astro +7 -0
- package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
- package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
- package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
- package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
- package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
- package/dist/astro/native/blob/config.d.ts +49 -0
- package/dist/astro/native/blob/config.d.ts.map +1 -0
- package/dist/astro/native/blob/config.js +86 -0
- package/dist/astro/native/blob/config.js.map +1 -0
- package/dist/astro/native/blob/config.ts +132 -0
- package/dist/astro/native/blob/controller.d.ts +11 -0
- package/dist/astro/native/blob/controller.d.ts.map +1 -0
- package/dist/astro/native/blob/controller.js +240 -0
- package/dist/astro/native/blob/controller.js.map +1 -0
- package/dist/astro/native/blob/controller.ts +248 -0
- package/dist/astro/native/blob/geometry.d.ts +2 -0
- package/dist/astro/native/blob/geometry.d.ts.map +1 -0
- package/dist/astro/native/blob/geometry.js +2 -0
- package/dist/astro/native/blob/geometry.js.map +1 -0
- package/dist/astro/native/blob/geometry.ts +1 -0
- package/dist/astro/native/blob/ids.d.ts +7 -0
- package/dist/astro/native/blob/ids.d.ts.map +1 -0
- package/dist/astro/native/blob/ids.js +11 -0
- package/dist/astro/native/blob/ids.js.map +1 -0
- package/dist/astro/native/blob/ids.ts +11 -0
- package/dist/astro/native/blob.css +83 -0
- package/dist/astro/native/button.d.ts +13 -0
- package/dist/astro/native/button.d.ts.map +1 -0
- package/dist/astro/native/button.js +26 -0
- package/dist/astro/native/button.js.map +1 -0
- package/dist/astro/native/button.ts +26 -0
- package/dist/astro/native/core-block.astro +18 -0
- package/dist/astro/native/core-button.astro +43 -0
- package/dist/astro/native/core-buttons.astro +14 -0
- package/dist/astro/native/core-group.astro +23 -0
- package/dist/astro/native/core-home-link.astro +11 -0
- package/dist/astro/native/core-html.astro +8 -0
- package/dist/astro/native/core-icon.astro +7 -0
- package/dist/astro/native/core-image.astro +124 -0
- package/dist/astro/native/core-navigation-link.astro +70 -0
- package/dist/astro/native/core-navigation-submenu.astro +32 -0
- package/dist/astro/native/core-navigation.astro +94 -0
- package/dist/astro/native/core-page-list-data-item.astro +18 -0
- package/dist/astro/native/core-page-list-item.astro +7 -0
- package/dist/astro/native/core-page-list.astro +40 -0
- package/dist/astro/native/core-post-date.astro +20 -0
- package/dist/astro/native/core-post-excerpt.astro +25 -0
- package/dist/astro/native/core-post-featured-image.astro +37 -0
- package/dist/astro/native/core-post-template.astro +30 -0
- package/dist/astro/native/core-post-terms.astro +46 -0
- package/dist/astro/native/core-post-title.astro +23 -0
- package/dist/astro/native/core-query-no-results.astro +12 -0
- package/dist/astro/native/core-query.astro +22 -0
- package/dist/astro/native/core-site-title.astro +15 -0
- package/dist/astro/native/core-term-description.astro +12 -0
- package/dist/astro/native/core-term-name.astro +20 -0
- package/dist/astro/native/core-term-template.astro +30 -0
- package/dist/astro/native/core-terms-query.astro +19 -0
- package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
- package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
- package/dist/astro/native/flowpress-navigation-controller.js +217 -0
- package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
- package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
- package/dist/astro/native/flowpress-navigation.css +17 -0
- package/dist/astro/native/grid-bleed.js +106 -0
- package/dist/astro/native/grid.css +180 -0
- package/dist/astro/native/grid.d.ts +17 -0
- package/dist/astro/native/grid.d.ts.map +1 -0
- package/dist/astro/native/grid.js +103 -0
- package/dist/astro/native/grid.js.map +1 -0
- package/dist/astro/native/grid.ts +118 -0
- package/dist/astro/native/html.d.ts +6 -0
- package/dist/astro/native/html.d.ts.map +1 -0
- package/dist/astro/native/html.js +10 -0
- package/dist/astro/native/html.js.map +1 -0
- package/dist/astro/native/html.ts +9 -0
- package/dist/astro/native/icon.d.ts +3 -0
- package/dist/astro/native/icon.d.ts.map +1 -0
- package/dist/astro/native/icon.js +23 -0
- package/dist/astro/native/icon.js.map +1 -0
- package/dist/astro/native/icon.ts +21 -0
- package/dist/astro/native/map.d.ts +14 -0
- package/dist/astro/native/map.d.ts.map +1 -0
- package/dist/astro/native/map.js +60 -0
- package/dist/astro/native/map.js.map +1 -0
- package/dist/astro/native/map.ts +70 -0
- package/dist/astro/native/motion-preference.d.ts +50 -0
- package/dist/astro/native/motion-preference.d.ts.map +1 -0
- package/dist/astro/native/motion-preference.js +132 -0
- package/dist/astro/native/motion-preference.js.map +1 -0
- package/dist/astro/native/motion-preference.ts +158 -0
- package/dist/astro/native/motion.d.ts +101 -0
- package/dist/astro/native/motion.d.ts.map +1 -0
- package/dist/astro/native/motion.js +168 -0
- package/dist/astro/native/motion.js.map +1 -0
- package/dist/astro/native/motion.ts +312 -0
- package/dist/astro/native/query-loop.d.ts +38 -0
- package/dist/astro/native/query-loop.d.ts.map +1 -0
- package/dist/astro/native/query-loop.js +20 -0
- package/dist/astro/native/query-loop.js.map +1 -0
- package/dist/astro/native/query-loop.ts +67 -0
- package/dist/astro/native/registry.d.ts +3 -0
- package/dist/astro/native/registry.d.ts.map +1 -0
- package/dist/astro/native/registry.js +72 -0
- package/dist/astro/native/registry.js.map +1 -0
- package/dist/astro/native/registry.ts +72 -0
- package/dist/astro/native/sf-block-binding.astro +20 -0
- package/dist/astro/native/sf-post-field.astro +9 -0
- package/dist/astro/native/sf-term-field.astro +9 -0
- package/dist/astro/native/timeline.css +4 -0
- package/dist/astro/native/timeline.d.ts +28 -0
- package/dist/astro/native/timeline.d.ts.map +1 -0
- package/dist/astro/native/timeline.js +43 -0
- package/dist/astro/native/timeline.js.map +1 -0
- package/dist/astro/native/timeline.ts +79 -0
- package/dist/block-renderers.d.ts +3 -3
- package/dist/block-renderers.d.ts.map +1 -1
- package/dist/block-renderers.js.map +1 -1
- package/dist/client.d.ts +16 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +23 -4
- package/dist/client.js.map +1 -1
- package/dist/default-blocks.d.ts +1 -1
- package/dist/default-blocks.d.ts.map +1 -1
- package/dist/default-blocks.js +36 -2
- package/dist/default-blocks.js.map +1 -1
- package/dist/media.d.ts +4 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +56 -36
- package/dist/media.js.map +1 -1
- package/dist/templates.d.ts +16 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.19 — 2026-10-07
|
|
4
|
+
|
|
5
|
+
- Publish the direct-media and editorial/runtime optimizations described below with a lockfile verified by clean installation and StyleFlow beta.9.
|
|
6
|
+
- Supersedes the unpublished beta.18 candidate; its immutable Git tag is retained.
|
|
7
|
+
|
|
8
|
+
## 1.0.0-beta.18 — unpublished candidate, 2026-10-07
|
|
9
|
+
|
|
10
|
+
- Deliver media at their real WordPress/R2 origin; undo legacy frontend aliases without inventing offload URLs. Preserve mixed libraries, srcset and external URLs. Proxy exports are deprecated compatibility APIs.
|
|
11
|
+
- Add `getPage` to reuse the route already returned by Site Editor compositions and optional `includeContent: false` (WordPress Core beta.19) for unused HTML. Existing APIs retain their defaults; previews are not cached across requests.
|
|
12
|
+
- Prepare descriptor/diagnostic indexes once per recursive composition, share unchanged media payload branches and consume StyleFlow Astro beta.9 contract indexes.
|
|
13
|
+
- [Canonical verification](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-10-07-media-diretti-runtime.md).
|
|
14
|
+
|
|
15
|
+
## 1.0.0-beta.17 — 2026-10-07
|
|
16
|
+
|
|
17
|
+
- Official native and sf/* renderers at every nesting depth; responsive grids and measured container bleed, maps, neutral organic shapes, timeline and accessible navigation.
|
|
18
|
+
- Canonical behavior, migration and verification: [pilot integration](https://github.com/StyleFlow-App/styleflow-docs/blob/main/wiki/piloti-flowpress.md), [report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-10-07-integrazione-piloti-flowpress.md).
|
|
19
|
+
|
|
3
20
|
## Unreleased
|
|
4
21
|
|
|
5
22
|
## 1.0.0-beta.16
|
package/README.md
CHANGED
|
@@ -268,3 +268,7 @@ Promote to `latest` only after the DMO canary and rollback gate.
|
|
|
268
268
|
|
|
269
269
|
Release activity reports are indexed in
|
|
270
270
|
[`docs/activities/README.md`](docs/activities/README.md).
|
|
271
|
+
|
|
272
|
+
Pilot integration in `1.0.0-beta.17`: Canonical behavior, migration and verification: [pilot integration](https://github.com/StyleFlow-App/styleflow-docs/blob/main/wiki/piloti-flowpress.md), [report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-10-07-integrazione-piloti-flowpress.md).
|
|
273
|
+
|
|
274
|
+
Direct media and query loading: [canonical guide](https://github.com/StyleFlow-App/styleflow-docs/blob/main/wiki/runtime-editoriale.md), [media migration](https://github.com/StyleFlow-App/styleflow-docs/blob/main/wiki/asset.md).
|
|
@@ -4,11 +4,11 @@ import S from "@styleflow.app/astro/S.astro";
|
|
|
4
4
|
import ThemeRuntime from "./ThemeRuntime.astro";
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
lang?: string;
|
|
8
|
-
seo?: SfSeo | null;
|
|
9
|
-
siteName?: string;
|
|
10
|
-
theme?: string;
|
|
11
|
-
themes?: string[];
|
|
7
|
+
lang?: string | undefined;
|
|
8
|
+
seo?: SfSeo | null | undefined;
|
|
9
|
+
siteName?: string | undefined;
|
|
10
|
+
theme?: string | undefined;
|
|
11
|
+
themes?: string[] | undefined;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const {
|
|
@@ -54,7 +54,7 @@ const jsonLd = seo?.jsonLd ? JSON.stringify(seo.jsonLd) : null;
|
|
|
54
54
|
<slot name="head" />
|
|
55
55
|
</head>
|
|
56
56
|
<body>
|
|
57
|
-
<S.main theme
|
|
57
|
+
<S.main {...(theme ? { theme } : {})} surface="default" layoutRole="none" density="regular">
|
|
58
58
|
<slot />
|
|
59
59
|
</S.main>
|
|
60
60
|
</body>
|
|
@@ -10,18 +10,19 @@ import {
|
|
|
10
10
|
resolveFlowpressBlockStyleflowProps,
|
|
11
11
|
type StyleflowContract
|
|
12
12
|
} from "../styleflow.js";
|
|
13
|
-
import type { FlowpressBlock, FlowpressCompositionV1 } from "../types.js";
|
|
13
|
+
import type { FlowpressBlock, FlowpressCompositionV1, FlowpressBlockTypeDescriptor } from "../types.js";
|
|
14
14
|
import { rewriteFlowpressMediaUrls, type FlowpressFrontendMediaOptions } from "../media.js";
|
|
15
15
|
|
|
16
16
|
interface Props {
|
|
17
17
|
composition: FlowpressCompositionV1;
|
|
18
18
|
adapters: FlowpressBlockAdapters;
|
|
19
|
-
blocks?: FlowpressBlock[];
|
|
20
|
-
contract?: StyleflowContract;
|
|
21
|
-
parentBlockName?: string;
|
|
22
|
-
production?: boolean;
|
|
23
|
-
depth?: number;
|
|
24
|
-
media?: FlowpressFrontendMediaOptions;
|
|
19
|
+
blocks?: FlowpressBlock[] | undefined;
|
|
20
|
+
contract?: StyleflowContract | undefined;
|
|
21
|
+
parentBlockName?: string | undefined;
|
|
22
|
+
production?: boolean | undefined;
|
|
23
|
+
depth?: number | undefined;
|
|
24
|
+
media?: FlowpressFrontendMediaOptions | undefined;
|
|
25
|
+
prepared?: { descriptors: ReadonlyMap<string, FlowpressBlockTypeDescriptor>; blocking: FlowpressCompositionV1["diagnostics"] } | undefined;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const {
|
|
@@ -48,14 +49,17 @@ const blocks = sourceBlocks
|
|
|
48
49
|
? depth === 0 ? rewriteFlowpressMediaUrls(sourceBlocks, mediaOptions) : sourceBlocks
|
|
49
50
|
: composition.blocks;
|
|
50
51
|
|
|
51
|
-
const
|
|
52
|
+
const prepared = Astro.props.prepared ?? {
|
|
53
|
+
descriptors: flowpressBlockTypeDescriptors(composition),
|
|
54
|
+
blocking: composition.diagnostics.filter((diagnostic) => diagnostic.blocking)
|
|
55
|
+
};
|
|
56
|
+
const { descriptors, blocking } = prepared;
|
|
52
57
|
if (blocking.length > 0 && production) {
|
|
53
58
|
throw new Error(
|
|
54
59
|
`FlowPress composition ${composition.sourceDigest} is not renderable:\n`
|
|
55
60
|
+ blocking.map(({ code, message }) => `- ${code}: ${message}`).join("\n")
|
|
56
61
|
);
|
|
57
62
|
}
|
|
58
|
-
const descriptors = flowpressBlockTypeDescriptors(composition);
|
|
59
63
|
const logoStyles = parentBlockName === undefined
|
|
60
64
|
? flowpressCompositionLogoStyles(composition)
|
|
61
65
|
: "";
|
|
@@ -136,6 +140,7 @@ const logoStyles = parentBlockName === undefined
|
|
|
136
140
|
parentBlockName={block.name}
|
|
137
141
|
production={production}
|
|
138
142
|
depth={depth + 1}
|
|
143
|
+
prepared={prepared}
|
|
139
144
|
/>
|
|
140
145
|
</Adapter>
|
|
141
146
|
</>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
import "./native/grid.css";
|
|
2
3
|
import S from "@styleflow.app/astro/S.astro";
|
|
3
4
|
import type {
|
|
4
5
|
FlowpressBlockAdapters,
|
|
@@ -13,7 +14,8 @@ import type { StyleflowContract } from "../styleflow.js";
|
|
|
13
14
|
import type {
|
|
14
15
|
FlowpressBlock,
|
|
15
16
|
FlowpressBlockHtmlProps,
|
|
16
|
-
FlowpressCompositionV1
|
|
17
|
+
FlowpressCompositionV1,
|
|
18
|
+
FlowpressBlockTypeDescriptor
|
|
17
19
|
} from "../types.js";
|
|
18
20
|
import type { DynamicStyleflowProps } from "../styleflow.js";
|
|
19
21
|
import ColumnBlock from "./blocks/ColumnBlock.astro";
|
|
@@ -37,22 +39,23 @@ import {
|
|
|
37
39
|
|
|
38
40
|
interface Props {
|
|
39
41
|
blocks: FlowpressBlock[];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
descriptorIndex?: ReadonlyMap<string, FlowpressBlockTypeDescriptor> | undefined;
|
|
43
|
+
contract?: StyleflowContract | undefined;
|
|
44
|
+
blockRenderers?: FlowpressBlockRenderers | undefined;
|
|
45
|
+
iconRenderer?: FlowpressIconRenderer | undefined;
|
|
46
|
+
rootHtmlProps?: FlowpressBlockHtmlProps | undefined;
|
|
47
|
+
rootStyleflowProps?: DynamicStyleflowProps | undefined;
|
|
48
|
+
adapterDefinitions?: FlowpressBlockAdapters | undefined;
|
|
49
|
+
composition?: FlowpressCompositionV1 | undefined;
|
|
50
|
+
parentBlockName?: string | undefined;
|
|
51
|
+
production?: boolean | undefined;
|
|
52
|
+
depth?: number | undefined;
|
|
53
|
+
skipCustomRendererFor?: string | undefined;
|
|
54
|
+
requireRegisteredAdapters?: boolean | undefined;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
const {
|
|
55
|
-
blocks,
|
|
58
|
+
blocks: rawBlocks,
|
|
56
59
|
contract,
|
|
57
60
|
blockRenderers = {},
|
|
58
61
|
iconRenderer: IconRenderer,
|
|
@@ -66,7 +69,15 @@ const {
|
|
|
66
69
|
skipCustomRendererFor,
|
|
67
70
|
requireRegisteredAdapters = false
|
|
68
71
|
} = Astro.props;
|
|
69
|
-
const
|
|
72
|
+
const { decorateGridBlocks } = await import("./native/grid.js");
|
|
73
|
+
const blocks = decorateGridBlocks(rawBlocks);
|
|
74
|
+
const { nativeBlockRenderers } = await import("./native/registry.js");
|
|
75
|
+
const effectiveRenderers = { ...nativeBlockRenderers, ...blockRenderers };
|
|
76
|
+
const descriptors = Astro.props.descriptorIndex ?? (composition ? flowpressBlockTypeDescriptors(composition) : undefined);
|
|
77
|
+
|
|
78
|
+
function objectCollection(value: unknown): Record<string, unknown>[] {
|
|
79
|
+
return Array.isArray(value) ? value.filter((item): item is Record<string, unknown> => !!item && typeof item === "object") : [];
|
|
80
|
+
}
|
|
70
81
|
|
|
71
82
|
function youtubeEmbedUrl(value: unknown): string | null {
|
|
72
83
|
try {
|
|
@@ -99,16 +110,16 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
99
110
|
|
|
100
111
|
{blocks.map((block, index) => {
|
|
101
112
|
const name = block.name.replace(/^sf\//, "");
|
|
102
|
-
const children = block.innerBlocks ?? [];
|
|
113
|
+
const children = decorateGridBlocks(block.innerBlocks ?? []);
|
|
103
114
|
const semantic = index === 0 && blocks.length === 1 && rootStyleflowProps
|
|
104
115
|
? rootStyleflowProps
|
|
105
116
|
: semanticProps(block.attributes, contract);
|
|
106
117
|
const htmlAttributes = index === 0 && blocks.length === 1 && rootHtmlProps
|
|
107
|
-
? rootHtmlProps
|
|
118
|
+
? { ...rootHtmlProps, class: Array.from(new Set([rootHtmlProps.class, block.attributes.className].filter(Boolean).join(" ").split(/\s+/))).join(" ") }
|
|
108
119
|
: blockHtmlAttributes(block.attributes);
|
|
109
120
|
const CustomBlockRenderer = block.name === skipCustomRendererFor
|
|
110
|
-
?
|
|
111
|
-
:
|
|
121
|
+
? nativeBlockRenderers[block.name as keyof typeof nativeBlockRenderers]
|
|
122
|
+
: effectiveRenderers[block.name as keyof typeof effectiveRenderers];
|
|
112
123
|
const compatibilityIssue = descriptors && adapterDefinitions
|
|
113
124
|
? flowpressAdapterCompatibilityIssue(block.name, descriptors, adapterDefinitions)
|
|
114
125
|
: null;
|
|
@@ -120,7 +131,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
120
131
|
if (
|
|
121
132
|
requireRegisteredAdapters
|
|
122
133
|
&& block.name !== skipCustomRendererFor
|
|
123
|
-
&& !CustomBlockRenderer
|
|
134
|
+
&& (!adapterDefinitions?.[block.name] || !CustomBlockRenderer)
|
|
124
135
|
) {
|
|
125
136
|
const message = compatibilityIssue?.message
|
|
126
137
|
?? `Missing FlowPress block adapter for "${block.name}".`;
|
|
@@ -156,7 +167,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
156
167
|
production
|
|
157
168
|
}}
|
|
158
169
|
>
|
|
159
|
-
<Astro.self
|
|
170
|
+
<Astro.self descriptorIndex={descriptors}
|
|
160
171
|
blocks={children}
|
|
161
172
|
contract={contract}
|
|
162
173
|
blockRenderers={blockRenderers}
|
|
@@ -176,7 +187,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
176
187
|
if (name === "hero") {
|
|
177
188
|
return (
|
|
178
189
|
<HeroBlock block={block} contract={contract}>
|
|
179
|
-
<Astro.self
|
|
190
|
+
<Astro.self descriptorIndex={descriptors}
|
|
180
191
|
blocks={children}
|
|
181
192
|
contract={contract}
|
|
182
193
|
blockRenderers={blockRenderers}
|
|
@@ -190,7 +201,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
190
201
|
if (name === "grid") {
|
|
191
202
|
return (
|
|
192
203
|
<GridBlock block={block} contract={contract}>
|
|
193
|
-
<Astro.self
|
|
204
|
+
<Astro.self descriptorIndex={descriptors}
|
|
194
205
|
blocks={children}
|
|
195
206
|
contract={contract}
|
|
196
207
|
blockRenderers={blockRenderers}
|
|
@@ -204,7 +215,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
204
215
|
if (name === "column") {
|
|
205
216
|
return (
|
|
206
217
|
<ColumnBlock block={block} contract={contract}>
|
|
207
|
-
<Astro.self
|
|
218
|
+
<Astro.self descriptorIndex={descriptors}
|
|
208
219
|
blocks={children}
|
|
209
220
|
contract={contract}
|
|
210
221
|
blockRenderers={blockRenderers}
|
|
@@ -226,7 +237,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
226
237
|
validChildren={invalidChildNames.length === 0}
|
|
227
238
|
invalidChildNames={invalidChildNames}
|
|
228
239
|
>
|
|
229
|
-
<Astro.self
|
|
240
|
+
<Astro.self descriptorIndex={descriptors}
|
|
230
241
|
blocks={children}
|
|
231
242
|
contract={contract}
|
|
232
243
|
blockRenderers={blockRenderers}
|
|
@@ -240,7 +251,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
240
251
|
if (name === "carousel-item") {
|
|
241
252
|
return (
|
|
242
253
|
<CarouselItemBlock block={block} contract={contract}>
|
|
243
|
-
<Astro.self
|
|
254
|
+
<Astro.self descriptorIndex={descriptors}
|
|
244
255
|
blocks={children}
|
|
245
256
|
contract={contract}
|
|
246
257
|
blockRenderers={blockRenderers}
|
|
@@ -263,7 +274,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
263
274
|
htmlProps={htmlAttributes}
|
|
264
275
|
styleflowProps={semantic}
|
|
265
276
|
>
|
|
266
|
-
<Astro.self
|
|
277
|
+
<Astro.self descriptorIndex={descriptors}
|
|
267
278
|
blocks={children}
|
|
268
279
|
contract={contract}
|
|
269
280
|
blockRenderers={blockRenderers}
|
|
@@ -286,7 +297,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
286
297
|
].includes(name)) {
|
|
287
298
|
return (
|
|
288
299
|
<TextBlock block={block} contract={contract} hasChildren={children.length > 0}>
|
|
289
|
-
<Astro.self
|
|
300
|
+
<Astro.self descriptorIndex={descriptors}
|
|
290
301
|
blocks={children}
|
|
291
302
|
contract={contract}
|
|
292
303
|
blockRenderers={blockRenderers}
|
|
@@ -381,7 +392,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
381
392
|
|
|
382
393
|
if (name === "gallery") {
|
|
383
394
|
const images = Array.isArray(block.attributes.images)
|
|
384
|
-
? block.attributes.images
|
|
395
|
+
? objectCollection(block.attributes.images)
|
|
385
396
|
: [];
|
|
386
397
|
return (
|
|
387
398
|
<S.div {...semantic} {...htmlAttributes}>
|
|
@@ -454,7 +465,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
454
465
|
|
|
455
466
|
if (name === "content-list" || name === "term-list") {
|
|
456
467
|
const items = Array.isArray(block.attributes.resolvedItems)
|
|
457
|
-
? block.attributes.resolvedItems
|
|
468
|
+
? objectCollection(block.attributes.resolvedItems)
|
|
458
469
|
: [];
|
|
459
470
|
const resolvedBlocks = Array.isArray(block.attributes.resolvedBlocks)
|
|
460
471
|
? block.attributes.resolvedBlocks as FlowpressBlock[][]
|
|
@@ -464,7 +475,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
464
475
|
{items.map((item, index) => (
|
|
465
476
|
<S.li>
|
|
466
477
|
{resolvedBlocks[index]?.length ? (
|
|
467
|
-
<Astro.self
|
|
478
|
+
<Astro.self descriptorIndex={descriptors}
|
|
468
479
|
blocks={resolvedBlocks[index]}
|
|
469
480
|
contract={contract}
|
|
470
481
|
blockRenderers={blockRenderers}
|
|
@@ -483,7 +494,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
483
494
|
if (name === "template") {
|
|
484
495
|
return Object.keys(htmlAttributes).length > 0 ? (
|
|
485
496
|
<div {...htmlAttributes}>
|
|
486
|
-
<Astro.self
|
|
497
|
+
<Astro.self descriptorIndex={descriptors}
|
|
487
498
|
blocks={children}
|
|
488
499
|
contract={contract}
|
|
489
500
|
blockRenderers={blockRenderers}
|
|
@@ -492,7 +503,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
492
503
|
/>
|
|
493
504
|
</div>
|
|
494
505
|
) : (
|
|
495
|
-
<Astro.self
|
|
506
|
+
<Astro.self descriptorIndex={descriptors}
|
|
496
507
|
blocks={children}
|
|
497
508
|
contract={contract}
|
|
498
509
|
blockRenderers={blockRenderers}
|
|
@@ -511,7 +522,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
511
522
|
<S.div {...semantic} {...htmlAttributes}>
|
|
512
523
|
<details>
|
|
513
524
|
<summary>{String(block.attributes.title ?? "")}</summary>
|
|
514
|
-
<Astro.self
|
|
525
|
+
<Astro.self descriptorIndex={descriptors}
|
|
515
526
|
blocks={children}
|
|
516
527
|
contract={contract}
|
|
517
528
|
blockRenderers={blockRenderers}
|
|
@@ -565,7 +576,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
565
576
|
const fallbackContent = block.innerHtml && children.length === 0
|
|
566
577
|
? <S.div set:html={block.innerHtml} />
|
|
567
578
|
: (
|
|
568
|
-
<Astro.self
|
|
579
|
+
<Astro.self descriptorIndex={descriptors}
|
|
569
580
|
blocks={children}
|
|
570
581
|
contract={contract}
|
|
571
582
|
blockRenderers={blockRenderers}
|
|
@@ -579,3 +590,7 @@ function nestedRendererProps(nextParentBlockName: string) {
|
|
|
579
590
|
<S.div {...semantic} {...htmlAttributes}>{fallbackContent}</S.div>
|
|
580
591
|
);
|
|
581
592
|
})}
|
|
593
|
+
|
|
594
|
+
<script>
|
|
595
|
+
import "./native/grid-bleed.js";
|
|
596
|
+
</script>
|
|
@@ -8,9 +8,9 @@ import { blockHtmlAttributes, semanticProps } from "./helpers.js";
|
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
block: FlowpressBlock;
|
|
11
|
-
contract?: StyleflowContract;
|
|
11
|
+
contract?: StyleflowContract | undefined;
|
|
12
12
|
validChildren: boolean;
|
|
13
|
-
invalidChildNames?: string[];
|
|
13
|
+
invalidChildNames?: string[] | undefined;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const { block, contract, validChildren, invalidChildNames = [] } = Astro.props;
|
|
@@ -99,7 +99,7 @@ if (!validChildren && import.meta.env.DEV) {
|
|
|
99
99
|
|
|
100
100
|
if (!customElements.get("flowpress-carousel")) {
|
|
101
101
|
customElements.define("flowpress-carousel", class extends HTMLElement {
|
|
102
|
-
private instance?: Splide;
|
|
102
|
+
private instance?: Splide | undefined;
|
|
103
103
|
|
|
104
104
|
connectedCallback() {
|
|
105
105
|
if (this.instance) return;
|
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
23
|
block: FlowpressBlock;
|
|
24
|
-
contract?: StyleflowContract;
|
|
25
|
-
htmlProps?: FlowpressBlockHtmlProps;
|
|
26
|
-
styleflowProps?: DynamicStyleflowProps;
|
|
24
|
+
contract?: StyleflowContract | undefined;
|
|
25
|
+
htmlProps?: FlowpressBlockHtmlProps | undefined;
|
|
26
|
+
styleflowProps?: DynamicStyleflowProps | undefined;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const { block, contract, htmlProps, styleflowProps } = Astro.props;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
type HTMLInputTypeAttribute = HTMLAttributes<"input">["type"];
|
|
2
4
|
import S from "@styleflow.app/astro/S.astro";
|
|
3
5
|
import type { FlowpressBlock } from "../../types.js";
|
|
4
6
|
import type { StyleflowContract } from "../../styleflow.js";
|
|
@@ -7,10 +9,10 @@ import { blockHtmlAttributes, semanticProps } from "./helpers.js";
|
|
|
7
9
|
interface FormField {
|
|
8
10
|
name: string;
|
|
9
11
|
type: string;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
values?: string[];
|
|
12
|
-
labels?: string[];
|
|
13
|
-
options?: string[];
|
|
12
|
+
required?: boolean | undefined;
|
|
13
|
+
values?: string[] | undefined;
|
|
14
|
+
labels?: string[] | undefined;
|
|
15
|
+
options?: string[] | undefined;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
interface FormSchema {
|
|
@@ -24,7 +26,7 @@ interface FormSchema {
|
|
|
24
26
|
|
|
25
27
|
interface Props {
|
|
26
28
|
block: FlowpressBlock;
|
|
27
|
-
contract?: StyleflowContract;
|
|
29
|
+
contract?: StyleflowContract | undefined;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
const { block, contract } = Astro.props;
|
|
@@ -63,7 +65,7 @@ const optionLabel = (field: FormField, index: number): string =>
|
|
|
63
65
|
{(field.values || []).map((value, index) => (
|
|
64
66
|
<label>
|
|
65
67
|
<input
|
|
66
|
-
type={field.type}
|
|
68
|
+
type={field.type as HTMLInputTypeAttribute}
|
|
67
69
|
name={field.type === "checkbox" ? `${field.name}[]` : field.name}
|
|
68
70
|
value={value}
|
|
69
71
|
required={field.required}
|
|
@@ -114,7 +116,7 @@ const optionLabel = (field: FormField, index: number): string =>
|
|
|
114
116
|
<label>
|
|
115
117
|
{labelFor(field)}
|
|
116
118
|
<input
|
|
117
|
-
type={field.type === "file" ? "file" : field.type}
|
|
119
|
+
type={field.type === "file" ? "file" : field.type as HTMLInputTypeAttribute}
|
|
118
120
|
name={field.name}
|
|
119
121
|
required={field.required}
|
|
120
122
|
/>
|
|
@@ -142,7 +144,7 @@ const optionLabel = (field: FormField, index: number): string =>
|
|
|
142
144
|
interface Window {
|
|
143
145
|
turnstile?: {
|
|
144
146
|
render(target: Element, options: Record<string, unknown>): string;
|
|
145
|
-
reset(widgetId?: string): void;
|
|
147
|
+
reset(widgetId?: string): void | undefined;
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
}
|
|
@@ -174,7 +176,7 @@ const optionLabel = (field: FormField, index: number): string =>
|
|
|
174
176
|
|
|
175
177
|
if (!customElements.get("flowpress-cf7-form")) {
|
|
176
178
|
customElements.define("flowpress-cf7-form", class extends HTMLElement {
|
|
177
|
-
private widgetId?: string;
|
|
179
|
+
private widgetId?: string | undefined;
|
|
178
180
|
|
|
179
181
|
connectedCallback() {
|
|
180
182
|
const form = this.querySelector<HTMLFormElement>("form");
|
|
@@ -207,8 +209,8 @@ const optionLabel = (field: FormField, index: number): string =>
|
|
|
207
209
|
headers: { Accept: "application/json" }
|
|
208
210
|
});
|
|
209
211
|
const result = await response.json() as {
|
|
210
|
-
message?: string;
|
|
211
|
-
invalidFields?: Array<{ field?: string; into?: string; message?: string }
|
|
212
|
+
message?: string | undefined;
|
|
213
|
+
invalidFields?: Array<{ field?: string | undefined; into?: string | undefined; message?: string }> | undefined;
|
|
212
214
|
};
|
|
213
215
|
status.textContent = result.message || (response.ok ? "Messaggio inviato." : "Invio non riuscito.");
|
|
214
216
|
for (const invalid of result.invalidFields || []) {
|
|
@@ -8,8 +8,8 @@ type SemanticElementTag =
|
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
tag: SemanticElementTag;
|
|
11
|
-
attributes?: Record<string, unknown
|
|
12
|
-
html?: string;
|
|
11
|
+
attributes?: Record<string, unknown> | undefined;
|
|
12
|
+
html?: string | undefined;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const { tag, attributes = {}, html } = Astro.props;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import S from "@styleflow.app/astro/S.astro";
|
|
3
3
|
import type { FlowpressBlockRendererProps } from "../../block-renderers.js";
|
|
4
4
|
|
|
5
|
-
type LogoImage = { url?: string; width?: number; height?: number; alt?: string };
|
|
5
|
+
type LogoImage = { url?: string | undefined; width?: number | undefined; height?: number | undefined; alt?: string } | undefined;
|
|
6
6
|
type LogoData = {
|
|
7
|
-
images?: { positive?: LogoImage; negative?: LogoImage };
|
|
8
|
-
homeUrl?: string;
|
|
9
|
-
override?: "auto" | "positive" | "negative";
|
|
7
|
+
images?: { positive?: LogoImage | undefined; negative?: LogoImage } | undefined;
|
|
8
|
+
homeUrl?: string | undefined;
|
|
9
|
+
override?: "auto" | "positive" | "negative" | undefined;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const { block, styleflowProps, htmlProps } = Astro.props as FlowpressBlockRendererProps;
|
|
@@ -16,8 +16,8 @@ import SemanticElement from "./SemanticElement.astro";
|
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
18
|
block: FlowpressBlock;
|
|
19
|
-
contract?: StyleflowContract;
|
|
20
|
-
hasChildren?: boolean;
|
|
19
|
+
contract?: StyleflowContract | undefined;
|
|
20
|
+
hasChildren?: boolean | undefined;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const { block, contract, hasChildren = false } = Astro.props;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FlowpressBlock } from "../../types.js";
|
|
2
2
|
export type CoverBackgroundType = "color" | "image" | "video";
|
|
3
|
-
export
|
|
3
|
+
export type CoverTagName = "article" | "aside" | "div" | "footer" | "header" | "main" | "section";
|
|
4
|
+
export declare function coverTagName(value: unknown): CoverTagName;
|
|
4
5
|
export declare function coverMediaSource(block: FlowpressBlock): string;
|
|
5
6
|
export declare function coverPosterSource(block: FlowpressBlock): string | undefined;
|
|
6
7
|
export declare function coverBackgroundType(block: FlowpressBlock): CoverBackgroundType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../../src/astro/blocks/cover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAwC9D,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../../src/astro/blocks/cover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAwC9D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAClG,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAGzD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAE9D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAI3E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,mBAAmB,CAK9E;AAUD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQ1D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,oBAAoB,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AI,OAAO,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACjD,OAAO,UAAU,CAAC,YAAY,CAAC;IACjC,CAAC;IACD,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,cAAc,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAmC;IACnE,MAAM,eAAe,GAAG,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACnE,IAAI,eAAe,KAAK,SAAS;QAAE,OAAO,eAAe,CAAC;IAE1D,OAAO,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC;AACvD,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../types.js\";\n\nexport type CoverBackgroundType = \"color\" | \"image\" | \"video\";\n\nconst COVER_TAGS = new Set([\n \"article\",\n \"aside\",\n \"div\",\n \"footer\",\n \"header\",\n \"main\",\n \"section\"\n]);\n\nconst HEIGHT_UNITS = new Set([\n \"px\",\n \"%\",\n \"em\",\n \"rem\",\n \"vh\",\n \"svh\",\n \"lvh\",\n \"dvh\",\n \"vw\"\n]);\n\nconst CONTENT_POSITIONS: Record<string, [string, string]> = {\n \"top left\": [\"start\", \"start\"],\n \"top center\": [\"start\", \"center\"],\n \"top right\": [\"start\", \"end\"],\n \"center left\": [\"center\", \"start\"],\n \"center center\": [\"center\", \"center\"],\n \"center right\": [\"center\", \"end\"],\n \"bottom left\": [\"end\", \"start\"],\n \"bottom center\": [\"end\", \"center\"],\n \"bottom right\": [\"end\", \"end\"]\n};\n\nfunction text(value: unknown): string {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nexport type CoverTagName = \"article\" | \"aside\" | \"div\" | \"footer\" | \"header\" | \"main\" | \"section\";\nexport function coverTagName(value: unknown): CoverTagName {\n const candidate = text(value).toLowerCase();\n return COVER_TAGS.has(candidate) ? candidate as CoverTagName : \"div\";\n}\n\nexport function coverMediaSource(block: FlowpressBlock): string {\n return text(block.attributes.url) || text(block.resolvedData?.url);\n}\n\nexport function coverPosterSource(block: FlowpressBlock): string | undefined {\n return text(block.attributes.poster)\n || text(block.resolvedData?.poster)\n || undefined;\n}\n\nexport function coverBackgroundType(block: FlowpressBlock): CoverBackgroundType {\n const requested = text(block.attributes.backgroundType).toLowerCase();\n if (requested === \"video\") return \"video\";\n if (requested === \"color\") return \"color\";\n return coverMediaSource(block) ? \"image\" : \"color\";\n}\n\nfunction percentage(value: unknown): number | undefined {\n const numeric = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(numeric)) return undefined;\n if (numeric >= 0 && numeric <= 1) return numeric * 100;\n if (numeric >= 0 && numeric <= 100) return numeric;\n return undefined;\n}\n\nexport function coverObjectPosition(value: unknown): string {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"50% 50%\";\n }\n const focalPoint = value as Record<string, unknown>;\n const x = percentage(focalPoint.x);\n const y = percentage(focalPoint.y);\n return x === undefined || y === undefined ? \"50% 50%\" : `${x}% ${y}%`;\n}\n\nexport function coverMinimumHeight(\n value: unknown,\n unitValue: unknown\n): string | undefined {\n const numeric = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(numeric) || numeric < 0) return undefined;\n const requestedUnit = text(unitValue).toLowerCase();\n const unit = HEIGHT_UNITS.has(requestedUnit) ? requestedUnit : \"px\";\n return `${numeric}${unit}`;\n}\n\nexport function coverContentPosition(value: unknown): [string, string] {\n return CONTENT_POSITIONS[text(value).toLowerCase()]\n ?? [\"center\", \"center\"];\n}\n\nexport function coverScrimEnabled(attributes: Record<string, unknown>): boolean {\n if (typeof attributes.scrimEnabled === \"boolean\") {\n return attributes.scrimEnabled;\n }\n const nativeDimRatio = Number(attributes.dimRatio);\n return Number.isFinite(nativeDimRatio) && nativeDimRatio > 0;\n}\n\nfunction clampedPercentage(value: unknown): number | undefined {\n const numeric = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(numeric)) return undefined;\n return Math.min(100, Math.max(0, numeric));\n}\n\nexport function coverScrimOpacity(attributes: Record<string, unknown>): number {\n const explicitOpacity = clampedPercentage(attributes.scrimOpacity);\n if (explicitOpacity !== undefined) return explicitOpacity;\n\n return clampedPercentage(attributes.dimRatio) ?? 100;\n}\n"]}
|
|
@@ -40,9 +40,10 @@ function text(value: unknown): string {
|
|
|
40
40
|
return typeof value === "string" ? value.trim() : "";
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export
|
|
43
|
+
export type CoverTagName = "article" | "aside" | "div" | "footer" | "header" | "main" | "section";
|
|
44
|
+
export function coverTagName(value: unknown): CoverTagName {
|
|
44
45
|
const candidate = text(value).toLowerCase();
|
|
45
|
-
return COVER_TAGS.has(candidate) ? candidate : "div";
|
|
46
|
+
return COVER_TAGS.has(candidate) ? candidate as CoverTagName : "div";
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export function coverMediaSource(block: FlowpressBlock): string {
|