@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,29 @@
1
+ import { CompileOptions, PontTheme } from './types';
2
+ export interface ApplyOptions {
3
+ /** The document to apply to (default: the global `document`). */
4
+ document?: Document;
5
+ /** Distinguishes several themes in one document (default `"brand"`). */
6
+ id?: string;
7
+ /** Passed to compileTheme when a theme object is given. */
8
+ compile?: CompileOptions;
9
+ }
10
+ export interface AppliedTheme {
11
+ /** The CSS now in the document. */
12
+ css: string;
13
+ /** Remove the element again. */
14
+ remove(): void;
15
+ }
16
+ /**
17
+ * Compile `theme` (unless it is already CSS) and apply it. Calling it again
18
+ * with the same id replaces the previous CSS. Throws ThemeError for an
19
+ * invalid theme, leaving the previous CSS in place.
20
+ */
21
+ export declare function applyTheme(theme: PontTheme | string, options?: ApplyOptions): AppliedTheme;
22
+ /**
23
+ * Load a published theme stylesheet. Calling it again with the same id
24
+ * points the same `<link>` at the new href. Only http(s) and same-origin
25
+ * relative URLs are accepted.
26
+ */
27
+ export declare function linkTheme(href: string, options?: Omit<ApplyOptions, "compile">): {
28
+ remove(): void;
29
+ };
@@ -0,0 +1,23 @@
1
+ import { CompileOptions, PontTheme } from './types';
2
+ /** Thrown by compileTheme for an invalid theme; `issues` lists every problem. */
3
+ export declare class ThemeError extends Error {
4
+ readonly issues: {
5
+ path: string;
6
+ message: string;
7
+ }[];
8
+ constructor(issues: {
9
+ path: string;
10
+ message: string;
11
+ }[]);
12
+ }
13
+ /**
14
+ * The token-API fingerprint a compiled theme was built against (its first
15
+ * line), or null for CSS that compileTheme did not produce. Compare it with
16
+ * `defaultManifest.fingerprint` to find stored CSS that needs recompiling.
17
+ */
18
+ export declare function themeFingerprint(css: string): string | null;
19
+ /**
20
+ * Compile a theme to CSS. Throws ThemeError when the theme is invalid
21
+ * (validateTheme), after migrating renamed tokens (migrateTheme).
22
+ */
23
+ export declare function compileTheme(theme: PontTheme, options?: CompileOptions): string;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * pont2 theming: `@pontive/pontkit-core/pont2/theme` (docs/11-tokens.md).
3
+ *
4
+ * Framework-free and registers no elements, so the dashboard (live preview
5
+ * and save), a Node backend and tests can all import it.
6
+ *
7
+ * validateTheme(theme) → every problem with a stored theme
8
+ * compileTheme(theme) → layered CSS for pont2.theme.brand (throws ThemeError)
9
+ * themeFingerprint(css) → the token-API fingerprint compiled CSS was built against
10
+ * applyTheme(theme|css) → (browser) one <style>: the live preview
11
+ * linkTheme(href) → (browser) one <link>: an app loading its published theme
12
+ * importShadcnTheme(css) → a theme scope from a shadcn theme
13
+ * defaultManifest → tokens.json: every token, its type, default and scope rules
14
+ */
15
+ export { applyTheme, linkTheme, type AppliedTheme, type ApplyOptions } from './apply';
16
+ export { compileTheme, ThemeError, themeFingerprint } from './compile';
17
+ export { defaultManifest } from './manifest';
18
+ export { THEME_SCOPES, TOKEN_ALIASES } from './scopes';
19
+ export { importShadcnTheme, type ShadcnImport } from './shadcn';
20
+ export type * from './types';
21
+ export { checkValue, type ValueContext } from './value';
22
+ export { migrateTheme, validateTheme } from './validate';
23
+ export { PROPERTY_TYPES, STATES, parseComponentToken, systemTokenType } from './vocabulary';
@@ -0,0 +1,2 @@
1
+ import { TokenManifest } from './types';
2
+ export declare const defaultManifest: TokenManifest;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Theme scopes: the elements a theme can target below `:root`
3
+ * (docs/11-tokens.md §7, §8). Keys are what the dashboard stores; values are
4
+ * the element the compiled CSS selects. A guardrail checks every tag here is
5
+ * a registered pont2 element.
6
+ */
7
+ export declare const THEME_SCOPES: Readonly<Record<string, string>>;
8
+ /**
9
+ * Renamed tokens, old name → new name (both without `--pont2-`). The token
10
+ * list is public API (11 §9): rename by adding an entry here, never by just
11
+ * deleting, so stored themes keep working.
12
+ */
13
+ export declare const TOKEN_ALIASES: Readonly<Record<string, string>>;
@@ -0,0 +1,7 @@
1
+ import { ThemeScope } from './types';
2
+ export interface ShadcnImport {
3
+ scope: ThemeScope;
4
+ /** shadcn variables with no pont2 counterpart, by name (without `--`). */
5
+ skipped: string[];
6
+ }
7
+ export declare function importShadcnTheme(css: string): ShadcnImport;