@styleflow.app/flowpress-astro-core 1.0.0-beta.4 → 1.0.0-beta.41
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 +249 -1
- package/README.md +104 -5
- 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 +37 -0
- package/dist/astro/FontStylesheets.astro +35 -0
- package/dist/astro/GutenbergRenderer.astro +267 -80
- package/dist/astro/Media.astro +27 -0
- package/dist/astro/StyleflowElement.astro +25 -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 +158 -0
- package/dist/astro/blocks/FormBlock.astro +23 -20
- package/dist/astro/blocks/GridBlock.astro +5 -4
- package/dist/astro/blocks/HeroBlock.astro +6 -6
- package/dist/astro/blocks/ImageBlock.astro +6 -6
- package/dist/astro/blocks/ListItemFallback.astro +9 -7
- 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 +55 -39
- package/dist/astro/blocks/helpers.js.map +1 -1
- package/dist/astro/blocks/helpers.ts +69 -44
- 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/block-sizing.css +34 -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 +137 -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 +40 -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 +18 -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/image.d.ts +5 -0
- package/dist/astro/native/image.d.ts.map +1 -0
- package/dist/astro/native/image.js +65 -0
- package/dist/astro/native/image.js.map +1 -0
- package/dist/astro/native/image.ts +56 -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 +81 -0
- package/dist/astro/native/registry.js.map +1 -0
- package/dist/astro/native/registry.ts +82 -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 +23 -3
- package/dist/block-renderers.d.ts.map +1 -1
- package/dist/block-renderers.js.map +1 -1
- package/dist/build-cache.d.ts +8 -0
- package/dist/build-cache.d.ts.map +1 -0
- package/dist/build-cache.js +81 -0
- package/dist/build-cache.js.map +1 -0
- package/dist/client.d.ts +23 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +78 -39
- 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 +117 -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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +20 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +106 -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 +13 -0
- package/dist/svg-media.d.ts.map +1 -0
- package/dist/svg-media.js +47 -0
- package/dist/svg-media.js.map +1 -0
- package/dist/template-hierarchy.d.ts +0 -7
- package/dist/template-hierarchy.d.ts.map +1 -1
- package/dist/template-hierarchy.js +0 -21
- package/dist/template-hierarchy.js.map +1 -1
- 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 +75 -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 +58 -7
- package/dist/astro/DefaultTemplate.astro +0 -42
- package/dist/templates.d.ts +0 -19
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js +0 -20
- package/dist/templates.js.map +0 -1
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
2
|
+
import "./native/inline-text.css";
|
|
3
|
+
import { registerFlowpressRenderSvgMedia, 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
|
+
registerFlowpressRenderSvgMedia(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,114 @@ 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,
|
|
131
|
+
block.name.startsWith("core/") && block.name !== "core/group" ? {} : undefined,
|
|
132
|
+
inheritedTone);
|
|
133
|
+
const htmlAttributes = index === 0 && blocks.length === 1 && rootHtmlProps
|
|
134
|
+
? { ...rootHtmlProps, class: Array.from(new Set([rootHtmlProps.class, block.attributes.className].filter(Boolean).join(" ").split(/\s+/))).join(" ") }
|
|
135
|
+
: blockHtmlAttributes(block.attributes);
|
|
136
|
+
const CustomBlockRenderer = block.name === skipCustomRendererFor
|
|
137
|
+
? nativeBlockRenderers[block.name as keyof typeof nativeBlockRenderers]
|
|
138
|
+
: effectiveRenderers[block.name as keyof typeof effectiveRenderers];
|
|
139
|
+
const compatibilityIssue = descriptors && adapterDefinitions
|
|
140
|
+
? flowpressAdapterCompatibilityIssue(block.name, descriptors, adapterDefinitions)
|
|
141
|
+
: null;
|
|
142
|
+
|
|
143
|
+
if (compatibilityIssue && production && block.name !== skipCustomRendererFor) {
|
|
144
|
+
throw new Error(compatibilityIssue.message);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (
|
|
148
|
+
requireRegisteredAdapters
|
|
149
|
+
&& block.name !== skipCustomRendererFor
|
|
150
|
+
&& (!adapterDefinitions?.[block.name] || !CustomBlockRenderer)
|
|
151
|
+
) {
|
|
152
|
+
const message = compatibilityIssue?.message
|
|
153
|
+
?? `Missing FlowPress block adapter for "${block.name}".`;
|
|
154
|
+
if (production) throw new Error(message);
|
|
155
|
+
return (
|
|
156
|
+
<aside data-flowpress-compatibility="missing-adapter" data-block-name={block.name} role="status">
|
|
157
|
+
<strong>{message}</strong>
|
|
158
|
+
<code>{compatibilityIssue?.command ?? `pnpm cms:block-adapter ${block.name}`}</code>
|
|
159
|
+
</aside>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
60
162
|
|
|
61
163
|
if (CustomBlockRenderer) {
|
|
62
164
|
return (
|
|
63
|
-
|
|
64
|
-
|
|
165
|
+
<>
|
|
166
|
+
{compatibilityIssue ? (
|
|
167
|
+
<aside data-flowpress-compatibility={compatibilityIssue.code} data-block-name={block.name} role="status">
|
|
168
|
+
<strong>{compatibilityIssue.message}</strong>
|
|
169
|
+
<code>{compatibilityIssue.command}</code>
|
|
170
|
+
</aside>
|
|
171
|
+
) : null}
|
|
172
|
+
<CustomBlockRenderer
|
|
173
|
+
block={block}
|
|
174
|
+
contract={contract}
|
|
175
|
+
composition={composition}
|
|
176
|
+
adapters={adapterDefinitions ?? {}}
|
|
177
|
+
htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
|
|
178
|
+
styleflowProps={semantic}
|
|
179
|
+
parentBlockName={parentBlockName}
|
|
180
|
+
context={{
|
|
181
|
+
...(parentBlockName ? { parentBlockName } : {}),
|
|
182
|
+
depth,
|
|
183
|
+
production,
|
|
184
|
+
blockRenderers,
|
|
185
|
+
inheritedTone,
|
|
186
|
+
effectiveTone: typeof semantic.tone === "string" ? semantic.tone : inheritedTone
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
<Astro.self descriptorIndex={descriptors}
|
|
65
190
|
blocks={children}
|
|
66
191
|
contract={contract}
|
|
67
192
|
blockRenderers={blockRenderers}
|
|
68
193
|
iconRenderer={IconRenderer}
|
|
194
|
+
adapterDefinitions={adapterDefinitions}
|
|
195
|
+
composition={composition}
|
|
196
|
+
parentBlockName={block.name}
|
|
197
|
+
production={production}
|
|
198
|
+
depth={depth + 1}
|
|
199
|
+
inheritedTone={typeof semantic.tone === "string" ? semantic.tone : inheritedTone}
|
|
200
|
+
interactiveAncestor={interactiveAncestor || Boolean(block.attributes.interactivePriority && !["none", "inherit"].includes(String(block.attributes.interactivePriority)))}
|
|
201
|
+
requireRegisteredAdapters={requireRegisteredAdapters}
|
|
69
202
|
/>
|
|
70
203
|
</CustomBlockRenderer>
|
|
204
|
+
</>
|
|
71
205
|
);
|
|
72
206
|
}
|
|
73
207
|
|
|
74
208
|
if (name === "hero") {
|
|
75
209
|
return (
|
|
76
210
|
<HeroBlock block={block} contract={contract}>
|
|
77
|
-
<Astro.self
|
|
211
|
+
<Astro.self descriptorIndex={descriptors}
|
|
78
212
|
blocks={children}
|
|
79
213
|
contract={contract}
|
|
80
214
|
blockRenderers={blockRenderers}
|
|
81
215
|
iconRenderer={IconRenderer}
|
|
216
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
82
217
|
/>
|
|
83
218
|
</HeroBlock>
|
|
84
219
|
);
|
|
@@ -87,11 +222,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
87
222
|
if (name === "grid") {
|
|
88
223
|
return (
|
|
89
224
|
<GridBlock block={block} contract={contract}>
|
|
90
|
-
<Astro.self
|
|
225
|
+
<Astro.self descriptorIndex={descriptors}
|
|
91
226
|
blocks={children}
|
|
92
227
|
contract={contract}
|
|
93
228
|
blockRenderers={blockRenderers}
|
|
94
229
|
iconRenderer={IconRenderer}
|
|
230
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
95
231
|
/>
|
|
96
232
|
</GridBlock>
|
|
97
233
|
);
|
|
@@ -100,11 +236,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
100
236
|
if (name === "column") {
|
|
101
237
|
return (
|
|
102
238
|
<ColumnBlock block={block} contract={contract}>
|
|
103
|
-
<Astro.self
|
|
239
|
+
<Astro.self descriptorIndex={descriptors}
|
|
104
240
|
blocks={children}
|
|
105
241
|
contract={contract}
|
|
106
242
|
blockRenderers={blockRenderers}
|
|
107
243
|
iconRenderer={IconRenderer}
|
|
244
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
108
245
|
/>
|
|
109
246
|
</ColumnBlock>
|
|
110
247
|
);
|
|
@@ -121,11 +258,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
121
258
|
validChildren={invalidChildNames.length === 0}
|
|
122
259
|
invalidChildNames={invalidChildNames}
|
|
123
260
|
>
|
|
124
|
-
<Astro.self
|
|
261
|
+
<Astro.self descriptorIndex={descriptors}
|
|
125
262
|
blocks={children}
|
|
126
263
|
contract={contract}
|
|
127
264
|
blockRenderers={blockRenderers}
|
|
128
265
|
iconRenderer={IconRenderer}
|
|
266
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
129
267
|
/>
|
|
130
268
|
</CarouselBlock>
|
|
131
269
|
);
|
|
@@ -134,11 +272,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
134
272
|
if (name === "carousel-item") {
|
|
135
273
|
return (
|
|
136
274
|
<CarouselItemBlock block={block} contract={contract}>
|
|
137
|
-
<Astro.self
|
|
275
|
+
<Astro.self descriptorIndex={descriptors}
|
|
138
276
|
blocks={children}
|
|
139
277
|
contract={contract}
|
|
140
278
|
blockRenderers={blockRenderers}
|
|
141
279
|
iconRenderer={IconRenderer}
|
|
280
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
142
281
|
/>
|
|
143
282
|
</CarouselItemBlock>
|
|
144
283
|
);
|
|
@@ -148,6 +287,25 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
148
287
|
return <NumberSpinnerBlock block={block} contract={contract} />;
|
|
149
288
|
}
|
|
150
289
|
|
|
290
|
+
if (block.name === "core/cover") {
|
|
291
|
+
return (
|
|
292
|
+
<CoverBlock
|
|
293
|
+
block={block}
|
|
294
|
+
contract={contract}
|
|
295
|
+
htmlProps={Object.fromEntries(Object.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean | undefined] => ["string", "number", "boolean", "undefined"].includes(typeof entry[1])))}
|
|
296
|
+
styleflowProps={semantic}
|
|
297
|
+
>
|
|
298
|
+
<Astro.self descriptorIndex={descriptors}
|
|
299
|
+
blocks={children}
|
|
300
|
+
contract={contract}
|
|
301
|
+
blockRenderers={blockRenderers}
|
|
302
|
+
iconRenderer={IconRenderer}
|
|
303
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
304
|
+
/>
|
|
305
|
+
</CoverBlock>
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
151
309
|
if ([
|
|
152
310
|
"heading",
|
|
153
311
|
"rich-text",
|
|
@@ -160,11 +318,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
160
318
|
].includes(name)) {
|
|
161
319
|
return (
|
|
162
320
|
<TextBlock block={block} contract={contract} hasChildren={children.length > 0}>
|
|
163
|
-
<Astro.self
|
|
321
|
+
<Astro.self descriptorIndex={descriptors}
|
|
164
322
|
blocks={children}
|
|
165
323
|
contract={contract}
|
|
166
324
|
blockRenderers={blockRenderers}
|
|
167
325
|
iconRenderer={IconRenderer}
|
|
326
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
168
327
|
/>
|
|
169
328
|
</TextBlock>
|
|
170
329
|
);
|
|
@@ -188,13 +347,12 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
188
347
|
const buttonContent = (
|
|
189
348
|
<>
|
|
190
349
|
{iconPosition === "before" ? buttonIcon : null}
|
|
191
|
-
{textValue(block, "label")}
|
|
350
|
+
{decodeFlowpressText(textValue(block, "label"))}
|
|
192
351
|
{iconPosition === "after" ? buttonIcon : null}
|
|
193
352
|
</>
|
|
194
353
|
);
|
|
195
354
|
return href ? (
|
|
196
|
-
<
|
|
197
|
-
as="a"
|
|
355
|
+
<StyleflowElement as="a"
|
|
198
356
|
href={href}
|
|
199
357
|
target={opensInNewTab ? "_blank" : undefined}
|
|
200
358
|
rel={opensInNewTab ? "noopener noreferrer" : undefined}
|
|
@@ -202,17 +360,16 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
202
360
|
{...htmlAttributes}
|
|
203
361
|
>
|
|
204
362
|
{buttonContent}
|
|
205
|
-
</
|
|
363
|
+
</StyleflowElement>
|
|
206
364
|
) : (
|
|
207
|
-
<
|
|
208
|
-
as="span"
|
|
365
|
+
<StyleflowElement as="span"
|
|
209
366
|
aria-disabled="true"
|
|
210
367
|
data-flowpress-link-unresolved
|
|
211
368
|
{...buttonSemantic}
|
|
212
369
|
{...htmlAttributes}
|
|
213
370
|
>
|
|
214
371
|
{buttonContent}
|
|
215
|
-
</
|
|
372
|
+
</StyleflowElement>
|
|
216
373
|
);
|
|
217
374
|
}
|
|
218
375
|
|
|
@@ -233,7 +390,7 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
233
390
|
name={icon}
|
|
234
391
|
display={display}
|
|
235
392
|
size={size}
|
|
236
|
-
label={
|
|
393
|
+
label={decodeFlowpressText(block.attributes.label).trim() || undefined}
|
|
237
394
|
{...iconSemantic}
|
|
238
395
|
{...htmlAttributes}
|
|
239
396
|
/>
|
|
@@ -256,19 +413,19 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
256
413
|
|
|
257
414
|
if (name === "gallery") {
|
|
258
415
|
const images = Array.isArray(block.attributes.images)
|
|
259
|
-
? block.attributes.images
|
|
416
|
+
? objectCollection(block.attributes.images)
|
|
260
417
|
: [];
|
|
261
418
|
return (
|
|
262
|
-
<
|
|
419
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
263
420
|
{images.map((image) => image.url ? (
|
|
264
|
-
<
|
|
421
|
+
<Media
|
|
265
422
|
src={String(image.url)}
|
|
266
|
-
alt={
|
|
423
|
+
alt={decodeFlowpressText(image.alt)}
|
|
267
424
|
loading="lazy"
|
|
268
425
|
decoding="async"
|
|
269
426
|
/>
|
|
270
427
|
) : null)}
|
|
271
|
-
</
|
|
428
|
+
</StyleflowElement>
|
|
272
429
|
);
|
|
273
430
|
}
|
|
274
431
|
|
|
@@ -276,7 +433,7 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
276
433
|
const video = objectValue(block, "video");
|
|
277
434
|
const poster = objectValue(block, "poster");
|
|
278
435
|
return video.url ? (
|
|
279
|
-
<
|
|
436
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
280
437
|
<video
|
|
281
438
|
src={String(video.url)}
|
|
282
439
|
poster={poster.url ? String(poster.url) : undefined}
|
|
@@ -285,30 +442,43 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
285
442
|
muted={Boolean(block.attributes.autoplay)}
|
|
286
443
|
playsinline
|
|
287
444
|
/>
|
|
288
|
-
</
|
|
445
|
+
</StyleflowElement>
|
|
289
446
|
) : null;
|
|
290
447
|
}
|
|
291
448
|
|
|
292
449
|
if (name === "video-youtube") {
|
|
293
450
|
const embed = youtubeEmbedUrl(block.attributes.url);
|
|
294
451
|
return embed ? (
|
|
295
|
-
<
|
|
452
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
296
453
|
<iframe
|
|
297
454
|
src={embed}
|
|
298
|
-
title={
|
|
455
|
+
title={decodeFlowpressText(block.attributes.title ?? "YouTube video")}
|
|
299
456
|
loading="lazy"
|
|
300
457
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
301
458
|
allowfullscreen
|
|
302
459
|
/>
|
|
303
|
-
</
|
|
460
|
+
</StyleflowElement>
|
|
304
461
|
) : null;
|
|
305
462
|
}
|
|
306
463
|
|
|
464
|
+
if (name === "media-text") {
|
|
465
|
+
const media = objectValue(block, "media");
|
|
466
|
+
const mediaNode = media.url ? <Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} width={media.width} height={media.height} loading="lazy" /> : null;
|
|
467
|
+
const contentNode = <StyleflowElement as="div">
|
|
468
|
+
<Astro.self descriptorIndex={descriptors} blocks={children} contract={contract} blockRenderers={blockRenderers} iconRenderer={IconRenderer} {...nestedRendererProps(block.name, block.attributes)} />
|
|
469
|
+
</StyleflowElement>;
|
|
470
|
+
return (
|
|
471
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes} data-flowpress-media-text>
|
|
472
|
+
{block.attributes.mediaPosition === "right" ? [contentNode, mediaNode] : [mediaNode, contentNode]}
|
|
473
|
+
</StyleflowElement>
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
307
477
|
if (name === "chip") {
|
|
308
478
|
return (
|
|
309
|
-
<
|
|
310
|
-
{textValue(block, "label")}
|
|
311
|
-
</
|
|
479
|
+
<StyleflowElement as="span" {...semantic} {...htmlAttributes}>
|
|
480
|
+
{decodeFlowpressText(textValue(block, "label"))}
|
|
481
|
+
</StyleflowElement>
|
|
312
482
|
);
|
|
313
483
|
}
|
|
314
484
|
|
|
@@ -316,60 +486,63 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
316
486
|
const media = objectValue(block, "image");
|
|
317
487
|
const href = linkValue(block);
|
|
318
488
|
return (
|
|
319
|
-
<
|
|
489
|
+
<StyleflowElement as="article" {...semantic} {...htmlAttributes}>
|
|
320
490
|
{media.url && (
|
|
321
|
-
<
|
|
491
|
+
<Media src={String(media.url)} alt={decodeFlowpressText(media.alt)} loading="lazy" />
|
|
322
492
|
)}
|
|
323
|
-
{block.attributes.title && <
|
|
324
|
-
{block.attributes.text && <
|
|
325
|
-
{href && <
|
|
326
|
-
</
|
|
493
|
+
{block.attributes.title && <StyleflowElement as="h3">{decodeFlowpressText(block.attributes.title)}</StyleflowElement>}
|
|
494
|
+
{block.attributes.text && <StyleflowElement as="p">{decodeFlowpressText(block.attributes.text)}</StyleflowElement>}
|
|
495
|
+
{href && <StyleflowElement as="a" href={href}>Scopri</StyleflowElement>}
|
|
496
|
+
</StyleflowElement>
|
|
327
497
|
);
|
|
328
498
|
}
|
|
329
499
|
|
|
330
500
|
if (name === "content-list" || name === "term-list") {
|
|
331
501
|
const items = Array.isArray(block.attributes.resolvedItems)
|
|
332
|
-
? block.attributes.resolvedItems
|
|
502
|
+
? objectCollection(block.attributes.resolvedItems)
|
|
333
503
|
: [];
|
|
334
504
|
const resolvedBlocks = Array.isArray(block.attributes.resolvedBlocks)
|
|
335
505
|
? block.attributes.resolvedBlocks as FlowpressBlock[][]
|
|
336
506
|
: [];
|
|
337
507
|
return (
|
|
338
|
-
<
|
|
508
|
+
<StyleflowElement as="ul" {...semantic} {...htmlAttributes}>
|
|
339
509
|
{items.map((item, index) => (
|
|
340
|
-
<
|
|
510
|
+
<StyleflowElement as="li">
|
|
341
511
|
{resolvedBlocks[index]?.length ? (
|
|
342
|
-
<Astro.self
|
|
512
|
+
<Astro.self descriptorIndex={descriptors}
|
|
343
513
|
blocks={resolvedBlocks[index]}
|
|
344
514
|
contract={contract}
|
|
345
515
|
blockRenderers={blockRenderers}
|
|
346
516
|
iconRenderer={IconRenderer}
|
|
517
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
347
518
|
/>
|
|
348
519
|
) : (
|
|
349
520
|
<ListItemFallback item={item} />
|
|
350
521
|
)}
|
|
351
|
-
</
|
|
522
|
+
</StyleflowElement>
|
|
352
523
|
))}
|
|
353
|
-
</
|
|
524
|
+
</StyleflowElement>
|
|
354
525
|
);
|
|
355
526
|
}
|
|
356
527
|
|
|
357
528
|
if (name === "template") {
|
|
358
529
|
return Object.keys(htmlAttributes).length > 0 ? (
|
|
359
530
|
<div {...htmlAttributes}>
|
|
360
|
-
<Astro.self
|
|
531
|
+
<Astro.self descriptorIndex={descriptors}
|
|
361
532
|
blocks={children}
|
|
362
533
|
contract={contract}
|
|
363
534
|
blockRenderers={blockRenderers}
|
|
364
535
|
iconRenderer={IconRenderer}
|
|
536
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
365
537
|
/>
|
|
366
538
|
</div>
|
|
367
539
|
) : (
|
|
368
|
-
<Astro.self
|
|
540
|
+
<Astro.self descriptorIndex={descriptors}
|
|
369
541
|
blocks={children}
|
|
370
542
|
contract={contract}
|
|
371
543
|
blockRenderers={blockRenderers}
|
|
372
544
|
iconRenderer={IconRenderer}
|
|
545
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
373
546
|
/>
|
|
374
547
|
);
|
|
375
548
|
}
|
|
@@ -380,17 +553,18 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
380
553
|
|
|
381
554
|
if (name === "accordion-item") {
|
|
382
555
|
return (
|
|
383
|
-
<
|
|
556
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
384
557
|
<details>
|
|
385
|
-
<summary>{
|
|
386
|
-
<Astro.self
|
|
558
|
+
<summary>{decodeFlowpressText(block.attributes.title)}</summary>
|
|
559
|
+
<Astro.self descriptorIndex={descriptors}
|
|
387
560
|
blocks={children}
|
|
388
561
|
contract={contract}
|
|
389
562
|
blockRenderers={blockRenderers}
|
|
390
563
|
iconRenderer={IconRenderer}
|
|
564
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
391
565
|
/>
|
|
392
566
|
</details>
|
|
393
|
-
</
|
|
567
|
+
</StyleflowElement>
|
|
394
568
|
);
|
|
395
569
|
}
|
|
396
570
|
|
|
@@ -411,42 +585,55 @@ function youtubeEmbedUrl(value: unknown): string | null {
|
|
|
411
585
|
+ `?key=${encodeURIComponent(googleMapsApiKey)}`
|
|
412
586
|
+ `&q=${encodeURIComponent(query)}`;
|
|
413
587
|
return (
|
|
414
|
-
<
|
|
588
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
415
589
|
<iframe
|
|
416
590
|
src={source}
|
|
417
591
|
title={address || "Map"}
|
|
418
592
|
loading="lazy"
|
|
419
593
|
referrerpolicy="no-referrer-when-downgrade"
|
|
420
594
|
/>
|
|
421
|
-
</
|
|
595
|
+
</StyleflowElement>
|
|
422
596
|
);
|
|
423
597
|
}
|
|
424
598
|
return query ? (
|
|
425
|
-
<
|
|
426
|
-
<
|
|
427
|
-
as="a"
|
|
599
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes}>
|
|
600
|
+
<StyleflowElement as="a"
|
|
428
601
|
href={`https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`}
|
|
429
602
|
rel="noreferrer"
|
|
430
603
|
>
|
|
431
|
-
{address || query}
|
|
432
|
-
</
|
|
433
|
-
</
|
|
604
|
+
{decodeFlowpressText(address || query)}
|
|
605
|
+
</StyleflowElement>
|
|
606
|
+
</StyleflowElement>
|
|
434
607
|
) : null;
|
|
435
608
|
}
|
|
436
609
|
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
610
|
+
const fallbackContent = block.innerHtml && children.length === 0
|
|
611
|
+
? <StyleflowElement as="div" set:html={block.innerHtml} />
|
|
612
|
+
: (
|
|
613
|
+
<Astro.self descriptorIndex={descriptors}
|
|
614
|
+
blocks={children}
|
|
615
|
+
contract={contract}
|
|
616
|
+
blockRenderers={blockRenderers}
|
|
617
|
+
iconRenderer={IconRenderer}
|
|
618
|
+
{...nestedRendererProps(block.name, block.attributes)}
|
|
619
|
+
/>
|
|
620
|
+
);
|
|
621
|
+
return name === "section" ? (
|
|
622
|
+
<StyleflowElement as="section" {...semantic} {...htmlAttributes} data-flowpress-structural>{fallbackContent}</StyleflowElement>
|
|
623
|
+
) : (
|
|
624
|
+
<StyleflowElement as="div" {...semantic} {...htmlAttributes} data-flowpress-structural={["group", "flex"].includes(name) || undefined}>{fallbackContent}</StyleflowElement>
|
|
451
625
|
);
|
|
452
626
|
})}
|
|
627
|
+
|
|
628
|
+
<script>
|
|
629
|
+
import "./native/grid-bleed.js";
|
|
630
|
+
</script>
|
|
631
|
+
|
|
632
|
+
<style is:global>
|
|
633
|
+
[data-flowpress-media-text] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
|
|
634
|
+
@media (max-width: 40rem) { [data-flowpress-media-text] { grid-template-columns: minmax(0, 1fr); } }
|
|
635
|
+
</style>
|
|
636
|
+
|
|
637
|
+
<style is:global>
|
|
638
|
+
.flowpress-carousel:not(.is-initialized), .sf-carousel:not(.is-initialized), .flowpress-query-carousel:not(.is-initialized) { visibility: visible; }
|
|
639
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
@layer base {
|
|
24
|
+
:where(.flowpress-svg-media) { max-inline-size: 100%; block-size: auto; }
|
|
25
|
+
}
|
|
26
|
+
:where(.flowpress-svg-media) { overflow: hidden; vertical-align: middle; }
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "./native/block-sizing.css";
|
|
3
|
+
import "./native/inline-text.css";
|
|
4
|
+
import { decodeFlowpressText } from "../text.js";
|
|
5
|
+
import { resolveStyleFlowAstroPrimitive } from "@styleflow.app/astro";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
as: string;
|
|
9
|
+
[attribute: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
const props = { ...Astro.props } as Props;
|
|
12
|
+
for (const key of ["ty", "v", "w"]) {
|
|
13
|
+
if (props[key] === "" || props[key] === null) delete props[key];
|
|
14
|
+
}
|
|
15
|
+
for (const name of ["alt", "title", "aria-label", "placeholder"]) {
|
|
16
|
+
if (typeof props[name] === "string") props[name] = decodeFlowpressText(props[name]);
|
|
17
|
+
}
|
|
18
|
+
const { tag, attributes } = resolveStyleFlowAstroPrimitive(props);
|
|
19
|
+
if (["ty", "v", "w"].every((key) => props[key] === undefined)) {
|
|
20
|
+
for (const name of ["type", "variant", "weight", "style"]) delete attributes[`data-text-${name}`];
|
|
21
|
+
}
|
|
22
|
+
const Element = tag;
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<Element {...attributes}><slot /></Element>
|