@wpmoo/ui 1.0.0-rc.8 → 1.0.0-rc.9

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI sidebar.js v1.0.0-rc.8 (https://ui.wpmoo.org/)
2
+ * Moo UI sidebar.js v1.0.0-rc.9 (https://ui.wpmoo.org/)
3
3
  * Copyright 2026 WPMoo (https://wpmoo.org)
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -8,7 +8,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
8
8
 
9
9
  // src/js/theme-owner.js
10
10
  var OWNER_SELECTOR = '.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]';
11
- var PORTAL_SELECTOR = "[data-moo-overlay-portal-host]";
11
+ var PORTAL_SELECTOR = "[data-moo-overlay-host]";
12
12
  function documentFor(node) {
13
13
  if (node?.nodeType === 9) return node;
14
14
  if (node?.ownerDocument) return node.ownerDocument;
@@ -249,7 +249,7 @@ var _Sidebar = class _Sidebar {
249
249
  _positionDropdown(control) {
250
250
  const item = control?.closest?.(".sidebar-menu-item");
251
251
  const isHeaderWorkspace = control?.classList.contains("sidebar-menu-button--workspace") && control.closest('[data-slot="sidebar-header"]');
252
- const isFooterAccount = control?.classList.contains("sidebar-menu-button--account") && control.closest('[data-slot="sidebar-footer"]');
252
+ const isFooterAccount = control?.closest(".sidebar-menu-item--account") && control.closest('[data-slot="sidebar-footer"]');
253
253
  if (!control || !item || !(isHeaderWorkspace || isFooterAccount) || !this._isDesktop()) {
254
254
  this._clearDropdownPosition(control);
255
255
  return;
package/dist/js/slider.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI slider.js v1.0.0-rc.8 (https://ui.wpmoo.org/)
2
+ * Moo UI slider.js v1.0.0-rc.9 (https://ui.wpmoo.org/)
3
3
  * Copyright 2026 WPMoo (https://wpmoo.org)
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -0,0 +1,102 @@
1
+ /*!
2
+ * Moo UI state bootstrap
3
+ * Copyright 2026 WPMoo (https://wpmoo.org)
4
+ * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
+ */
6
+ (() => {
7
+ const ownerDocument = typeof document === "undefined" ? null : document;
8
+ const owner = ownerDocument?.currentScript?.parentElement;
9
+ if (!owner) return;
10
+
11
+ const view =
12
+ ownerDocument?.defaultView ||
13
+ (typeof window === "undefined" ? null : window);
14
+
15
+ if (owner.matches?.('.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]')) {
16
+ const body = ownerDocument?.body;
17
+ const documentOwner =
18
+ owner.dataset?.mooDocumentOwner === "true" &&
19
+ owner.parentElement === body &&
20
+ owner === body?.firstElementChild;
21
+ const normalizeDirection = (value) =>
22
+ value === "ltr" || value === "rtl" ? value : null;
23
+ const ownerDirection = normalizeDirection(
24
+ owner.getAttribute?.("dir") || owner.dir,
25
+ );
26
+ const documentDirection = normalizeDirection(
27
+ ownerDocument?.documentElement?.getAttribute?.("dir") ||
28
+ ownerDocument?.documentElement?.dir,
29
+ );
30
+ owner.__mooStateBaseline = {
31
+ theme: owner.dataset.bsTheme === "dark" ? "dark" : "light",
32
+ direction: documentOwner ? documentDirection || "ltr" : ownerDirection,
33
+ };
34
+
35
+ const readPreference = (axis, allowed) => {
36
+ const dataKey = axis === "theme" ? "mooThemeKey" : "mooDirectionKey";
37
+ const explicit = owner.dataset?.[dataKey]?.trim();
38
+ const key = explicit || (documentOwner ? `moo:${axis}` : null);
39
+ if (!key) return null;
40
+ try {
41
+ const value = view?.localStorage?.getItem(key);
42
+ return allowed.includes(value) ? value : null;
43
+ } catch (_) {
44
+ return null;
45
+ }
46
+ };
47
+
48
+ const systemPrefersDark = () => {
49
+ try {
50
+ const matchMedia = view?.matchMedia;
51
+ if (typeof matchMedia !== "function") return null;
52
+ return Boolean(
53
+ matchMedia.call(view, "(prefers-color-scheme: dark)")?.matches,
54
+ );
55
+ } catch (_) {
56
+ return null;
57
+ }
58
+ };
59
+
60
+ try {
61
+ const storedTheme = readPreference("theme", ["light", "dark", "system"]);
62
+ const mediaPrefersDark =
63
+ storedTheme === "system" ? systemPrefersDark() : null;
64
+ const resolvedTheme =
65
+ storedTheme === "dark"
66
+ ? "dark"
67
+ : storedTheme === "light"
68
+ ? "light"
69
+ : storedTheme === "system" && mediaPrefersDark !== null
70
+ ? mediaPrefersDark
71
+ ? "dark"
72
+ : "light"
73
+ : owner.dataset.bsTheme === "dark"
74
+ ? "dark"
75
+ : "light";
76
+ owner.dataset.bsTheme = resolvedTheme;
77
+
78
+ const storedDirection = readPreference("direction", ["ltr", "rtl"]);
79
+ if (storedDirection) {
80
+ if (documentOwner) ownerDocument.documentElement.dir = storedDirection;
81
+ else owner.dir = storedDirection;
82
+ }
83
+ } finally {
84
+ owner.dataset.mooState = "ready";
85
+ }
86
+ return;
87
+ }
88
+
89
+ if (!owner.matches?.('[data-slot="sidebar-wrapper"][data-sidebar-key]')) return;
90
+ const key = owner.dataset?.sidebarKey;
91
+ if (!key) return;
92
+ try {
93
+ const state = view?.localStorage?.getItem(`moo-sidebar:${key}`);
94
+ if (state === "expanded" || state === "collapsed") {
95
+ owner.dataset.sidebarState = state;
96
+ }
97
+ } catch (_) {
98
+ // Restricted browsing contexts may deny localStorage.
99
+ } finally {
100
+ owner.dataset.sidebarStateReady = "";
101
+ }
102
+ })();
@@ -3,22 +3,22 @@
3
3
  {
4
4
  "export": "./moo.css",
5
5
  "path": "dist/assets/css/moo.css",
6
- "sha256": "29c92bd75db1e4990745796aeef4d6a0b3313d1b9d2e3c929f559f8687a5fe6f"
6
+ "sha256": "9f5228c6387b728efe2f341aea9ff09c193f621e778ac413fee9f1cd84992791"
7
7
  },
8
8
  {
9
9
  "export": "./moo-ui.css",
10
10
  "path": "dist/assets/css/moo-ui.css",
11
- "sha256": "00db81fad96811182874b9207746a3154adb0f457c965a08e639a04af83f95a4"
11
+ "sha256": "ca54a5ff1e8a1fa2ac704e3b55e63aa4517353aede35c0bf509c485e6d04a2c6"
12
12
  },
13
13
  {
14
- "export": "./theme-prepaint.js",
15
- "path": "dist/js/theme-prepaint.js",
16
- "sha256": "e40ce7caa83112498c0819719e63ee8d0f23f58236f02ec038ccabf7a128121a"
14
+ "export": "./state.js",
15
+ "path": "dist/js/state.js",
16
+ "sha256": "094cc7bdce8934b846d77476727fd7627062538612f7fcfa8fbd873e44c5e264"
17
17
  }
18
18
  ],
19
19
  "package": {
20
20
  "name": "@wpmoo/ui",
21
- "version": "1.0.0-rc.8"
21
+ "version": "1.0.0-rc.9"
22
22
  },
23
23
  "schemaVersion": 1
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpmoo/ui",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "description": "Bootstrap markup. shadcn feel. A frontend-framework-free component system for server-rendered apps.",
5
5
  "license": "MIT",
6
6
  "author": "WPMoo (https://wpmoo.org)",
@@ -42,7 +42,7 @@
42
42
  "./chart.min.js": "./dist/js/chart.min.js",
43
43
  "./datepicker.js": "./dist/js/datepicker.js",
44
44
  "./datepicker.min.js": "./dist/js/datepicker.min.js",
45
- "./theme-prepaint.js": "./dist/js/theme-prepaint.js",
45
+ "./state.js": "./dist/js/state.js",
46
46
  "./release-manifest.json": "./dist/release-manifest.json",
47
47
  "./scss/config": "./scss/_config.scss",
48
48
  "./scss/moo-ui": "./scss/moo-ui.scss",
@@ -68,7 +68,7 @@
68
68
  "dist/js/chart.min.js",
69
69
  "dist/js/datepicker.js",
70
70
  "dist/js/datepicker.min.js",
71
- "dist/js/theme-prepaint.js",
71
+ "dist/js/state.js",
72
72
  "dist/release-manifest.json",
73
73
  "scss/*.scss",
74
74
  "scss/**/*.scss",
@@ -74,6 +74,14 @@
74
74
  > hr {
75
75
  margin-block: 0;
76
76
  }
77
+
78
+ // A public Bootstrap .row is an explicit layout request from the consumer.
79
+ // Preserve its responsive columns and let Bootstrap's gutters own spacing
80
+ // instead of turning the row back into a vertical, gap-managed field stack.
81
+ &.row {
82
+ flex-direction: row;
83
+ gap: 0;
84
+ }
77
85
  }
78
86
 
79
87
  .field-form {
@@ -3,6 +3,11 @@
3
3
  @import "../foundations/focus";
4
4
  @import "../utilities/scroll_fade";
5
5
  @import "../layouts/app";
6
+ @import "../layouts/page_grid";
6
7
  @import "../themes/forms";
7
8
  @include moo-overlay-backdrop-scoped;
9
+ :where(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
10
+ .display-1, .display-2, .display-3, .display-4, .display-5, .display-6) {
11
+ font-family: var(--moo-heading-font-family, var(--bs-body-font-family));
12
+ }
8
13
  }
@@ -28,7 +28,6 @@
28
28
  min-height: 0;
29
29
  flex: 1 1 auto;
30
30
  flex-direction: column;
31
- overflow-y: auto;
32
31
  }
33
32
 
34
33
  .wrapper[data-layout="app"] > [data-slot="page"] > header,
@@ -46,6 +45,7 @@
46
45
  min-height: 0;
47
46
  flex: 1 1 auto;
48
47
  flex-direction: column;
48
+ overflow-y: auto;
49
49
  }
50
50
 
51
51
  .wrapper[data-layout="app"] > [data-slot="page"] > main > :is(
@@ -74,4 +74,8 @@
74
74
  .wrapper[data-layout="app"][data-shell-mode="contained"] > [data-slot="page"] {
75
75
  overflow: visible;
76
76
  }
77
+
78
+ .wrapper[data-layout="app"][data-shell-mode="contained"] > [data-slot="page"] > main {
79
+ overflow: visible;
80
+ }
77
81
  }
@@ -0,0 +1,30 @@
1
+ // Opt-in Bootstrap row geometry keyed to the usable Moo Page rail, not the
2
+ // viewport or the optional Sidebar state. The rail itself is the query owner.
3
+ [data-page-container] {
4
+ container: moo-page / inline-size;
5
+ }
6
+
7
+ // Keep the compact branch usable in browsers without container queries.
8
+ [data-page-container] [data-page-show-from] {
9
+ display: none !important;
10
+ }
11
+
12
+ @each $breakpoint, $min-width in $grid-breakpoints {
13
+ @if $breakpoint != xs {
14
+ @container moo-page (min-width: #{$min-width}) {
15
+ @for $span from 1 through $grid-columns {
16
+ [data-page-container] .row[data-layout="page-grid"] > [data-page-col-#{$breakpoint}="#{$span}"] {
17
+ width: percentage(divide($span, $grid-columns));
18
+ }
19
+ }
20
+
21
+ [data-page-container] [data-page-show-from="#{$breakpoint}"] {
22
+ display: block !important;
23
+ }
24
+
25
+ [data-page-container] [data-page-hide-from="#{$breakpoint}"] {
26
+ display: none !important;
27
+ }
28
+ }
29
+ }
30
+ }
@@ -1,6 +1,6 @@
1
- // Default App Sidebar variant: attached to the shell edge with one divider.
1
+ // Attached Sidebar variants keep a divider at the shell edge; Inset does not.
2
2
 
3
- .sidebar[data-side="left"] .sidebar-inner {
3
+ .sidebar[data-side="left"]:not([data-variant="inset"]) .sidebar-inner {
4
4
  // `side` is a physical placement contract. Keep the divider on the
5
5
  // Sidebar/Page boundary when the document direction is RTL as well.
6
6
  border-right: var(--bs-border-width) solid var(--moo-sidebar-border);
@@ -21,6 +21,6 @@
21
21
  order: 0;
22
22
  }
23
23
 
24
- .sidebar[data-side="right"] .sidebar-inner {
24
+ .sidebar[data-side="right"]:not([data-variant="inset"]) .sidebar-inner {
25
25
  border-left: var(--bs-border-width) solid var(--moo-sidebar-border);
26
26
  }
@@ -2,7 +2,10 @@
2
2
  // the viewport edge with a margin, border, radius, and shadow.
3
3
 
4
4
  @include media-breakpoint-up(lg) {
5
- .sidebar {
5
+ // Enable shell motion only after Sidebar has restored its initial state.
6
+ // Hosts that hydrate after first paint must not animate the correction from
7
+ // their server/default state to the persisted state.
8
+ :where(.wrapper[data-layout="app"][data-sidebar-ready]) > .sidebar {
6
9
  transition: flex-basis 0.2s ease, width 0.2s ease;
7
10
  }
8
11
 
@@ -14,6 +14,11 @@
14
14
  background: var(--bs-body-bg);
15
15
  }
16
16
 
17
+ .wrapper[data-layout="app"]:has(> .sidebar[data-variant="inset"]) > [data-slot="page"] > header {
18
+ border-top-left-radius: inherit;
19
+ border-top-right-radius: inherit;
20
+ }
21
+
17
22
  .wrapper[data-layout="app"][data-sidebar-state="collapsed"]:has(> .sidebar[data-variant="inset"]) > [data-slot="page"] {
18
23
  margin-left: $spacer * 0.5;
19
24
  }
@@ -7,7 +7,7 @@ $input-height: 2rem !default;
7
7
  $input-line-height: 1.4285714286 !default;
8
8
  $input-bg: var(--moo-input-bg, transparent) !default;
9
9
  $input-border-color: var(--moo-border) !default;
10
- $input-border-radius: 0.625rem !default;
10
+ $input-border-radius: var(--bs-border-radius-lg) !default;
11
11
  $input-placeholder-color: var(--bs-tertiary-color) !default;
12
12
  $input-focus-bg: var(--moo-input-bg, transparent) !default;
13
13
  // Bootstrap leaves disabled text-control foregrounds null by default
@@ -1,6 +1,7 @@
1
1
  .moo-ui[data-bs-theme] {
2
2
  @include moo-core-scales;
3
3
  @include moo-core-shared;
4
+ font-family: var(--bs-body-font-family);
4
5
  }
5
6
 
6
7
  .moo-ui[data-bs-theme="light"] {
@@ -1,5 +1,5 @@
1
- // A complete document places its resolved owner directly inside body. The
2
- // owner, rather than body, supplies the viewport-sized foreground surface.
3
- body > .moo-ui[data-bs-theme] {
1
+ // A complete document's resolved owner supplies the viewport-sized surface.
2
+ // Direct-body overlay hosts share its theme but are infrastructure, not roots.
3
+ body > .moo-ui[data-bs-theme]:not([data-moo-overlay-host]) {
4
4
  min-block-size: 100dvh;
5
5
  }
@@ -91,6 +91,9 @@ $moo-theme-colors-border-subtle-dark: (
91
91
  --moo-chart-3: #{$moo-chart-3};
92
92
  --moo-chart-4: #{$moo-chart-4};
93
93
  --moo-chart-5: #{$moo-chart-5};
94
+ // Resolved owners reset this token so nested Moo owners never inherit a
95
+ // parent owner's heading-font choice.
96
+ --moo-heading-font-family: var(--#{$prefix}body-font-family);
94
97
  }
95
98
 
96
99
  @mixin moo-core-light {
@@ -1,91 +0,0 @@
1
- /*!
2
- * Moo UI theme prepaint
3
- * Copyright 2026 WPMoo (https://wpmoo.org)
4
- * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
- */
6
- (() => {
7
- const ownerDocument =
8
- typeof document === "undefined"
9
- ? null
10
- : document;
11
- const owner = ownerDocument?.currentScript?.parentElement;
12
- const ownerSelector =
13
- '.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]';
14
-
15
- if (!owner?.matches?.(ownerSelector)) return;
16
-
17
- const body = ownerDocument?.body;
18
- const documentOwner =
19
- owner.dataset?.mooDocumentOwner === "true" &&
20
- owner.parentElement === body &&
21
- owner === body?.firstElementChild;
22
- const view =
23
- ownerDocument?.defaultView ||
24
- (typeof window === "undefined" ? null : window);
25
- const normalizeDirection = (value) =>
26
- value === "ltr" || value === "rtl" ? value : null;
27
- const ownerDirection = normalizeDirection(
28
- owner.getAttribute?.("dir") || owner.dir,
29
- );
30
- const documentDirection = normalizeDirection(
31
- ownerDocument?.documentElement?.getAttribute?.("dir") ||
32
- ownerDocument?.documentElement?.dir,
33
- );
34
- owner.__mooPrepaintBaseline = {
35
- theme: owner.dataset.bsTheme === "dark" ? "dark" : "light",
36
- direction: documentOwner ? documentDirection || "ltr" : ownerDirection,
37
- };
38
-
39
- const readPreference = (axis, allowed) => {
40
- const dataKey = axis === "theme" ? "mooThemeKey" : "mooDirectionKey";
41
- const explicit = owner.dataset?.[dataKey]?.trim();
42
- const key = explicit || (documentOwner ? `moo:${axis}` : null);
43
- if (!key) return null;
44
-
45
- try {
46
- const value = view?.localStorage?.getItem(key);
47
- return allowed.includes(value) ? value : null;
48
- } catch (_) {
49
- return null;
50
- }
51
- };
52
-
53
- const systemPrefersDark = () => {
54
- try {
55
- const matchMedia = view?.matchMedia;
56
- if (typeof matchMedia !== "function") return null;
57
- return Boolean(
58
- matchMedia.call(view, "(prefers-color-scheme: dark)")?.matches,
59
- );
60
- } catch (_) {
61
- return null;
62
- }
63
- };
64
-
65
- try {
66
- const storedTheme = readPreference("theme", ["light", "dark", "system"]);
67
- const mediaPrefersDark =
68
- storedTheme === "system" ? systemPrefersDark() : null;
69
- const resolvedTheme =
70
- storedTheme === "dark"
71
- ? "dark"
72
- : storedTheme === "light"
73
- ? "light"
74
- : storedTheme === "system" && mediaPrefersDark !== null
75
- ? mediaPrefersDark
76
- ? "dark"
77
- : "light"
78
- : owner.dataset.bsTheme === "dark"
79
- ? "dark"
80
- : "light";
81
- owner.dataset.bsTheme = resolvedTheme;
82
-
83
- const storedDirection = readPreference("direction", ["ltr", "rtl"]);
84
- if (storedDirection) {
85
- if (documentOwner) ownerDocument.documentElement.dir = storedDirection;
86
- else owner.dir = storedDirection;
87
- }
88
- } finally {
89
- owner.dataset.mooPrepaint = "ready";
90
- }
91
- })();