@xeonr/platform-ui 1.11.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/dist/auth/AuthCode.d.ts +48 -0
- package/dist/auth/AuthCode.d.ts.map +1 -0
- package/dist/auth/AuthCode.js +197 -0
- package/dist/auth/AuthCode.js.map +1 -0
- package/dist/auth/AuthConsent.d.ts +69 -0
- package/dist/auth/AuthConsent.d.ts.map +1 -0
- package/dist/auth/AuthConsent.js +155 -0
- package/dist/auth/AuthConsent.js.map +1 -0
- package/dist/auth/AuthControls.d.ts +133 -0
- package/dist/auth/AuthControls.d.ts.map +1 -0
- package/dist/auth/AuthControls.js +379 -0
- package/dist/auth/AuthControls.js.map +1 -0
- package/dist/auth/AuthPanel.d.ts +106 -0
- package/dist/auth/AuthPanel.d.ts.map +1 -0
- package/dist/auth/AuthPanel.js +317 -0
- package/dist/auth/AuthPanel.js.map +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +15 -0
- package/dist/auth.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kit/Anchored.js +109 -109
- package/dist/kit/Anchored.js.map +1 -1
- package/dist/kit/ApiKeyForm.js +73 -73
- package/dist/kit/ApiKeyForm.js.map +1 -1
- package/dist/kit/ApiKeys.js +144 -144
- package/dist/kit/ApiKeys.js.map +1 -1
- package/dist/kit/Badge.js +45 -45
- package/dist/kit/Badge.js.map +1 -1
- package/dist/kit/Blocks.d.ts.map +1 -1
- package/dist/kit/Blocks.js +103 -102
- package/dist/kit/Blocks.js.map +1 -1
- package/dist/kit/Board.js +54 -54
- package/dist/kit/Board.js.map +1 -1
- package/dist/kit/Button.d.ts +3 -3
- package/dist/kit/Button.d.ts.map +1 -1
- package/dist/kit/Button.js +55 -50
- package/dist/kit/Button.js.map +1 -1
- package/dist/kit/Card.d.ts.map +1 -1
- package/dist/kit/Card.js +41 -31
- package/dist/kit/Card.js.map +1 -1
- package/dist/kit/ChartFrame.js +54 -54
- package/dist/kit/ChartFrame.js.map +1 -1
- package/dist/kit/ChartTypes.js +215 -215
- package/dist/kit/ChartTypes.js.map +1 -1
- package/dist/kit/Charts.js +605 -605
- package/dist/kit/Charts.js.map +1 -1
- package/dist/kit/Checkbox.js +16 -16
- package/dist/kit/Checkbox.js.map +1 -1
- package/dist/kit/Chip.js +21 -21
- package/dist/kit/Chip.js.map +1 -1
- package/dist/kit/Choice.js +24 -24
- package/dist/kit/Choice.js.map +1 -1
- package/dist/kit/CodeEditor.js +25 -25
- package/dist/kit/CodeEditor.js.map +1 -1
- package/dist/kit/Color.js +74 -74
- package/dist/kit/Color.js.map +1 -1
- package/dist/kit/Combobox.js +67 -67
- package/dist/kit/Combobox.js.map +1 -1
- package/dist/kit/CommandPalette.d.ts.map +1 -1
- package/dist/kit/CommandPalette.js +96 -86
- package/dist/kit/CommandPalette.js.map +1 -1
- package/dist/kit/Comment.js +7 -7
- package/dist/kit/Comment.js.map +1 -1
- package/dist/kit/Controls.js +122 -122
- package/dist/kit/Controls.js.map +1 -1
- package/dist/kit/DataGrid.js +97 -97
- package/dist/kit/DataGrid.js.map +1 -1
- package/dist/kit/DataTable.d.ts.map +1 -1
- package/dist/kit/DataTable.js +196 -195
- package/dist/kit/DataTable.js.map +1 -1
- package/dist/kit/DatePicker.js +242 -242
- package/dist/kit/DatePicker.js.map +1 -1
- package/dist/kit/Drawer.d.ts.map +1 -1
- package/dist/kit/Drawer.js +15 -14
- package/dist/kit/Drawer.js.map +1 -1
- package/dist/kit/Dropzone.js +80 -80
- package/dist/kit/Dropzone.js.map +1 -1
- package/dist/kit/Editable.d.ts.map +1 -1
- package/dist/kit/Editable.js +130 -129
- package/dist/kit/Editable.js.map +1 -1
- package/dist/kit/EmptyState.d.ts.map +1 -1
- package/dist/kit/EmptyState.js +14 -13
- package/dist/kit/EmptyState.js.map +1 -1
- package/dist/kit/EntityHeader.d.ts.map +1 -1
- package/dist/kit/EntityHeader.js +17 -16
- package/dist/kit/EntityHeader.js.map +1 -1
- package/dist/kit/Facet.js +52 -52
- package/dist/kit/Facet.js.map +1 -1
- package/dist/kit/FacetRail.js +91 -91
- package/dist/kit/FacetRail.js.map +1 -1
- package/dist/kit/Forbidden.js +7 -7
- package/dist/kit/Forbidden.js.map +1 -1
- package/dist/kit/Form.d.ts.map +1 -1
- package/dist/kit/Form.js +157 -143
- package/dist/kit/Form.js.map +1 -1
- package/dist/kit/Graph.js +429 -429
- package/dist/kit/Graph.js.map +1 -1
- package/dist/kit/GroupedMultiSelect.js +115 -115
- package/dist/kit/GroupedMultiSelect.js.map +1 -1
- package/dist/kit/Icon.d.ts +2 -0
- package/dist/kit/Icon.d.ts.map +1 -1
- package/dist/kit/Icon.js +3 -1
- package/dist/kit/Icon.js.map +1 -1
- package/dist/kit/JumpList.js +11 -11
- package/dist/kit/JumpList.js.map +1 -1
- package/dist/kit/KV.js +6 -6
- package/dist/kit/KV.js.map +1 -1
- package/dist/kit/Layout.js +5 -5
- package/dist/kit/Layout.js.map +1 -1
- package/dist/kit/List.js +74 -74
- package/dist/kit/List.js.map +1 -1
- package/dist/kit/LogView.js +68 -68
- package/dist/kit/LogView.js.map +1 -1
- package/dist/kit/Markdown.js +37 -37
- package/dist/kit/Markdown.js.map +1 -1
- package/dist/kit/Marker.js +42 -42
- package/dist/kit/Marker.js.map +1 -1
- package/dist/kit/Menu.js +128 -128
- package/dist/kit/Menu.js.map +1 -1
- package/dist/kit/Modal.d.ts.map +1 -1
- package/dist/kit/Modal.js +86 -75
- package/dist/kit/Modal.js.map +1 -1
- package/dist/kit/MultiCombobox.js +157 -157
- package/dist/kit/MultiCombobox.js.map +1 -1
- package/dist/kit/PageHeader.d.ts.map +1 -1
- package/dist/kit/PageHeader.js +8 -7
- package/dist/kit/PageHeader.js.map +1 -1
- package/dist/kit/Panel.d.ts.map +1 -1
- package/dist/kit/Panel.js +33 -14
- package/dist/kit/Panel.js.map +1 -1
- package/dist/kit/Picker.js +159 -159
- package/dist/kit/Picker.js.map +1 -1
- package/dist/kit/PipelineFlow.js +86 -86
- package/dist/kit/PipelineFlow.js.map +1 -1
- package/dist/kit/Popover.js +67 -67
- package/dist/kit/Popover.js.map +1 -1
- package/dist/kit/Range.js +76 -76
- package/dist/kit/Range.js.map +1 -1
- package/dist/kit/Reorder.js +95 -95
- package/dist/kit/Reorder.js.map +1 -1
- package/dist/kit/Search.js +27 -27
- package/dist/kit/Search.js.map +1 -1
- package/dist/kit/Secret.js +26 -26
- package/dist/kit/Secret.js.map +1 -1
- package/dist/kit/Skeleton.js +14 -14
- package/dist/kit/Skeleton.js.map +1 -1
- package/dist/kit/Sparkline.js +51 -51
- package/dist/kit/Sparkline.js.map +1 -1
- package/dist/kit/Spectrum.js +163 -163
- package/dist/kit/Spectrum.js.map +1 -1
- package/dist/kit/Splash.js +3 -3
- package/dist/kit/Splash.js.map +1 -1
- package/dist/kit/Split.js +13 -13
- package/dist/kit/Split.js.map +1 -1
- package/dist/kit/SplitButton.d.ts.map +1 -1
- package/dist/kit/SplitButton.js +8 -6
- package/dist/kit/SplitButton.js.map +1 -1
- package/dist/kit/Stat.d.ts.map +1 -1
- package/dist/kit/Stat.js +74 -60
- package/dist/kit/Stat.js.map +1 -1
- package/dist/kit/Stepper.js +22 -22
- package/dist/kit/Stepper.js.map +1 -1
- package/dist/kit/TabStrip.js +68 -68
- package/dist/kit/TabStrip.js.map +1 -1
- package/dist/kit/Text.js +63 -63
- package/dist/kit/Text.js.map +1 -1
- package/dist/kit/Toast.js +29 -29
- package/dist/kit/Toast.js.map +1 -1
- package/dist/kit/Tooltip.js +83 -83
- package/dist/kit/Tooltip.js.map +1 -1
- package/dist/kit/Trace.js +33 -33
- package/dist/kit/Trace.js.map +1 -1
- package/dist/kit/Upload.js +88 -88
- package/dist/kit/Upload.js.map +1 -1
- package/dist/kit/identity.d.ts +8 -1
- package/dist/kit/identity.d.ts.map +1 -1
- package/dist/kit/identity.js +9 -2
- package/dist/kit/identity.js.map +1 -1
- package/dist/theme/ThemeProvider.d.ts +17 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +40 -4
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeScope.d.ts +9 -1
- package/dist/theme/ThemeScope.d.ts.map +1 -1
- package/dist/theme/ThemeScope.js +11 -4
- package/dist/theme/ThemeScope.js.map +1 -1
- package/dist/theme/tokens.d.ts +63 -0
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +189 -3
- package/dist/theme/tokens.js.map +1 -1
- package/package.json +8 -2
- package/scripts/stable-styled-ids.mjs +75 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACtI,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACtI,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EA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AU,cAAS,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,EAC5C,WAAW,IAAI,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,WAAW,KAAG,CAAC,CAAC,CAAC,IAAI,EAC7D,QAAQ,IACI,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC;AACX,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,WAAW,GAAG,iBAAiB,CAAA;IACjC,YAAY,EAAE;IACd,SAAS,EAAE;CACd,CAAC;AAEF,iFAAiF;AACjF,4EAA4E;AAC5E,gEAAgE;AAChE,MAAM,UAAU,GAAG,iBAAiB,CAAoB;IACpD,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;CAC5B,CAAC;AAEF,0EAA0E;AAC1E,8EAA8E;AAC9E,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,6CAA6C;AAC7C,MAAM,WAAW,GAAG,iBAAiB,CAAA;IACjC,WAAW,CAAC,QAAQ,CAAC;CACxB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { type DesignLanguage } from "./tokens.ts";
|
|
2
3
|
export interface ThemeScopeProps {
|
|
3
4
|
/** The scope's name: the sheet hangs off `[data-x-scope="<name>"]`. */
|
|
4
5
|
name: string;
|
|
@@ -6,6 +7,12 @@ export interface ThemeScopeProps {
|
|
|
6
7
|
brand?: string | null | undefined;
|
|
7
8
|
/** Follow the OS colour scheme when nothing explicit is set. Default true. */
|
|
8
9
|
systemScheme?: boolean | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The design language inside the scope (1.12). Default: the nearest
|
|
12
|
+
* AppThemeProvider's, or "classic" with none. The scope carries its own
|
|
13
|
+
* `data-x-language`, so a host with no provider at its root can still choose.
|
|
14
|
+
*/
|
|
15
|
+
language?: DesignLanguage | undefined;
|
|
9
16
|
/**
|
|
10
17
|
* Apply the element resets the kit's components assume (button, form
|
|
11
18
|
* controls, links, code), at zero specificity (CON-155). Default true; false
|
|
@@ -31,6 +38,7 @@ export declare function themeScopeCss(name: string, opts?: {
|
|
|
31
38
|
systemScheme?: boolean | undefined;
|
|
32
39
|
reset?: boolean | undefined;
|
|
33
40
|
css?: string | undefined;
|
|
41
|
+
language?: DesignLanguage | undefined;
|
|
34
42
|
}): string;
|
|
35
|
-
export declare function ThemeScope({ name, brand, systemScheme, reset, css, children }: ThemeScopeProps): import("react").JSX.Element;
|
|
43
|
+
export declare function ThemeScope({ name, brand, systemScheme, reset, css, language: ownLanguage, children }: ThemeScopeProps): import("react").JSX.Element;
|
|
36
44
|
//# sourceMappingURL=ThemeScope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeScope.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeScope.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKxG,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AA0BhF,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAOD;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,WAAW,GAAG,IAAI,CAIpD;AAqBD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,GAAG,MAAM,CAiBlO;AAQD,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,eAAe,+BA8BrH"}
|
package/dist/theme/ThemeScope.js
CHANGED
|
@@ -3,7 +3,8 @@ import { createContext, useContext, useEffect, useLayoutEffect, useState } from
|
|
|
3
3
|
import { createGlobalStyle } from "styled-components";
|
|
4
4
|
import { brandCss } from "./brand.js";
|
|
5
5
|
import { scopeSelector } from "./scope.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useThemeMaybe } from "./ThemeProvider.js";
|
|
7
|
+
import { cssVariables, languageCss, v } from "./tokens.js";
|
|
7
8
|
const hasDOM = typeof window !== "undefined" && typeof document !== "undefined";
|
|
8
9
|
const useIsoLayoutEffect = hasDOM ? useLayoutEffect : useEffect;
|
|
9
10
|
const PortalCtx = createContext(null);
|
|
@@ -42,6 +43,7 @@ export function themeScopeCss(name, opts) {
|
|
|
42
43
|
return `
|
|
43
44
|
${cssVariables(sheet)}
|
|
44
45
|
${opts?.brand ? brandCss(opts.brand, sheet) : ""}
|
|
46
|
+
${opts?.language ? languageCss(opts.language, sheet) : ""}
|
|
45
47
|
${s} {
|
|
46
48
|
color: ${v.text};
|
|
47
49
|
font-family: ${v.font};
|
|
@@ -57,7 +59,10 @@ const ScopeSheet = createGlobalStyle `
|
|
|
57
59
|
${(p) => p.$css}
|
|
58
60
|
`;
|
|
59
61
|
const wrapperStyle = { display: "contents" };
|
|
60
|
-
export function ThemeScope({ name, brand, systemScheme, reset, css, children }) {
|
|
62
|
+
export function ThemeScope({ name, brand, systemScheme, reset, css, language: ownLanguage, children }) {
|
|
63
|
+
const inherited = useThemeMaybe()?.language;
|
|
64
|
+
const language = ownLanguage ?? inherited ?? "classic";
|
|
65
|
+
const languageAttr = language === "classic" ? undefined : language;
|
|
61
66
|
// The portal host is made once the component is in the DOM, so a server
|
|
62
67
|
// render (and a hydrating one) never touches document. An overlay that is
|
|
63
68
|
// already open on the first client frame lands in body for that frame and
|
|
@@ -66,6 +71,8 @@ export function ThemeScope({ name, brand, systemScheme, reset, css, children })
|
|
|
66
71
|
useIsoLayoutEffect(() => {
|
|
67
72
|
const el = document.createElement("div");
|
|
68
73
|
el.setAttribute("data-x-scope", name);
|
|
74
|
+
if (languageAttr)
|
|
75
|
+
el.setAttribute("data-x-language", languageAttr);
|
|
69
76
|
el.setAttribute("data-x-portal", "");
|
|
70
77
|
document.body.appendChild(el);
|
|
71
78
|
setHost(el);
|
|
@@ -73,7 +80,7 @@ export function ThemeScope({ name, brand, systemScheme, reset, css, children })
|
|
|
73
80
|
el.remove();
|
|
74
81
|
setHost(null);
|
|
75
82
|
};
|
|
76
|
-
}, [name]);
|
|
77
|
-
return (_jsxs(PortalCtx.Provider, { value: host, children: [_jsx(ScopeSheet, { "$css": themeScopeCss(name, { brand, systemScheme, reset, css }) }), _jsx("div", { "data-x-scope": name, style: wrapperStyle, children: children })] }));
|
|
83
|
+
}, [name, languageAttr]);
|
|
84
|
+
return (_jsxs(PortalCtx.Provider, { value: host, children: [_jsx(ScopeSheet, { "$css": themeScopeCss(name, { brand, systemScheme, reset, css, language }) }), _jsx("div", { "data-x-scope": name, "data-x-language": languageAttr, style: wrapperStyle, children: children })] }));
|
|
78
85
|
}
|
|
79
86
|
//# sourceMappingURL=ThemeScope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeScope.js","sourceRoot":"","sources":["../../src/theme/ThemeScope.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ThemeScope.js","sourceRoot":"","sources":["../../src/theme/ThemeScope.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,EAAuB,MAAM,aAAa,CAAC;AAsDhF,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ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AE,CAAC,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9B,OAAO,CAAC,EAAE,CAAC,CAAC;QACZ,OAAO,GAAG,EAAE;YACV,EAAE,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,MAAC,SAAS,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,aAC7B,KAAC,UAAU,YAAO,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAI,EACxF,8BAAmB,IAAI,qBAAmB,YAAY,EAAE,KAAK,EAAE,YAAY,YACxE,QAAQ,GACL,IACa,CACtB,CAAC;AACJ,CAAC"}
|
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -6,9 +6,54 @@ export declare const BRAND: {
|
|
|
6
6
|
g3: string;
|
|
7
7
|
g4: string;
|
|
8
8
|
};
|
|
9
|
+
export declare const PROVIDER_COLOURS: {
|
|
10
|
+
readonly discord: "#5865F2";
|
|
11
|
+
readonly google: {
|
|
12
|
+
readonly blue: "#4285F4";
|
|
13
|
+
readonly green: "#34A853";
|
|
14
|
+
readonly yellow: "#FBBC05";
|
|
15
|
+
readonly red: "#EA4335";
|
|
16
|
+
};
|
|
17
|
+
readonly microsoft: {
|
|
18
|
+
readonly red: "#F25022";
|
|
19
|
+
readonly green: "#7FBA00";
|
|
20
|
+
readonly blue: "#00A4EF";
|
|
21
|
+
readonly yellow: "#FFB900";
|
|
22
|
+
};
|
|
23
|
+
readonly gitlab: "#FC6D26";
|
|
24
|
+
};
|
|
25
|
+
export declare const QR_COLOURS: {
|
|
26
|
+
readonly plate: "#FFFFFF";
|
|
27
|
+
readonly ink: "#0B0B10";
|
|
28
|
+
};
|
|
9
29
|
export declare const GRAD: string;
|
|
10
30
|
export declare const GRAD_90: string;
|
|
11
31
|
export declare function cssVariables(opts?: SheetOptions): string;
|
|
32
|
+
export type DesignLanguage = "classic" | "signal";
|
|
33
|
+
/**
|
|
34
|
+
* The same hairline in a colour of the caller's choosing, for a surface whose
|
|
35
|
+
* border is not the neutral line: a card in a severity tone, whose coloured
|
|
36
|
+
* border would otherwise stop at each cut and leave a gap. `size` is one of
|
|
37
|
+
* the `--x-edge-size-*` tokens (`v.edgeSizeCard`, …), which is 0 in a language
|
|
38
|
+
* with no cuts, so this draws nothing there.
|
|
39
|
+
*
|
|
40
|
+
* It exists because a custom property's `var()`s are resolved where the
|
|
41
|
+
* property is declared, not where it is used: a surface cannot recolour the
|
|
42
|
+
* inherited `--x-edge-card` by setting a colour of its own.
|
|
43
|
+
*/
|
|
44
|
+
export declare function cutEdgeIn(colour: string, size: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Signal's display and caption faces, as one stylesheet. AppThemeProvider adds
|
|
47
|
+
* it to the page in the browser when given `language="signal"`; a
|
|
48
|
+
* server-rendered host links it itself, beside the sheet it inlines.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SIGNAL_FONTS_URL = "https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap";
|
|
51
|
+
/**
|
|
52
|
+
* The sheet for one design language, or `""` for classic. Inline it after
|
|
53
|
+
* `cssVariables()` on a server-rendered host; AppThemeProvider injects it for
|
|
54
|
+
* everyone else when given `language`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function languageCss(language: DesignLanguage, opts?: SheetOptions): string;
|
|
12
57
|
export declare const v: {
|
|
13
58
|
brand: string;
|
|
14
59
|
grad: string;
|
|
@@ -25,7 +70,25 @@ export declare const v: {
|
|
|
25
70
|
rCard: string;
|
|
26
71
|
rPanel: string;
|
|
27
72
|
rModal: string;
|
|
73
|
+
rPill: string;
|
|
28
74
|
ring: string;
|
|
75
|
+
display: string;
|
|
76
|
+
label: string;
|
|
77
|
+
labelCase: string;
|
|
78
|
+
labelTracking: string;
|
|
79
|
+
clipCtl: string;
|
|
80
|
+
clipTile: string;
|
|
81
|
+
clipCard: string;
|
|
82
|
+
clipPanel: string;
|
|
83
|
+
clipModal: string;
|
|
84
|
+
edgeCard: string;
|
|
85
|
+
edgePanel: string;
|
|
86
|
+
edgeModal: string;
|
|
87
|
+
edgeContent: string;
|
|
88
|
+
edgePosition: string;
|
|
89
|
+
edgeSizeCard: string;
|
|
90
|
+
edgeSizePanel: string;
|
|
91
|
+
edgeSizeModal: string;
|
|
29
92
|
canvas: string;
|
|
30
93
|
bg: string;
|
|
31
94
|
sidebar: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAUA,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5E,eAAO,MAAM,KAAK;;;;;;CAMjB,CAAC;AAMF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAKnB,CAAC;AAIX,eAAO,MAAM,UAAU;;;CAAgD,CAAC;AAExE,eAAO,MAAM,IAAI,QAAwF,CAAC;AAC1G,eAAO,MAAM,OAAO,QAAuF,CAAC;AA0E5G,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,CA6KxD;AAwBD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAqBlD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,+HACiG,CAAC;AAqF/H;;;;GAIG;AAC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O,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACnE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACnE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAC9F,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAC/D,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAC9F,CAAC;AAQF,wBAAgB,SAAS,IAAI,MAAM,CAwClC;AAMD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;CAyBvB,CAAC"}
|
package/dist/theme/tokens.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// colour literals (scripts/check-colour-literals.mjs enforces it). Light and dark
|
|
8
8
|
// are both first-class: the ThemeProvider stamps data-theme on <html> and these
|
|
9
9
|
// blocks re-map the same variable names.
|
|
10
|
-
import { rootSelector } from "./scope.js";
|
|
10
|
+
import { rootSelector, scopeSelector } from "./scope.js";
|
|
11
11
|
export const BRAND = {
|
|
12
12
|
primary: "#A354A2",
|
|
13
13
|
g1: "#9C4699",
|
|
@@ -15,6 +15,19 @@ export const BRAND = {
|
|
|
15
15
|
g3: "#9B3EE4",
|
|
16
16
|
g4: "#5726BE",
|
|
17
17
|
};
|
|
18
|
+
// Other people's marks, in other people's colours: the identity providers a
|
|
19
|
+
// sign-in screen offers (auth/ProviderMark). Not tokens, since nothing about
|
|
20
|
+
// them follows the theme or the brand; they are here because this is where
|
|
21
|
+
// colour literals live.
|
|
22
|
+
export const PROVIDER_COLOURS = {
|
|
23
|
+
discord: "#5865F2",
|
|
24
|
+
google: { blue: "#4285F4", green: "#34A853", yellow: "#FBBC05", red: "#EA4335" },
|
|
25
|
+
microsoft: { red: "#F25022", green: "#7FBA00", blue: "#00A4EF", yellow: "#FFB900" },
|
|
26
|
+
gitlab: "#FC6D26",
|
|
27
|
+
};
|
|
28
|
+
// A QR code is dark on light whatever the scheme: it is read by a camera, not
|
|
29
|
+
// by the person, and scanners are unreliable on an inverted code (auth/AuthQr).
|
|
30
|
+
export const QR_COLOURS = { plate: "#FFFFFF", ink: "#0B0B10" };
|
|
18
31
|
export const GRAD = `linear-gradient(135deg, ${BRAND.g1}, ${BRAND.g2} 34%, ${BRAND.g3} 68%, ${BRAND.g4})`;
|
|
19
32
|
export const GRAD_90 = `linear-gradient(90deg, ${BRAND.g1}, ${BRAND.g2} 34%, ${BRAND.g3} 68%, ${BRAND.g4})`;
|
|
20
33
|
// The light scheme, once: both the explicit `data-theme="light"` rule and the
|
|
@@ -111,7 +124,34 @@ ${r("")} {
|
|
|
111
124
|
--x-r-card: 12px; /* cards, tiles */
|
|
112
125
|
--x-r-panel: 14px;/* panels, tables, empty states */
|
|
113
126
|
--x-r-modal: 16px;/* modals, palette */
|
|
127
|
+
--x-r-pill: 999px;/* a fully rounded end (count pills, chips, meters), and the cap on a computed radius */
|
|
114
128
|
--x-ring: 0 0 0 3px var(--x-brand-55);
|
|
129
|
+
/* Design-language hooks (1.12). Each sits at a value that draws nothing new,
|
|
130
|
+
so a console that names no language looks as it always has; languageCss()
|
|
131
|
+
repoints them. --x-display is the face for titles and big numbers,
|
|
132
|
+
--x-label the face for small captions, and the case and tracking beside it
|
|
133
|
+
are for captions that are sentence case today. --x-clip-* cut the corners
|
|
134
|
+
of a control, a tile, a card, a panel and a modal; --x-edge-* draw the hairline
|
|
135
|
+
along a card's or a panel's cut (the content and position pair switch a
|
|
136
|
+
panel's overlay on). */
|
|
137
|
+
--x-display: var(--x-font);
|
|
138
|
+
--x-label: var(--x-font);
|
|
139
|
+
--x-label-case: none;
|
|
140
|
+
--x-label-tracking: normal;
|
|
141
|
+
--x-clip-ctl: none;
|
|
142
|
+
--x-clip-tile: none;
|
|
143
|
+
--x-clip-card: none;
|
|
144
|
+
--x-clip-panel: none;
|
|
145
|
+
--x-clip-modal: none;
|
|
146
|
+
--x-edge-card: none;
|
|
147
|
+
--x-edge-panel: none;
|
|
148
|
+
--x-edge-modal: none;
|
|
149
|
+
--x-edge-content: none;
|
|
150
|
+
/* how far in along the diagonal a cut's hairline sits; 0 draws none */
|
|
151
|
+
--x-edge-size-card: 0px;
|
|
152
|
+
--x-edge-size-panel: 0px;
|
|
153
|
+
--x-edge-size-modal: 0px;
|
|
154
|
+
--x-edge-position: static;
|
|
115
155
|
--x-z-nav: 20; --x-z-pop: 30; --x-z-scrim: 40; --x-z-modal: 41; --x-z-palette: 50; --x-z-toast: 60;
|
|
116
156
|
}
|
|
117
157
|
|
|
@@ -235,12 +275,158 @@ ${r('[data-theme="light"]')} {
|
|
|
235
275
|
${LIGHT}}
|
|
236
276
|
`;
|
|
237
277
|
}
|
|
278
|
+
/** A cut on the top-left and bottom-right corners, `c` deep. */
|
|
279
|
+
const cutBoth = (c) => `polygon(${c} 0, 100% 0, 100% calc(100% - ${c}), calc(100% - ${c}) 100%, 0 100%, 0 ${c})`;
|
|
280
|
+
/** A cut on the top-right and bottom-left corners: the primary button's. */
|
|
281
|
+
const cutCross = (c) => `polygon(0 0, calc(100% - ${c}) 0, 100% ${c}, 100% 100%, ${c} 100%, 0 calc(100% - ${c}))`;
|
|
282
|
+
/**
|
|
283
|
+
* The hairline along a `cutBoth` corner, as a background-image for a surface
|
|
284
|
+
* whose `background-origin` is `border-box`. A 135deg gradient measures from
|
|
285
|
+
* the top-left corner along the diagonal, so a cut `c` deep sits `c / √2` in:
|
|
286
|
+
* everything up to one pixel past it is the line's colour, and the clip takes
|
|
287
|
+
* the part outside the cut. `t` is that `c / √2 + 1px`, worked out by hand
|
|
288
|
+
* because calc() cannot take a root.
|
|
289
|
+
*/
|
|
290
|
+
const cutEdge = (t) => `linear-gradient(135deg, var(--x-brand) ${t}, transparent ${t}), linear-gradient(315deg, var(--x-g3) ${t}, transparent ${t})`;
|
|
291
|
+
/**
|
|
292
|
+
* The same hairline in a colour of the caller's choosing, for a surface whose
|
|
293
|
+
* border is not the neutral line: a card in a severity tone, whose coloured
|
|
294
|
+
* border would otherwise stop at each cut and leave a gap. `size` is one of
|
|
295
|
+
* the `--x-edge-size-*` tokens (`v.edgeSizeCard`, …), which is 0 in a language
|
|
296
|
+
* with no cuts, so this draws nothing there.
|
|
297
|
+
*
|
|
298
|
+
* It exists because a custom property's `var()`s are resolved where the
|
|
299
|
+
* property is declared, not where it is used: a surface cannot recolour the
|
|
300
|
+
* inherited `--x-edge-card` by setting a colour of its own.
|
|
301
|
+
*/
|
|
302
|
+
export function cutEdgeIn(colour, size) {
|
|
303
|
+
return `linear-gradient(135deg, ${colour} ${size}, transparent ${size}), linear-gradient(315deg, ${colour} ${size}, transparent ${size})`;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Signal's display and caption faces, as one stylesheet. AppThemeProvider adds
|
|
307
|
+
* it to the page in the browser when given `language="signal"`; a
|
|
308
|
+
* server-rendered host links it itself, beside the sheet it inlines.
|
|
309
|
+
*/
|
|
310
|
+
export const SIGNAL_FONTS_URL = "https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap";
|
|
311
|
+
const SIGNAL_SHARED = `
|
|
312
|
+
--x-display: "Chakra Petch", var(--x-font);
|
|
313
|
+
--x-label: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
314
|
+
--x-label-case: uppercase;
|
|
315
|
+
--x-label-tracking: 0.08em;
|
|
316
|
+
--x-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
317
|
+
--x-r-ctl: 3px;
|
|
318
|
+
--x-r-card: 2px;
|
|
319
|
+
--x-r-panel: 2px;
|
|
320
|
+
--x-r-modal: 3px;
|
|
321
|
+
--x-r-pill: 3px;
|
|
322
|
+
--x-clip-ctl: ${cutCross("8px")};
|
|
323
|
+
--x-clip-tile: ${cutBoth("8px")};
|
|
324
|
+
--x-clip-card: ${cutBoth("12px")};
|
|
325
|
+
--x-clip-panel: ${cutBoth("14px")};
|
|
326
|
+
--x-clip-modal: ${cutBoth("18px")};
|
|
327
|
+
--x-edge-card: ${cutEdge("9.5px")};
|
|
328
|
+
--x-edge-panel: ${cutEdge("10.9px")};
|
|
329
|
+
--x-edge-modal: ${cutEdge("13.7px")};
|
|
330
|
+
--x-edge-size-card: 9.5px;
|
|
331
|
+
--x-edge-size-panel: 10.9px;
|
|
332
|
+
--x-edge-size-modal: 13.7px;
|
|
333
|
+
--x-edge-content: "";
|
|
334
|
+
--x-edge-position: relative;
|
|
335
|
+
/* inside the box: a ring outside a clipped surface is cut away with its corners */
|
|
336
|
+
--x-ring: inset 0 0 0 2px var(--x-info);
|
|
337
|
+
`;
|
|
338
|
+
const SIGNAL_DARK = `
|
|
339
|
+
color-scheme: dark;
|
|
340
|
+
--x-canvas: color-mix(in srgb, var(--x-brand) 4.5%, #08080b);
|
|
341
|
+
--x-grid: rgba(255, 255, 255, 0.04);
|
|
342
|
+
--x-bg:
|
|
343
|
+
linear-gradient(var(--x-grid) 1px, transparent 1px) 0 0 / 56px 56px,
|
|
344
|
+
linear-gradient(90deg, var(--x-grid) 1px, transparent 1px) 0 0 / 56px 56px,
|
|
345
|
+
radial-gradient(720px 360px at 86% -120px, color-mix(in srgb, var(--x-g3) 22%, transparent), transparent 70%),
|
|
346
|
+
radial-gradient(760px 380px at 8% -140px, color-mix(in srgb, var(--x-brand) 20%, transparent), transparent 70%),
|
|
347
|
+
var(--x-canvas);
|
|
348
|
+
--x-sidebar: color-mix(in srgb, var(--x-brand) 4.5%, #0c0c10);
|
|
349
|
+
--x-surface: color-mix(in srgb, var(--x-brand) 5%, #131317);
|
|
350
|
+
--x-surface-2: color-mix(in srgb, var(--x-brand) 6%, #1b1b21);
|
|
351
|
+
--x-surface-3: color-mix(in srgb, var(--x-brand) 7%, #26262d);
|
|
352
|
+
--x-text: #f4f2f7;
|
|
353
|
+
--x-muted: #b9b3c6;
|
|
354
|
+
--x-faint: #948ea4;
|
|
355
|
+
--x-line: rgba(255, 255, 255, 0.10);
|
|
356
|
+
--x-line-2: rgba(255, 255, 255, 0.20);
|
|
357
|
+
--x-field: color-mix(in srgb, var(--x-brand) 4%, #0b0b0e);
|
|
358
|
+
--x-field-line: rgba(255, 255, 255, 0.18);
|
|
359
|
+
--x-hover: rgba(255, 255, 255, 0.06);
|
|
360
|
+
/* Hairlines carry a surface's edges, and a cut surface clips its own shadow
|
|
361
|
+
away, so this is only seen under what floats uncut: menus, popovers,
|
|
362
|
+
tooltips. One deep shadow, no glow. */
|
|
363
|
+
--x-elev: 0 22px 54px -26px rgba(0, 0, 0, 0.9);
|
|
364
|
+
--x-scrim: rgba(4, 3, 8, 0.66);
|
|
365
|
+
`;
|
|
366
|
+
const SIGNAL_LIGHT = `
|
|
367
|
+
color-scheme: light;
|
|
368
|
+
--x-canvas: color-mix(in srgb, var(--x-brand) 3%, #f4f4f6);
|
|
369
|
+
--x-grid: rgba(24, 18, 40, 0.055);
|
|
370
|
+
--x-bg:
|
|
371
|
+
linear-gradient(var(--x-grid) 1px, transparent 1px) 0 0 / 56px 56px,
|
|
372
|
+
linear-gradient(90deg, var(--x-grid) 1px, transparent 1px) 0 0 / 56px 56px,
|
|
373
|
+
radial-gradient(720px 360px at 86% -120px, color-mix(in srgb, var(--x-g3) 9%, transparent), transparent 70%),
|
|
374
|
+
radial-gradient(760px 380px at 8% -140px, color-mix(in srgb, var(--x-brand) 8%, transparent), transparent 70%),
|
|
375
|
+
var(--x-canvas);
|
|
376
|
+
--x-sidebar: color-mix(in srgb, var(--x-brand) 2%, #fbfbfc);
|
|
377
|
+
--x-surface: #ffffff;
|
|
378
|
+
--x-surface-2: color-mix(in srgb, var(--x-brand) 3%, #f6f6f8);
|
|
379
|
+
--x-surface-3: color-mix(in srgb, var(--x-brand) 4%, #ececf0);
|
|
380
|
+
--x-text: #1a1524;
|
|
381
|
+
--x-muted: #565062;
|
|
382
|
+
--x-faint: #6b6478;
|
|
383
|
+
--x-line: rgba(24, 18, 40, 0.12);
|
|
384
|
+
--x-line-2: rgba(24, 18, 40, 0.24);
|
|
385
|
+
--x-field: #ffffff;
|
|
386
|
+
--x-field-line: rgba(24, 18, 40, 0.24);
|
|
387
|
+
--x-hover: rgba(24, 18, 40, 0.045);
|
|
388
|
+
--x-elev: 0 18px 44px -26px rgba(24, 18, 40, 0.3);
|
|
389
|
+
--x-scrim: rgba(24, 18, 40, 0.38);
|
|
390
|
+
`;
|
|
391
|
+
/**
|
|
392
|
+
* The sheet for one design language, or `""` for classic. Inline it after
|
|
393
|
+
* `cssVariables()` on a server-rendered host; AppThemeProvider injects it for
|
|
394
|
+
* everyone else when given `language`.
|
|
395
|
+
*/
|
|
396
|
+
export function languageCss(language, opts) {
|
|
397
|
+
if (language !== "signal")
|
|
398
|
+
return "";
|
|
399
|
+
// On the document the attribute sits on the root, beside data-theme. In a
|
|
400
|
+
// scope it sits on the scope's own element (ThemeScope writes it there), so
|
|
401
|
+
// a scoped host needs no AppThemeProvider at the root to choose a language.
|
|
402
|
+
const scoped = opts?.scope ? `${scopeSelector(opts.scope).repeat(2)}[data-x-language="signal"]` : null;
|
|
403
|
+
const r = (q) => scoped ? (q ? `:root${q} ${scoped}` : scoped) : rootSelector(`[data-x-language="signal"]${q}`, opts, true);
|
|
404
|
+
const system = opts?.systemScheme !== false;
|
|
405
|
+
return `
|
|
406
|
+
${r("")} {
|
|
407
|
+
${SIGNAL_SHARED}${SIGNAL_DARK}}
|
|
408
|
+
|
|
409
|
+
${system ? `
|
|
410
|
+
@media (prefers-color-scheme: light) {
|
|
411
|
+
${r(':not([data-theme="dark"])')} {
|
|
412
|
+
${SIGNAL_LIGHT.replace(/^(?=.)/gm, " ")} }
|
|
413
|
+
}
|
|
414
|
+
` : ""}
|
|
415
|
+
|
|
416
|
+
${r('[data-theme="light"]')} {
|
|
417
|
+
${SIGNAL_LIGHT}}
|
|
418
|
+
`;
|
|
419
|
+
}
|
|
238
420
|
// v is a tiny typed helper so component styles read `${v.text}` instead of the
|
|
239
421
|
// raw var() incantation — a misspelt token is a build error, not a silent default.
|
|
240
422
|
const names = [
|
|
241
423
|
"brand", "grad", "grad-90", "on-brand",
|
|
242
424
|
"brand-08", "brand-12", "brand-16", "brand-22", "brand-55",
|
|
243
|
-
"font", "mono", "r-ctl", "r-card", "r-panel", "r-modal", "ring",
|
|
425
|
+
"font", "mono", "r-ctl", "r-card", "r-panel", "r-modal", "r-pill", "ring",
|
|
426
|
+
"display", "label", "label-case", "label-tracking",
|
|
427
|
+
"clip-ctl", "clip-tile", "clip-card", "clip-panel", "clip-modal", "edge-card", "edge-panel", "edge-modal",
|
|
428
|
+
"edge-size-card", "edge-size-panel", "edge-size-modal",
|
|
429
|
+
"edge-content", "edge-position",
|
|
244
430
|
"canvas", "bg", "sidebar", "surface", "surface-2", "surface-3", "text", "muted", "faint",
|
|
245
431
|
"line", "line-2", "field", "field-line", "hover", "elev", "scrim",
|
|
246
432
|
"danger", "danger-bg", "success", "success-bg", "warning", "warning-bg", "info", "info-bg",
|
|
@@ -298,7 +484,7 @@ export function globalCss() {
|
|
|
298
484
|
color: ${v.text};
|
|
299
485
|
}
|
|
300
486
|
|
|
301
|
-
:focus-visible { outline: none; box-shadow: ${v.ring}; border-radius: 4px; }
|
|
487
|
+
:focus-visible { outline: none; box-shadow: ${v.ring}; border-radius: min(4px, ${v.rCtl}); }
|
|
302
488
|
::selection { background: ${v.brand22}; }
|
|
303
489
|
|
|
304
490
|
* { scrollbar-width: thin; scrollbar-color: ${v.line2} transparent; }
|
package/dist/theme/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,iCAAiC;AACjC,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,yCAAyC;AAEzC,OAAO,EAAE,YAAY,EAAqB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,iCAAiC;AACjC,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,yCAAyC;AAEzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,OAAO,EAAE,SAAS;IAClB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;CACd,CAAC;AAEF,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,wBAAwB;AACxB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE;IAChF,SAAS,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAA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,UAAU,EAAE,QAAQ,EAAE;QAClD,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;QACzC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;QACzC,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE;KAC9C;IACD,MAAM,EAAE;QACN,mBAAmB,EAAE,SAAS;QAC9B,mBAAmB,EAAE,SAAS;QAC9B,6BAA6B,EAAE,SAAS;QACxC,mCAAmC,EAAE,SAAS;QAC9C,gCAAgC,EAAE,SAAS;QAC3C,4BAA4B,EAAE,SAAS;QACvC,+BAA+B,EAAE,SAAS;QAC1C,yBAAyB,EAAE,SAAS;QACpC,yBAAyB,EAAE,SAAS;QACpC,qBAAqB,EAAE,SAAS;QAChC,mCAAmC,EAAE,WAAW;QAChD,kCAAkC,EAAE,WAAW;QAC/C,4BAA4B,EAAE,WAAW;KAC1C;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeonr/platform-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "Xeonr Platform Suite design language: the --x-* token sheet, theme provider and kit shared by every Xeonr console.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"./markdown": {
|
|
22
22
|
"types": "./dist/markdown.d.ts",
|
|
23
23
|
"import": "./dist/markdown.js"
|
|
24
|
+
},
|
|
25
|
+
"./auth": {
|
|
26
|
+
"types": "./dist/auth.d.ts",
|
|
27
|
+
"import": "./dist/auth.js"
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
"files": [
|
|
@@ -60,6 +64,7 @@
|
|
|
60
64
|
"@fortawesome/react-fontawesome": "^3.0.2"
|
|
61
65
|
},
|
|
62
66
|
"devDependencies": {
|
|
67
|
+
"@babel/core": "^8.1.2",
|
|
63
68
|
"@eslint/js": "^9.39.5",
|
|
64
69
|
"@monaco-editor/react": "^4.7.0",
|
|
65
70
|
"@testing-library/dom": "^10.4.2",
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
"@types/react": "^19.1.0",
|
|
68
73
|
"@types/react-dom": "^19.1.0",
|
|
69
74
|
"@vitejs/plugin-react": "^4.7.0",
|
|
75
|
+
"babel-plugin-styled-components": "^2.4.0",
|
|
70
76
|
"eslint": "^9.39.5",
|
|
71
77
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
72
78
|
"jsdom": "^26.1.0",
|
|
@@ -83,7 +89,7 @@
|
|
|
83
89
|
"@xeonr/config": "^0.2.0"
|
|
84
90
|
},
|
|
85
91
|
"scripts": {
|
|
86
|
-
"build": "tsc -p tsconfig.build.json",
|
|
92
|
+
"build": "tsc -p tsconfig.build.json && node scripts/stable-styled-ids.mjs",
|
|
87
93
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
88
94
|
"lint": "eslint . && node scripts/check-colour-literals.mjs",
|
|
89
95
|
"test": "vitest run"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Gives every styled component in dist/ an id of its own, after tsc has built
|
|
3
|
+
// it. Part of `pnpm build`.
|
|
4
|
+
//
|
|
5
|
+
// Left alone, styled-components names a component `sc-` plus a hash of how
|
|
6
|
+
// many components were created before it. That depends on the order modules
|
|
7
|
+
// are evaluated in, and a server-rendered host does not evaluate them in the
|
|
8
|
+
// order its browser bundle does: the server loads every route up front, the
|
|
9
|
+
// browser only the routes it needs, and a second entry point into the kit
|
|
10
|
+
// (`/auth`, `/editor`, `/markdown`) is evaluated whenever something first
|
|
11
|
+
// asks for it. Every id after the first difference shifts, the class the
|
|
12
|
+
// server rendered is not the class the browser computes, and React reports a
|
|
13
|
+
// hydration mismatch on every one of them. auth/ui met this with its own
|
|
14
|
+
// components (AUTH-142) and again with the kit's when it took the sign-in
|
|
15
|
+
// surfaces from `@xeonr/platform-ui/auth`.
|
|
16
|
+
//
|
|
17
|
+
// babel-plugin-styled-components derives the id from the package name, the
|
|
18
|
+
// file's path inside the package and the component's position in the file, and
|
|
19
|
+
// adds it as `.withConfig({ componentId })`. Nothing else is switched on: no
|
|
20
|
+
// display names, no CSS minifying, no template rewriting. A host that is only
|
|
21
|
+
// ever rendered in the browser sees different class names and nothing else.
|
|
22
|
+
//
|
|
23
|
+
// Runs over dist rather than src so the kit keeps building with tsc alone and
|
|
24
|
+
// its tests keep running the source as written.
|
|
25
|
+
|
|
26
|
+
import { readdirSync, readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
27
|
+
import { dirname, join } from "node:path";
|
|
28
|
+
import { fileURLToPath } from "node:url";
|
|
29
|
+
import process from "node:process";
|
|
30
|
+
import { transformAsync } from "@babel/core";
|
|
31
|
+
import styledComponents from "babel-plugin-styled-components";
|
|
32
|
+
|
|
33
|
+
const DIST = join(dirname(fileURLToPath(import.meta.url)), "..", "dist");
|
|
34
|
+
|
|
35
|
+
function collect(dir) {
|
|
36
|
+
const out = [];
|
|
37
|
+
for (const ent of readdirSync(dir, { withFileTypes: true })) {
|
|
38
|
+
const p = join(dir, ent.name);
|
|
39
|
+
if (ent.isDirectory()) out.push(...collect(p));
|
|
40
|
+
else if (ent.name.endsWith(".js")) out.push(p);
|
|
41
|
+
}
|
|
42
|
+
return out.sort();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!existsSync(DIST)) {
|
|
46
|
+
console.error("stable-styled-ids: no dist/ to process; run tsc first");
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let files = 0;
|
|
51
|
+
let components = 0;
|
|
52
|
+
for (const file of collect(DIST)) {
|
|
53
|
+
const code = readFileSync(file, "utf8");
|
|
54
|
+
if (!code.includes("styled-components")) continue;
|
|
55
|
+
const mapFile = `${file}.map`;
|
|
56
|
+
const inputSourceMap = existsSync(mapFile) ? JSON.parse(readFileSync(mapFile, "utf8")) : undefined;
|
|
57
|
+
const out = await transformAsync(code, {
|
|
58
|
+
filename: file,
|
|
59
|
+
babelrc: false,
|
|
60
|
+
configFile: false,
|
|
61
|
+
compact: false,
|
|
62
|
+
retainLines: true,
|
|
63
|
+
sourceMaps: !!inputSourceMap,
|
|
64
|
+
inputSourceMap,
|
|
65
|
+
plugins: [[styledComponents, { ssr: true, displayName: false, fileName: false, minify: false, transpileTemplateLiterals: false, pure: false }]],
|
|
66
|
+
});
|
|
67
|
+
if (!out?.code) throw new Error(`stable-styled-ids: babel returned nothing for ${file}`);
|
|
68
|
+
const added = (out.code.match(/componentId:/g) ?? []).length - (code.match(/componentId:/g) ?? []).length;
|
|
69
|
+
if (added <= 0) continue;
|
|
70
|
+
writeFileSync(file, out.code.endsWith("\n") ? out.code : `${out.code}\n`);
|
|
71
|
+
if (out.map) writeFileSync(mapFile, JSON.stringify(out.map));
|
|
72
|
+
files += 1;
|
|
73
|
+
components += added;
|
|
74
|
+
}
|
|
75
|
+
console.log(`stable-styled-ids: ${components} components in ${files} files`);
|