@styleflow.app/flowpress-astro-core 1.0.0-beta.2 → 1.0.0-beta.21

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.
Files changed (205) hide show
  1. package/CHANGELOG.md +151 -1
  2. package/README.md +111 -3
  3. package/dist/astro/BaseLayout.astro +10 -6
  4. package/dist/astro/CompositionRenderer.astro +157 -0
  5. package/dist/astro/DefaultBlockAdapter.astro +35 -0
  6. package/dist/astro/DefaultTemplate.astro +6 -1
  7. package/dist/astro/GutenbergRenderer.astro +231 -72
  8. package/dist/astro/ThemeRuntime.astro +24 -0
  9. package/dist/astro/blocks/CarouselBlock.astro +7 -9
  10. package/dist/astro/blocks/CarouselItemBlock.astro +3 -3
  11. package/dist/astro/blocks/ColumnBlock.astro +3 -4
  12. package/dist/astro/blocks/CoverBlock.astro +155 -0
  13. package/dist/astro/blocks/FormBlock.astro +18 -16
  14. package/dist/astro/blocks/GridBlock.astro +3 -3
  15. package/dist/astro/blocks/HeroBlock.astro +3 -4
  16. package/dist/astro/blocks/ImageBlock.astro +3 -4
  17. package/dist/astro/blocks/ListItemFallback.astro +7 -5
  18. package/dist/astro/blocks/NumberSpinnerBlock.astro +25 -19
  19. package/dist/astro/blocks/SemanticElement.astro +35 -0
  20. package/dist/astro/blocks/SiteLogoBlock.astro +53 -0
  21. package/dist/astro/blocks/TextBlock.astro +29 -25
  22. package/dist/astro/blocks/ThemeToggleBlock.astro +23 -0
  23. package/dist/astro/blocks/cover.d.ts +13 -0
  24. package/dist/astro/blocks/cover.d.ts.map +1 -0
  25. package/dist/astro/blocks/cover.js +105 -0
  26. package/dist/astro/blocks/cover.js.map +1 -0
  27. package/dist/astro/blocks/cover.ts +119 -0
  28. package/dist/astro/blocks/helpers.d.ts +7 -0
  29. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  30. package/dist/astro/blocks/helpers.js +51 -41
  31. package/dist/astro/blocks/helpers.js.map +1 -1
  32. package/dist/astro/blocks/helpers.ts +63 -45
  33. package/dist/astro/native/Blob.astro +113 -0
  34. package/dist/astro/native/BlobBlock.astro +52 -0
  35. package/dist/astro/native/CustomFieldValue.astro +86 -0
  36. package/dist/astro/native/LevelTag.astro +20 -0
  37. package/dist/astro/native/MapBlock.astro +41 -0
  38. package/dist/astro/native/NativeHtmlBlock.astro +12 -0
  39. package/dist/astro/native/NativeIconBlock.astro +33 -0
  40. package/dist/astro/native/ProjectTimelineBlock.astro +34 -0
  41. package/dist/astro/native/ResolvedBlocks.astro +89 -0
  42. package/dist/astro/native/SyncedPatternContent.astro +92 -0
  43. package/dist/astro/native/TermFieldValue.astro +37 -0
  44. package/dist/astro/native/Timeline.astro +20 -0
  45. package/dist/astro/native/TimelineCardBlock.astro +7 -0
  46. package/dist/astro/native/blob/blob-shapes.generated.d.ts +2 -0
  47. package/dist/astro/native/blob/blob-shapes.generated.d.ts.map +1 -0
  48. package/dist/astro/native/blob/blob-shapes.generated.js +2 -0
  49. package/dist/astro/native/blob/blob-shapes.generated.js.map +1 -0
  50. package/dist/astro/native/blob/blob-shapes.generated.ts +1 -0
  51. package/dist/astro/native/blob/config.d.ts +49 -0
  52. package/dist/astro/native/blob/config.d.ts.map +1 -0
  53. package/dist/astro/native/blob/config.js +86 -0
  54. package/dist/astro/native/blob/config.js.map +1 -0
  55. package/dist/astro/native/blob/config.ts +132 -0
  56. package/dist/astro/native/blob/controller.d.ts +11 -0
  57. package/dist/astro/native/blob/controller.d.ts.map +1 -0
  58. package/dist/astro/native/blob/controller.js +240 -0
  59. package/dist/astro/native/blob/controller.js.map +1 -0
  60. package/dist/astro/native/blob/controller.ts +248 -0
  61. package/dist/astro/native/blob/geometry.d.ts +2 -0
  62. package/dist/astro/native/blob/geometry.d.ts.map +1 -0
  63. package/dist/astro/native/blob/geometry.js +2 -0
  64. package/dist/astro/native/blob/geometry.js.map +1 -0
  65. package/dist/astro/native/blob/geometry.ts +1 -0
  66. package/dist/astro/native/blob/ids.d.ts +7 -0
  67. package/dist/astro/native/blob/ids.d.ts.map +1 -0
  68. package/dist/astro/native/blob/ids.js +11 -0
  69. package/dist/astro/native/blob/ids.js.map +1 -0
  70. package/dist/astro/native/blob/ids.ts +11 -0
  71. package/dist/astro/native/blob.css +83 -0
  72. package/dist/astro/native/button.d.ts +13 -0
  73. package/dist/astro/native/button.d.ts.map +1 -0
  74. package/dist/astro/native/button.js +26 -0
  75. package/dist/astro/native/button.js.map +1 -0
  76. package/dist/astro/native/button.ts +26 -0
  77. package/dist/astro/native/core-block.astro +18 -0
  78. package/dist/astro/native/core-button.astro +43 -0
  79. package/dist/astro/native/core-buttons.astro +14 -0
  80. package/dist/astro/native/core-group.astro +23 -0
  81. package/dist/astro/native/core-home-link.astro +11 -0
  82. package/dist/astro/native/core-html.astro +8 -0
  83. package/dist/astro/native/core-icon.astro +7 -0
  84. package/dist/astro/native/core-image.astro +124 -0
  85. package/dist/astro/native/core-navigation-link.astro +70 -0
  86. package/dist/astro/native/core-navigation-submenu.astro +32 -0
  87. package/dist/astro/native/core-navigation.astro +94 -0
  88. package/dist/astro/native/core-page-list-data-item.astro +18 -0
  89. package/dist/astro/native/core-page-list-item.astro +7 -0
  90. package/dist/astro/native/core-page-list.astro +40 -0
  91. package/dist/astro/native/core-post-date.astro +20 -0
  92. package/dist/astro/native/core-post-excerpt.astro +25 -0
  93. package/dist/astro/native/core-post-featured-image.astro +37 -0
  94. package/dist/astro/native/core-post-template.astro +30 -0
  95. package/dist/astro/native/core-post-terms.astro +46 -0
  96. package/dist/astro/native/core-post-title.astro +23 -0
  97. package/dist/astro/native/core-query-no-results.astro +12 -0
  98. package/dist/astro/native/core-query.astro +22 -0
  99. package/dist/astro/native/core-site-title.astro +15 -0
  100. package/dist/astro/native/core-term-description.astro +12 -0
  101. package/dist/astro/native/core-term-name.astro +20 -0
  102. package/dist/astro/native/core-term-template.astro +30 -0
  103. package/dist/astro/native/core-terms-query.astro +19 -0
  104. package/dist/astro/native/flowpress-navigation-controller.d.ts +2 -0
  105. package/dist/astro/native/flowpress-navigation-controller.d.ts.map +1 -0
  106. package/dist/astro/native/flowpress-navigation-controller.js +217 -0
  107. package/dist/astro/native/flowpress-navigation-controller.js.map +1 -0
  108. package/dist/astro/native/flowpress-navigation-controller.ts +215 -0
  109. package/dist/astro/native/flowpress-navigation.css +17 -0
  110. package/dist/astro/native/grid-bleed.js +106 -0
  111. package/dist/astro/native/grid.css +180 -0
  112. package/dist/astro/native/grid.d.ts +17 -0
  113. package/dist/astro/native/grid.d.ts.map +1 -0
  114. package/dist/astro/native/grid.js +103 -0
  115. package/dist/astro/native/grid.js.map +1 -0
  116. package/dist/astro/native/grid.ts +118 -0
  117. package/dist/astro/native/html.d.ts +6 -0
  118. package/dist/astro/native/html.d.ts.map +1 -0
  119. package/dist/astro/native/html.js +10 -0
  120. package/dist/astro/native/html.js.map +1 -0
  121. package/dist/astro/native/html.ts +9 -0
  122. package/dist/astro/native/icon.d.ts +3 -0
  123. package/dist/astro/native/icon.d.ts.map +1 -0
  124. package/dist/astro/native/icon.js +23 -0
  125. package/dist/astro/native/icon.js.map +1 -0
  126. package/dist/astro/native/icon.ts +21 -0
  127. package/dist/astro/native/map.d.ts +14 -0
  128. package/dist/astro/native/map.d.ts.map +1 -0
  129. package/dist/astro/native/map.js +60 -0
  130. package/dist/astro/native/map.js.map +1 -0
  131. package/dist/astro/native/map.ts +70 -0
  132. package/dist/astro/native/motion-preference.d.ts +50 -0
  133. package/dist/astro/native/motion-preference.d.ts.map +1 -0
  134. package/dist/astro/native/motion-preference.js +132 -0
  135. package/dist/astro/native/motion-preference.js.map +1 -0
  136. package/dist/astro/native/motion-preference.ts +158 -0
  137. package/dist/astro/native/motion.d.ts +101 -0
  138. package/dist/astro/native/motion.d.ts.map +1 -0
  139. package/dist/astro/native/motion.js +168 -0
  140. package/dist/astro/native/motion.js.map +1 -0
  141. package/dist/astro/native/motion.ts +312 -0
  142. package/dist/astro/native/query-loop.d.ts +38 -0
  143. package/dist/astro/native/query-loop.d.ts.map +1 -0
  144. package/dist/astro/native/query-loop.js +20 -0
  145. package/dist/astro/native/query-loop.js.map +1 -0
  146. package/dist/astro/native/query-loop.ts +67 -0
  147. package/dist/astro/native/registry.d.ts +3 -0
  148. package/dist/astro/native/registry.d.ts.map +1 -0
  149. package/dist/astro/native/registry.js +72 -0
  150. package/dist/astro/native/registry.js.map +1 -0
  151. package/dist/astro/native/registry.ts +72 -0
  152. package/dist/astro/native/sf-block-binding.astro +20 -0
  153. package/dist/astro/native/sf-post-field.astro +9 -0
  154. package/dist/astro/native/sf-term-field.astro +9 -0
  155. package/dist/astro/native/timeline.css +4 -0
  156. package/dist/astro/native/timeline.d.ts +28 -0
  157. package/dist/astro/native/timeline.d.ts.map +1 -0
  158. package/dist/astro/native/timeline.js +43 -0
  159. package/dist/astro/native/timeline.js.map +1 -0
  160. package/dist/astro/native/timeline.ts +79 -0
  161. package/dist/block-renderers.d.ts +20 -3
  162. package/dist/block-renderers.d.ts.map +1 -1
  163. package/dist/block-renderers.js.map +1 -1
  164. package/dist/client.d.ts +17 -1
  165. package/dist/client.d.ts.map +1 -1
  166. package/dist/client.js +63 -9
  167. package/dist/client.js.map +1 -1
  168. package/dist/composition.d.ts +14 -0
  169. package/dist/composition.d.ts.map +1 -0
  170. package/dist/composition.js +124 -0
  171. package/dist/composition.js.map +1 -0
  172. package/dist/default-blocks.d.ts +9 -0
  173. package/dist/default-blocks.d.ts.map +1 -0
  174. package/dist/default-blocks.js +107 -0
  175. package/dist/default-blocks.js.map +1 -0
  176. package/dist/env.d.ts +9 -0
  177. package/dist/env.d.ts.map +1 -1
  178. package/dist/env.js +20 -0
  179. package/dist/env.js.map +1 -1
  180. package/dist/index.d.ts +5 -0
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +5 -0
  183. package/dist/index.js.map +1 -1
  184. package/dist/links.d.ts +5 -0
  185. package/dist/links.d.ts.map +1 -0
  186. package/dist/links.js +32 -0
  187. package/dist/links.js.map +1 -0
  188. package/dist/media.d.ts +28 -0
  189. package/dist/media.d.ts.map +1 -0
  190. package/dist/media.js +212 -0
  191. package/dist/media.js.map +1 -0
  192. package/dist/styleflow.d.ts +16 -1
  193. package/dist/styleflow.d.ts.map +1 -1
  194. package/dist/styleflow.js +67 -7
  195. package/dist/styleflow.js.map +1 -1
  196. package/dist/templates.d.ts +16 -16
  197. package/dist/theme-runtime.d.ts +16 -0
  198. package/dist/theme-runtime.d.ts.map +1 -0
  199. package/dist/theme-runtime.js +77 -0
  200. package/dist/theme-runtime.js.map +1 -0
  201. package/dist/tsconfig.tsbuildinfo +1 -1
  202. package/dist/types.d.ts +84 -1
  203. package/dist/types.d.ts.map +1 -1
  204. package/dist/types.js.map +1 -1
  205. package/package.json +13 -4
