@styleflow.app/flowpress-astro-core 1.0.0-beta.30 → 1.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/astro/CompositionRenderer.astro +13 -2
- package/dist/astro/DefaultBlockAdapter.astro +1 -0
- package/dist/astro/FontStylesheets.astro +35 -0
- package/dist/astro/GutenbergRenderer.astro +58 -19
- package/dist/astro/Media.astro +24 -0
- package/dist/astro/StyleflowElement.astro +1 -0
- package/dist/astro/blocks/CarouselBlock.astro +3 -0
- package/dist/astro/blocks/CoverBlock.astro +2 -1
- package/dist/astro/blocks/HeroBlock.astro +2 -1
- package/dist/astro/blocks/ImageBlock.astro +2 -1
- package/dist/astro/blocks/ListItemFallback.astro +2 -1
- package/dist/astro/blocks/SiteLogoBlock.astro +3 -2
- package/dist/astro/blocks/helpers.d.ts +3 -1
- package/dist/astro/blocks/helpers.d.ts.map +1 -1
- package/dist/astro/blocks/helpers.js +5 -3
- package/dist/astro/blocks/helpers.js.map +1 -1
- package/dist/astro/blocks/helpers.ts +7 -4
- package/dist/astro/motion/AccordionRuntime.astro +9 -0
- package/dist/astro/motion/MotionBoot.astro +21 -0
- package/dist/astro/motion/MotionRuntime.astro +31 -0
- package/dist/astro/motion/accordion.css +163 -0
- package/dist/astro/motion/accordion.d.ts +3 -0
- package/dist/astro/motion/accordion.d.ts.map +1 -0
- package/dist/astro/motion/accordion.js +98 -0
- package/dist/astro/motion/accordion.js.map +1 -0
- package/dist/astro/motion/accordion.ts +109 -0
- package/dist/astro/motion/motion-controller.d.ts +12 -0
- package/dist/astro/motion/motion-controller.d.ts.map +1 -0
- package/dist/astro/motion/motion-controller.js +293 -0
- package/dist/astro/motion/motion-controller.js.map +1 -0
- package/dist/astro/motion/motion-controller.ts +377 -0
- package/dist/astro/motion/motion.css +546 -0
- package/dist/astro/motion/motion.d.ts +127 -0
- package/dist/astro/motion/motion.d.ts.map +1 -0
- package/dist/astro/motion/motion.js +255 -0
- package/dist/astro/motion/motion.js.map +1 -0
- package/dist/astro/motion/motion.ts +419 -0
- package/dist/astro/native/CustomFieldValue.astro +2 -1
- package/dist/astro/native/ReservedLogin.astro +107 -0
- package/dist/astro/native/ResolvedBlocks.astro +2 -0
- package/dist/astro/native/SyncedPatternContent.astro +2 -0
- package/dist/astro/native/TermFieldValue.astro +2 -1
- package/dist/astro/native/Timeline.astro +2 -1
- package/dist/astro/native/blob.css +1 -1
- package/dist/astro/native/button-template.d.ts +31 -0
- package/dist/astro/native/button-template.d.ts.map +1 -0
- package/dist/astro/native/button-template.js +54 -0
- package/dist/astro/native/button-template.js.map +1 -0
- package/dist/astro/native/button-template.ts +92 -0
- package/dist/astro/native/core-button-fallback.astro +43 -0
- package/dist/astro/native/core-button.astro +48 -26
- package/dist/astro/native/core-group.astro +3 -1
- package/dist/astro/native/core-image.astro +3 -2
- package/dist/astro/native/core-navigation.astro +9 -2
- package/dist/astro/native/core-post-featured-image.astro +3 -2
- package/dist/astro/native/core-post-template-fallback.astro +30 -0
- package/dist/astro/native/core-post-template.astro +17 -24
- package/dist/astro/native/grid-bleed.d.ts +2 -0
- package/dist/astro/native/grid-bleed.d.ts.map +1 -0
- package/dist/astro/native/grid-bleed.js +24 -7
- package/dist/astro/native/grid-bleed.js.map +1 -0
- package/dist/astro/native/group.css +36 -0
- package/dist/astro/native/group.d.ts +15 -0
- package/dist/astro/native/group.d.ts.map +1 -0
- package/dist/astro/native/group.js +66 -0
- package/dist/astro/native/group.js.map +1 -0
- package/dist/astro/native/group.ts +61 -0
- package/dist/astro/native/inline-text.css +15 -0
- package/dist/astro/native/query-carousel.d.ts +12 -0
- package/dist/astro/native/query-carousel.d.ts.map +1 -0
- package/dist/astro/native/query-carousel.js +36 -0
- package/dist/astro/native/query-carousel.js.map +1 -0
- package/dist/astro/native/query-carousel.ts +56 -0
- package/dist/astro/native/registry.d.ts.map +1 -1
- package/dist/astro/native/registry.js +3 -0
- package/dist/astro/native/registry.js.map +1 -1
- package/dist/astro/native/registry.ts +4 -0
- package/dist/astro/native/timeline.css +1 -1
- package/dist/astro/preferences/AccessibilityPanel.astro +73 -86
- package/dist/block-renderers.d.ts +2 -0
- package/dist/block-renderers.d.ts.map +1 -1
- package/dist/block-renderers.js.map +1 -1
- package/dist/composition.d.ts.map +1 -1
- package/dist/composition.js +2 -1
- package/dist/composition.js.map +1 -1
- package/dist/default-blocks.d.ts +1 -1
- package/dist/default-blocks.d.ts.map +1 -1
- package/dist/default-blocks.js +3 -1
- package/dist/default-blocks.js.map +1 -1
- package/dist/reserved-area.d.ts +10 -0
- package/dist/reserved-area.d.ts.map +1 -0
- package/dist/reserved-area.js +93 -0
- package/dist/reserved-area.js.map +1 -0
- package/dist/styleflow.d.ts +2 -0
- package/dist/styleflow.d.ts.map +1 -1
- package/dist/styleflow.js +6 -4
- package/dist/styleflow.js.map +1 -1
- package/dist/svg-media-runtime.d.ts +3 -0
- package/dist/svg-media-runtime.d.ts.map +1 -0
- package/dist/svg-media-runtime.js +33 -0
- package/dist/svg-media-runtime.js.map +1 -0
- package/dist/svg-media-types.d.ts +11 -0
- package/dist/svg-media-types.d.ts.map +1 -0
- package/dist/svg-media-types.js +2 -0
- package/dist/svg-media-types.js.map +1 -0
- package/dist/svg-media.d.ts +10 -0
- package/dist/svg-media.d.ts.map +1 -0
- package/dist/svg-media.js +34 -0
- package/dist/svg-media.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nativeFlexItemProps } from "../native/group.js";
|
|
1
2
|
import {
|
|
2
3
|
resolveFlowpressBlockStyleflowProps,
|
|
3
4
|
type StyleflowContract
|
|
@@ -37,7 +38,7 @@ export function heroObjectPosition(value: unknown): string {
|
|
|
37
38
|
export function blockHtmlAttributes(
|
|
38
39
|
attributes: Record<string, unknown>,
|
|
39
40
|
baseClass = ""
|
|
40
|
-
): { id?: string; class?: string } {
|
|
41
|
+
): { id?: string; class?: string; style?: string; [key: string]: unknown } {
|
|
41
42
|
const anchor = typeof attributes.anchor === "string"
|
|
42
43
|
? attributes.anchor.trim()
|
|
43
44
|
: "";
|
|
@@ -49,10 +50,10 @@ export function blockHtmlAttributes(
|
|
|
49
50
|
.join(" ")
|
|
50
51
|
.replace(/\s+/g, " ");
|
|
51
52
|
|
|
52
|
-
return {
|
|
53
|
+
return nativeFlexItemProps(attributes, {
|
|
53
54
|
...(anchor ? { id: anchor } : {}),
|
|
54
55
|
...(className ? { class: className } : {})
|
|
55
|
-
};
|
|
56
|
+
});
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export const TEXT_HTML_TAGS = [
|
|
@@ -139,9 +140,11 @@ export function textHtmlTag(value: unknown): TextHtmlTag {
|
|
|
139
140
|
export function semanticProps(
|
|
140
141
|
attributes: Record<string, unknown>,
|
|
141
142
|
contract?: StyleflowContract,
|
|
142
|
-
defaults: Record<string, unknown> = DEFAULT_SEMANTIC_PROPS
|
|
143
|
+
defaults: Record<string, unknown> = DEFAULT_SEMANTIC_PROPS,
|
|
144
|
+
effectiveTone?: string
|
|
143
145
|
): Record<string, unknown> {
|
|
144
146
|
return resolveFlowpressBlockStyleflowProps(attributes, contract, defaults, {
|
|
147
|
+
effectiveTone,
|
|
145
148
|
strict: process.env.NODE_ENV === "production" || process.env.STYLEFLOW_STRICT === "1",
|
|
146
149
|
onDiagnostic: (diagnostic) => console.warn(`[${diagnostic.code}] ${diagnostic.message}`)
|
|
147
150
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "./accordion.css";
|
|
3
|
+
---
|
|
4
|
+
<script>
|
|
5
|
+
import { initializeAccordions } from "./accordion.js";
|
|
6
|
+
let cleanup = () => {};
|
|
7
|
+
const start = () => { cleanup(); cleanup = initializeAccordions(); };
|
|
8
|
+
start(); document.addEventListener("astro:page-load", start); document.addEventListener("astro:before-swap", () => cleanup());
|
|
9
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Head counterpart of MotionRuntime: render it right after the motion
|
|
4
|
+
* preference bootstrap, with the same options. Reveals that the controller
|
|
5
|
+
* will arm are hidden before first paint instead of after it.
|
|
6
|
+
* Portabile in FlowPress: docs/pilots/primo-paint-stabile.md
|
|
7
|
+
*/
|
|
8
|
+
import { motionBootCss, motionBootScript, type SfMotionOptions } from "./motion.js";
|
|
9
|
+
import { MOTION_ATTRIBUTE } from "../../motion-preference.js";
|
|
10
|
+
|
|
11
|
+
export interface Props extends SfMotionOptions {}
|
|
12
|
+
|
|
13
|
+
const css = motionBootCss(Astro.props);
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
{css && (
|
|
17
|
+
<>
|
|
18
|
+
<style is:inline set:html={css}></style>
|
|
19
|
+
<script is:inline set:html={motionBootScript(MOTION_ATTRIBUTE)}></script>
|
|
20
|
+
</>
|
|
21
|
+
)}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import {
|
|
3
|
+
resolveSfMotionOptions,
|
|
4
|
+
type SfMotionOptions,
|
|
5
|
+
} from "./motion.js";
|
|
6
|
+
|
|
7
|
+
export interface Props extends SfMotionOptions {}
|
|
8
|
+
|
|
9
|
+
const options = resolveSfMotionOptions(Astro.props);
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<style is:global>@import "./motion.css";</style>
|
|
13
|
+
<template data-sf-motion-options={JSON.stringify(options)}></template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { initializeSfMotion } from "./motion-controller.js";
|
|
17
|
+
import type { SfMotionOptions } from "./motion.js";
|
|
18
|
+
|
|
19
|
+
const optionsElement = document.querySelector<HTMLTemplateElement>(
|
|
20
|
+
"template[data-sf-motion-options]",
|
|
21
|
+
);
|
|
22
|
+
let options: SfMotionOptions = {};
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
options = JSON.parse(optionsElement?.dataset.sfMotionOptions ?? "{}");
|
|
26
|
+
} catch {
|
|
27
|
+
// Malformed serialized configuration keeps all markup visible.
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
initializeSfMotion(options);
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/* FlowPress accordion: stack > item > details, including the unmodified markup. */
|
|
2
|
+
/* styleflow-ignore-start rule=SF_CSS_HARDCODED reason="Disclosure geometry and motion are interaction behavior; typography uses StyleFlow tokens" scope="Project accordion" */
|
|
3
|
+
:where([data-layout-role="stack"]):has(> [data-layout-role="item"] > details) {
|
|
4
|
+
gap: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Unboxed rows: the separator line below each item replaces the item frame. */
|
|
8
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]):has(> details) {
|
|
9
|
+
position: relative;
|
|
10
|
+
padding: 0;
|
|
11
|
+
border-width: 0;
|
|
12
|
+
border-radius: 0;
|
|
13
|
+
background: transparent;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Separator with the same reveal as an <hr> (`sf-reveal--line`). It is drawn
|
|
18
|
+
* by the item because an injected <hr> would miss the one-time reveal setup.
|
|
19
|
+
*/
|
|
20
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]):has(> details)::after {
|
|
21
|
+
content: "";
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset-inline: 0;
|
|
24
|
+
inset-block-end: 0;
|
|
25
|
+
block-size: 1px;
|
|
26
|
+
background: currentColor;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* The item only carries the reveal state: the row itself never moves or fades. */
|
|
31
|
+
.sf-reveal.sf-reveal--accordion-line {
|
|
32
|
+
--sf-reveal-duration: 1100ms;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
html[data-sf-motion="ready"]
|
|
36
|
+
.sf-reveal.sf-reveal--accordion-line[data-sf-reveal-state]:not(.sf-motion-static) {
|
|
37
|
+
clip-path: none;
|
|
38
|
+
filter: none;
|
|
39
|
+
opacity: 1;
|
|
40
|
+
transform: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
html[data-sf-motion="ready"]
|
|
44
|
+
.sf-reveal--accordion-line[data-sf-reveal-state="pending"]:not(.sf-motion-static)::after {
|
|
45
|
+
clip-path: inset(0 100% 0 0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
html[data-sf-motion="ready"]
|
|
49
|
+
.sf-reveal--accordion-line[data-sf-reveal-state="pending"]:not(.sf-motion-static):dir(rtl)::after {
|
|
50
|
+
clip-path: inset(0 0 0 100%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Settled keeps the transition so the line never jumps if the state changes mid-draw. */
|
|
54
|
+
html[data-sf-motion="ready"]
|
|
55
|
+
.sf-reveal--accordion-line:is([data-sf-reveal-state="visible"], [data-sf-reveal-state="settled"]):not(.sf-motion-static)::after {
|
|
56
|
+
clip-path: inset(0);
|
|
57
|
+
transition: clip-path var(--sf-reveal-duration) var(--sf-motion-ease-luxury)
|
|
58
|
+
var(--sf-reveal-delay);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Hover styles live on details: the item's reveal states override its transitions. */
|
|
62
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details {
|
|
63
|
+
--fp-accordion-duration: var(--sf-motion-duration-default, 500ms);
|
|
64
|
+
--fp-accordion-easing: var(--sf-motion-ease-soft, cubic-bezier(0.22, 1, 0.36, 1));
|
|
65
|
+
--fp-accordion-hover-indent: var(--sf-layout-panel-comfortable-padding-x, 1rem);
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
padding-inline: 0;
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
transition:
|
|
70
|
+
background-color var(--fp-accordion-duration) var(--fp-accordion-easing),
|
|
71
|
+
padding-inline-start var(--fp-accordion-duration) var(--fp-accordion-easing);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (hover: hover) {
|
|
75
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details:hover {
|
|
76
|
+
padding-inline-start: var(--fp-accordion-hover-indent);
|
|
77
|
+
background-color: var(--sf-surface-sunken-background);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Vertical spacing stays off details: accordion.ts collapses it to the summary height. */
|
|
82
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
gap: var(--sf-layout-panel-regular-gap, 1rem);
|
|
87
|
+
min-block-size: 44px;
|
|
88
|
+
padding-block: var(--sf-layout-panel-comfortable-padding-y, 1rem);
|
|
89
|
+
list-style: none;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
font-family: var(--sf-text-heading-3-light-font-family, inherit);
|
|
92
|
+
font-size: var(--sf-text-heading-3-light-font-size, 1.75rem);
|
|
93
|
+
font-style: var(--sf-text-heading-3-light-font-style, normal);
|
|
94
|
+
font-weight: var(--sf-text-heading-3-light-font-weight, 400);
|
|
95
|
+
line-height: var(--sf-text-heading-3-light-line-height, 1.1);
|
|
96
|
+
letter-spacing: var(--sf-text-heading-3-light-letter-spacing, -0.025em);
|
|
97
|
+
text-transform: var(--sf-text-heading-3-light-text-transform, none);
|
|
98
|
+
font-variation-settings: var(--sf-text-heading-3-light-font-variation-settings, normal);
|
|
99
|
+
overflow-wrap: anywhere;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary::-webkit-details-marker {
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary::marker {
|
|
107
|
+
content: "";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Two 2px bars make a decorative +; rotating 45 degrees makes the close ×. */
|
|
111
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary::after {
|
|
112
|
+
content: "";
|
|
113
|
+
flex: 0 0 auto;
|
|
114
|
+
inline-size: 0.75em;
|
|
115
|
+
block-size: 0.75em;
|
|
116
|
+
/* An even box keeps the centered 2px bars on whole pixels. */
|
|
117
|
+
inline-size: round(0.75em, 2px);
|
|
118
|
+
block-size: round(0.75em, 2px);
|
|
119
|
+
background:
|
|
120
|
+
linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
|
|
121
|
+
linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
|
|
122
|
+
transform: rotate(0deg);
|
|
123
|
+
transition: transform var(--fp-accordion-duration) var(--fp-accordion-easing);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details[open]:not([data-accordion-expanded="false"]) > summary::after {
|
|
127
|
+
transform: rotate(45deg);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary:focus-visible {
|
|
131
|
+
outline: 2px solid currentColor;
|
|
132
|
+
outline-offset: 4px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary ~ * {
|
|
136
|
+
margin-block-start: var(--sf-layout-stack-regular-gap, 0.5rem);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* The summary padding already separates the first content block. */
|
|
140
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary + * {
|
|
141
|
+
margin-block-start: 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Padding, not margin: a trailing margin could collapse out below the separator. */
|
|
145
|
+
:where([data-layout-role="stack"]) > :where([data-layout-role="item"]) > details > summary ~ :last-child {
|
|
146
|
+
padding-block-end: var(--sf-layout-panel-comfortable-padding-y, 1rem);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Height is animated by accordion.ts, so closing content remains visible. */
|
|
150
|
+
details[data-accordion-animating="true"] {
|
|
151
|
+
overflow: clip;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
html[data-sf-motion-preference="reduce"] details > summary::after {
|
|
155
|
+
transition: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@media (prefers-reduced-motion: reduce) {
|
|
159
|
+
html:not([data-sf-motion-preference]) details > summary::after {
|
|
160
|
+
transition: none;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/* styleflow-ignore-end */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/astro/motion/accordion.ts"],"names":[],"mappings":"AAKA,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,KAAK,GAAE,UAAqB,GAAG,MAAM,IAAI,CAsG7E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { getMotionPreference, subscribeMotionPreference } from "../../motion-preference.js";
|
|
2
|
+
const GROUP_SELECTOR = '[data-layout-role="stack"]:has(> [data-layout-role="item"] > details)';
|
|
3
|
+
const ITEM_SELECTOR = ':scope > [data-layout-role="item"] > details';
|
|
4
|
+
/** Enhance the existing FlowPress markup without changing native summary controls. */
|
|
5
|
+
export function initializeAccordions(scope = document) {
|
|
6
|
+
const cleanups = [];
|
|
7
|
+
const settleAnimations = [];
|
|
8
|
+
scope.querySelectorAll(GROUP_SELECTOR).forEach((group) => {
|
|
9
|
+
if (group.dataset.accordionReady === "true")
|
|
10
|
+
return;
|
|
11
|
+
group.dataset.accordionReady = "true";
|
|
12
|
+
const items = [];
|
|
13
|
+
let hasOpenItem = false;
|
|
14
|
+
group.querySelectorAll(ITEM_SELECTOR).forEach((details) => {
|
|
15
|
+
const summary = details.querySelector(":scope > summary");
|
|
16
|
+
if (!summary)
|
|
17
|
+
return;
|
|
18
|
+
// Keep at most one initially open item, independently for each group.
|
|
19
|
+
let expanded = details.open && !hasOpenItem;
|
|
20
|
+
hasOpenItem ||= expanded;
|
|
21
|
+
let animation;
|
|
22
|
+
details.open = expanded;
|
|
23
|
+
details.dataset.accordionExpanded = String(expanded);
|
|
24
|
+
summary.setAttribute("aria-expanded", String(expanded));
|
|
25
|
+
const settle = () => {
|
|
26
|
+
details.open = expanded;
|
|
27
|
+
animation?.cancel();
|
|
28
|
+
animation = undefined;
|
|
29
|
+
delete details.dataset.accordionAnimating;
|
|
30
|
+
};
|
|
31
|
+
settleAnimations.push(settle);
|
|
32
|
+
const setExpanded = (next) => {
|
|
33
|
+
if (next === expanded)
|
|
34
|
+
return;
|
|
35
|
+
// Capture the current frame before cancelling: rapid clicks can reverse smoothly.
|
|
36
|
+
const from = details.getBoundingClientRect().height;
|
|
37
|
+
animation?.cancel();
|
|
38
|
+
animation = undefined;
|
|
39
|
+
expanded = next;
|
|
40
|
+
details.dataset.accordionExpanded = String(expanded);
|
|
41
|
+
summary.setAttribute("aria-expanded", String(expanded));
|
|
42
|
+
if (getMotionPreference() === "reduce" || details.closest(".sf-motion-disable") || !details.animate) {
|
|
43
|
+
settle();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// Keep open until collapse finishes; the native closed state hides content instantly.
|
|
47
|
+
details.open = true;
|
|
48
|
+
const to = expanded ? details.getBoundingClientRect().height : summary.getBoundingClientRect().height;
|
|
49
|
+
const styles = getComputedStyle(details);
|
|
50
|
+
const durationValue = styles.getPropertyValue("--fp-accordion-duration").trim();
|
|
51
|
+
const duration = Number.parseFloat(durationValue) * (durationValue.endsWith("ms") ? 1 : 1000);
|
|
52
|
+
if (from === to || !Number.isFinite(duration) || duration <= 0) {
|
|
53
|
+
settle();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
details.dataset.accordionAnimating = "true";
|
|
57
|
+
animation = details.animate([{ height: `${from}px` }, { height: `${to}px` }], {
|
|
58
|
+
duration,
|
|
59
|
+
easing: styles.getPropertyValue("--fp-accordion-easing").trim() || "ease-out",
|
|
60
|
+
fill: "both",
|
|
61
|
+
});
|
|
62
|
+
animation.onfinish = settle;
|
|
63
|
+
};
|
|
64
|
+
const onClick = (event) => {
|
|
65
|
+
if (event.defaultPrevented || event.button !== 0)
|
|
66
|
+
return;
|
|
67
|
+
if (event.target instanceof Element && event.target.closest("a, button, input, select, textarea"))
|
|
68
|
+
return;
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
const next = !expanded;
|
|
71
|
+
if (next)
|
|
72
|
+
items.forEach((item) => {
|
|
73
|
+
if (item.details !== details)
|
|
74
|
+
item.setExpanded(false);
|
|
75
|
+
});
|
|
76
|
+
setExpanded(next);
|
|
77
|
+
};
|
|
78
|
+
items.push({ details, setExpanded });
|
|
79
|
+
summary.addEventListener("click", onClick);
|
|
80
|
+
cleanups.push(() => {
|
|
81
|
+
summary.removeEventListener("click", onClick);
|
|
82
|
+
settle();
|
|
83
|
+
summary.removeAttribute("aria-expanded");
|
|
84
|
+
delete details.dataset.accordionExpanded;
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
cleanups.push(() => { delete group.dataset.accordionReady; });
|
|
88
|
+
});
|
|
89
|
+
const unsubscribe = settleAnimations.length ? subscribeMotionPreference((preference) => {
|
|
90
|
+
if (preference === "reduce")
|
|
91
|
+
settleAnimations.forEach((settle) => settle());
|
|
92
|
+
}) : () => { };
|
|
93
|
+
return () => {
|
|
94
|
+
unsubscribe();
|
|
95
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../src/astro/motion/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,4BA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AAC;YACrC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE;gBACjB,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC9C,MAAM,EAAE,CAAC;gBACT,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;gBACzC,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,UAAU,EAAE,EAAE;QACrF,IAAI,UAAU,KAAK,QAAQ;YAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;IAEd,OAAO,GAAG,EAAE;QACV,WAAW,EAAE,CAAC;QACd,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { getMotionPreference, subscribeMotionPreference } from \"../../motion-preference.js\";\n\nconst GROUP_SELECTOR = '[data-layout-role=\"stack\"]:has(> [data-layout-role=\"item\"] > details)';\nconst ITEM_SELECTOR = ':scope > [data-layout-role=\"item\"] > details';\n\n/** Enhance the existing FlowPress markup without changing native summary controls. */\nexport function initializeAccordions(scope: ParentNode = document): () => void {\n const cleanups: (() => void)[] = [];\n const settleAnimations: (() => void)[] = [];\n\n scope.querySelectorAll<HTMLElement>(GROUP_SELECTOR).forEach((group) => {\n if (group.dataset.accordionReady === \"true\") return;\n group.dataset.accordionReady = \"true\";\n\n const items: { details: HTMLDetailsElement; setExpanded: (expanded: boolean) => void }[] = [];\n let hasOpenItem = false;\n\n group.querySelectorAll<HTMLDetailsElement>(ITEM_SELECTOR).forEach((details) => {\n const summary = details.querySelector<HTMLElement>(\":scope > summary\");\n if (!summary) return;\n\n // Keep at most one initially open item, independently for each group.\n let expanded = details.open && !hasOpenItem;\n hasOpenItem ||= expanded;\n let animation: Animation | undefined;\n details.open = expanded;\n details.dataset.accordionExpanded = String(expanded);\n summary.setAttribute(\"aria-expanded\", String(expanded));\n\n const settle = () => {\n details.open = expanded;\n animation?.cancel();\n animation = undefined;\n delete details.dataset.accordionAnimating;\n };\n settleAnimations.push(settle);\n\n const setExpanded = (next: boolean) => {\n if (next === expanded) return;\n\n // Capture the current frame before cancelling: rapid clicks can reverse smoothly.\n const from = details.getBoundingClientRect().height;\n animation?.cancel();\n animation = undefined;\n expanded = next;\n details.dataset.accordionExpanded = String(expanded);\n summary.setAttribute(\"aria-expanded\", String(expanded));\n\n if (getMotionPreference() === \"reduce\" || details.closest(\".sf-motion-disable\") || !details.animate) {\n settle();\n return;\n }\n\n // Keep open until collapse finishes; the native closed state hides content instantly.\n details.open = true;\n const to = expanded ? details.getBoundingClientRect().height : summary.getBoundingClientRect().height;\n const styles = getComputedStyle(details);\n const durationValue = styles.getPropertyValue(\"--fp-accordion-duration\").trim();\n const duration = Number.parseFloat(durationValue) * (durationValue.endsWith(\"ms\") ? 1 : 1000);\n\n if (from === to || !Number.isFinite(duration) || duration <= 0) {\n settle();\n return;\n }\n\n details.dataset.accordionAnimating = \"true\";\n animation = details.animate(\n [{ height: `${from}px` }, { height: `${to}px` }],\n {\n duration,\n easing: styles.getPropertyValue(\"--fp-accordion-easing\").trim() || \"ease-out\",\n fill: \"both\",\n },\n );\n animation.onfinish = settle;\n };\n\n const onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || event.button !== 0) return;\n if (event.target instanceof Element && event.target.closest(\"a, button, input, select, textarea\")) return;\n event.preventDefault();\n const next = !expanded;\n if (next) items.forEach((item) => {\n if (item.details !== details) item.setExpanded(false);\n });\n setExpanded(next);\n };\n\n items.push({ details, setExpanded });\n summary.addEventListener(\"click\", onClick);\n cleanups.push(() => {\n summary.removeEventListener(\"click\", onClick);\n settle();\n summary.removeAttribute(\"aria-expanded\");\n delete details.dataset.accordionExpanded;\n });\n });\n cleanups.push(() => { delete group.dataset.accordionReady; });\n });\n\n const unsubscribe = settleAnimations.length ? subscribeMotionPreference((preference) => {\n if (preference === \"reduce\") settleAnimations.forEach((settle) => settle());\n }) : () => {};\n\n return () => {\n unsubscribe();\n cleanups.forEach((cleanup) => cleanup());\n };\n}\n"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { getMotionPreference, subscribeMotionPreference } from "../../motion-preference.js";
|
|
2
|
+
|
|
3
|
+
const GROUP_SELECTOR = '[data-layout-role="stack"]:has(> [data-layout-role="item"] > details)';
|
|
4
|
+
const ITEM_SELECTOR = ':scope > [data-layout-role="item"] > details';
|
|
5
|
+
|
|
6
|
+
/** Enhance the existing FlowPress markup without changing native summary controls. */
|
|
7
|
+
export function initializeAccordions(scope: ParentNode = document): () => void {
|
|
8
|
+
const cleanups: (() => void)[] = [];
|
|
9
|
+
const settleAnimations: (() => void)[] = [];
|
|
10
|
+
|
|
11
|
+
scope.querySelectorAll<HTMLElement>(GROUP_SELECTOR).forEach((group) => {
|
|
12
|
+
if (group.dataset.accordionReady === "true") return;
|
|
13
|
+
group.dataset.accordionReady = "true";
|
|
14
|
+
|
|
15
|
+
const items: { details: HTMLDetailsElement; setExpanded: (expanded: boolean) => void }[] = [];
|
|
16
|
+
let hasOpenItem = false;
|
|
17
|
+
|
|
18
|
+
group.querySelectorAll<HTMLDetailsElement>(ITEM_SELECTOR).forEach((details) => {
|
|
19
|
+
const summary = details.querySelector<HTMLElement>(":scope > summary");
|
|
20
|
+
if (!summary) return;
|
|
21
|
+
|
|
22
|
+
// Keep at most one initially open item, independently for each group.
|
|
23
|
+
let expanded = details.open && !hasOpenItem;
|
|
24
|
+
hasOpenItem ||= expanded;
|
|
25
|
+
let animation: Animation | undefined;
|
|
26
|
+
details.open = expanded;
|
|
27
|
+
details.dataset.accordionExpanded = String(expanded);
|
|
28
|
+
summary.setAttribute("aria-expanded", String(expanded));
|
|
29
|
+
|
|
30
|
+
const settle = () => {
|
|
31
|
+
details.open = expanded;
|
|
32
|
+
animation?.cancel();
|
|
33
|
+
animation = undefined;
|
|
34
|
+
delete details.dataset.accordionAnimating;
|
|
35
|
+
};
|
|
36
|
+
settleAnimations.push(settle);
|
|
37
|
+
|
|
38
|
+
const setExpanded = (next: boolean) => {
|
|
39
|
+
if (next === expanded) return;
|
|
40
|
+
|
|
41
|
+
// Capture the current frame before cancelling: rapid clicks can reverse smoothly.
|
|
42
|
+
const from = details.getBoundingClientRect().height;
|
|
43
|
+
animation?.cancel();
|
|
44
|
+
animation = undefined;
|
|
45
|
+
expanded = next;
|
|
46
|
+
details.dataset.accordionExpanded = String(expanded);
|
|
47
|
+
summary.setAttribute("aria-expanded", String(expanded));
|
|
48
|
+
|
|
49
|
+
if (getMotionPreference() === "reduce" || details.closest(".sf-motion-disable") || !details.animate) {
|
|
50
|
+
settle();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Keep open until collapse finishes; the native closed state hides content instantly.
|
|
55
|
+
details.open = true;
|
|
56
|
+
const to = expanded ? details.getBoundingClientRect().height : summary.getBoundingClientRect().height;
|
|
57
|
+
const styles = getComputedStyle(details);
|
|
58
|
+
const durationValue = styles.getPropertyValue("--fp-accordion-duration").trim();
|
|
59
|
+
const duration = Number.parseFloat(durationValue) * (durationValue.endsWith("ms") ? 1 : 1000);
|
|
60
|
+
|
|
61
|
+
if (from === to || !Number.isFinite(duration) || duration <= 0) {
|
|
62
|
+
settle();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
details.dataset.accordionAnimating = "true";
|
|
67
|
+
animation = details.animate(
|
|
68
|
+
[{ height: `${from}px` }, { height: `${to}px` }],
|
|
69
|
+
{
|
|
70
|
+
duration,
|
|
71
|
+
easing: styles.getPropertyValue("--fp-accordion-easing").trim() || "ease-out",
|
|
72
|
+
fill: "both",
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
animation.onfinish = settle;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const onClick = (event: MouseEvent) => {
|
|
79
|
+
if (event.defaultPrevented || event.button !== 0) return;
|
|
80
|
+
if (event.target instanceof Element && event.target.closest("a, button, input, select, textarea")) return;
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
const next = !expanded;
|
|
83
|
+
if (next) items.forEach((item) => {
|
|
84
|
+
if (item.details !== details) item.setExpanded(false);
|
|
85
|
+
});
|
|
86
|
+
setExpanded(next);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
items.push({ details, setExpanded });
|
|
90
|
+
summary.addEventListener("click", onClick);
|
|
91
|
+
cleanups.push(() => {
|
|
92
|
+
summary.removeEventListener("click", onClick);
|
|
93
|
+
settle();
|
|
94
|
+
summary.removeAttribute("aria-expanded");
|
|
95
|
+
delete details.dataset.accordionExpanded;
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
cleanups.push(() => { delete group.dataset.accordionReady; });
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const unsubscribe = settleAnimations.length ? subscribeMotionPreference((preference) => {
|
|
102
|
+
if (preference === "reduce") settleAnimations.forEach((settle) => settle());
|
|
103
|
+
}) : () => {};
|
|
104
|
+
|
|
105
|
+
return () => {
|
|
106
|
+
unsubscribe();
|
|
107
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SfMotionOptions } from "./motion.js";
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the project reveal system once per document.
|
|
4
|
+
*
|
|
5
|
+
* Markup is visible by default. Initial-viewport content remains visible unless
|
|
6
|
+
* `revealAboveFold` explicitly opts it into motion; every reveal completes once.
|
|
7
|
+
* Reveals follow the shared motion preference (see `motion-preference.ts`):
|
|
8
|
+
* reduced motion shows everything at once, and allowing it again re-arms the
|
|
9
|
+
* reveals still below the fold without a reload.
|
|
10
|
+
*/
|
|
11
|
+
export declare function initializeSfMotion(options?: SfMotionOptions): void;
|
|
12
|
+
//# sourceMappingURL=motion-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion-controller.d.ts","sourceRoot":"","sources":["../../../src/astro/motion/motion-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAeL,KAAK,eAAe,EAErB,MAAM,aAAa,CAAC;AAmHrB;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,eAAoB,GAAG,IAAI,CA2OtE"}
|