@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
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { nativeFlexItemProps } from "./astro/native/group.js";
|
|
2
|
+
export function flowpressBlockHtmlProps(attributes) {
|
|
3
|
+
const id = typeof attributes.anchor === "string" ? attributes.anchor.trim() : "";
|
|
4
|
+
const className = typeof attributes.className === "string"
|
|
5
|
+
? attributes.className.trim().replace(/\s+/g, " ")
|
|
6
|
+
: "";
|
|
7
|
+
const props = {
|
|
8
|
+
...(id ? { id } : {}),
|
|
9
|
+
...(className ? { class: className } : {})
|
|
10
|
+
};
|
|
11
|
+
const explicit = attributes.htmlAttributes;
|
|
12
|
+
if (explicit && typeof explicit === "object" && !Array.isArray(explicit)) {
|
|
13
|
+
for (const [name, value] of Object.entries(explicit)) {
|
|
14
|
+
const normalized = normalizeSupportedHtmlAttribute(name);
|
|
15
|
+
if (!normalized || normalized === "id" || normalized === "class")
|
|
16
|
+
continue;
|
|
17
|
+
if (["string", "number", "boolean"].includes(typeof value)) {
|
|
18
|
+
props[normalized] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
for (const [attribute, htmlName] of [
|
|
23
|
+
["title", "title"],
|
|
24
|
+
["role", "role"],
|
|
25
|
+
["lang", "lang"],
|
|
26
|
+
["dir", "dir"],
|
|
27
|
+
["tabIndex", "tabindex"],
|
|
28
|
+
["ariaLabel", "aria-label"]
|
|
29
|
+
]) {
|
|
30
|
+
const value = attributes[attribute];
|
|
31
|
+
if (["string", "number", "boolean"].includes(typeof value)) {
|
|
32
|
+
props[htmlName] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return nativeFlexItemProps(attributes, props);
|
|
36
|
+
}
|
|
37
|
+
function normalizeSupportedHtmlAttribute(name) {
|
|
38
|
+
const normalized = name.trim().toLowerCase();
|
|
39
|
+
if (["title", "role", "lang", "dir", "tabindex", "hidden"].includes(normalized)) {
|
|
40
|
+
return normalized;
|
|
41
|
+
}
|
|
42
|
+
if (/^aria-[a-z0-9-]+$/.test(normalized))
|
|
43
|
+
return normalized;
|
|
44
|
+
if (/^data-[a-z0-9-]+$/.test(normalized)
|
|
45
|
+
&& !/^data-(?:color|surface|foreground|layout|text|interactive|styleflow|sf-)/.test(normalized)) {
|
|
46
|
+
return normalized;
|
|
47
|
+
}
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
function findLogoData(blocks) {
|
|
51
|
+
for (const block of blocks) {
|
|
52
|
+
if (block.name === "core/site-logo" && block.resolvedData) {
|
|
53
|
+
return block.resolvedData;
|
|
54
|
+
}
|
|
55
|
+
const nested = findLogoData(block.innerBlocks ?? []);
|
|
56
|
+
if (nested)
|
|
57
|
+
return nested;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
/** Structural logo visibility rules emitted once per composition. */
|
|
62
|
+
export function flowpressCompositionLogoStyles(composition) {
|
|
63
|
+
const data = findLogoData(composition.blocks);
|
|
64
|
+
if (!data)
|
|
65
|
+
return "";
|
|
66
|
+
const fallback = data.fallback === "negative" ? "negative" : "positive";
|
|
67
|
+
const other = fallback === "positive" ? "negative" : "positive";
|
|
68
|
+
const lines = [
|
|
69
|
+
`:root{--flowpress-logo-${fallback}-display:block;--flowpress-logo-${other}-display:none}`,
|
|
70
|
+
".flowpress-site-logo__image--positive{display:var(--flowpress-logo-positive-display,none)}",
|
|
71
|
+
".flowpress-site-logo__image--negative{display:var(--flowpress-logo-negative-display,none)}"
|
|
72
|
+
];
|
|
73
|
+
for (const [theme, variant] of Object.entries(data.themeMap ?? {})) {
|
|
74
|
+
if (!/^[a-z0-9_-]+$/.test(theme))
|
|
75
|
+
continue;
|
|
76
|
+
const hidden = variant === "positive" ? "negative" : "positive";
|
|
77
|
+
lines.push(`[data-styleflow-theme="${theme}"]{--flowpress-logo-${variant}-display:block;--flowpress-logo-${hidden}-display:none}`);
|
|
78
|
+
}
|
|
79
|
+
lines.push('.flowpress-site-logo[data-flowpress-logo-override="positive"]{--flowpress-logo-positive-display:block;--flowpress-logo-negative-display:none}', '.flowpress-site-logo[data-flowpress-logo-override="negative"]{--flowpress-logo-positive-display:none;--flowpress-logo-negative-display:block}');
|
|
80
|
+
return lines.join("\n");
|
|
81
|
+
}
|
|
82
|
+
export function flowpressBlockTypeDescriptors(composition) {
|
|
83
|
+
return new Map(composition.blockTypes.map((descriptor) => [
|
|
84
|
+
descriptor.blockName,
|
|
85
|
+
descriptor
|
|
86
|
+
]));
|
|
87
|
+
}
|
|
88
|
+
export function flowpressAdapterCompatibilityIssue(blockName, descriptors, adapters) {
|
|
89
|
+
const adapter = adapters[blockName];
|
|
90
|
+
if (!adapter) {
|
|
91
|
+
const command = `pnpm cms:block-adapter ${blockName}`;
|
|
92
|
+
return {
|
|
93
|
+
code: "missing-adapter",
|
|
94
|
+
message: `Missing FlowPress block adapter for "${blockName}". Run ${command}.`,
|
|
95
|
+
command
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (adapter.status !== "ready") {
|
|
99
|
+
const command = `pnpm cms:block-adapter:approve ${blockName}`;
|
|
100
|
+
return {
|
|
101
|
+
code: "draft-adapter",
|
|
102
|
+
message: `FlowPress block adapter for "${blockName}" is draft. Run ${command}.`,
|
|
103
|
+
command
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const descriptor = descriptors.get(blockName);
|
|
107
|
+
if (!descriptor) {
|
|
108
|
+
const command = "pnpm cms:block-adapters:check";
|
|
109
|
+
return {
|
|
110
|
+
code: "missing-descriptor",
|
|
111
|
+
message: `WordPress did not provide a block type descriptor for "${blockName}". Run ${command}.`,
|
|
112
|
+
command
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (descriptor.fingerprint !== adapter.fingerprint) {
|
|
116
|
+
const command = `pnpm cms:block-adapter ${blockName} --refresh-schema`;
|
|
117
|
+
return {
|
|
118
|
+
code: "stale-adapter",
|
|
119
|
+
message: `FlowPress block adapter for "${blockName}" has a stale schema fingerprint. Run ${command}.`,
|
|
120
|
+
command
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAU9D,MAAM,UAAU,uBAAuB,CACrC,UAA6C;IAE7C,MAAM,EAAE,GAAG,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,SAAS,KAAK,QAAQ;QACxD,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GAA4B;QACrC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC;IACF,MAAM,QAAQ,GA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B,MAAM,OAAO,GAAG,kCAAkC,SAAS,EAAE,CAAC;QAC9D,OAAO;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,gCAAgC,SAAS,mBAAmB,OAAO,GAAG;YAC/E,OAAO;SACR,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,+BAA+B,CAAC;QAChD,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,0DAA0D,SAAS,UAAU,OAAO,GAAG;YAChG,OAAO;SACR,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,0BAA0B,SAAS,mBAAmB,CAAC;QACvE,OAAO;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,gCAAgC,SAAS,yCAAyC,OAAO,GAAG;YACrG,OAAO;SACR,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { nativeFlexItemProps } from \"./astro/native/group.js\";\nimport type { FlowpressBlockAdapters } from \"./block-renderers.js\";\nimport type {\n FlowpressBlock,\n FlowpressBlockAuthoringAttributes,\n FlowpressBlockHtmlProps,\n FlowpressBlockTypeDescriptor,\n FlowpressCompositionV1\n} from \"./types.js\";\n\nexport function flowpressBlockHtmlProps(\n attributes: FlowpressBlockAuthoringAttributes\n): FlowpressBlockHtmlProps {\n const id = typeof attributes.anchor === \"string\" ? attributes.anchor.trim() : \"\";\n const className = typeof attributes.className === \"string\"\n ? attributes.className.trim().replace(/\\s+/g, \" \")\n : \"\";\n const props: FlowpressBlockHtmlProps = {\n ...(id ? { id } : {}),\n ...(className ? { class: className } : {})\n };\n const explicit = attributes.htmlAttributes;\n if (explicit && typeof explicit === \"object\" && !Array.isArray(explicit)) {\n for (const [name, value] of Object.entries(explicit)) {\n const normalized = normalizeSupportedHtmlAttribute(name);\n if (!normalized || normalized === \"id\" || normalized === \"class\") continue;\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n props[normalized] = value as string | number | boolean;\n }\n }\n }\n for (const [attribute, htmlName] of [\n [\"title\", \"title\"],\n [\"role\", \"role\"],\n [\"lang\", \"lang\"],\n [\"dir\", \"dir\"],\n [\"tabIndex\", \"tabindex\"],\n [\"ariaLabel\", \"aria-label\"]\n ] as const) {\n const value = attributes[attribute];\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n props[htmlName] = value as string | number | boolean;\n }\n }\n return nativeFlexItemProps(attributes, props);\n}\n\nfunction normalizeSupportedHtmlAttribute(name: string): string {\n const normalized = name.trim().toLowerCase();\n if ([\"title\", \"role\", \"lang\", \"dir\", \"tabindex\", \"hidden\"].includes(normalized)) {\n return normalized;\n }\n if (/^aria-[a-z0-9-]+$/.test(normalized)) return normalized;\n if (\n /^data-[a-z0-9-]+$/.test(normalized)\n && !/^data-(?:color|surface|foreground|layout|text|interactive|styleflow|sf-)/.test(normalized)\n ) {\n return normalized;\n }\n return \"\";\n}\n\ntype LogoResolvedData = {\n themeMap?: Record<string, \"positive\" | \"negative\">;\n fallback?: \"positive\" | \"negative\";\n};\n\nfunction findLogoData(blocks: FlowpressBlock[]): LogoResolvedData | null {\n for (const block of blocks) {\n if (block.name === \"core/site-logo\" && block.resolvedData) {\n return block.resolvedData as LogoResolvedData;\n }\n const nested = findLogoData(block.innerBlocks ?? []);\n if (nested) return nested;\n }\n return null;\n}\n\n/** Structural logo visibility rules emitted once per composition. */\nexport function flowpressCompositionLogoStyles(\n composition: FlowpressCompositionV1\n): string {\n const data = findLogoData(composition.blocks);\n if (!data) return \"\";\n const fallback = data.fallback === \"negative\" ? \"negative\" : \"positive\";\n const other = fallback === \"positive\" ? \"negative\" : \"positive\";\n const lines = [\n `:root{--flowpress-logo-${fallback}-display:block;--flowpress-logo-${other}-display:none}`,\n \".flowpress-site-logo__image--positive{display:var(--flowpress-logo-positive-display,none)}\",\n \".flowpress-site-logo__image--negative{display:var(--flowpress-logo-negative-display,none)}\"\n ];\n for (const [theme, variant] of Object.entries(data.themeMap ?? {})) {\n if (!/^[a-z0-9_-]+$/.test(theme)) continue;\n const hidden = variant === \"positive\" ? \"negative\" : \"positive\";\n lines.push(\n `[data-styleflow-theme=\"${theme}\"]{--flowpress-logo-${variant}-display:block;--flowpress-logo-${hidden}-display:none}`\n );\n }\n lines.push(\n '.flowpress-site-logo[data-flowpress-logo-override=\"positive\"]{--flowpress-logo-positive-display:block;--flowpress-logo-negative-display:none}',\n '.flowpress-site-logo[data-flowpress-logo-override=\"negative\"]{--flowpress-logo-positive-display:none;--flowpress-logo-negative-display:block}'\n );\n return lines.join(\"\\n\");\n}\n\nexport type FlowpressAdapterCompatibilityCode =\n | \"missing-adapter\"\n | \"draft-adapter\"\n | \"missing-descriptor\"\n | \"stale-adapter\";\n\nexport interface FlowpressAdapterCompatibilityIssue {\n code: FlowpressAdapterCompatibilityCode;\n message: string;\n command: string;\n}\n\nexport function flowpressBlockTypeDescriptors(\n composition: FlowpressCompositionV1\n): ReadonlyMap<string, FlowpressBlockTypeDescriptor> {\n return new Map(composition.blockTypes.map((descriptor) => [\n descriptor.blockName,\n descriptor\n ]));\n}\n\nexport function flowpressAdapterCompatibilityIssue(\n blockName: string,\n descriptors: ReadonlyMap<string, FlowpressBlockTypeDescriptor>,\n adapters: FlowpressBlockAdapters\n): FlowpressAdapterCompatibilityIssue | null {\n const adapter = adapters[blockName];\n if (!adapter) {\n const command = `pnpm cms:block-adapter ${blockName}`;\n return {\n code: \"missing-adapter\",\n message: `Missing FlowPress block adapter for \"${blockName}\". Run ${command}.`,\n command\n };\n }\n if (adapter.status !== \"ready\") {\n const command = `pnpm cms:block-adapter:approve ${blockName}`;\n return {\n code: \"draft-adapter\",\n message: `FlowPress block adapter for \"${blockName}\" is draft. Run ${command}.`,\n command\n };\n }\n const descriptor = descriptors.get(blockName);\n if (!descriptor) {\n const command = \"pnpm cms:block-adapters:check\";\n return {\n code: \"missing-descriptor\",\n message: `WordPress did not provide a block type descriptor for \"${blockName}\". Run ${command}.`,\n command\n };\n }\n if (descriptor.fingerprint !== adapter.fingerprint) {\n const command = `pnpm cms:block-adapter ${blockName} --refresh-schema`;\n return {\n code: \"stale-adapter\",\n message: `FlowPress block adapter for \"${blockName}\" has a stale schema fingerprint. Run ${command}.`,\n command\n };\n }\n return null;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION: "6";
|
|
2
|
+
export interface FlowpressDefaultBlockCatalogEntry {
|
|
3
|
+
blockName: string;
|
|
4
|
+
template: "DefaultBlockAdapter.astro";
|
|
5
|
+
}
|
|
6
|
+
export declare const flowpressDefaultBlockCatalog: readonly FlowpressDefaultBlockCatalogEntry[];
|
|
7
|
+
export declare function hasFlowpressDefaultBlockAdapter(blockName: string): boolean;
|
|
8
|
+
export declare function createFlowpressDefaultBlockAdapterSource(blockName: string): string;
|
|
9
|
+
//# sourceMappingURL=default-blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-blocks.d.ts","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uCAAuC,EAAG,GAAY,CAAC;AAEpE,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,2BAA2B,CAAC;CACvC;AAqFD,eAAO,MAAM,4BAA4B,EAAE,SAAS,iCAAiC,EACc,CAAC;AAIpG,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,wBAAgB,wCAAwC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA+BlF"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "6";
|
|
2
|
+
const blockNames = [
|
|
3
|
+
"core/separator",
|
|
4
|
+
"core/post-content",
|
|
5
|
+
"core/site-logo",
|
|
6
|
+
"core/template-part",
|
|
7
|
+
"sf/accordion",
|
|
8
|
+
"sf/collection",
|
|
9
|
+
"sf/flex",
|
|
10
|
+
"sf/group",
|
|
11
|
+
"sf/marquee",
|
|
12
|
+
"sf/media-text",
|
|
13
|
+
"sf/theme-toggle",
|
|
14
|
+
"core/term-name",
|
|
15
|
+
"core/post-terms",
|
|
16
|
+
"core/button",
|
|
17
|
+
"flowpress/login",
|
|
18
|
+
"flowpress/reserved-pagination",
|
|
19
|
+
"core/post-date",
|
|
20
|
+
"core/icon",
|
|
21
|
+
"core/post-excerpt",
|
|
22
|
+
"core/term-description",
|
|
23
|
+
"core/post-template",
|
|
24
|
+
"core/html",
|
|
25
|
+
"core/block",
|
|
26
|
+
"core/site-title",
|
|
27
|
+
"core/post-featured-image",
|
|
28
|
+
"core/page-list",
|
|
29
|
+
"core/terms-query",
|
|
30
|
+
"core/buttons",
|
|
31
|
+
"core/image",
|
|
32
|
+
"core/query-no-results",
|
|
33
|
+
"core/term-template",
|
|
34
|
+
"core/navigation",
|
|
35
|
+
"core/navigation-submenu",
|
|
36
|
+
"core/query",
|
|
37
|
+
"core/home-link",
|
|
38
|
+
"core/page-list-item",
|
|
39
|
+
"core/navigation-link",
|
|
40
|
+
"core/post-title",
|
|
41
|
+
"sf/post-field",
|
|
42
|
+
"project/post-field",
|
|
43
|
+
"sf/block-binding",
|
|
44
|
+
"project/block-binding",
|
|
45
|
+
"sf/term-field",
|
|
46
|
+
"project/term-field",
|
|
47
|
+
"sf/timeline",
|
|
48
|
+
"core/cover",
|
|
49
|
+
"core/group",
|
|
50
|
+
"core/heading",
|
|
51
|
+
"core/list",
|
|
52
|
+
"core/list-item",
|
|
53
|
+
"core/paragraph",
|
|
54
|
+
"core/quote",
|
|
55
|
+
"sf/accordion-item",
|
|
56
|
+
"sf/button",
|
|
57
|
+
"sf/card",
|
|
58
|
+
"sf/carousel",
|
|
59
|
+
"sf/carousel-item",
|
|
60
|
+
"sf/chip",
|
|
61
|
+
"sf/code",
|
|
62
|
+
"sf/column",
|
|
63
|
+
"sf/content-list",
|
|
64
|
+
"sf/form",
|
|
65
|
+
"sf/gallery",
|
|
66
|
+
"sf/grid",
|
|
67
|
+
"sf/heading",
|
|
68
|
+
"sf/hero",
|
|
69
|
+
"sf/icon",
|
|
70
|
+
"sf/image",
|
|
71
|
+
"sf/blob",
|
|
72
|
+
"sf/timeline-card",
|
|
73
|
+
"sf/map",
|
|
74
|
+
"sf/number-spinner",
|
|
75
|
+
"sf/quote",
|
|
76
|
+
"sf/rich-text",
|
|
77
|
+
"sf/section",
|
|
78
|
+
"sf/template",
|
|
79
|
+
"sf/term-list",
|
|
80
|
+
"sf/video",
|
|
81
|
+
"sf/video-youtube"
|
|
82
|
+
];
|
|
83
|
+
export const flowpressDefaultBlockCatalog = [...blockNames].sort().map((blockName) => ({ blockName, template: "DefaultBlockAdapter.astro" }));
|
|
84
|
+
const supported = new Set(blockNames);
|
|
85
|
+
export function hasFlowpressDefaultBlockAdapter(blockName) {
|
|
86
|
+
return supported.has(blockName);
|
|
87
|
+
}
|
|
88
|
+
export function createFlowpressDefaultBlockAdapterSource(blockName) {
|
|
89
|
+
if (!hasFlowpressDefaultBlockAdapter(blockName)) {
|
|
90
|
+
throw new Error(`FlowPress has no official default adapter for ${blockName}.`);
|
|
91
|
+
}
|
|
92
|
+
if (blockName === "core/cover") {
|
|
93
|
+
return `---
|
|
94
|
+
import CoverBlock from "@styleflow.app/flowpress-astro-core/blocks/CoverBlock.astro";
|
|
95
|
+
import type { FlowpressBlockRendererProps } from "@styleflow.app/flowpress-astro-core";
|
|
96
|
+
|
|
97
|
+
const { block, contract, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
<CoverBlock
|
|
101
|
+
block={block}
|
|
102
|
+
contract={contract}
|
|
103
|
+
htmlProps={htmlProps}
|
|
104
|
+
styleflowProps={styleflowProps}
|
|
105
|
+
>
|
|
106
|
+
<slot />
|
|
107
|
+
</CoverBlock>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
return `---
|
|
111
|
+
import DefaultBlockAdapter from "@styleflow.app/flowpress-astro-core/DefaultBlockAdapter.astro";
|
|
112
|
+
import type { FlowpressBlockRendererProps } from "@styleflow.app/flowpress-astro-core";
|
|
113
|
+
|
|
114
|
+
const props = Astro.props as FlowpressBlockRendererProps;
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
<DefaultBlockAdapter {...props} />
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=default-blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-blocks.js","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAY,CAAC;AAOpE,MAAM,UAAU,GAAG;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,SAAS;IACT,UAAU;IACV,YAAY;IACZ,eAAe;IACf,iBAAiB;IAEjB,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,+BAA+B;IAC/B,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,oBAAoB;IACpB,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,0BAA0B;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;IACd,YAAY;IACZ,uBAAuB;IACvB,oBAAoB;IACpB,iBAAiB;IACjB,yBAAyB;IACzB,YAAY;IACZ,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,oBAAoB;IACpB,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,kBAAkB;IAClB,QAAQ;IACR,mBAAmB;IACnB,UAAU;IACV,cAAc;IACd,YAAY;IACZ,aAAa;IACb,cAAc;IACd,UAAU;IACV,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,4BAA4B,GACvC,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;AAEpG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,UAAU,CAAC,CAAC;AAE9C,MAAM,UAAU,+BAA+B,CAAC,SAAiB;IAC/D,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,wCAAwC,CAAC,SAAiB;IACxE,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,iDAAiD,SAAS,GAAG,CAAC,CAAC;IACjF,CAAC;IACD,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;QAC/B,OAAO;;;;;;;;;;;;;;;CAeV,CAAC;IACA,CAAC;IACD,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC","sourcesContent":["export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = \"6\" as const;\n\nexport interface FlowpressDefaultBlockCatalogEntry {\n blockName: string;\n template: \"DefaultBlockAdapter.astro\";\n}\n\nconst blockNames = [\n \"core/separator\",\n \"core/post-content\",\n \"core/site-logo\",\n \"core/template-part\",\n \"sf/accordion\",\n \"sf/collection\",\n \"sf/flex\",\n \"sf/group\",\n \"sf/marquee\",\n \"sf/media-text\",\n \"sf/theme-toggle\",\n\n \"core/term-name\",\n \"core/post-terms\",\n \"core/button\",\n \"flowpress/login\",\n \"flowpress/reserved-pagination\",\n \"core/post-date\",\n \"core/icon\",\n \"core/post-excerpt\",\n \"core/term-description\",\n \"core/post-template\",\n \"core/html\",\n \"core/block\",\n \"core/site-title\",\n \"core/post-featured-image\",\n \"core/page-list\",\n \"core/terms-query\",\n \"core/buttons\",\n \"core/image\",\n \"core/query-no-results\",\n \"core/term-template\",\n \"core/navigation\",\n \"core/navigation-submenu\",\n \"core/query\",\n \"core/home-link\",\n \"core/page-list-item\",\n \"core/navigation-link\",\n \"core/post-title\",\n \"sf/post-field\",\n \"project/post-field\",\n \"sf/block-binding\",\n \"project/block-binding\",\n \"sf/term-field\",\n \"project/term-field\",\n \"sf/timeline\",\n \"core/cover\",\n \"core/group\",\n \"core/heading\",\n \"core/list\",\n \"core/list-item\",\n \"core/paragraph\",\n \"core/quote\",\n \"sf/accordion-item\",\n \"sf/button\",\n \"sf/card\",\n \"sf/carousel\",\n \"sf/carousel-item\",\n \"sf/chip\",\n \"sf/code\",\n \"sf/column\",\n \"sf/content-list\",\n \"sf/form\",\n \"sf/gallery\",\n \"sf/grid\",\n \"sf/heading\",\n \"sf/hero\",\n \"sf/icon\",\n \"sf/image\",\n \"sf/blob\",\n \"sf/timeline-card\",\n \"sf/map\",\n \"sf/number-spinner\",\n \"sf/quote\",\n \"sf/rich-text\",\n \"sf/section\",\n \"sf/template\",\n \"sf/term-list\",\n \"sf/video\",\n \"sf/video-youtube\"\n] as const;\n\nexport const flowpressDefaultBlockCatalog: readonly FlowpressDefaultBlockCatalogEntry[] =\n [...blockNames].sort().map((blockName) => ({ blockName, template: \"DefaultBlockAdapter.astro\" }));\n\nconst supported = new Set<string>(blockNames);\n\nexport function hasFlowpressDefaultBlockAdapter(blockName: string): boolean {\n return supported.has(blockName);\n}\n\nexport function createFlowpressDefaultBlockAdapterSource(blockName: string): string {\n if (!hasFlowpressDefaultBlockAdapter(blockName)) {\n throw new Error(`FlowPress has no official default adapter for ${blockName}.`);\n }\n if (blockName === \"core/cover\") {\n return `---\nimport CoverBlock from \"@styleflow.app/flowpress-astro-core/blocks/CoverBlock.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst { block, contract, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;\n---\n\n<CoverBlock\n block={block}\n contract={contract}\n htmlProps={htmlProps}\n styleflowProps={styleflowProps}\n>\n <slot />\n</CoverBlock>\n`;\n }\n return `---\nimport DefaultBlockAdapter from \"@styleflow.app/flowpress-astro-core/DefaultBlockAdapter.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst props = Astro.props as FlowpressBlockRendererProps;\n---\n\n<DefaultBlockAdapter {...props} />\n`;\n}\n"]}
|
package/dist/env.d.ts
CHANGED
|
@@ -6,8 +6,17 @@ export interface FlowpressEnvironment {
|
|
|
6
6
|
outputMode: AstroOutputMode;
|
|
7
7
|
siteUrl: string;
|
|
8
8
|
backendUrl: string;
|
|
9
|
+
mediaUrl: string;
|
|
9
10
|
graphqlUrl: string;
|
|
10
11
|
localAstroPort: number;
|
|
11
12
|
}
|
|
13
|
+
export interface FlowpressMediaRemotePattern {
|
|
14
|
+
protocol: "http" | "https";
|
|
15
|
+
hostname: string;
|
|
16
|
+
port?: string;
|
|
17
|
+
pathname: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function resolveFlowpressMediaUrl(env: NodeJS.ProcessEnv): string;
|
|
20
|
+
export declare function flowpressMediaRemotePattern(env: NodeJS.ProcessEnv): FlowpressMediaRemotePattern;
|
|
12
21
|
export declare function readFlowpressEnvironment(env?: NodeJS.ProcessEnv): FlowpressEnvironment;
|
|
13
22
|
//# sourceMappingURL=env.d.ts.map
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AA0BD,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAQvE;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,2BAA2B,CAS7B;AA0BD,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,oBAAoB,CAuBtB"}
|
package/dist/env.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
export function resolveFlowpressMediaUrl(env) {
|
|
2
|
+
const key = env.FLOWPRESS_MEDIA?.trim() ? "FLOWPRESS_MEDIA" : "BACKEND_URL";
|
|
3
|
+
const value = validUrl(required(env, key), key);
|
|
4
|
+
const url = new URL(value);
|
|
5
|
+
if (url.username || url.password || url.search || url.hash) {
|
|
6
|
+
throw new Error(`${key} must not contain credentials, query, or fragment.`);
|
|
7
|
+
}
|
|
8
|
+
return url.toString().replace(/\/+$/, "");
|
|
9
|
+
}
|
|
10
|
+
export function flowpressMediaRemotePattern(env) {
|
|
11
|
+
const url = new URL(resolveFlowpressMediaUrl(env));
|
|
12
|
+
const basePath = url.pathname.replace(/\/+$/, "");
|
|
13
|
+
return {
|
|
14
|
+
protocol: url.protocol.slice(0, -1),
|
|
15
|
+
hostname: url.hostname,
|
|
16
|
+
...(url.port ? { port: url.port } : {}),
|
|
17
|
+
pathname: basePath ? `${basePath}/**` : "/**"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
1
20
|
function required(env, key) {
|
|
2
21
|
const value = env[key]?.trim();
|
|
3
22
|
if (!value) {
|
|
@@ -32,6 +51,7 @@ export function readFlowpressEnvironment(env = process.env) {
|
|
|
32
51
|
outputMode,
|
|
33
52
|
siteUrl: validUrl(required(env, "SITE_URL"), "SITE_URL"),
|
|
34
53
|
backendUrl: validUrl(required(env, "BACKEND_URL"), "BACKEND_URL"),
|
|
54
|
+
mediaUrl: resolveFlowpressMediaUrl(env),
|
|
35
55
|
graphqlUrl: validUrl(required(env, "BACKEND_GRAPHQL_URL"), "BACKEND_GRAPHQL_URL"),
|
|
36
56
|
localAstroPort: port(required(env, "LOCAL_ASTRO_PORT"), "LOCAL_ASTRO_PORT")
|
|
37
57
|
};
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,wBAAwB,CAAC,GAAsB;IAC7D,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC;IAC5E,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,oDAAoD,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,GAAsB;IAEtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClD,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAqB;QACvD,Q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AAU,GAAG,QAAQ,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;IACtD,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;QAChC,WAAW,EAAE,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;QAC1C,WAAW,EAAE,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;QAC1C,UAAU;QACV,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC;QACxD,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,aAAa,CAAC;QACjE,QAAQ,EAAE,wBAAwB,CAAC,GAAG,CAAC;QACvC,UAAU,EAAE,QAAQ,CAClB,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,EACpC,qBAAqB,CACtB;QACD,cAAc,EAAE,IAAI,CAClB,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC,EACjC,kBAAkB,CACnB;KACF,CAAC;AACJ,CAAC","sourcesContent":["export type AstroOutputMode = \"static\" | \"server\";\n\nexport interface FlowpressEnvironment {\n appEnv: string;\n projectName: string;\n projectSlug: string;\n outputMode: AstroOutputMode;\n siteUrl: string;\n backendUrl: string;\n mediaUrl: string;\n graphqlUrl: string;\n localAstroPort: number;\n}\n\nexport interface FlowpressMediaRemotePattern {\n protocol: \"http\" | \"https\";\n hostname: string;\n port?: string;\n pathname: string;\n}\n\nexport function resolveFlowpressMediaUrl(env: NodeJS.ProcessEnv): string {\n const key = env.FLOWPRESS_MEDIA?.trim() ? \"FLOWPRESS_MEDIA\" : \"BACKEND_URL\";\n const value = validUrl(required(env, key), key);\n const url = new URL(value);\n if (url.username || url.password || url.search || url.hash) {\n throw new Error(`${key} must not contain credentials, query, or fragment.`);\n }\n return url.toString().replace(/\\/+$/, \"\");\n}\n\nexport function flowpressMediaRemotePattern(\n env: NodeJS.ProcessEnv\n): FlowpressMediaRemotePattern {\n const url = new URL(resolveFlowpressMediaUrl(env));\n const basePath = url.pathname.replace(/\\/+$/, \"\");\n return {\n protocol: url.protocol.slice(0, -1) as \"http\" | \"https\",\n hostname: url.hostname,\n ...(url.port ? { port: url.port } : {}),\n pathname: basePath ? `${basePath}/**` : \"/**\"\n };\n}\n\nfunction required(env: NodeJS.ProcessEnv, key: string): string {\n const value = env[key]?.trim();\n if (!value) {\n throw new Error(`Missing required environment variable ${key}.`);\n }\n return value;\n}\n\nfunction validUrl(value: string, key: string): string {\n try {\n return new URL(value).toString().replace(/\\/$/, \"\");\n } catch {\n throw new Error(`${key} must be an absolute URL.`);\n }\n}\n\nfunction port(value: string, key: string): number {\n const parsed = Number.parseInt(value, 10);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65_535) {\n throw new Error(`${key} must be a valid TCP port.`);\n }\n return parsed;\n}\n\nexport function readFlowpressEnvironment(\n env: NodeJS.ProcessEnv = process.env\n): FlowpressEnvironment {\n const outputMode = required(env, \"ASTRO_OUTPUT_MODE\");\n if (outputMode !== \"static\" && outputMode !== \"server\") {\n throw new Error(\"ASTRO_OUTPUT_MODE must be static or server.\");\n }\n\n return {\n appEnv: required(env, \"APP_ENV\"),\n projectName: required(env, \"PROJECT_NAME\"),\n projectSlug: required(env, \"PROJECT_SLUG\"),\n outputMode,\n siteUrl: validUrl(required(env, \"SITE_URL\"), \"SITE_URL\"),\n backendUrl: validUrl(required(env, \"BACKEND_URL\"), \"BACKEND_URL\"),\n mediaUrl: resolveFlowpressMediaUrl(env),\n graphqlUrl: validUrl(\n required(env, \"BACKEND_GRAPHQL_URL\"),\n \"BACKEND_GRAPHQL_URL\"\n ),\n localAstroPort: port(\n required(env, \"LOCAL_ASTRO_PORT\"),\n \"LOCAL_ASTRO_PORT\"\n )\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
export * from "./client.js";
|
|
2
2
|
export * from "./carousel.js";
|
|
3
3
|
export * from "./block-renderers.js";
|
|
4
|
+
export * from "./composition.js";
|
|
5
|
+
export * from "./default-blocks.js";
|
|
4
6
|
export * from "./env.js";
|
|
7
|
+
export * from "./links.js";
|
|
8
|
+
export * from "./media.js";
|
|
5
9
|
export * from "./number-spinner.js";
|
|
6
10
|
export * from "./styleflow.js";
|
|
7
11
|
export * from "./style-classes.js";
|
|
8
12
|
export * from "./template-hierarchy.js";
|
|
13
|
+
export * from "./theme-runtime.js";
|
|
14
|
+
export { resolveFlowpressSiteDesign, flowpressSiteDesignAttributes } from "@styleflow.app/flowpress-components/site-design";
|
|
15
|
+
export type { FlowpressSiteDesign, FlowpressSiteDesignDefaults } from "@styleflow.app/flowpress-components/site-design";
|
|
9
16
|
export * from "./types.js";
|
|
17
|
+
export * from "./text.js";
|
|
10
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAC5H,YAAY,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AACxH,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
export * from "./client.js";
|
|
2
2
|
export * from "./carousel.js";
|
|
3
3
|
export * from "./block-renderers.js";
|
|
4
|
+
export * from "./composition.js";
|
|
5
|
+
export * from "./default-blocks.js";
|
|
4
6
|
export * from "./env.js";
|
|
7
|
+
export * from "./links.js";
|
|
8
|
+
export * from "./media.js";
|
|
5
9
|
export * from "./number-spinner.js";
|
|
6
10
|
export * from "./styleflow.js";
|
|
7
11
|
export * from "./style-classes.js";
|
|
8
12
|
export * from "./template-hierarchy.js";
|
|
13
|
+
export * from "./theme-runtime.js";
|
|
14
|
+
export { resolveFlowpressSiteDesign, flowpressSiteDesignAttributes } from "@styleflow.app/flowpress-components/site-design";
|
|
9
15
|
export * from "./types.js";
|
|
16
|
+
export * from "./text.js";
|
|
10
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC","sourcesContent":["export * from \"./client.js\";\nexport * from \"./carousel.js\";\nexport * from \"./block-renderers.js\";\nexport * from \"./env.js\";\nexport * from \"./number-spinner.js\";\nexport * from \"./styleflow.js\";\nexport * from \"./style-classes.js\";\nexport * from \"./template-hierarchy.js\";\nexport * from \"./types.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAE5H,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC","sourcesContent":["export * from \"./client.js\";\nexport * from \"./carousel.js\";\nexport * from \"./block-renderers.js\";\nexport * from \"./composition.js\";\nexport * from \"./default-blocks.js\";\nexport * from \"./env.js\";\nexport * from \"./links.js\";\nexport * from \"./media.js\";\nexport * from \"./number-spinner.js\";\nexport * from \"./styleflow.js\";\nexport * from \"./style-classes.js\";\nexport * from \"./template-hierarchy.js\";\nexport * from \"./theme-runtime.js\";\nexport { resolveFlowpressSiteDesign, flowpressSiteDesignAttributes } from \"@styleflow.app/flowpress-components/site-design\";\nexport type { FlowpressSiteDesign, FlowpressSiteDesignDefaults } from \"@styleflow.app/flowpress-components/site-design\";\nexport * from \"./types.js\";\nexport * from \"./text.js\";\n"]}
|
package/dist/links.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FlowpressLinkValue } from "./types.js";
|
|
2
|
+
export declare function flowpressLinkValue(value: unknown): FlowpressLinkValue | null;
|
|
3
|
+
/** Return only a browser-safe, resolved href. A bare # always fails closed. */
|
|
4
|
+
export declare function flowpressLinkHref(value: unknown): string;
|
|
5
|
+
//# sourceMappingURL=links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AASrD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAa5E;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOxD"}
|
package/dist/links.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const VALID_HREF = /^(?:\/(?!\/)|#[^#\s]+$|https?:\/\/|mailto:|tel:)/i;
|
|
2
|
+
const FAILED_RESOLUTIONS = new Set([
|
|
3
|
+
"missing_translation",
|
|
4
|
+
"missing_entity",
|
|
5
|
+
"invalid"
|
|
6
|
+
]);
|
|
7
|
+
export function flowpressLinkValue(value) {
|
|
8
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
9
|
+
return null;
|
|
10
|
+
const candidate = value;
|
|
11
|
+
return {
|
|
12
|
+
kind: String(candidate.kind ?? "custom"),
|
|
13
|
+
type: String(candidate.type ?? "custom"),
|
|
14
|
+
id: typeof candidate.id === "number" || typeof candidate.id === "string"
|
|
15
|
+
? candidate.id
|
|
16
|
+
: null,
|
|
17
|
+
url: typeof candidate.url === "string" ? candidate.url : null,
|
|
18
|
+
opensInNewTab: Boolean(candidate.opensInNewTab),
|
|
19
|
+
resolution: String(candidate.resolution ?? "legacy_raw")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Return only a browser-safe, resolved href. A bare # always fails closed. */
|
|
23
|
+
export function flowpressLinkHref(value) {
|
|
24
|
+
const relation = flowpressLinkValue(value);
|
|
25
|
+
if (relation && FAILED_RESOLUTIONS.has(relation.resolution))
|
|
26
|
+
return "";
|
|
27
|
+
const href = typeof value === "string"
|
|
28
|
+
? value.trim()
|
|
29
|
+
: String(relation?.url ?? "").trim();
|
|
30
|
+
return href !== "#" && VALID_HREF.test(href) ? href : "";
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,mDAAmD,CAAC;AACvE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,qBAAqB;IACrB,gBAAgB;IAChB,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,MAAM,SAAS,GAAG,KAAoC,CAAC;IACvD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,QAAQ,CAAC;QACxC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,QAAQ,CAAC;QACxC,EAAE,EAAE,OAAO,SAAS,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,SAAS,CAAC,EAAE,KAAK,QAAQ;YACtE,CAAC,CAAC,SAAS,CAAC,EAAE;YACd,CAAC,CAAC,IAAI;QACR,GAAG,EAAE,OAAO,SAAS,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;QAC7D,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;QAC/C,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,UAAU,IAAI,YAAY,CAAqC;KAC7F,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,QAAQ,IAAI,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,EAAE,CAAC;IACvE,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ;QACpC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QACd,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,OAAO,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["import type { FlowpressLinkValue } from \"./types.js\";\n\nconst VALID_HREF = /^(?:\\/(?!\\/)|#[^#\\s]+$|https?:\\/\\/|mailto:|tel:)/i;\nconst FAILED_RESOLUTIONS = new Set([\n \"missing_translation\",\n \"missing_entity\",\n \"invalid\"\n]);\n\nexport function flowpressLinkValue(value: unknown): FlowpressLinkValue | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n const candidate = value as Partial<FlowpressLinkValue>;\n return {\n kind: String(candidate.kind ?? \"custom\"),\n type: String(candidate.type ?? \"custom\"),\n id: typeof candidate.id === \"number\" || typeof candidate.id === \"string\"\n ? candidate.id\n : null,\n url: typeof candidate.url === \"string\" ? candidate.url : null,\n opensInNewTab: Boolean(candidate.opensInNewTab),\n resolution: String(candidate.resolution ?? \"legacy_raw\") as FlowpressLinkValue[\"resolution\"]\n };\n}\n\n/** Return only a browser-safe, resolved href. A bare # always fails closed. */\nexport function flowpressLinkHref(value: unknown): string {\n const relation = flowpressLinkValue(value);\n if (relation && FAILED_RESOLUTIONS.has(relation.resolution)) return \"\";\n const href = typeof value === \"string\"\n ? value.trim()\n : String(relation?.url ?? \"\").trim();\n return href !== \"#\" && VALID_HREF.test(href) ? href : \"\";\n}\n"]}
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const FLOWPRESS_UPLOADS_PREFIX = "/app/uploads/";
|
|
2
|
+
export declare const FLOWPRESS_MEDIA_PREFIX = "/media/";
|
|
3
|
+
export interface FlowpressFrontendMediaOptions {
|
|
4
|
+
frontendOrigin: string;
|
|
5
|
+
backendUrl?: string | undefined;
|
|
6
|
+
mediaUrl?: string | undefined;
|
|
7
|
+
/** Canonical frontend URLs and aliases owned by the selected backend. */
|
|
8
|
+
frontendUrls?: readonly string[] | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function rewriteFlowpressMediaUrl(value: string, options: FlowpressFrontendMediaOptions): string;
|
|
11
|
+
/** Normalize media data once, sharing unchanged branches and parsing origins
|
|
12
|
+
* once per payload. HTML, CSS and scripts remain intact.
|
|
13
|
+
*/
|
|
14
|
+
export declare function rewriteFlowpressMediaUrls<T>(value: T, options: FlowpressFrontendMediaOptions): T;
|
|
15
|
+
export declare function isFlowpressUploadPath(pathname: string): boolean;
|
|
16
|
+
export declare function isFlowpressMediaPath(pathname: string): boolean;
|
|
17
|
+
export declare function rewriteFlowpressBackendUrl(value: string, backendUrl: string, frontendOrigin?: string): string;
|
|
18
|
+
/** @deprecated Deliver media directly from WordPress or storage. Kept for existing consumers. */
|
|
19
|
+
export declare function proxyFlowpressUpload(request: Request, backendUrl: string, fetchImpl?: typeof fetch): Promise<Response>;
|
|
20
|
+
/**
|
|
21
|
+
* Proxy /media/<path> to the current FLOWPRESS_MEDIA origin (an offload CDN,
|
|
22
|
+
* or the WordPress backend as a fallback). /media/ is a frontend-only routing
|
|
23
|
+
* marker with no equivalent on either upstream, so it is stripped before the
|
|
24
|
+
* request is forwarded: /media/2026/09/x.jpg becomes <origin>/2026/09/x.jpg.
|
|
25
|
+
*/
|
|
26
|
+
/** @deprecated Deliver media directly from storage. Kept for existing consumers. */
|
|
27
|
+
export declare function proxyFlowpressMedia(request: Request, mediaUrl: string, fetchImpl?: typeof fetch): Promise<Response>;
|
|
28
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,MAAM,WAAW,6BAA6B;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,yEAAyE;IACzE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC9C;AAiCD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAEtG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,6BAA6B,GAAG,CAAC,CAyBhG;AAwBD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,cAAc,SAAK,GAClB,MAAM,CASR;AAoED,iGAAiG;AACjG,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,OAAO,KAAa,GAC9B,OAA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