@styleflow.app/flowpress-astro-core 1.0.0-beta.3 → 1.0.0-beta.30
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 +190 -1
- package/README.md +111 -3
- package/dist/accessibility-panel.d.ts +2 -0
- package/dist/accessibility-panel.d.ts.map +1 -0
- package/dist/accessibility-panel.js +81 -0
- package/dist/accessibility-panel.js.map +1 -0
- package/dist/astro/BaseLayout.astro +34 -17
- package/dist/astro/CompositionRenderer.astro +157 -0
- package/dist/astro/DefaultBlockAdapter.astro +35 -0
- package/dist/astro/DefaultTemplate.astro +12 -7
- package/dist/astro/GutenbergRenderer.astro +240 -80
- package/dist/astro/StyleflowElement.astro +23 -0
- package/dist/astro/ThemeRuntime.astro +26 -0
- package/dist/astro/blocks/CarouselBlock.astro +8 -10
- package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
- package/dist/astro/blocks/ColumnBlock.astro +4 -5
- package/dist/astro/blocks/CoverBlock.astro +155 -0
- package/dist/astro/blocks/FormBlock.astro +23 -20
- package/dist/astro/blocks/GridBlock.astro +4 -4
- package/dist/astro/blocks/HeroBlock.astro +4 -5
- package/dist/astro/blocks/ImageBlock.astro +4 -5
- package/dist/astro/blocks/ListItemFallback.astro +10 -7
- package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
- package/dist/astro/blocks/SemanticElement.astro +35 -0
- package/dist/astro/blocks/SiteLogoBlock.astro +53 -0
- package/dist/astro/blocks/TextBlock.astro +33 -28
- package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
- package/dist/astro/blocks/cover.d.ts +13 -0
- package/dist/astro/blocks/cover.d.ts.map +1 -0
- package/dist/astro/blocks/cover.js +105 -0
- package/dist/astro/blocks/cover.js.map +1 -0
- package/dist/astro/blocks/cover.ts +119 -0
- package/dist/astro/blocks/helpers.d.ts +7 -0
- package/dist/astro/blocks/helpers.d.ts.map +1 -1
- package/dist/astro/blocks/helpers.js +52 -41
- package/dist/astro/blocks/helpers.js.map +1 -1
- package/dist/astro/blocks/helpers.ts +64 -45
- package/dist/astro/native/Blob.astro +113 -0
- package/dist/astro/native/BlobBlock.astro +52 -0
- package/dist/astro/native/CustomFieldValue.astro +87 -0
- package/dist/astro/native/LevelTag.astro +20 -0
- package/dist/astro/native/MapBlock.astro +41 -0
- package/dist/astro/native/NativeHtmlBlock.astro +12 -0
- package/dist/astro/native/NativeIconBlock.astro +42 -0
- package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
- package/dist/astro/native/ResolvedBlocks.astro +89 -0
- package/dist/astro/native/SyncedPatternContent.astro +92 -0
- package/dist/astro/native/TermFieldValue.astro +38 -0
- package/dist/astro/native/Timeline.astro +21 -0
- package/dist/astro/native/TimelineCardBlock.astro +7 -0
- package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
- package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
- package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
- package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
- package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
- package/dist/astro/native/blob/config.d.ts +49 -0
- package/dist/astro/native/blob/config.d.ts.map +1 -0
- package/dist/astro/native/blob/config.js +86 -0
- package/dist/astro/native/blob/config.js.map +1 -0
- package/dist/astro/native/blob/config.ts +132 -0
- package/dist/astro/native/blob/controller.d.ts +11 -0
- package/dist/astro/native/blob/controller.d.ts.map +1 -0
- package/dist/astro/native/blob/controller.js +240 -0
- package/dist/astro/native/blob/controller.js.map +1 -0
- package/dist/astro/native/blob/controller.ts +248 -0
- package/dist/astro/native/blob/geometry.d.ts +2 -0
- package/dist/astro/native/blob/geometry.d.ts.map +1 -0
- package/dist/astro/native/blob/geometry.js +2 -0
- package/dist/astro/native/blob/geometry.js.map +1 -0
- package/dist/astro/native/blob/geometry.ts +1 -0
- package/dist/astro/native/blob/ids.d.ts +7 -0
- package/dist/astro/native/blob/ids.d.ts.map +1 -0
- package/dist/astro/native/blob/ids.js +11 -0
- package/dist/astro/native/blob/ids.js.map +1 -0
- package/dist/astro/native/blob/ids.ts +11 -0
- package/dist/astro/native/blob.css +83 -0
- package/dist/astro/native/button.d.ts +13 -0
- package/dist/astro/native/button.d.ts.map +1 -0
- package/dist/astro/native/button.js +26 -0
- package/dist/astro/native/button.js.map +1 -0
- package/dist/astro/native/button.ts +26 -0
- package/dist/astro/native/core-block.astro +18 -0
- package/dist/astro/native/core-button.astro +43 -0
- package/dist/astro/native/core-buttons.astro +14 -0
- package/dist/astro/native/core-group.astro +23 -0
- package/dist/astro/native/core-home-link.astro +12 -0
- package/dist/astro/native/core-html.astro +8 -0
- package/dist/astro/native/core-icon.astro +7 -0
- package/dist/astro/native/core-image.astro +124 -0
- package/dist/astro/native/core-navigation-link.astro +71 -0
- package/dist/astro/native/core-navigation-submenu.astro +33 -0
- package/dist/astro/native/core-navigation.astro +94 -0
- package/dist/astro/native/core-page-list-data-item.astro +19 -0
- package/dist/astro/native/core-page-list-item.astro +8 -0
- package/dist/astro/native/core-page-list.astro +40 -0
- package/dist/astro/native/core-post-date.astro +21 -0
- package/dist/astro/native/core-post-excerpt.astro +26 -0
- package/dist/astro/native/core-post-featured-image.astro +37 -0
- package/dist/astro/native/core-post-template.astro +30 -0
- package/dist/astro/native/core-post-terms.astro +47 -0
- package/dist/astro/native/core-post-title.astro +23 -0
- package/dist/astro/native/core-query-no-results.astro +12 -0
- package/dist/astro/native/core-query.astro +22 -0
- package/dist/astro/native/core-separator.astro +20 -0
- package/dist/astro/native/core-site-title.astro +16 -0
- package/dist/astro/native/core-term-description.astro +12 -0
- package/dist/astro/native/core-term-name.astro +21 -0
- package/dist/astro/native/core-term-template.astro +30 -0
- package/dist/astro/native/core-terms-query.astro +19 -0
- package/dist/astro/native/core-transparent.astro +11 -0
- package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
- package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
- package/dist/astro/native/flowpress-navigation-controller.js +217 -0
- package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
- package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
- package/dist/astro/native/flowpress-navigation.css +17 -0
- package/dist/astro/native/grid-bleed.js +106 -0
- package/dist/astro/native/grid.css +180 -0
- package/dist/astro/native/grid.d.ts +17 -0
- package/dist/astro/native/grid.d.ts.map +1 -0
- package/dist/astro/native/grid.js +103 -0
- package/dist/astro/native/grid.js.map +1 -0
- package/dist/astro/native/grid.ts +118 -0
- package/dist/astro/native/html.d.ts +6 -0
- package/dist/astro/native/html.d.ts.map +1 -0
- package/dist/astro/native/html.js +10 -0
- package/dist/astro/native/html.js.map +1 -0
- package/dist/astro/native/html.ts +9 -0
- package/dist/astro/native/icon.d.ts +3 -0
- package/dist/astro/native/icon.d.ts.map +1 -0
- package/dist/astro/native/icon.js +23 -0
- package/dist/astro/native/icon.js.map +1 -0
- package/dist/astro/native/icon.ts +21 -0
- package/dist/astro/native/map.d.ts +14 -0
- package/dist/astro/native/map.d.ts.map +1 -0
- package/dist/astro/native/map.js +60 -0
- package/dist/astro/native/map.js.map +1 -0
- package/dist/astro/native/map.ts +70 -0
- package/dist/astro/native/motion-preference.d.ts +50 -0
- package/dist/astro/native/motion-preference.d.ts.map +1 -0
- package/dist/astro/native/motion-preference.js +132 -0
- package/dist/astro/native/motion-preference.js.map +1 -0
- package/dist/astro/native/motion-preference.ts +158 -0
- package/dist/astro/native/motion.d.ts +101 -0
- package/dist/astro/native/motion.d.ts.map +1 -0
- package/dist/astro/native/motion.js +168 -0
- package/dist/astro/native/motion.js.map +1 -0
- package/dist/astro/native/motion.ts +312 -0
- package/dist/astro/native/query-loop.d.ts +38 -0
- package/dist/astro/native/query-loop.d.ts.map +1 -0
- package/dist/astro/native/query-loop.js +20 -0
- package/dist/astro/native/query-loop.js.map +1 -0
- package/dist/astro/native/query-loop.ts +67 -0
- package/dist/astro/native/registry.d.ts +3 -0
- package/dist/astro/native/registry.d.ts.map +1 -0
- package/dist/astro/native/registry.js +81 -0
- package/dist/astro/native/registry.js.map +1 -0
- package/dist/astro/native/registry.ts +81 -0
- package/dist/astro/native/sf-block-binding.astro +20 -0
- package/dist/astro/native/sf-post-field.astro +9 -0
- package/dist/astro/native/sf-term-field.astro +9 -0
- package/dist/astro/native/timeline.css +4 -0
- package/dist/astro/native/timeline.d.ts +28 -0
- package/dist/astro/native/timeline.d.ts.map +1 -0
- package/dist/astro/native/timeline.js +43 -0
- package/dist/astro/native/timeline.js.map +1 -0
- package/dist/astro/native/timeline.ts +79 -0
- package/dist/astro/preferences/AccessibilityPanel.astro +118 -0
- package/dist/astro/preferences/ColorModeToggle.astro +26 -0
- package/dist/astro/preferences/MotionToggle.astro +27 -0
- package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
- package/dist/astro/preferences/ThemeToggle.astro +30 -0
- package/dist/astro/preferences/Toggle.astro +50 -0
- package/dist/astro/preferences/preferences.css +125 -0
- package/dist/block-renderers.d.ts +20 -3
- package/dist/block-renderers.d.ts.map +1 -1
- package/dist/block-renderers.js.map +1 -1
- package/dist/client.d.ts +17 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +63 -9
- package/dist/client.js.map +1 -1
- package/dist/composition.d.ts +14 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +124 -0
- package/dist/composition.js.map +1 -0
- package/dist/default-blocks.d.ts +9 -0
- package/dist/default-blocks.d.ts.map +1 -0
- package/dist/default-blocks.js +118 -0
- package/dist/default-blocks.js.map +1 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +20 -0
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +5 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +32 -0
- package/dist/links.js.map +1 -0
- package/dist/media.d.ts +28 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +212 -0
- package/dist/media.js.map +1 -0
- package/dist/motion-preference.d.ts +50 -0
- package/dist/motion-preference.d.ts.map +1 -0
- package/dist/motion-preference.js +132 -0
- package/dist/motion-preference.js.map +1 -0
- package/dist/preferences-runtime.d.ts +3 -0
- package/dist/preferences-runtime.d.ts.map +1 -0
- package/dist/preferences-runtime.js +23 -0
- package/dist/preferences-runtime.js.map +1 -0
- package/dist/preferences-styleflow.d.ts +3 -0
- package/dist/preferences-styleflow.d.ts.map +1 -0
- package/dist/preferences-styleflow.js +14 -0
- package/dist/preferences-styleflow.js.map +1 -0
- package/dist/preferences.d.ts +4 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +4 -0
- package/dist/preferences.js.map +1 -0
- package/dist/styleflow.d.ts +16 -1
- package/dist/styleflow.d.ts.map +1 -1
- package/dist/styleflow.js +76 -7
- package/dist/styleflow.js.map +1 -1
- package/dist/templates.d.ts +16 -16
- package/dist/text.d.ts +3 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +6 -0
- package/dist/text.js.map +1 -0
- package/dist/theme-runtime.d.ts +16 -0
- package/dist/theme-runtime.d.ts.map +1 -0
- package/dist/theme-runtime.js +100 -0
- package/dist/theme-runtime.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +84 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vivid-colors-preference.d.ts +31 -0
- package/dist/vivid-colors-preference.d.ts.map +1 -0
- package/dist/vivid-colors-preference.js +102 -0
- package/dist/vivid-colors-preference.js.map +1 -0
- package/package.json +26 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { FlowpressBlockRendererProps } from "../../index.js";
|
|
3
|
+
import CustomFieldValue from "./CustomFieldValue.astro";
|
|
4
|
+
|
|
5
|
+
// sf/term-field: ACF / meta field of the current term (custom-fields.php).
|
|
6
|
+
const { block, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<CustomFieldValue block={block} htmlProps={htmlProps} styleflowProps={styleflowProps} baseClass="wp-block-project-term-field" />
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
.flowpress-timeline__list { list-style:none; padding-inline-start:var(--fp-timeline-inset,1.5rem); border-inline-start:var(--fp-timeline-line-width,2px) solid currentColor; }
|
|
2
|
+
.flowpress-timeline__item { position:relative; }
|
|
3
|
+
.flowpress-timeline__item::before { content:""; position:absolute; inline-size:var(--fp-timeline-marker-size,.5rem); block-size:var(--fp-timeline-marker-size,.5rem); border-radius:50%; background:currentColor; inset-inline-start:calc(-1 * var(--fp-timeline-inset,1.5rem) - var(--fp-timeline-marker-size,.5rem) / 2 - var(--fp-timeline-line-width,2px) / 2); }
|
|
4
|
+
.flowpress-timeline__item img { max-inline-size:100%; block-size:auto; }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type TimelineTone = string;
|
|
2
|
+
export type TimelineIntensity = string;
|
|
3
|
+
export interface TimelineMedia {
|
|
4
|
+
url?: string | undefined;
|
|
5
|
+
sourceUrl?: string | undefined;
|
|
6
|
+
alt?: string | undefined;
|
|
7
|
+
altText?: string | undefined;
|
|
8
|
+
width?: number | undefined;
|
|
9
|
+
height?: number | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface TimelineItem {
|
|
12
|
+
year: string;
|
|
13
|
+
description: string;
|
|
14
|
+
image?: TimelineMedia | undefined;
|
|
15
|
+
metric?: string | undefined;
|
|
16
|
+
statisticValue?: string | undefined;
|
|
17
|
+
statisticLabel?: string | undefined;
|
|
18
|
+
tone?: TimelineTone | "inherit" | undefined;
|
|
19
|
+
intensity?: TimelineIntensity | "inherit" | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface TimelineBlockLike {
|
|
22
|
+
name?: string;
|
|
23
|
+
attributes?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export declare function normalizeTimelineTone(value: unknown): string;
|
|
26
|
+
export declare const normalizeTimelineIntensity: typeof normalizeTimelineTone;
|
|
27
|
+
export declare function timelineItemsFromBlocks(blocks: TimelineBlockLike[]): TimelineItem[];
|
|
28
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/astro/native/timeline.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5C,SAAS,CAAC,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAOD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAG5D;AACD,eAAO,MAAM,0BAA0B,8BAAwB,CAAC;AAuBhE,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,EAAE,GAC1B,YAAY,EAAE,CAgBhB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function optionalText(value) {
|
|
2
|
+
const normalized = String(value ?? "").trim();
|
|
3
|
+
return normalized || undefined;
|
|
4
|
+
}
|
|
5
|
+
export function normalizeTimelineTone(value) {
|
|
6
|
+
const normalized = String(value ?? "inherit").trim();
|
|
7
|
+
return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : "inherit";
|
|
8
|
+
}
|
|
9
|
+
export const normalizeTimelineIntensity = normalizeTimelineTone;
|
|
10
|
+
function mediaValue(value) {
|
|
11
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const media = value;
|
|
15
|
+
const url = optionalText(media.url) ?? optionalText(media.sourceUrl);
|
|
16
|
+
if (!url) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
url: optionalText(media.url),
|
|
21
|
+
sourceUrl: optionalText(media.sourceUrl),
|
|
22
|
+
alt: optionalText(media.alt),
|
|
23
|
+
altText: optionalText(media.altText),
|
|
24
|
+
width: Number(media.width) || undefined,
|
|
25
|
+
height: Number(media.height) || undefined
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function timelineItemsFromBlocks(blocks) {
|
|
29
|
+
return blocks
|
|
30
|
+
.filter(({ name }) => name === "sf/timeline-card")
|
|
31
|
+
.map(({ attributes = {} }) => ({
|
|
32
|
+
year: String(attributes.year ?? "").trim(),
|
|
33
|
+
description: String(attributes.description ?? "").trim(),
|
|
34
|
+
image: mediaValue(attributes.image),
|
|
35
|
+
metric: optionalText(attributes.metric),
|
|
36
|
+
statisticValue: optionalText(attributes.statisticValue),
|
|
37
|
+
statisticLabel: optionalText(attributes.statisticLabel),
|
|
38
|
+
tone: normalizeTimelineTone(attributes.tone),
|
|
39
|
+
intensity: normalizeTimelineIntensity(attributes.intensity)
|
|
40
|
+
}))
|
|
41
|
+
.filter(({ year, description, image, metric, statisticValue }) => (Boolean(year || description || image || metric || statisticValue)));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../../src/astro/native/timeline.ts"],"names":[],"mappings":"AA4BA,SAAS,YAAY,CAAC,KAAc;IAClC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,OAAO,UAAU,IAAI,SAAS,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,OAAO,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC;AACD,MAAM,CAAC,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;AAEhE,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,KAAgC,CAAC;IAC/C,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACrE,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC;QAC5B,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC;QACxC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC;QAC5B,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;QACpC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,SAAS;QACvC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,SAAS;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAA2B;IAE3B,OAAO,MAAM;SACV,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,kBAAkB,CAAC;SACjD,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC1C,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QACxD,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QACnC,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC;QACvC,cAAc,EAAE,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC;QACvD,cAAc,EAAE,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC;QACvD,IAAI,EAAE,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5C,SAAS,EAAE,0BAA0B,CAAC,UAAU,CAAC,SAAS,CAAC;KAC5D,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAChE,OAAO,CAAC,IAAI,IAAI,WAAW,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,CAAC,CAClE,CAAC,CAAC;AACP,CAAC","sourcesContent":["export type TimelineTone = string;\nexport type TimelineIntensity = string;\n\nexport interface TimelineMedia {\n url?: string | undefined;\n sourceUrl?: string | undefined;\n alt?: string | undefined;\n altText?: string | undefined;\n width?: number | undefined;\n height?: number | undefined;\n}\n\nexport interface TimelineItem {\n year: string;\n description: string;\n image?: TimelineMedia | undefined;\n metric?: string | undefined;\n statisticValue?: string | undefined;\n statisticLabel?: string | undefined;\n tone?: TimelineTone | \"inherit\" | undefined;\n intensity?: TimelineIntensity | \"inherit\" | undefined;\n}\n\nexport interface TimelineBlockLike {\n name?: string;\n attributes?: Record<string, unknown>;\n}\n\nfunction optionalText(value: unknown): string | undefined {\n const normalized = String(value ?? \"\").trim();\n return normalized || undefined;\n}\n\nexport function normalizeTimelineTone(value: unknown): string {\n const normalized = String(value ?? \"inherit\").trim();\n return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : \"inherit\";\n}\nexport const normalizeTimelineIntensity = normalizeTimelineTone;\n\nfunction mediaValue(value: unknown): TimelineMedia | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return undefined;\n }\n\n const media = value as Record<string, unknown>;\n const url = optionalText(media.url) ?? optionalText(media.sourceUrl);\n if (!url) {\n return undefined;\n }\n\n return {\n url: optionalText(media.url),\n sourceUrl: optionalText(media.sourceUrl),\n alt: optionalText(media.alt),\n altText: optionalText(media.altText),\n width: Number(media.width) || undefined,\n height: Number(media.height) || undefined\n };\n}\n\nexport function timelineItemsFromBlocks(\n blocks: TimelineBlockLike[]\n): TimelineItem[] {\n return blocks\n .filter(({ name }) => name === \"sf/timeline-card\")\n .map(({ attributes = {} }) => ({\n year: String(attributes.year ?? \"\").trim(),\n description: String(attributes.description ?? \"\").trim(),\n image: mediaValue(attributes.image),\n metric: optionalText(attributes.metric),\n statisticValue: optionalText(attributes.statisticValue),\n statisticLabel: optionalText(attributes.statisticLabel),\n tone: normalizeTimelineTone(attributes.tone),\n intensity: normalizeTimelineIntensity(attributes.intensity)\n }))\n .filter(({ year, description, image, metric, statisticValue }) => (\n Boolean(year || description || image || metric || statisticValue)\n ));\n}\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type TimelineTone = string;
|
|
2
|
+
export type TimelineIntensity = string;
|
|
3
|
+
|
|
4
|
+
export interface TimelineMedia {
|
|
5
|
+
url?: string | undefined;
|
|
6
|
+
sourceUrl?: string | undefined;
|
|
7
|
+
alt?: string | undefined;
|
|
8
|
+
altText?: string | undefined;
|
|
9
|
+
width?: number | undefined;
|
|
10
|
+
height?: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TimelineItem {
|
|
14
|
+
year: string;
|
|
15
|
+
description: string;
|
|
16
|
+
image?: TimelineMedia | undefined;
|
|
17
|
+
metric?: string | undefined;
|
|
18
|
+
statisticValue?: string | undefined;
|
|
19
|
+
statisticLabel?: string | undefined;
|
|
20
|
+
tone?: TimelineTone | "inherit" | undefined;
|
|
21
|
+
intensity?: TimelineIntensity | "inherit" | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TimelineBlockLike {
|
|
25
|
+
name?: string;
|
|
26
|
+
attributes?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function optionalText(value: unknown): string | undefined {
|
|
30
|
+
const normalized = String(value ?? "").trim();
|
|
31
|
+
return normalized || undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function normalizeTimelineTone(value: unknown): string {
|
|
35
|
+
const normalized = String(value ?? "inherit").trim();
|
|
36
|
+
return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : "inherit";
|
|
37
|
+
}
|
|
38
|
+
export const normalizeTimelineIntensity = normalizeTimelineTone;
|
|
39
|
+
|
|
40
|
+
function mediaValue(value: unknown): TimelineMedia | undefined {
|
|
41
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const media = value as Record<string, unknown>;
|
|
46
|
+
const url = optionalText(media.url) ?? optionalText(media.sourceUrl);
|
|
47
|
+
if (!url) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
url: optionalText(media.url),
|
|
53
|
+
sourceUrl: optionalText(media.sourceUrl),
|
|
54
|
+
alt: optionalText(media.alt),
|
|
55
|
+
altText: optionalText(media.altText),
|
|
56
|
+
width: Number(media.width) || undefined,
|
|
57
|
+
height: Number(media.height) || undefined
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function timelineItemsFromBlocks(
|
|
62
|
+
blocks: TimelineBlockLike[]
|
|
63
|
+
): TimelineItem[] {
|
|
64
|
+
return blocks
|
|
65
|
+
.filter(({ name }) => name === "sf/timeline-card")
|
|
66
|
+
.map(({ attributes = {} }) => ({
|
|
67
|
+
year: String(attributes.year ?? "").trim(),
|
|
68
|
+
description: String(attributes.description ?? "").trim(),
|
|
69
|
+
image: mediaValue(attributes.image),
|
|
70
|
+
metric: optionalText(attributes.metric),
|
|
71
|
+
statisticValue: optionalText(attributes.statisticValue),
|
|
72
|
+
statisticLabel: optionalText(attributes.statisticLabel),
|
|
73
|
+
tone: normalizeTimelineTone(attributes.tone),
|
|
74
|
+
intensity: normalizeTimelineIntensity(attributes.intensity)
|
|
75
|
+
}))
|
|
76
|
+
.filter(({ year, description, image, metric, statisticValue }) => (
|
|
77
|
+
Boolean(year || description || image || metric || statisticValue)
|
|
78
|
+
));
|
|
79
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { decodeFlowpressText } from "../../text.js";
|
|
3
|
+
import StyleflowElement from "../StyleflowElement.astro";
|
|
4
|
+
import MotionToggle from "./MotionToggle.astro";
|
|
5
|
+
import ThemeToggle from "./ThemeToggle.astro";
|
|
6
|
+
import ColorModeToggle from "./ColorModeToggle.astro";
|
|
7
|
+
import { preferencesStyleflow } from "../../preferences-styleflow.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Floating accessibility controls: a round button, fixed bottom-right, that
|
|
11
|
+
* opens a small panel with the theme (dark/light) and animations (on/off)
|
|
12
|
+
* switches. Astro only; it ships hidden and is revealed by its script, since
|
|
13
|
+
* nothing in it works without JavaScript. Mount it once, in the layout.
|
|
14
|
+
*/
|
|
15
|
+
interface Props {
|
|
16
|
+
/** Panel title and its accessible name. */
|
|
17
|
+
title?: string;
|
|
18
|
+
openLabel?: string;
|
|
19
|
+
closeLabel?: string;
|
|
20
|
+
themeLabel?: string;
|
|
21
|
+
motionLabel?: string;
|
|
22
|
+
vividColorLabel?: string;
|
|
23
|
+
/** Show the light/dark switch; hide it while a project has no designed dark theme. */
|
|
24
|
+
showTheme?: boolean;
|
|
25
|
+
themes?: string[];
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
title = "Accessibilità",
|
|
31
|
+
openLabel = "Apri le impostazioni di accessibilità",
|
|
32
|
+
closeLabel = "Chiudi le impostazioni di accessibilità",
|
|
33
|
+
themeLabel = "Tema scuro",
|
|
34
|
+
motionLabel = "Animazioni",
|
|
35
|
+
vividColorLabel = "Colori vividi",
|
|
36
|
+
themes = ["light", "dark"],
|
|
37
|
+
showTheme = themes.includes("dark") && themes.some((theme) => theme !== "dark"),
|
|
38
|
+
class: className,
|
|
39
|
+
} = Astro.props;
|
|
40
|
+
const triggerColors = preferencesStyleflow({tone:"main",intensity:"strong-1",surface:"raised"},{tone:"main",intensity:"base",surface:"raised"});
|
|
41
|
+
const panelColors = preferencesStyleflow({tone:"neutral",intensity:"soft-3",surface:"raised"},{tone:"neutral",intensity:"soft-2",surface:"raised"},{tone:"neutral",intensity:"base",surface:"default"});
|
|
42
|
+
const titleTypography = preferencesStyleflow({ty:"body",v:"lg",w:"strong"},{ty:"body",v:"md",w:"strong"});
|
|
43
|
+
const labelTypography = preferencesStyleflow({ty:"body",v:"md",w:"default"});
|
|
44
|
+
const id = `sf-a11y-${crypto.randomUUID()}`;
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
<!-- Hidden until its script runs; the wrapper only positions the controls. -->
|
|
48
|
+
<StyleflowElement as="div"
|
|
49
|
+
data-sf-a11y
|
|
50
|
+
hidden
|
|
51
|
+
layoutRole="none"
|
|
52
|
+
density="compact"
|
|
53
|
+
noBackground
|
|
54
|
+
noBorder
|
|
55
|
+
noForeground
|
|
56
|
+
noGap
|
|
57
|
+
noPadding
|
|
58
|
+
noRadius
|
|
59
|
+
class:list={["sf-a11y", className]}
|
|
60
|
+
>
|
|
61
|
+
<StyleflowElement as="button"
|
|
62
|
+
type="button"
|
|
63
|
+
data-sf-a11y-trigger
|
|
64
|
+
data-open-label={openLabel}
|
|
65
|
+
data-close-label={closeLabel}
|
|
66
|
+
aria-label={openLabel}
|
|
67
|
+
aria-haspopup="dialog"
|
|
68
|
+
aria-expanded="false"
|
|
69
|
+
aria-controls={`${id}-panel`}
|
|
70
|
+
{...triggerColors}
|
|
71
|
+
foreground="primary"
|
|
72
|
+
layoutRole="control"
|
|
73
|
+
density="compact"
|
|
74
|
+
interactivePriority="primary"
|
|
75
|
+
noPadding
|
|
76
|
+
class="sf-a11y__trigger"
|
|
77
|
+
>
|
|
78
|
+
<svg class="sf-a11y__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
|
|
79
|
+
<circle cx="12" cy="5" r="1.75" fill="currentColor" stroke="none"></circle>
|
|
80
|
+
<path d="M5.5 9.5h13M12 9.5v4.5M12 14l-3 6M12 14l3 6"></path>
|
|
81
|
+
</svg>
|
|
82
|
+
</StyleflowElement>
|
|
83
|
+
|
|
84
|
+
<StyleflowElement as="div"
|
|
85
|
+
id={`${id}-panel`}
|
|
86
|
+
role="dialog"
|
|
87
|
+
aria-modal="false"
|
|
88
|
+
aria-labelledby={`${id}-title`}
|
|
89
|
+
data-sf-a11y-panel
|
|
90
|
+
data-state="closed"
|
|
91
|
+
inert
|
|
92
|
+
{...panelColors}
|
|
93
|
+
layoutRole="panel"
|
|
94
|
+
density="regular"
|
|
95
|
+
class="sf-a11y__panel"
|
|
96
|
+
>
|
|
97
|
+
<StyleflowElement as="h2" id={`${id}-title`} {...titleTypography}>{decodeFlowpressText(title)}</StyleflowElement>
|
|
98
|
+
{showTheme ? (
|
|
99
|
+
<StyleflowElement as="div" layoutRole="none" class="sf-a11y__row">
|
|
100
|
+
<StyleflowElement as="span" id={`${id}-theme-label`} {...labelTypography}>{decodeFlowpressText(themeLabel)}</StyleflowElement>
|
|
101
|
+
<ThemeToggle labelledby={`${id}-theme-label`} />
|
|
102
|
+
</StyleflowElement>
|
|
103
|
+
) : null}
|
|
104
|
+
<StyleflowElement as="div" layoutRole="none" class="sf-a11y__row">
|
|
105
|
+
<StyleflowElement as="span" id={`${id}-motion-label`} {...labelTypography}>{decodeFlowpressText(motionLabel)}</StyleflowElement>
|
|
106
|
+
<MotionToggle labelledby={`${id}-motion-label`} />
|
|
107
|
+
</StyleflowElement>
|
|
108
|
+
<StyleflowElement as="div" layoutRole="none" class="sf-a11y__row">
|
|
109
|
+
<StyleflowElement as="span" id={`${id}-color-mode-vivid-label`} {...labelTypography}>{decodeFlowpressText(vividColorLabel)}</StyleflowElement>
|
|
110
|
+
<ColorModeToggle labelledby={`${id}-color-mode-vivid-label`} />
|
|
111
|
+
</StyleflowElement>
|
|
112
|
+
</StyleflowElement>
|
|
113
|
+
</StyleflowElement>
|
|
114
|
+
|
|
115
|
+
<script>
|
|
116
|
+
import { startFlowpressPreferencesRuntime } from "../../preferences-runtime.js";
|
|
117
|
+
startFlowpressPreferencesRuntime();
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Toggle from "./Toggle.astro";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Vivid-colors switch (checked means full saturation). State and persistence
|
|
6
|
+
* live in vivid-colors-preference.ts and are mirrored on
|
|
7
|
+
* `<html data-sf-vivid-colors>`.
|
|
8
|
+
*/
|
|
9
|
+
interface Props {
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
/** Id of a visible label; it then names the switch instead of `label`. */
|
|
12
|
+
labelledby?: string | undefined;
|
|
13
|
+
class?: string | undefined;
|
|
14
|
+
[attribute: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { label = "Vivid colors", labelledby, class: className, ...attributes } = Astro.props;
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<Toggle {...attributes} label={label} labelledby={labelledby} class={className} data-sf-vivid-colors-toggle />
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { startFlowpressPreferencesRuntime } from "../../preferences-runtime.js";
|
|
25
|
+
startFlowpressPreferencesRuntime();
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Toggle from "./Toggle.astro";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Animations on/off switch (checked means animations on). State and
|
|
6
|
+
* persistence live in motion-preference.ts: the choice is stored, mirrored on
|
|
7
|
+
* `<html data-sf-motion-preference>` and picked up live by blobs, reveals and
|
|
8
|
+
* the navigation drawer.
|
|
9
|
+
*/
|
|
10
|
+
interface Props {
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
/** Id of a visible label; it then names the switch instead of `label`. */
|
|
13
|
+
labelledby?: string | undefined;
|
|
14
|
+
class?: string | undefined;
|
|
15
|
+
[attribute: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { label = "Animations", labelledby, class: className, ...attributes } = Astro.props;
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<Toggle {...attributes} label={label} labelledby={labelledby} class={className} data-sf-motion-toggle />
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import { startFlowpressPreferencesRuntime } from "../../preferences-runtime.js";
|
|
26
|
+
startFlowpressPreferencesRuntime();
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { motionPreferenceBootstrapScript, vividColorsBootstrapScript } from "../../preferences.js";
|
|
3
|
+
---
|
|
4
|
+
<script is:inline set:html={motionPreferenceBootstrapScript()}></script>
|
|
5
|
+
<script is:inline set:html={vividColorsBootstrapScript()}></script>
|
|
6
|
+
<script>
|
|
7
|
+
import { startFlowpressPreferencesRuntime } from "../../preferences-runtime.js";
|
|
8
|
+
startFlowpressPreferencesRuntime();
|
|
9
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Toggle from "./Toggle.astro";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Dark/light switch. The theme itself belongs to the FlowPress theme runtime,
|
|
6
|
+
* which binds every `[data-styleflow-theme-toggle]` and flips
|
|
7
|
+
* `<html data-styleflow-theme>`; this component only renders the switch and
|
|
8
|
+
* keeps `aria-checked` in step (checked means the dark theme).
|
|
9
|
+
*/
|
|
10
|
+
interface Props {
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
/** Id of a visible label; it then names the switch instead of `label`. */
|
|
13
|
+
labelledby?: string | undefined;
|
|
14
|
+
class?: string | undefined;
|
|
15
|
+
[attribute: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { label = "Change color theme", labelledby, class: className, ...attributes } = Astro.props;
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<Toggle {...attributes} label={label} labelledby={labelledby} class={className} data-styleflow-theme-toggle data-styleflow-theme-toggle-target="dark">
|
|
22
|
+
<svg slot="thumb" class="sf-toggle__glyph sf-toggle__glyph--off" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
|
|
23
|
+
<circle cx="12" cy="12" r="4.5"></circle>
|
|
24
|
+
<path d="M12 2.5v2M12 19.5v2M4.6 4.6l1.4 1.4M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4L6 18M18 6l1.4-1.4"></path>
|
|
25
|
+
</svg>
|
|
26
|
+
<svg slot="thumb" class="sf-toggle__glyph sf-toggle__glyph--on" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
|
|
27
|
+
<path d="M20.5 13.2A8.5 8.5 0 1 1 10.8 3.5a6.7 6.7 0 0 0 9.7 9.7z"></path>
|
|
28
|
+
</svg>
|
|
29
|
+
</Toggle>
|
|
30
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
import StyleflowElement from "../StyleflowElement.astro";
|
|
3
|
+
import "./preferences.css";
|
|
4
|
+
import { preferencesStyleflow } from "../../preferences-styleflow.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* iOS-style switch: a track that cross-fades from neutral to the main tone and a
|
|
8
|
+
* thumb that slides across. It owns semantics (`role="switch"`, `aria-checked`)
|
|
9
|
+
* and looks, not state: whoever uses it flips `aria-checked` (see ThemeToggle,
|
|
10
|
+
* MotionToggle). Colours come from Styleflow props only; the "on" look lives
|
|
11
|
+
* in preferences.css so a toggle can also mirror document state before scripts run.
|
|
12
|
+
*
|
|
13
|
+
* Name it with `label` (aria-label) or, when a visible label sits next to it,
|
|
14
|
+
* with `labelledby` (id of that label).
|
|
15
|
+
*/
|
|
16
|
+
interface Props {
|
|
17
|
+
label?: string | undefined;
|
|
18
|
+
labelledby?: string | undefined;
|
|
19
|
+
checked?: boolean | undefined;
|
|
20
|
+
class?: string | undefined;
|
|
21
|
+
[attribute: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { label, labelledby, checked = false, class: className, ...attributes } = Astro.props;
|
|
25
|
+
const off = preferencesStyleflow({tone:"neutral",intensity:"soft-1",surface:"sunken"},{tone:"neutral",intensity:"base",surface:"default"});
|
|
26
|
+
const on = preferencesStyleflow({tone:"main",intensity:"strong-2",surface:"default"},{tone:"main",intensity:"base",surface:"default"});
|
|
27
|
+
const thumb = preferencesStyleflow({tone:"neutral",intensity:"soft-3",surface:"raised"},{tone:"neutral",intensity:"soft-2",surface:"raised"},{tone:"neutral",intensity:"base",surface:"default"});
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<StyleflowElement as="button"
|
|
31
|
+
{...attributes}
|
|
32
|
+
type="button"
|
|
33
|
+
role="switch"
|
|
34
|
+
aria-checked={checked ? "true" : "false"}
|
|
35
|
+
aria-label={labelledby ? undefined : label}
|
|
36
|
+
aria-labelledby={labelledby}
|
|
37
|
+
foreground="primary"
|
|
38
|
+
layoutRole="none"
|
|
39
|
+
density="compact"
|
|
40
|
+
interactivePriority="tertiary"
|
|
41
|
+
noPadding
|
|
42
|
+
noBackground
|
|
43
|
+
class:list={["sf-toggle", className]}
|
|
44
|
+
>
|
|
45
|
+
<StyleflowElement as="span" aria-hidden="true" {...off} layoutRole="none" class="sf-toggle__track"></StyleflowElement>
|
|
46
|
+
<StyleflowElement as="span" aria-hidden="true" {...on} layoutRole="none" class="sf-toggle__track sf-toggle__track--on"></StyleflowElement>
|
|
47
|
+
<StyleflowElement as="span" aria-hidden="true" {...thumb} layoutRole="none" class="sf-toggle__thumb">
|
|
48
|
+
<slot name="thumb" />
|
|
49
|
+
</StyleflowElement>
|
|
50
|
+
</StyleflowElement>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Toggle: state and geometry live here; colours come from StyleFlow props.
|
|
3
|
+
*
|
|
4
|
+
* `--sf-toggle-on` is 1 when the switch reads "on". Besides `aria-checked`, the
|
|
5
|
+
* theme and motion switches mirror the document (`<html>` attributes set by the
|
|
6
|
+
* head bootstrap scripts), so they are right from first paint and never slide
|
|
7
|
+
* into place after the page loads.
|
|
8
|
+
*/
|
|
9
|
+
.sf-toggle {
|
|
10
|
+
--sf-toggle-on: 0;
|
|
11
|
+
--sf-toggle-travel: 1.25rem;
|
|
12
|
+
--sf-toggle-direction: 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sf-toggle:dir(rtl) {
|
|
16
|
+
--sf-toggle-direction: -1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sf-toggle[aria-checked="true"],
|
|
20
|
+
html[data-styleflow-theme="dark"] .sf-toggle[data-styleflow-theme-toggle],
|
|
21
|
+
html[data-sf-motion-preference="full"] .sf-toggle[data-sf-motion-toggle],
|
|
22
|
+
html[data-sf-vivid-colors="true"] .sf-toggle[data-sf-vivid-colors-toggle] {
|
|
23
|
+
--sf-toggle-on: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sf-toggle__track--on {
|
|
27
|
+
opacity: var(--sf-toggle-on);
|
|
28
|
+
transition: opacity var(--sf-motion-duration-default, 180ms) var(--sf-motion-ease-standard, ease);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* A ring keeps the "off" track readable against the panel in both themes. */
|
|
32
|
+
.sf-toggle__track:not(.sf-toggle__track--on) {
|
|
33
|
+
box-shadow: inset 0 0 0 0.0625rem var(--sf-border);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sf-toggle__thumb {
|
|
37
|
+
box-shadow: 0 0.0625rem 0.25rem color-mix(in srgb, var(--sf-foreground-primary) 45%, transparent);
|
|
38
|
+
transform: translateX(calc(var(--sf-toggle-on) * var(--sf-toggle-travel) * var(--sf-toggle-direction)));
|
|
39
|
+
transition:
|
|
40
|
+
transform var(--sf-motion-duration-default, 180ms) var(--sf-motion-ease-out, ease-out),
|
|
41
|
+
scale var(--sf-motion-duration-fast, 120ms) var(--sf-motion-ease-out, ease-out);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sf-toggle:active .sf-toggle__thumb {
|
|
45
|
+
scale: 1.08 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Optional thumb glyphs: one per state, cross-fading with the thumb. */
|
|
49
|
+
.sf-toggle__glyph {
|
|
50
|
+
position: absolute;
|
|
51
|
+
inline-size: 1rem;
|
|
52
|
+
block-size: 1rem;
|
|
53
|
+
transition: opacity var(--sf-motion-duration-default, 180ms) var(--sf-motion-ease-standard, ease);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.sf-toggle__glyph--off {
|
|
57
|
+
opacity: calc(1 - var(--sf-toggle-on));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sf-toggle__glyph--on {
|
|
61
|
+
opacity: var(--sf-toggle-on);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* Accessibility panel: the closed/open states and the lift under the round
|
|
66
|
+
* button. Colours are Styleflow tokens (set by the S props in the markup); the
|
|
67
|
+
* shadow is derived from the foreground token so it follows the theme.
|
|
68
|
+
* Transitions stop on their own when animations are off (motion.css).
|
|
69
|
+
*/
|
|
70
|
+
html[data-sf-vivid-colors="false"] {
|
|
71
|
+
filter: saturate(30%);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.sf-a11y__trigger {
|
|
75
|
+
box-shadow: 0 0.375rem 1.25rem color-mix(in srgb, var(--sf-surface-default-foreground-primary) 28%, transparent);
|
|
76
|
+
transition: transform var(--sf-motion-duration-default, 180ms) var(--sf-motion-ease-out, ease-out);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.sf-a11y__trigger:active {
|
|
80
|
+
transform: scale(0.94);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.sf-a11y__panel {
|
|
84
|
+
box-shadow: 0 0.75rem 2rem color-mix(in srgb, var(--sf-surface-default-foreground-primary) 22%, transparent);
|
|
85
|
+
transform-origin: bottom right;
|
|
86
|
+
transition:
|
|
87
|
+
opacity var(--sf-motion-duration-fast, 120ms) var(--sf-motion-ease-soft, ease),
|
|
88
|
+
transform var(--sf-motion-duration-default, 180ms) var(--sf-motion-ease-out, ease-out),
|
|
89
|
+
visibility 0s linear var(--sf-motion-duration-default, 180ms);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.sf-a11y__panel[data-state="closed"] {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transform: translateY(0.5rem) scale(0.96);
|
|
95
|
+
visibility: hidden;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.sf-a11y__panel[data-state="open"] {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
transform: none;
|
|
101
|
+
transition-delay: 0s;
|
|
102
|
+
visibility: visible;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.sf-a11y__panel[data-state="open"]:dir(rtl) {
|
|
106
|
+
transform-origin: bottom left;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Geometry formerly supplied by the pilot Tailwind classes. */
|
|
110
|
+
.sf-toggle { position: relative; display: inline-block; block-size: 2rem; inline-size: 3.25rem; flex-shrink: 0; cursor: pointer; border-radius: 9999px !important; }
|
|
111
|
+
.sf-toggle__track { position: absolute; inset: 0; border-radius: 9999px !important; }
|
|
112
|
+
.sf-toggle__thumb { position: absolute; inset-inline-start: .125rem; inset-block-start: .125rem; display: grid; inline-size: 1.75rem; block-size: 1.75rem; place-items: center; border-radius: 9999px !important; }
|
|
113
|
+
.sf-a11y { position: fixed; inset-inline-end: var(--fp-preferences-inset, 1rem); inset-block-end: var(--fp-preferences-inset, 1rem); z-index: var(--fp-preferences-z-index, var(--z-floating, 50)); display: flex; flex-direction: column-reverse; align-items: flex-end; gap: .75rem; }
|
|
114
|
+
.sf-a11y[hidden] { display: none !important; }
|
|
115
|
+
.sf-a11y__trigger { display: grid; inline-size: 3.5rem; block-size: 3.5rem; flex-shrink: 0; place-items: center; cursor: pointer; border-radius: 9999px !important; }
|
|
116
|
+
.sf-a11y__icon { inline-size: 1.75rem; block-size: 1.75rem; }
|
|
117
|
+
.sf-a11y__panel { display: flex; flex-direction: column; inline-size: var(--fp-preferences-width, 18rem); max-inline-size: calc(100vw - 2rem); gap: 1rem; }
|
|
118
|
+
.sf-a11y__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
|
|
119
|
+
/* Inherited visibility must become focusable immediately, without an all transition. */
|
|
120
|
+
.sf-a11y__row, .sf-toggle { transition-property: color, background-color, border-color, box-shadow; }
|
|
121
|
+
.sf-toggle:focus-visible, .sf-a11y__trigger:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
|
|
122
|
+
html[data-sf-motion-preference="reduce"] :is(.sf-toggle, .sf-toggle *, .sf-a11y, .sf-a11y *) { transition: none !important; }
|
|
123
|
+
@media print { .sf-a11y { display: none !important; } }
|
|
124
|
+
|
|
125
|
+
.flowpress-theme-control { display: inline-flex; align-items: center; gap: .5rem; }
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import type { AstroComponentFactory } from "astro/runtime/server/index.js";
|
|
2
|
-
import type { StyleflowContract } from "./styleflow.js";
|
|
3
|
-
import type { FlowpressBlock } from "./types.js";
|
|
2
|
+
import type { DynamicStyleflowProps, StyleflowContract } from "./styleflow.js";
|
|
3
|
+
import type { FlowpressBlock, FlowpressBlockHtmlProps, FlowpressBlockAdapterStatus, FlowpressBlockClass, FlowpressCompositionV1 } from "./types.js";
|
|
4
4
|
export interface FlowpressBlockRendererProps {
|
|
5
5
|
block: FlowpressBlock;
|
|
6
|
-
|
|
6
|
+
styleflowProps: DynamicStyleflowProps;
|
|
7
|
+
htmlProps: FlowpressBlockHtmlProps;
|
|
8
|
+
composition?: FlowpressCompositionV1 | undefined;
|
|
9
|
+
context: {
|
|
10
|
+
parentBlockName?: string;
|
|
11
|
+
depth: number;
|
|
12
|
+
production: boolean;
|
|
13
|
+
};
|
|
14
|
+
parentBlockName?: string;
|
|
15
|
+
contract?: StyleflowContract | undefined;
|
|
16
|
+
adapters?: FlowpressBlockAdapters | undefined;
|
|
7
17
|
}
|
|
8
18
|
export interface FlowpressIconRendererProps {
|
|
9
19
|
name: string;
|
|
@@ -19,4 +29,11 @@ export interface FlowpressIconRendererProps {
|
|
|
19
29
|
export type FlowpressBlockRenderer = AstroComponentFactory;
|
|
20
30
|
export type FlowpressIconRenderer = AstroComponentFactory;
|
|
21
31
|
export type FlowpressBlockRenderers = Readonly<Record<string, FlowpressBlockRenderer>>;
|
|
32
|
+
export interface FlowpressBlockAdapterDefinition {
|
|
33
|
+
renderer: FlowpressBlockRenderer;
|
|
34
|
+
status: FlowpressBlockAdapterStatus;
|
|
35
|
+
class: FlowpressBlockClass;
|
|
36
|
+
fingerprint: string;
|
|
37
|
+
}
|
|
38
|
+
export type FlowpressBlockAdapters = Readonly<Record<string, FlowpressBlockAdapterDefinition>>;
|
|
22
39
|
//# sourceMappingURL=block-renderers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-renderers.d.ts","sourceRoot":"","sources":["../src/block-renderers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"block-renderers.d.ts","sourceRoot":"","sources":["../src/block-renderers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,cAAc,CAAC;IACtB,cAAc,EAAE,qBAAqB,CAAC;IACtC,SAAS,EAAE,uBAAuB,CAAC;IACnC,WAAW,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IACjD,OAAO,EAAE;QACP,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAC5C,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CACvC,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE,2BAA2B,CAAC;IACpC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAC3C,MAAM,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-renderers.js","sourceRoot":"","sources":["../src/block-renderers.ts"],"names":[],"mappings":"","sourcesContent":["import type { AstroComponentFactory } from \"astro/runtime/server/index.js\";\nimport type { StyleflowContract } from \"./styleflow.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"block-renderers.js","sourceRoot":"","sources":["../src/block-renderers.ts"],"names":[],"mappings":"","sourcesContent":["import type { AstroComponentFactory } from \"astro/runtime/server/index.js\";\nimport type { DynamicStyleflowProps, StyleflowContract } from \"./styleflow.js\";\nimport type {\n FlowpressBlock,\n FlowpressBlockHtmlProps,\n FlowpressBlockAdapterStatus,\n FlowpressBlockClass,\n FlowpressCompositionV1\n} from \"./types.js\";\n\nexport interface FlowpressBlockRendererProps {\n block: FlowpressBlock;\n styleflowProps: DynamicStyleflowProps;\n htmlProps: FlowpressBlockHtmlProps;\n composition?: FlowpressCompositionV1 | undefined;\n context: {\n parentBlockName?: string;\n depth: number;\n production: boolean;\n };\n parentBlockName?: string;\n contract?: StyleflowContract | undefined;\n adapters?: FlowpressBlockAdapters | undefined;\n}\n\nexport interface FlowpressIconRendererProps {\n name: string;\n display?: \"inline\" | \"block\";\n foreground?: string;\n tone?: string;\n intensity?: string | number;\n size?: number;\n label?: string;\n id?: string;\n class?: string;\n}\n\nexport type FlowpressBlockRenderer = AstroComponentFactory;\n\nexport type FlowpressIconRenderer = AstroComponentFactory;\n\nexport type FlowpressBlockRenderers = Readonly<\n Record<string, FlowpressBlockRenderer>\n>;\n\nexport interface FlowpressBlockAdapterDefinition {\n renderer: FlowpressBlockRenderer;\n status: FlowpressBlockAdapterStatus;\n class: FlowpressBlockClass;\n fingerprint: string;\n}\n\nexport type FlowpressBlockAdapters = Readonly<\n Record<string, FlowpressBlockAdapterDefinition>\n>;\n"]}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FlowpressCapabilities, FlowpressContent, FlowpressRoute } from "./types.js";
|
|
1
|
+
import type { FlowpressCapabilities, FlowpressCompositionV1, FlowpressContent, FlowpressRoute } from "./types.js";
|
|
2
2
|
export interface FlowpressGraphqlIssue {
|
|
3
3
|
message?: string;
|
|
4
4
|
extensions?: {
|
|
@@ -31,5 +31,21 @@ export declare class FlowpressClient {
|
|
|
31
31
|
getRoute(uri: string, locale?: string): Promise<FlowpressRoute | null>;
|
|
32
32
|
getRoutes(locale?: string): Promise<FlowpressRoute[]>;
|
|
33
33
|
getContent(loader: string, variables: Record<string, unknown>): Promise<FlowpressContent | null>;
|
|
34
|
+
getComposition(uri: string, locale?: string, options?: {
|
|
35
|
+
includeContent?: boolean;
|
|
36
|
+
}): Promise<FlowpressCompositionV1 | null>;
|
|
37
|
+
/** Site Editor already returns route and content in its composition. No
|
|
38
|
+
* route preflight, retries or cross-request cache are needed for previews.
|
|
39
|
+
*/
|
|
40
|
+
getPage(uri: string, options: {
|
|
41
|
+
mode: "site-editor" | "astro";
|
|
42
|
+
locale?: string;
|
|
43
|
+
route?: FlowpressRoute;
|
|
44
|
+
includeContent?: boolean;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
route: FlowpressRoute;
|
|
47
|
+
content: FlowpressContent | null;
|
|
48
|
+
composition: FlowpressCompositionV1 | null;
|
|
49
|
+
} | null>;
|
|
34
50
|
}
|
|
35
51
|
//# sourceMappingURL=client.d.ts.map
|