@styleflow.app/flowpress-astro-core 1.0.0-beta.4 → 1.0.0-beta.40
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 +242 -1
- package/README.md +104 -5
- package/dist/accessibility-panel.d.ts +2 -0
- package/dist/accessibility-panel.d.ts.map +1 -0
- package/dist/accessibility-panel.js +81 -0
- package/dist/accessibility-panel.js.map +1 -0
- package/dist/astro/BaseLayout.astro +34 -17
- package/dist/astro/CompositionRenderer.astro +168 -0
- package/dist/astro/DefaultBlockAdapter.astro +37 -0
- package/dist/astro/FontStylesheets.astro +35 -0
- package/dist/astro/GutenbergRenderer.astro +267 -80
- package/dist/astro/Media.astro +24 -0
- package/dist/astro/StyleflowElement.astro +24 -0
- package/dist/astro/ThemeRuntime.astro +26 -0
- package/dist/astro/blocks/CarouselBlock.astro +11 -10
- package/dist/astro/blocks/CarouselItemBlock.astro +4 -4
- package/dist/astro/blocks/ColumnBlock.astro +4 -5
- package/dist/astro/blocks/CoverBlock.astro +169 -0
- package/dist/astro/blocks/FormBlock.astro +23 -20
- package/dist/astro/blocks/GridBlock.astro +6 -4
- package/dist/astro/blocks/HeroBlock.astro +6 -6
- package/dist/astro/blocks/ImageBlock.astro +6 -6
- package/dist/astro/blocks/ListItemFallback.astro +9 -7
- package/dist/astro/blocks/NumberSpinnerBlock.astro +29 -22
- package/dist/astro/blocks/SemanticElement.astro +35 -0
- package/dist/astro/blocks/SiteLogoBlock.astro +54 -0
- package/dist/astro/blocks/TextBlock.astro +33 -28
- package/dist/astro/blocks/ThemeToggleBlock.astro +13 -0
- package/dist/astro/blocks/cover.d.ts +13 -0
- package/dist/astro/blocks/cover.d.ts.map +1 -0
- package/dist/astro/blocks/cover.js +105 -0
- package/dist/astro/blocks/cover.js.map +1 -0
- package/dist/astro/blocks/cover.ts +119 -0
- package/dist/astro/blocks/helpers.d.ts +10 -1
- package/dist/astro/blocks/helpers.d.ts.map +1 -1
- package/dist/astro/blocks/helpers.js +55 -39
- package/dist/astro/blocks/helpers.js.map +1 -1
- package/dist/astro/blocks/helpers.ts +69 -44
- package/dist/astro/motion/AccordionRuntime.astro +9 -0
- package/dist/astro/motion/MotionBoot.astro +21 -0
- package/dist/astro/motion/MotionRuntime.astro +31 -0
- package/dist/astro/motion/accordion.css +163 -0
- package/dist/astro/motion/accordion.d.ts +3 -0
- package/dist/astro/motion/accordion.d.ts.map +1 -0
- package/dist/astro/motion/accordion.js +98 -0
- package/dist/astro/motion/accordion.js.map +1 -0
- package/dist/astro/motion/accordion.ts +109 -0
- package/dist/astro/motion/motion-controller.d.ts +12 -0
- package/dist/astro/motion/motion-controller.d.ts.map +1 -0
- package/dist/astro/motion/motion-controller.js +293 -0
- package/dist/astro/motion/motion-controller.js.map +1 -0
- package/dist/astro/motion/motion-controller.ts +377 -0
- package/dist/astro/motion/motion.css +546 -0
- package/dist/astro/motion/motion.d.ts +127 -0
- package/dist/astro/motion/motion.d.ts.map +1 -0
- package/dist/astro/motion/motion.js +255 -0
- package/dist/astro/motion/motion.js.map +1 -0
- package/dist/astro/motion/motion.ts +419 -0
- package/dist/astro/native/Blob.astro +113 -0
- package/dist/astro/native/BlobBlock.astro +52 -0
- package/dist/astro/native/CustomFieldValue.astro +88 -0
- package/dist/astro/native/LevelTag.astro +20 -0
- package/dist/astro/native/MapBlock.astro +41 -0
- package/dist/astro/native/NativeHtmlBlock.astro +12 -0
- package/dist/astro/native/NativeIconBlock.astro +42 -0
- package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
- package/dist/astro/native/ReservedLogin.astro +107 -0
- package/dist/astro/native/ResolvedBlocks.astro +91 -0
- package/dist/astro/native/SyncedPatternContent.astro +94 -0
- package/dist/astro/native/TermFieldValue.astro +39 -0
- package/dist/astro/native/Timeline.astro +22 -0
- package/dist/astro/native/TimelineCardBlock.astro +7 -0
- package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
- package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
- package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
- package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
- package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
- package/dist/astro/native/blob/config.d.ts +49 -0
- package/dist/astro/native/blob/config.d.ts.map +1 -0
- package/dist/astro/native/blob/config.js +86 -0
- package/dist/astro/native/blob/config.js.map +1 -0
- package/dist/astro/native/blob/config.ts +132 -0
- package/dist/astro/native/blob/controller.d.ts +11 -0
- package/dist/astro/native/blob/controller.d.ts.map +1 -0
- package/dist/astro/native/blob/controller.js +240 -0
- package/dist/astro/native/blob/controller.js.map +1 -0
- package/dist/astro/native/blob/controller.ts +248 -0
- package/dist/astro/native/blob/geometry.d.ts +2 -0
- package/dist/astro/native/blob/geometry.d.ts.map +1 -0
- package/dist/astro/native/blob/geometry.js +2 -0
- package/dist/astro/native/blob/geometry.js.map +1 -0
- package/dist/astro/native/blob/geometry.ts +1 -0
- package/dist/astro/native/blob/ids.d.ts +7 -0
- package/dist/astro/native/blob/ids.d.ts.map +1 -0
- package/dist/astro/native/blob/ids.js +11 -0
- package/dist/astro/native/blob/ids.js.map +1 -0
- package/dist/astro/native/blob/ids.ts +11 -0
- package/dist/astro/native/blob.css +83 -0
- package/dist/astro/native/button-template.d.ts +31 -0
- package/dist/astro/native/button-template.d.ts.map +1 -0
- package/dist/astro/native/button-template.js +54 -0
- package/dist/astro/native/button-template.js.map +1 -0
- package/dist/astro/native/button-template.ts +92 -0
- package/dist/astro/native/button.d.ts +13 -0
- package/dist/astro/native/button.d.ts.map +1 -0
- package/dist/astro/native/button.js +26 -0
- package/dist/astro/native/button.js.map +1 -0
- package/dist/astro/native/button.ts +26 -0
- package/dist/astro/native/core-block.astro +18 -0
- package/dist/astro/native/core-button-fallback.astro +43 -0
- package/dist/astro/native/core-button.astro +65 -0
- package/dist/astro/native/core-buttons.astro +14 -0
- package/dist/astro/native/core-group.astro +25 -0
- package/dist/astro/native/core-home-link.astro +12 -0
- package/dist/astro/native/core-html.astro +8 -0
- package/dist/astro/native/core-icon.astro +7 -0
- package/dist/astro/native/core-image.astro +139 -0
- package/dist/astro/native/core-navigation-link.astro +71 -0
- package/dist/astro/native/core-navigation-submenu.astro +33 -0
- package/dist/astro/native/core-navigation.astro +101 -0
- package/dist/astro/native/core-page-list-data-item.astro +19 -0
- package/dist/astro/native/core-page-list-item.astro +8 -0
- package/dist/astro/native/core-page-list.astro +40 -0
- package/dist/astro/native/core-post-date.astro +21 -0
- package/dist/astro/native/core-post-excerpt.astro +26 -0
- package/dist/astro/native/core-post-featured-image.astro +38 -0
- package/dist/astro/native/core-post-template-fallback.astro +30 -0
- package/dist/astro/native/core-post-template.astro +23 -0
- package/dist/astro/native/core-post-terms.astro +47 -0
- package/dist/astro/native/core-post-title.astro +23 -0
- package/dist/astro/native/core-query-no-results.astro +12 -0
- package/dist/astro/native/core-query.astro +22 -0
- package/dist/astro/native/core-separator.astro +20 -0
- package/dist/astro/native/core-site-title.astro +16 -0
- package/dist/astro/native/core-term-description.astro +12 -0
- package/dist/astro/native/core-term-name.astro +21 -0
- package/dist/astro/native/core-term-template.astro +30 -0
- package/dist/astro/native/core-terms-query.astro +19 -0
- package/dist/astro/native/core-transparent.astro +11 -0
- package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
- package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
- package/dist/astro/native/flowpress-navigation-controller.js +217 -0
- package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
- package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
- package/dist/astro/native/flowpress-navigation.css +17 -0
- package/dist/astro/native/grid-bleed.d.ts +2 -0
- package/dist/astro/native/grid-bleed.d.ts.map +1 -0
- package/dist/astro/native/grid-bleed.js +123 -0
- package/dist/astro/native/grid-bleed.js.map +1 -0
- package/dist/astro/native/grid.css +180 -0
- package/dist/astro/native/grid.d.ts +17 -0
- package/dist/astro/native/grid.d.ts.map +1 -0
- package/dist/astro/native/grid.js +103 -0
- package/dist/astro/native/grid.js.map +1 -0
- package/dist/astro/native/grid.ts +118 -0
- package/dist/astro/native/group.css +36 -0
- package/dist/astro/native/group.d.ts +15 -0
- package/dist/astro/native/group.d.ts.map +1 -0
- package/dist/astro/native/group.js +66 -0
- package/dist/astro/native/group.js.map +1 -0
- package/dist/astro/native/group.ts +61 -0
- package/dist/astro/native/html.d.ts +6 -0
- package/dist/astro/native/html.d.ts.map +1 -0
- package/dist/astro/native/html.js +10 -0
- package/dist/astro/native/html.js.map +1 -0
- package/dist/astro/native/html.ts +9 -0
- package/dist/astro/native/icon.d.ts +3 -0
- package/dist/astro/native/icon.d.ts.map +1 -0
- package/dist/astro/native/icon.js +23 -0
- package/dist/astro/native/icon.js.map +1 -0
- package/dist/astro/native/icon.ts +21 -0
- package/dist/astro/native/image.d.ts +5 -0
- package/dist/astro/native/image.d.ts.map +1 -0
- package/dist/astro/native/image.js +65 -0
- package/dist/astro/native/image.js.map +1 -0
- package/dist/astro/native/image.ts +56 -0
- package/dist/astro/native/inline-text.css +15 -0
- package/dist/astro/native/map.d.ts +14 -0
- package/dist/astro/native/map.d.ts.map +1 -0
- package/dist/astro/native/map.js +60 -0
- package/dist/astro/native/map.js.map +1 -0
- package/dist/astro/native/map.ts +70 -0
- package/dist/astro/native/motion-preference.d.ts +50 -0
- package/dist/astro/native/motion-preference.d.ts.map +1 -0
- package/dist/astro/native/motion-preference.js +132 -0
- package/dist/astro/native/motion-preference.js.map +1 -0
- package/dist/astro/native/motion-preference.ts +158 -0
- package/dist/astro/native/motion.d.ts +101 -0
- package/dist/astro/native/motion.d.ts.map +1 -0
- package/dist/astro/native/motion.js +168 -0
- package/dist/astro/native/motion.js.map +1 -0
- package/dist/astro/native/motion.ts +312 -0
- package/dist/astro/native/query-carousel.d.ts +12 -0
- package/dist/astro/native/query-carousel.d.ts.map +1 -0
- package/dist/astro/native/query-carousel.js +36 -0
- package/dist/astro/native/query-carousel.js.map +1 -0
- package/dist/astro/native/query-carousel.ts +56 -0
- package/dist/astro/native/query-loop.d.ts +38 -0
- package/dist/astro/native/query-loop.d.ts.map +1 -0
- package/dist/astro/native/query-loop.js +20 -0
- package/dist/astro/native/query-loop.js.map +1 -0
- package/dist/astro/native/query-loop.ts +67 -0
- package/dist/astro/native/registry.d.ts +3 -0
- package/dist/astro/native/registry.d.ts.map +1 -0
- package/dist/astro/native/registry.js +81 -0
- package/dist/astro/native/registry.js.map +1 -0
- package/dist/astro/native/registry.ts +82 -0
- package/dist/astro/native/sf-block-binding.astro +20 -0
- package/dist/astro/native/sf-post-field.astro +9 -0
- package/dist/astro/native/sf-term-field.astro +9 -0
- package/dist/astro/native/timeline.css +4 -0
- package/dist/astro/native/timeline.d.ts +28 -0
- package/dist/astro/native/timeline.d.ts.map +1 -0
- package/dist/astro/native/timeline.js +43 -0
- package/dist/astro/native/timeline.js.map +1 -0
- package/dist/astro/native/timeline.ts +79 -0
- package/dist/astro/preferences/AccessibilityPanel.astro +105 -0
- package/dist/astro/preferences/ColorModeToggle.astro +26 -0
- package/dist/astro/preferences/MotionToggle.astro +27 -0
- package/dist/astro/preferences/PreferencesRuntime.astro +9 -0
- package/dist/astro/preferences/ThemeToggle.astro +30 -0
- package/dist/astro/preferences/Toggle.astro +50 -0
- package/dist/astro/preferences/preferences.css +125 -0
- package/dist/block-renderers.d.ts +23 -3
- package/dist/block-renderers.d.ts.map +1 -1
- package/dist/block-renderers.js.map +1 -1
- package/dist/build-cache.d.ts +8 -0
- package/dist/build-cache.d.ts.map +1 -0
- package/dist/build-cache.js +81 -0
- package/dist/build-cache.js.map +1 -0
- package/dist/client.d.ts +23 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +78 -39
- package/dist/client.js.map +1 -1
- package/dist/composition.d.ts +14 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +125 -0
- package/dist/composition.js.map +1 -0
- package/dist/default-blocks.d.ts +9 -0
- package/dist/default-blocks.d.ts.map +1 -0
- package/dist/default-blocks.js +117 -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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +20 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +106 -0
- package/dist/media.js.map +1 -0
- package/dist/motion-preference.d.ts +50 -0
- package/dist/motion-preference.d.ts.map +1 -0
- package/dist/motion-preference.js +132 -0
- package/dist/motion-preference.js.map +1 -0
- package/dist/preferences-runtime.d.ts +3 -0
- package/dist/preferences-runtime.d.ts.map +1 -0
- package/dist/preferences-runtime.js +23 -0
- package/dist/preferences-runtime.js.map +1 -0
- package/dist/preferences-styleflow.d.ts +3 -0
- package/dist/preferences-styleflow.d.ts.map +1 -0
- package/dist/preferences-styleflow.js +14 -0
- package/dist/preferences-styleflow.js.map +1 -0
- package/dist/preferences.d.ts +4 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +4 -0
- package/dist/preferences.js.map +1 -0
- package/dist/reserved-area.d.ts +10 -0
- package/dist/reserved-area.d.ts.map +1 -0
- package/dist/reserved-area.js +93 -0
- package/dist/reserved-area.js.map +1 -0
- package/dist/styleflow.d.ts +18 -1
- package/dist/styleflow.d.ts.map +1 -1
- package/dist/styleflow.js +82 -11
- package/dist/styleflow.js.map +1 -1
- package/dist/svg-media-runtime.d.ts +3 -0
- package/dist/svg-media-runtime.d.ts.map +1 -0
- package/dist/svg-media-runtime.js +33 -0
- package/dist/svg-media-runtime.js.map +1 -0
- package/dist/svg-media-types.d.ts +11 -0
- package/dist/svg-media-types.d.ts.map +1 -0
- package/dist/svg-media-types.js +2 -0
- package/dist/svg-media-types.js.map +1 -0
- package/dist/svg-media.d.ts +13 -0
- package/dist/svg-media.d.ts.map +1 -0
- package/dist/svg-media.js +47 -0
- package/dist/svg-media.js.map +1 -0
- package/dist/template-hierarchy.d.ts +0 -7
- package/dist/template-hierarchy.d.ts.map +1 -1
- package/dist/template-hierarchy.js +0 -21
- package/dist/template-hierarchy.js.map +1 -1
- 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 +75 -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 +58 -7
- package/dist/astro/DefaultTemplate.astro +0 -42
- package/dist/templates.d.ts +0 -19
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js +0 -20
- package/dist/templates.js.map +0 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
export const SF_REVEAL_SELECTOR = ".sf-reveal:not(.sf-motion-static)";
|
|
2
|
+
|
|
3
|
+
export const SF_REVEAL_CLASS = "sf-reveal";
|
|
4
|
+
|
|
5
|
+
export const SF_MOTION_STATIC_CLASS = "sf-motion-static";
|
|
6
|
+
|
|
7
|
+
export const SF_MOTION_DISABLE_CLASS = "sf-motion-disable";
|
|
8
|
+
|
|
9
|
+
export const SF_MOTION_DRAWER_EXIT_MS = 820;
|
|
10
|
+
|
|
11
|
+
export const SF_REVEAL_VISIBLE_RATIO = 0.2;
|
|
12
|
+
|
|
13
|
+
export const SF_REVEAL_STAGGER_SELECTOR = ".sf-reveal-stagger";
|
|
14
|
+
|
|
15
|
+
export const SF_REVEAL_STAGGER_STEP_MS = 90;
|
|
16
|
+
|
|
17
|
+
export const SF_REVEAL_STAGGER_MAX_MS = 450;
|
|
18
|
+
|
|
19
|
+
const SF_REVEAL_MODIFIER_PATTERN = /^sf-reveal--\S+$/;
|
|
20
|
+
|
|
21
|
+
export type SfRevealModifier = `sf-reveal--${string}`;
|
|
22
|
+
|
|
23
|
+
export type SfDefaultReveal = false | SfRevealModifier;
|
|
24
|
+
|
|
25
|
+
export interface SfRevealRule {
|
|
26
|
+
/** Any selector accepted by `document.querySelectorAll`. */
|
|
27
|
+
selector: string;
|
|
28
|
+
/** Reveal modifier enforced on every matching element. */
|
|
29
|
+
reveal: SfRevealModifier;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SfRevealClassChanges {
|
|
33
|
+
add: string[];
|
|
34
|
+
remove: SfRevealModifier[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SfMotionOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Allows reveal elements already in the initial viewport to animate.
|
|
40
|
+
* Defaults to `false`, so initial content is immediately available.
|
|
41
|
+
*/
|
|
42
|
+
revealAboveFold?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Ordered selector-specific reveal rules. The first matching rule wins and
|
|
45
|
+
* enforces its modifier. Any valid CSS selector may be used.
|
|
46
|
+
*/
|
|
47
|
+
revealRules?: readonly SfRevealRule[];
|
|
48
|
+
/**
|
|
49
|
+
* Preset applied to automatically selected elements. `false` keeps the
|
|
50
|
+
* reveal system strictly opt-in.
|
|
51
|
+
*/
|
|
52
|
+
defaultReveal?: SfDefaultReveal;
|
|
53
|
+
/**
|
|
54
|
+
* Standard CSS selectors. Tags, classes, IDs, attributes and combinations
|
|
55
|
+
* can be mixed in the same array.
|
|
56
|
+
*/
|
|
57
|
+
autoRevealSelectors?: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ResolvedSfMotionOptions {
|
|
61
|
+
autoRevealSelectors: string[];
|
|
62
|
+
defaultReveal: SfDefaultReveal;
|
|
63
|
+
revealAboveFold: boolean;
|
|
64
|
+
revealRules: SfRevealRule[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type SfRevealState = "pending" | "visible" | "settled";
|
|
68
|
+
|
|
69
|
+
export interface InitialRevealStateInput {
|
|
70
|
+
bottom: number;
|
|
71
|
+
containsHashTarget: boolean;
|
|
72
|
+
protectedContent: boolean;
|
|
73
|
+
reducedMotion: boolean;
|
|
74
|
+
revealAboveFold: boolean;
|
|
75
|
+
top: number;
|
|
76
|
+
viewportHeight: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface RevealVisibilityInput {
|
|
80
|
+
bottom: number;
|
|
81
|
+
height: number;
|
|
82
|
+
top: number;
|
|
83
|
+
viewportHeight: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function isSfRevealModifier(value: unknown): value is SfRevealModifier {
|
|
87
|
+
return typeof value === "string" && SF_REVEAL_MODIFIER_PATTERN.test(value);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function normalizeSelectors(value: unknown): string[] {
|
|
91
|
+
if (!Array.isArray(value)) return [];
|
|
92
|
+
|
|
93
|
+
return Array.from(
|
|
94
|
+
new Set(
|
|
95
|
+
value
|
|
96
|
+
.filter((selector): selector is string => typeof selector === "string")
|
|
97
|
+
.map((selector) => selector.trim())
|
|
98
|
+
.filter(Boolean),
|
|
99
|
+
),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function normalizeRevealRules(value: unknown): SfRevealRule[] {
|
|
104
|
+
if (!Array.isArray(value)) return [];
|
|
105
|
+
|
|
106
|
+
const seenSelectors = new Set<string>();
|
|
107
|
+
return value.flatMap((rule: unknown) => {
|
|
108
|
+
if (!rule || typeof rule !== "object") return [];
|
|
109
|
+
|
|
110
|
+
const candidate = rule as Partial<SfRevealRule>;
|
|
111
|
+
const selector =
|
|
112
|
+
typeof candidate.selector === "string" ? candidate.selector.trim() : "";
|
|
113
|
+
if (
|
|
114
|
+
!selector ||
|
|
115
|
+
seenSelectors.has(selector) ||
|
|
116
|
+
!isSfRevealModifier(candidate.reveal)
|
|
117
|
+
) {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
seenSelectors.add(selector);
|
|
122
|
+
return [{ selector, reveal: candidate.reveal }];
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Normalizes server- or client-provided configuration. Invalid values fail
|
|
128
|
+
* open by disabling automatic reveals; empty and duplicate selectors are
|
|
129
|
+
* removed without changing their order.
|
|
130
|
+
*/
|
|
131
|
+
export function resolveSfMotionOptions(
|
|
132
|
+
options: SfMotionOptions = {},
|
|
133
|
+
): ResolvedSfMotionOptions {
|
|
134
|
+
const defaultReveal = isSfRevealModifier(options.defaultReveal)
|
|
135
|
+
? options.defaultReveal
|
|
136
|
+
: false;
|
|
137
|
+
return {
|
|
138
|
+
autoRevealSelectors: normalizeSelectors(options.autoRevealSelectors),
|
|
139
|
+
defaultReveal,
|
|
140
|
+
revealAboveFold: options.revealAboveFold === true,
|
|
141
|
+
revealRules: normalizeRevealRules(options.revealRules),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Exact class mutation required by an authoritative selector rule. */
|
|
146
|
+
export function ruleRevealClassChanges(
|
|
147
|
+
existingClasses: Iterable<string>,
|
|
148
|
+
reveal: SfRevealModifier,
|
|
149
|
+
): SfRevealClassChanges {
|
|
150
|
+
const classes = Array.from(existingClasses);
|
|
151
|
+
if (
|
|
152
|
+
classes.includes(SF_MOTION_STATIC_CLASS) ||
|
|
153
|
+
classes.includes(SF_MOTION_DISABLE_CLASS)
|
|
154
|
+
) {
|
|
155
|
+
return { add: [], remove: [] };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
add: [
|
|
160
|
+
...(classes.includes(SF_REVEAL_CLASS) ? [] : [SF_REVEAL_CLASS]),
|
|
161
|
+
...(classes.includes(reveal) ? [] : [reveal]),
|
|
162
|
+
],
|
|
163
|
+
remove: classes
|
|
164
|
+
.filter(isSfRevealModifier)
|
|
165
|
+
.filter((modifier) => modifier !== reveal),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Delay for a zero-based participant index in a reveal stagger group. */
|
|
170
|
+
export function staggerRevealDelayMs(index: number): number {
|
|
171
|
+
if (!Number.isFinite(index) || index <= 0) return 0;
|
|
172
|
+
return Math.min(
|
|
173
|
+
Math.floor(index) * SF_REVEAL_STAGGER_STEP_MS,
|
|
174
|
+
SF_REVEAL_STAGGER_MAX_MS,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Returns only the classes that automatic inheritance must add. Explicit
|
|
180
|
+
* modifiers win over the configured default and `sf-motion-static` remains a
|
|
181
|
+
* complete opt-out.
|
|
182
|
+
*/
|
|
183
|
+
export function automaticRevealClasses(
|
|
184
|
+
existingClasses: Iterable<string>,
|
|
185
|
+
defaultReveal: SfDefaultReveal,
|
|
186
|
+
): string[] {
|
|
187
|
+
if (defaultReveal === false) return [];
|
|
188
|
+
|
|
189
|
+
const classes = Array.from(existingClasses);
|
|
190
|
+
if (
|
|
191
|
+
classes.includes(SF_MOTION_STATIC_CLASS) ||
|
|
192
|
+
classes.includes(SF_MOTION_DISABLE_CLASS)
|
|
193
|
+
) {
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return [
|
|
198
|
+
...(classes.includes(SF_REVEAL_CLASS) ? [] : [SF_REVEAL_CLASS]),
|
|
199
|
+
...(classes.some(isSfRevealModifier) ? [] : [defaultReveal]),
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function cssTimeToMs(value: string): number {
|
|
204
|
+
const normalized = value.trim();
|
|
205
|
+
const amount = Number.parseFloat(normalized);
|
|
206
|
+
if (!Number.isFinite(amount)) return 0;
|
|
207
|
+
|
|
208
|
+
return normalized.endsWith("ms") ? amount : amount * 1000;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Returns the longest combined CSS transition duration and delay. */
|
|
212
|
+
export function maximumTransitionTimeMs(
|
|
213
|
+
transitionDuration: string,
|
|
214
|
+
transitionDelay: string,
|
|
215
|
+
): number {
|
|
216
|
+
const durations = transitionDuration.split(",").map(cssTimeToMs);
|
|
217
|
+
const delays = transitionDelay.split(",").map(cssTimeToMs);
|
|
218
|
+
const itemCount = Math.max(durations.length, delays.length);
|
|
219
|
+
|
|
220
|
+
return Array.from({ length: itemCount }, (_, index) => {
|
|
221
|
+
const duration = durations[index % durations.length] ?? 0;
|
|
222
|
+
const delay = delays[index % delays.length] ?? 0;
|
|
223
|
+
return Math.max(0, duration + delay);
|
|
224
|
+
}).reduce((maximum, value) => Math.max(maximum, value), 0);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Initial viewport content stays static unless the project explicitly enables
|
|
229
|
+
* above-the-fold reveals. Deep links and protected content remain visible.
|
|
230
|
+
*/
|
|
231
|
+
export function initialRevealState({
|
|
232
|
+
bottom,
|
|
233
|
+
containsHashTarget,
|
|
234
|
+
protectedContent,
|
|
235
|
+
reducedMotion,
|
|
236
|
+
revealAboveFold,
|
|
237
|
+
top,
|
|
238
|
+
viewportHeight,
|
|
239
|
+
}: InitialRevealStateInput): SfRevealState {
|
|
240
|
+
if (
|
|
241
|
+
reducedMotion ||
|
|
242
|
+
containsHashTarget ||
|
|
243
|
+
protectedContent
|
|
244
|
+
) {
|
|
245
|
+
return "visible";
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// DMO: content that only peeks into the initial viewport (less than the
|
|
249
|
+
// reveal share of its height) waits for the scroll instead of appearing
|
|
250
|
+
// statically; content already scrolled past the top stays visible.
|
|
251
|
+
if (
|
|
252
|
+
!revealAboveFold &&
|
|
253
|
+
bottom > 0 &&
|
|
254
|
+
top < viewportHeight &&
|
|
255
|
+
(top < 0 ||
|
|
256
|
+
hasEnoughVisibleArea({
|
|
257
|
+
bottom,
|
|
258
|
+
height: Math.max(0, bottom - top),
|
|
259
|
+
top,
|
|
260
|
+
viewportHeight,
|
|
261
|
+
}))
|
|
262
|
+
) {
|
|
263
|
+
return "visible";
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return "pending";
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Reveal ordinary content once 20% of its perceivable height is visible.
|
|
271
|
+
* For elements taller than the viewport, the viewport height is the reference.
|
|
272
|
+
*/
|
|
273
|
+
export function hasEnoughVisibleArea({
|
|
274
|
+
bottom,
|
|
275
|
+
height,
|
|
276
|
+
top,
|
|
277
|
+
viewportHeight,
|
|
278
|
+
}: RevealVisibilityInput): boolean {
|
|
279
|
+
if (height <= 0 || viewportHeight <= 0) return true;
|
|
280
|
+
|
|
281
|
+
const visibleHeight = Math.max(
|
|
282
|
+
0,
|
|
283
|
+
Math.min(bottom, viewportHeight) - Math.max(top, 0),
|
|
284
|
+
);
|
|
285
|
+
const requiredHeight =
|
|
286
|
+
Math.min(height, viewportHeight) * SF_REVEAL_VISIBLE_RATIO;
|
|
287
|
+
|
|
288
|
+
return visibleHeight + 1 >= requiredHeight;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Reveal is deliberately one-way: focus and viewport entry can complete it,
|
|
293
|
+
* while leaving the viewport never conceals content again.
|
|
294
|
+
*/
|
|
295
|
+
export function nextRevealState(
|
|
296
|
+
current: SfRevealState,
|
|
297
|
+
event: "focus" | "intersect" | "leave",
|
|
298
|
+
): SfRevealState {
|
|
299
|
+
if (current === "settled") return "settled";
|
|
300
|
+
|
|
301
|
+
if (current === "visible" || event === "focus" || event === "intersect") {
|
|
302
|
+
return "visible";
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return "pending";
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export function shouldInitializeMotion(
|
|
309
|
+
initialized: string | undefined,
|
|
310
|
+
): boolean {
|
|
311
|
+
return initialized !== "true";
|
|
312
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlowpressBlock, FlowpressBlockRendererProps } from "../../index.js";
|
|
2
|
+
import type { LoopTemplateData } from "./query-loop.js";
|
|
3
|
+
type SfCarouselAttributes = Record<string, any>;
|
|
4
|
+
export type QueryCarouselSettings = Pick<SfCarouselAttributes, "ariaLabel" | "itemsPerViewBase" | "itemsPerViewSm" | "itemsPerViewMd" | "itemsPerViewLg" | "itemsPerViewXl" | "itemsPerView2xl" | "itemsPerMove" | "gap" | "showArrows" | "showPagination" | "drag" | "keyboard" | "autoplay" | "autoplayInterval" | "pauseOnHover" | "pauseOnFocus" | "loop" | "speed"> & {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface QueryCarouselData extends LoopTemplateData {
|
|
8
|
+
sfQueryCarousel?: QueryCarouselSettings;
|
|
9
|
+
}
|
|
10
|
+
export declare function queryCarouselBlocks(props: Pick<FlowpressBlockRendererProps, "block" | "htmlProps" | "styleflowProps">): FlowpressBlock[] | undefined;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=query-carousel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-carousel.d.ts","sourceRoot":"","sources":["../../../src/astro/native/query-carousel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,KAAK,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAC3D,WAAW,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,gBAAgB,GACtE,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,cAAc,GACxE,KAAK,GAAG,YAAY,GAAG,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAC1E,kBAAkB,GAAG,cAAc,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CACxE,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAUD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,2BAA2B,EACzE,OAAO,GAAG,WAAW,GAAG,gBAAgB,CACzC,GAAG,cAAc,EAAE,GAAG,SAAS,CA6B/B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const classNames = (...values) => [...new Set(values.flatMap((value) => String(value ?? "").split(/\s+/)).filter(Boolean))].join(" ");
|
|
2
|
+
// Remove this template's former grid decorations, retaining its placement in
|
|
3
|
+
// a parent grid. Saved content and resolved card blocks are never mutated.
|
|
4
|
+
const withoutOwnGridClasses = (value) => String(value ?? "").split(/\s+/)
|
|
5
|
+
.filter((token) => !/^(?:fp-grid$|fp-cols-|fp-align-|is-layout-grid$|columns-\d+$)/.test(token)).join(" ");
|
|
6
|
+
export function queryCarouselBlocks(props) {
|
|
7
|
+
const { block, htmlProps, styleflowProps } = props;
|
|
8
|
+
const data = (block.resolvedData ?? {});
|
|
9
|
+
if (data.sfQueryCarousel?.enabled !== true)
|
|
10
|
+
return undefined;
|
|
11
|
+
const items = data.items ?? [];
|
|
12
|
+
if (items.length === 0)
|
|
13
|
+
return [];
|
|
14
|
+
const { layout: _layout, style: _style, metadata: _metadata, ...attributes } = block.attributes;
|
|
15
|
+
const { enabled: _enabled, ...settings } = data.sfQueryCarousel;
|
|
16
|
+
return [{
|
|
17
|
+
name: "sf/carousel",
|
|
18
|
+
attributes: {
|
|
19
|
+
...attributes, ...styleflowProps, ...settings,
|
|
20
|
+
// The official carousel renderer derives props from these attributes.
|
|
21
|
+
...((htmlProps.id ?? attributes.anchor) ? { anchor: String(htmlProps.id ?? attributes.anchor) } : {}),
|
|
22
|
+
className: classNames("flowpress-query-carousel", withoutOwnGridClasses(attributes.className), withoutOwnGridClasses(htmlProps.class)),
|
|
23
|
+
...(attributes.noGap === true ? { gap: 0 } : {}),
|
|
24
|
+
},
|
|
25
|
+
resolvedData: {},
|
|
26
|
+
innerHtml: "",
|
|
27
|
+
innerBlocks: items.map((item) => ({
|
|
28
|
+
name: "sf/carousel-item",
|
|
29
|
+
attributes: { className: classNames("wp-block-post", `post-${item.id}`, item.postType ? `type-${item.postType}` : "") },
|
|
30
|
+
resolvedData: {},
|
|
31
|
+
innerHtml: "",
|
|
32
|
+
innerBlocks: item.blocks,
|
|
33
|
+
})),
|
|
34
|
+
}];
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=query-carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-carousel.js","sourceRoot":"","sources":["../../../src/astro/native/query-carousel.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,GAAG,CAAC,GAAG,MAAiB,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAChF,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEhE,6EAA6E;AAC7E,2EAA2E;AAC3E,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;KAC/E,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,+DAA+D,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7G,MAAM,UAAU,mBAAmB,CAAC,KAEnC;IACC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAsB,CAAC;IAC7D,IAAI,IAAI,CAAC,eAAe,EAAE,OAAO,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC;IAChG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;IAChE,OAAO,CAAC;YACN,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE;gBACV,GAAG,UAAU,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ;gBAC7C,sEAAsE;gBACtE,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnG,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,EAC3F,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACzC,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACjD;YACD,YAAY,EAAE,EAAE;YAChB,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,IAAI,EAAE,kBAAkB;gBACxB,UAAU,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,QAAQ,IAAI,CAAC,EAAE,EAAE,EACpE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;gBACjD,YAAY,EAAE,EAAE;gBAChB,SAAS,EAAE,EAAE;gBACb,WAAW,EAAE,IAAI,CAAC,MAAM;aACzB,CAAC,CAAC;SACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["// PILOT — Render-only adaptation of native Query Loop results. No new query.\nimport type { FlowpressBlock, FlowpressBlockRendererProps } from \"../../index.js\";\nimport type { LoopTemplateData } from \"./query-loop.js\";\ntype SfCarouselAttributes = Record<string, any>;\n\nexport type QueryCarouselSettings = Pick<SfCarouselAttributes,\n \"ariaLabel\" | \"itemsPerViewBase\" | \"itemsPerViewSm\" | \"itemsPerViewMd\" |\n \"itemsPerViewLg\" | \"itemsPerViewXl\" | \"itemsPerView2xl\" | \"itemsPerMove\" |\n \"gap\" | \"showArrows\" | \"showPagination\" | \"drag\" | \"keyboard\" | \"autoplay\" |\n \"autoplayInterval\" | \"pauseOnHover\" | \"pauseOnFocus\" | \"loop\" | \"speed\"\n> & { enabled: boolean };\n\nexport interface QueryCarouselData extends LoopTemplateData {\n sfQueryCarousel?: QueryCarouselSettings;\n}\n\nconst classNames = (...values: unknown[]) => [...new Set(values.flatMap((value) =>\n String(value ?? \"\").split(/\\s+/)).filter(Boolean))].join(\" \");\n\n// Remove this template's former grid decorations, retaining its placement in\n// a parent grid. Saved content and resolved card blocks are never mutated.\nconst withoutOwnGridClasses = (value: unknown) => String(value ?? \"\").split(/\\s+/)\n .filter((token) => !/^(?:fp-grid$|fp-cols-|fp-align-|is-layout-grid$|columns-\\d+$)/.test(token)).join(\" \");\n\nexport function queryCarouselBlocks(props: Pick<FlowpressBlockRendererProps,\n \"block\" | \"htmlProps\" | \"styleflowProps\"\n>): FlowpressBlock[] | undefined {\n const { block, htmlProps, styleflowProps } = props;\n const data = (block.resolvedData ?? {}) as QueryCarouselData;\n if (data.sfQueryCarousel?.enabled !== true) return undefined;\n const items = data.items ?? [];\n if (items.length === 0) return [];\n const { layout: _layout, style: _style, metadata: _metadata, ...attributes } = block.attributes;\n const { enabled: _enabled, ...settings } = data.sfQueryCarousel;\n return [{\n name: \"sf/carousel\",\n attributes: {\n ...attributes, ...styleflowProps, ...settings,\n // The official carousel renderer derives props from these attributes.\n ...((htmlProps.id ?? attributes.anchor) ? {anchor: String(htmlProps.id ?? attributes.anchor)} : {}),\n className: classNames(\"flowpress-query-carousel\", withoutOwnGridClasses(attributes.className),\n withoutOwnGridClasses(htmlProps.class)),\n ...(attributes.noGap === true ? { gap: 0 } : {}),\n },\n resolvedData: {},\n innerHtml: \"\",\n innerBlocks: items.map((item) => ({\n name: \"sf/carousel-item\",\n attributes: { className: classNames(\"wp-block-post\", `post-${item.id}`,\n item.postType ? `type-${item.postType}` : \"\") },\n resolvedData: {},\n innerHtml: \"\",\n innerBlocks: item.blocks,\n })),\n }];\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// PILOT — Render-only adaptation of native Query Loop results. No new query.
|
|
2
|
+
import type { FlowpressBlock, FlowpressBlockRendererProps } from "../../index.js";
|
|
3
|
+
import type { LoopTemplateData } from "./query-loop.js";
|
|
4
|
+
type SfCarouselAttributes = Record<string, any>;
|
|
5
|
+
|
|
6
|
+
export type QueryCarouselSettings = Pick<SfCarouselAttributes,
|
|
7
|
+
"ariaLabel" | "itemsPerViewBase" | "itemsPerViewSm" | "itemsPerViewMd" |
|
|
8
|
+
"itemsPerViewLg" | "itemsPerViewXl" | "itemsPerView2xl" | "itemsPerMove" |
|
|
9
|
+
"gap" | "showArrows" | "showPagination" | "drag" | "keyboard" | "autoplay" |
|
|
10
|
+
"autoplayInterval" | "pauseOnHover" | "pauseOnFocus" | "loop" | "speed"
|
|
11
|
+
> & { enabled: boolean };
|
|
12
|
+
|
|
13
|
+
export interface QueryCarouselData extends LoopTemplateData {
|
|
14
|
+
sfQueryCarousel?: QueryCarouselSettings;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const classNames = (...values: unknown[]) => [...new Set(values.flatMap((value) =>
|
|
18
|
+
String(value ?? "").split(/\s+/)).filter(Boolean))].join(" ");
|
|
19
|
+
|
|
20
|
+
// Remove this template's former grid decorations, retaining its placement in
|
|
21
|
+
// a parent grid. Saved content and resolved card blocks are never mutated.
|
|
22
|
+
const withoutOwnGridClasses = (value: unknown) => String(value ?? "").split(/\s+/)
|
|
23
|
+
.filter((token) => !/^(?:fp-grid$|fp-cols-|fp-align-|is-layout-grid$|columns-\d+$)/.test(token)).join(" ");
|
|
24
|
+
|
|
25
|
+
export function queryCarouselBlocks(props: Pick<FlowpressBlockRendererProps,
|
|
26
|
+
"block" | "htmlProps" | "styleflowProps"
|
|
27
|
+
>): FlowpressBlock[] | undefined {
|
|
28
|
+
const { block, htmlProps, styleflowProps } = props;
|
|
29
|
+
const data = (block.resolvedData ?? {}) as QueryCarouselData;
|
|
30
|
+
if (data.sfQueryCarousel?.enabled !== true) return undefined;
|
|
31
|
+
const items = data.items ?? [];
|
|
32
|
+
if (items.length === 0) return [];
|
|
33
|
+
const { layout: _layout, style: _style, metadata: _metadata, ...attributes } = block.attributes;
|
|
34
|
+
const { enabled: _enabled, ...settings } = data.sfQueryCarousel;
|
|
35
|
+
return [{
|
|
36
|
+
name: "sf/carousel",
|
|
37
|
+
attributes: {
|
|
38
|
+
...attributes, ...styleflowProps, ...settings,
|
|
39
|
+
// The official carousel renderer derives props from these attributes.
|
|
40
|
+
...((htmlProps.id ?? attributes.anchor) ? {anchor: String(htmlProps.id ?? attributes.anchor)} : {}),
|
|
41
|
+
className: classNames("flowpress-query-carousel", withoutOwnGridClasses(attributes.className),
|
|
42
|
+
withoutOwnGridClasses(htmlProps.class)),
|
|
43
|
+
...(attributes.noGap === true ? { gap: 0 } : {}),
|
|
44
|
+
},
|
|
45
|
+
resolvedData: {},
|
|
46
|
+
innerHtml: "",
|
|
47
|
+
innerBlocks: items.map((item) => ({
|
|
48
|
+
name: "sf/carousel-item",
|
|
49
|
+
attributes: { className: classNames("wp-block-post", `post-${item.id}`,
|
|
50
|
+
item.postType ? `type-${item.postType}` : "") },
|
|
51
|
+
resolvedData: {},
|
|
52
|
+
innerHtml: "",
|
|
53
|
+
innerBlocks: item.blocks,
|
|
54
|
+
})),
|
|
55
|
+
}];
|
|
56
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FlowpressBlock, FlowpressBlockTypeDescriptor, FlowpressCompositionDiagnostic, FlowpressCompositionStylesheet } from "../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* resolvedData shapes of the project Query Loop pilot
|
|
4
|
+
* (apps/cms/project/src/query-loop.php and custom-fields.php).
|
|
5
|
+
*/
|
|
6
|
+
export interface NestedPass {
|
|
7
|
+
blockTypes?: FlowpressBlockTypeDescriptor[];
|
|
8
|
+
stylesheets?: FlowpressCompositionStylesheet[];
|
|
9
|
+
diagnostics?: FlowpressCompositionDiagnostic[];
|
|
10
|
+
}
|
|
11
|
+
export interface LoopData extends NestedPass {
|
|
12
|
+
blocks?: FlowpressBlock[];
|
|
13
|
+
}
|
|
14
|
+
export interface LoopItem {
|
|
15
|
+
id: number;
|
|
16
|
+
postType?: string;
|
|
17
|
+
taxonomy?: string;
|
|
18
|
+
blocks: FlowpressBlock[];
|
|
19
|
+
}
|
|
20
|
+
export interface LoopTemplateData extends NestedPass {
|
|
21
|
+
items?: LoopItem[];
|
|
22
|
+
}
|
|
23
|
+
export interface ResolvedImage {
|
|
24
|
+
id?: number;
|
|
25
|
+
url?: string;
|
|
26
|
+
alt?: string;
|
|
27
|
+
width?: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
srcSet?: string;
|
|
30
|
+
sizes?: string;
|
|
31
|
+
sizeSlug?: string;
|
|
32
|
+
href?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function classNames(...values: unknown[]): string | undefined;
|
|
35
|
+
export declare function text(value: unknown): string;
|
|
36
|
+
export declare function headingLevel(value: unknown, fallback?: number): number;
|
|
37
|
+
export declare function externalRel(target: unknown, rel?: unknown): string | undefined;
|
|
38
|
+
//# sourceMappingURL=query-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-loop.d.ts","sourceRoot":"","sources":["../../../src/astro/native/query-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,4BAA4B,EAAE,CAAC;IAC5C,WAAW,CAAC,EAAE,8BAA8B,EAAE,CAAC;IAC/C,WAAW,CAAC,EAAE,8BAA8B,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,SAAS,CAOnE;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE3C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAI,GAAG,MAAM,CAGjE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function classNames(...values) {
|
|
2
|
+
const className = [...new Set(values
|
|
3
|
+
.flatMap((value) => String(value ?? "").split(/\s+/))
|
|
4
|
+
.filter(Boolean))].join(" ");
|
|
5
|
+
return className || undefined;
|
|
6
|
+
}
|
|
7
|
+
export function text(value) {
|
|
8
|
+
return typeof value === "string" ? value : typeof value === "number" ? String(value) : "";
|
|
9
|
+
}
|
|
10
|
+
export function headingLevel(value, fallback = 2) {
|
|
11
|
+
const level = Number(value);
|
|
12
|
+
return Number.isInteger(level) && level >= 0 && level <= 6 ? level : fallback;
|
|
13
|
+
}
|
|
14
|
+
export function externalRel(target, rel) {
|
|
15
|
+
const tokens = text(rel).split(/\s+/).filter(Boolean);
|
|
16
|
+
if (target === "_blank")
|
|
17
|
+
tokens.push("noopener", "noreferrer");
|
|
18
|
+
return tokens.length > 0 ? [...new Set(tokens)].join(" ") : undefined;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=query-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-loop.js","sourceRoot":"","sources":["../../../src/astro/native/query-loop.ts"],"names":[],"mappings":"AA4CA,MAAM,UAAU,UAAU,CAAC,GAAG,MAAiB;IAC7C,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAC3B,MAAM;aACH,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;aACpD,MAAM,CAAC,OAAO,CAAC,CACnB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,SAAS,IAAI,SAAS,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,GAAa;IACxD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,MAAM,KAAK,QAAQ;QAAE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC","sourcesContent":["import type {\n FlowpressBlock,\n FlowpressBlockTypeDescriptor,\n FlowpressCompositionDiagnostic,\n FlowpressCompositionStylesheet,\n} from \"../../index.js\";\n\n/**\n * resolvedData shapes of the project Query Loop pilot\n * (apps/cms/project/src/query-loop.php and custom-fields.php).\n */\nexport interface NestedPass {\n blockTypes?: FlowpressBlockTypeDescriptor[];\n stylesheets?: FlowpressCompositionStylesheet[];\n diagnostics?: FlowpressCompositionDiagnostic[];\n}\n\nexport interface LoopData extends NestedPass {\n blocks?: FlowpressBlock[];\n}\n\nexport interface LoopItem {\n id: number;\n postType?: string;\n taxonomy?: string;\n blocks: FlowpressBlock[];\n}\n\nexport interface LoopTemplateData extends NestedPass {\n items?: LoopItem[];\n}\n\nexport interface ResolvedImage {\n id?: number;\n url?: string;\n alt?: string;\n width?: number;\n height?: number;\n srcSet?: string;\n sizes?: string;\n sizeSlug?: string;\n href?: string;\n}\n\nexport function classNames(...values: unknown[]): string | undefined {\n const className = [...new Set(\n values\n .flatMap((value) => String(value ?? \"\").split(/\\s+/))\n .filter(Boolean),\n )].join(\" \");\n return className || undefined;\n}\n\nexport function text(value: unknown): string {\n return typeof value === \"string\" ? value : typeof value === \"number\" ? String(value) : \"\";\n}\n\nexport function headingLevel(value: unknown, fallback = 2): number {\n const level = Number(value);\n return Number.isInteger(level) && level >= 0 && level <= 6 ? level : fallback;\n}\n\nexport function externalRel(target: unknown, rel?: unknown): string | undefined {\n const tokens = text(rel).split(/\\s+/).filter(Boolean);\n if (target === \"_blank\") tokens.push(\"noopener\", \"noreferrer\");\n return tokens.length > 0 ? [...new Set(tokens)].join(\" \") : undefined;\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FlowpressBlock,
|
|
3
|
+
FlowpressBlockTypeDescriptor,
|
|
4
|
+
FlowpressCompositionDiagnostic,
|
|
5
|
+
FlowpressCompositionStylesheet,
|
|
6
|
+
} from "../../index.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* resolvedData shapes of the project Query Loop pilot
|
|
10
|
+
* (apps/cms/project/src/query-loop.php and custom-fields.php).
|
|
11
|
+
*/
|
|
12
|
+
export interface NestedPass {
|
|
13
|
+
blockTypes?: FlowpressBlockTypeDescriptor[];
|
|
14
|
+
stylesheets?: FlowpressCompositionStylesheet[];
|
|
15
|
+
diagnostics?: FlowpressCompositionDiagnostic[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LoopData extends NestedPass {
|
|
19
|
+
blocks?: FlowpressBlock[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface LoopItem {
|
|
23
|
+
id: number;
|
|
24
|
+
postType?: string;
|
|
25
|
+
taxonomy?: string;
|
|
26
|
+
blocks: FlowpressBlock[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface LoopTemplateData extends NestedPass {
|
|
30
|
+
items?: LoopItem[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ResolvedImage {
|
|
34
|
+
id?: number;
|
|
35
|
+
url?: string;
|
|
36
|
+
alt?: string;
|
|
37
|
+
width?: number;
|
|
38
|
+
height?: number;
|
|
39
|
+
srcSet?: string;
|
|
40
|
+
sizes?: string;
|
|
41
|
+
sizeSlug?: string;
|
|
42
|
+
href?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function classNames(...values: unknown[]): string | undefined {
|
|
46
|
+
const className = [...new Set(
|
|
47
|
+
values
|
|
48
|
+
.flatMap((value) => String(value ?? "").split(/\s+/))
|
|
49
|
+
.filter(Boolean),
|
|
50
|
+
)].join(" ");
|
|
51
|
+
return className || undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function text(value: unknown): string {
|
|
55
|
+
return typeof value === "string" ? value : typeof value === "number" ? String(value) : "";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function headingLevel(value: unknown, fallback = 2): number {
|
|
59
|
+
const level = Number(value);
|
|
60
|
+
return Number.isInteger(level) && level >= 0 && level <= 6 ? level : fallback;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function externalRel(target: unknown, rel?: unknown): string | undefined {
|
|
64
|
+
const tokens = text(rel).split(/\s+/).filter(Boolean);
|
|
65
|
+
if (target === "_blank") tokens.push("noopener", "noreferrer");
|
|
66
|
+
return tokens.length > 0 ? [...new Set(tokens)].join(" ") : undefined;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/astro/native/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAwCxE,eAAO,MAAM,oBAAoB,EAAE,uBAyClC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import Renderer0 from "./core-term-name.astro";
|
|
2
|
+
import Renderer2 from "./core-post-terms.astro";
|
|
3
|
+
import Renderer3 from "./core-button.astro";
|
|
4
|
+
import Renderer4 from "./core-post-date.astro";
|
|
5
|
+
import Renderer5 from "./core-icon.astro";
|
|
6
|
+
import Renderer6 from "./core-post-excerpt.astro";
|
|
7
|
+
import Renderer7 from "./core-term-description.astro";
|
|
8
|
+
import Renderer8 from "./core-post-template.astro";
|
|
9
|
+
import Renderer9 from "./core-group.astro";
|
|
10
|
+
import Renderer10 from "./core-html.astro";
|
|
11
|
+
import Renderer11 from "./core-block.astro";
|
|
12
|
+
import Renderer12 from "./core-site-title.astro";
|
|
13
|
+
import Renderer13 from "./core-post-featured-image.astro";
|
|
14
|
+
import Renderer14 from "./core-page-list.astro";
|
|
15
|
+
import Renderer15 from "./core-terms-query.astro";
|
|
16
|
+
import Renderer16 from "./core-buttons.astro";
|
|
17
|
+
import Renderer17 from "./core-image.astro";
|
|
18
|
+
import Renderer18 from "./core-query-no-results.astro";
|
|
19
|
+
import Renderer19 from "./core-term-template.astro";
|
|
20
|
+
import Renderer20 from "./core-navigation.astro";
|
|
21
|
+
import Renderer21 from "./core-navigation-submenu.astro";
|
|
22
|
+
import Renderer22 from "./core-query.astro";
|
|
23
|
+
import Renderer23 from "./core-home-link.astro";
|
|
24
|
+
import Renderer24 from "./core-page-list-item.astro";
|
|
25
|
+
import Renderer25 from "./core-navigation-link.astro";
|
|
26
|
+
import Renderer26 from "./core-post-title.astro";
|
|
27
|
+
import Renderer27 from "./sf-post-field.astro";
|
|
28
|
+
import Renderer28 from "./sf-block-binding.astro";
|
|
29
|
+
import Renderer29 from "./sf-term-field.astro";
|
|
30
|
+
import Renderer30 from "./MapBlock.astro";
|
|
31
|
+
import Renderer31 from "./ProjectTimelineBlock.astro";
|
|
32
|
+
import TimelineCardBlock from "./TimelineCardBlock.astro";
|
|
33
|
+
import BlobBlock from "./BlobBlock.astro";
|
|
34
|
+
import TransparentBlock from "./core-transparent.astro";
|
|
35
|
+
import SeparatorBlock from "./core-separator.astro";
|
|
36
|
+
import SiteLogoBlock from "../blocks/SiteLogoBlock.astro";
|
|
37
|
+
import ThemeToggleBlock from "../blocks/ThemeToggleBlock.astro";
|
|
38
|
+
import ReservedLogin from "./ReservedLogin.astro";
|
|
39
|
+
export const nativeBlockRenderers = {
|
|
40
|
+
"core/separator": SeparatorBlock,
|
|
41
|
+
"core/post-content": TransparentBlock,
|
|
42
|
+
"core/template-part": TransparentBlock,
|
|
43
|
+
"core/site-logo": SiteLogoBlock,
|
|
44
|
+
"sf/theme-toggle": ThemeToggleBlock,
|
|
45
|
+
"core/term-name": Renderer0,
|
|
46
|
+
"core/post-terms": Renderer2,
|
|
47
|
+
"core/button": Renderer3,
|
|
48
|
+
"core/post-date": Renderer4,
|
|
49
|
+
"core/icon": Renderer5,
|
|
50
|
+
"core/post-excerpt": Renderer6,
|
|
51
|
+
"core/term-description": Renderer7,
|
|
52
|
+
"core/post-template": Renderer8,
|
|
53
|
+
"core/group": Renderer9,
|
|
54
|
+
"core/html": Renderer10,
|
|
55
|
+
"core/block": Renderer11,
|
|
56
|
+
"core/site-title": Renderer12,
|
|
57
|
+
"core/post-featured-image": Renderer13,
|
|
58
|
+
"core/page-list": Renderer14,
|
|
59
|
+
"core/terms-query": Renderer15,
|
|
60
|
+
"core/buttons": Renderer16,
|
|
61
|
+
"core/image": Renderer17,
|
|
62
|
+
"flowpress/login": ReservedLogin,
|
|
63
|
+
"flowpress/reserved-pagination": ReservedLogin,
|
|
64
|
+
"core/query-no-results": Renderer18,
|
|
65
|
+
"core/term-template": Renderer19,
|
|
66
|
+
"core/navigation": Renderer20,
|
|
67
|
+
"core/navigation-submenu": Renderer21,
|
|
68
|
+
"core/query": Renderer22,
|
|
69
|
+
"core/home-link": Renderer23,
|
|
70
|
+
"core/page-list-item": Renderer24,
|
|
71
|
+
"core/navigation-link": Renderer25,
|
|
72
|
+
"core/post-title": Renderer26,
|
|
73
|
+
"sf/post-field": Renderer27,
|
|
74
|
+
"sf/block-binding": Renderer28,
|
|
75
|
+
"sf/term-field": Renderer29,
|
|
76
|
+
"sf/blob": BlobBlock,
|
|
77
|
+
"sf/map": Renderer30,
|
|
78
|
+
"sf/timeline": Renderer31,
|
|
79
|
+
"sf/timeline-card": TimelineCardBlock,
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=registry.js.map
|