minerva-design 1.12.0 → 1.12.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # minerva-design
2
2
 
3
+ ## 1.12.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7884716: Taro: `Page` re-applies the theme of the closest `ConfigProvider` / `ThemeProvider` (mode, palette and design classes, `primaryColor` and custom theme variables). In mini-programs every page renders under its own root, outside the provider's element, so pages used to get only the default light tokens: the brand color, dark mode and palettes now reach page content. Outside the default light theme, `Page` also paints the page background and text color. React Native icons accept any `ColorValue` for `color` (e.g. the color a navigation `tabBarIcon` receives).
8
+
3
9
  ## 1.12.0
4
10
 
5
11
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ import { ColorValue } from 'react-native';
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  import { IconDefinition } from '../../icons/core.cjs';
3
4
  export interface IconProps extends Omit<SvgProps, "color" | "stroke" | "strokeWidth" | "fill" | "width" | "height" | "viewBox" | "title" | "children" | "name"> {
@@ -5,8 +6,8 @@ export interface IconProps extends Omit<SvgProps, "color" | "stroke" | "strokeWi
5
6
  icon: IconDefinition;
6
7
  /** Width and height in dp @default 24 */
7
8
  size?: number;
8
- /** Stroke color; per-path `colors` of the icon win @default the theme's text color (`text-color` token) */
9
- color?: string;
9
+ /** Stroke color (any React Native `ColorValue`, e.g. the `color` of a navigation `tabBarIcon`); per-path `colors` of the icon win @default the theme's text color (`text-color` token) */
10
+ color?: ColorValue;
10
11
  /** Stroke width on the 24×24 grid (scales with the size) @default 2 */
11
12
  strokeWidth?: number;
12
13
  /** Keeps `strokeWidth` in dp whatever the size @default false */
@@ -1,3 +1,4 @@
1
+ import { ColorValue } from 'react-native';
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  import { IconDefinition } from '../../icons/core.js';
3
4
  export interface IconProps extends Omit<SvgProps, "color" | "stroke" | "strokeWidth" | "fill" | "width" | "height" | "viewBox" | "title" | "children" | "name"> {
@@ -5,8 +6,8 @@ export interface IconProps extends Omit<SvgProps, "color" | "stroke" | "strokeWi
5
6
  icon: IconDefinition;
6
7
  /** Width and height in dp @default 24 */
7
8
  size?: number;
8
- /** Stroke color; per-path `colors` of the icon win @default the theme's text color (`text-color` token) */
9
- color?: string;
9
+ /** Stroke color (any React Native `ColorValue`, e.g. the `color` of a navigation `tabBarIcon`); per-path `colors` of the icon win @default the theme's text color (`text-color` token) */
10
+ color?: ColorValue;
10
11
  /** Stroke width on the 24×24 grid (scales with the size) @default 2 */
11
12
  strokeWidth?: number;
12
13
  /** Keeps `strokeWidth` in dp whatever the size @default false */
@@ -1,5 +1,6 @@
1
1
  // Props of the React Native bindings (minerva-design/native/icons).
2
2
 
3
+ import type { ColorValue } from "react-native";
3
4
  import type { SvgProps } from "react-native-svg";
4
5
  import type { IconDefinition } from "../../../icons/core.js";
5
6
 
@@ -20,8 +21,8 @@ export interface IconProps extends Omit<
20
21
  icon: IconDefinition;
21
22
  /** Width and height in dp @default 24 */
22
23
  size?: number;
23
- /** Stroke color; per-path `colors` of the icon win @default the theme's text color (`text-color` token) */
24
- color?: string;
24
+ /** Stroke color (any React Native `ColorValue`, e.g. the `color` of a navigation `tabBarIcon`); per-path `colors` of the icon win @default the theme's text color (`text-color` token) */
25
+ color?: ColorValue;
25
26
  /** Stroke width on the 24×24 grid (scales with the size) @default 2 */
26
27
  strokeWidth?: number;
27
28
  /** Keeps `strokeWidth` in dp whatever the size @default false */
@@ -44,7 +44,7 @@ function q(e) {
44
44
  return R.onWindowResize?.(t), () => R.offWindowResize?.(t);
45
45
  }, [n]), [n, r];
46
46
  }
