@pontive/pontkit-core 1.28.0 → 1.30.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.
Files changed (43) hide show
  1. package/catalog.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/components/renderers/auth/scope-list/_scope-list.d.ts +1 -1
  4. package/dist/components/renderers/auth/scope-list/scope-list.types.d.ts +1 -1
  5. package/dist/components/widgets/pont-consent/consent-api.d.ts +1 -1
  6. package/dist/components/widgets/pont-consent/pont-consent.d.ts +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/pont2/core/names.d.ts +1 -1
  10. package/dist/pont2/globals.css +19 -7
  11. package/dist/pont2/index.mjs +678 -617
  12. package/dist/pont2/index.mjs.map +1 -1
  13. package/dist/pont2/kit/alert/alert.d.ts +2 -1
  14. package/dist/pont2/kit/block/block.d.ts +3 -1
  15. package/dist/pont2/kit/flow-widget/preview.d.ts +46 -0
  16. package/dist/pont2/kit/index.d.ts +1 -0
  17. package/dist/pont2/kit/link/link.d.ts +2 -0
  18. package/dist/pont2/kit/otp-field/otp-resend.d.ts +2 -0
  19. package/dist/pont2/kit/qr-code/qr-code.d.ts +1 -0
  20. package/dist/pont2/kit/recovery-codes/recovery-codes.d.ts +1 -0
  21. package/dist/pont2/kit/typography/typography.d.ts +4 -0
  22. package/dist/pont2/kit/watermark/watermark.d.ts +2 -0
  23. package/dist/pont2/primitives/card/card.d.ts +3 -1
  24. package/dist/pont2/primitives/dropdown-menu/dropdown-menu.d.ts +5 -0
  25. package/dist/pont2/primitives/popover/popover.d.ts +2 -0
  26. package/dist/pont2/primitives/tooltip/tooltip.d.ts +2 -0
  27. package/dist/pont2/styles.css +2433 -1026
  28. package/dist/pont2/theme/apply.d.ts +29 -0
  29. package/dist/pont2/theme/compile.d.ts +23 -0
  30. package/dist/pont2/theme/index.d.ts +23 -0
  31. package/dist/pont2/theme/manifest.d.ts +2 -0
  32. package/dist/pont2/theme/scopes.d.ts +13 -0
  33. package/dist/pont2/theme/shadcn.d.ts +7 -0
  34. package/dist/pont2/theme/tokens.json.d.ts +7009 -0
  35. package/dist/pont2/theme/types.d.ts +92 -0
  36. package/dist/pont2/theme/validate.d.ts +11 -0
  37. package/dist/pont2/theme/value.d.ts +10 -0
  38. package/dist/pont2/theme/vocabulary.d.ts +32 -0
  39. package/dist/pont2/theme.mjs +337 -0
  40. package/dist/pont2/theme.mjs.map +1 -0
  41. package/dist/pont2/tokens.json +7006 -0
  42. package/dist/pont2/with-legacy.css +1 -1
  43. package/package.json +8 -2
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Types for pont2 themes and the token manifest (docs/11-tokens.md §8, §9).
3
+ *
4
+ * Framework-free: nothing here (or anywhere in src/theme/) imports Lit or
5
+ * registers elements, so the dashboard and a Node backend can use it.
6
+ */
7
+ /** What kind of CSS value a token holds. Decides how theme values are validated. */
8
+ export type TokenType = "color" | "dimension" | "number" | "fontFamily" | "fontWeight" | "shadow" | "duration" | "cubicBezier"
9
+ /** A mode switch (`sem-mode-*`): follows the colour scheme, never themed. */
10
+ | "keyword";
11
+ /** ref: raw palettes (global only). sem: design roles. component: a component's public API. */
12
+ export type TokenTier = "ref" | "sem" | "component";
13
+ /** One token, as the manifest describes it. Names omit the `--pont2-` prefix. */
14
+ export interface TokenDef {
15
+ tier: TokenTier;
16
+ type: TokenType;
17
+ /** The default: the declared value (ref/sem) or the fallback (component), as CSS. */
18
+ value: string;
19
+ /** The dark-mode default, when pont2 declares one (sem colours). */
20
+ dark?: string;
21
+ /** Tokens `value` reads (without the prefix). */
22
+ refs?: string[];
23
+ /** Tokens `dark` reads. */
24
+ darkRefs?: string[];
25
+ /** Component tokens: the human label from the `@token` annotation. */
26
+ label?: string;
27
+ /** Component tokens: the component the token belongs to (`button`, `provider-button` …). */
28
+ component?: string;
29
+ /** Component tokens: the selectors whose private resolves this token. */
30
+ appliesTo?: string[];
31
+ /** Component tokens: the private custom property that resolves it on the element. */
32
+ private?: string;
33
+ /** The stylesheet that declares or reads it, relative to pont2/src. */
34
+ source: string;
35
+ }
36
+ export interface TokenManifest {
37
+ version: 1;
38
+ /**
39
+ * A hash of everything compiled output depends on (token names, tiers, types
40
+ * and defaults, scopes, aliases, layer order, dark selectors). compileTheme
41
+ * writes it into the CSS header; CSS whose fingerprint differs from the
42
+ * current manifest's was compiled against another token API and should be
43
+ * recompiled from its stored theme (docs/12-theming-integration.md).
44
+ */
45
+ fingerprint: string;
46
+ /** The shared `@layer …;` order statement (styles/layers.css). */
47
+ layers: string;
48
+ dark: {
49
+ /** The full dark-mode selector list the sem tokens use. */
50
+ selector: string;
51
+ /** The same list without `:root`-qualified entries, for use inside `:where()`. */
52
+ within: string;
53
+ };
54
+ /** Theme scope name → the element it scopes (`signin` → `pont2-signin`). */
55
+ scopes: Record<string, string>;
56
+ /** Renamed tokens: old name → new name. Themes using an old name are migrated. */
57
+ aliases: Record<string, string>;
58
+ tokens: Record<string, TokenDef>;
59
+ }
60
+ /** Token name (without `--pont2-`) → CSS value. */
61
+ export type TokenValues = Record<string, string>;
62
+ /**
63
+ * Values for one scope, per mode. A colour (sem or component) applies to the
64
+ * mode it is given for; the other mode keeps its own value. Every other token
65
+ * applies to both modes unless a dark value is given.
66
+ */
67
+ export interface ThemeScope {
68
+ light?: TokenValues;
69
+ dark?: TokenValues;
70
+ }
71
+ /** What the dashboard stores (docs/11-tokens.md §8). */
72
+ export interface PontTheme {
73
+ version: 1;
74
+ /** On `:root`: ref, sem and component tokens. */
75
+ global?: ThemeScope;
76
+ /**
77
+ * Per widget scope (`signin`, `signup` …): component tokens only. Global
78
+ * roles (ref palettes, sem colours, radius …) are set once, globally.
79
+ */
80
+ widgets?: Record<string, ThemeScope>;
81
+ }
82
+ export interface ThemeIssue {
83
+ /** Where in the theme, e.g. `widgets.signin.light.sem-radius`. */
84
+ path: string;
85
+ message: string;
86
+ }
87
+ export interface CompileOptions {
88
+ /** Which theme layer to fill (default `brand`; presets use `preset`). */
89
+ layer?: "brand" | "preset";
90
+ /** The manifest to compile against (default: the one shipped with pont2). */
91
+ manifest?: TokenManifest;
92
+ }
@@ -0,0 +1,11 @@
1
+ import { PontTheme, ThemeIssue, TokenManifest } from './types';
2
+ /** Rename tokens listed in the manifest's `aliases` (old → new). Returns a new theme. */
3
+ export declare function migrateTheme(theme: PontTheme, manifest?: TokenManifest): PontTheme;
4
+ /**
5
+ * Every problem with a theme, or `[]`. Checks the shape, that each token
6
+ * exists, the scope rules (widgets take component tokens only; ref tokens have
7
+ * no mode), and each
8
+ * value against its token's type (value.ts). Run `migrateTheme` first if the
9
+ * theme may use renamed tokens (compileTheme does).
10
+ */
11
+ export declare function validateTheme(theme: unknown, manifest?: TokenManifest): ThemeIssue[];
@@ -0,0 +1,10 @@
1
+ import { TokenType } from './types';
2
+ export interface ValueContext {
3
+ /** Whether `var(--pont2-<name>)` may be used in this value (name without the prefix). */
4
+ canReference(name: string): boolean;
5
+ }
6
+ /**
7
+ * Check one theme value against its token's type. Returns an error message,
8
+ * or null when the value is acceptable.
9
+ */
10
+ export declare function checkValue(type: TokenType, raw: unknown, ctx: ValueContext): string | null;
@@ -0,0 +1,32 @@
1
+ import { TokenType } from './types';
2
+ /**
3
+ * The property suffixes a component token may end in, and the type each
4
+ * implies. Extend deliberately, and document the addition in 11 §3.
5
+ */
6
+ export declare const PROPERTY_TYPES: Readonly<Record<string, TokenType>>;
7
+ /** State suffixes, placed after the property: `--pont2-button-default-bg-hover`. */
8
+ export declare const STATES: readonly ["hover", "active", "focus", "disabled", "invalid", "checked", "open"];
9
+ /** `--pont2-shadow` and `--pont2-ring-shadow`: the box-shadow composition helpers (base.css). */
10
+ export declare const SHADOW_HELPERS: readonly ["shadow", "ring-shadow"];
11
+ /**
12
+ * `--pont2-*` variables that are not tokens, so they are neither in the
13
+ * manifest nor themable, but component CSS may read them directly:
14
+ * - runtime inputs pont2's own scripts write per element: the popup
15
+ * positioning variables (core/popup/anchored.ts) and Gap's size attribute;
16
+ * - author knobs whose values a theme cannot carry: mask-image URLs.
17
+ */
18
+ export declare const NON_TOKEN_VARIABLES: readonly ["popup-x", "popup-y", "anchor-width", "anchor-height", "available-width", "available-height", "transform-origin", "arrow-x", "arrow-y", "gap-size", "spinner-icon", "native-select-icon"];
19
+ export interface ComponentTokenName {
20
+ /** Everything before the property: component, then optional part and variant/size. */
21
+ stem: string;
22
+ property: string;
23
+ state?: string;
24
+ type: TokenType;
25
+ }
26
+ /**
27
+ * Parse a component token name (without `--pont2-`) into stem, property and
28
+ * state. Returns null when it does not end in a vocabulary property.
29
+ */
30
+ export declare function parseComponentToken(name: string): ComponentTokenName | null;
31
+ /** The type of a ref or sem token, from its name. Null when the name fits no group. */
32
+ export declare function systemTokenType(name: string): TokenType | null;