@styleflow.app/flowpress-astro-core 1.0.0-beta.3 → 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.
- package/CHANGELOG.md +197 -1
- package/README.md +111 -3
- package/dist/accessibility-panel.d.ts +2 -0
- package/dist/accessibility-panel.d.ts.map +1 -0
- package/dist/accessibility-panel.js +81 -0
- package/dist/accessibility-panel.js.map +1 -0
- package/dist/astro/BaseLayout.astro +34 -17
- package/dist/astro/CompositionRenderer.astro +168 -0
- package/dist/astro/DefaultBlockAdapter.astro +36 -0
- package/dist/astro/DefaultTemplate.astro +12 -7
- package/dist/astro/FontStylesheets.astro +35 -0
- package/dist/astro/GutenbergRenderer.astro +280 -81
- package/dist/astro/Media.astro +24 -0
- package/dist/astro/StyleflowElement.astro +24 -0
- package/dist/astro/ThemeRuntime.astro +26 -0
- package/dist/astro/blocks/CarouselBlock.astro +11 -10
- package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
- package/dist/astro/blocks/ColumnBlock.astro +4 -5
- package/dist/astro/blocks/CoverBlock.astro +156 -0
- package/dist/astro/blocks/FormBlock.astro +23 -20
- package/dist/astro/blocks/GridBlock.astro +4 -4
- package/dist/astro/blocks/HeroBlock.astro +6 -6
- package/dist/astro/blocks/ImageBlock.astro +6 -6
- package/dist/astro/blocks/ListItemFallback.astro +12 -8
- package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
- package/dist/astro/blocks/SemanticElement.astro +35 -0
- package/dist/astro/blocks/SiteLogoBlock.astro +54 -0
- package/dist/astro/blocks/TextBlock.astro +33 -28
- package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
- package/dist/astro/blocks/cover.d.ts +13 -0
- package/dist/astro/blocks/cover.d.ts.map +1 -0
- package/dist/astro/blocks/cover.js +105 -0
- package/dist/astro/blocks/cover.js.map +1 -0
- package/dist/astro/blocks/cover.ts +119 -0
- package/dist/astro/blocks/helpers.d.ts +10 -1
- package/dist/astro/blocks/helpers.d.ts.map +1 -1
- package/dist/astro/blocks/helpers.js +57 -44
- package/dist/astro/blocks/helpers.js.map +1 -1
- package/dist/astro/blocks/helpers.ts +71 -49
- package/dist/astro/motion/AccordionRuntime.astro +9 -0
- package/dist/astro/motion/MotionBoot.astro +21 -0
- package/dist/astro/motion/MotionRuntime.astro +31 -0
- package/dist/astro/motion/accordion.css +163 -0
- package/dist/astro/motion/accordion.d.ts +3 -0
- package/dist/astro/motion/accordion.d.ts.map +1 -0
- package/dist/astro/motion/accordion.js +98 -0
- package/dist/astro/motion/accordion.js.map +1 -0
- package/dist/astro/motion/accordion.ts +109 -0
- package/dist/astro/motion/motion-controller.d.ts +12 -0
- package/dist/astro/motion/motion-controller.d.ts.map +1 -0
- package/dist/astro/motion/motion-controller.js +293 -0
- package/dist/astro/motion/motion-controller.js.map +1 -0
- package/dist/astro/motion/motion-controller.ts +377 -0
- package/dist/astro/motion/motion.css +546 -0
- package/dist/astro/motion/motion.d.ts +127 -0
- package/dist/astro/motion/motion.d.ts.map +1 -0
- package/dist/astro/motion/motion.js +255 -0
- package/dist/astro/motion/motion.js.map +1 -0
- package/dist/astro/motion/motion.ts +419 -0
- package/dist/astro/native/Blob.astro +113 -0
- package/dist/astro/native/BlobBlock.astro +52 -0
- package/dist/astro/native/CustomFieldValue.astro +88 -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 +42 -0
- package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
- package/dist/astro/native/ReservedLogin.astro +107 -0
- package/dist/astro/native/ResolvedBlocks.astro +91 -0
- package/dist/astro/native/SyncedPatternContent.astro +94 -0
- package/dist/astro/native/TermFieldValue.astro +39 -0
- package/dist/astro/native/Timeline.astro +22 -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-template.d.ts +31 -0
- package/dist/astro/native/button-template.d.ts.map +1 -0
- package/dist/astro/native/button-template.js +54 -0
- package/dist/astro/native/button-template.js.map +1 -0
- package/dist/astro/native/button-template.ts +92 -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-fallback.astro +43 -0
- package/dist/astro/native/core-button.astro +65 -0
- package/dist/astro/native/core-buttons.astro +14 -0
- package/dist/astro/native/core-group.astro +25 -0
- package/dist/astro/native/core-home-link.astro +12 -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 +125 -0
- package/dist/astro/native/core-navigation-link.astro +71 -0
- package/dist/astro/native/core-navigation-submenu.astro +33 -0
- package/dist/astro/native/core-navigation.astro +101 -0
- package/dist/astro/native/core-page-list-data-item.astro +19 -0
- package/dist/astro/native/core-page-list-item.astro +8 -0
- package/dist/astro/native/core-page-list.astro +40 -0
- package/dist/astro/native/core-post-date.astro +21 -0
- package/dist/astro/native/core-post-excerpt.astro +26 -0
- package/dist/astro/native/core-post-featured-image.astro +38 -0
- package/dist/astro/native/core-post-template-fallback.astro +30 -0
- package/dist/astro/native/core-post-template.astro +23 -0
- package/dist/astro/native/core-post-terms.astro +47 -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-separator.astro +20 -0
- package/dist/astro/native/core-site-title.astro +16 -0
- package/dist/astro/native/core-term-description.astro +12 -0
- package/dist/astro/native/core-term-name.astro +21 -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/core-transparent.astro +11 -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.d.ts +2 -0
- package/dist/astro/native/grid-bleed.d.ts.map +1 -0
- package/dist/astro/native/grid-bleed.js +123 -0
- package/dist/astro/native/grid-bleed.js.map +1 -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/group.css +36 -0
- package/dist/astro/native/group.d.ts +15 -0
- package/dist/astro/native/group.d.ts.map +1 -0
- package/dist/astro/native/group.js +66 -0
- package/dist/astro/native/group.js.map +1 -0
- package/dist/astro/native/group.ts +61 -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/inline-text.css +15 -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-carousel.d.ts +12 -0
- package/dist/astro/native/query-carousel.d.ts.map +1 -0
- package/dist/astro/native/query-carousel.js +36 -0
- package/dist/astro/native/query-carousel.js.map +1 -0
- package/dist/astro/native/query-carousel.ts +56 -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 +84 -0
- package/dist/astro/native/registry.js.map +1 -0
- package/dist/astro/native/registry.ts +85 -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/astro/preferences/AccessibilityPanel.astro +105 -0
- package/dist/astro/preferences/ColorModeToggle.astro +26 -0
- package/dist/astro/preferences/MotionToggle.astro +27 -0
- package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
- package/dist/astro/preferences/ThemeToggle.astro +30 -0
- package/dist/astro/preferences/Toggle.astro +50 -0
- package/dist/astro/preferences/preferences.css +125 -0
- package/dist/block-renderers.d.ts +22 -3
- package/dist/block-renderers.d.ts.map +1 -1
- package/dist/block-renderers.js.map +1 -1
- package/dist/client.d.ts +17 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +63 -9
- package/dist/client.js.map +1 -1
- package/dist/composition.d.ts +14 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +125 -0
- package/dist/composition.js.map +1 -0
- package/dist/default-blocks.d.ts +9 -0
- package/dist/default-blocks.d.ts.map +1 -0
- package/dist/default-blocks.js +120 -0
- package/dist/default-blocks.js.map +1 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +20 -0
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +5 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +32 -0
- package/dist/links.js.map +1 -0
- package/dist/media.d.ts +28 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +212 -0
- package/dist/media.js.map +1 -0
- package/dist/motion-preference.d.ts +50 -0
- package/dist/motion-preference.d.ts.map +1 -0
- package/dist/motion-preference.js +132 -0
- package/dist/motion-preference.js.map +1 -0
- package/dist/preferences-runtime.d.ts +3 -0
- package/dist/preferences-runtime.d.ts.map +1 -0
- package/dist/preferences-runtime.js +23 -0
- package/dist/preferences-runtime.js.map +1 -0
- package/dist/preferences-styleflow.d.ts +3 -0
- package/dist/preferences-styleflow.d.ts.map +1 -0
- package/dist/preferences-styleflow.js +14 -0
- package/dist/preferences-styleflow.js.map +1 -0
- package/dist/preferences.d.ts +4 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +4 -0
- package/dist/preferences.js.map +1 -0
- package/dist/reserved-area.d.ts +10 -0
- package/dist/reserved-area.d.ts.map +1 -0
- package/dist/reserved-area.js +93 -0
- package/dist/reserved-area.js.map +1 -0
- package/dist/styleflow.d.ts +18 -1
- package/dist/styleflow.d.ts.map +1 -1
- package/dist/styleflow.js +82 -11
- package/dist/styleflow.js.map +1 -1
- package/dist/svg-media-runtime.d.ts +3 -0
- package/dist/svg-media-runtime.d.ts.map +1 -0
- package/dist/svg-media-runtime.js +33 -0
- package/dist/svg-media-runtime.js.map +1 -0
- package/dist/svg-media-types.d.ts +11 -0
- package/dist/svg-media-types.d.ts.map +1 -0
- package/dist/svg-media-types.js +2 -0
- package/dist/svg-media-types.js.map +1 -0
- package/dist/svg-media.d.ts +10 -0
- package/dist/svg-media.d.ts.map +1 -0
- package/dist/svg-media.js +34 -0
- package/dist/svg-media.js.map +1 -0
- package/dist/templates.d.ts +16 -16
- package/dist/text.d.ts +3 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +6 -0
- package/dist/text.js.map +1 -0
- package/dist/theme-runtime.d.ts +16 -0
- package/dist/theme-runtime.d.ts.map +1 -0
- package/dist/theme-runtime.js +100 -0
- package/dist/theme-runtime.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +84 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vivid-colors-preference.d.ts +31 -0
- package/dist/vivid-colors-preference.d.ts.map +1 -0
- package/dist/vivid-colors-preference.js +102 -0
- package/dist/vivid-colors-preference.js.map +1 -0
- package/package.json +53 -4
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
2
|
+
import "./native/inline-text.css";
|
|
3
|
+
import { registerFlowpressSvgMedia, type FlowpressSvgMediaLocals } from "../svg-media.js";
|
|
4
|
+
import Media from "./Media.astro";
|
|
5
|
+
import { decodeFlowpressText } from "../text.js";
|
|
6
|
+
import "./native/grid.css";
|
|
7
|
+
import "./native/group.css";
|
|
8
|
+
import StyleflowElement from "./StyleflowElement.astro";
|
|
3
9
|
import type {
|
|
10
|
+
FlowpressBlockAdapters,
|
|
4
11
|
FlowpressBlockRenderers,
|
|
5
12
|
FlowpressIconRenderer
|
|
6
13
|
} from "../block-renderers.js";
|
|
14
|
+
import {
|
|
15
|
+
flowpressAdapterCompatibilityIssue,
|
|
16
|
+
flowpressBlockTypeDescriptors
|
|
17
|
+
} from "../composition.js";
|
|
7
18
|
import type { StyleflowContract } from "../styleflow.js";
|
|
8
|
-
import type {
|
|
19
|
+
import type {
|
|
20
|
+
FlowpressBlock,
|
|
21
|
+
FlowpressBlockHtmlProps,
|
|
22
|
+
FlowpressCompositionV1,
|
|
23
|
+
FlowpressBlockTypeDescriptor
|
|
24
|
+
} from "../types.js";
|
|
25
|
+
import type { DynamicStyleflowProps } from "../styleflow.js";
|
|
9
26
|
import ColumnBlock from "./blocks/ColumnBlock.astro";
|
|
10
27
|
import CarouselBlock from "./blocks/CarouselBlock.astro";
|
|
11
28
|
import CarouselItemBlock from "./blocks/CarouselItemBlock.astro";
|
|
29
|
+
import CoverBlock from "./blocks/CoverBlock.astro";
|
|
12
30
|
import FormBlock from "./blocks/FormBlock.astro";
|
|
13
31
|
import GridBlock from "./blocks/GridBlock.astro";
|
|
14
32
|
import HeroBlock from "./blocks/HeroBlock.astro";
|
|
@@ -26,12 +44,51 @@ import {
|
|
|
26
44
|
|
|
27
45
|
interface Props {
|
|
28
46
|
blocks: FlowpressBlock[];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
descriptorIndex?: ReadonlyMap<string, FlowpressBlockTypeDescriptor> | undefined;
|
|
48
|
+
contract?: StyleflowContract | undefined;
|
|
49
|
+
blockRenderers?: FlowpressBlockRenderers | undefined;
|
|
50
|
+
iconRenderer?: FlowpressIconRenderer | undefined;
|
|
51
|
+
rootHtmlProps?: FlowpressBlockHtmlProps | undefined;
|
|
52
|
+
rootStyleflowProps?: DynamicStyleflowProps | undefined;
|
|
53
|
+
adapterDefinitions?: FlowpressBlockAdapters | undefined;
|
|
54
|
+
composition?: FlowpressCompositionV1 | undefined;
|
|
55
|
+
parentBlockName?: string | undefined;
|
|
56
|
+
production?: boolean | undefined;
|
|
57
|
+
depth?: number | undefined;
|
|
58
|
+
inheritedTone?: string | undefined;
|
|
59
|
+
skipCustomRendererFor?: string | undefined;
|
|
60
|
+
requireRegisteredAdapters?: boolean | undefined;
|
|
61
|
+
interactiveAncestor?: boolean | undefined;
|
|
32
62
|
}
|
|
33
63
|
|
|
34
|
-
const {
|
|
64
|
+
const {
|
|
65
|
+
blocks: rawBlocks,
|
|
66
|
+
contract,
|
|
67
|
+
blockRenderers = {},
|
|
68
|
+
iconRenderer: IconRenderer,
|
|
69
|
+
rootHtmlProps,
|
|
70
|
+
rootStyleflowProps,
|
|
71
|
+
adapterDefinitions,
|
|
72
|
+
composition,
|
|
73
|
+
parentBlockName,
|
|
74
|
+
production = import.meta.env.PROD,
|
|
75
|
+
depth = 0,
|
|
76
|
+
inheritedTone,
|
|
77
|
+
skipCustomRendererFor,
|
|
78
|
+
interactiveAncestor = false,
|
|
79
|
+
requireRegisteredAdapters = false
|
|
80
|
+
} = Astro.props;
|
|
81
|
+
registerFlowpressSvgMedia(rawBlocks, Astro.locals as FlowpressSvgMediaLocals);
|
|
82
|
+
|
|
83
|
+
const { decorateGridBlocks } = await import("./native/grid.js");
|
|
84
|
+
const blocks = decorateGridBlocks(rawBlocks);
|
|
85
|
+
const { nativeBlockRenderers } = await import("./native/registry.js");
|
|
86
|
+
const effectiveRenderers = { ...nativeBlockRenderers, ...blockRenderers };
|
|
87
|
+
const descriptors = Astro.props.descriptorIndex ?? (composition ? flowpressBlockTypeDescriptors(composition) : undefined);
|
|
88
|
+
|
|
89
|
+
function objectCollection(value: unknown): Record<string, unknown>[] {
|
|
90
|
+
return Array.isArray(value) ? value.filter((item): item is Record<string, unknown> => !!item && typeof item === "object") : [];
|
|
91
|
+
}
|
|
35
92
|
|
|
36
93
|
function youtubeEmbedUrl(value: unknown): string | null {
|
|
37
94
|
try {
|
|
@@ -49,36 +106,111 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
49
106
|
return null;
|
|
50
107
|
}
|
|
51
108
|
}
|
|
109
|
+
|
|
110
|
+
function nestedRendererProps(nextParentBlockName: string, attrs: Record<string, unknown> = {}) {
|
|
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,
|
|
114
|
+
adapterDefinitions,
|
|
115
|
+
composition,
|
|
116
|
+
parentBlockName: nextParentBlockName,
|
|
117
|
+
production,
|
|
118
|
+
depth: depth + 1,
|
|
119
|
+
requireRegisteredAdapters
|
|
120
|
+
};
|
|
121
|
+
}
|
|
52
122
|
---
|
|
53
123
|
|
|
54
|
-
{blocks.map((block) => {
|
|
124
|
+
{blocks.map((block, index) => {
|
|
55
125
|
const name = block.name.replace(/^sf\//, "");
|
|
56
|
-
const children = block.innerBlocks ?? [];
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
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"}};
|
|
128
|
+
const semantic = index === 0 && blocks.length === 1 && rootStyleflowProps
|
|
129
|
+
? rootStyleflowProps
|
|
130
|
+
: semanticProps(block.attributes, contract, undefined, inheritedTone);
|
|
131
|
+
const htmlAttributes = index === 0 && blocks.length === 1 && rootHtmlProps
|
|
132
|
+
? { ...rootHtmlProps, class: Array.from(new Set([rootHtmlProps.class, block.attributes.className].filter(Boolean).join(" ").split(/\s+/))).join(" ") }
|
|
133
|
+
: blockHtmlAttributes(block.attributes);
|
|
134
|
+
const CustomBlockRenderer = block.name === skipCustomRendererFor
|
|
135
|
+
? nativeBlockRenderers[block.name as keyof typeof nativeBlockRenderers]
|
|
136
|
+
: effectiveRenderers[block.name as keyof typeof effectiveRenderers];
|
|
137
|
+
const compatibilityIssue = descriptors && adapterDefinitions
|
|
138
|
+
? flowpressAdapterCompatibilityIssue(block.name, descriptors, adapterDefinitions)
|
|
139
|
+
: null;
|
|
140
|
+
|
|
141
|
+
if (compatibilityIssue && production && block.name !== skipCustomRendererFor) {
|
|
142
|
+
throw new Error(compatibilityIssue.message);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (
|
|
146
|
+
requireRegisteredAdapters
|
|
147
|
+
&& block.name !== skipCustomRendererFor
|
|
148
|
+
&& (!adapterDefinitions?.[block.name] || !CustomBlockRenderer)
|
|
149
|
+
) {
|
|
150
|
+
const message = compatibilityIssue?.message
|
|
151
|
+
?? `Missing FlowPress block adapter for "${block.name}".`;
|
|
152
|
+
if (production) throw new Error(message);
|
|
153
|
+
return (
|
|
154
|
+
<aside data-flowpress-compatibility="missing-adapter" data-block-name={block.name} role="status">
|
|
155
|
+
<strong>{message}</strong>
|
|
156
|
+
<code>{compatibilityIssue?.command ?? `pnpm cms:block-adapter ${block.name}`}</code>
|
|
157
|
+
</aside>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
60
160
|
|
|
61
161
|
if (CustomBlockRenderer) {
|
|
62
162
|
return (
|
|
63
|
-
|
|
64
|
-
|
|
163
|
+
<>
|
|
164
|
+
{compatibilityIssue ? (
|
|
165
|
+
<aside data-flowpress-compatibility={compatibilityIssue.code} data-block-name={block.name} role="status">
|
|
166
|
+
<strong>{compatibilityIssue.message}</strong>
|
|
167
|
+
<code>{compatibilityIssue.command}</code>
|
|
168
|
+
</aside>
|
|
169
|
+
) : null}
|
|
170
|
+
<CustomBlockRenderer
|
|
171
|
+
block={block}
|
|
172
|
+
contract={contract}
|
|
173
|
+
composition={composition}
|
|
174
|
+
adapters={adapterDefinitions ?? {}}
|
|
175
|
+
htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
|
|
176
|
+
styleflowProps={semantic}
|
|
177
|
+
parentBlockName={parentBlockName}
|
|
178
|
+
context={{
|
|
179
|
+
...(parentBlockName ? { parentBlockName } : {}),
|
|
180
|
+
depth,
|
|
181
|
+
production,
|
|
182
|
+
inheritedTone,
|
|
183
|
+
effectiveTone: typeof semantic.tone === "string" ? semantic.tone : inheritedTone
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<Astro.self descriptorIndex={descriptors}
|
|
65
187
|
blocks={children}
|
|
66
188
|
contract={contract}
|
|
67
189
|
blockRenderers={blockRenderers}
|
|
68
190
|
iconRenderer={IconRenderer}
|
|
191
|
+
adapterDefinitions={adapterDefinitions}
|
|
192
|
+
composition={composition}
|
|
193
|
+
parentBlockName={block.name}
|
|
194
|
+
production={production}
|
|
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)))}
|
|
198
|
+
requireRegisteredAdapters={requireRegisteredAdapters}
|
|
69
199
|
/>
|
|
70
200
|
</CustomBlockRenderer>
|
|
201
|
+
</>
|
|
71
202
|
);
|
|
72
203
|
}
|
|
73
204
|
|
|
74
205
|
if (name === "hero") {
|
|
75
206
|
return (
|
|
76
207
|
<HeroBlock block={block} contract={contract}>
|
|
77
|
-
<Astro.self
|
|
208
|
+
<Astro.self descriptorIndex={descriptors}
|
|
78
209
|
blocks={children}
|
|
79
210
|
contract={contract}
|
|
80
211
|
blockRenderers={blockRenderers}
|
|
81
212
|
iconRenderer={IconRenderer}
|
|
213
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
82
214
|
/>
|
|
83
215
|
</HeroBlock>
|
|
84
216
|
);
|
|
@@ -87,11 +219,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
87
219
|
if (name === "grid") {
|
|
88
220
|
return (
|
|
89
221
|
<GridBlock block={block} contract={contract}>
|
|
90
|
-
<Astro.self
|
|
222
|
+
<Astro.self descriptorIndex={descriptors}
|
|
91
223
|
blocks={children}
|
|
92
224
|
contract={contract}
|
|
93
225
|
blockRenderers={blockRenderers}
|
|
94
226
|
iconRenderer={IconRenderer}
|
|
227
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
95
228
|
/>
|
|
96
229
|
</GridBlock>
|
|
97
230
|
);
|
|
@@ -100,11 +233,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
100
233
|
if (name === "column") {
|
|
101
234
|
return (
|
|
102
235
|
<ColumnBlock block={block} contract={contract}>
|
|
103
|
-
<Astro.self
|
|
236
|
+
<Astro.self descriptorIndex={descriptors}
|
|
104
237
|
blocks={children}
|
|
105
238
|
contract={contract}
|
|
106
239
|
blockRenderers={blockRenderers}
|
|
107
240
|
iconRenderer={IconRenderer}
|
|
241
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
108
242
|
/>
|
|
109
243
|
</ColumnBlock>
|
|
110
244
|
);
|
|
@@ -121,11 +255,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
121
255
|
validChildren={invalidChildNames.length === 0}
|
|
122
256
|
invalidChildNames={invalidChildNames}
|
|
123
257
|
>
|
|
124
|
-
<Astro.self
|
|
258
|
+
<Astro.self descriptorIndex={descriptors}
|
|
125
259
|
blocks={children}
|
|
126
260
|
contract={contract}
|
|
127
261
|
blockRenderers={blockRenderers}
|
|
128
262
|
iconRenderer={IconRenderer}
|
|
263
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
129
264
|
/>
|
|
130
265
|
</CarouselBlock>
|
|
131
266
|
);
|
|
@@ -134,11 +269,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
134
269
|
if (name === "carousel-item") {
|
|
135
270
|
return (
|
|
136
271
|
<CarouselItemBlock block={block} contract={contract}>
|
|
137
|
-
<Astro.self
|
|
272
|
+
<Astro.self descriptorIndex={descriptors}
|
|
138
273
|
blocks={children}
|
|
139
274
|
contract={contract}
|
|
140
275
|
blockRenderers={blockRenderers}
|
|
141
276
|
iconRenderer={IconRenderer}
|
|
277
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
142
278
|
/>
|
|
143
279
|
</CarouselItemBlock>
|
|
144
280
|
);
|
|
@@ -148,6 +284,25 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
148
284
|
return <NumberSpinnerBlock block={block} contract={contract} />;
|
|
149
285
|
}
|
|
150
286
|
|
|
287
|
+
if (block.name === "core/cover") {
|
|
288
|
+
return (
|
|
289
|
+
<CoverBlock
|
|
290
|
+
block={block}
|
|
291
|
+
contract={contract}
|
|
292
|
+
htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
|
|
293
|
+
styleflowProps={semantic}
|
|
294
|
+
>
|
|
295
|
+
<Astro.self descriptorIndex={descriptors}
|
|
296
|
+
blocks={children}
|
|
297
|
+
contract={contract}
|
|
298
|
+
blockRenderers={blockRenderers}
|
|
299
|
+
iconRenderer={IconRenderer}
|
|
300
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
301
|
+
/>
|
|
302
|
+
</CoverBlock>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
151
306
|
if ([
|
|
152
307
|
"heading",
|
|
153
308
|
"rich-text",
|
|
@@ -160,18 +315,19 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
160
315
|
].includes(name)) {
|
|
161
316
|
return (
|
|
162
317
|
<TextBlock block={block} contract={contract} hasChildren={children.length > 0}>
|
|
163
|
-
<Astro.self
|
|
318
|
+
<Astro.self descriptorIndex={descriptors}
|
|
164
319
|
blocks={children}
|
|
165
320
|
contract={contract}
|
|
166
321
|
blockRenderers={blockRenderers}
|
|
167
322
|
iconRenderer={IconRenderer}
|
|
323
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
168
324
|
/>
|
|
169
325
|
</TextBlock>
|
|
170
326
|
);
|
|
171
327
|
}
|
|
172
328
|
|
|
173
329
|
if (name === "button") {
|
|
174
|
-
const href = linkValue(block, "href")
|
|
330
|
+
const href = linkValue(block, "href");
|
|
175
331
|
const link = objectValue(block, "href");
|
|
176
332
|
const opensInNewTab = Boolean(link.opensInNewTab);
|
|
177
333
|
const icon = String(block.attributes.icon ?? "").trim();
|
|
@@ -185,19 +341,32 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
185
341
|
const buttonIcon = IconRenderer && icon ? (
|
|
186
342
|
<IconRenderer name={icon} display="inline" size={4} />
|
|
187
343
|
) : null;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
344
|
+
const buttonContent = (
|
|
345
|
+
<>
|
|
346
|
+
{iconPosition === "before" ? buttonIcon : null}
|
|
347
|
+
{decodeFlowpressText(textValue(block, "label"))}
|
|
348
|
+
{iconPosition === "after" ? buttonIcon : null}
|
|
349
|
+
</>
|
|
350
|
+
);
|
|
351
|
+
return href ? (
|
|
352
|
+
<StyleflowElement as="a"
|
|
191
353
|
href={href}
|
|
192
354
|
target={opensInNewTab ? "_blank" : undefined}
|
|
193
355
|
rel={opensInNewTab ? "noopener noreferrer" : undefined}
|
|
194
356
|
{...buttonSemantic}
|
|
195
357
|
{...htmlAttributes}
|
|
196
358
|
>
|
|
197
|
-
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
359
|
+
{buttonContent}
|
|
360
|
+
</StyleflowElement>
|
|
361
|
+
) : (
|
|
362
|
+
<StyleflowElement as="span"
|
|
363
|
+
aria-disabled="true"
|
|
364
|
+
data-flowpress-link-unresolved
|
|
365
|
+
{...buttonSemantic}
|
|
366
|
+
{...htmlAttributes}
|
|
367
|
+
>
|
|
368
|
+
{buttonContent}
|
|
369
|
+
</StyleflowElement>
|
|
201
370
|
);
|
|
202
371
|
}
|
|
203
372
|
|
|
@@ -218,7 +387,7 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
218
387
|
name={icon}
|
|
219
388
|
display={display}
|
|
220
389
|
size={size}
|
|
221
|
-
label={
|
|
390
|
+
label={decodeFlowpressText(block.attributes.label).trim() || undefined}
|
|
222
391
|
{...iconSemantic}
|
|
223
392
|
{...htmlAttributes}
|
|
224
393
|
/>
|
|
@@ -241,19 +410,19 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
241
410
|
|
|
242
411
|
if (name === "gallery") {
|
|
243
412
|
const images = Array.isArray(block.attributes.images)
|
|
244
|
-
? block.attributes.images
|
|
413
|
+
? objectCollection(block.attributes.images)
|
|
245
414
|
: [];
|
|
246
415
|
return (
|
|
247
|
-
<
|
|
416
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
248
417
|
{images.map((image) => image.url ? (
|
|
249
|
-
<
|
|
418
|
+
<Media
|
|
250
419
|
src={String(image.url)}
|
|
251
|
-
alt={
|
|
420
|
+
alt={decodeFlowpressText(image.alt)}
|
|
252
421
|
loading="lazy"
|
|
253
422
|
decoding="async"
|
|
254
423
|
/>
|
|
255
424
|
) : null)}
|
|
256
|
-
</
|
|
425
|
+
</StyleflowElement>
|
|
257
426
|
);
|
|
258
427
|
}
|
|
259
428
|
|
|
@@ -261,7 +430,7 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
261
430
|
const video = objectValue(block, "video");
|
|
262
431
|
const poster = objectValue(block, "poster");
|
|
263
432
|
return video.url ? (
|
|
264
|
-
<
|
|
433
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
265
434
|
<video
|
|
266
435
|
src={String(video.url)}
|
|
267
436
|
poster={poster.url ? String(poster.url) : undefined}
|
|
@@ -270,30 +439,43 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
270
439
|
muted={Boolean(block.attributes.autoplay)}
|
|
271
440
|
playsinline
|
|
272
441
|
/>
|
|
273
|
-
</
|
|
442
|
+
</StyleflowElement>
|
|
274
443
|
) : null;
|
|
275
444
|
}
|
|
276
445
|
|
|
277
446
|
if (name === "video-youtube") {
|
|
278
447
|
const embed = youtubeEmbedUrl(block.attributes.url);
|
|
279
448
|
return embed ? (
|
|
280
|
-
<
|
|
449
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
281
450
|
<iframe
|
|
282
451
|
src={embed}
|
|
283
|
-
title={
|
|
452
|
+
title={decodeFlowpressText(block.attributes.title ?? "YouTube video")}
|
|
284
453
|
loading="lazy"
|
|
285
454
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
286
455
|
allowfullscreen
|
|
287
456
|
/>
|
|
288
|
-
</
|
|
457
|
+
</StyleflowElement>
|
|
289
458
|
) : null;
|
|
290
459
|
}
|
|
291
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
|
+
|
|
292
474
|
if (name === "chip") {
|
|
293
475
|
return (
|
|
294
|
-
<
|
|
295
|
-
{textValue(block, "label")}
|
|
296
|
-
</
|
|
476
|
+
<StyleflowElement as="span" {...semantic} {...htmlAttributes}>
|
|
477
|
+
{decodeFlowpressText(textValue(block, "label"))}
|
|
478
|
+
</StyleflowElement>
|
|
297
479
|
);
|
|
298
480
|
}
|
|
299
481
|
|
|
@@ -301,60 +483,63 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
301
483
|
const media = objectValue(block, "image");
|
|
302
484
|
const href = linkValue(block);
|
|
303
485
|
return (
|
|
304
|
-
<
|
|
486
|
+
<StyleflowElement as="article" {...semantic} {...htmlAttributes}>
|
|
305
487
|
{media.url && (
|
|
306
|
-
<
|
|
488
|
+
<Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} loading="lazy" />
|
|
307
489
|
)}
|
|
308
|
-
{block.attributes.title && <
|
|
309
|
-
{block.attributes.text && <
|
|
310
|
-
{href && <
|
|
311
|
-
</
|
|
490
|
+
{block.attributes.title && <StyleflowElement as="h3">{decodeFlowpressText(block.attributes.title)}</StyleflowElement>}
|
|
491
|
+
{block.attributes.text && <StyleflowElement as="p">{decodeFlowpressText(block.attributes.text)}</StyleflowElement>}
|
|
492
|
+
{href && <StyleflowElement as="a" href={href}>Scopri</StyleflowElement>}
|
|
493
|
+
</StyleflowElement>
|
|
312
494
|
);
|
|
313
495
|
}
|
|
314
496
|
|
|
315
497
|
if (name === "content-list" || name === "term-list") {
|
|
316
498
|
const items = Array.isArray(block.attributes.resolvedItems)
|
|
317
|
-
? block.attributes.resolvedItems
|
|
499
|
+
? objectCollection(block.attributes.resolvedItems)
|
|
318
500
|
: [];
|
|
319
501
|
const resolvedBlocks = Array.isArray(block.attributes.resolvedBlocks)
|
|
320
502
|
? block.attributes.resolvedBlocks as FlowpressBlock[][]
|
|
321
503
|
: [];
|
|
322
504
|
return (
|
|
323
|
-
<
|
|
505
|
+
<StyleflowElement as="ul" {...semantic} {...htmlAttributes}>
|
|
324
506
|
{items.map((item, index) => (
|
|
325
|
-
<
|
|
507
|
+
<StyleflowElement as="li">
|
|
326
508
|
{resolvedBlocks[index]?.length ? (
|
|
327
|
-
<Astro.self
|
|
509
|
+
<Astro.self descriptorIndex={descriptors}
|
|
328
510
|
blocks={resolvedBlocks[index]}
|
|
329
511
|
contract={contract}
|
|
330
512
|
blockRenderers={blockRenderers}
|
|
331
513
|
iconRenderer={IconRenderer}
|
|
514
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
332
515
|
/>
|
|
333
516
|
) : (
|
|
334
517
|
<ListItemFallback item={item} />
|
|
335
518
|
)}
|
|
336
|
-
</
|
|
519
|
+
</StyleflowElement>
|
|
337
520
|
))}
|
|
338
|
-
</
|
|
521
|
+
</StyleflowElement>
|
|
339
522
|
);
|
|
340
523
|
}
|
|
341
524
|
|
|
342
525
|
if (name === "template") {
|
|
343
526
|
return Object.keys(htmlAttributes).length > 0 ? (
|
|
344
527
|
<div {...htmlAttributes}>
|
|
345
|
-
<Astro.self
|
|
528
|
+
<Astro.self descriptorIndex={descriptors}
|
|
346
529
|
blocks={children}
|
|
347
530
|
contract={contract}
|
|
348
531
|
blockRenderers={blockRenderers}
|
|
349
532
|
iconRenderer={IconRenderer}
|
|
533
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
350
534
|
/>
|
|
351
535
|
</div>
|
|
352
536
|
) : (
|
|
353
|
-
<Astro.self
|
|
537
|
+
<Astro.self descriptorIndex={descriptors}
|
|
354
538
|
blocks={children}
|
|
355
539
|
contract={contract}
|
|
356
540
|
blockRenderers={blockRenderers}
|
|
357
541
|
iconRenderer={IconRenderer}
|
|
542
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
358
543
|
/>
|
|
359
544
|
);
|
|
360
545
|
}
|
|
@@ -365,17 +550,18 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
365
550
|
|
|
366
551
|
if (name === "accordion-item") {
|
|
367
552
|
return (
|
|
368
|
-
<
|
|
553
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
369
554
|
<details>
|
|
370
|
-
<summary>{
|
|
371
|
-
<Astro.self
|
|
555
|
+
<summary>{decodeFlowpressText(block.attributes.title)}</summary>
|
|
556
|
+
<Astro.self descriptorIndex={descriptors}
|
|
372
557
|
blocks={children}
|
|
373
558
|
contract={contract}
|
|
374
559
|
blockRenderers={blockRenderers}
|
|
375
560
|
iconRenderer={IconRenderer}
|
|
561
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
376
562
|
/>
|
|
377
563
|
</details>
|
|
378
|
-
</
|
|
564
|
+
</StyleflowElement>
|
|
379
565
|
);
|
|
380
566
|
}
|
|
381
567
|
|
|
@@ -396,42 +582,55 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
396
582
|
+ `?key=${encodeURIComponent(googleMapsApiKey)}`
|
|
397
583
|
+ `&q=${encodeURIComponent(query)}`;
|
|
398
584
|
return (
|
|
399
|
-
<
|
|
585
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
400
586
|
<iframe
|
|
401
587
|
src={source}
|
|
402
588
|
title={address || "Map"}
|
|
403
589
|
loading="lazy"
|
|
404
590
|
referrerpolicy="no-referrer-when-downgrade"
|
|
405
591
|
/>
|
|
406
|
-
</
|
|
592
|
+
</StyleflowElement>
|
|
407
593
|
);
|
|
408
594
|
}
|
|
409
595
|
return query ? (
|
|
410
|
-
<
|
|
411
|
-
<
|
|
412
|
-
as="a"
|
|
596
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
597
|
+
<StyleflowElement as="a"
|
|
413
598
|
href={`https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`}
|
|
414
599
|
rel="noreferrer"
|
|
415
600
|
>
|
|
416
|
-
{address || query}
|
|
417
|
-
</
|
|
418
|
-
</
|
|
601
|
+
{decodeFlowpressText(address || query)}
|
|
602
|
+
</StyleflowElement>
|
|
603
|
+
</StyleflowElement>
|
|
419
604
|
) : null;
|
|
420
605
|
}
|
|
421
606
|
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
607
|
+
const fallbackContent = block.innerHtml && children.length === 0
|
|
608
|
+
? <StyleflowElement as="div" set:html={block.innerHtml} />
|
|
609
|
+
: (
|
|
610
|
+
<Astro.self descriptorIndex={descriptors}
|
|
611
|
+
blocks={children}
|
|
612
|
+
contract={contract}
|
|
613
|
+
blockRenderers={blockRenderers}
|
|
614
|
+
iconRenderer={IconRenderer}
|
|
615
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
616
|
+
/>
|
|
617
|
+
);
|
|
618
|
+
return name === "section" ? (
|
|
619
|
+
<StyleflowElement as="section" {...semantic} {...htmlAttributes}>{fallbackContent}</StyleflowElement>
|
|
620
|
+
) : (
|
|
621
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>{fallbackContent}</StyleflowElement>
|
|
436
622
|
);
|
|
437
623
|
})}
|
|
624
|
+
|
|
625
|
+
<script>
|
|
626
|
+
import "./native/grid-bleed.js";
|
|
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>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "./native/inline-text.css";
|
|
3
|
+
import { decodeFlowpressText } from "../text.js";
|
|
4
|
+
import { resolveStyleFlowAstroPrimitive } from "@styleflow.app/astro";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
as: string;
|
|
8
|
+
[attribute: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
const props = { ...Astro.props } as Props;
|
|
11
|
+
for (const key of ["ty", "v", "w"]) {
|
|
12
|
+
if (props[key] === "" || props[key] === null) delete props[key];
|
|
13
|
+
}
|
|
14
|
+
for (const name of ["alt", "title", "aria-label", "placeholder"]) {
|
|
15
|
+
if (typeof props[name] === "string") props[name] = decodeFlowpressText(props[name]);
|
|
16
|
+
}
|
|
17
|
+
const { tag, attributes } = resolveStyleFlowAstroPrimitive(props);
|
|
18
|
+
if (["ty", "v", "w"].every((key) => props[key] === undefined)) {
|
|
19
|
+
for (const name of ["type", "variant", "weight", "style"]) delete attributes[`data-text-${name}`];
|
|
20
|
+
}
|
|
21
|
+
const Element = tag;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<Element {...attributes}><slot /></Element>
|