@pantoken/components 0.1.0 → 0.2.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 CHANGED
@@ -1,3 +1,5 @@
1
+ import { ELEVATION_NAMES, FOCUSABLE_SELECTOR, elevationDeclarations, focusOutlineDeclarations, focusOutlineRules } from "@pantoken/utils";
2
+
1
3
  //#region src/lib/helpers.d.ts
2
4
  /**
3
5
  * Shared primitives for the component builders: the class-prefix namespace helper, the standalone-sheet
@@ -8,6 +10,8 @@
8
10
  */
9
11
  /** The default class prefix (`instui` → `.instui-button`). */
10
12
  declare const DEFAULT_PREFIX = "instui";
13
+ /** Theme keys emitted by `@pantoken/tokens`. */
14
+ type ComponentTheme = "rebrand" | "canvas" | "canvasHighContrast";
11
15
  /** Options common to every builder. */
12
16
  interface ComponentOptions {
13
17
  /**
@@ -17,6 +21,10 @@ interface ComponentOptions {
17
21
  * built with `"instui"`.
18
22
  */
19
23
  prefix?: string | null;
24
+ /**
25
+ * Target theme for emitted CSS. Defaults to `"rebrand"` when omitted.
26
+ */
27
+ theme?: ComponentTheme;
20
28
  }
21
29
  //#endregion
22
30
  //#region src/rules/prose.d.ts
@@ -36,25 +44,6 @@ interface ProseOptions {
36
44
  declare function proseCss(options?: ProseOptions): string;
37
45
  //#endregion
38
46
  //#region src/declarations/elevation.d.ts
39
- /**
40
- * The `--instui-elevation-*` shadow scale. Helpers only — NOT a documented record and not in any
41
- * registry: `componentsCss()` leads its sheet with `elevationCss()` so the shadows components
42
- * reference (modal, alert, menu) resolve from `components.css` alone.
43
- *
44
- * @module
45
- */
46
- /**
47
- * Every elevation level and alias emitted as `--instui-elevation-<name>` (`resting`, `above`,
48
- * `topmost`, `depth1`–`depth3`, `card`, `cardHover`). Derived from the geometry + alias maps.
49
- */
50
- declare const ELEVATION_NAMES: readonly string[];
51
- /**
52
- * The `--instui-elevation-*` name/value pairs (each a multi-layer `box-shadow`). Values reference the
53
- * themed drop-shadow colour tokens, so they adapt per theme wherever a token sheet is loaded.
54
- *
55
- * @returns One `[customProperty, value]` pair per level and alias.
56
- */
57
- declare function elevationDeclarations(): [name: string, value: string][];
58
47
  /**
59
48
  * Build the elevation token block: `<selector> { --instui-elevation-*: … }`. Shipped inside
60
49
  * `components.css` (so shadows are intrinsic — no plugin, no extra import), and reusable by other
@@ -77,24 +66,6 @@ declare function elevationCss(options?: {
77
66
  }): string;
78
67
  //#endregion
79
68
  //#region src/declarations/focus.d.ts
80
- /** The elements the ring applies to by default (the common interactive/focusable elements). */
81
- declare const FOCUSABLE_SELECTOR = "a, button, input, select, textarea, summary, [tabindex]";
82
- /**
83
- * The `--instui-focus-outline-*` name/value pairs the ring rules read. Colour/width/offset reference
84
- * the themed shared focus tokens; the transition, line style, and inset are constants.
85
- *
86
- * @returns One `[customProperty, value]` pair per focus-ring variable.
87
- */
88
- declare function focusOutlineDeclarations(): [name: string, value: string][];
89
- /**
90
- * The focus-ring rules for a given focusable selector: a transparent resting ring that transitions in
91
- * on `:focus-visible`, plus the `-focus-color-*` / `-focus-position-inset` / `-focus-within` /
92
- * `-without-focus-animation` modifiers. All `:where()`-wrapped, so zero-specificity.
93
- *
94
- * @param selector - The focusable selector the base ring applies to (default {@link FOCUSABLE_SELECTOR}).
95
- * @returns The CSS rules string.
96
- */
97
- declare function focusOutlineRules(selector?: string): string;
98
69
  /**
99
70
  * Build the focus-outline block: the `--instui-focus-outline-*` token defs plus the ring rules.
100
71
  * Baked into `base.css` (so focusables get the ring out of the box), and reusable by other layered
@@ -341,19 +312,22 @@ declare function iconGlyphsCss(names: readonly string[], options?: IconGlyphsOpt
341
312
  //#region src/index.d.ts
342
313
  /**
343
314
  * Build the opt-in base/reset stylesheet: global document defaults from the tokens (box-sizing, body
344
- * reset, page surface, base text colour/font, `color-scheme`, base link), followed by the focus ring
345
- * (a document-level default that targets bare focusables). Load it once, ahead of the component and
346
- * prose sheets, when pantoken owns the page.
315
+ * reset, page surface, base text colour/font, `color-scheme`, base link), followed by the focus-ring
316
+ * rules (a document-level default that targets bare focusables). Only the ring *rules* live here the
317
+ * `--instui-focus-outline-*` custom properties they read ship in the token sheet (`@pantoken/css`), so
318
+ * `base.css` no longer redefines them. Load it once, ahead of the component and prose sheets, when
319
+ * pantoken owns the page.
347
320
  *
348
321
  * @returns The CSS string.
349
322
  */
350
323
  declare function baseCss(): string;
351
324
  /**
352
- * Build the aggregated component stylesheet: the `--instui-elevation-*` scale (so shadows are intrinsic)
353
- * followed by every component's rules in the `COMPONENTS` concat order. The size-alias and
354
- * deprecated-alias twins are appended PER COMPONENT (within its own chunk) so each alias documents on
355
- * its own page the deprecated aliases are discovered from each record's `@deprecated {@link -x}`
356
- * metadata (see `withAliases`), not a central hand-kept list.
325
+ * Build the aggregated component stylesheet: every component's rules in the `COMPONENTS` concat order.
326
+ * The size-alias and deprecated-alias twins are appended PER COMPONENT (within its own chunk) so each
327
+ * alias documents on its own page the deprecated aliases are discovered from each record's
328
+ * `@deprecated {@link -x}` metadata (see `withAliases`), not a central hand-kept list. The
329
+ * `--instui-elevation-*` shadow scale the components reference is defined in the token sheet
330
+ * (`@pantoken/css`), so it's no longer inlined here.
357
331
  *
358
332
  * @param options - {@link ComponentOptions}.
359
333
  * @returns The CSS string.