@styleflow.app/flowpress-astro-core 1.0.0-beta.45 → 1.0.0-beta.47
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 +16 -0
- package/dist/astro/CompositionRenderer.astro +4 -3
- package/dist/astro/GutenbergRenderer.astro +5 -4
- package/dist/astro/motion/motion.css +5 -4
- package/dist/astro/native/flowpress-navigation.css +6 -5
- package/dist/astro/native/grid.d.ts.map +1 -1
- package/dist/astro/native/grid.js +7 -2
- package/dist/astro/native/grid.js.map +1 -1
- package/dist/astro/native/grid.ts +16 -2
- package/dist/astro/native/registry.d.ts.map +1 -1
- package/dist/astro/native/registry.js +2 -0
- package/dist/astro/native/registry.js.map +1 -1
- package/dist/astro/native/registry.ts +2 -0
- package/dist/astro/native/sf-slot.astro +6 -0
- package/dist/default-blocks.d.ts +1 -1
- package/dist/default-blocks.d.ts.map +1 -1
- package/dist/default-blocks.js +2 -1
- package/dist/default-blocks.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.47 — 2026-11-16
|
|
4
|
+
|
|
5
|
+
- Add the official `sf/slot` adapter. WordPress materializes each instance's blocks as `innerBlocks`; Astro renders only those children, with no wrapper, HTML attributes or visual context from the slot.
|
|
6
|
+
- Preserve the rendered parent and inherited tone through nested slots. Responsive grids count and decorate the actual slot children, including empty and nested slots, so spans and edge bleed match the DOM.
|
|
7
|
+
- Verify empty and populated slots, inherited context, synced-pattern content and responsive grid children through both Gutenberg and Site Editor renderer builds.
|
|
8
|
+
- Depend on `@styleflow.app/flowpress-components` 1.0.0-beta.19 for the shared structural slot contract.
|
|
9
|
+
- [Canonical report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-11-16-slot-pattern-sincronizzati.md).
|
|
10
|
+
|
|
11
|
+
## 1.0.0-beta.46 — 2026-11-04
|
|
12
|
+
|
|
13
|
+
- Menu toggle of `core/navigation`: the two bars sit 0.5rem apart and the cross is centred on the button. `flowpress-navigation.css` placed the bars at 35%/65% with `inset-inline: 0` and won over the `motion.css` insets, while `motion.css` still applied its centred transforms, so every offset counted twice: bars 14px apart and 10px left of the icon, cross 10px above the button centre (seen on friviera.it).
|
|
14
|
+
- `flowpress-navigation.css`: the static bars (pages without `motion.css`) use the same centred geometry as `motion.css` and zero specificity (`:where()`), so the two stylesheets compose in any order. The icon is centred in the 2.75rem button (`margin-inline: auto`).
|
|
15
|
+
- `motion.css`: the closed bars include the `-50%` of their own height, so the pair is symmetric around the icon centre (it sat 1px low), and bars are `0.125rem` thick, the 2px every navigation rendered so far. The `--bars` variant is unchanged.
|
|
16
|
+
- New renderer fixture pages `navigation-toggle` (with `motion.css`) and `navigation-static` (without) and browser check `tests/browser/navigation-toggle.js` (gap, vertical centre and cross centre, full and reduced motion).
|
|
17
|
+
- [Canonical report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-11-04-toggle-menu-navigazione.md).
|
|
18
|
+
|
|
3
19
|
## 1.0.0-beta.45 — 2026-11-04
|
|
4
20
|
|
|
5
21
|
- `sf/carousel` slides animate again. The track used `sf-motion-disable`, whose `transition: none !important` overrode the transition Splide writes inline on the list (slide) and on the slides (fade), so every move jumped. The track now uses the new `sf-reveal-skip`.
|
|
@@ -109,8 +109,9 @@ const logoStyles = parentBlockName === undefined
|
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
const Adapter = adapter.renderer;
|
|
112
|
+
const isSlot = block.name === "sf/slot";
|
|
112
113
|
const children = block.innerBlocks ?? [];
|
|
113
|
-
const styleflowProps = resolveFlowpressBlockStyleflowProps(
|
|
114
|
+
const styleflowProps = isSlot ? {} : resolveFlowpressBlockStyleflowProps(
|
|
114
115
|
block.attributes,
|
|
115
116
|
contract,
|
|
116
117
|
{},
|
|
@@ -122,7 +123,7 @@ const logoStyles = parentBlockName === undefined
|
|
|
122
123
|
)
|
|
123
124
|
}
|
|
124
125
|
);
|
|
125
|
-
const htmlProps = flowpressBlockHtmlProps(block.attributes);
|
|
126
|
+
const htmlProps = isSlot ? {} : flowpressBlockHtmlProps(block.attributes);
|
|
126
127
|
return (
|
|
127
128
|
<>
|
|
128
129
|
{issue && (
|
|
@@ -152,7 +153,7 @@ const logoStyles = parentBlockName === undefined
|
|
|
152
153
|
adapters={adapters}
|
|
153
154
|
blocks={children}
|
|
154
155
|
contract={contract}
|
|
155
|
-
parentBlockName={block.name}
|
|
156
|
+
parentBlockName={isSlot ? parentBlockName : block.name}
|
|
156
157
|
production={production}
|
|
157
158
|
depth={depth + 1}
|
|
158
159
|
inheritedTone={typeof styleflowProps.tone === "string" ? styleflowProps.tone : inheritedTone}
|
|
@@ -123,14 +123,15 @@ function nestedRendererProps(nextParentBlockName: string, attrs: Record<string,
|
|
|
123
123
|
|
|
124
124
|
{blocks.map((block, index) => {
|
|
125
125
|
const name = block.name.replace(/^sf\//, "");
|
|
126
|
+
const isSlot = block.name === "sf/slot";
|
|
126
127
|
const children = decorateGridBlocks(block.innerBlocks ?? []);
|
|
127
128
|
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
|
+
const semantic = isSlot ? {} : index === 0 && blocks.length === 1 && rootStyleflowProps
|
|
129
130
|
? rootStyleflowProps
|
|
130
131
|
: semanticProps(block.attributes, contract,
|
|
131
132
|
block.name.startsWith("core/") && block.name !== "core/group" ? {} : undefined,
|
|
132
133
|
inheritedTone);
|
|
133
|
-
const htmlAttributes = index === 0 && blocks.length === 1 && rootHtmlProps
|
|
134
|
+
const htmlAttributes = isSlot ? {} : index === 0 && blocks.length === 1 && rootHtmlProps
|
|
134
135
|
? { ...rootHtmlProps, class: Array.from(new Set([rootHtmlProps.class, block.attributes.className].filter(Boolean).join(" ").split(/\s+/))).join(" ") }
|
|
135
136
|
: blockHtmlAttributes(block.attributes);
|
|
136
137
|
const CustomBlockRenderer = block.name === skipCustomRendererFor
|
|
@@ -193,11 +194,11 @@ function nestedRendererProps(nextParentBlockName: string, attrs: Record<string,
|
|
|
193
194
|
iconRenderer={IconRenderer}
|
|
194
195
|
adapterDefinitions={adapterDefinitions}
|
|
195
196
|
composition={composition}
|
|
196
|
-
parentBlockName={block.name}
|
|
197
|
+
parentBlockName={isSlot ? parentBlockName : block.name}
|
|
197
198
|
production={production}
|
|
198
199
|
depth={depth + 1}
|
|
199
200
|
inheritedTone={typeof semantic.tone === "string" ? semantic.tone : inheritedTone}
|
|
200
|
-
interactiveAncestor={interactiveAncestor || Boolean(block.attributes.interactivePriority && !["none", "inherit"].includes(String(block.attributes.interactivePriority)))}
|
|
201
|
+
interactiveAncestor={interactiveAncestor || (!isSlot && Boolean(block.attributes.interactivePriority && !["none", "inherit"].includes(String(block.attributes.interactivePriority))))}
|
|
201
202
|
requireRegisteredAdapters={requireRegisteredAdapters}
|
|
202
203
|
/>
|
|
203
204
|
</CustomBlockRenderer>
|
|
@@ -414,7 +414,7 @@ details[open] > summary.sf-motion-disclosure .sf-motion-disclosure-icon {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
.sf-motion-menu-toggle__line {
|
|
417
|
-
block-size: 0.
|
|
417
|
+
block-size: 0.125rem;
|
|
418
418
|
border-radius: 999px;
|
|
419
419
|
box-shadow: inset 0 0 0 999px currentColor;
|
|
420
420
|
inline-size: 1.25rem;
|
|
@@ -427,18 +427,19 @@ details[open] > summary.sf-motion-disclosure .sf-motion-disclosure-icon {
|
|
|
427
427
|
transform var(--sf-motion-duration-reveal) var(--sf-motion-ease-out);
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
+
/* Bars centred on the icon (-50% of their own height), 0.5rem apart. */
|
|
430
431
|
.sf-motion-menu-toggle__line:nth-child(1) {
|
|
431
|
-
transform: translate(-50%, -0.25rem);
|
|
432
|
+
transform: translate(-50%, calc(-50% - 0.25rem));
|
|
432
433
|
}
|
|
433
434
|
.sf-motion-menu-toggle__line:nth-child(2) {
|
|
434
435
|
inline-size: 0.875rem;
|
|
435
|
-
transform: translate(-28%, 0.25rem);
|
|
436
|
+
transform: translate(-28%, calc(-50% + 0.25rem));
|
|
436
437
|
}
|
|
437
438
|
|
|
438
439
|
.sf-motion-menu-toggle:hover .sf-motion-menu-toggle__line:nth-child(2),
|
|
439
440
|
.sf-motion-menu-toggle:focus-visible .sf-motion-menu-toggle__line:nth-child(2) {
|
|
440
441
|
inline-size: 1.25rem;
|
|
441
|
-
transform: translate(-50%, 0.25rem);
|
|
442
|
+
transform: translate(-50%, calc(-50% + 0.25rem));
|
|
442
443
|
}
|
|
443
444
|
|
|
444
445
|
.sf-motion-menu-toggle[aria-expanded="true"] .sf-motion-menu-toggle__icon {
|
|
@@ -10,8 +10,9 @@ flowpress-navigation .site-nav__backdrop { position: fixed; inset: 0; z-index: v
|
|
|
10
10
|
flowpress-navigation[data-overlay-active="false"][data-orientation="horizontal"] .site-nav__list { flex-direction: row; flex-wrap: wrap; }
|
|
11
11
|
flowpress-navigation .site-nav__summary { cursor: pointer; }
|
|
12
12
|
flowpress-navigation .site-nav__link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
|
13
|
-
flowpress-navigation .sf-motion-menu-toggle__icon { display: block; inline-size: 1.25rem; block-size: 1.25rem; position: relative; }
|
|
14
|
-
|
|
15
|
-
flowpress-navigation .sf-motion-menu-toggle__line
|
|
16
|
-
flowpress-navigation
|
|
17
|
-
flowpress-navigation [aria-expanded="true"] .sf-motion-menu-toggle__line
|
|
13
|
+
flowpress-navigation .sf-motion-menu-toggle__icon { display: block; inline-size: 1.25rem; block-size: 1.25rem; margin-inline: auto; position: relative; }
|
|
14
|
+
/* Static bars for pages without motion.css. Same centred geometry as motion.css and zero specificity, so its transforms win instead of adding up. */
|
|
15
|
+
:where(flowpress-navigation .sf-motion-menu-toggle__line) { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; inline-size: 100%; block-size: 2px; background: currentColor; transform: translate(-50%, calc(-50% - 0.25rem)); }
|
|
16
|
+
:where(flowpress-navigation .sf-motion-menu-toggle__line + .sf-motion-menu-toggle__line) { transform: translate(-50%, calc(-50% + 0.25rem)); }
|
|
17
|
+
:where(flowpress-navigation [aria-expanded="true"] .sf-motion-menu-toggle__line) { transform: translate(-50%, -50%) rotate(45deg); }
|
|
18
|
+
:where(flowpress-navigation [aria-expanded="true"] .sf-motion-menu-toggle__line + .sf-motion-menu-toggle__line) { transform: translate(-50%, -50%) rotate(-45deg); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/astro/native/grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,eAAe,kDAAmD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAC5D,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAO1C,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,aAAY,cAAmB,KAAG,OAEhC,CAAC;AAExC,eAAO,MAAM,UAAU,GAAI,YAAY,cAAc,KAAG,MAQvD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,YAAY,cAAc,KAAG,MAQvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,cAAc,EAAE,MAAM,CAM7E,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,YAAY,cAAc,KAAG,MAAM,EAQ9D,CAAC;AAEF,eAAO,MA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AM,EAAE,EAsBzF,CAAC;AAqBF,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,cAAc,EAAE,KAAG,cAAc,EAkB1E,CAAC"}
|
|
@@ -79,18 +79,23 @@ const appendClasses = (attributes, classes) => ({
|
|
|
79
79
|
...attributes,
|
|
80
80
|
className: [...new Set([...(attributes.className || "").split(/\s+/), ...classes].filter(Boolean))].join(" "),
|
|
81
81
|
});
|
|
82
|
+
/** Slot children occupy their own grid cells because the slot has no DOM root. */
|
|
83
|
+
const visibleChildren = (blocks) => blocks.flatMap((block) => block.name === "sf/slot" ? visibleChildren(block.innerBlocks ?? []) : [block]);
|
|
84
|
+
const mapVisibleChildren = (blocks, decorate, cursor = { index: 0 }) => blocks.map((block) => block.name === "sf/slot"
|
|
85
|
+
? { ...block, innerBlocks: mapVisibleChildren(block.innerBlocks ?? [], decorate, cursor) }
|
|
86
|
+
: decorate(block, cursor.index++));
|
|
82
87
|
/** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
|
|
83
88
|
export const decorateGridBlocks = (blocks) => blocks.map((block) => {
|
|
84
89
|
const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;
|
|
85
90
|
const attributes = (block.attributes || {});
|
|
86
91
|
if (!isGrid(block.name, attributes))
|
|
87
92
|
return innerBlocks ? { ...block, innerBlocks } : block;
|
|
88
|
-
const children = innerBlocks ?? [];
|
|
93
|
+
const children = visibleChildren(innerBlocks ?? []);
|
|
89
94
|
const bleed = bleedClasses(attributes, children.map((child) => child.attributes || {}));
|
|
90
95
|
return {
|
|
91
96
|
...block,
|
|
92
97
|
attributes: appendClasses({ layoutRole: "stack", density: "regular", ...attributes }, gridClasses(attributes)),
|
|
93
|
-
innerBlocks:
|
|
98
|
+
innerBlocks: mapVisibleChildren(innerBlocks ?? [], (child, index) => ({
|
|
94
99
|
...child,
|
|
95
100
|
attributes: appendClasses(child.attributes || {}, [
|
|
96
101
|
...spanClasses(child.attributes || {}),
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QAAQ,GAAG,WAAW,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1G,OAAO;QACL,GAAG,KAAK;QACR,UAAU,EAAE,aAAa,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;QAC9G,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,GAAG,KAAK;YACR,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,UAA4B,IAAI,EAAE,EAAE;gBAClE,GAAG,WAAW,CAAC,KAAK,CAAC,UAA4B,IAAI,EAAE,CAAC;gBACxD,GAAG,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,UAA4B,IAAI,EAAE,CAAC;gBACxE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;aACxB,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../index.js\";\n\nexport const gridBreakpoints = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\nexport type GridBreakpoint = typeof gridBreakpoints[number];\ntype Values = Partial<Record<GridBreakpoint, number>>;\ntype GridAttributes = Record<string, any>;\n\nconst count = (value: unknown, fallback: number): number => {\n const n = Number(value);\n return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;\n};\n\nexport const isGrid = (name: string, attributes: GridAttributes = {}): boolean =>\n (name === \"core/group\" || name === \"core/post-template\" || name === \"core/term-template\")\n && attributes.layout?.type === \"grid\";\n\nexport const gridValues = (attributes: GridAttributes): Values => {\n const layout = attributes.layout || {};\n const values: Values = { base: count(layout.columnCount, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressColumns?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const spanValues = (attributes: GridAttributes): Values => {\n const layout = attributes.style?.layout || {};\n const values: Values = { base: count(layout.columnSpan, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressGridSpan?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const effectiveValues = (values: Values): Record<GridBreakpoint, number> => {\n let current = values.base ?? 1;\n return Object.fromEntries(gridBreakpoints.map((breakpoint) => {\n current = values[breakpoint] ?? current;\n return [breakpoint, current];\n })) as Record<GridBreakpoint, number>;\n};\n\nexport const gridClasses = (attributes: GridAttributes): string[] => {\n const values = gridValues(attributes);\n const align = attributes.layout?.flowpressAlign;\n return [\n \"fp-grid\",\n ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),\n ...( [\"start\", \"center\", \"end\", \"stretch\"].includes(align) ? [`fp-align-${align}`] : []),\n ];\n};\n\nexport const spanClasses = (attributes: GridAttributes): string[] => {\n const values = spanValues(attributes);\n return [\"fp-grid-item\", ...gridBreakpoints.flatMap((breakpoint) =>\n values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : []\n )];\n};\n\nexport const usedSpanClasses = (parent: GridAttributes, child: GridAttributes): string[] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = effectiveValues(spanValues(child));\n return gridBreakpoints.map((breakpoint) =>\n `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`\n );\n};\n\nexport const bleedClasses = (parent: GridAttributes, children: GridAttributes[]): string[][] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = children.map((child) => effectiveValues(spanValues(child)));\n const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? [\"fp-bleed-managed\"] : [] as string[]);\n for (const breakpoint of gridBreakpoints) {\n let position = 0;\n children.forEach((child, index) => {\n const width = Math.min(spans[index]![breakpoint], columns[breakpoint]);\n if (position + width > columns[breakpoint]) position = 0;\n const start = position === 0;\n const end = position + width === columns[breakpoint];\n const bleed = child.style?.layout?.flowpressGridBleed;\n const from = gridBreakpoints.indexOf(bleed?.from || \"base\");\n if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&\n ((bleed.side === \"start\" && start) || (bleed.side === \"end\" && end))) {\n result[index]!.push(`fp-bleed-${breakpoint}-${bleed.side}`);\n }\n position += width;\n if (position === columns[breakpoint]) position = 0;\n });\n }\n return result;\n};\n\nconst appendClasses = (attributes: GridAttributes, classes: string[]): GridAttributes => ({\n ...attributes,\n className: [...new Set([...(attributes.className || \"\").split(/\\s+/), ...classes].filter(Boolean))].join(\" \"),\n});\n\n/** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */\nexport const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {\n const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;\n const attributes = (block.attributes || {}) as GridAttributes;\n if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;\n const children = innerBlocks ?? [];\n const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));\n return {\n ...block,\n attributes: appendClasses({ layoutRole: \"stack\", density: \"regular\", ...attributes }, gridClasses(attributes)),\n innerBlocks: children.map((child, index) => ({\n ...child,\n attributes: appendClasses(child.attributes as GridAttributes || {}, [\n ...spanClasses(child.attributes as GridAttributes || {}),\n ...usedSpanClasses(attributes, child.attributes as GridAttributes || {}),\n ...(bleed[index] ?? []),\n ]),\n })),\n };\n});\n"]}
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/astro/native/grid.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,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AAK,CAAC,UAA4B,IAAI,EAAE,CAAC;gBACxE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;aACxB,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../index.js\";\n\nexport const gridBreakpoints = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\nexport type GridBreakpoint = typeof gridBreakpoints[number];\ntype Values = Partial<Record<GridBreakpoint, number>>;\ntype GridAttributes = Record<string, any>;\n\nconst count = (value: unknown, fallback: number): number => {\n const n = Number(value);\n return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;\n};\n\nexport const isGrid = (name: string, attributes: GridAttributes = {}): boolean =>\n (name === \"core/group\" || name === \"core/post-template\" || name === \"core/term-template\")\n && attributes.layout?.type === \"grid\";\n\nexport const gridValues = (attributes: GridAttributes): Values => {\n const layout = attributes.layout || {};\n const values: Values = { base: count(layout.columnCount, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressColumns?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const spanValues = (attributes: GridAttributes): Values => {\n const layout = attributes.style?.layout || {};\n const values: Values = { base: count(layout.columnSpan, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressGridSpan?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const effectiveValues = (values: Values): Record<GridBreakpoint, number> => {\n let current = values.base ?? 1;\n return Object.fromEntries(gridBreakpoints.map((breakpoint) => {\n current = values[breakpoint] ?? current;\n return [breakpoint, current];\n })) as Record<GridBreakpoint, number>;\n};\n\nexport const gridClasses = (attributes: GridAttributes): string[] => {\n const values = gridValues(attributes);\n const align = attributes.layout?.flowpressAlign;\n return [\n \"fp-grid\",\n ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),\n ...( [\"start\", \"center\", \"end\", \"stretch\"].includes(align) ? [`fp-align-${align}`] : []),\n ];\n};\n\nexport const spanClasses = (attributes: GridAttributes): string[] => {\n const values = spanValues(attributes);\n return [\"fp-grid-item\", ...gridBreakpoints.flatMap((breakpoint) =>\n values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : []\n )];\n};\n\nexport const usedSpanClasses = (parent: GridAttributes, child: GridAttributes): string[] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = effectiveValues(spanValues(child));\n return gridBreakpoints.map((breakpoint) =>\n `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`\n );\n};\n\nexport const bleedClasses = (parent: GridAttributes, children: GridAttributes[]): string[][] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = children.map((child) => effectiveValues(spanValues(child)));\n const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? [\"fp-bleed-managed\"] : [] as string[]);\n for (const breakpoint of gridBreakpoints) {\n let position = 0;\n children.forEach((child, index) => {\n const width = Math.min(spans[index]![breakpoint], columns[breakpoint]);\n if (position + width > columns[breakpoint]) position = 0;\n const start = position === 0;\n const end = position + width === columns[breakpoint];\n const bleed = child.style?.layout?.flowpressGridBleed;\n const from = gridBreakpoints.indexOf(bleed?.from || \"base\");\n if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&\n ((bleed.side === \"start\" && start) || (bleed.side === \"end\" && end))) {\n result[index]!.push(`fp-bleed-${breakpoint}-${bleed.side}`);\n }\n position += width;\n if (position === columns[breakpoint]) position = 0;\n });\n }\n return result;\n};\n\nconst appendClasses = (attributes: GridAttributes, classes: string[]): GridAttributes => ({\n ...attributes,\n className: [...new Set([...(attributes.className || \"\").split(/\\s+/), ...classes].filter(Boolean))].join(\" \"),\n});\n\n/** Slot children occupy their own grid cells because the slot has no DOM root. */\nconst visibleChildren = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.flatMap((block) =>\n block.name === \"sf/slot\" ? visibleChildren(block.innerBlocks ?? []) : [block]\n);\n\nconst mapVisibleChildren = (\n blocks: FlowpressBlock[],\n decorate: (block: FlowpressBlock, index: number) => FlowpressBlock,\n cursor = { index: 0 }\n): FlowpressBlock[] => blocks.map((block) => block.name === \"sf/slot\"\n ? { ...block, innerBlocks: mapVisibleChildren(block.innerBlocks ?? [], decorate, cursor) }\n : decorate(block, cursor.index++)\n);\n\n/** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */\nexport const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {\n const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;\n const attributes = (block.attributes || {}) as GridAttributes;\n if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;\n const children = visibleChildren(innerBlocks ?? []);\n const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));\n return {\n ...block,\n attributes: appendClasses({ layoutRole: \"stack\", density: \"regular\", ...attributes }, gridClasses(attributes)),\n innerBlocks: mapVisibleChildren(innerBlocks ?? [], (child, index) => ({\n ...child,\n attributes: appendClasses(child.attributes as GridAttributes || {}, [\n ...spanClasses(child.attributes as GridAttributes || {}),\n ...usedSpanClasses(attributes, child.attributes as GridAttributes || {}),\n ...(bleed[index] ?? []),\n ]),\n })),\n };\n});\n"]}
|
|
@@ -96,17 +96,31 @@ const appendClasses = (attributes: GridAttributes, classes: string[]): GridAttri
|
|
|
96
96
|
className: [...new Set([...(attributes.className || "").split(/\s+/), ...classes].filter(Boolean))].join(" "),
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
/** Slot children occupy their own grid cells because the slot has no DOM root. */
|
|
100
|
+
const visibleChildren = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.flatMap((block) =>
|
|
101
|
+
block.name === "sf/slot" ? visibleChildren(block.innerBlocks ?? []) : [block]
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const mapVisibleChildren = (
|
|
105
|
+
blocks: FlowpressBlock[],
|
|
106
|
+
decorate: (block: FlowpressBlock, index: number) => FlowpressBlock,
|
|
107
|
+
cursor = { index: 0 }
|
|
108
|
+
): FlowpressBlock[] => blocks.map((block) => block.name === "sf/slot"
|
|
109
|
+
? { ...block, innerBlocks: mapVisibleChildren(block.innerBlocks ?? [], decorate, cursor) }
|
|
110
|
+
: decorate(block, cursor.index++)
|
|
111
|
+
);
|
|
112
|
+
|
|
99
113
|
/** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
|
|
100
114
|
export const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {
|
|
101
115
|
const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;
|
|
102
116
|
const attributes = (block.attributes || {}) as GridAttributes;
|
|
103
117
|
if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;
|
|
104
|
-
const children = innerBlocks ?? [];
|
|
118
|
+
const children = visibleChildren(innerBlocks ?? []);
|
|
105
119
|
const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));
|
|
106
120
|
return {
|
|
107
121
|
...block,
|
|
108
122
|
attributes: appendClasses({ layoutRole: "stack", density: "regular", ...attributes }, gridClasses(attributes)),
|
|
109
|
-
innerBlocks:
|
|
123
|
+
innerBlocks: mapVisibleChildren(innerBlocks ?? [], (child, index) => ({
|
|
110
124
|
...child,
|
|
111
125
|
attributes: appendClasses(child.attributes as GridAttributes || {}, [
|
|
112
126
|
...spanClasses(child.attributes as GridAttributes || {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAyCxE,eAAO,MAAM,oBAAoB,EAAE,uBA0ClC,CAAC"}
|
|
@@ -36,12 +36,14 @@ import SeparatorBlock from "./core-separator.astro";
|
|
|
36
36
|
import SiteLogoBlock from "../blocks/SiteLogoBlock.astro";
|
|
37
37
|
import ThemeToggleBlock from "../blocks/ThemeToggleBlock.astro";
|
|
38
38
|
import ReservedLogin from "./ReservedLogin.astro";
|
|
39
|
+
import Slot from "./sf-slot.astro";
|
|
39
40
|
export const nativeBlockRenderers = {
|
|
40
41
|
"core/separator": SeparatorBlock,
|
|
41
42
|
"core/post-content": TransparentBlock,
|
|
42
43
|
"core/template-part": TransparentBlock,
|
|
43
44
|
"core/site-logo": SiteLogoBlock,
|
|
44
45
|
"sf/theme-toggle": ThemeToggleBlock,
|
|
46
|
+
"sf/slot": Slot,
|
|
45
47
|
"core/term-name": Renderer0,
|
|
46
48
|
"core/post-terms": Renderer2,
|
|
47
49
|
"core/button": Renderer3,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,SAAS,MAAM,+BAA+B,CAAC;AACtD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,UA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S;IACpB,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,UAAU;IACzB,kBAAkB,EAAE,iBAAiB;CACtC,CAAC","sourcesContent":["import type { FlowpressBlockRenderers } from \"../../block-renderers.js\";\nimport Renderer0 from \"./core-term-name.astro\";\nimport Renderer2 from \"./core-post-terms.astro\";\nimport Renderer3 from \"./core-button.astro\";\nimport Renderer4 from \"./core-post-date.astro\";\nimport Renderer5 from \"./core-icon.astro\";\nimport Renderer6 from \"./core-post-excerpt.astro\";\nimport Renderer7 from \"./core-term-description.astro\";\nimport Renderer8 from \"./core-post-template.astro\";\nimport Renderer9 from \"./core-group.astro\";\nimport Renderer10 from \"./core-html.astro\";\nimport Renderer11 from \"./core-block.astro\";\nimport Renderer12 from \"./core-site-title.astro\";\nimport Renderer13 from \"./core-post-featured-image.astro\";\nimport Renderer14 from \"./core-page-list.astro\";\nimport Renderer15 from \"./core-terms-query.astro\";\nimport Renderer16 from \"./core-buttons.astro\";\nimport Renderer17 from \"./core-image.astro\";\nimport Renderer18 from \"./core-query-no-results.astro\";\nimport Renderer19 from \"./core-term-template.astro\";\nimport Renderer20 from \"./core-navigation.astro\";\nimport Renderer21 from \"./core-navigation-submenu.astro\";\nimport Renderer22 from \"./core-query.astro\";\nimport Renderer23 from \"./core-home-link.astro\";\nimport Renderer24 from \"./core-page-list-item.astro\";\nimport Renderer25 from \"./core-navigation-link.astro\";\nimport Renderer26 from \"./core-post-title.astro\";\nimport Renderer27 from \"./sf-post-field.astro\";\nimport Renderer28 from \"./sf-block-binding.astro\";\nimport Renderer29 from \"./sf-term-field.astro\";\nimport Renderer30 from \"./MapBlock.astro\";\nimport Renderer31 from \"./ProjectTimelineBlock.astro\";\nimport TimelineCardBlock from \"./TimelineCardBlock.astro\";\nimport BlobBlock from \"./BlobBlock.astro\";\nimport TransparentBlock from \"./core-transparent.astro\";\nimport SeparatorBlock from \"./core-separator.astro\";\nimport SiteLogoBlock from \"../blocks/SiteLogoBlock.astro\";\nimport ThemeToggleBlock from \"../blocks/ThemeToggleBlock.astro\";\nimport ReservedLogin from \"./ReservedLogin.astro\";\nimport Slot from \"./sf-slot.astro\";\n\nexport const nativeBlockRenderers: FlowpressBlockRenderers = {\n \"core/separator\": SeparatorBlock,\n \"core/post-content\": TransparentBlock,\n \"core/template-part\": TransparentBlock,\n \"core/site-logo\": SiteLogoBlock,\n \"sf/theme-toggle\": ThemeToggleBlock,\n \"sf/slot\": Slot,\n \"core/term-name\": Renderer0,\n \"core/post-terms\": Renderer2,\n \"core/button\": Renderer3,\n \"core/post-date\": Renderer4,\n \"core/icon\": Renderer5,\n \"core/post-excerpt\": Renderer6,\n \"core/term-description\": Renderer7,\n \"core/post-template\": Renderer8,\n \"core/group\": Renderer9,\n \"core/html\": Renderer10,\n \"core/block\": Renderer11,\n \"core/site-title\": Renderer12,\n \"core/post-featured-image\": Renderer13,\n \"core/page-list\": Renderer14,\n \"core/terms-query\": Renderer15,\n \"core/buttons\": Renderer16,\n \"core/image\": Renderer17,\n \"flowpress/login\": ReservedLogin,\n \"flowpress/reserved-pagination\": ReservedLogin,\n \"core/query-no-results\": Renderer18,\n \"core/term-template\": Renderer19,\n \"core/navigation\": Renderer20,\n \"core/navigation-submenu\": Renderer21,\n \"core/query\": Renderer22,\n \"core/home-link\": Renderer23,\n \"core/page-list-item\": Renderer24,\n \"core/navigation-link\": Renderer25,\n \"core/post-title\": Renderer26,\n \"sf/post-field\": Renderer27,\n \"sf/block-binding\": Renderer28,\n \"sf/term-field\": Renderer29,\n \"sf/blob\": BlobBlock,\n \"sf/map\": Renderer30,\n \"sf/timeline\": Renderer31,\n \"sf/timeline-card\": TimelineCardBlock,\n};\n"]}
|
|
@@ -37,6 +37,7 @@ import SeparatorBlock from "./core-separator.astro";
|
|
|
37
37
|
import SiteLogoBlock from "../blocks/SiteLogoBlock.astro";
|
|
38
38
|
import ThemeToggleBlock from "../blocks/ThemeToggleBlock.astro";
|
|
39
39
|
import ReservedLogin from "./ReservedLogin.astro";
|
|
40
|
+
import Slot from "./sf-slot.astro";
|
|
40
41
|
|
|
41
42
|
export const nativeBlockRenderers: FlowpressBlockRenderers = {
|
|
42
43
|
"core/separator": SeparatorBlock,
|
|
@@ -44,6 +45,7 @@ export const nativeBlockRenderers: FlowpressBlockRenderers = {
|
|
|
44
45
|
"core/template-part": TransparentBlock,
|
|
45
46
|
"core/site-logo": SiteLogoBlock,
|
|
46
47
|
"sf/theme-toggle": ThemeToggleBlock,
|
|
48
|
+
"sf/slot": Slot,
|
|
47
49
|
"core/term-name": Renderer0,
|
|
48
50
|
"core/post-terms": Renderer2,
|
|
49
51
|
"core/button": Renderer3,
|
package/dist/default-blocks.d.ts
CHANGED
|
@@ -1 +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;
|
|
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;AAmFD,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"}
|
package/dist/default-blocks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "
|
|
1
|
+
export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "7";
|
|
2
2
|
const blockNames = [
|
|
3
3
|
"core/separator",
|
|
4
4
|
"core/post-content",
|
|
@@ -72,6 +72,7 @@ const blockNames = [
|
|
|
72
72
|
"sf/quote",
|
|
73
73
|
"sf/rich-text",
|
|
74
74
|
"sf/section",
|
|
75
|
+
"sf/slot",
|
|
75
76
|
"sf/template",
|
|
76
77
|
"sf/term-list",
|
|
77
78
|
"sf/video",
|
|
@@ -1 +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,kBAAkB;IAClB,eAAe;IACf,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 = \"
|
|
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,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ACxE,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 = \"7\" 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 \"sf/block-binding\",\n \"sf/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/slot\",\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleflow.app/flowpress-astro-core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.47",
|
|
4
4
|
"description": "Project-agnostic WordPress routing, templates, SEO and GraphQL runtime for FlowPress Astro apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"dependencies": {
|
|
96
96
|
"@splidejs/splide": "4.1.4",
|
|
97
97
|
"@styleflow.app/astro": "1.0.0-beta.11",
|
|
98
|
-
"@styleflow.app/flowpress-components": "1.0.0-beta.
|
|
98
|
+
"@styleflow.app/flowpress-components": "1.0.0-beta.19",
|
|
99
99
|
"entities": "8.1.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|