@pantoken/css 0.3.11 → 0.4.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.d.mts +113 -2
- package/dist/index.mjs +2 -2
- package/dist/inject.mjs +1 -1
- package/dist/properties.css +1 -0
- package/dist/properties.lean.css +1 -0
- package/dist/schemes.css +1 -0
- package/dist/scope.css +1 -0
- package/dist/scope.lean.css +1 -0
- package/dist/src-h17qjVzD.mjs +417 -0
- package/dist/style.canvas-high-contrast.css +1 -1
- package/dist/style.canvas-high-contrast.lean.css +1 -1
- package/dist/style.canvas.css +1 -1
- package/dist/style.canvas.lean.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.lean.css +1 -1
- package/dist/style.rebrand.light.css +1 -1
- package/dist/style.rebrand.light.lean.css +1 -1
- package/package.json +12 -7
- package/dist/src-YRQrYIS8.mjs +0 -257
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { checkPlugins, definePlugin } from "@pantoken/plugin-kit";
|
|
2
|
+
import { BOUNDARY_ATTR, BOUNDARY_CLASS, COLOR_ATTR, SCHEME_ATTR, SCOPE_LAYERS, THEME_ATTR, colorClass, elevationDeclarations, focusOutlineDeclarations, schemeClass, schemeScopeSelector, schemeScopeSelectors, themeClass, themeScopeSelector, themeScopeSelectors } from "@pantoken/utils";
|
|
3
|
+
import { byTheme } from "@pantoken/tokens";
|
|
4
|
+
//#region src/foundation.ts
|
|
5
|
+
/**
|
|
6
|
+
* The elevation (`--instui-elevation-*`) and focus-outline (`--instui-focus-outline-*`) composite
|
|
7
|
+
* custom properties shared by the ready-made token sheets and docs-only themed token sheet.
|
|
8
|
+
*/
|
|
9
|
+
const foundationPlugin = definePlugin({
|
|
10
|
+
name: "pantoken-foundation",
|
|
11
|
+
css: () => ({
|
|
12
|
+
marker: "pantoken foundation — elevation + focus-outline custom properties",
|
|
13
|
+
declarations: [...elevationDeclarations(), ...focusOutlineDeclarations()]
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/theme-variants.ts
|
|
18
|
+
const ICON_TOKEN_PREFIX = "--instui-icon-";
|
|
19
|
+
function withoutIcons(tokens) {
|
|
20
|
+
return tokens.filter((t) => !t.name.startsWith(ICON_TOKEN_PREFIX));
|
|
21
|
+
}
|
|
22
|
+
/** Split the top-level comma of a `light-dark(light, dark)` value; `null` when it isn't one. */
|
|
23
|
+
function splitLightDark(value) {
|
|
24
|
+
const trimmed = value.trim();
|
|
25
|
+
if (!trimmed.startsWith("light-dark(") || !trimmed.endsWith(")")) return null;
|
|
26
|
+
const inner = trimmed.slice(11, -1);
|
|
27
|
+
let depth = 0;
|
|
28
|
+
for (let i = 0; i < inner.length; i += 1) {
|
|
29
|
+
const char = inner[i];
|
|
30
|
+
if (char === "(") depth += 1;
|
|
31
|
+
else if (char === ")") depth = Math.max(0, depth - 1);
|
|
32
|
+
else if (char === "," && depth === 0) return [inner.slice(0, i).trim(), inner.slice(i + 1).trim()];
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
/** The light branch of a `light-dark()` value, or `null` when the value isn't one. */
|
|
37
|
+
function lightBranch(value) {
|
|
38
|
+
return splitLightDark(value)?.[0] ?? null;
|
|
39
|
+
}
|
|
40
|
+
/** The dark branch of a `light-dark()` value, or `null` when the value isn't one. */
|
|
41
|
+
function darkBranch(value) {
|
|
42
|
+
return splitLightDark(value)?.[1] ?? null;
|
|
43
|
+
}
|
|
44
|
+
function collapseScheme(tokens, scheme) {
|
|
45
|
+
const pick = scheme === "light" ? lightBranch : darkBranch;
|
|
46
|
+
return tokens.map((token) => {
|
|
47
|
+
const branch = pick(token.value);
|
|
48
|
+
if (!branch) return token;
|
|
49
|
+
return {
|
|
50
|
+
...token,
|
|
51
|
+
value: branch,
|
|
52
|
+
themed: false
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The tokens whose value actually changes when a theme is pinned to `scheme` — i.e. the ones written
|
|
58
|
+
* with `light-dark()`. This is the minimal forcing block for `[data-pantoken-scheme]`.
|
|
59
|
+
*/
|
|
60
|
+
function schemeOverrideTokens(theme, scheme) {
|
|
61
|
+
const source = byTheme(theme);
|
|
62
|
+
return collapseScheme(source, scheme).filter((token, i) => token.value !== source[i]?.value);
|
|
63
|
+
}
|
|
64
|
+
/** Build a theme token set with optional icon removal and light/dark collapse. */
|
|
65
|
+
function themedTokens(theme, options) {
|
|
66
|
+
const { includeIcons = true, lightOnly = false, scheme } = options ?? {};
|
|
67
|
+
const pinned = scheme ?? (lightOnly ? "light" : void 0);
|
|
68
|
+
const themeTokens = byTheme(theme);
|
|
69
|
+
const modeTokens = pinned ? collapseScheme(themeTokens, pinned) : themeTokens;
|
|
70
|
+
return includeIcons ? modeTokens : withoutIcons(modeTokens);
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/emit.ts
|
|
74
|
+
function renderSection(scope, { layer, pairs }) {
|
|
75
|
+
const declarations = [
|
|
76
|
+
` ${scope} {`,
|
|
77
|
+
...pairs.map(([name, val]) => ` ${name}: ${val.trim()};`),
|
|
78
|
+
" }"
|
|
79
|
+
];
|
|
80
|
+
return layer ? [
|
|
81
|
+
`@layer ${layer} {`,
|
|
82
|
+
...declarations,
|
|
83
|
+
"}"
|
|
84
|
+
].join("\n") : declarations.join("\n");
|
|
85
|
+
}
|
|
86
|
+
function renderProperty({ name, syntax, value }, inherits) {
|
|
87
|
+
return [
|
|
88
|
+
`@property ${name} {`,
|
|
89
|
+
` syntax: "${syntax}";`,
|
|
90
|
+
` inherits: ${inherits};`,
|
|
91
|
+
` initial-value: ${value.trim()};`,
|
|
92
|
+
`}`
|
|
93
|
+
].join("\n");
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build a CSS file string: typed `@property` registrations (top-level, theme-agnostic) followed by
|
|
97
|
+
* one or more scoped declaration sections (whose selector the consuming build may rewrite).
|
|
98
|
+
*
|
|
99
|
+
* @example Register one typed property and emit a scoped declaration
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { buildCssFile } from "@pantoken/css";
|
|
102
|
+
*
|
|
103
|
+
* buildCssFile({
|
|
104
|
+
* comments: ["/* my tokens *\/"],
|
|
105
|
+
* scope: ":root",
|
|
106
|
+
* properties: [{ name: "--instui-color-brand", syntax: "<color>", value: "#0374b5" }],
|
|
107
|
+
* sections: [{ pairs: [["--instui-color-text-base", "var(--instui-color-brand)"]] }],
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example Wrap a section in a CSS cascade layer
|
|
112
|
+
* ```ts
|
|
113
|
+
* import { buildCssFile } from "@pantoken/css";
|
|
114
|
+
*
|
|
115
|
+
* buildCssFile({
|
|
116
|
+
* comments: [],
|
|
117
|
+
* scope: ":root",
|
|
118
|
+
* sections: [{ layer: "pantoken", pairs: [["--instui-spacing-space-md", "1rem"]] }],
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
function buildCssFile({ comments, scope, properties = [], sections, inherits = true }) {
|
|
123
|
+
const blocks = [properties.map((p) => renderProperty(p, inherits)).join("\n\n"), ...sections.filter((s) => s.pairs.length > 0).map((s) => renderSection(scope, s))].filter(Boolean);
|
|
124
|
+
return [
|
|
125
|
+
`/* DO NOT EDIT — generated by @pantoken/css */`,
|
|
126
|
+
"",
|
|
127
|
+
...comments,
|
|
128
|
+
"",
|
|
129
|
+
...blocks,
|
|
130
|
+
""
|
|
131
|
+
].join("\n");
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/to-css.ts
|
|
135
|
+
/**
|
|
136
|
+
* `toCss` — turn the token IR into CSS: concrete tokens become typed `@property` registrations,
|
|
137
|
+
* themed/reference tokens become scoped declarations. Plugins can contribute or post-process CSS.
|
|
138
|
+
*
|
|
139
|
+
* @module
|
|
140
|
+
*/
|
|
141
|
+
/** True when a value cannot be a typed `@property` initial-value (`var()` / `light-dark()`). */
|
|
142
|
+
function isContextual(value) {
|
|
143
|
+
return /var\(|light-dark\(/.test(value);
|
|
144
|
+
}
|
|
145
|
+
function marked(marker, css) {
|
|
146
|
+
return marker ? `/* ${marker} */\n${css}` : css;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Emit CSS for a token IR.
|
|
150
|
+
*
|
|
151
|
+
* @param tokens - The IR (e.g. from `@pantoken/tokens`).
|
|
152
|
+
* @param options - {@link ToCssOptions}.
|
|
153
|
+
* @returns The CSS string.
|
|
154
|
+
*
|
|
155
|
+
* @example Build the default stylesheet
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { toCss } from "@pantoken/css";
|
|
158
|
+
* import { tokens } from "@pantoken/tokens";
|
|
159
|
+
*
|
|
160
|
+
* const stylesheet = toCss(tokens); // declarations under :root
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example Scope declarations to a class and build another theme
|
|
164
|
+
* ```ts
|
|
165
|
+
* import { toCss } from "@pantoken/css";
|
|
166
|
+
* import { byTheme } from "@pantoken/tokens";
|
|
167
|
+
*
|
|
168
|
+
* toCss(byTheme("canvas"), { scope: '[class*="instui"]' });
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @example Post-process with a plugin css hook
|
|
172
|
+
* ```ts
|
|
173
|
+
* import { toCss } from "@pantoken/css";
|
|
174
|
+
* import { tokens } from "@pantoken/tokens";
|
|
175
|
+
*
|
|
176
|
+
* toCss(tokens, {
|
|
177
|
+
* plugins: [
|
|
178
|
+
* {
|
|
179
|
+
* name: "focus",
|
|
180
|
+
* css: () => ({ append: ":focus-visible { outline: 2px solid var(--instui-focus-color); }" }),
|
|
181
|
+
* },
|
|
182
|
+
* ],
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
function toCss(tokens, options = {}) {
|
|
187
|
+
const { scope = ":root", layer, emit = "all", declareAll = false, plugins = [] } = options;
|
|
188
|
+
const properties = [];
|
|
189
|
+
const declarations = [];
|
|
190
|
+
for (const token of tokens) if (declareAll || isContextual(token.value)) declarations.push([token.name, token.value]);
|
|
191
|
+
else properties.push({
|
|
192
|
+
name: token.name,
|
|
193
|
+
syntax: token.syntax,
|
|
194
|
+
value: token.value
|
|
195
|
+
});
|
|
196
|
+
let css = buildCssFile({
|
|
197
|
+
comments: ["/* Instructure design tokens + icon set (pantoken) */", "/* Concrete tokens are registered with @property; themed/reference tokens are declarations. */"],
|
|
198
|
+
scope,
|
|
199
|
+
properties: emit === "declarations" ? [] : properties,
|
|
200
|
+
sections: emit === "properties" ? [] : [{
|
|
201
|
+
layer,
|
|
202
|
+
pairs: declarations
|
|
203
|
+
}]
|
|
204
|
+
});
|
|
205
|
+
const prepends = [];
|
|
206
|
+
const appends = [];
|
|
207
|
+
for (const plugin of checkPlugins(plugins, "css")) {
|
|
208
|
+
const c = plugin.css?.({
|
|
209
|
+
tokens,
|
|
210
|
+
css
|
|
211
|
+
});
|
|
212
|
+
if (!c) continue;
|
|
213
|
+
appendContribution(c, prepends, appends, {
|
|
214
|
+
scope,
|
|
215
|
+
emit,
|
|
216
|
+
declareAll
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return [
|
|
220
|
+
...prepends,
|
|
221
|
+
css,
|
|
222
|
+
...appends
|
|
223
|
+
].filter(Boolean).join("\n\n");
|
|
224
|
+
}
|
|
225
|
+
function appendContribution(c, prepends, appends, { scope, emit, declareAll }) {
|
|
226
|
+
if (c.prepend && emit !== "properties") prepends.push(marked(c.marker, c.prepend));
|
|
227
|
+
const typedProps = [];
|
|
228
|
+
const declPairs = [...c.declarations ?? []];
|
|
229
|
+
for (const p of c.properties ?? []) if (declareAll || isContextual(p.value)) declPairs.push([p.name, p.value]);
|
|
230
|
+
else typedProps.push(p);
|
|
231
|
+
const extraProps = emit === "declarations" ? "" : typedProps.map((p) => `@property ${p.name} {\n syntax: "${p.syntax}";\n inherits: true;\n initial-value: ${p.value};\n}`).join("\n\n");
|
|
232
|
+
const emitDecls = emit !== "properties";
|
|
233
|
+
const block = [
|
|
234
|
+
extraProps,
|
|
235
|
+
emitDecls && declPairs.length ? `${scope} {\n${declPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}\n}` : "",
|
|
236
|
+
emitDecls ? c.append : ""
|
|
237
|
+
].filter(Boolean).join("\n\n");
|
|
238
|
+
if (block) appends.push(marked(c.marker, block));
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/scoped.ts
|
|
242
|
+
/**
|
|
243
|
+
* Multi-scope sheets: token blocks keyed to an attribute on *any* element rather than `:root`, so
|
|
244
|
+
* several themes and color schemes can be active in one document at once.
|
|
245
|
+
*
|
|
246
|
+
* Three things make that work:
|
|
247
|
+
*
|
|
248
|
+
* 1. `@property` registrations are document-global, so they are emitted once by {@link propertiesCss}
|
|
249
|
+
* and every theme block is declarations only.
|
|
250
|
+
* 2. A scope block declares the *complete* token set, not a diff against the default. A diff block
|
|
251
|
+
* nested inside another theme's subtree would inherit the enclosing theme's values for every
|
|
252
|
+
* token it omitted.
|
|
253
|
+
* 3. Theme, scheme, and color blocks live in separate cascade layers so that when all three
|
|
254
|
+
* attributes sit on the same element the more specific intent wins deterministically.
|
|
255
|
+
*
|
|
256
|
+
* @module
|
|
257
|
+
*/
|
|
258
|
+
/** Cascade layers this module emits into, in ascending precedence order. */
|
|
259
|
+
const LAYERS = SCOPE_LAYERS;
|
|
260
|
+
/** The `@layer` statement that fixes layer precedence. Must come before any layered rule. */
|
|
261
|
+
const layerOrderCss = () => `@layer ${LAYERS.join(", ")};`;
|
|
262
|
+
/**
|
|
263
|
+
* The document-global `@property` registrations, with no declarations. Load this once per document;
|
|
264
|
+
* every theme sheet below is declarations only, so loading a second theme cannot clobber it.
|
|
265
|
+
*/
|
|
266
|
+
function propertiesCss(theme, options = {}) {
|
|
267
|
+
const { includeIcons = true, plugins = [] } = options;
|
|
268
|
+
return toCss(themedTokens(theme, { includeIcons }), {
|
|
269
|
+
emit: "properties",
|
|
270
|
+
plugins
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* One theme's complete token set, scoped to any element carrying `data-pantoken-theme="<theme>"` or
|
|
275
|
+
* the equivalent `.--pantoken-theme-<theme>` class.
|
|
276
|
+
*
|
|
277
|
+
* Every token is emitted as a declaration — including the concrete ones that would normally become
|
|
278
|
+
* `@property` initial-values — because an initial-value is document-global and cannot vary per scope.
|
|
279
|
+
*/
|
|
280
|
+
function scopedThemeCss(theme, options = {}) {
|
|
281
|
+
const { includeIcons = true, plugins = [] } = options;
|
|
282
|
+
return toCss(themedTokens(theme, { includeIcons }), {
|
|
283
|
+
scope: themeScopeSelectors(theme),
|
|
284
|
+
layer: "pantoken.theme",
|
|
285
|
+
emit: "declarations",
|
|
286
|
+
declareAll: true,
|
|
287
|
+
plugins
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Pin a subtree's color scheme.
|
|
292
|
+
*
|
|
293
|
+
* `color-scheme` is an ordinary inherited property, so one rule keyed to the scope attribute (or its
|
|
294
|
+
* class twin) resolves every `light-dark()` token below it. No token needs flattening: this sheet is
|
|
295
|
+
* a couple of hundred bytes, not the ~87kb an explicit per-token override table would cost.
|
|
296
|
+
*/
|
|
297
|
+
function scopedSchemeCss(scheme) {
|
|
298
|
+
return [
|
|
299
|
+
"@layer pantoken.scheme {",
|
|
300
|
+
` ${schemeScopeSelectors(scheme)} {`,
|
|
301
|
+
` color-scheme: ${scheme};`,
|
|
302
|
+
" }",
|
|
303
|
+
"}"
|
|
304
|
+
].join("\n");
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The light and dark scheme pins, as a standalone sheet. Theme-independent — the scheme only decides
|
|
308
|
+
* which branch of `light-dark()` wins, which the browser does for us.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* import { schemesCss } from "@pantoken/css";
|
|
313
|
+
*
|
|
314
|
+
* schemesCss();
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
function schemesCss() {
|
|
318
|
+
return [scopedSchemeCss("light"), scopedSchemeCss("dark")].join("\n\n");
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The complete multi-scope sheet: layer order, one set of `@property` registrations, a shared base
|
|
322
|
+
* block, a token block per theme, and the light/dark `color-scheme` pins.
|
|
323
|
+
*
|
|
324
|
+
* Tokens are partitioned by whether their value actually varies across `themes`. Invariant tokens go
|
|
325
|
+
* in the shared base block once; varying tokens are repeated in full in *every* theme block. That
|
|
326
|
+
* second half is what makes nesting safe — a theme block that omitted a varying token would inherit
|
|
327
|
+
* the enclosing scope's value for it.
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* import { multiScopeCss } from "@pantoken/css";
|
|
332
|
+
*
|
|
333
|
+
* multiScopeCss({ themes: ["rebrand", "canvas"], defaultTheme: "rebrand" });
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
function multiScopeCss(options) {
|
|
337
|
+
const { themes, defaultTheme, schemes = true, includeIcons = true, plugins = [] } = options;
|
|
338
|
+
const perTheme = new Map(themes.map((t) => [t, themedTokens(t, { includeIcons })]));
|
|
339
|
+
const varying = /* @__PURE__ */ new Set();
|
|
340
|
+
const seen = /* @__PURE__ */ new Map();
|
|
341
|
+
for (const tokens of perTheme.values()) for (const token of tokens) {
|
|
342
|
+
const previous = seen.get(token.name);
|
|
343
|
+
if (previous === void 0) seen.set(token.name, token.value);
|
|
344
|
+
else if (previous !== token.value) varying.add(token.name);
|
|
345
|
+
}
|
|
346
|
+
const baseTokens = (perTheme.get(defaultTheme) ?? []).filter((t) => !varying.has(t.name));
|
|
347
|
+
const blocks = [
|
|
348
|
+
layerOrderCss(),
|
|
349
|
+
propertiesCss(defaultTheme, {
|
|
350
|
+
includeIcons,
|
|
351
|
+
plugins
|
|
352
|
+
}),
|
|
353
|
+
toCss(baseTokens, {
|
|
354
|
+
scope: ":root",
|
|
355
|
+
layer: "pantoken.base",
|
|
356
|
+
emit: "declarations",
|
|
357
|
+
plugins
|
|
358
|
+
})
|
|
359
|
+
];
|
|
360
|
+
for (const theme of themes) {
|
|
361
|
+
const tokens = (perTheme.get(theme) ?? []).filter((t) => varying.has(t.name));
|
|
362
|
+
blocks.push(toCss(tokens, {
|
|
363
|
+
scope: themeScopeSelectors(theme),
|
|
364
|
+
layer: "pantoken.theme",
|
|
365
|
+
emit: "declarations",
|
|
366
|
+
declareAll: true
|
|
367
|
+
}));
|
|
368
|
+
}
|
|
369
|
+
if (schemes) blocks.push(schemesCss());
|
|
370
|
+
return blocks.filter(Boolean).join("\n\n");
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/index.ts
|
|
374
|
+
/**
|
|
375
|
+
* `@pantoken/css` — emit Instructure design tokens as `@property`-typed CSS.
|
|
376
|
+
*
|
|
377
|
+
* {@link toCss} turns any token IR into CSS; {@link css} is the ready-made `rebrand` stylesheet and
|
|
378
|
+
* {@link leanCss} is a lean variant that drops the full `--instui-icon-*` set (the ~1,777 icon data-URIs
|
|
379
|
+
* that dominate the sheet) for CDN/embed delivery — ~a sixth the size over the wire. Both carry the
|
|
380
|
+
* elevation + focus-outline foundation (composite custom properties whose pure builders live in
|
|
381
|
+
* `@pantoken/utils`), so a component sheet resolves its shadows and focus ring against the token sheet
|
|
382
|
+
* alone. A DOM side-effect entry lives at `@pantoken/css/inject`; static files at
|
|
383
|
+
* `@pantoken/css/style.css` and `@pantoken/css/style.lean.css`.
|
|
384
|
+
*
|
|
385
|
+
* @module
|
|
386
|
+
* @beta
|
|
387
|
+
*/
|
|
388
|
+
function themedCss(theme, options) {
|
|
389
|
+
return toCss(themedTokens(theme, options), { plugins: [foundationPlugin] });
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* The ready-made `rebrand` stylesheet string (typed: concrete tokens as `@property` registrations).
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* import { css } from "@pantoken/css";
|
|
397
|
+
*
|
|
398
|
+
* document.head.insertAdjacentHTML("beforeend", `<style>${css}</style>`);
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
const css = themedCss("rebrand");
|
|
402
|
+
/**
|
|
403
|
+
* The lean `rebrand` stylesheet string — the full sheet minus the `--instui-icon-*` glyph tokens (the
|
|
404
|
+
* ~1,777 icon data-URIs that make up most of {@link css}). Roughly a sixth the size over the wire; the
|
|
405
|
+
* recommended foundation for CDN/embed delivery. Components reference only a handful of icons, shipped
|
|
406
|
+
* separately as `@pantoken/components`'s `component-icons.css`; consumers who use `var(--instui-icon-*)`
|
|
407
|
+
* broadly should load the full {@link css} (or the `icons.css` glyph sheet). See
|
|
408
|
+
* `@pantoken/css/style.lean.css`.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```ts
|
|
412
|
+
* import { leanCss } from "@pantoken/css";
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
const leanCss = toCss(themedTokens("rebrand", { includeIcons: false }), { plugins: [foundationPlugin] });
|
|
416
|
+
//#endregion
|
|
417
|
+
export { buildCssFile as C, themedTokens as D, schemeOverrideTokens as E, toCss as S, lightBranch as T, scopedSchemeCss as _, COLOR_ATTR as a, themeScopeSelector as b, THEME_ATTR as c, multiScopeCss as d, propertiesCss as f, schemesCss as g, schemeScopeSelectors as h, BOUNDARY_CLASS as i, colorClass as l, schemeScopeSelector as m, leanCss as n, LAYERS as o, schemeClass as p, BOUNDARY_ATTR as r, SCHEME_ATTR as s, css as t, layerOrderCss as u, scopedThemeCss as v, darkBranch as w, themeScopeSelectors as x, themeClass as y };
|