47
- function ee(e, t, n, { side: r = "bottom", align: a = "center", sideOffset: o = 6, alignOffset: c = 0, collisionPadding: l = 8, matchAnchorWidth: u = !1 }) {
47
+ function J(e, t, n, { side: r = "bottom", align: a = "center", sideOffset: o = 6, alignOffset: c = 0, collisionPadding: l = 8, matchAnchorWidth: u = !1 }) {
48
48
  let [d, f] = s();
49
49
  i(() => {
50
50
  if (!n) {
@@ -150,25 +150,25 @@ function ee(e, t, n, { side: r = "bottom", align: a = "center", sideOffset: o =
150
150
  }
151
151
  //#endregion
152
152
  //#region src/theme.tsx
153
- var J = t(null);
154
- function te(e) {
153
+ var Y = t(null);
154
+ function ee(e) {
155
155
  try {
156
156
  return R.getStorageSync(e);
157
157
  } catch {
158
158
  return;
159
159
  }
160
160
  }
161
- var ne = ["primary-color", ..._], Y = /* @__PURE__ */ new Set();
162
- function X(e, t) {
161
+ var te = ["primary-color", ..._], X = /* @__PURE__ */ new Set();
162
+ function ne(e, t) {
163
163
  let n = F(e);
164
164
  if (process.env.NODE_ENV !== "production" && n === void 0) {
165
165
  let t = JSON.stringify(e);
166
- Y.has(t) || (Y.add(t), console.error(C("ConfigProvider", D(e))));
166
+ X.has(t) || (X.add(t), console.error(C("ConfigProvider", D(e))));
167
167
  }
168
168
  return (e !== void 0 && n !== void 0 ? n : t) ?? null;
169
169
  }
170
170
  function re(e) {
171
- return Object.fromEntries(Object.entries(e).filter(([e]) => !ne.includes(e)));
171
+ return Object.fromEntries(Object.entries(e).filter(([e]) => !te.includes(e)));
172
172
  }
173
173
  function ie() {
174
174
  try {
@@ -178,11 +178,11 @@ function ie() {
178
178
  }
179
179
  }
180
180
  function ae({ theme: e, palette: t, primaryColor: n, locale: a, design: c, preset: l, density: u, radius: d, shadow: f, fontScale: p, children: m, persist: g = !1, onThemeChange: _, onPaletteChange: v, ...b }) {
181
- let x = r(J), S = g && !x, [C, w] = s(() => {
182
- let t = S ? te("minerva-theme") : void 0;
181
+ let x = r(Y), S = g && !x, [C, w] = s(() => {
182
+ let t = S ? ee("minerva-theme") : void 0;
183
183
  return A(t) ? t : e ?? x?.definition ?? "light";
184
184
  }), [E, D] = s(() => {
185
- let e = S ? te("minerva-palette") : void 0;
185
+ let e = S ? ee("minerva-palette") : void 0;
186
186
  return O(e) ? e : t === void 0 ? x?.palette ?? null : t;
187
187
  }), [k, j] = s(ie), [N, P] = s({}), F = typeof C == "string" ? C === "auto" ? "system" : C === "github-dark" ? "dark" : C : "light" in C && "dark" in C ? "system" : x?.theme ?? "light", L = o([e, x?.definition]);
188
188
  i(() => {
@@ -205,14 +205,18 @@ function ae({ theme: e, palette: t, primaryColor: n, locale: a, design: c, prese
205
205
  ...f ? { shadow: f } : {},
206
206
  ...p ? { fontScale: p } : {},
207
207
  ...N
208
- }, H = F === "system" ? k : F, U = typeof C == "object" ? "light" in C && "dark" in C ? C[H] : C : C === "github-dark" ? T : void 0, W = X(n, x?.primaryColor), G = W !== null || (x?.brandScope ?? !1), K = I({
208
+ }, H = F === "system" ? k : F, U = typeof C == "object" ? "light" in C && "dark" in C ? C[H] : C : C === "github-dark" ? T : void 0, W = ne(n, x?.primaryColor), G = W !== null || (x?.brandScope ?? !1), K = I({
209
209
  mode: H,
210
210
  palette: E,
211
211
  primaryColor: W,
212
212
  design: V,
213
213
  overrides: U && W ? re(U) : U
214
- }), q = (e) => Object.fromEntries(e.filter((e) => e in K.css).map((e) => [`--${e}`, K.css[e]])), ee = U ? q(Object.keys(K.css)) : G ? q(ne) : {};
215
- return /* @__PURE__ */ B(J.Provider, {
214
+ }), q = (e) => Object.fromEntries(e.filter((e) => e in K.css).map((e) => [`--${e}`, K.css[e]])), J = U ? q(Object.keys(K.css)) : G ? q(te) : {}, X = M({
215
+ mode: H,
216
+ palette: E,
217
+ design: V
218
+ });
219
+ return /* @__PURE__ */ B(Y.Provider, {
216
220
  value: {
217
221
  tokens: K,
218
222
  definition: C,
@@ -233,28 +237,28 @@ function ae({ theme: e, palette: t, primaryColor: n, locale: a, design: c, prese
233
237
  setDesign: P,
234
238
  locale: (typeof a == "string" ? a : a?.language) ?? x?.locale ?? "en",
235
239
  primaryColor: W,
236
- brandScope: G
240
+ brandScope: G,
241
+ scope: {
242
+ className: X,
243
+ style: J
244
+ }
237
245
  },
238
246
  children: /* @__PURE__ */ B(h, {
239
247
  ...b,
240
248
  style: {
241
- ...ee,
249
+ ...J,
242
250
  ...b.style
243
251
  },
244
252
  "data-minerva": "config-provider",
245
253
  "data-theme": H,
246
254
  "data-mode": F,
247
- className: y(M({
248
- mode: H,
249
- palette: E,
250
- design: V
251
- }), b.className),
255
+ className: y(X, b.className),
252
256
  children: m
253
257
  })
254
258
  });
255
259
  }
256
260
  function oe({ defaultTheme: e, defaultPalette: t, primaryColor: n, children: i, locale: a, disableStorage: o = !1, onThemeChange: s, onPaletteChange: c }) {
257
- let l = r(J);
261
+ let l = r(Y);
258
262
  return /* @__PURE__ */ B(ae, {
259
263
  theme: e ?? (l ? void 0 : "system"),
260
264
  palette: t,
@@ -267,10 +271,10 @@ function oe({ defaultTheme: e, defaultPalette: t, primaryColor: n, children: i,
267
271
  });
268
272
  }
269
273
  function se() {
270
- return r(J);
274
+ return r(Y);
271
275
  }
272
276
  function ce() {
273
- let e = r(J);
277
+ let e = r(Y);
274
278
  if (!e) throw Error("useTheme requires ConfigProvider or ThemeProvider");
275
279
  return e;
276
280
  }
@@ -328,7 +332,7 @@ function de({ presets: e = ["minerva", "touch"], disabled: t, ...n }) {
328
332
  });
329
333
  }
330
334
  function Z() {
331
- let e = r(J), t = k(e?.locale) ? e.locale : "en";
335
+ let e = r(Y), t = k(e?.locale) ? e.locale : "en";
332
336
  return {
333
337
  t: b({
334
338
  language: t,
@@ -338,7 +342,7 @@ function Z() {
338
342
  };
339
343
  }
340
344
  function fe() {
341
- return r(J)?.tokens ?? I();
345
+ return r(Y)?.tokens ?? I();
342
346
  }
343
347
  //#endregion
344
348
  //#region src/h5.ts
@@ -745,7 +749,7 @@ function Ae({ value: e, defaultValue: t = "", onChange: n, open: r, defaultOpen:
745
749
  open: T,
746
750
  setOpen: E
747
751
  }), me(k, T, !1, () => E(!1), A);
748
- let M = ee(A, k, T, {
752
+ let M = J(A, k, T, {
749
753
  side: "bottom",
750
754
  align: "start",
751
755
  sideOffset: 4,
@@ -859,32 +863,32 @@ function Ie({ value: e, defaultValue: t = "", onChange: n, options: r, onSelect:
859
863
  }, animation: A = !0, ...j }) {
860
864
  let { t: M } = Z(), N = Q(), P = v ?? g?.disabled ?? N.disabled, F = b ?? g?.readOnly ?? N.readOnly, [I, L] = G(e, t, n), [R, H] = G(j.open, j.defaultOpen ?? !1, (e) => {
861
865
  j.onOpenChange?.(e), s?.(e);
862
- }), U = a().replace(/[^a-zA-Z0-9_-]/g, ""), W = `mn-auto-complete-${U}-anchor`, q = `mn-auto-complete-${U}-panel`, J = R && !P && !F;
866
+ }), U = a().replace(/[^a-zA-Z0-9_-]/g, ""), W = `mn-auto-complete-${U}-anchor`, q = `mn-auto-complete-${U}-panel`, Y = R && !P && !F;
863
867
  pe(W, {
864
- open: J,
868
+ open: Y,
865
869
  setOpen: H,
866
870
  input: !0
867
- }), me(q, J, !1, () => H(!1), W);
868
- let te = O === "top" || O === "bottom", ne = ee(W, q, J, {
871
+ }), me(q, Y, !1, () => H(!1), W);
872
+ let ee = O === "top" || O === "bottom", te = J(W, q, Y, {
869
873
  side: O,
870
874
  align: "start",
871
- sideOffset: te ? k.y : k.x,
872
- alignOffset: te ? k.x : k.y,
875
+ sideOffset: ee ? k.y : k.x,
876
+ alignOffset: ee ? k.x : k.y,
873
877
  matchAnchorWidth: "min"
874
- }), Y = r.map((e) => typeof e == "string" ? {
878
+ }), X = r.map((e) => typeof e == "string" ? {
875
879
  value: e,
876
880
  label: e
877
881
  } : e).filter((e) => c ? c(I, e) : e.label.toLowerCase().includes(I.toLowerCase()));
878
- l && (Y = [...Y].sort(l));
879
- let X = [];
880
- u ? Y.forEach((e) => {
881
- let t = u(e), n = d === "adjacent" ? X.at(-1)?.[0] === t ? X.at(-1) : void 0 : X.find((e) => e[0] === t);
882
- n ? n[1].push(e) : X.push([t, [e]]);
883
- }) : X.push(["", Y]);
882
+ l && (X = [...X].sort(l));
883
+ let ne = [];
884
+ u ? X.forEach((e) => {
885
+ let t = u(e), n = d === "adjacent" ? ne.at(-1)?.[0] === t ? ne.at(-1) : void 0 : ne.find((e) => e[0] === t);
886
+ n ? n[1].push(e) : ne.push([t, [e]]);
887
+ }) : ne.push(["", X]);
884
888
  let re = (e, t = !1) => {
885
889
  e.disabled || P || F || (T && L(e.label), i?.(e), t && o?.(e), H(!1));
886
- }, ie = Y.find((e) => !e.disabled);
887
- return /* @__PURE__ */ V(z, { children: [J && /* @__PURE__ */ B(h, {
890
+ }, ie = X.find((e) => !e.disabled);
891
+ return /* @__PURE__ */ V(z, { children: [Y && /* @__PURE__ */ B(h, {
888
892
  className: "mn-picker-backdrop",
889
893
  onClick: () => H(!1)
890
894
  }), /* @__PURE__ */ V(K, {
@@ -893,7 +897,7 @@ function Ie({ value: e, defaultValue: t = "", onChange: n, options: r, onSelect:
893
897
  className: j.className,
894
898
  style: {
895
899
  ...j.style,
896
- zIndex: J ? 50 : void 0
900
+ zIndex: Y ? 50 : void 0
897
901
  },
898
902
  children: [
899
903
  m && /* @__PURE__ */ B(p, { children: m }),
@@ -914,15 +918,15 @@ function Ie({ value: e, defaultValue: t = "", onChange: n, options: r, onSelect:
914
918
  L(e), H(!0);
915
919
  }
916
920
  }),
917
- J && /* @__PURE__ */ B(K, {
921
+ Y && /* @__PURE__ */ B(K, {
918
922
  name: "auto-complete",
919
923
  part: "content",
920
924
  role: "listbox",
921
925
  id: q,
922
- "data-side": ne.side,
923
- className: y(D, A && "mn-popup-animated", `mn-popup-${ne.side}`),
924
- style: ne.style,
925
- children: S ? /* @__PURE__ */ B(p, { children: M("common.loading") }) : Y.length ? X.map(([e, t], n) => /* @__PURE__ */ V(h, {
926
+ "data-side": te.side,
927
+ className: y(D, A && "mn-popup-animated", `mn-popup-${te.side}`),
928
+ style: te.style,
929
+ children: S ? /* @__PURE__ */ B(p, { children: M("common.loading") }) : X.length ? ne.map(([e, t], n) => /* @__PURE__ */ V(h, {
926
930
  role: u ? "group" : void 0,
927
931
  "aria-label": e || void 0,
928
932
  children: [u && /* @__PURE__ */ B(p, {
@@ -952,7 +956,7 @@ function Ie({ value: e, defaultValue: t = "", onChange: n, options: r, onSelect:
952
956
  function Le({ value: e, defaultValue: t = [], onChange: n, options: r, label: c, disabled: l, readOnly: u, placeholder: d, allowClear: m = !0, showSearch: g, filter: _, loadData: v, displayRender: y, optionRender: b, maxLevel: C = 6, expandTrigger: w = "click", width: T = 240, dropdownClassName: E, dropdownStyle: D, optionStyle: O, ...k }) {
953
957
  let A = Q(), { t: j } = Z();
954
958
  d ??= j("cascader.placeholder");
955
- let M = (l ?? A.disabled) || (u ?? A.readOnly), [N, P] = G(e, t, (e) => n?.(e, x(r, e))), [F, I] = G(k.open, k.defaultOpen ?? !1, k.onOpenChange), [L, R] = s([]), [H, U] = s(!1), [W, q] = s(""), [J, te] = s(""), ne = a().replace(/[^a-zA-Z0-9_-]/g, ""), Y = `mn-cascader-${ne}-anchor`, X = `mn-cascader-${ne}-panel`, re = ee(Y, X, F, {
959
+ let M = (l ?? A.disabled) || (u ?? A.readOnly), [N, P] = G(e, t, (e) => n?.(e, x(r, e))), [F, I] = G(k.open, k.defaultOpen ?? !1, k.onOpenChange), [L, R] = s([]), [H, U] = s(!1), [W, q] = s(""), [Y, ee] = s(""), te = a().replace(/[^a-zA-Z0-9_-]/g, ""), X = `mn-cascader-${te}-anchor`, ne = `mn-cascader-${te}-panel`, re = J(X, ne, F, {
956
960
  side: "bottom",
957
961
  align: "start",
958
962
  sideOffset: 4,
@@ -978,18 +982,18 @@ function Le({ value: e, defaultValue: t = [], onChange: n, options: r, label: c,
978
982
  } else R(e.map((e) => e.value));
979
983
  return;
980
984
  }
981
- P(e.map((e) => e.value)), te(""), I(!1);
985
+ P(e.map((e) => e.value)), ee(""), I(!1);
982
986
  };
983
987
  function de(e, t) {
984
988
  w === "hover" && le(e, t) && ue([...ae.slice(0, t), e]);
985
989
  }
986
- let fe = J ? S(r).filter((e) => !le(e.option, e.path.length - 1) && e.path.length <= ce && (_ ? _(J, e.path) : e.path.map((e) => e.label).join(" / ").toLowerCase().includes(J.toLowerCase()))) : [], pe = [r, ...ae.map((e) => e.children ?? []).filter((e) => e.length)];
990
+ let fe = Y ? S(r).filter((e) => !le(e.option, e.path.length - 1) && e.path.length <= ce && (_ ? _(Y, e.path) : e.path.map((e) => e.label).join(" / ").toLowerCase().includes(Y.toLowerCase()))) : [], pe = [r, ...ae.map((e) => e.children ?? []).filter((e) => e.length)];
987
991
  return /* @__PURE__ */ V(z, { children: [F && /* @__PURE__ */ B(h, {
988
992
  className: "mn-picker-backdrop",
989
993
  onClick: () => I(!1)
990
994
  }), /* @__PURE__ */ V(K, {
991
995
  name: "cascader",
992
- id: Y,
996
+ id: X,
993
997
  className: k.className,
994
998
  style: {
995
999
  width: T,
@@ -1012,7 +1016,7 @@ function Le({ value: e, defaultValue: t = [], onChange: n, options: r, label: c,
1012
1016
  "aria-label": j("cascader.clear"),
1013
1017
  disabled: M,
1014
1018
  onClick: () => {
1015
- P([]), te("");
1019
+ P([]), ee("");
1016
1020
  },
1017
1021
  children: "×"
1018
1022
  }),
@@ -1020,7 +1024,7 @@ function Le({ value: e, defaultValue: t = [], onChange: n, options: r, label: c,
1020
1024
  name: "cascader",
1021
1025
  part: "content",
1022
1026
  role: "listbox",
1023
- id: X,
1027
+ id: ne,
1024
1028
  "data-side": re.side,
1025
1029
  className: E,
1026
1030
  style: {
@@ -1030,8 +1034,8 @@ function Le({ value: e, defaultValue: t = [], onChange: n, options: r, label: c,
1030
1034
  children: [
1031
1035
  g && /* @__PURE__ */ B(We, {
1032
1036
  "aria-label": c ? `${c} ${j("searchBar.label")}` : j("cascader.options"),
1033
- value: J,
1034
- onChange: te,
1037
+ value: Y,
1038
+ onChange: ee,
1035
1039
  disabled: M
1036
1040
  }),
1037
1041
  " ",
@@ -1039,7 +1043,7 @@ function Le({ value: e, defaultValue: t = [], onChange: n, options: r, label: c,
1039
1043
  role: "alert",
1040
1044
  children: W
1041
1045
  }),
1042
- H ? /* @__PURE__ */ B(p, { children: j("common.loading") }) : J ? fe.length ? fe.map((e) => /* @__PURE__ */ B($, {
1046
+ H ? /* @__PURE__ */ B(p, { children: j("common.loading") }) : Y ? fe.length ? fe.map((e) => /* @__PURE__ */ B($, {
1043
1047
  variant: "ghost",
1044
1048
  role: "option",
1045
1049
  style: O,
@@ -1430,7 +1434,7 @@ function Ge({ checked: e, defaultChecked: t = !1, disabled: n, readOnly: r, clas
1430
1434
  value: D,
1431
1435
  disabled: n ?? L.disabled,
1432
1436
  style: { display: "none" }
1433
- }), q = _ === "segmented" && f != null && m != null, ee = y(`mn-size-${b}`, `mn-color-${x}`, `mn-shape-${v}`, H && "mn-disabled", g && "mn-loading");
1437
+ }), q = _ === "segmented" && f != null && m != null, J = y(`mn-size-${b}`, `mn-color-${x}`, `mn-shape-${v}`, H && "mn-disabled", g && "mn-loading");
1434
1438
  if (q) return /* @__PURE__ */ V(h, {
1435
1439
  role: "group",
1436
1440
  id: N.id ?? L.id,
@@ -1438,7 +1442,7 @@ function Ge({ checked: e, defaultChecked: t = !1, disabled: n, readOnly: r, clas
1438
1442
  "aria-labelledby": N["aria-labelledby"],
1439
1443
  "aria-describedby": N["aria-describedby"],
1440
1444
  "aria-disabled": H,
1441
- className: y("mn-switch-segmented", ee, a),
1445
+ className: y("mn-switch-segmented", J, a),
1442
1446
  style: typeof M == "object" ? M : void 0,
1443
1447
  "data-minerva": "switch",
1444
1448
  "data-part": "root",
@@ -1452,7 +1456,7 @@ function Ge({ checked: e, defaultChecked: t = !1, disabled: n, readOnly: r, clas
1452
1456
  children: e ? m : f
1453
1457
  }, String(e)))]
1454
1458
  });
1455
- let J = /* @__PURE__ */ V(h, {
1459
+ let Y = /* @__PURE__ */ V(h, {
1456
1460
  className: y("mn-switch-control", `mn-color-${x}`),
1457
1461
  children: [
1458
1462
  /* @__PURE__ */ V($, {
@@ -1464,7 +1468,7 @@ function Ge({ checked: e, defaultChecked: t = !1, disabled: n, readOnly: r, clas
1464
1468
  "aria-checked": R,
1465
1469
  "aria-invalid": A ?? L.invalid,
1466
1470
  "aria-required": j ?? L.required,
1467
- className: y("mn-switch", "mn-switch-custom", ee, R && "mn-checked"),
1471
+ className: y("mn-switch", "mn-switch-custom", J, R && "mn-checked"),
1468
1472
  variant: "ghost",
1469
1473
  color: x,
1470
1474
  disabled: H,
@@ -1492,15 +1496,15 @@ function Ge({ checked: e, defaultChecked: t = !1, disabled: n, readOnly: r, clas
1492
1496
  className: "mn-switch-ripple"
1493
1497
  }, P)
1494
1498
  ]
1495
- }), te = f != null && m != null, ne = l ?? u;
1499
+ }), ee = f != null && m != null, te = l ?? u;
1496
1500
  return /* @__PURE__ */ V(h, {
1497
- className: y("mn-switch-field", `mn-label-${S}`, ee, a),
1501
+ className: y("mn-switch-field", `mn-label-${S}`, J, a),
1498
1502
  style: typeof M == "object" ? M : void 0,
1499
1503
  "data-minerva": "switch",
1500
1504
  "data-part": "root",
1501
1505
  children: [
1502
1506
  K,
1503
- te && /* @__PURE__ */ B($, {
1507
+ ee && /* @__PURE__ */ B($, {
1504
1508
  className: y("mn-switch-side", !R && "mn-selected"),
1505
1509
  variant: "ghost",
1506
1510
  color: x,
@@ -1508,20 +1512,20 @@ function Ge({ checked: e, defaultChecked: t = !1, disabled: n, readOnly: r, clas
1508
1512
  onClick: (e) => U(!1, e),
1509
1513
  children: f
1510
1514
  }),
1511
- J,
1512
- te ? /* @__PURE__ */ B($, {
1515
+ Y,
1516
+ ee ? /* @__PURE__ */ B($, {
1513
1517
  className: y("mn-switch-side", R && "mn-selected"),
1514
1518
  variant: "ghost",
1515
1519
  color: x,
1516
1520
  disabled: H,
1517
1521
  onClick: (e) => U(!0, e),
1518
1522
  children: m
1519
- }) : ne && /* @__PURE__ */ B(p, {
1523
+ }) : te && /* @__PURE__ */ B(p, {
1520
1524
  className: "mn-switch-label",
1521
- children: ne
1525
+ children: te
1522
1526
  })
1523
1527
  ]
1524
1528
  });
1525
1529
  }
1526
1530
  //#endregion
1527
- export { pe as A, K as B, Me as C, xe as D, Ve as E, le as F, q as H, Z as I, se as L, ue as M, de as N, Q as O, oe as P, ce as R, Ne as S, Fe as T, G as U, ee as V, Ee as _, Ie as a, Ue as b, we as c, _e as d, ye as f, Oe as g, Be as h, N as i, ae as j, me as k, ge as l, Re as m, We as n, Le as o, ve as p, Ge as r, Ce as s, $ as t, be as u, De as v, Pe as w, Ae as x, He as y, fe as z };
1531
+ export { pe as A, K as B, Me as C, xe as D, Ve as E, le as F, q as H, Z as I, se as L, ue as M, de as N, Q as O, oe as P, ce as R, Ne as S, Fe as T, G as U, J as V, Ee as _, Ie as a, Ue as b, we as c, _e as d, ye as f, Oe as g, Be as h, N as i, ae as j, me as k, ge as l, Re as m, We as n, Le as o, ve as p, Ge as r, Ce as s, $ as t, be as u, De as v, Pe as w, Ae as x, He as y, fe as z };
@@ -300,6 +300,14 @@ export declare function SplitLayout({ aside, asideWidth, gap, collapseBelow, chi
300
300
  gap?: number | string;
301
301
  collapseBelow?: "md" | "lg";
302
302
  }): import('react').JSX.Element;
303
+ /**
304
+ * The root of a page. Inside a `ConfigProvider` / `ThemeProvider` it
305
+ * re-applies the provider's token scope (mode, palette and design classes,
306
+ * brand color / custom theme variables): in mini-programs every page renders
307
+ * under its own root, outside the provider's element, so without it pages
308
+ * only get the default light tokens of `page`. Outside the default light
309
+ * theme it also paints the page background and text color.
310
+ */
303
311
  export declare function Page({ maxWidth, ...props }: NativeProps & {
304
312
  maxWidth?: number | string;
305
313
  }): import('react').JSX.Element;
@@ -1,4 +1,4 @@
1
- import { z as e } from "./components-DA7_jBUn.js";
1
+ import { z as e } from "./components-DoBebZ28.js";
2
2
  import { useMemo as t } from "react";
3
3
  import { Image as n } from "@tarojs/components";
4
4
  import { jsx as r } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, U as g, V as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, u as L, v as R, w as z, x as B, y as ee, z as te } from "./components-DA7_jBUn.js";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, U as g, V as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, u as L, v as R, w as z, x as B, y as ee, z as te } from "./components-DoBebZ28.js";
2
2
  import { Children as ne, Fragment as V, cloneElement as re, createContext as ie, forwardRef as H, isValidElement as ae, useContext as oe, useEffect as U, useId as se, useImperativeHandle as ce, useMemo as W, useRef as G, useState as le } from "react";
3
3
  import { Canvas as ue, Image as de, Navigator as fe, ScrollView as pe, Text as K, View as q } from "@tarojs/components";
4
4
  import { addDays as me, cn as J, computeFixedColumnLayout as he, dayKey as ge, formatHasSeconds as _e, formatTime as ve, getColumnCompare as ye, getPaginationItems as be, getPaginationVisibleRange as xe, getTabsTabStop as Se, getVirtualRange as Ce, isSafeUrl as we, matchesAccept as Te, matchesShortcut as Ee, monthStart as De, nextSortState as Oe, normalizeShortcuts as ke, parseDayKey as Ae, parseTimeInput as je, resolveSize as Me, resolveTimeFormat as Ne, resolveTokens as Pe, secondsOfDay as Fe, startOfToday as Ie, weekStart as Le } from "../core/index.js";
@@ -3160,10 +3160,17 @@ function vi({ aside: e, asideWidth: n = 320, gap: r = 6, collapseBelow: i = "md"
3160
3160
  });
3161
3161
  }
3162
3162
  function yi({ maxWidth: e = 1200, ...n }) {
3163
+ let r = c(), i = r?.scope, a = !!r && (r.resolvedTheme === "dark" || r.palette !== null || typeof r.definition == "object" || r.definition === "github-dark");
3163
3164
  return /* @__PURE__ */ Y(t, {
3164
3165
  name: "page",
3165
3166
  ...n,
3167
+ className: J(i?.className, n.className),
3166
3168
  style: {
3169
+ ...i?.style,
3170
+ ...a && {
3171
+ backgroundColor: "var(--background-color)",
3172
+ color: "var(--text-color)"
3173
+ },
3167
3174
  maxWidth: e,
3168
3175
  ...n.style
3169
3176
  }
@@ -1,4 +1,4 @@
1
- import { I as e, L as t, t as n } from "./components-DA7_jBUn.js";
1
+ import { I as e, L as t, t as n } from "./components-DoBebZ28.js";
2
2
  import { useEffect as r, useId as i, useRef as a, useState as o } from "react";
3
3
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
4
4
  //#region src/monaco.tsx
@@ -23,6 +23,15 @@ interface ThemeContextValue {
23
23
  primaryColor: PrimaryColorPair | null;
24
24
  /** A provider of the tree wrote brand tokens (nested ones must re-write them) */
25
25
  brandScope: boolean;
26
+ /**
27
+ * The token scope of this provider's root: its token classes and inline
28
+ * CSS variables. `Page` re-applies it, because in mini-programs every page
29
+ * renders under its own root, outside the provider's element.
30
+ */
31
+ scope: {
32
+ className: string;
33
+ style: Record<string, string>;
34
+ };
26
35
  }
27
36
  export interface ConfigProviderProps extends NativeProps, DesignOptions {
28
37
  theme?: ConfigProviderTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minerva-design",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "Minerva Design: React, Vue, Angular, Web Components and native platform components with shared design tokens and contracts",
5
5
  "license": "MIT",
6
6
  "author": "fwx5618177 <fwx5618177@gmail.com>",