@@ -0,0 +1,106 @@
1
+ /* Exact logical viewport offset for grid items inside nested Styleflow containers. */
2
+ (function () {
3
+ const breakpoints = ["base", "sm", "md", "lg", "xl", "2xl"];
4
+ const thresholds = [0, 640, 768, 1024, 1280, 1536];
5
+ const installed = new WeakSet();
6
+ const resizeObservers = new WeakMap();
7
+ const resizeObserved = new WeakMap();
8
+
9
+ const setOffset = (element, property, value) => {
10
+ if (element.style.getPropertyValue(property) !== value) {
11
+ element.style.setProperty(property, value);
12
+ }
13
+ };
14
+
15
+ const update = (doc) => {
16
+ if (!doc?.defaultView) return;
17
+ const win = doc.defaultView;
18
+ const viewportWidth = doc.documentElement.clientWidth;
19
+ const breakpoint = breakpoints.reduce((current, name, index) =>
20
+ win.innerWidth >= thresholds[index] ? name : current, "base");
21
+ for (const item of doc.querySelectorAll(".fp-grid > .fp-bleed-managed")) {
22
+ const grid = item.parentElement;
23
+ const container = grid.closest('[data-layout-role="container"], .sf-container');
24
+ const resizeObserver = resizeObservers.get(doc);
25
+ const observed = resizeObserved.get(doc);
26
+ for (const element of [grid, container]) {
27
+ if (element && !observed?.has(element)) {
28
+ resizeObserver?.observe(element);
29
+ observed?.add(element);
30
+ }
31
+ }
32
+ if (!container) {
33
+ item.style.removeProperty("--fp-bleed-start-offset");
34
+ item.style.removeProperty("--fp-bleed-end-offset");
35
+ continue;
36
+ }
37
+ const active = item.classList.contains(`fp-bleed-${breakpoint}-start`) ||
38
+ item.classList.contains(`fp-bleed-${breakpoint}-end`);
39
+ if (!active) continue;
40
+ const rect = grid.getBoundingClientRect();
41
+ const style = win.getComputedStyle(grid);
42
+ const rtl = style.direction === "rtl";
43
+ const insetStart = (Number.parseFloat(style.paddingInlineStart) || 0) +
44
+ (Number.parseFloat(style.borderInlineStartWidth) || 0);
45
+ const insetEnd = (Number.parseFloat(style.paddingInlineEnd) || 0) +
46
+ (Number.parseFloat(style.borderInlineEndWidth) || 0);
47
+ const start = rtl ? viewportWidth - rect.right + insetStart : rect.left + insetStart;
48
+ const end = rtl ? rect.left + insetEnd : viewportWidth - rect.right + insetEnd;
49
+ setOffset(item, "--fp-bleed-start-offset", `${-Math.max(0, start)}px`);
50
+ setOffset(item, "--fp-bleed-end-offset", `${-Math.max(0, end)}px`);
51
+ }
52
+ };
53
+
54
+ const install = (doc) => {
55
+ if (!doc?.body || installed.has(doc)) return;
56
+ installed.add(doc);
57
+ let scheduled = false;
58
+ const schedule = () => {
59
+ if (scheduled) return;
60
+ scheduled = true;
61
+ doc.defaultView.requestAnimationFrame(() => {
62
+ scheduled = false;
63
+ update(doc);
64
+ });
65
+ };
66
+ const observer = new MutationObserver((mutations) => {
67
+ if (mutations.some((mutation) => mutation.type === "childList" ||
68
+ (mutation.type === "attributes" &&
69
+ (mutation.target.classList.contains("fp-grid") ||
70
+ mutation.target.classList.contains("fp-bleed-managed") ||
71
+ ["data-layout-role", "data-layout-density", "dir"].includes(mutation.attributeName))))) {
72
+ schedule();
73
+ }
74
+ });
75
+ observer.observe(doc.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["class", "data-layout-role", "data-layout-density", "dir"] });
76
+ doc.defaultView.addEventListener("resize", schedule, { passive: true });
77
+ const resizeObserver = new ResizeObserver(schedule);
78
+ resizeObservers.set(doc, resizeObserver);
79
+ resizeObserved.set(doc, new WeakSet());
80
+ resizeObserver.observe(doc.documentElement);
81
+ update(doc);
82
+ };
83
+
84
+ const installCanvas = () => {
85
+ install(document);
86
+ for (const frame of document.querySelectorAll('iframe[name="editor-canvas"]')) {
87
+ try {
88
+ install(frame.contentDocument);
89
+ if (!frame.dataset.fpGridBleedListener) {
90
+ frame.addEventListener("load", installCanvas);
91
+ frame.dataset.fpGridBleedListener = "true";
92
+ }
93
+ } catch {
94
+ // The WordPress canvas is same-origin; ignore unrelated frames.
95
+ }
96
+ }
97
+ };
98
+
99
+ window.flowpressGridBleedUpdate = update;
100
+ if (document.readyState === "loading") {
101
+ document.addEventListener("DOMContentLoaded", installCanvas, { once: true });
102
+ } else {
103
+ installCanvas();
104
+ }
105
+ new MutationObserver(installCanvas).observe(document.documentElement, { childList: true, subtree: true });
106
+ })();
@@ -0,0 +1,180 @@
1
+ /* Shared by Gutenberg, WordPress output and Astro. Geometry only; Styleflow owns spacing. */
2
+ [data-layout-role="container"], .sf-container { container: sf-container / inline-size; }
3
+ .fp-grid { display: grid !important; --fp-current-cols: 1; grid-template-columns: repeat(var(--fp-current-cols), minmax(0, 1fr)) !important; }
4
+ .fp-grid > .fp-grid-item { min-width: 0; --fp-used-span: 1; grid-column: span var(--fp-used-span) !important; }
5
+ .fp-align-start { align-items: start; }
6
+ .fp-align-center { align-items: center; }
7
+ .fp-align-end { align-items: end; }
8
+ .fp-align-stretch { align-items: stretch; }
9
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
10
+ .fp-cols-base-1 { --fp-current-cols: 1; }
11
+ .fp-grid > .fp-used-span-base-1 { --fp-used-span: 1; }
12
+ .fp-cols-base-2 { --fp-current-cols: 2; }
13
+ .fp-grid > .fp-used-span-base-2 { --fp-used-span: 2; }
14
+ .fp-cols-base-3 { --fp-current-cols: 3; }
15
+ .fp-grid > .fp-used-span-base-3 { --fp-used-span: 3; }
16
+ .fp-cols-base-4 { --fp-current-cols: 4; }
17
+ .fp-grid > .fp-used-span-base-4 { --fp-used-span: 4; }
18
+ .fp-cols-base-5 { --fp-current-cols: 5; }
19
+ .fp-grid > .fp-used-span-base-5 { --fp-used-span: 5; }
20
+ .fp-cols-base-6 { --fp-current-cols: 6; }
21
+ .fp-grid > .fp-used-span-base-6 { --fp-used-span: 6; }
22
+ .fp-cols-base-7 { --fp-current-cols: 7; }
23
+ .fp-grid > .fp-used-span-base-7 { --fp-used-span: 7; }
24
+ .fp-cols-base-8 { --fp-current-cols: 8; }
25
+ .fp-grid > .fp-used-span-base-8 { --fp-used-span: 8; }
26
+ .fp-cols-base-9 { --fp-current-cols: 9; }
27
+ .fp-grid > .fp-used-span-base-9 { --fp-used-span: 9; }
28
+ .fp-cols-base-10 { --fp-current-cols: 10; }
29
+ .fp-grid > .fp-used-span-base-10 { --fp-used-span: 10; }
30
+ .fp-cols-base-11 { --fp-current-cols: 11; }
31
+ .fp-grid > .fp-used-span-base-11 { --fp-used-span: 11; }
32
+ .fp-cols-base-12 { --fp-current-cols: 12; }
33
+ .fp-grid > .fp-used-span-base-12 { --fp-used-span: 12; }
34
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-base-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); } }
35
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-base-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); } }
36
+ @media (min-width: 640px) {
37
+ .fp-cols-sm-1 { --fp-current-cols: 1; }
38
+ .fp-grid > .fp-used-span-sm-1 { --fp-used-span: 1; }
39
+ .fp-cols-sm-2 { --fp-current-cols: 2; }
40
+ .fp-grid > .fp-used-span-sm-2 { --fp-used-span: 2; }
41
+ .fp-cols-sm-3 { --fp-current-cols: 3; }
42
+ .fp-grid > .fp-used-span-sm-3 { --fp-used-span: 3; }
43
+ .fp-cols-sm-4 { --fp-current-cols: 4; }
44
+ .fp-grid > .fp-used-span-sm-4 { --fp-used-span: 4; }
45
+ .fp-cols-sm-5 { --fp-current-cols: 5; }
46
+ .fp-grid > .fp-used-span-sm-5 { --fp-used-span: 5; }
47
+ .fp-cols-sm-6 { --fp-current-cols: 6; }
48
+ .fp-grid > .fp-used-span-sm-6 { --fp-used-span: 6; }
49
+ .fp-cols-sm-7 { --fp-current-cols: 7; }
50
+ .fp-grid > .fp-used-span-sm-7 { --fp-used-span: 7; }
51
+ .fp-cols-sm-8 { --fp-current-cols: 8; }
52
+ .fp-grid > .fp-used-span-sm-8 { --fp-used-span: 8; }
53
+ .fp-cols-sm-9 { --fp-current-cols: 9; }
54
+ .fp-grid > .fp-used-span-sm-9 { --fp-used-span: 9; }
55
+ .fp-cols-sm-10 { --fp-current-cols: 10; }
56
+ .fp-grid > .fp-used-span-sm-10 { --fp-used-span: 10; }
57
+ .fp-cols-sm-11 { --fp-current-cols: 11; }
58
+ .fp-grid > .fp-used-span-sm-11 { --fp-used-span: 11; }
59
+ .fp-cols-sm-12 { --fp-current-cols: 12; }
60
+ .fp-grid > .fp-used-span-sm-12 { --fp-used-span: 12; }
61
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
62
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-sm-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); } }
63
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-sm-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); } }
64
+ }
65
+ @media (min-width: 768px) {
66
+ .fp-cols-md-1 { --fp-current-cols: 1; }
67
+ .fp-grid > .fp-used-span-md-1 { --fp-used-span: 1; }
68
+ .fp-cols-md-2 { --fp-current-cols: 2; }
69
+ .fp-grid > .fp-used-span-md-2 { --fp-used-span: 2; }
70
+ .fp-cols-md-3 { --fp-current-cols: 3; }
71
+ .fp-grid > .fp-used-span-md-3 { --fp-used-span: 3; }
72
+ .fp-cols-md-4 { --fp-current-cols: 4; }
73
+ .fp-grid > .fp-used-span-md-4 { --fp-used-span: 4; }
74
+ .fp-cols-md-5 { --fp-current-cols: 5; }
75
+ .fp-grid > .fp-used-span-md-5 { --fp-used-span: 5; }
76
+ .fp-cols-md-6 { --fp-current-cols: 6; }
77
+ .fp-grid > .fp-used-span-md-6 { --fp-used-span: 6; }
78
+ .fp-cols-md-7 { --fp-current-cols: 7; }
79
+ .fp-grid > .fp-used-span-md-7 { --fp-used-span: 7; }
80
+ .fp-cols-md-8 { --fp-current-cols: 8; }
81
+ .fp-grid > .fp-used-span-md-8 { --fp-used-span: 8; }
82
+ .fp-cols-md-9 { --fp-current-cols: 9; }
83
+ .fp-grid > .fp-used-span-md-9 { --fp-used-span: 9; }
84
+ .fp-cols-md-10 { --fp-current-cols: 10; }
85
+ .fp-grid > .fp-used-span-md-10 { --fp-used-span: 10; }
86
+ .fp-cols-md-11 { --fp-current-cols: 11; }
87
+ .fp-grid > .fp-used-span-md-11 { --fp-used-span: 11; }
88
+ .fp-cols-md-12 { --fp-current-cols: 12; }
89
+ .fp-grid > .fp-used-span-md-12 { --fp-used-span: 12; }
90
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
91
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-md-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); } }
92
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-md-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); } }
93
+ }
94
+ @media (min-width: 1024px) {
95
+ .fp-cols-lg-1 { --fp-current-cols: 1; }
96
+ .fp-grid > .fp-used-span-lg-1 { --fp-used-span: 1; }
97
+ .fp-cols-lg-2 { --fp-current-cols: 2; }
98
+ .fp-grid > .fp-used-span-lg-2 { --fp-used-span: 2; }
99
+ .fp-cols-lg-3 { --fp-current-cols: 3; }
100
+ .fp-grid > .fp-used-span-lg-3 { --fp-used-span: 3; }
101
+ .fp-cols-lg-4 { --fp-current-cols: 4; }
102
+ .fp-grid > .fp-used-span-lg-4 { --fp-used-span: 4; }
103
+ .fp-cols-lg-5 { --fp-current-cols: 5; }
104
+ .fp-grid > .fp-used-span-lg-5 { --fp-used-span: 5; }
105
+ .fp-cols-lg-6 { --fp-current-cols: 6; }
106
+ .fp-grid > .fp-used-span-lg-6 { --fp-used-span: 6; }
107
+ .fp-cols-lg-7 { --fp-current-cols: 7; }
108
+ .fp-grid > .fp-used-span-lg-7 { --fp-used-span: 7; }
109
+ .fp-cols-lg-8 { --fp-current-cols: 8; }
110
+ .fp-grid > .fp-used-span-lg-8 { --fp-used-span: 8; }
111
+ .fp-cols-lg-9 { --fp-current-cols: 9; }
112
+ .fp-grid > .fp-used-span-lg-9 { --fp-used-span: 9; }
113
+ .fp-cols-lg-10 { --fp-current-cols: 10; }
114
+ .fp-grid > .fp-used-span-lg-10 { --fp-used-span: 10; }
115
+ .fp-cols-lg-11 { --fp-current-cols: 11; }
116
+ .fp-grid > .fp-used-span-lg-11 { --fp-used-span: 11; }
117
+ .fp-cols-lg-12 { --fp-current-cols: 12; }
118
+ .fp-grid > .fp-used-span-lg-12 { --fp-used-span: 12; }
119
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
120
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-lg-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); } }
121
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-lg-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); } }
122
+ }
123
+ @media (min-width: 1280px) {
124
+ .fp-cols-xl-1 { --fp-current-cols: 1; }
125
+ .fp-grid > .fp-used-span-xl-1 { --fp-used-span: 1; }
126
+ .fp-cols-xl-2 { --fp-current-cols: 2; }
127
+ .fp-grid > .fp-used-span-xl-2 { --fp-used-span: 2; }
128
+ .fp-cols-xl-3 { --fp-current-cols: 3; }
129
+ .fp-grid > .fp-used-span-xl-3 { --fp-used-span: 3; }
130
+ .fp-cols-xl-4 { --fp-current-cols: 4; }
131
+ .fp-grid > .fp-used-span-xl-4 { --fp-used-span: 4; }
132
+ .fp-cols-xl-5 { --fp-current-cols: 5; }
133
+ .fp-grid > .fp-used-span-xl-5 { --fp-used-span: 5; }
134
+ .fp-cols-xl-6 { --fp-current-cols: 6; }
135
+ .fp-grid > .fp-used-span-xl-6 { --fp-used-span: 6; }
136
+ .fp-cols-xl-7 { --fp-current-cols: 7; }
137
+ .fp-grid > .fp-used-span-xl-7 { --fp-used-span: 7; }
138
+ .fp-cols-xl-8 { --fp-current-cols: 8; }
139
+ .fp-grid > .fp-used-span-xl-8 { --fp-used-span: 8; }
140
+ .fp-cols-xl-9 { --fp-current-cols: 9; }
141
+ .fp-grid > .fp-used-span-xl-9 { --fp-used-span: 9; }
142
+ .fp-cols-xl-10 { --fp-current-cols: 10; }
143
+ .fp-grid > .fp-used-span-xl-10 { --fp-used-span: 10; }
144
+ .fp-cols-xl-11 { --fp-current-cols: 11; }
145
+ .fp-grid > .fp-used-span-xl-11 { --fp-used-span: 11; }
146
+ .fp-cols-xl-12 { --fp-current-cols: 12; }
147
+ .fp-grid > .fp-used-span-xl-12 { --fp-used-span: 12; }
148
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
149
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-xl-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); } }
150
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-xl-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); } }
151
+ }
152
+ @media (min-width: 1536px) {
153
+ .fp-cols-2xl-1 { --fp-current-cols: 1; }
154
+ .fp-grid > .fp-used-span-2xl-1 { --fp-used-span: 1; }
155
+ .fp-cols-2xl-2 { --fp-current-cols: 2; }
156
+ .fp-grid > .fp-used-span-2xl-2 { --fp-used-span: 2; }
157
+ .fp-cols-2xl-3 { --fp-current-cols: 3; }
158
+ .fp-grid > .fp-used-span-2xl-3 { --fp-used-span: 3; }
159
+ .fp-cols-2xl-4 { --fp-current-cols: 4; }
160
+ .fp-grid > .fp-used-span-2xl-4 { --fp-used-span: 4; }
161
+ .fp-cols-2xl-5 { --fp-current-cols: 5; }
162
+ .fp-grid > .fp-used-span-2xl-5 { --fp-used-span: 5; }
163
+ .fp-cols-2xl-6 { --fp-current-cols: 6; }
164
+ .fp-grid > .fp-used-span-2xl-6 { --fp-used-span: 6; }
165
+ .fp-cols-2xl-7 { --fp-current-cols: 7; }
166
+ .fp-grid > .fp-used-span-2xl-7 { --fp-used-span: 7; }
167
+ .fp-cols-2xl-8 { --fp-current-cols: 8; }
168
+ .fp-grid > .fp-used-span-2xl-8 { --fp-used-span: 8; }
169
+ .fp-cols-2xl-9 { --fp-current-cols: 9; }
170
+ .fp-grid > .fp-used-span-2xl-9 { --fp-used-span: 9; }
171
+ .fp-cols-2xl-10 { --fp-current-cols: 10; }
172
+ .fp-grid > .fp-used-span-2xl-10 { --fp-used-span: 10; }
173
+ .fp-cols-2xl-11 { --fp-current-cols: 11; }
174
+ .fp-grid > .fp-used-span-2xl-11 { --fp-used-span: 11; }
175
+ .fp-cols-2xl-12 { --fp-current-cols: 12; }
176
+ .fp-grid > .fp-used-span-2xl-12 { --fp-used-span: 12; }
177
+ .fp-grid > .fp-bleed-managed { margin-inline-start: 0; margin-inline-end: 0; }
178
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-2xl-start { margin-inline-start: var(--fp-bleed-start-offset, 0px); } }
179
+ @container sf-container (min-width: 0px) { .fp-grid > .fp-bleed-2xl-end { margin-inline-end: var(--fp-bleed-end-offset, 0px); } }
180
+ }
@@ -0,0 +1,17 @@
1
+ import type { FlowpressBlock } from "../../index.js";
2
+ export declare const gridBreakpoints: readonly ["base", "sm", "md", "lg", "xl", "2xl"];
3
+ export type GridBreakpoint = typeof gridBreakpoints[number];
4
+ type Values = Partial<Record<GridBreakpoint, number>>;
5
+ type GridAttributes = Record<string, any>;
6
+ export declare const isGrid: (name: string, attributes?: GridAttributes) => boolean;
7
+ export declare const gridValues: (attributes: GridAttributes) => Values;
8
+ export declare const spanValues: (attributes: GridAttributes) => Values;
9
+ export declare const effectiveValues: (values: Values) => Record<GridBreakpoint, number>;
10
+ export declare const gridClasses: (attributes: GridAttributes) => string[];
11
+ export declare const spanClasses: (attributes: GridAttributes) => string[];
12
+ export declare const usedSpanClasses: (parent: GridAttributes, child: GridAttributes) => string[];
13
+ export declare const bleedClasses: (parent: GridAttributes, children: GridAttributes[]) => string[][];
14
+ /** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
15
+ export declare const decorateGridBlocks: (blocks: FlowpressBlock[]) => FlowpressBlock[];
16
+ export {};
17
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/astro/native/grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,eAAe,kDAAmD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAC5D,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAO1C,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,aAAY,cAAmB,KAAG,OAEhC,CAAC;AAExC,eAAO,MAAM,UAAU,GAAI,YAAY,cAAc,KAAG,MAQvD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,YAAY,cAAc,KAAG,MAQvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,cAAc,EAAE,MAAM,CAM7E,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,YAAY,cAAc,KAAG,MAAM,EAQ9D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,YAAY,cAAc,KAAG,MAAM,EAK9D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,cAAc,EAAE,OAAO,cAAc,KAAG,MAAM,EAMrF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,QAAQ,cAAc,EAAE,UAAU,cAAc,EAAE,KAAG,MAAM,EAAE,EAsBzF,CAAC;AAOF,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,cAAc,EAAE,KAAG,cAAc,EAkB1E,CAAC"}
@@ -0,0 +1,103 @@
1
+ export const gridBreakpoints = ["base", "sm", "md", "lg", "xl", "2xl"];
2
+ const count = (value, fallback) => {
3
+ const n = Number(value);
4
+ return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;
5
+ };
6
+ export const isGrid = (name, attributes = {}) => (name === "core/group" || name === "core/post-template" || name === "core/term-template")
7
+ && attributes.layout?.type === "grid";
8
+ export const gridValues = (attributes) => {
9
+ const layout = attributes.layout || {};
10
+ const values = { base: count(layout.columnCount, 1) };
11
+ for (const breakpoint of gridBreakpoints.slice(1)) {
12
+ const value = layout.flowpressColumns?.[breakpoint];
13
+ if (value !== undefined)
14
+ values[breakpoint] = count(value, values.base);
15
+ }
16
+ return values;
17
+ };
18
+ export const spanValues = (attributes) => {
19
+ const layout = attributes.style?.layout || {};
20
+ const values = { base: count(layout.columnSpan, 1) };
21
+ for (const breakpoint of gridBreakpoints.slice(1)) {
22
+ const value = layout.flowpressGridSpan?.[breakpoint];
23
+ if (value !== undefined)
24
+ values[breakpoint] = count(value, values.base);
25
+ }
26
+ return values;
27
+ };
28
+ export const effectiveValues = (values) => {
29
+ let current = values.base ?? 1;
30
+ return Object.fromEntries(gridBreakpoints.map((breakpoint) => {
31
+ current = values[breakpoint] ?? current;
32
+ return [breakpoint, current];
33
+ }));
34
+ };
35
+ export const gridClasses = (attributes) => {
36
+ const values = gridValues(attributes);
37
+ const align = attributes.layout?.flowpressAlign;
38
+ return [
39
+ "fp-grid",
40
+ ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),
41
+ ...(["start", "center", "end", "stretch"].includes(align) ? [`fp-align-${align}`] : []),
42
+ ];
43
+ };
44
+ export const spanClasses = (attributes) => {
45
+ const values = spanValues(attributes);
46
+ return ["fp-grid-item", ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : [])];
47
+ };
48
+ export const usedSpanClasses = (parent, child) => {
49
+ const columns = effectiveValues(gridValues(parent));
50
+ const spans = effectiveValues(spanValues(child));
51
+ return gridBreakpoints.map((breakpoint) => `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`);
52
+ };
53
+ export const bleedClasses = (parent, children) => {
54
+ const columns = effectiveValues(gridValues(parent));
55
+ const spans = children.map((child) => effectiveValues(spanValues(child)));
56
+ const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? ["fp-bleed-managed"] : []);
57
+ for (const breakpoint of gridBreakpoints) {
58
+ let position = 0;
59
+ children.forEach((child, index) => {
60
+ const width = Math.min(spans[index][breakpoint], columns[breakpoint]);
61
+ if (position + width > columns[breakpoint])
62
+ position = 0;
63
+ const start = position === 0;
64
+ const end = position + width === columns[breakpoint];
65
+ const bleed = child.style?.layout?.flowpressGridBleed;
66
+ const from = gridBreakpoints.indexOf(bleed?.from || "base");
67
+ if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&
68
+ ((bleed.side === "start" && start) || (bleed.side === "end" && end))) {
69
+ result[index].push(`fp-bleed-${breakpoint}-${bleed.side}`);
70
+ }
71
+ position += width;
72
+ if (position === columns[breakpoint])
73
+ position = 0;
74
+ });
75
+ }
76
+ return result;
77
+ };
78
+ const appendClasses = (attributes, classes) => ({
79
+ ...attributes,
80
+ className: [...new Set([...(attributes.className || "").split(/\s+/), ...classes].filter(Boolean))].join(" "),
81
+ });
82
+ /** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
83
+ export const decorateGridBlocks = (blocks) => blocks.map((block) => {
84
+ const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;
85
+ const attributes = (block.attributes || {});
86
+ if (!isGrid(block.name, attributes))
87
+ return innerBlocks ? { ...block, innerBlocks } : block;
88
+ const children = innerBlocks ?? [];
89
+ const bleed = bleedClasses(attributes, children.map((child) => child.attributes || {}));
90
+ return {
91
+ ...block,
92
+ attributes: appendClasses({ layoutRole: "stack", density: "regular", ...attributes }, gridClasses(attributes)),
93
+ innerBlocks: children.map((child, index) => ({
94
+ ...child,
95
+ attributes: appendClasses(child.attributes || {}, [
96
+ ...spanClasses(child.attributes || {}),
97
+ ...usedSpanClasses(attributes, child.attributes || {}),
98
+ ...(bleed[index] ?? []),
99
+ ]),
100
+ })),
101
+ };
102
+ });
103
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/astro/native/grid.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAKhF,MAAM,KAAK,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAU,EAAE;IACzD,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,aAA6B,EAAE,EAAW,EAAE,CAC/E,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,oBAAoB,IAAI,IAAI,KAAK,oBAAoB,CAAC;OACtF,UAAU,CAAC,MAAM,EAAE,IAAI,KAAK,MAAM,CAAC;AA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aACxB,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { FlowpressBlock } from \"../../index.js\";\n\nexport const gridBreakpoints = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\nexport type GridBreakpoint = typeof gridBreakpoints[number];\ntype Values = Partial<Record<GridBreakpoint, number>>;\ntype GridAttributes = Record<string, any>;\n\nconst count = (value: unknown, fallback: number): number => {\n const n = Number(value);\n return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;\n};\n\nexport const isGrid = (name: string, attributes: GridAttributes = {}): boolean =>\n (name === \"core/group\" || name === \"core/post-template\" || name === \"core/term-template\")\n && attributes.layout?.type === \"grid\";\n\nexport const gridValues = (attributes: GridAttributes): Values => {\n const layout = attributes.layout || {};\n const values: Values = { base: count(layout.columnCount, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressColumns?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const spanValues = (attributes: GridAttributes): Values => {\n const layout = attributes.style?.layout || {};\n const values: Values = { base: count(layout.columnSpan, 1) };\n for (const breakpoint of gridBreakpoints.slice(1)) {\n const value = layout.flowpressGridSpan?.[breakpoint];\n if (value !== undefined) values[breakpoint] = count(value, values.base!);\n }\n return values;\n};\n\nexport const effectiveValues = (values: Values): Record<GridBreakpoint, number> => {\n let current = values.base ?? 1;\n return Object.fromEntries(gridBreakpoints.map((breakpoint) => {\n current = values[breakpoint] ?? current;\n return [breakpoint, current];\n })) as Record<GridBreakpoint, number>;\n};\n\nexport const gridClasses = (attributes: GridAttributes): string[] => {\n const values = gridValues(attributes);\n const align = attributes.layout?.flowpressAlign;\n return [\n \"fp-grid\",\n ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),\n ...( [\"start\", \"center\", \"end\", \"stretch\"].includes(align) ? [`fp-align-${align}`] : []),\n ];\n};\n\nexport const spanClasses = (attributes: GridAttributes): string[] => {\n const values = spanValues(attributes);\n return [\"fp-grid-item\", ...gridBreakpoints.flatMap((breakpoint) =>\n values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : []\n )];\n};\n\nexport const usedSpanClasses = (parent: GridAttributes, child: GridAttributes): string[] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = effectiveValues(spanValues(child));\n return gridBreakpoints.map((breakpoint) =>\n `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`\n );\n};\n\nexport const bleedClasses = (parent: GridAttributes, children: GridAttributes[]): string[][] => {\n const columns = effectiveValues(gridValues(parent));\n const spans = children.map((child) => effectiveValues(spanValues(child)));\n const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? [\"fp-bleed-managed\"] : [] as string[]);\n for (const breakpoint of gridBreakpoints) {\n let position = 0;\n children.forEach((child, index) => {\n const width = Math.min(spans[index]![breakpoint], columns[breakpoint]);\n if (position + width > columns[breakpoint]) position = 0;\n const start = position === 0;\n const end = position + width === columns[breakpoint];\n const bleed = child.style?.layout?.flowpressGridBleed;\n const from = gridBreakpoints.indexOf(bleed?.from || \"base\");\n if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&\n ((bleed.side === \"start\" && start) || (bleed.side === \"end\" && end))) {\n result[index]!.push(`fp-bleed-${breakpoint}-${bleed.side}`);\n }\n position += width;\n if (position === columns[breakpoint]) position = 0;\n });\n }\n return result;\n};\n\nconst appendClasses = (attributes: GridAttributes, classes: string[]): GridAttributes => ({\n ...attributes,\n className: [...new Set([...(attributes.className || \"\").split(/\\s+/), ...classes].filter(Boolean))].join(\" \"),\n});\n\n/** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */\nexport const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {\n const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;\n const attributes = (block.attributes || {}) as GridAttributes;\n if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;\n const children = innerBlocks ?? [];\n const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));\n return {\n ...block,\n attributes: appendClasses({ layoutRole: \"stack\", density: \"regular\", ...attributes }, gridClasses(attributes)),\n innerBlocks: children.map((child, index) => ({\n ...child,\n attributes: appendClasses(child.attributes as GridAttributes || {}, [\n ...spanClasses(child.attributes as GridAttributes || {}),\n ...usedSpanClasses(attributes, child.attributes as GridAttributes || {}),\n ...(bleed[index] ?? []),\n ]),\n })),\n };\n});\n"]}
@@ -0,0 +1,118 @@
1
+ import type { FlowpressBlock } from "../../index.js";
2
+
3
+ export const gridBreakpoints = ["base", "sm", "md", "lg", "xl", "2xl"] as const;
4
+ export type GridBreakpoint = typeof gridBreakpoints[number];
5
+ type Values = Partial<Record<GridBreakpoint, number>>;
6
+ type GridAttributes = Record<string, any>;
7
+
8
+ const count = (value: unknown, fallback: number): number => {
9
+ const n = Number(value);
10
+ return Number.isInteger(n) && n >= 1 && n <= 12 ? n : fallback;
11
+ };
12
+
13
+ export const isGrid = (name: string, attributes: GridAttributes = {}): boolean =>
14
+ (name === "core/group" || name === "core/post-template" || name === "core/term-template")
15
+ && attributes.layout?.type === "grid";
16
+
17
+ export const gridValues = (attributes: GridAttributes): Values => {
18
+ const layout = attributes.layout || {};
19
+ const values: Values = { base: count(layout.columnCount, 1) };
20
+ for (const breakpoint of gridBreakpoints.slice(1)) {
21
+ const value = layout.flowpressColumns?.[breakpoint];
22
+ if (value !== undefined) values[breakpoint] = count(value, values.base!);
23
+ }
24
+ return values;
25
+ };
26
+
27
+ export const spanValues = (attributes: GridAttributes): Values => {
28
+ const layout = attributes.style?.layout || {};
29
+ const values: Values = { base: count(layout.columnSpan, 1) };
30
+ for (const breakpoint of gridBreakpoints.slice(1)) {
31
+ const value = layout.flowpressGridSpan?.[breakpoint];
32
+ if (value !== undefined) values[breakpoint] = count(value, values.base!);
33
+ }
34
+ return values;
35
+ };
36
+
37
+ export const effectiveValues = (values: Values): Record<GridBreakpoint, number> => {
38
+ let current = values.base ?? 1;
39
+ return Object.fromEntries(gridBreakpoints.map((breakpoint) => {
40
+ current = values[breakpoint] ?? current;
41
+ return [breakpoint, current];
42
+ })) as Record<GridBreakpoint, number>;
43
+ };
44
+
45
+ export const gridClasses = (attributes: GridAttributes): string[] => {
46
+ const values = gridValues(attributes);
47
+ const align = attributes.layout?.flowpressAlign;
48
+ return [
49
+ "fp-grid",
50
+ ...gridBreakpoints.flatMap((breakpoint) => values[breakpoint] ? [`fp-cols-${breakpoint}-${values[breakpoint]}`] : []),
51
+ ...( ["start", "center", "end", "stretch"].includes(align) ? [`fp-align-${align}`] : []),
52
+ ];
53
+ };
54
+
55
+ export const spanClasses = (attributes: GridAttributes): string[] => {
56
+ const values = spanValues(attributes);
57
+ return ["fp-grid-item", ...gridBreakpoints.flatMap((breakpoint) =>
58
+ values[breakpoint] ? [`fp-span-${breakpoint}-${values[breakpoint]}`] : []
59
+ )];
60
+ };
61
+
62
+ export const usedSpanClasses = (parent: GridAttributes, child: GridAttributes): string[] => {
63
+ const columns = effectiveValues(gridValues(parent));
64
+ const spans = effectiveValues(spanValues(child));
65
+ return gridBreakpoints.map((breakpoint) =>
66
+ `fp-used-span-${breakpoint}-${Math.min(spans[breakpoint], columns[breakpoint])}`
67
+ );
68
+ };
69
+
70
+ export const bleedClasses = (parent: GridAttributes, children: GridAttributes[]): string[][] => {
71
+ const columns = effectiveValues(gridValues(parent));
72
+ const spans = children.map((child) => effectiveValues(spanValues(child)));
73
+ const result = children.map((child) => child.style?.layout?.flowpressGridBleed ? ["fp-bleed-managed"] : [] as string[]);
74
+ for (const breakpoint of gridBreakpoints) {
75
+ let position = 0;
76
+ children.forEach((child, index) => {
77
+ const width = Math.min(spans[index]![breakpoint], columns[breakpoint]);
78
+ if (position + width > columns[breakpoint]) position = 0;
79
+ const start = position === 0;
80
+ const end = position + width === columns[breakpoint];
81
+ const bleed = child.style?.layout?.flowpressGridBleed;
82
+ const from = gridBreakpoints.indexOf(bleed?.from || "base");
83
+ if (bleed && gridBreakpoints.indexOf(breakpoint) >= from &&
84
+ ((bleed.side === "start" && start) || (bleed.side === "end" && end))) {
85
+ result[index]!.push(`fp-bleed-${breakpoint}-${bleed.side}`);
86
+ }
87
+ position += width;
88
+ if (position === columns[breakpoint]) position = 0;
89
+ });
90
+ }
91
+ return result;
92
+ };
93
+
94
+ const appendClasses = (attributes: GridAttributes, classes: string[]): GridAttributes => ({
95
+ ...attributes,
96
+ className: [...new Set([...(attributes.className || "").split(/\s+/), ...classes].filter(Boolean))].join(" "),
97
+ });
98
+
99
+ /** Adds render-only classes. Gutenberg's serialized block HTML is never changed. */
100
+ export const decorateGridBlocks = (blocks: FlowpressBlock[]): FlowpressBlock[] => blocks.map((block) => {
101
+ const innerBlocks = block.innerBlocks ? decorateGridBlocks(block.innerBlocks) : undefined;
102
+ const attributes = (block.attributes || {}) as GridAttributes;
103
+ if (!isGrid(block.name, attributes)) return innerBlocks ? { ...block, innerBlocks } : block;
104
+ const children = innerBlocks ?? [];
105
+ const bleed = bleedClasses(attributes, children.map((child) => child.attributes as GridAttributes || {}));
106
+ return {
107
+ ...block,
108
+ attributes: appendClasses({ layoutRole: "stack", density: "regular", ...attributes }, gridClasses(attributes)),
109
+ innerBlocks: children.map((child, index) => ({
110
+ ...child,
111
+ attributes: appendClasses(child.attributes as GridAttributes || {}, [
112
+ ...spanClasses(child.attributes as GridAttributes || {}),
113
+ ...usedSpanClasses(attributes, child.attributes as GridAttributes || {}),
114
+ ...(bleed[index] ?? []),
115
+ ]),
116
+ })),
117
+ };
118
+ });
@@ -0,0 +1,6 @@
1
+ /** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */
2
+ export declare function nativeHtmlData(data?: Record<string, unknown> | null, legacyHtml?: string | null): {
3
+ html: string;
4
+ hidden: boolean;
5
+ };
6
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/astro/native/html.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAOnI"}
@@ -0,0 +1,10 @@
1
+ /** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */
2
+ export function nativeHtmlData(data, legacyHtml) {
3
+ return {
4
+ // Legacy FlowPress serialization supplies only wp_kses_post(innerHtml).
5
+ // A present resolver (including empty output) always takes precedence.
6
+ html: typeof data?.html === "string" ? data.html : data == null ? legacyHtml ?? "" : "",
7
+ hidden: data?.hidden === true,
8
+ };
9
+ }
10
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/astro/native/html.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,IAAqC,EAAE,UAA0B;IAC9F,OAAO;QACL,wEAAwE;QACxE,uEAAuE;QACvE,IAAI,EAAE,OAAO,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;QACvF,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["/** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */\nexport function nativeHtmlData(data?: Record<string, unknown> | null, legacyHtml?: string | null): { html: string; hidden: boolean } {\n return {\n // Legacy FlowPress serialization supplies only wp_kses_post(innerHtml).\n // A present resolver (including empty output) always takes precedence.\n html: typeof data?.html === \"string\" ? data.html : data == null ? legacyHtml ?? \"\" : \"\",\n hidden: data?.hidden === true,\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /** Prefer resolved HTML; older payloads provide a server-sanitized fragment. */
2
+ export function nativeHtmlData(data?: Record<string, unknown> | null, legacyHtml?: string | null): { html: string; hidden: boolean } {
3
+ return {
4
+ // Legacy FlowPress serialization supplies only wp_kses_post(innerHtml).
5
+ // A present resolver (including empty output) always takes precedence.
6
+ html: typeof data?.html === "string" ? data.html : data == null ? legacyHtml ?? "" : "",
7
+ hidden: data?.hidden === true,
8
+ };
9
+ }
@@ -0,0 +1,3 @@
1
+ export declare function nativeIconWidth(value: unknown): string | undefined;
2
+ export declare function nativeIconSvg(name: unknown, resolved: unknown, prefix: string): string | undefined;
3
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/astro/native/icon.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMlE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUlG"}
@@ -0,0 +1,23 @@
1
+ import { normalizeIconSvg, scopeIconSvgIds } from "@styleflow.app/flowpress-components/icon-svg";
2
+ export function nativeIconWidth(value) {
3
+ if (typeof value !== "string")
4
+ return undefined;
5
+ const match = value.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(px|rem|em|%|vw|vh)$/);
6
+ if (!match)
7
+ return undefined;
8
+ const limit = match[2] === "px" ? 1536 : ["%", "vw", "vh"].includes(match[2]) ? 100 : 96;
9
+ return Number(match[1]) > 0 && Number(match[1]) <= limit ? value.trim() : undefined;
10
+ }
11
+ export function nativeIconSvg(name, resolved, prefix) {
12
+ if (typeof name !== "string")
13
+ return undefined;
14
+ let svg;
15
+ if (!svg) {
16
+ const data = resolved && typeof resolved === "object" ? resolved : {};
17
+ if (data.name === name && data.empty === false && typeof data.svg === "string" && data.svg) {
18
+ svg = normalizeIconSvg(data.svg, name);
19
+ }
20
+ }
21
+ return svg ? scopeIconSvgIds(svg, prefix) : undefined;
22
+ }
23
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/astro/native/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAEjG,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1F,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAa,EAAE,QAAiB,EAAE,MAAc;IAC5E,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,GAAuB,CAAC;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,GAAG,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAmC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjG,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3F,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC","sourcesContent":["import { normalizeIconSvg, scopeIconSvgIds } from \"@styleflow.app/flowpress-components/icon-svg\";\n\nexport function nativeIconWidth(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?|\\.\\d+)(px|rem|em|%|vw|vh)$/);\n if (!match) return undefined;\n const limit = match[2] === \"px\" ? 1536 : [\"%\", \"vw\", \"vh\"].includes(match[2]!) ? 100 : 96;\n return Number(match[1]) > 0 && Number(match[1]) <= limit ? value.trim() : undefined;\n}\n\nexport function nativeIconSvg(name: unknown, resolved: unknown, prefix: string): string | undefined {\n if (typeof name !== \"string\") return undefined;\n let svg: string | undefined;\n if (!svg) {\n const data = resolved && typeof resolved === \"object\" ? resolved as Record<string, unknown> : {};\n if (data.name === name && data.empty === false && typeof data.svg === \"string\" && data.svg) {\n svg = normalizeIconSvg(data.svg, name);\n }\n }\n return svg ? scopeIconSvgIds(svg, prefix) : undefined;\n}\n"]}