@nswds/app 1.87.13 → 1.88.0
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/dist/index.cjs +37 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +37 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -17557,7 +17557,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
17557
17557
|
|
|
17558
17558
|
// package.json
|
|
17559
17559
|
var package_default = {
|
|
17560
|
-
version: "1.87.
|
|
17560
|
+
version: "1.87.14"};
|
|
17561
17561
|
var SluggerContext = React5__namespace.default.createContext(null);
|
|
17562
17562
|
function flattenText(nodes) {
|
|
17563
17563
|
if (nodes == null || typeof nodes === "boolean") return "";
|
|
@@ -30428,40 +30428,56 @@ function ThemeColorPaletteLoading() {
|
|
|
30428
30428
|
] }, i)) })
|
|
30429
30429
|
] });
|
|
30430
30430
|
}
|
|
30431
|
-
function getInitialThemeState(searchParams) {
|
|
30431
|
+
function getInitialThemeState(searchParams, defaults) {
|
|
30432
30432
|
const themeParam = searchParams.get("theme");
|
|
30433
30433
|
const primaryParam = searchParams.get("primary");
|
|
30434
30434
|
const accentParam = searchParams.get("accent");
|
|
30435
|
-
const themeCategory = themeParam === "aboriginal"
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30435
|
+
const themeCategory = themeParam === "aboriginal" || themeParam === "brand" ? themeParam : defaults?.themeCategory ?? "brand";
|
|
30436
|
+
function pickFirst(arr) {
|
|
30437
|
+
return arr.length > 0 ? arr[0] : null;
|
|
30438
|
+
}
|
|
30439
|
+
function pickFirstNot(arr, not) {
|
|
30440
|
+
return arr.find((x) => x !== not) ?? null;
|
|
30441
|
+
}
|
|
30442
|
+
const availableColors = Object.keys(colorThemes[themeCategory] ?? {});
|
|
30443
|
+
const availableNonGreyColors = availableColors.filter((c) => !c.toLowerCase().includes("grey"));
|
|
30444
|
+
let primaryColor = defaults?.primaryColor ?? "blue";
|
|
30445
|
+
let accentColor = defaults?.accentColor ?? "red";
|
|
30446
|
+
if (primaryParam && availableNonGreyColors.includes(primaryParam)) {
|
|
30440
30447
|
primaryColor = primaryParam;
|
|
30441
|
-
} else if (!
|
|
30442
|
-
|
|
30448
|
+
} else if (!availableNonGreyColors.includes(primaryColor)) {
|
|
30449
|
+
const fallback = pickFirst(availableNonGreyColors);
|
|
30450
|
+
if (fallback) primaryColor = fallback;
|
|
30443
30451
|
}
|
|
30444
|
-
if (accentParam &&
|
|
30452
|
+
if (accentParam && availableNonGreyColors.includes(accentParam) && accentParam !== primaryColor) {
|
|
30445
30453
|
accentColor = accentParam;
|
|
30446
30454
|
} else {
|
|
30447
|
-
const
|
|
30448
|
-
if (
|
|
30455
|
+
const defaultAccentOk = availableNonGreyColors.includes(accentColor) && accentColor !== primaryColor;
|
|
30456
|
+
if (!defaultAccentOk) {
|
|
30457
|
+
const fallback = pickFirstNot(availableNonGreyColors, primaryColor);
|
|
30458
|
+
if (fallback) accentColor = fallback;
|
|
30459
|
+
}
|
|
30449
30460
|
}
|
|
30450
|
-
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "grey";
|
|
30461
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? defaults?.greyColor ?? "grey";
|
|
30451
30462
|
return { themeCategory, primaryColor, accentColor, greyColor: neutralKey };
|
|
30452
30463
|
}
|
|
30453
|
-
function ThemeColorPaletteContent() {
|
|
30464
|
+
function ThemeColorPaletteContent(props) {
|
|
30454
30465
|
const searchParams = navigation.useSearchParams();
|
|
30455
|
-
const baseColors = {
|
|
30456
|
-
brand,
|
|
30457
|
-
aboriginal
|
|
30458
|
-
};
|
|
30459
30466
|
const {
|
|
30460
30467
|
themeCategory: initialThemeCategory,
|
|
30461
30468
|
primaryColor: initialPrimaryColor,
|
|
30462
30469
|
accentColor: initialAccentColor,
|
|
30463
30470
|
greyColor: initialGreyColor
|
|
30464
|
-
} = getInitialThemeState(searchParams
|
|
30471
|
+
} = getInitialThemeState(searchParams, {
|
|
30472
|
+
themeCategory: props.defaultThemeCategory,
|
|
30473
|
+
primaryColor: props.defaultPrimaryColor,
|
|
30474
|
+
accentColor: props.defaultAccentColor,
|
|
30475
|
+
greyColor: props.defaultGreyColor
|
|
30476
|
+
});
|
|
30477
|
+
const baseColors = {
|
|
30478
|
+
brand,
|
|
30479
|
+
aboriginal
|
|
30480
|
+
};
|
|
30465
30481
|
const [format, setFormat] = React5.useState("hex");
|
|
30466
30482
|
const [viewMode, setViewMode] = React5.useState("grid");
|
|
30467
30483
|
const [themeCategory, setThemeCategory] = React5.useState(initialThemeCategory);
|
|
@@ -30611,8 +30627,8 @@ function ThemeColorPaletteContent() {
|
|
|
30611
30627
|
}) })
|
|
30612
30628
|
] });
|
|
30613
30629
|
}
|
|
30614
|
-
function ThemeColorPalette() {
|
|
30615
|
-
return /* @__PURE__ */ jsxRuntime.jsx(React5.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(ThemeColorPaletteLoading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(ThemeColorPaletteContent, {}) });
|
|
30630
|
+
function ThemeColorPalette(props) {
|
|
30631
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React5.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(ThemeColorPaletteLoading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(ThemeColorPaletteContent, { ...props }) });
|
|
30616
30632
|
}
|
|
30617
30633
|
function ThemeProvider({ children, ...props }) {
|
|
30618
30634
|
return /* @__PURE__ */ jsxRuntime.jsx(nextThemes.ThemeProvider, { ...props, children });
|