@styleflow.app/flowpress-astro-core 1.0.0-beta.47 → 1.0.0-beta.48
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 +6 -0
- package/dist/astro/CompositionRenderer.astro +2 -1
- package/dist/astro/GutenbergRenderer.astro +2 -1
- package/dist/astro/native/AccordionRuntime.astro +11 -0
- package/dist/astro/native/accordion-controller.d.ts +3 -0
- package/dist/astro/native/accordion-controller.d.ts.map +1 -0
- package/dist/astro/native/accordion-controller.js +132 -0
- package/dist/astro/native/accordion-controller.js.map +1 -0
- package/dist/astro/native/accordion-controller.ts +97 -0
- package/dist/astro/native/accordion.css +29 -0
- package/dist/astro/native/accordion.d.ts +23 -0
- package/dist/astro/native/accordion.d.ts.map +1 -0
- package/dist/astro/native/accordion.js +58 -0
- package/dist/astro/native/accordion.js.map +1 -0
- package/dist/astro/native/accordion.ts +70 -0
- package/dist/astro/native/core-accordion-heading.astro +21 -0
- package/dist/astro/native/core-accordion-item.astro +8 -0
- package/dist/astro/native/core-accordion-panel.astro +8 -0
- package/dist/astro/native/core-accordion.astro +8 -0
- package/dist/astro/native/registry.d.ts.map +1 -1
- package/dist/astro/native/registry.js +8 -0
- package/dist/astro/native/registry.js.map +1 -1
- package/dist/astro/native/registry.ts +9 -0
- package/dist/default-blocks.d.ts +1 -1
- package/dist/default-blocks.d.ts.map +1 -1
- package/dist/default-blocks.js +5 -1
- package/dist/default-blocks.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.48 — 2026-11-17
|
|
4
|
+
|
|
5
|
+
- Aggiunge i quattro adapter ufficiali della famiglia `core/accordion`, catalogo default v8, props StyleFlow sul pulsante e icone configurabili risolte dal CMS.
|
|
6
|
+
- Runtime autonomo con scorrimento e rotazione da variabili CSS globali, tastiera, autoclose, hash, gruppi annidati, cleanup Astro e contenuti leggibili senza JavaScript. I renderer `sf/*` rimangono disponibili.
|
|
7
|
+
- [Rapporto canonico](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-11-17-accordion-nativo.md).
|
|
8
|
+
|
|
3
9
|
## 1.0.0-beta.47 — 2026-11-16
|
|
4
10
|
|
|
5
11
|
- 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.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import "./native/inline-text.css";
|
|
3
|
+
import { decorateAccordionBlocks, accordionRenderPrefix } from "./native/accordion.js";
|
|
3
4
|
import { registerFlowpressRenderSvgMedia, type FlowpressSvgMediaLocals } from "../svg-media.js";
|
|
4
5
|
import "./native/grid.css";
|
|
5
6
|
import "./native/group.css";
|
|
@@ -59,7 +60,7 @@ const inputBlocks = sourceBlocks
|
|
|
59
60
|
: composition.blocks;
|
|
60
61
|
// Prepare the whole authored tree once, before adapters render native groups.
|
|
61
62
|
// Nested resolved passes prepare their own trees through ResolvedBlocks.
|
|
62
|
-
const blocks = depth === 0 ? decorateGridBlocks(inputBlocks) : inputBlocks;
|
|
63
|
+
const blocks = decorateAccordionBlocks(depth === 0 ? decorateGridBlocks(inputBlocks) : inputBlocks, accordionRenderPrefix(Astro.locals));
|
|
63
64
|
|
|
64
65
|
const prepared = Astro.props.prepared ?? {
|
|
65
66
|
descriptors: flowpressBlockTypeDescriptors(composition),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import "./native/inline-text.css";
|
|
3
|
+
import { decorateAccordionBlocks, accordionRenderPrefix } from "./native/accordion.js";
|
|
3
4
|
import { registerFlowpressRenderSvgMedia, type FlowpressSvgMediaLocals } from "../svg-media.js";
|
|
4
5
|
import Media from "./Media.astro";
|
|
5
6
|
import { decodeFlowpressText } from "../text.js";
|
|
@@ -81,7 +82,7 @@ const {
|
|
|
81
82
|
registerFlowpressRenderSvgMedia(rawBlocks, Astro.locals as FlowpressSvgMediaLocals);
|
|
82
83
|
|
|
83
84
|
const { decorateGridBlocks } = await import("./native/grid.js");
|
|
84
|
-
const blocks = decorateGridBlocks(rawBlocks);
|
|
85
|
+
const blocks = decorateAccordionBlocks(decorateGridBlocks(rawBlocks), accordionRenderPrefix(Astro.locals));
|
|
85
86
|
const { nativeBlockRenderers } = await import("./native/registry.js");
|
|
86
87
|
const effectiveRenderers = { ...nativeBlockRenderers, ...blockRenderers };
|
|
87
88
|
const descriptors = Astro.props.descriptorIndex ?? (composition ? flowpressBlockTypeDescriptors(composition) : undefined);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "./accordion.css";
|
|
3
|
+
---
|
|
4
|
+
<script>
|
|
5
|
+
import { initializeNativeAccordions } from "./accordion-controller.js";
|
|
6
|
+
let cleanup = () => {};
|
|
7
|
+
const start = () => { cleanup(); cleanup = initializeNativeAccordions(); };
|
|
8
|
+
start();
|
|
9
|
+
document.addEventListener("astro:page-load", start);
|
|
10
|
+
document.addEventListener("astro:before-swap", () => cleanup());
|
|
11
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion-controller.d.ts","sourceRoot":"","sources":["../../../src/astro/native/accordion-controller.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,wBAAgB,0BAA0B,CAAC,KAAK,GAAE,UAAqB,GAAG,MAAM,IAAI,CA4FnF"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { getMotionPreference, subscribeMotionPreference } from "../../motion-preference.js";
|
|
2
|
+
const owner = (element, group) => element.closest("[data-fp-accordion]") === group;
|
|
3
|
+
/** Each invocation owns only the groups it binds; safe under Astro navigation. */
|
|
4
|
+
export function initializeNativeAccordions(scope = document) {
|
|
5
|
+
const cleanups = [];
|
|
6
|
+
scope.querySelectorAll("[data-fp-accordion]").forEach(group => {
|
|
7
|
+
if (group.dataset.fpAccordionReady === "true")
|
|
8
|
+
return;
|
|
9
|
+
const reduced = () => getMotionPreference() === "reduce" || Boolean(group.closest(".sf-motion-disable"));
|
|
10
|
+
const items = [...group.querySelectorAll("[data-fp-accordion-item]")].filter(el => owner(el, group)).flatMap(item => {
|
|
11
|
+
const button = [...item.querySelectorAll("[data-fp-accordion-toggle]")].find(el => el.closest("[data-fp-accordion-item]") === item);
|
|
12
|
+
const panel = [...item.querySelectorAll("[data-fp-accordion-panel]")].find(el => el.closest("[data-fp-accordion-item]") === item);
|
|
13
|
+
if (!button || !panel)
|
|
14
|
+
return [];
|
|
15
|
+
let expanded = item.dataset.fpAccordionInitialOpen === "true";
|
|
16
|
+
let animation;
|
|
17
|
+
const sync = () => {
|
|
18
|
+
button.setAttribute("aria-expanded", String(expanded));
|
|
19
|
+
item.classList.toggle("is-open", expanded);
|
|
20
|
+
panel.inert = !expanded;
|
|
21
|
+
};
|
|
22
|
+
const settle = () => {
|
|
23
|
+
animation?.cancel();
|
|
24
|
+
animation = undefined;
|
|
25
|
+
delete panel.dataset.fpAccordionAnimating;
|
|
26
|
+
panel.hidden = !expanded;
|
|
27
|
+
sync();
|
|
28
|
+
};
|
|
29
|
+
const setExpanded = (next, animate = true) => {
|
|
30
|
+
if (next === expanded)
|
|
31
|
+
return;
|
|
32
|
+
const from = panel.hidden ? 0 : panel.getBoundingClientRect().height;
|
|
33
|
+
animation?.cancel();
|
|
34
|
+
animation = undefined;
|
|
35
|
+
expanded = next;
|
|
36
|
+
panel.hidden = false;
|
|
37
|
+
sync();
|
|
38
|
+
panel.dataset.fpAccordionAnimating = "true";
|
|
39
|
+
const style = getComputedStyle(panel);
|
|
40
|
+
const time = style.getPropertyValue("--fp-accordion-computed-panel-duration").trim();
|
|
41
|
+
const duration = parseFloat(time) * (time.endsWith("ms") ? 1 : 1000);
|
|
42
|
+
const to = expanded ? panel.getBoundingClientRect().height : 0;
|
|
43
|
+
if (!animate || reduced() || panel.closest(".sf-motion-disable") || !panel.animate || !Number.isFinite(duration) || duration <= 0 || from === to) {
|
|
44
|
+
settle();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
animation = panel.animate([{ height: `${from}px` }, { height: `${to}px` }], {
|
|
49
|
+
duration, easing: style.getPropertyValue("--fp-accordion-computed-panel-easing").trim() || "ease-out", fill: "both",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
settle();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
animation.onfinish = settle;
|
|
57
|
+
};
|
|
58
|
+
settle();
|
|
59
|
+
return [{ item, button, panel, setExpanded, settle, isOpen: () => expanded }];
|
|
60
|
+
});
|
|
61
|
+
const onClick = (event) => {
|
|
62
|
+
if (!(event.target instanceof Element))
|
|
63
|
+
return;
|
|
64
|
+
const button = event.target.closest("[data-fp-accordion-toggle]");
|
|
65
|
+
const current = items.find(item => item.button === button);
|
|
66
|
+
if (!current || !button || !owner(button, group) || event.defaultPrevented)
|
|
67
|
+
return;
|
|
68
|
+
const next = !current.isOpen();
|
|
69
|
+
if (next && group.dataset.fpAccordionAutoclose === "true")
|
|
70
|
+
items.forEach(item => { if (item !== current)
|
|
71
|
+
item.setExpanded(false); });
|
|
72
|
+
current.setExpanded(next);
|
|
73
|
+
};
|
|
74
|
+
const onKey = (event) => {
|
|
75
|
+
const index = items.findIndex(item => item.button === event.target);
|
|
76
|
+
if (index < 0 || !["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key))
|
|
77
|
+
return;
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : Math.max(0, Math.min(items.length - 1, index + (event.key === "ArrowDown" ? 1 : -1)));
|
|
80
|
+
items[next]?.button.focus();
|
|
81
|
+
};
|
|
82
|
+
const onHash = () => {
|
|
83
|
+
let id;
|
|
84
|
+
try {
|
|
85
|
+
id = decodeURIComponent(window.location.hash.slice(1));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const target = id ? document.getElementById(id) : null;
|
|
91
|
+
if (!target)
|
|
92
|
+
return;
|
|
93
|
+
const current = items.find(item => item.panel === target || item.panel.contains(target));
|
|
94
|
+
if (!current)
|
|
95
|
+
return;
|
|
96
|
+
if (group.dataset.fpAccordionAutoclose === "true")
|
|
97
|
+
items.forEach(item => { if (item !== current)
|
|
98
|
+
item.setExpanded(false, false); });
|
|
99
|
+
current.setExpanded(true, false);
|
|
100
|
+
requestAnimationFrame(() => target.scrollIntoView());
|
|
101
|
+
};
|
|
102
|
+
const syncMotion = () => {
|
|
103
|
+
group.dataset.fpAccordionMotion = reduced() ? "reduce" : "full";
|
|
104
|
+
if (reduced())
|
|
105
|
+
items.forEach(item => item.settle());
|
|
106
|
+
};
|
|
107
|
+
syncMotion();
|
|
108
|
+
const unsubscribe = subscribeMotionPreference(syncMotion);
|
|
109
|
+
group.dataset.fpAccordionReady = "true";
|
|
110
|
+
group.addEventListener("click", onClick);
|
|
111
|
+
group.addEventListener("keydown", onKey);
|
|
112
|
+
window.addEventListener("hashchange", onHash);
|
|
113
|
+
onHash();
|
|
114
|
+
cleanups.push(() => {
|
|
115
|
+
unsubscribe();
|
|
116
|
+
group.removeEventListener("click", onClick);
|
|
117
|
+
group.removeEventListener("keydown", onKey);
|
|
118
|
+
window.removeEventListener("hashchange", onHash);
|
|
119
|
+
delete group.dataset.fpAccordionReady;
|
|
120
|
+
delete group.dataset.fpAccordionMotion;
|
|
121
|
+
items.forEach(({ item, button, panel, settle }) => {
|
|
122
|
+
settle();
|
|
123
|
+
panel.hidden = false;
|
|
124
|
+
panel.inert = false;
|
|
125
|
+
button.setAttribute("aria-expanded", "true");
|
|
126
|
+
item.classList.remove("is-open");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
return () => cleanups.forEach(cleanup => cleanup());
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=accordion-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion-controller.js","sourceRoot":"","sources":["../../../src/astro/native/accordion-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,MAAM,KAAK,GAAG,CAAC,OAAgB,EAAE,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,KAAK,KAAK,CAAC;AACrG,kFAAkF;AAClF,MAAM,UAAU,0BAA0B,CAAC,QAAoB,QAAQ;IACrE,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,KAAK,CAAC,gBAAgB,CAAc,qBAAqB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzE,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,KAAK,MAAM;YAAE,OAAO;QACtD,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,mBAAmB,EAAE,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACzG,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAc,0BAA0B,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC/H,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAoB,4BAA4B,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,KAAK,IAAI,CAAC,CAAC;YACvJ,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAc,2BAA2B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D,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAAC,OAAO,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAC9E,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;gBAChD,MAAM,EAAE,CAAC;gBAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;gBAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;gBAAC,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;gBAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACtI,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { getMotionPreference, subscribeMotionPreference } from \"../../motion-preference.js\";\n\nconst owner = (element: Element, group: Element) => element.closest(\"[data-fp-accordion]\") === group;\n/** Each invocation owns only the groups it binds; safe under Astro navigation. */\nexport function initializeNativeAccordions(scope: ParentNode = document): () => void {\n const cleanups: (() => void)[] = [];\n scope.querySelectorAll<HTMLElement>(\"[data-fp-accordion]\").forEach(group => {\n if (group.dataset.fpAccordionReady === \"true\") return;\n const reduced = () => getMotionPreference() === \"reduce\" || Boolean(group.closest(\".sf-motion-disable\"));\n const items = [...group.querySelectorAll<HTMLElement>(\"[data-fp-accordion-item]\")].filter(el => owner(el, group)).flatMap(item => {\n const button = [...item.querySelectorAll<HTMLButtonElement>(\"[data-fp-accordion-toggle]\")].find(el => el.closest(\"[data-fp-accordion-item]\") === item);\n const panel = [...item.querySelectorAll<HTMLElement>(\"[data-fp-accordion-panel]\")].find(el => el.closest(\"[data-fp-accordion-item]\") === item);\n if (!button || !panel) return [];\n let expanded = item.dataset.fpAccordionInitialOpen === \"true\";\n let animation: Animation | undefined;\n const sync = () => {\n button.setAttribute(\"aria-expanded\", String(expanded));\n item.classList.toggle(\"is-open\", expanded);\n panel.inert = !expanded;\n };\n const settle = () => {\n animation?.cancel(); animation = undefined;\n delete panel.dataset.fpAccordionAnimating;\n panel.hidden = !expanded;\n sync();\n };\n const setExpanded = (next: boolean, animate = true) => {\n if (next === expanded) return;\n const from = panel.hidden ? 0 : panel.getBoundingClientRect().height;\n animation?.cancel(); animation = undefined;\n expanded = next; panel.hidden = false;\n sync();\n panel.dataset.fpAccordionAnimating = \"true\";\n const style = getComputedStyle(panel);\n const time = style.getPropertyValue(\"--fp-accordion-computed-panel-duration\").trim();\n const duration = parseFloat(time) * (time.endsWith(\"ms\") ? 1 : 1000);\n const to = expanded ? panel.getBoundingClientRect().height : 0;\n if (!animate || reduced() || panel.closest(\".sf-motion-disable\") || !panel.animate || !Number.isFinite(duration) || duration <= 0 || from === to) { settle(); return; }\n try {\n animation = panel.animate([{ height: `${from}px` }, { height: `${to}px` }], {\n duration, easing: style.getPropertyValue(\"--fp-accordion-computed-panel-easing\").trim() || \"ease-out\", fill: \"both\",\n });\n } catch { settle(); return; }\n animation.onfinish = settle;\n };\n settle();\n return [{ item, button, panel, setExpanded, settle, isOpen: () => expanded }];\n });\n const onClick = (event: Event) => {\n if (!(event.target instanceof Element)) return;\n const button = event.target.closest(\"[data-fp-accordion-toggle]\");\n const current = items.find(item => item.button === button);\n if (!current || !button || !owner(button, group) || event.defaultPrevented) return;\n const next = !current.isOpen();\n if (next && group.dataset.fpAccordionAutoclose === \"true\") items.forEach(item => { if (item !== current) item.setExpanded(false); });\n current.setExpanded(next);\n };\n const onKey = (event: KeyboardEvent) => {\n const index = items.findIndex(item => item.button === event.target);\n if (index < 0 || ![\"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"].includes(event.key)) return;\n event.preventDefault();\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : Math.max(0, Math.min(items.length - 1, index + (event.key === \"ArrowDown\" ? 1 : -1)));\n items[next]?.button.focus();\n };\n const onHash = () => {\n let id: string;\n try { id = decodeURIComponent(window.location.hash.slice(1)); } catch { return; }\n const target = id ? document.getElementById(id) : null;\n if (!target) return;\n const current = items.find(item => item.panel === target || item.panel.contains(target));\n if (!current) return;\n if (group.dataset.fpAccordionAutoclose === \"true\") items.forEach(item => { if (item !== current) item.setExpanded(false, false); });\n current.setExpanded(true, false);\n requestAnimationFrame(() => target.scrollIntoView());\n };\n const syncMotion = () => {\n group.dataset.fpAccordionMotion = reduced() ? \"reduce\" : \"full\";\n if (reduced()) items.forEach(item => item.settle());\n };\n syncMotion();\n const unsubscribe = subscribeMotionPreference(syncMotion);\n group.dataset.fpAccordionReady = \"true\";\n group.addEventListener(\"click\", onClick);\n group.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"hashchange\", onHash);\n onHash();\n cleanups.push(() => {\n unsubscribe(); group.removeEventListener(\"click\", onClick); group.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"hashchange\", onHash);\n delete group.dataset.fpAccordionReady; delete group.dataset.fpAccordionMotion;\n items.forEach(({ item, button, panel, settle }) => {\n settle(); panel.hidden = false; panel.inert = false; button.setAttribute(\"aria-expanded\", \"true\"); item.classList.remove(\"is-open\");\n });\n });\n });\n return () => cleanups.forEach(cleanup => cleanup());\n}\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { getMotionPreference, subscribeMotionPreference } from "../../motion-preference.js";
|
|
2
|
+
|
|
3
|
+
const owner = (element: Element, group: Element) => element.closest("[data-fp-accordion]") === group;
|
|
4
|
+
/** Each invocation owns only the groups it binds; safe under Astro navigation. */
|
|
5
|
+
export function initializeNativeAccordions(scope: ParentNode = document): () => void {
|
|
6
|
+
const cleanups: (() => void)[] = [];
|
|
7
|
+
scope.querySelectorAll<HTMLElement>("[data-fp-accordion]").forEach(group => {
|
|
8
|
+
if (group.dataset.fpAccordionReady === "true") return;
|
|
9
|
+
const reduced = () => getMotionPreference() === "reduce" || Boolean(group.closest(".sf-motion-disable"));
|
|
10
|
+
const items = [...group.querySelectorAll<HTMLElement>("[data-fp-accordion-item]")].filter(el => owner(el, group)).flatMap(item => {
|
|
11
|
+
const button = [...item.querySelectorAll<HTMLButtonElement>("[data-fp-accordion-toggle]")].find(el => el.closest("[data-fp-accordion-item]") === item);
|
|
12
|
+
const panel = [...item.querySelectorAll<HTMLElement>("[data-fp-accordion-panel]")].find(el => el.closest("[data-fp-accordion-item]") === item);
|
|
13
|
+
if (!button || !panel) return [];
|
|
14
|
+
let expanded = item.dataset.fpAccordionInitialOpen === "true";
|
|
15
|
+
let animation: Animation | undefined;
|
|
16
|
+
const sync = () => {
|
|
17
|
+
button.setAttribute("aria-expanded", String(expanded));
|
|
18
|
+
item.classList.toggle("is-open", expanded);
|
|
19
|
+
panel.inert = !expanded;
|
|
20
|
+
};
|
|
21
|
+
const settle = () => {
|
|
22
|
+
animation?.cancel(); animation = undefined;
|
|
23
|
+
delete panel.dataset.fpAccordionAnimating;
|
|
24
|
+
panel.hidden = !expanded;
|
|
25
|
+
sync();
|
|
26
|
+
};
|
|
27
|
+
const setExpanded = (next: boolean, animate = true) => {
|
|
28
|
+
if (next === expanded) return;
|
|
29
|
+
const from = panel.hidden ? 0 : panel.getBoundingClientRect().height;
|
|
30
|
+
animation?.cancel(); animation = undefined;
|
|
31
|
+
expanded = next; panel.hidden = false;
|
|
32
|
+
sync();
|
|
33
|
+
panel.dataset.fpAccordionAnimating = "true";
|
|
34
|
+
const style = getComputedStyle(panel);
|
|
35
|
+
const time = style.getPropertyValue("--fp-accordion-computed-panel-duration").trim();
|
|
36
|
+
const duration = parseFloat(time) * (time.endsWith("ms") ? 1 : 1000);
|
|
37
|
+
const to = expanded ? panel.getBoundingClientRect().height : 0;
|
|
38
|
+
if (!animate || reduced() || panel.closest(".sf-motion-disable") || !panel.animate || !Number.isFinite(duration) || duration <= 0 || from === to) { settle(); return; }
|
|
39
|
+
try {
|
|
40
|
+
animation = panel.animate([{ height: `${from}px` }, { height: `${to}px` }], {
|
|
41
|
+
duration, easing: style.getPropertyValue("--fp-accordion-computed-panel-easing").trim() || "ease-out", fill: "both",
|
|
42
|
+
});
|
|
43
|
+
} catch { settle(); return; }
|
|
44
|
+
animation.onfinish = settle;
|
|
45
|
+
};
|
|
46
|
+
settle();
|
|
47
|
+
return [{ item, button, panel, setExpanded, settle, isOpen: () => expanded }];
|
|
48
|
+
});
|
|
49
|
+
const onClick = (event: Event) => {
|
|
50
|
+
if (!(event.target instanceof Element)) return;
|
|
51
|
+
const button = event.target.closest("[data-fp-accordion-toggle]");
|
|
52
|
+
const current = items.find(item => item.button === button);
|
|
53
|
+
if (!current || !button || !owner(button, group) || event.defaultPrevented) return;
|
|
54
|
+
const next = !current.isOpen();
|
|
55
|
+
if (next && group.dataset.fpAccordionAutoclose === "true") items.forEach(item => { if (item !== current) item.setExpanded(false); });
|
|
56
|
+
current.setExpanded(next);
|
|
57
|
+
};
|
|
58
|
+
const onKey = (event: KeyboardEvent) => {
|
|
59
|
+
const index = items.findIndex(item => item.button === event.target);
|
|
60
|
+
if (index < 0 || !["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return;
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : Math.max(0, Math.min(items.length - 1, index + (event.key === "ArrowDown" ? 1 : -1)));
|
|
63
|
+
items[next]?.button.focus();
|
|
64
|
+
};
|
|
65
|
+
const onHash = () => {
|
|
66
|
+
let id: string;
|
|
67
|
+
try { id = decodeURIComponent(window.location.hash.slice(1)); } catch { return; }
|
|
68
|
+
const target = id ? document.getElementById(id) : null;
|
|
69
|
+
if (!target) return;
|
|
70
|
+
const current = items.find(item => item.panel === target || item.panel.contains(target));
|
|
71
|
+
if (!current) return;
|
|
72
|
+
if (group.dataset.fpAccordionAutoclose === "true") items.forEach(item => { if (item !== current) item.setExpanded(false, false); });
|
|
73
|
+
current.setExpanded(true, false);
|
|
74
|
+
requestAnimationFrame(() => target.scrollIntoView());
|
|
75
|
+
};
|
|
76
|
+
const syncMotion = () => {
|
|
77
|
+
group.dataset.fpAccordionMotion = reduced() ? "reduce" : "full";
|
|
78
|
+
if (reduced()) items.forEach(item => item.settle());
|
|
79
|
+
};
|
|
80
|
+
syncMotion();
|
|
81
|
+
const unsubscribe = subscribeMotionPreference(syncMotion);
|
|
82
|
+
group.dataset.fpAccordionReady = "true";
|
|
83
|
+
group.addEventListener("click", onClick);
|
|
84
|
+
group.addEventListener("keydown", onKey);
|
|
85
|
+
window.addEventListener("hashchange", onHash);
|
|
86
|
+
onHash();
|
|
87
|
+
cleanups.push(() => {
|
|
88
|
+
unsubscribe(); group.removeEventListener("click", onClick); group.removeEventListener("keydown", onKey);
|
|
89
|
+
window.removeEventListener("hashchange", onHash);
|
|
90
|
+
delete group.dataset.fpAccordionReady; delete group.dataset.fpAccordionMotion;
|
|
91
|
+
items.forEach(({ item, button, panel, settle }) => {
|
|
92
|
+
settle(); panel.hidden = false; panel.inert = false; button.setAttribute("aria-expanded", "true"); item.classList.remove("is-open");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
return () => cleanups.forEach(cleanup => cleanup());
|
|
97
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* Structural disclosure behavior. All visual recipes belong to StyleFlow props. */
|
|
2
|
+
/* styleflow-ignore-start rule=SF_CSS_HARDCODED reason="Native accordion control geometry and state" scope="Native accordion" */
|
|
3
|
+
:where([data-fp-accordion-toggle]) {
|
|
4
|
+
display: flex; align-items: center; inline-size: 100%; text-align: inherit;
|
|
5
|
+
font: inherit; color: inherit; cursor: pointer;
|
|
6
|
+
gap: var(--sf-layout-control-regular-gap, .5em);
|
|
7
|
+
}
|
|
8
|
+
:where([data-fp-accordion-toggle]) > .wp-block-accordion-heading__toggle-title { flex: 1; }
|
|
9
|
+
:where([data-fp-accordion-toggle]) > .wp-block-accordion-heading__toggle-icon { display: inline-flex; flex: 0 0 auto; inline-size: 1.2em; block-size: 1.2em; align-items: center; justify-content: center; }
|
|
10
|
+
:where([data-fp-accordion-toggle][data-fp-accordion-icon-position="left"]) > .wp-block-accordion-heading__toggle-icon { order: -1; }
|
|
11
|
+
:where([data-fp-accordion-toggle]) .wp-block-accordion-heading__toggle-icon > span { display: inline-flex; inline-size: 100%; block-size: 100%; align-items: center; justify-content: center; }
|
|
12
|
+
:where([data-fp-accordion-toggle]) .wp-block-accordion-heading__toggle-icon svg { display: block; inline-size: 100%; block-size: 100%; }
|
|
13
|
+
[data-fp-accordion-toggle] > .wp-block-accordion-heading__toggle-icon { transform: none !important; transition: none !important; }
|
|
14
|
+
[data-fp-accordion-toggle][aria-expanded="true"] [data-fp-accordion-icon-closed],
|
|
15
|
+
[data-fp-accordion-toggle][aria-expanded="false"] [data-fp-accordion-icon-open] { display: none; }
|
|
16
|
+
[data-fp-accordion-toggle][aria-expanded="true"][data-fp-accordion-icon-animation="rotate"] [data-fp-accordion-icon-single] { transform: rotate(var(--fp-accordion-icon-rotation, 45deg)); }
|
|
17
|
+
[data-fp-accordion-ready="true"] [data-fp-accordion-icon-single] {
|
|
18
|
+
transition: transform var(--fp-accordion-icon-duration, var(--sf-motion-duration-fast, 200ms)) var(--fp-accordion-icon-easing, var(--sf-motion-ease-soft, ease-in-out));
|
|
19
|
+
}
|
|
20
|
+
[data-fp-accordion-panel] {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
--fp-accordion-computed-panel-duration: var(--fp-accordion-panel-duration, var(--sf-motion-duration-default, 300ms));
|
|
23
|
+
--fp-accordion-computed-panel-easing: var(--fp-accordion-panel-easing, var(--sf-motion-ease-soft, ease-out));
|
|
24
|
+
}
|
|
25
|
+
[data-fp-accordion-panel][data-fp-accordion-animating="true"] { display: block !important; overflow: clip; }
|
|
26
|
+
[data-fp-accordion-panel][hidden] { display: none !important; }
|
|
27
|
+
[data-fp-accordion-motion="reduce"] [data-fp-accordion-icon-single],
|
|
28
|
+
.sf-motion-disable [data-fp-accordion-icon-single] { transition: none; }
|
|
29
|
+
/* styleflow-ignore-end */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FlowpressBlock } from "../../types.js";
|
|
2
|
+
export interface AccordionSettings {
|
|
3
|
+
autoclose: boolean;
|
|
4
|
+
level: number;
|
|
5
|
+
showIcon: boolean;
|
|
6
|
+
iconPosition: string;
|
|
7
|
+
animation: string;
|
|
8
|
+
rotation: number;
|
|
9
|
+
closedIcon?: string | undefined;
|
|
10
|
+
openIcon?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface AccordionItemData extends AccordionSettings {
|
|
13
|
+
id: string;
|
|
14
|
+
panelId: string;
|
|
15
|
+
open: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function accordionData(block: FlowpressBlock): Partial<AccordionItemData>;
|
|
18
|
+
export declare function accordionRenderPrefix(locals: object): string;
|
|
19
|
+
/** Prepare only a rendered copy; pattern/query passes receive their own unique prefix. */
|
|
20
|
+
export declare function decorateAccordionBlocks(blocks: FlowpressBlock[], prefix: string): FlowpressBlock[];
|
|
21
|
+
/** Source attributes may be absent in a parser-only payload; retain nested rich text. */
|
|
22
|
+
export declare function accordionTitle(block: FlowpressBlock): string;
|
|
23
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/astro/native/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AACD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAE/E;AACD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI5D;AACD,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,CAmClG;AACD,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAG5D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { nativeIconSvg } from "./icon.js";
|
|
2
|
+
const object = (value) => value && typeof value === "object" ? value : {};
|
|
3
|
+
const level = (value, fallback) => Number.isInteger(value) && Number(value) >= 1 && Number(value) <= 6 ? Number(value) : fallback;
|
|
4
|
+
export function accordionData(block) {
|
|
5
|
+
return object(block.resolvedData?.flowpressAccordion);
|
|
6
|
+
}
|
|
7
|
+
export function accordionRenderPrefix(locals) {
|
|
8
|
+
const state = locals;
|
|
9
|
+
state.flowpressAccordionSequence = (state.flowpressAccordionSequence ?? 0) + 1;
|
|
10
|
+
return `fp-accordion-${state.flowpressAccordionSequence}`;
|
|
11
|
+
}
|
|
12
|
+
/** Prepare only a rendered copy; pattern/query passes receive their own unique prefix. */
|
|
13
|
+
export function decorateAccordionBlocks(blocks, prefix) {
|
|
14
|
+
let sequence = 0;
|
|
15
|
+
const visit = (block, settings, item) => {
|
|
16
|
+
if (block.resolvedData?.flowpressAccordion)
|
|
17
|
+
return block;
|
|
18
|
+
const attrs = block.attributes;
|
|
19
|
+
let data;
|
|
20
|
+
if (block.name === "core/accordion") {
|
|
21
|
+
const icons = object(block.resolvedData?.accordionIcons);
|
|
22
|
+
const rotation = Number(attrs.flowpressAccordionIconRotation ?? 45);
|
|
23
|
+
settings = {
|
|
24
|
+
autoclose: attrs.autoclose === true,
|
|
25
|
+
level: level(attrs.headingLevel, 3), showIcon: attrs.showIcon !== false,
|
|
26
|
+
iconPosition: attrs.iconPosition === "left" ? "left" : "right",
|
|
27
|
+
animation: attrs.flowpressAccordionIconAnimation === "none" ? "none" : "rotate",
|
|
28
|
+
rotation: Number.isFinite(rotation) ? Math.max(-360, Math.min(360, rotation)) : 45,
|
|
29
|
+
closedIcon: nativeIconSvg(attrs.flowpressAccordionIcon, icons.closed, `${prefix}-icon-${sequence++}`),
|
|
30
|
+
openIcon: nativeIconSvg(attrs.flowpressAccordionOpenIcon, icons.open, `${prefix}-icon-${sequence++}`),
|
|
31
|
+
};
|
|
32
|
+
data = settings;
|
|
33
|
+
item = undefined;
|
|
34
|
+
}
|
|
35
|
+
else if (block.name === "core/accordion-item" && settings) {
|
|
36
|
+
const id = `${prefix}-item-${sequence++}`;
|
|
37
|
+
const panel = block.innerBlocks?.find(child => child.name === "core/accordion-panel");
|
|
38
|
+
item = { ...settings, id, panelId: typeof panel?.attributes.anchor === "string" && panel.attributes.anchor ? panel.attributes.anchor : `${id}-panel`, open: attrs.openByDefault === true };
|
|
39
|
+
data = item;
|
|
40
|
+
}
|
|
41
|
+
else if (["core/accordion-heading", "core/accordion-panel"].includes(block.name) && item) {
|
|
42
|
+
data = { ...item, level: level(attrs.level, item.level) };
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...block,
|
|
46
|
+
...(data ? { resolvedData: { ...block.resolvedData, flowpressAccordion: data } } : {}),
|
|
47
|
+
...(block.innerBlocks ? { innerBlocks: block.innerBlocks.map(child => visit(child, settings, item)) } : {}),
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
return blocks.map(block => visit(block));
|
|
51
|
+
}
|
|
52
|
+
/** Source attributes may be absent in a parser-only payload; retain nested rich text. */
|
|
53
|
+
export function accordionTitle(block) {
|
|
54
|
+
if (typeof block.attributes.title === "string")
|
|
55
|
+
return block.attributes.title;
|
|
56
|
+
return block.innerHtml?.match(/<span\b[^>]*class=["'][^"']*wp-block-accordion-heading__toggle-title[^"']*["'][^>]*>([\s\S]*?)<\/span>\s*(?=<span\b[^>]*class=["'][^"']*wp-block-accordion-heading__toggle-icon|<\/button>)/i)?.[1] ?? "";
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../src/astro/native/accordion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAiB1C,MAAM,MAAM,GAAG,CAAC,KAAc,EAAuB,EAAE,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/H,MAAM,KAAK,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnJ,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AACxD,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,MAAM,KAAK,GAAG,MAAiD,CAAC;IAChE,KAAK,CAAC,0BAA0B,GAAG,CAAC,KAAK,CAAC,0BAA0B,IAAI,CAAC,CA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I,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5G,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC;AACD,yFAAyF;AACzF,MAAM,UAAU,cAAc,CAAC,KAAqB;IAClD,IAAI,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;IAC9E,OAAO,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,8LAA8L,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3O,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../types.js\";\nimport { nativeIconSvg } from \"./icon.js\";\n\nexport interface AccordionSettings {\n autoclose: boolean;\n level: number;\n showIcon: boolean;\n iconPosition: string;\n animation: string;\n rotation: number;\n closedIcon?: string | undefined;\n openIcon?: string | undefined;\n}\nexport interface AccordionItemData extends AccordionSettings {\n id: string;\n panelId: string;\n open: boolean;\n}\nconst object = (value: unknown): Record<string, any> => value && typeof value === \"object\" ? value as Record<string, any> : {};\nconst level = (value: unknown, fallback: number) => Number.isInteger(value) && Number(value) >= 1 && Number(value) <= 6 ? Number(value) : fallback;\nexport function accordionData(block: FlowpressBlock): Partial<AccordionItemData> {\n return object(block.resolvedData?.flowpressAccordion);\n}\nexport function accordionRenderPrefix(locals: object): string {\n const state = locals as { flowpressAccordionSequence?: number };\n state.flowpressAccordionSequence = (state.flowpressAccordionSequence ?? 0) + 1;\n return `fp-accordion-${state.flowpressAccordionSequence}`;\n}\n/** Prepare only a rendered copy; pattern/query passes receive their own unique prefix. */\nexport function decorateAccordionBlocks(blocks: FlowpressBlock[], prefix: string): FlowpressBlock[] {\n let sequence = 0;\n const visit = (block: FlowpressBlock, settings?: AccordionSettings, item?: AccordionItemData): FlowpressBlock => {\n if (block.resolvedData?.flowpressAccordion) return block;\n const attrs = block.attributes;\n let data: Partial<AccordionItemData> | undefined;\n if (block.name === \"core/accordion\") {\n const icons = object(block.resolvedData?.accordionIcons);\n const rotation = Number(attrs.flowpressAccordionIconRotation ?? 45);\n settings = {\n autoclose: attrs.autoclose === true,\n level: level(attrs.headingLevel, 3), showIcon: attrs.showIcon !== false,\n iconPosition: attrs.iconPosition === \"left\" ? \"left\" : \"right\",\n animation: attrs.flowpressAccordionIconAnimation === \"none\" ? \"none\" : \"rotate\",\n rotation: Number.isFinite(rotation) ? Math.max(-360, Math.min(360, rotation)) : 45,\n closedIcon: nativeIconSvg(attrs.flowpressAccordionIcon, icons.closed, `${prefix}-icon-${sequence++}`),\n openIcon: nativeIconSvg(attrs.flowpressAccordionOpenIcon, icons.open, `${prefix}-icon-${sequence++}`),\n };\n data = settings;\n item = undefined;\n } else if (block.name === \"core/accordion-item\" && settings) {\n const id = `${prefix}-item-${sequence++}`;\n const panel = block.innerBlocks?.find(child => child.name === \"core/accordion-panel\");\n item = { ...settings, id, panelId: typeof panel?.attributes.anchor === \"string\" && panel.attributes.anchor ? panel.attributes.anchor : `${id}-panel`, open: attrs.openByDefault === true };\n data = item;\n } else if ([\"core/accordion-heading\", \"core/accordion-panel\"].includes(block.name) && item) {\n data = { ...item, level: level(attrs.level, item.level) };\n }\n return {\n ...block,\n ...(data ? { resolvedData: { ...block.resolvedData, flowpressAccordion: data } } : {}),\n ...(block.innerBlocks ? { innerBlocks: block.innerBlocks.map(child => visit(child, settings, item)) } : {}),\n };\n };\n return blocks.map(block => visit(block));\n}\n/** Source attributes may be absent in a parser-only payload; retain nested rich text. */\nexport function accordionTitle(block: FlowpressBlock): string {\n if (typeof block.attributes.title === \"string\") return block.attributes.title;\n return block.innerHtml?.match(/<span\\b[^>]*class=[\"'][^\"']*wp-block-accordion-heading__toggle-title[^\"']*[\"'][^>]*>([\\s\\S]*?)<\\/span>\\s*(?=<span\\b[^>]*class=[\"'][^\"']*wp-block-accordion-heading__toggle-icon|<\\/button>)/i)?.[1] ?? \"\";\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { FlowpressBlock } from "../../types.js";
|
|
2
|
+
import { nativeIconSvg } from "./icon.js";
|
|
3
|
+
|
|
4
|
+
export interface AccordionSettings {
|
|
5
|
+
autoclose: boolean;
|
|
6
|
+
level: number;
|
|
7
|
+
showIcon: boolean;
|
|
8
|
+
iconPosition: string;
|
|
9
|
+
animation: string;
|
|
10
|
+
rotation: number;
|
|
11
|
+
closedIcon?: string | undefined;
|
|
12
|
+
openIcon?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface AccordionItemData extends AccordionSettings {
|
|
15
|
+
id: string;
|
|
16
|
+
panelId: string;
|
|
17
|
+
open: boolean;
|
|
18
|
+
}
|
|
19
|
+
const object = (value: unknown): Record<string, any> => value && typeof value === "object" ? value as Record<string, any> : {};
|
|
20
|
+
const level = (value: unknown, fallback: number) => Number.isInteger(value) && Number(value) >= 1 && Number(value) <= 6 ? Number(value) : fallback;
|
|
21
|
+
export function accordionData(block: FlowpressBlock): Partial<AccordionItemData> {
|
|
22
|
+
return object(block.resolvedData?.flowpressAccordion);
|
|
23
|
+
}
|
|
24
|
+
export function accordionRenderPrefix(locals: object): string {
|
|
25
|
+
const state = locals as { flowpressAccordionSequence?: number };
|
|
26
|
+
state.flowpressAccordionSequence = (state.flowpressAccordionSequence ?? 0) + 1;
|
|
27
|
+
return `fp-accordion-${state.flowpressAccordionSequence}`;
|
|
28
|
+
}
|
|
29
|
+
/** Prepare only a rendered copy; pattern/query passes receive their own unique prefix. */
|
|
30
|
+
export function decorateAccordionBlocks(blocks: FlowpressBlock[], prefix: string): FlowpressBlock[] {
|
|
31
|
+
let sequence = 0;
|
|
32
|
+
const visit = (block: FlowpressBlock, settings?: AccordionSettings, item?: AccordionItemData): FlowpressBlock => {
|
|
33
|
+
if (block.resolvedData?.flowpressAccordion) return block;
|
|
34
|
+
const attrs = block.attributes;
|
|
35
|
+
let data: Partial<AccordionItemData> | undefined;
|
|
36
|
+
if (block.name === "core/accordion") {
|
|
37
|
+
const icons = object(block.resolvedData?.accordionIcons);
|
|
38
|
+
const rotation = Number(attrs.flowpressAccordionIconRotation ?? 45);
|
|
39
|
+
settings = {
|
|
40
|
+
autoclose: attrs.autoclose === true,
|
|
41
|
+
level: level(attrs.headingLevel, 3), showIcon: attrs.showIcon !== false,
|
|
42
|
+
iconPosition: attrs.iconPosition === "left" ? "left" : "right",
|
|
43
|
+
animation: attrs.flowpressAccordionIconAnimation === "none" ? "none" : "rotate",
|
|
44
|
+
rotation: Number.isFinite(rotation) ? Math.max(-360, Math.min(360, rotation)) : 45,
|
|
45
|
+
closedIcon: nativeIconSvg(attrs.flowpressAccordionIcon, icons.closed, `${prefix}-icon-${sequence++}`),
|
|
46
|
+
openIcon: nativeIconSvg(attrs.flowpressAccordionOpenIcon, icons.open, `${prefix}-icon-${sequence++}`),
|
|
47
|
+
};
|
|
48
|
+
data = settings;
|
|
49
|
+
item = undefined;
|
|
50
|
+
} else if (block.name === "core/accordion-item" && settings) {
|
|
51
|
+
const id = `${prefix}-item-${sequence++}`;
|
|
52
|
+
const panel = block.innerBlocks?.find(child => child.name === "core/accordion-panel");
|
|
53
|
+
item = { ...settings, id, panelId: typeof panel?.attributes.anchor === "string" && panel.attributes.anchor ? panel.attributes.anchor : `${id}-panel`, open: attrs.openByDefault === true };
|
|
54
|
+
data = item;
|
|
55
|
+
} else if (["core/accordion-heading", "core/accordion-panel"].includes(block.name) && item) {
|
|
56
|
+
data = { ...item, level: level(attrs.level, item.level) };
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
...block,
|
|
60
|
+
...(data ? { resolvedData: { ...block.resolvedData, flowpressAccordion: data } } : {}),
|
|
61
|
+
...(block.innerBlocks ? { innerBlocks: block.innerBlocks.map(child => visit(child, settings, item)) } : {}),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
return blocks.map(block => visit(block));
|
|
65
|
+
}
|
|
66
|
+
/** Source attributes may be absent in a parser-only payload; retain nested rich text. */
|
|
67
|
+
export function accordionTitle(block: FlowpressBlock): string {
|
|
68
|
+
if (typeof block.attributes.title === "string") return block.attributes.title;
|
|
69
|
+
return block.innerHtml?.match(/<span\b[^>]*class=["'][^"']*wp-block-accordion-heading__toggle-title[^"']*["'][^>]*>([\s\S]*?)<\/span>\s*(?=<span\b[^>]*class=["'][^"']*wp-block-accordion-heading__toggle-icon|<\/button>)/i)?.[1] ?? "";
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import S from "../StyleflowElement.astro";
|
|
3
|
+
import { accordionData, accordionTitle } from "./accordion.js";
|
|
4
|
+
import type { FlowpressBlockRendererProps } from "../../index.js";
|
|
5
|
+
const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
|
|
6
|
+
const data = accordionData(block);
|
|
7
|
+
const tag = `h${data.level ?? 3}`;
|
|
8
|
+
const title = accordionTitle(block);
|
|
9
|
+
const dual = Boolean(data.openIcon);
|
|
10
|
+
---
|
|
11
|
+
<!-- styleflow-ignore-start rule=SF_INLINE_STYLE reason="Validated accordion icon rotation is interaction geometry" scope="Native accordion" -->
|
|
12
|
+
<S as={tag} id={htmlProps.id} class={["wp-block-accordion-heading", htmlProps.class].filter(Boolean).join(" ")}>
|
|
13
|
+
<S as="button" {...htmlProps} {...styleflowProps} id={data.id} class="wp-block-accordion-heading__toggle" type="button" aria-expanded="true" aria-controls={data.panelId} data-fp-accordion-toggle data-fp-accordion-icon-position={data.iconPosition ?? "right"} data-fp-accordion-icon-animation={dual ? "none" : data.animation ?? "rotate"} style={[htmlProps.style, `--fp-accordion-icon-rotation:${data.rotation ?? 45}deg`].filter(Boolean).join(";")}>
|
|
14
|
+
<span class="wp-block-accordion-heading__toggle-title" set:html={title} />
|
|
15
|
+
{data.showIcon !== false && <span class="wp-block-accordion-heading__toggle-icon" aria-hidden="true">
|
|
16
|
+
<span data-fp-accordion-icon-closed={!dual ? undefined : ""} data-fp-accordion-icon-single={dual ? undefined : ""}>{data.closedIcon ? <Fragment set:html={data.closedIcon} /> : "+"}</span>
|
|
17
|
+
{dual && <span data-fp-accordion-icon-open set:html={data.openIcon} />}
|
|
18
|
+
</span>}
|
|
19
|
+
</S>
|
|
20
|
+
</S>
|
|
21
|
+
<!-- styleflow-ignore-end -->
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
import S from "../StyleflowElement.astro";
|
|
3
|
+
import { accordionData } from "./accordion.js";
|
|
4
|
+
import type { FlowpressBlockRendererProps } from "../../index.js";
|
|
5
|
+
const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
|
|
6
|
+
const data = accordionData(block);
|
|
7
|
+
---
|
|
8
|
+
<S as="div" {...htmlProps} {...styleflowProps} class={["wp-block-accordion-item", htmlProps.class].filter(Boolean).join(" ")} data-fp-accordion-item data-fp-accordion-initial-open={String(data.open === true)}><slot /></S>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
import S from "../StyleflowElement.astro";
|
|
3
|
+
import { accordionData } from "./accordion.js";
|
|
4
|
+
import type { FlowpressBlockRendererProps } from "../../index.js";
|
|
5
|
+
const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
|
|
6
|
+
const data = accordionData(block);
|
|
7
|
+
---
|
|
8
|
+
<S as="div" {...htmlProps} {...styleflowProps} class={["wp-block-accordion-panel", htmlProps.class].filter(Boolean).join(" ")} id={data.panelId ?? htmlProps.id} role="region" aria-labelledby={data.id} data-fp-accordion-panel><slot /></S>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
import S from "../StyleflowElement.astro";
|
|
3
|
+
import Runtime from "./AccordionRuntime.astro";
|
|
4
|
+
import type { FlowpressBlockRendererProps } from "../../index.js";
|
|
5
|
+
const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
|
|
6
|
+
---
|
|
7
|
+
<S as="div" {...htmlProps} {...styleflowProps} class={["wp-block-accordion", htmlProps.class].filter(Boolean).join(" ")} role="group" data-fp-accordion data-fp-accordion-autoclose={String(block.attributes.autoclose === true)}><slot /></S>
|
|
8
|
+
<Runtime />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAyCxE,eAAO,MAAM,oBAAoB,EAAE,uBA+ClC,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import NativeAccordion from "./core-accordion.astro";
|
|
2
|
+
import NativeAccordionItem from "./core-accordion-item.astro";
|
|
3
|
+
import NativeAccordionHeading from "./core-accordion-heading.astro";
|
|
4
|
+
import NativeAccordionPanel from "./core-accordion-panel.astro";
|
|
1
5
|
import Renderer0 from "./core-term-name.astro";
|
|
2
6
|
import Renderer2 from "./core-post-terms.astro";
|
|
3
7
|
import Renderer3 from "./core-button.astro";
|
|
@@ -38,6 +42,10 @@ import ThemeToggleBlock from "../blocks/ThemeToggleBlock.astro";
|
|
|
38
42
|
import ReservedLogin from "./ReservedLogin.astro";
|
|
39
43
|
import Slot from "./sf-slot.astro";
|
|
40
44
|
export const nativeBlockRenderers = {
|
|
45
|
+
"core/accordion": NativeAccordion,
|
|
46
|
+
"core/accordion-item": NativeAccordionItem,
|
|
47
|
+
"core/accordion-heading": NativeAccordionHeading,
|
|
48
|
+
"core/accordion-panel": NativeAccordionPanel,
|
|
41
49
|
"core/separator": SeparatorBlock,
|
|
42
50
|
"core/post-content": TransparentBlock,
|
|
43
51
|
"core/template-part": TransparentBlock,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AACpE,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAEhE,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,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO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nC,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,SAAS;IAC3B,iBAAiB,EAAE,SAAS;IAC5B,aAAa,EAAE,SAAS;IACxB,gBAAgB,EAAE,SAAS;IAC3B,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,SAAS;IAC9B,uBAAuB,EAAE,SAAS;IAClC,oBAAoB,EAAE,SAAS;IAC/B,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,UAAU;IACvB,YAAY,EAAE,UAAU;IACxB,iBAAiB,EAAE,UAAU;IAC7B,0BAA0B,EAAE,UAAU;IACtC,gBAAgB,EAAE,UAAU;IAC5B,kBAAkB,EAAE,UAAU;IAC9B,cAAc,EAAE,UAAU;IAC1B,YAAY,EAAE,UAAU;IACxB,iBAAiB,EAAE,aAAa;IAChC,+BAA+B,EAAE,aAAa;IAC9C,uBAAuB,EAAE,UAAU;IACnC,oBAAoB,EAAE,UAAU;IAChC,iBAAiB,EAAE,UAAU;IAC7B,yBAAyB,EAAE,UAAU;IACrC,YAAY,EAAE,UAAU;IACxB,gBAAgB,EAAE,UAAU;IAC5B,qBAAqB,EAAE,UAAU;IACjC,sBAAsB,EAAE,UAAU;IAClC,iBAAiB,EAAE,UAAU;IAC7B,eAAe,EAAE,UAAU;IAC3B,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,UAAU;IAC3B,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,UAAU;IACzB,kBAAkB,EAAE,iBAAiB;CACtC,CAAC","sourcesContent":["import NativeAccordion from \"./core-accordion.astro\";\nimport NativeAccordionItem from \"./core-accordion-item.astro\";\nimport NativeAccordionHeading from \"./core-accordion-heading.astro\";\nimport NativeAccordionPanel from \"./core-accordion-panel.astro\";\nimport 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/accordion\": NativeAccordion,\n \"core/accordion-item\": NativeAccordionItem,\n \"core/accordion-heading\": NativeAccordionHeading,\n \"core/accordion-panel\": NativeAccordionPanel,\n\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"]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import NativeAccordion from "./core-accordion.astro";
|
|
2
|
+
import NativeAccordionItem from "./core-accordion-item.astro";
|
|
3
|
+
import NativeAccordionHeading from "./core-accordion-heading.astro";
|
|
4
|
+
import NativeAccordionPanel from "./core-accordion-panel.astro";
|
|
1
5
|
import type { FlowpressBlockRenderers } from "../../block-renderers.js";
|
|
2
6
|
import Renderer0 from "./core-term-name.astro";
|
|
3
7
|
import Renderer2 from "./core-post-terms.astro";
|
|
@@ -40,6 +44,11 @@ import ReservedLogin from "./ReservedLogin.astro";
|
|
|
40
44
|
import Slot from "./sf-slot.astro";
|
|
41
45
|
|
|
42
46
|
export const nativeBlockRenderers: FlowpressBlockRenderers = {
|
|
47
|
+
"core/accordion": NativeAccordion,
|
|
48
|
+
"core/accordion-item": NativeAccordionItem,
|
|
49
|
+
"core/accordion-heading": NativeAccordionHeading,
|
|
50
|
+
"core/accordion-panel": NativeAccordionPanel,
|
|
51
|
+
|
|
43
52
|
"core/separator": SeparatorBlock,
|
|
44
53
|
"core/post-content": TransparentBlock,
|
|
45
54
|
"core/template-part": TransparentBlock,
|
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;AAuFD,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,5 +1,9 @@
|
|
|
1
|
-
export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "
|
|
1
|
+
export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "8";
|
|
2
2
|
const blockNames = [
|
|
3
|
+
"core/accordion",
|
|
4
|
+
"core/accordion-item",
|
|
5
|
+
"core/accordion-heading",
|
|
6
|
+
"core/accordion-panel",
|
|
3
7
|
"core/separator",
|
|
4
8
|
"core/post-content",
|
|
5
9
|
"core/site-logo",
|
|
@@ -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,SAAS;IACT,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,qBAAqB;IACrB,wBAAwB;IACxB,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,SAAS;IACT,UAAU;IACV,YAAY;IACZ,eAAe;IACf,iBAAiB;IAEjB,gBAAgB;IAChB,iBA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,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 = \"8\" as const;\n\nexport interface FlowpressDefaultBlockCatalogEntry {\n blockName: string;\n template: \"DefaultBlockAdapter.astro\";\n}\n\nconst blockNames = [\n \"core/accordion\",\n \"core/accordion-item\",\n \"core/accordion-heading\",\n \"core/accordion-panel\",\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/accessibility-panel.ts","../src/astro.d.ts","../src/block-renderers.ts","../src/build-cache.ts","../src/carousel.ts","../src/client.ts","../src/composition.ts","../src/default-blocks.ts","../src/env.ts","../src/index.ts","../src/links.ts","../src/media.ts","../src/motion-preference.ts","../src/number-spinner.ts","../src/preferences-runtime.ts","../src/preferences-styleflow.ts","../src/preferences.ts","../src/reserved-area.ts","../src/style-classes.ts","../src/styleflow.ts","../src/svg-media-types.ts","../src/svg-media.ts","../src/template-hierarchy.ts","../src/text.ts","../src/theme-runtime.ts","../src/types.ts","../src/vivid-colors-preference.ts","../src/astro/blocks/cover.ts","../src/astro/blocks/helpers.ts","../src/astro/motion/accordion.ts","../src/astro/motion/motion-controller.ts","../src/astro/motion/motion.ts","../src/astro/native/button-template.ts","../src/astro/native/button.ts","../src/astro/native/flowpress-navigation-controller.ts","../src/astro/native/grid.ts","../src/astro/native/group.ts","../src/astro/native/html.ts","../src/astro/native/icon.ts","../src/astro/native/image.ts","../src/astro/native/map.ts","../src/astro/native/motion-preference.ts","../src/astro/native/motion.ts","../src/astro/native/query-carousel.ts","../src/astro/native/query-loop.ts","../src/astro/native/registry.ts","../src/astro/native/timeline.ts","../src/astro/native/blob/blob-shapes.generated.ts","../src/astro/native/blob/config.ts","../src/astro/native/blob/controller.ts","../src/astro/native/blob/geometry.ts","../src/astro/native/blob/ids.ts","../src/svg-media-runtime.js","../src/astro/native/grid-bleed.js"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../src/accessibility-panel.ts","../src/astro.d.ts","../src/block-renderers.ts","../src/build-cache.ts","../src/carousel.ts","../src/client.ts","../src/composition.ts","../src/default-blocks.ts","../src/env.ts","../src/index.ts","../src/links.ts","../src/media.ts","../src/motion-preference.ts","../src/number-spinner.ts","../src/preferences-runtime.ts","../src/preferences-styleflow.ts","../src/preferences.ts","../src/reserved-area.ts","../src/style-classes.ts","../src/styleflow.ts","../src/svg-media-types.ts","../src/svg-media.ts","../src/template-hierarchy.ts","../src/text.ts","../src/theme-runtime.ts","../src/types.ts","../src/vivid-colors-preference.ts","../src/astro/blocks/cover.ts","../src/astro/blocks/helpers.ts","../src/astro/motion/accordion.ts","../src/astro/motion/motion-controller.ts","../src/astro/motion/motion.ts","../src/astro/native/accordion-controller.ts","../src/astro/native/accordion.ts","../src/astro/native/button-template.ts","../src/astro/native/button.ts","../src/astro/native/flowpress-navigation-controller.ts","../src/astro/native/grid.ts","../src/astro/native/group.ts","../src/astro/native/html.ts","../src/astro/native/icon.ts","../src/astro/native/image.ts","../src/astro/native/map.ts","../src/astro/native/motion-preference.ts","../src/astro/native/motion.ts","../src/astro/native/query-carousel.ts","../src/astro/native/query-loop.ts","../src/astro/native/registry.ts","../src/astro/native/timeline.ts","../src/astro/native/blob/blob-shapes.generated.ts","../src/astro/native/blob/config.ts","../src/astro/native/blob/controller.ts","../src/astro/native/blob/geometry.ts","../src/astro/native/blob/ids.ts","../src/svg-media-runtime.js","../src/astro/native/grid-bleed.js"],"version":"5.9.3"}
|
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.48",
|
|
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.20",
|
|
99
99
|
"entities": "8.1.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|