@kardalum/plugin-sdk 0.17.0 → 0.19.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/CHANGELOG.md +109 -0
- package/README.md +4 -3
- package/dist/assets/asset-picker.d.ts +11 -0
- package/dist/assets/asset-picker.js +109 -0
- package/dist/assets/asset-tree.d.ts +30 -0
- package/dist/assets/asset-tree.js +150 -0
- package/dist/built-in-editor-ids.d.ts +1 -0
- package/dist/built-in-editor-ids.js +20 -0
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +31 -4
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +20 -11
- package/dist/capabilities.js +5 -0
- package/dist/data-type-plugin.d.ts +2 -2
- package/dist/datatype-validation.d.ts +2 -2
- package/dist/datatype-validation.js +20 -6
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- package/dist/entitlement-entry.d.ts +3 -2
- package/dist/entitlement-entry.js +13 -1
- package/dist/entitlement-gate.d.ts +18 -0
- package/dist/entitlement-gate.js +95 -21
- package/dist/entitlement-plan.d.ts +21 -0
- package/dist/entitlement-plan.js +26 -0
- package/dist/entitlement-types.d.ts +21 -4
- package/dist/entitlement.d.ts +29 -1
- package/dist/entitlement.js +39 -0
- package/dist/grid-arrow-step.d.ts +7 -0
- package/dist/grid-arrow-step.js +20 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +11 -12
- package/dist/manifest-entry.d.ts +4 -0
- package/dist/manifest-entry.js +4 -0
- package/dist/manifest-schema.d.ts +5 -1
- package/dist/manifest-schema.js +14 -2
- package/dist/manifest.d.ts +21 -1
- package/dist/media/media-picker.js +34 -34
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/plugin-context.js +3 -3
- package/dist/register-built-ins.js +6 -6
- package/dist/registry.js +1 -1
- package/dist/richtext/block-panel.js +19 -20
- package/dist/richtext/extensions.js +17 -8
- package/dist/richtext/insert-menu.js +4 -4
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +2 -2
- package/dist/richtext/text-style-class.js +1 -1
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/simple-storage-value-provider.js +3 -3
- package/dist/structured-storage-types.d.ts +12 -1
- package/dist/structured-storage-types.js +2 -2
- package/dist/tailwind.js +10 -3
- package/dist/tokens/tailwind-theme.css +176 -0
- package/dist/tokens/tokens.css +1 -0
- package/dist/tokens/tokens.json +2 -1
- package/dist/ui-entry.js +3 -3
- package/dist/vendor-check.d.ts +39 -0
- package/dist/vendor-check.js +79 -0
- package/dist/vendor-entry.d.ts +3 -0
- package/dist/vendor-entry.js +9 -0
- package/dist/vendor-service.d.ts +20 -0
- package/dist/vendor-service.js +20 -0
- package/dist/views/asset-view.d.ts +6 -0
- package/dist/views/asset-view.js +55 -0
- package/dist/views/content-list-settings-view.js +1 -1
- package/dist/views/content-list-view.js +1 -1
- package/dist/views/date-range-view.js +5 -5
- package/dist/views/html-code-editor.js +2 -3
- package/dist/views/html-view.js +7 -7
- package/dist/views/image-view.js +5 -5
- package/dist/views/rich-text-view.js +33 -32
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +17 -15
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +10 -3
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +30 -9
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +12 -6
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +11 -6
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +26 -6
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +6 -3
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +56 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +48 -19
- package/node_modules/@kardalum/api-schemas/dist/index.js +34 -12
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +162 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +144 -9
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +15 -9
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +7 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +251 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +196 -31
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +10 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +24 -4
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -20
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +207 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +147 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -8
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +27 -12
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +22 -10
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +6 -1
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +5 -0
- package/node_modules/@kardalum/design-tokens/README.md +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -5
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +1 -1
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +54 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +18 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +58 -1
- package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +10 -10
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +3 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
- package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/ui/README.md +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
- package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +52 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +20 -7
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
- package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
- package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/sheet.js +15 -9
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
- package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +82 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +11 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +94 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
- package/node_modules/@kardalum/ui/dist/index.d.ts +4 -1
- package/node_modules/@kardalum/ui/dist/index.js +4 -1
- package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
- package/node_modules/@kardalum/ui/package.json +8 -6
- package/package.json +21 -7
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The token's `typ`, and (with a trailing ".") the purpose string in its signed bytes (D5). */
|
|
3
|
+
export declare const VENDOR_TOKEN_TYPE: "kardalum-vendor-token/1";
|
|
4
|
+
/** D4: a token lives 5 minutes. */
|
|
5
|
+
export declare const VENDOR_TOKEN_TTL_SECONDS = 300;
|
|
6
|
+
/** Spec 3a: the decoded payload is at most 4 KiB. */
|
|
7
|
+
export declare const VENDOR_TOKEN_PAYLOAD_MAX_BYTES = 4096;
|
|
8
|
+
/** The whole token as it travels: both base64url segments and the dot. */
|
|
9
|
+
export declare const VENDOR_TOKEN_MAX_LENGTH = 8192;
|
|
10
|
+
export declare const VENDOR_SERVICE_ORIGIN_MAX = 255;
|
|
11
|
+
/** Spec 3b: the one refusal the marketplace gives, whatever the reason. */
|
|
12
|
+
export declare const VENDOR_TOKEN_REFUSAL_CODE: "no_vendor_token";
|
|
13
|
+
/** A licence term's states (S317). Mirrors LicenseTermState in
|
|
14
|
+
* @kardalum/plugin-package, which pins the two as equal at compile time. */
|
|
15
|
+
export declare const VENDOR_TOKEN_TERM_STATES: readonly ["active", "renewing", "past_due", "lapsed"];
|
|
16
|
+
/** D3: the states a token calls live. */
|
|
17
|
+
export declare const VENDOR_TOKEN_LIVE_STATES: readonly ["active", "renewing", "past_due"];
|
|
18
|
+
/** True for the hosts a development install may reach over plain http. */
|
|
19
|
+
export declare function isLocalVendorHost(hostname: string): boolean;
|
|
20
|
+
export type VendorServiceOriginResult = {
|
|
21
|
+
ok: true;
|
|
22
|
+
origin: string;
|
|
23
|
+
host: string;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
reason: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The origin rule (spec 3b, 3c, 3d). `https:` with any host; `http:` only for
|
|
30
|
+
* localhost, 127.0.0.1 or [::1] and only with `allowLocalHttp`. The value must
|
|
31
|
+
* be exactly the URL's origin: no path (not even "/"), query, fragment or
|
|
32
|
+
* userinfo, a lower-case host, at most 255 characters. No regex: the URL
|
|
33
|
+
* parser and exact comparisons.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseVendorServiceOrigin(value: unknown, opts: {
|
|
36
|
+
allowLocalHttp: boolean;
|
|
37
|
+
}): VendorServiceOriginResult;
|
|
38
|
+
/** D6: the manifest's top-level `vendorService`. An http://localhost origin
|
|
39
|
+
* parses here (a plugin in development); both publish gates refuse it. */
|
|
40
|
+
export declare const PluginVendorServiceSchema: z.ZodObject<{
|
|
41
|
+
origin: z.ZodString;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export type PluginVendorServiceDeclaration = z.infer<typeof PluginVendorServiceSchema>;
|
|
44
|
+
/** Spec 3a: the token payload. `exp` is after `iat` and at most 300 s later. */
|
|
45
|
+
export declare const VendorTokenPayloadSchema: z.ZodObject<{
|
|
46
|
+
typ: z.ZodLiteral<"kardalum-vendor-token/1">;
|
|
47
|
+
kid: z.ZodString;
|
|
48
|
+
pluginId: z.ZodString;
|
|
49
|
+
aud: z.ZodString;
|
|
50
|
+
domain: z.ZodString;
|
|
51
|
+
live: z.ZodBoolean;
|
|
52
|
+
plan: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
key: z.ZodString;
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
term: z.ZodObject<{
|
|
58
|
+
state: z.ZodEnum<{
|
|
59
|
+
active: "active";
|
|
60
|
+
renewing: "renewing";
|
|
61
|
+
past_due: "past_due";
|
|
62
|
+
lapsed: "lapsed";
|
|
63
|
+
}>;
|
|
64
|
+
endsAt: z.ZodNullable<z.ZodISODateTime>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
iat: z.ZodNumber;
|
|
67
|
+
exp: z.ZodNumber;
|
|
68
|
+
jti: z.ZodString;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export type VendorTokenPayload = z.infer<typeof VendorTokenPayloadSchema>;
|
|
71
|
+
/** Spec 3b: what the CMS sends. The key is the credential. */
|
|
72
|
+
export declare const VendorTokenRequestSchema: z.ZodObject<{
|
|
73
|
+
key: z.ZodString;
|
|
74
|
+
pluginId: z.ZodString;
|
|
75
|
+
domain: z.ZodString;
|
|
76
|
+
aud: z.ZodString;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
export type VendorTokenRequest = z.infer<typeof VendorTokenRequestSchema>;
|
|
79
|
+
export declare const VendorTokenResponseSchema: z.ZodObject<{
|
|
80
|
+
token: z.ZodString;
|
|
81
|
+
expiresAt: z.ZodISODateTime;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
export type VendorTokenResponse = z.infer<typeof VendorTokenResponseSchema>;
|
|
84
|
+
export declare const VendorTokenRefusalSchema: z.ZodObject<{
|
|
85
|
+
code: z.ZodLiteral<"no_vendor_token">;
|
|
86
|
+
error: z.ZodString;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export type VendorTokenRefusal = z.infer<typeof VendorTokenRefusalSchema>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PLAN_KEY_MAX, PLAN_NAME_MAX } from "./plan-editor.schema.js";
|
|
3
|
+
// S320 (2026-11-01-s320-vendor-service-design.md): the vendor service. A paid
|
|
4
|
+
// plugin's server-side code calls its author's server through the CMS, which
|
|
5
|
+
// sends a 5-minute token the marketplace signed, never the licence key (D4).
|
|
6
|
+
// The token codec lives in @kardalum/plugin-package (vendor-token.ts); these
|
|
7
|
+
// are its shapes and the one origin rule every side applies.
|
|
8
|
+
/** The token's `typ`, and (with a trailing ".") the purpose string in its signed bytes (D5). */
|
|
9
|
+
export const VENDOR_TOKEN_TYPE = "kardalum-vendor-token/1";
|
|
10
|
+
/** D4: a token lives 5 minutes. */
|
|
11
|
+
export const VENDOR_TOKEN_TTL_SECONDS = 300;
|
|
12
|
+
/** Spec 3a: the decoded payload is at most 4 KiB. */
|
|
13
|
+
export const VENDOR_TOKEN_PAYLOAD_MAX_BYTES = 4096;
|
|
14
|
+
/** The whole token as it travels: both base64url segments and the dot. */
|
|
15
|
+
export const VENDOR_TOKEN_MAX_LENGTH = 8192;
|
|
16
|
+
export const VENDOR_SERVICE_ORIGIN_MAX = 255;
|
|
17
|
+
/** Spec 3b: the one refusal the marketplace gives, whatever the reason. */
|
|
18
|
+
export const VENDOR_TOKEN_REFUSAL_CODE = "no_vendor_token";
|
|
19
|
+
/** A licence term's states (S317). Mirrors LicenseTermState in
|
|
20
|
+
* @kardalum/plugin-package, which pins the two as equal at compile time. */
|
|
21
|
+
export const VENDOR_TOKEN_TERM_STATES = ["active", "renewing", "past_due", "lapsed"];
|
|
22
|
+
/** D3: the states a token calls live. */
|
|
23
|
+
export const VENDOR_TOKEN_LIVE_STATES = ["active", "renewing", "past_due"];
|
|
24
|
+
const UrlCtor = globalThis.URL;
|
|
25
|
+
const LOCAL_HOSTS = ["localhost", "127.0.0.1", "[::1]"];
|
|
26
|
+
/** True for the hosts a development install may reach over plain http. */
|
|
27
|
+
export function isLocalVendorHost(hostname) {
|
|
28
|
+
return LOCAL_HOSTS.includes(hostname);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The origin rule (spec 3b, 3c, 3d). `https:` with any host; `http:` only for
|
|
32
|
+
* localhost, 127.0.0.1 or [::1] and only with `allowLocalHttp`. The value must
|
|
33
|
+
* be exactly the URL's origin: no path (not even "/"), query, fragment or
|
|
34
|
+
* userinfo, a lower-case host, at most 255 characters. No regex: the URL
|
|
35
|
+
* parser and exact comparisons.
|
|
36
|
+
*/
|
|
37
|
+
export function parseVendorServiceOrigin(value, opts) {
|
|
38
|
+
if (typeof value !== "string" || value.length === 0)
|
|
39
|
+
return { ok: false, reason: "must be a non-empty string" };
|
|
40
|
+
if (value.length > VENDOR_SERVICE_ORIGIN_MAX)
|
|
41
|
+
return { ok: false, reason: `must be at most ${VENDOR_SERVICE_ORIGIN_MAX} characters` };
|
|
42
|
+
let url;
|
|
43
|
+
try {
|
|
44
|
+
url = new UrlCtor(value);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return { ok: false, reason: "must be a URL origin such as https://api.example.com" };
|
|
48
|
+
}
|
|
49
|
+
if (url.username !== "" || url.password !== "")
|
|
50
|
+
return { ok: false, reason: "must not carry a user name or password" };
|
|
51
|
+
if (url.protocol === "http:") {
|
|
52
|
+
if (!opts.allowLocalHttp || !isLocalVendorHost(url.hostname))
|
|
53
|
+
return { ok: false, reason: "must use https (http only for localhost in development)" };
|
|
54
|
+
}
|
|
55
|
+
else if (url.protocol !== "https:") {
|
|
56
|
+
return { ok: false, reason: "must use https" };
|
|
57
|
+
}
|
|
58
|
+
if (url.origin !== value)
|
|
59
|
+
return { ok: false, reason: "must be an origin only: scheme, lower-case host and port, no path or trailing slash" };
|
|
60
|
+
return { ok: true, origin: url.origin, host: url.host };
|
|
61
|
+
}
|
|
62
|
+
const VendorServiceOriginSchema = z.string().superRefine((value, ctx) => {
|
|
63
|
+
const parsed = parseVendorServiceOrigin(value, { allowLocalHttp: true });
|
|
64
|
+
if (!parsed.ok)
|
|
65
|
+
ctx.addIssue({ code: "custom", message: parsed.reason });
|
|
66
|
+
});
|
|
67
|
+
/** D6: the manifest's top-level `vendorService`. An http://localhost origin
|
|
68
|
+
* parses here (a plugin in development); both publish gates refuse it. */
|
|
69
|
+
export const PluginVendorServiceSchema = z.object({ origin: VendorServiceOriginSchema }).strict();
|
|
70
|
+
const instant = z.iso.datetime({ offset: false });
|
|
71
|
+
/** Spec 3a: the token payload. `exp` is after `iat` and at most 300 s later. */
|
|
72
|
+
export const VendorTokenPayloadSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
typ: z.literal(VENDOR_TOKEN_TYPE),
|
|
75
|
+
kid: z.string().min(1).max(64),
|
|
76
|
+
pluginId: z.string().min(1).max(128),
|
|
77
|
+
aud: z.string().min(1).max(VENDOR_SERVICE_ORIGIN_MAX),
|
|
78
|
+
domain: z.string().min(1).max(253),
|
|
79
|
+
live: z.boolean(),
|
|
80
|
+
plan: z.object({ id: z.string().min(1).max(64), key: z.string().min(1).max(PLAN_KEY_MAX), name: z.string().min(1).max(PLAN_NAME_MAX) }).strict(),
|
|
81
|
+
term: z.object({ state: z.enum(VENDOR_TOKEN_TERM_STATES), endsAt: instant.nullable() }).strict(),
|
|
82
|
+
iat: z.number().int().nonnegative(),
|
|
83
|
+
exp: z.number().int().nonnegative(),
|
|
84
|
+
jti: z.string().min(16).max(64),
|
|
85
|
+
})
|
|
86
|
+
.strict()
|
|
87
|
+
.refine((p) => p.exp > p.iat && p.exp - p.iat <= VENDOR_TOKEN_TTL_SECONDS, { message: "exp must be after iat and at most 300 seconds later", path: ["exp"] });
|
|
88
|
+
/** Spec 3b: what the CMS sends. The key is the credential. */
|
|
89
|
+
export const VendorTokenRequestSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
key: z.string().min(1).max(128),
|
|
92
|
+
pluginId: z.string().min(1).max(128),
|
|
93
|
+
// Trimmed before the length check, so a whitespace-only domain is a 400
|
|
94
|
+
// here and never reaches the signer as "" (S320 fix wave, M7).
|
|
95
|
+
domain: z.string().trim().min(1).max(253),
|
|
96
|
+
aud: z.string().min(1).max(VENDOR_SERVICE_ORIGIN_MAX),
|
|
97
|
+
})
|
|
98
|
+
.strict();
|
|
99
|
+
export const VendorTokenResponseSchema = z.object({ token: z.string().min(3).max(VENDOR_TOKEN_MAX_LENGTH), expiresAt: instant });
|
|
100
|
+
export const VendorTokenRefusalSchema = z.object({ code: z.literal(VENDOR_TOKEN_REFUSAL_CODE), error: z.string() });
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const ContentLimitsSchema: z.ZodObject<{
|
|
3
|
+
assetBytes: z.ZodNumber;
|
|
4
|
+
templateBytes: z.ZodNumber;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type ContentLimits = z.infer<typeof ContentLimitsSchema>;
|
|
2
7
|
export declare const WhoamiResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
8
|
kind: z.ZodLiteral<"key">;
|
|
4
9
|
actions: z.ZodArray<z.ZodString>;
|
|
10
|
+
limits: z.ZodObject<{
|
|
11
|
+
assetBytes: z.ZodNumber;
|
|
12
|
+
templateBytes: z.ZodNumber;
|
|
13
|
+
}, z.core.$strip>;
|
|
5
14
|
key: z.ZodObject<{
|
|
6
15
|
id: z.ZodString;
|
|
7
16
|
name: z.ZodString;
|
|
@@ -10,6 +19,10 @@ export declare const WhoamiResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
10
19
|
}, z.core.$strip>, z.ZodObject<{
|
|
11
20
|
kind: z.ZodLiteral<"session">;
|
|
12
21
|
actions: z.ZodArray<z.ZodString>;
|
|
22
|
+
limits: z.ZodObject<{
|
|
23
|
+
assetBytes: z.ZodNumber;
|
|
24
|
+
templateBytes: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>;
|
|
13
26
|
user: z.ZodObject<{
|
|
14
27
|
id: z.ZodString;
|
|
15
28
|
name: z.ZodNullable<z.ZodString>;
|
|
@@ -4,18 +4,23 @@ import { z } from "zod";
|
|
|
4
4
|
// plaintext key or an email: the key is described by id, name and expiry, the
|
|
5
5
|
// user by id, name and role. One branch per kind, so an answer always carries
|
|
6
6
|
// exactly the description that matches it.
|
|
7
|
+
// S314c3 (D8): the site's size limits, in UTF-8 bytes (KARDALUM_MAX_ASSET_BYTES and
|
|
8
|
+
// KARDALUM_MAX_TEMPLATE_BYTES), so the admin's editors show the numbers the server holds a write to.
|
|
9
|
+
export const ContentLimitsSchema = z.object({ assetBytes: z.number().int().positive(), templateBytes: z.number().int().positive() });
|
|
7
10
|
export const WhoamiResponseSchema = z.discriminatedUnion("kind", [
|
|
8
11
|
z.object({
|
|
9
12
|
kind: z.literal("key"),
|
|
10
13
|
// Exactly the actions the credential holds, sorted. For a key this includes
|
|
11
14
|
// managementApi.use, because a key that reaches the route holds it.
|
|
12
15
|
actions: z.array(z.string()),
|
|
16
|
+
limits: ContentLimitsSchema,
|
|
13
17
|
key: z.object({ id: z.string().uuid(), name: z.string(), expiresAt: z.string().datetime().nullable() }),
|
|
14
18
|
}),
|
|
15
19
|
z.object({
|
|
16
20
|
kind: z.literal("session"),
|
|
17
21
|
// Exactly the actions the session holds, sorted.
|
|
18
22
|
actions: z.array(z.string()),
|
|
23
|
+
limits: ContentLimitsSchema,
|
|
19
24
|
// The name is null for a user who never set one.
|
|
20
25
|
user: z.object({ id: z.string(), name: z.string().nullable(), role: z.string() }),
|
|
21
26
|
}),
|
|
@@ -26,4 +26,4 @@ console.log(tokens.color.primary[500]);
|
|
|
26
26
|
|
|
27
27
|
Kardalum's source is not public. Questions and bug reports:
|
|
28
28
|
[kardalum-devkit](https://github.com/kardalum/kardalum-devkit). Docs at
|
|
29
|
-
https://
|
|
29
|
+
https://dev.kardalum.com/docs/. Apache-2.0.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The complete tokens.css text: :root variables, one [data-theme] block
|
|
3
3
|
* per built-in theme that has overrides (the exact mechanism a
|
|
4
4
|
* third-party theme plugin uses at runtime), and the language-conditional
|
|
5
|
-
* sans-stack swap for Arabic. Pure
|
|
5
|
+
* sans-stack swap for Arabic. Pure: generate.ts writes it to disk.
|
|
6
6
|
*/
|
|
7
7
|
export declare function buildTokensCss(): string;
|
|
8
8
|
export declare function countVariables(): number;
|
|
@@ -16,7 +16,7 @@ function rootVariables() {
|
|
|
16
16
|
* The complete tokens.css text: :root variables, one [data-theme] block
|
|
17
17
|
* per built-in theme that has overrides (the exact mechanism a
|
|
18
18
|
* third-party theme plugin uses at runtime), and the language-conditional
|
|
19
|
-
* sans-stack swap for Arabic. Pure
|
|
19
|
+
* sans-stack swap for Arabic. Pure: generate.ts writes it to disk.
|
|
20
20
|
*/
|
|
21
21
|
export function buildTokensCss() {
|
|
22
22
|
const variables = rootVariables();
|
|
@@ -25,7 +25,7 @@ export function buildTokensCss() {
|
|
|
25
25
|
...Object.entries(variables).map(([name, value]) => ` ${name}: ${value};`),
|
|
26
26
|
'}',
|
|
27
27
|
].join('\n');
|
|
28
|
-
// Light has no overrides (it IS the :root default) so it emits no block
|
|
28
|
+
// Light has no overrides (it IS the :root default) so it emits no block,
|
|
29
29
|
// a property of Light's token set, not a special case in this loop.
|
|
30
30
|
const themeBlocks = themes
|
|
31
31
|
.map((theme) => themeOverridesToCss(theme.id, theme.contributions.themeTokens))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Each tailwindTheme scale and the Tailwind 4 namespace it becomes. */
|
|
2
|
+
export declare const THEME_NAMESPACES: {
|
|
3
|
+
readonly colors: "color";
|
|
4
|
+
readonly fontFamily: "font";
|
|
5
|
+
readonly fontSize: "text";
|
|
6
|
+
readonly fontWeight: "font-weight";
|
|
7
|
+
readonly lineHeight: "leading";
|
|
8
|
+
readonly spacing: "spacing";
|
|
9
|
+
readonly borderRadius: "radius";
|
|
10
|
+
readonly boxShadow: "shadow";
|
|
11
|
+
readonly transitionTimingFunction: "ease";
|
|
12
|
+
readonly transitionDuration: "transition-duration";
|
|
13
|
+
};
|
|
14
|
+
/** A token key as a theme variable name part; a key that would need escaping throws. */
|
|
15
|
+
export declare function themeVariableKey(name: string): string;
|
|
16
|
+
export declare function buildTailwindThemeCss(): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Tailwind 4 theme (S314e2, spec C1): the same scales as tailwindTheme,
|
|
3
|
+
* written as one `@theme inline reference` block, generated from
|
|
4
|
+
* tailwindTheme itself so the v3 preset (kept for plugin authors) and this
|
|
5
|
+
* file cannot drift. generate.ts writes it to dist/tailwind-theme.css.
|
|
6
|
+
*
|
|
7
|
+
* - `--<namespace>-*: initial` first, per replaced scale: our scales replace
|
|
8
|
+
* Tailwind's, as `theme: { ...tailwindTheme }` did in v3, so a step
|
|
9
|
+
* outside them (p-13, w-40) still emits nothing. Scales the tokens do not
|
|
10
|
+
* cover (max-width, z-index, opacity, tracking, breakpoints) keep
|
|
11
|
+
* Tailwind's defaults, as in v3.
|
|
12
|
+
* - `inline`: a utility gets the value itself, `var(--color-primary-500)`,
|
|
13
|
+
* resolved against tokens.css at runtime, so theme plugins still re-skin
|
|
14
|
+
* by overriding variables.
|
|
15
|
+
* - `reference`: the block writes no variable into the page. Our token names
|
|
16
|
+
* are Tailwind's own for colour, spacing, radius and shadow, so without it
|
|
17
|
+
* Tailwind would emit `--color-primary-500: var(--color-primary-500)`, a
|
|
18
|
+
* self-reference that makes every colour invalid wherever tokens.css is
|
|
19
|
+
* absent.
|
|
20
|
+
* - `--default-transition-duration: 0s`: v3's replaced duration scale had no
|
|
21
|
+
* DEFAULT, so a bare `transition-colors` ran in 0s; v4 always applies this
|
|
22
|
+
* default, and 0s keeps that behaviour.
|
|
23
|
+
*/
|
|
24
|
+
import { tailwindTheme } from './tailwind-theme.js';
|
|
25
|
+
/** Each tailwindTheme scale and the Tailwind 4 namespace it becomes. */
|
|
26
|
+
export const THEME_NAMESPACES = {
|
|
27
|
+
colors: 'color',
|
|
28
|
+
fontFamily: 'font',
|
|
29
|
+
fontSize: 'text',
|
|
30
|
+
fontWeight: 'font-weight',
|
|
31
|
+
lineHeight: 'leading',
|
|
32
|
+
spacing: 'spacing',
|
|
33
|
+
borderRadius: 'radius',
|
|
34
|
+
boxShadow: 'shadow',
|
|
35
|
+
transitionTimingFunction: 'ease',
|
|
36
|
+
transitionDuration: 'transition-duration',
|
|
37
|
+
};
|
|
38
|
+
// CSS keywords in the v3 colours, not theme values: Tailwind 4 has
|
|
39
|
+
// bg-transparent, bg-current and bg-inherit built in.
|
|
40
|
+
const KEYWORD_COLORS = new Set(['transparent', 'current', 'inherit']);
|
|
41
|
+
const SAFE_KEY = /^[A-Za-z0-9-]+$/;
|
|
42
|
+
/** A token key as a theme variable name part; a key that would need escaping throws. */
|
|
43
|
+
export function themeVariableKey(name) {
|
|
44
|
+
if (!SAFE_KEY.test(name)) {
|
|
45
|
+
throw new Error(`The token key "${name}" cannot be part of a Tailwind 4 theme variable without escaping: teach build-theme-css.ts to escape it first.`);
|
|
46
|
+
}
|
|
47
|
+
return name;
|
|
48
|
+
}
|
|
49
|
+
export function buildTailwindThemeCss() {
|
|
50
|
+
const lines = [];
|
|
51
|
+
for (const namespace of Object.values(THEME_NAMESPACES))
|
|
52
|
+
lines.push(` --${namespace}-*: initial;`);
|
|
53
|
+
for (const [scaleName, namespace] of Object.entries(THEME_NAMESPACES)) {
|
|
54
|
+
const scale = tailwindTheme[scaleName];
|
|
55
|
+
for (const [name, value] of Object.entries(scale)) {
|
|
56
|
+
if (scaleName === 'colors' && KEYWORD_COLORS.has(name))
|
|
57
|
+
continue;
|
|
58
|
+
if (typeof value === 'string') {
|
|
59
|
+
lines.push(` --${namespace}-${themeVariableKey(name)}: ${value};`);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
for (const [step, ref] of Object.entries(value)) {
|
|
63
|
+
lines.push(` --${namespace}-${themeVariableKey(name)}-${themeVariableKey(step)}: ${ref};`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
lines.push(' --default-transition-duration: 0s;');
|
|
68
|
+
return [
|
|
69
|
+
'/* Generated by @kardalum/design-tokens: do not edit by hand. */',
|
|
70
|
+
'/* The Tailwind 4 theme: import it after `@import "tailwindcss"`. Every value is a token variable from tokens.css. */',
|
|
71
|
+
'@theme inline reference {',
|
|
72
|
+
...lines,
|
|
73
|
+
'}',
|
|
74
|
+
'',
|
|
75
|
+
].join('\n');
|
|
76
|
+
}
|
|
@@ -8,6 +8,7 @@ import { writeFile } from 'node:fs/promises';
|
|
|
8
8
|
import { dirname, join } from 'node:path';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
10
|
import { buildSystemDarkCss, buildTokensCss, countVariables } from './build-css.js';
|
|
11
|
+
import { buildTailwindThemeCss } from './build-theme-css.js';
|
|
11
12
|
import { tokens } from './tokens.js';
|
|
12
13
|
const outDir = dirname(fileURLToPath(import.meta.url));
|
|
13
14
|
await writeFile(join(outDir, 'tokens.css'), buildTokensCss(), 'utf8');
|
|
@@ -15,4 +16,6 @@ await writeFile(join(outDir, 'tokens.css'), buildTokensCss(), 'utf8');
|
|
|
15
16
|
// buildSystemDarkCss's comment for why it is not part of tokens.css.
|
|
16
17
|
await writeFile(join(outDir, 'system-dark.css'), buildSystemDarkCss(), 'utf8');
|
|
17
18
|
await writeFile(join(outDir, 'tokens.json'), JSON.stringify(tokens, null, 2) + '\n', 'utf8');
|
|
18
|
-
|
|
19
|
+
// The Tailwind 4 theme, from the same source as the v3 tailwindTheme (S314e2).
|
|
20
|
+
await writeFile(join(outDir, 'tailwind-theme.css'), buildTailwindThemeCss(), 'utf8');
|
|
21
|
+
console.log(`Generated tokens.css (${countVariables()} variables), system-dark.css, tokens.json and tailwind-theme.css`);
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/* Generated by @kardalum/design-tokens: do not edit by hand. */
|
|
2
|
+
/* The Tailwind 4 theme: import it after `@import "tailwindcss"`. Every value is a token variable from tokens.css. */
|
|
3
|
+
@theme inline reference {
|
|
4
|
+
--color-*: initial;
|
|
5
|
+
--font-*: initial;
|
|
6
|
+
--text-*: initial;
|
|
7
|
+
--font-weight-*: initial;
|
|
8
|
+
--leading-*: initial;
|
|
9
|
+
--spacing-*: initial;
|
|
10
|
+
--radius-*: initial;
|
|
11
|
+
--shadow-*: initial;
|
|
12
|
+
--ease-*: initial;
|
|
13
|
+
--transition-duration-*: initial;
|
|
14
|
+
--color-primary-50: var(--color-primary-50);
|
|
15
|
+
--color-primary-100: var(--color-primary-100);
|
|
16
|
+
--color-primary-200: var(--color-primary-200);
|
|
17
|
+
--color-primary-300: var(--color-primary-300);
|
|
18
|
+
--color-primary-400: var(--color-primary-400);
|
|
19
|
+
--color-primary-500: var(--color-primary-500);
|
|
20
|
+
--color-primary-600: var(--color-primary-600);
|
|
21
|
+
--color-primary-700: var(--color-primary-700);
|
|
22
|
+
--color-primary-800: var(--color-primary-800);
|
|
23
|
+
--color-primary-900: var(--color-primary-900);
|
|
24
|
+
--color-primary-950: var(--color-primary-950);
|
|
25
|
+
--color-secondary-50: var(--color-secondary-50);
|
|
26
|
+
--color-secondary-100: var(--color-secondary-100);
|
|
27
|
+
--color-secondary-200: var(--color-secondary-200);
|
|
28
|
+
--color-secondary-300: var(--color-secondary-300);
|
|
29
|
+
--color-secondary-400: var(--color-secondary-400);
|
|
30
|
+
--color-secondary-500: var(--color-secondary-500);
|
|
31
|
+
--color-secondary-600: var(--color-secondary-600);
|
|
32
|
+
--color-secondary-700: var(--color-secondary-700);
|
|
33
|
+
--color-secondary-800: var(--color-secondary-800);
|
|
34
|
+
--color-secondary-900: var(--color-secondary-900);
|
|
35
|
+
--color-secondary-950: var(--color-secondary-950);
|
|
36
|
+
--color-success-50: var(--color-success-50);
|
|
37
|
+
--color-success-100: var(--color-success-100);
|
|
38
|
+
--color-success-200: var(--color-success-200);
|
|
39
|
+
--color-success-300: var(--color-success-300);
|
|
40
|
+
--color-success-400: var(--color-success-400);
|
|
41
|
+
--color-success-500: var(--color-success-500);
|
|
42
|
+
--color-success-600: var(--color-success-600);
|
|
43
|
+
--color-success-700: var(--color-success-700);
|
|
44
|
+
--color-success-800: var(--color-success-800);
|
|
45
|
+
--color-success-900: var(--color-success-900);
|
|
46
|
+
--color-success-950: var(--color-success-950);
|
|
47
|
+
--color-warning-50: var(--color-warning-50);
|
|
48
|
+
--color-warning-100: var(--color-warning-100);
|
|
49
|
+
--color-warning-200: var(--color-warning-200);
|
|
50
|
+
--color-warning-300: var(--color-warning-300);
|
|
51
|
+
--color-warning-400: var(--color-warning-400);
|
|
52
|
+
--color-warning-500: var(--color-warning-500);
|
|
53
|
+
--color-warning-600: var(--color-warning-600);
|
|
54
|
+
--color-warning-700: var(--color-warning-700);
|
|
55
|
+
--color-warning-800: var(--color-warning-800);
|
|
56
|
+
--color-warning-900: var(--color-warning-900);
|
|
57
|
+
--color-warning-950: var(--color-warning-950);
|
|
58
|
+
--color-danger-50: var(--color-danger-50);
|
|
59
|
+
--color-danger-100: var(--color-danger-100);
|
|
60
|
+
--color-danger-200: var(--color-danger-200);
|
|
61
|
+
--color-danger-300: var(--color-danger-300);
|
|
62
|
+
--color-danger-400: var(--color-danger-400);
|
|
63
|
+
--color-danger-500: var(--color-danger-500);
|
|
64
|
+
--color-danger-600: var(--color-danger-600);
|
|
65
|
+
--color-danger-700: var(--color-danger-700);
|
|
66
|
+
--color-danger-800: var(--color-danger-800);
|
|
67
|
+
--color-danger-900: var(--color-danger-900);
|
|
68
|
+
--color-danger-950: var(--color-danger-950);
|
|
69
|
+
--color-neutral-50: var(--color-neutral-50);
|
|
70
|
+
--color-neutral-100: var(--color-neutral-100);
|
|
71
|
+
--color-neutral-200: var(--color-neutral-200);
|
|
72
|
+
--color-neutral-300: var(--color-neutral-300);
|
|
73
|
+
--color-neutral-400: var(--color-neutral-400);
|
|
74
|
+
--color-neutral-500: var(--color-neutral-500);
|
|
75
|
+
--color-neutral-600: var(--color-neutral-600);
|
|
76
|
+
--color-neutral-700: var(--color-neutral-700);
|
|
77
|
+
--color-neutral-800: var(--color-neutral-800);
|
|
78
|
+
--color-neutral-900: var(--color-neutral-900);
|
|
79
|
+
--color-neutral-950: var(--color-neutral-950);
|
|
80
|
+
--color-background-base: var(--color-background-base);
|
|
81
|
+
--color-background-elevated: var(--color-background-elevated);
|
|
82
|
+
--color-background-subtle: var(--color-background-subtle);
|
|
83
|
+
--color-background-overlay: var(--color-background-overlay);
|
|
84
|
+
--color-background-hover: var(--color-background-hover);
|
|
85
|
+
--color-text-primary: var(--color-text-primary);
|
|
86
|
+
--color-text-secondary: var(--color-text-secondary);
|
|
87
|
+
--color-text-tertiary: var(--color-text-tertiary);
|
|
88
|
+
--color-text-disabled: var(--color-text-disabled);
|
|
89
|
+
--color-text-inverse: var(--color-text-inverse);
|
|
90
|
+
--color-text-placeholder: var(--color-text-placeholder);
|
|
91
|
+
--color-border-default: var(--color-border-default);
|
|
92
|
+
--color-border-subtle: var(--color-border-subtle);
|
|
93
|
+
--color-border-strong: var(--color-border-strong);
|
|
94
|
+
--color-code-keyword: var(--color-code-keyword);
|
|
95
|
+
--color-code-tag: var(--color-code-tag);
|
|
96
|
+
--color-code-string: var(--color-code-string);
|
|
97
|
+
--color-code-attr: var(--color-code-attr);
|
|
98
|
+
--color-code-comment: var(--color-code-comment);
|
|
99
|
+
--color-code-punctuation: var(--color-code-punctuation);
|
|
100
|
+
--color-artifact-base: var(--color-artifact-base);
|
|
101
|
+
--color-artifact-raised: var(--color-artifact-raised);
|
|
102
|
+
--color-artifact-border: var(--color-artifact-border);
|
|
103
|
+
--color-artifact-text: var(--color-artifact-text);
|
|
104
|
+
--color-artifact-muted: var(--color-artifact-muted);
|
|
105
|
+
--color-artifact-strong: var(--color-artifact-strong);
|
|
106
|
+
--color-artifact-keyword: var(--color-artifact-keyword);
|
|
107
|
+
--color-artifact-string: var(--color-artifact-string);
|
|
108
|
+
--color-artifact-highlight: var(--color-artifact-highlight);
|
|
109
|
+
--color-footer-base: var(--color-footer-base);
|
|
110
|
+
--color-footer-border: var(--color-footer-border);
|
|
111
|
+
--color-footer-text: var(--color-footer-text);
|
|
112
|
+
--color-footer-muted: var(--color-footer-muted);
|
|
113
|
+
--color-footer-strong: var(--color-footer-strong);
|
|
114
|
+
--color-brand-tile: var(--color-brand-tile);
|
|
115
|
+
--color-brand-keep: var(--color-brand-keep);
|
|
116
|
+
--color-canvas: var(--color-canvas);
|
|
117
|
+
--font-sans: var(--font-family-sans);
|
|
118
|
+
--font-serif: var(--font-family-serif);
|
|
119
|
+
--font-mono: var(--font-family-mono);
|
|
120
|
+
--text-xs: var(--font-size-xs);
|
|
121
|
+
--text-sm: var(--font-size-sm);
|
|
122
|
+
--text-base: var(--font-size-base);
|
|
123
|
+
--text-lg: var(--font-size-lg);
|
|
124
|
+
--text-xl: var(--font-size-xl);
|
|
125
|
+
--text-2xl: var(--font-size-2xl);
|
|
126
|
+
--text-3xl: var(--font-size-3xl);
|
|
127
|
+
--text-4xl: var(--font-size-4xl);
|
|
128
|
+
--text-5xl: var(--font-size-5xl);
|
|
129
|
+
--font-weight-normal: var(--font-weight-normal);
|
|
130
|
+
--font-weight-medium: var(--font-weight-medium);
|
|
131
|
+
--font-weight-semibold: var(--font-weight-semibold);
|
|
132
|
+
--font-weight-bold: var(--font-weight-bold);
|
|
133
|
+
--leading-tight: var(--line-height-tight);
|
|
134
|
+
--leading-normal: var(--line-height-normal);
|
|
135
|
+
--leading-relaxed: var(--line-height-relaxed);
|
|
136
|
+
--spacing-0: var(--spacing-0);
|
|
137
|
+
--spacing-1: var(--spacing-1);
|
|
138
|
+
--spacing-2: var(--spacing-2);
|
|
139
|
+
--spacing-3: var(--spacing-3);
|
|
140
|
+
--spacing-4: var(--spacing-4);
|
|
141
|
+
--spacing-5: var(--spacing-5);
|
|
142
|
+
--spacing-6: var(--spacing-6);
|
|
143
|
+
--spacing-7: var(--spacing-7);
|
|
144
|
+
--spacing-8: var(--spacing-8);
|
|
145
|
+
--spacing-9: var(--spacing-9);
|
|
146
|
+
--spacing-10: var(--spacing-10);
|
|
147
|
+
--spacing-11: var(--spacing-11);
|
|
148
|
+
--spacing-12: var(--spacing-12);
|
|
149
|
+
--spacing-14: var(--spacing-14);
|
|
150
|
+
--spacing-16: var(--spacing-16);
|
|
151
|
+
--spacing-20: var(--spacing-20);
|
|
152
|
+
--spacing-24: var(--spacing-24);
|
|
153
|
+
--spacing-28: var(--spacing-28);
|
|
154
|
+
--spacing-32: var(--spacing-32);
|
|
155
|
+
--spacing-44: var(--spacing-44);
|
|
156
|
+
--spacing-64: var(--spacing-64);
|
|
157
|
+
--spacing-72: var(--spacing-72);
|
|
158
|
+
--spacing-px: var(--spacing-px);
|
|
159
|
+
--radius-none: var(--radius-none);
|
|
160
|
+
--radius-sm: var(--radius-sm);
|
|
161
|
+
--radius-md: var(--radius-md);
|
|
162
|
+
--radius-lg: var(--radius-lg);
|
|
163
|
+
--radius-xl: var(--radius-xl);
|
|
164
|
+
--radius-full: var(--radius-full);
|
|
165
|
+
--shadow-sm: var(--shadow-sm);
|
|
166
|
+
--shadow-md: var(--shadow-md);
|
|
167
|
+
--shadow-lg: var(--shadow-lg);
|
|
168
|
+
--shadow-xl: var(--shadow-xl);
|
|
169
|
+
--ease-standard: var(--motion-easing-standard);
|
|
170
|
+
--ease-enter: var(--motion-easing-enter);
|
|
171
|
+
--ease-exit: var(--motion-easing-exit);
|
|
172
|
+
--transition-duration-fast: var(--motion-duration-fast);
|
|
173
|
+
--transition-duration-normal: var(--motion-duration-normal);
|
|
174
|
+
--transition-duration-slow: var(--motion-duration-slow);
|
|
175
|
+
--default-transition-duration: 0s;
|
|
176
|
+
}
|
|
@@ -10,7 +10,7 @@ export declare const tailwindTheme: {
|
|
|
10
10
|
danger: Record<import("./types.js").ColorScaleStep, string>;
|
|
11
11
|
neutral: Record<import("./types.js").ColorScaleStep, string>;
|
|
12
12
|
background: Record<"base" | "elevated" | "subtle" | "overlay" | "hover", string>;
|
|
13
|
-
text: Record<"primary" | "secondary" | "tertiary" | "disabled" | "inverse", string>;
|
|
13
|
+
text: Record<"primary" | "secondary" | "tertiary" | "disabled" | "inverse" | "placeholder", string>;
|
|
14
14
|
border: Record<"subtle" | "default" | "strong", string>;
|
|
15
15
|
code: Record<"string" | "keyword" | "tag" | "attr" | "comment" | "punctuation", string>;
|
|
16
16
|
artifact: Record<"string" | "base" | "text" | "border" | "strong" | "keyword" | "raised" | "muted" | "highlight", string>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tailwind theme built from the token definitions
|
|
2
|
+
* Tailwind theme built from the token definitions: every value is a
|
|
3
3
|
* var(--...) reference into tokens.css, never a raw value. Utilities
|
|
4
4
|
* like bg-primary-500 therefore resolve through the CSS custom
|
|
5
5
|
* property at runtime, which is what lets theme plugins re-skin the
|
|
6
6
|
* admin (and every plugin UI rendered with host components) by
|
|
7
|
-
* overriding variables
|
|
7
|
+
* overriding variables, with no build-time theme baking.
|
|
8
8
|
*
|
|
9
9
|
* Variable names here must stay in sync with generate.ts's flattening
|
|
10
10
|
* (color/spacing/radius/shadow/motion keep their section prefix,
|
|
@@ -20,7 +20,7 @@ function scaleRefs(scale, prefix) {
|
|
|
20
20
|
}
|
|
21
21
|
export const tailwindTheme = {
|
|
22
22
|
colors: {
|
|
23
|
-
// CSS keywords, not theme values
|
|
23
|
+
// CSS keywords, not theme values: the only non-var entries
|
|
24
24
|
transparent: 'transparent',
|
|
25
25
|
current: 'currentColor',
|
|
26
26
|
inherit: 'inherit',
|
|
@@ -3,10 +3,10 @@ export declare function toKebab(key: string): string;
|
|
|
3
3
|
export declare function flatten(value: unknown, path: string[], out: Record<string, string>): void;
|
|
4
4
|
/** THE theme mechanism: one token-override set → one [data-theme] CSS
|
|
5
5
|
* block. The build-time generator bakes built-ins through this exact
|
|
6
|
-
* function; the admin injects installed themes through it at runtime
|
|
6
|
+
* function; the admin injects installed themes through it at runtime,
|
|
7
7
|
* "same mechanism as a third-party theme" is true by construction, not
|
|
8
8
|
* by convention. Empty overrides → empty string (Light IS the :root
|
|
9
9
|
* default and emits no block). Entries whose name or value contain a
|
|
10
10
|
* CSS-escaping character are skipped (with a warning) rather than
|
|
11
|
-
* emitted
|
|
11
|
+
* emitted (see UNSAFE_CSS_CHARS). */
|
|
12
12
|
export declare function themeOverridesToCss(themeDomId: string, overrides: ThemeTokenOverrides): string;
|
|
@@ -20,12 +20,12 @@ export function flatten(value, path, out) {
|
|
|
20
20
|
const UNSAFE_CSS_CHARS = new RegExp('[{};\\u0000-\\u001f\\u007f]');
|
|
21
21
|
/** THE theme mechanism: one token-override set → one [data-theme] CSS
|
|
22
22
|
* block. The build-time generator bakes built-ins through this exact
|
|
23
|
-
* function; the admin injects installed themes through it at runtime
|
|
23
|
+
* function; the admin injects installed themes through it at runtime,
|
|
24
24
|
* "same mechanism as a third-party theme" is true by construction, not
|
|
25
25
|
* by convention. Empty overrides → empty string (Light IS the :root
|
|
26
26
|
* default and emits no block). Entries whose name or value contain a
|
|
27
27
|
* CSS-escaping character are skipped (with a warning) rather than
|
|
28
|
-
* emitted
|
|
28
|
+
* emitted (see UNSAFE_CSS_CHARS). */
|
|
29
29
|
export function themeOverridesToCss(themeDomId, overrides) {
|
|
30
30
|
const vars = {};
|
|
31
31
|
flatten(overrides, [], vars);
|
|
@@ -2,7 +2,7 @@ import type { ColorScale, KardalumDesignTokens } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* What a theme is allowed to touch: color scales/semantic groups and
|
|
4
4
|
* radius. Deliberately excludes typography, spacing, shadow, and motion
|
|
5
|
-
*
|
|
5
|
+
* (the Theme System section's "tokens only, never components" rule)
|
|
6
6
|
* still leaves room for a theme to accidentally reshape layout-adjacent
|
|
7
7
|
* tokens if the type allowed it; keeping the override surface to
|
|
8
8
|
* color + radius keeps themes cosmetic by construction, not just by
|
|
@@ -30,7 +30,7 @@ export interface ThemeTokenOverrides {
|
|
|
30
30
|
/** A built-in theme, shaped like a theme plugin MANIFEST's relevant
|
|
31
31
|
* slice ({id, name, type, contributions.themeTokens}) rather than the
|
|
32
32
|
* retired pre-SDK {tokens} shape. DELIBERATE WAIVER: built-in ids stay
|
|
33
|
-
* "light"/"dark" (not reverse-domain)
|
|
33
|
+
* "light"/"dark" (not reverse-domain): they are statically registered,
|
|
34
34
|
* never pass marketplace validation, and every [data-theme] consumer
|
|
35
35
|
* (tokens.css, docs pages, tests) keys on these historical ids. */
|
|
36
36
|
export interface BuiltInTheme {
|