@kardalum/plugin-sdk 0.18.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 +42 -0
- package/README.md +1 -1
- package/dist/assets/asset-picker.js +3 -3
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.js +4 -4
- package/dist/built-ins.js +10 -10
- package/dist/data-type-plugin.d.ts +2 -2
- package/dist/datatype-validation.d.ts +2 -2
- package/dist/datatype-validation.js +2 -2
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/manifest-schema.js +7 -1
- package/dist/media/media-picker.js +4 -4
- 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 +2 -2
- package/dist/richtext/extensions.js +7 -7
- package/dist/richtext/insert-menu.js +3 -3
- package/dist/richtext/style-listbox.js +1 -1
- package/dist/richtext/text-style-class.js +1 -1
- package/dist/simple-storage-value-provider.js +3 -3
- package/dist/structured-storage-types.d.ts +1 -1
- package/dist/structured-storage-types.js +2 -2
- package/dist/ui-entry.js +3 -3
- package/dist/views/asset-view.js +3 -3
- package/dist/views/date-range-view.js +5 -5
- package/dist/views/html-code-editor.js +2 -2
- package/dist/views/html-view.js +7 -7
- package/dist/views/image-view.js +4 -4
- package/dist/views/rich-text-view.js +4 -3
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +14 -8
- 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 +2 -2
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -3
- 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 +14 -4
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +11 -8
- package/node_modules/@kardalum/api-schemas/dist/index.js +6 -4
- 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 +47 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +42 -8
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +9 -9
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
- 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 +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +39 -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/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/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/snapshot.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +1 -1
- 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.js +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/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.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +5 -5
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +2 -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 +9 -9
- 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/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/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 +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
- 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/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 +12 -7
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- 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 +3 -1
- package/node_modules/@kardalum/ui/dist/index.js +3 -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 +7 -6
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The most a stored media ceiling may be (S358 P6). Uploads are held in memory. */
|
|
3
|
+
export declare const MEDIA_MAX_SIZE_CEILING_BYTES = 1073741824;
|
|
4
|
+
export declare const MAX_ASSET_BYTES_CEILING = 33554432;
|
|
5
|
+
export declare const MAX_TEMPLATE_BYTES_CEILING = 8388608;
|
|
6
|
+
/** The longest licence grace period, in days: a paid plugin's own check refuses a verdict older
|
|
7
|
+
* than this, so a longer period could never hold (S284b). */
|
|
8
|
+
export declare const LICENSE_GRACE_DAYS_MAX = 14;
|
|
9
|
+
export declare const RATE_LIMIT_SETTING_KEYS: readonly ["rateLimitKeyMax", "rateLimitIpMax", "rateLimitWindowSeconds", "rateLimitDocsMax", "rateLimitDocsWindowSeconds", "rateLimitMediaMax", "rateLimitMediaWindowSeconds", "rateLimitRenderMax", "rateLimitRenderWindowSeconds", "rateLimitAdminMax", "rateLimitAdminWindowSeconds"];
|
|
10
|
+
export type RateLimitSettingKey = (typeof RATE_LIMIT_SETTING_KEYS)[number];
|
|
11
|
+
export declare function isRateLimitSettingKey(key: string): key is RateLimitSettingKey;
|
|
12
|
+
export declare const RATE_LIMIT_MAX_CEILING = 1000000;
|
|
13
|
+
export declare const RATE_LIMIT_WINDOW_CEILING_SECONDS = 3600;
|
|
14
|
+
/** S359 spec D8: the administrator's own path runs through these two lanes. */
|
|
15
|
+
export declare const RATE_LIMIT_FLOORS_PER_MINUTE: {
|
|
16
|
+
readonly ip: 30;
|
|
17
|
+
readonly admin: 120;
|
|
18
|
+
};
|
|
19
|
+
/** The smallest maximum that keeps `floorPerMinute` over a window of `windowSeconds`. It floors
|
|
20
|
+
* the burst as well as the rate (S359 fix wave): a window under a minute still allows the
|
|
21
|
+
* per-minute floor in one window, because a cold admin load is many requests in under a second. */
|
|
22
|
+
export declare function rateLimitFloorMax(floorPerMinute: number, windowSeconds: number): number;
|
|
23
|
+
export declare const LIVE_SERVER_SETTING_KEYS: readonly ["previewTokenTtl", "previewBaseUrl", "publicUrl", "mediaMaxSize", "licenseCheckIntervalHours", "licenseStaleWarnDays", "maxAssetBytes", "maxTemplateBytes", "licenseGraceDays", "rateLimitKeyMax", "rateLimitIpMax", "rateLimitWindowSeconds", "rateLimitDocsMax", "rateLimitDocsWindowSeconds", "rateLimitMediaMax", "rateLimitMediaWindowSeconds", "rateLimitRenderMax", "rateLimitRenderWindowSeconds", "rateLimitAdminMax", "rateLimitAdminWindowSeconds"];
|
|
24
|
+
export declare const LiveServerSettingKeySchema: z.ZodEnum<{
|
|
25
|
+
licenseGraceDays: "licenseGraceDays";
|
|
26
|
+
licenseStaleWarnDays: "licenseStaleWarnDays";
|
|
27
|
+
rateLimitKeyMax: "rateLimitKeyMax";
|
|
28
|
+
rateLimitIpMax: "rateLimitIpMax";
|
|
29
|
+
rateLimitWindowSeconds: "rateLimitWindowSeconds";
|
|
30
|
+
rateLimitDocsMax: "rateLimitDocsMax";
|
|
31
|
+
rateLimitDocsWindowSeconds: "rateLimitDocsWindowSeconds";
|
|
32
|
+
rateLimitMediaMax: "rateLimitMediaMax";
|
|
33
|
+
rateLimitMediaWindowSeconds: "rateLimitMediaWindowSeconds";
|
|
34
|
+
rateLimitRenderMax: "rateLimitRenderMax";
|
|
35
|
+
rateLimitRenderWindowSeconds: "rateLimitRenderWindowSeconds";
|
|
36
|
+
rateLimitAdminMax: "rateLimitAdminMax";
|
|
37
|
+
rateLimitAdminWindowSeconds: "rateLimitAdminWindowSeconds";
|
|
38
|
+
previewTokenTtl: "previewTokenTtl";
|
|
39
|
+
previewBaseUrl: "previewBaseUrl";
|
|
40
|
+
publicUrl: "publicUrl";
|
|
41
|
+
mediaMaxSize: "mediaMaxSize";
|
|
42
|
+
licenseCheckIntervalHours: "licenseCheckIntervalHours";
|
|
43
|
+
maxAssetBytes: "maxAssetBytes";
|
|
44
|
+
maxTemplateBytes: "maxTemplateBytes";
|
|
45
|
+
}>;
|
|
46
|
+
export type LiveServerSettingKey = z.infer<typeof LiveServerSettingKeySchema>;
|
|
47
|
+
export declare const ServerSettingSourceSchema: z.ZodEnum<{
|
|
48
|
+
default: "default";
|
|
49
|
+
stored: "stored";
|
|
50
|
+
environment: "environment";
|
|
51
|
+
}>;
|
|
52
|
+
export type ServerSettingSource = z.infer<typeof ServerSettingSourceSchema>;
|
|
53
|
+
export declare const LiveServerSettingValueSchemas: {
|
|
54
|
+
readonly previewTokenTtl: z.ZodNumber;
|
|
55
|
+
readonly previewBaseUrl: z.ZodPipe<z.ZodString, z.ZodURL>;
|
|
56
|
+
readonly publicUrl: z.ZodPipe<z.ZodString, z.ZodURL>;
|
|
57
|
+
readonly mediaMaxSize: z.ZodNumber;
|
|
58
|
+
readonly licenseCheckIntervalHours: z.ZodNumber;
|
|
59
|
+
readonly licenseStaleWarnDays: z.ZodNumber;
|
|
60
|
+
readonly maxAssetBytes: z.ZodNumber;
|
|
61
|
+
readonly maxTemplateBytes: z.ZodNumber;
|
|
62
|
+
readonly licenseGraceDays: z.ZodNumber;
|
|
63
|
+
readonly rateLimitKeyMax: z.ZodNumber;
|
|
64
|
+
readonly rateLimitIpMax: z.ZodNumber;
|
|
65
|
+
readonly rateLimitWindowSeconds: z.ZodNumber;
|
|
66
|
+
readonly rateLimitDocsMax: z.ZodNumber;
|
|
67
|
+
readonly rateLimitDocsWindowSeconds: z.ZodNumber;
|
|
68
|
+
readonly rateLimitMediaMax: z.ZodNumber;
|
|
69
|
+
readonly rateLimitMediaWindowSeconds: z.ZodNumber;
|
|
70
|
+
readonly rateLimitRenderMax: z.ZodNumber;
|
|
71
|
+
readonly rateLimitRenderWindowSeconds: z.ZodNumber;
|
|
72
|
+
readonly rateLimitAdminMax: z.ZodNumber;
|
|
73
|
+
readonly rateLimitAdminWindowSeconds: z.ZodNumber;
|
|
74
|
+
};
|
|
75
|
+
export interface LiveServerSettingValues {
|
|
76
|
+
previewTokenTtl: number;
|
|
77
|
+
previewBaseUrl: string | null;
|
|
78
|
+
publicUrl: string | null;
|
|
79
|
+
mediaMaxSize: number;
|
|
80
|
+
licenseCheckIntervalHours: number;
|
|
81
|
+
licenseStaleWarnDays: number;
|
|
82
|
+
maxAssetBytes: number;
|
|
83
|
+
maxTemplateBytes: number;
|
|
84
|
+
licenseGraceDays: number;
|
|
85
|
+
rateLimitKeyMax: number;
|
|
86
|
+
rateLimitIpMax: number;
|
|
87
|
+
rateLimitWindowSeconds: number;
|
|
88
|
+
rateLimitDocsMax: number;
|
|
89
|
+
rateLimitDocsWindowSeconds: number;
|
|
90
|
+
rateLimitMediaMax: number;
|
|
91
|
+
rateLimitMediaWindowSeconds: number;
|
|
92
|
+
rateLimitRenderMax: number;
|
|
93
|
+
rateLimitRenderWindowSeconds: number;
|
|
94
|
+
rateLimitAdminMax: number;
|
|
95
|
+
rateLimitAdminWindowSeconds: number;
|
|
96
|
+
}
|
|
97
|
+
/** A key left out is unchanged; null clears the stored value (back to the environment). */
|
|
98
|
+
export declare const UpdateServerSettingsRequestSchema: z.ZodObject<{
|
|
99
|
+
previewTokenTtl: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
100
|
+
previewBaseUrl: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodURL>>>;
|
|
101
|
+
publicUrl: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodURL>>>;
|
|
102
|
+
mediaMaxSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
103
|
+
licenseCheckIntervalHours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
104
|
+
licenseStaleWarnDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
105
|
+
maxAssetBytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
106
|
+
maxTemplateBytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
licenseGraceDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
108
|
+
rateLimitKeyMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
109
|
+
rateLimitIpMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
110
|
+
rateLimitWindowSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
111
|
+
rateLimitDocsMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
112
|
+
rateLimitDocsWindowSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
113
|
+
rateLimitMediaMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
114
|
+
rateLimitMediaWindowSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
115
|
+
rateLimitRenderMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
116
|
+
rateLimitRenderWindowSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
117
|
+
rateLimitAdminMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
118
|
+
rateLimitAdminWindowSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
export type UpdateServerSettingsRequest = z.infer<typeof UpdateServerSettingsRequestSchema>;
|
|
121
|
+
export declare const LiveServerSettingRowSchema: z.ZodObject<{
|
|
122
|
+
key: z.ZodEnum<{
|
|
123
|
+
licenseGraceDays: "licenseGraceDays";
|
|
124
|
+
licenseStaleWarnDays: "licenseStaleWarnDays";
|
|
125
|
+
rateLimitKeyMax: "rateLimitKeyMax";
|
|
126
|
+
rateLimitIpMax: "rateLimitIpMax";
|
|
127
|
+
rateLimitWindowSeconds: "rateLimitWindowSeconds";
|
|
128
|
+
rateLimitDocsMax: "rateLimitDocsMax";
|
|
129
|
+
rateLimitDocsWindowSeconds: "rateLimitDocsWindowSeconds";
|
|
130
|
+
rateLimitMediaMax: "rateLimitMediaMax";
|
|
131
|
+
rateLimitMediaWindowSeconds: "rateLimitMediaWindowSeconds";
|
|
132
|
+
rateLimitRenderMax: "rateLimitRenderMax";
|
|
133
|
+
rateLimitRenderWindowSeconds: "rateLimitRenderWindowSeconds";
|
|
134
|
+
rateLimitAdminMax: "rateLimitAdminMax";
|
|
135
|
+
rateLimitAdminWindowSeconds: "rateLimitAdminWindowSeconds";
|
|
136
|
+
previewTokenTtl: "previewTokenTtl";
|
|
137
|
+
previewBaseUrl: "previewBaseUrl";
|
|
138
|
+
publicUrl: "publicUrl";
|
|
139
|
+
mediaMaxSize: "mediaMaxSize";
|
|
140
|
+
licenseCheckIntervalHours: "licenseCheckIntervalHours";
|
|
141
|
+
maxAssetBytes: "maxAssetBytes";
|
|
142
|
+
maxTemplateBytes: "maxTemplateBytes";
|
|
143
|
+
}>;
|
|
144
|
+
envName: z.ZodString;
|
|
145
|
+
value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
146
|
+
source: z.ZodEnum<{
|
|
147
|
+
default: "default";
|
|
148
|
+
stored: "stored";
|
|
149
|
+
environment: "environment";
|
|
150
|
+
}>;
|
|
151
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
152
|
+
defaultValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
153
|
+
envLine: z.ZodNullable<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
export declare const RestartOnlySettingRowSchema: z.ZodObject<{
|
|
156
|
+
envName: z.ZodString;
|
|
157
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
158
|
+
reason: z.ZodEnum<{
|
|
159
|
+
registration: "registration";
|
|
160
|
+
boundary: "boundary";
|
|
161
|
+
}>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
export declare const ServerSettingsResponseSchema: z.ZodObject<{
|
|
164
|
+
live: z.ZodArray<z.ZodObject<{
|
|
165
|
+
key: z.ZodEnum<{
|
|
166
|
+
licenseGraceDays: "licenseGraceDays";
|
|
167
|
+
licenseStaleWarnDays: "licenseStaleWarnDays";
|
|
168
|
+
rateLimitKeyMax: "rateLimitKeyMax";
|
|
169
|
+
rateLimitIpMax: "rateLimitIpMax";
|
|
170
|
+
rateLimitWindowSeconds: "rateLimitWindowSeconds";
|
|
171
|
+
rateLimitDocsMax: "rateLimitDocsMax";
|
|
172
|
+
rateLimitDocsWindowSeconds: "rateLimitDocsWindowSeconds";
|
|
173
|
+
rateLimitMediaMax: "rateLimitMediaMax";
|
|
174
|
+
rateLimitMediaWindowSeconds: "rateLimitMediaWindowSeconds";
|
|
175
|
+
rateLimitRenderMax: "rateLimitRenderMax";
|
|
176
|
+
rateLimitRenderWindowSeconds: "rateLimitRenderWindowSeconds";
|
|
177
|
+
rateLimitAdminMax: "rateLimitAdminMax";
|
|
178
|
+
rateLimitAdminWindowSeconds: "rateLimitAdminWindowSeconds";
|
|
179
|
+
previewTokenTtl: "previewTokenTtl";
|
|
180
|
+
previewBaseUrl: "previewBaseUrl";
|
|
181
|
+
publicUrl: "publicUrl";
|
|
182
|
+
mediaMaxSize: "mediaMaxSize";
|
|
183
|
+
licenseCheckIntervalHours: "licenseCheckIntervalHours";
|
|
184
|
+
maxAssetBytes: "maxAssetBytes";
|
|
185
|
+
maxTemplateBytes: "maxTemplateBytes";
|
|
186
|
+
}>;
|
|
187
|
+
envName: z.ZodString;
|
|
188
|
+
value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
189
|
+
source: z.ZodEnum<{
|
|
190
|
+
default: "default";
|
|
191
|
+
stored: "stored";
|
|
192
|
+
environment: "environment";
|
|
193
|
+
}>;
|
|
194
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
195
|
+
defaultValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
196
|
+
envLine: z.ZodNullable<z.ZodString>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
restartOnly: z.ZodArray<z.ZodObject<{
|
|
199
|
+
envName: z.ZodString;
|
|
200
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
201
|
+
reason: z.ZodEnum<{
|
|
202
|
+
registration: "registration";
|
|
203
|
+
boundary: "boundary";
|
|
204
|
+
}>;
|
|
205
|
+
}, z.core.$strip>>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
export type ServerSettingsResponse = z.infer<typeof ServerSettingsResponseSchema>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { strictUrl } from "./strict-url.js";
|
|
3
|
+
// S358 (S236 spec): the operational settings an administrator may change without a
|
|
4
|
+
// restart. The list is closed on purpose (S236 spec section 8: never a general env
|
|
5
|
+
// editor); a key outside it is refused by the strict request schema.
|
|
6
|
+
/** The most a stored media ceiling may be (S358 P6). Uploads are held in memory. */
|
|
7
|
+
export const MEDIA_MAX_SIZE_CEILING_BYTES = 1_073_741_824;
|
|
8
|
+
// S358b spec D2: the most a stored text asset or template limit may be. A text asset is held in
|
|
9
|
+
// memory and in one database row on every dialect; a template is parsed on every render.
|
|
10
|
+
export const MAX_ASSET_BYTES_CEILING = 33_554_432;
|
|
11
|
+
export const MAX_TEMPLATE_BYTES_CEILING = 8_388_608;
|
|
12
|
+
/** The longest licence grace period, in days: a paid plugin's own check refuses a verdict older
|
|
13
|
+
* than this, so a longer period could never hold (S284b). */
|
|
14
|
+
export const LICENSE_GRACE_DAYS_MAX = 14;
|
|
15
|
+
// S359 (S359 spec D1, D8): the rate limits an administrator may change without a restart.
|
|
16
|
+
// Login, setup and the session lane are not here on purpose (D2, D4).
|
|
17
|
+
export const RATE_LIMIT_SETTING_KEYS = [
|
|
18
|
+
"rateLimitKeyMax",
|
|
19
|
+
"rateLimitIpMax",
|
|
20
|
+
"rateLimitWindowSeconds",
|
|
21
|
+
"rateLimitDocsMax",
|
|
22
|
+
"rateLimitDocsWindowSeconds",
|
|
23
|
+
"rateLimitMediaMax",
|
|
24
|
+
"rateLimitMediaWindowSeconds",
|
|
25
|
+
"rateLimitRenderMax",
|
|
26
|
+
"rateLimitRenderWindowSeconds",
|
|
27
|
+
"rateLimitAdminMax",
|
|
28
|
+
"rateLimitAdminWindowSeconds",
|
|
29
|
+
];
|
|
30
|
+
export function isRateLimitSettingKey(key) {
|
|
31
|
+
return RATE_LIMIT_SETTING_KEYS.includes(key);
|
|
32
|
+
}
|
|
33
|
+
export const RATE_LIMIT_MAX_CEILING = 1_000_000;
|
|
34
|
+
export const RATE_LIMIT_WINDOW_CEILING_SECONDS = 3600;
|
|
35
|
+
/** S359 spec D8: the administrator's own path runs through these two lanes. */
|
|
36
|
+
export const RATE_LIMIT_FLOORS_PER_MINUTE = { ip: 30, admin: 120 };
|
|
37
|
+
/** The smallest maximum that keeps `floorPerMinute` over a window of `windowSeconds`. It floors
|
|
38
|
+
* the burst as well as the rate (S359 fix wave): a window under a minute still allows the
|
|
39
|
+
* per-minute floor in one window, because a cold admin load is many requests in under a second. */
|
|
40
|
+
export function rateLimitFloorMax(floorPerMinute, windowSeconds) {
|
|
41
|
+
return Math.max(floorPerMinute, Math.ceil((floorPerMinute * windowSeconds) / 60));
|
|
42
|
+
}
|
|
43
|
+
const RateLimitMaxSchema = z.number().int().min(1).max(RATE_LIMIT_MAX_CEILING);
|
|
44
|
+
const RateLimitWindowSchema = z.number().int().min(1).max(RATE_LIMIT_WINDOW_CEILING_SECONDS);
|
|
45
|
+
export const LIVE_SERVER_SETTING_KEYS = [
|
|
46
|
+
"previewTokenTtl",
|
|
47
|
+
"previewBaseUrl",
|
|
48
|
+
"publicUrl",
|
|
49
|
+
"mediaMaxSize",
|
|
50
|
+
"licenseCheckIntervalHours",
|
|
51
|
+
"licenseStaleWarnDays",
|
|
52
|
+
"maxAssetBytes",
|
|
53
|
+
"maxTemplateBytes",
|
|
54
|
+
"licenseGraceDays",
|
|
55
|
+
...RATE_LIMIT_SETTING_KEYS,
|
|
56
|
+
];
|
|
57
|
+
export const LiveServerSettingKeySchema = z.enum(LIVE_SERVER_SETTING_KEYS);
|
|
58
|
+
export const ServerSettingSourceSchema = z.enum(["stored", "environment", "default"]);
|
|
59
|
+
const NO_SPACE = /\s/;
|
|
60
|
+
const BASE_URL_MESSAGE = "Enter an http or https address with no user name, password, spaces, query or fragment.";
|
|
61
|
+
/** No credentials, no whitespace, and no query or fragment (a bare `?` or `#` included),
|
|
62
|
+
* which the public host reader refuses too. strictUrl has already refused control
|
|
63
|
+
* characters and anything but http or https; the URL global is declared in whatwg-url.d.ts. */
|
|
64
|
+
function isPlainBaseUrl(value) {
|
|
65
|
+
if (NO_SPACE.test(value) || value.includes("?") || value.includes("#"))
|
|
66
|
+
return false;
|
|
67
|
+
try {
|
|
68
|
+
const url = new URL(value);
|
|
69
|
+
return url.username === "" && url.password === "";
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const BaseUrlSchema = strictUrl({ protocol: /^https?$/, max: 2048, error: BASE_URL_MESSAGE }).refine(isPlainBaseUrl, {
|
|
76
|
+
message: BASE_URL_MESSAGE,
|
|
77
|
+
});
|
|
78
|
+
export const LiveServerSettingValueSchemas = {
|
|
79
|
+
previewTokenTtl: z.number().int().min(60).max(2_592_000),
|
|
80
|
+
previewBaseUrl: BaseUrlSchema,
|
|
81
|
+
publicUrl: BaseUrlSchema,
|
|
82
|
+
mediaMaxSize: z.number().int().min(1).max(MEDIA_MAX_SIZE_CEILING_BYTES),
|
|
83
|
+
licenseCheckIntervalHours: z.number().int().min(1).max(504),
|
|
84
|
+
licenseStaleWarnDays: z.number().int().min(1).max(365),
|
|
85
|
+
maxAssetBytes: z.number().int().min(1).max(MAX_ASSET_BYTES_CEILING),
|
|
86
|
+
maxTemplateBytes: z.number().int().min(1).max(MAX_TEMPLATE_BYTES_CEILING),
|
|
87
|
+
licenseGraceDays: z.number().int().min(1).max(LICENSE_GRACE_DAYS_MAX),
|
|
88
|
+
rateLimitKeyMax: RateLimitMaxSchema,
|
|
89
|
+
rateLimitIpMax: RateLimitMaxSchema,
|
|
90
|
+
rateLimitWindowSeconds: RateLimitWindowSchema,
|
|
91
|
+
rateLimitDocsMax: RateLimitMaxSchema,
|
|
92
|
+
rateLimitDocsWindowSeconds: RateLimitWindowSchema,
|
|
93
|
+
rateLimitMediaMax: RateLimitMaxSchema,
|
|
94
|
+
rateLimitMediaWindowSeconds: RateLimitWindowSchema,
|
|
95
|
+
rateLimitRenderMax: RateLimitMaxSchema,
|
|
96
|
+
rateLimitRenderWindowSeconds: RateLimitWindowSchema,
|
|
97
|
+
rateLimitAdminMax: RateLimitMaxSchema,
|
|
98
|
+
rateLimitAdminWindowSeconds: RateLimitWindowSchema,
|
|
99
|
+
};
|
|
100
|
+
/** A key left out is unchanged; null clears the stored value (back to the environment). */
|
|
101
|
+
export const UpdateServerSettingsRequestSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
previewTokenTtl: LiveServerSettingValueSchemas.previewTokenTtl.nullable().optional(),
|
|
104
|
+
previewBaseUrl: LiveServerSettingValueSchemas.previewBaseUrl.nullable().optional(),
|
|
105
|
+
publicUrl: LiveServerSettingValueSchemas.publicUrl.nullable().optional(),
|
|
106
|
+
mediaMaxSize: LiveServerSettingValueSchemas.mediaMaxSize.nullable().optional(),
|
|
107
|
+
licenseCheckIntervalHours: LiveServerSettingValueSchemas.licenseCheckIntervalHours.nullable().optional(),
|
|
108
|
+
licenseStaleWarnDays: LiveServerSettingValueSchemas.licenseStaleWarnDays.nullable().optional(),
|
|
109
|
+
maxAssetBytes: LiveServerSettingValueSchemas.maxAssetBytes.nullable().optional(),
|
|
110
|
+
maxTemplateBytes: LiveServerSettingValueSchemas.maxTemplateBytes.nullable().optional(),
|
|
111
|
+
licenseGraceDays: LiveServerSettingValueSchemas.licenseGraceDays.nullable().optional(),
|
|
112
|
+
rateLimitKeyMax: LiveServerSettingValueSchemas.rateLimitKeyMax.nullable().optional(),
|
|
113
|
+
rateLimitIpMax: LiveServerSettingValueSchemas.rateLimitIpMax.nullable().optional(),
|
|
114
|
+
rateLimitWindowSeconds: LiveServerSettingValueSchemas.rateLimitWindowSeconds.nullable().optional(),
|
|
115
|
+
rateLimitDocsMax: LiveServerSettingValueSchemas.rateLimitDocsMax.nullable().optional(),
|
|
116
|
+
rateLimitDocsWindowSeconds: LiveServerSettingValueSchemas.rateLimitDocsWindowSeconds.nullable().optional(),
|
|
117
|
+
rateLimitMediaMax: LiveServerSettingValueSchemas.rateLimitMediaMax.nullable().optional(),
|
|
118
|
+
rateLimitMediaWindowSeconds: LiveServerSettingValueSchemas.rateLimitMediaWindowSeconds.nullable().optional(),
|
|
119
|
+
rateLimitRenderMax: LiveServerSettingValueSchemas.rateLimitRenderMax.nullable().optional(),
|
|
120
|
+
rateLimitRenderWindowSeconds: LiveServerSettingValueSchemas.rateLimitRenderWindowSeconds.nullable().optional(),
|
|
121
|
+
rateLimitAdminMax: LiveServerSettingValueSchemas.rateLimitAdminMax.nullable().optional(),
|
|
122
|
+
rateLimitAdminWindowSeconds: LiveServerSettingValueSchemas.rateLimitAdminWindowSeconds.nullable().optional(),
|
|
123
|
+
})
|
|
124
|
+
.strict()
|
|
125
|
+
.refine((change) => Object.keys(change).length > 0, { message: "Name at least one setting to change." });
|
|
126
|
+
const SettingValueSchema = z.union([z.number(), z.string(), z.null()]);
|
|
127
|
+
export const LiveServerSettingRowSchema = z.object({
|
|
128
|
+
key: LiveServerSettingKeySchema,
|
|
129
|
+
envName: z.string(),
|
|
130
|
+
value: SettingValueSchema,
|
|
131
|
+
source: ServerSettingSourceSchema,
|
|
132
|
+
/** The variable as the environment holds it, or null when it is unset. */
|
|
133
|
+
environment: z.string().nullable(),
|
|
134
|
+
defaultValue: SettingValueSchema,
|
|
135
|
+
/** For a stored value, the line that would set the same value in `.env` (S358 P1). */
|
|
136
|
+
envLine: z.string().nullable(),
|
|
137
|
+
});
|
|
138
|
+
export const RestartOnlySettingRowSchema = z.object({
|
|
139
|
+
envName: z.string(),
|
|
140
|
+
environment: z.string().nullable(),
|
|
141
|
+
/** "registration": read when the server starts (S236b). "boundary": kept out of the admin on purpose. */
|
|
142
|
+
reason: z.enum(["registration", "boundary"]),
|
|
143
|
+
});
|
|
144
|
+
export const ServerSettingsResponseSchema = z.object({
|
|
145
|
+
live: z.array(LiveServerSettingRowSchema),
|
|
146
|
+
restartOnly: z.array(RestartOnlySettingRowSchema),
|
|
147
|
+
});
|
|
@@ -10,6 +10,12 @@ export declare const BundledTemplateSchema: z.ZodObject<{
|
|
|
10
10
|
}, z.core.$catchall<z.ZodString>>, unknown>>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
export type BundledTemplate = z.infer<typeof BundledTemplateSchema>;
|
|
13
|
+
export declare const SetupHandoffFailedStageSchema: z.ZodEnum<{
|
|
14
|
+
build: "build";
|
|
15
|
+
close: "close";
|
|
16
|
+
listen: "listen";
|
|
17
|
+
}>;
|
|
18
|
+
export type SetupHandoffFailedStage = z.infer<typeof SetupHandoffFailedStageSchema>;
|
|
13
19
|
export declare const SetupStatusResponseSchema: z.ZodObject<{
|
|
14
20
|
setupRequired: z.ZodBoolean;
|
|
15
21
|
bundledTemplates: z.ZodArray<z.ZodObject<{
|
|
@@ -23,6 +29,11 @@ export declare const SetupStatusResponseSchema: z.ZodObject<{
|
|
|
23
29
|
}, z.core.$catchall<z.ZodString>>, unknown>>;
|
|
24
30
|
}, z.core.$strip>>;
|
|
25
31
|
databaseConfigured: z.ZodBoolean;
|
|
32
|
+
handoffFailed: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
build: "build";
|
|
34
|
+
close: "close";
|
|
35
|
+
listen: "listen";
|
|
36
|
+
}>>;
|
|
26
37
|
}, z.core.$strip>;
|
|
27
38
|
export type SetupStatusResponse = z.infer<typeof SetupStatusResponseSchema>;
|
|
28
39
|
export declare const SetupStarterSelectionSchema: z.ZodObject<{
|
|
@@ -3,7 +3,7 @@ import { InstallAnswersSchema, InstallDescriptionSchema } from "./plugin-install
|
|
|
3
3
|
import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
|
|
4
4
|
import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
|
|
5
5
|
// One bundled first-party starter template (currently only the blog
|
|
6
|
-
// template
|
|
6
|
+
// template, apps/server/src/setup/bundled-templates.ts) offered from the
|
|
7
7
|
// setup wizard's optional "starter template" step. `pluginId` matches the
|
|
8
8
|
// template plugin's manifest id (e.g. "com.kardalum.blog"): the same id the
|
|
9
9
|
// marketplace install flow uses elsewhere, so a template picked here and a
|
|
@@ -20,9 +20,15 @@ export const BundledTemplateSchema = z.object({
|
|
|
20
20
|
// checkbox.
|
|
21
21
|
sampleContentDescription: InstallDescriptionSchema.optional(),
|
|
22
22
|
});
|
|
23
|
+
// S357c (D5): where a failed no-restart handover stopped (the server's
|
|
24
|
+
// boot/hand-off-to-full-app.ts). A kind only: the error's own text stays in
|
|
25
|
+
// the server log and never reaches a response. "build": the full app could
|
|
26
|
+
// not be built and the wizard is still served; "close": the setup app did
|
|
27
|
+
// not close cleanly; "listen": the full app could not take the port.
|
|
28
|
+
export const SetupHandoffFailedStageSchema = z.enum(["build", "close", "listen"]);
|
|
23
29
|
export const SetupStatusResponseSchema = z.object({
|
|
24
30
|
setupRequired: z.boolean(),
|
|
25
|
-
// Always present
|
|
31
|
+
// Always present: [] outside setup mode (a fully-configured instance has
|
|
26
32
|
// nothing left to offer here) and whenever nothing bundled is resolvable,
|
|
27
33
|
// never omitted or null.
|
|
28
34
|
bundledTemplates: z.array(BundledTemplateSchema),
|
|
@@ -31,6 +37,9 @@ export const SetupStatusResponseSchema = z.object({
|
|
|
31
37
|
// See the BootMode type and resolveBootMode function in
|
|
32
38
|
// apps/server/src/boot/resolve-boot-mode.ts for the three states.
|
|
33
39
|
databaseConfigured: z.boolean(),
|
|
40
|
+
// S357c (D5): present only after setup completed and the handover to the
|
|
41
|
+
// full app failed, so the wizard can say why it asks for a restart.
|
|
42
|
+
handoffFailed: SetupHandoffFailedStageSchema.optional(),
|
|
34
43
|
});
|
|
35
44
|
const SqliteSelectionSchema = z.object({
|
|
36
45
|
dialect: z.literal("sqlite"),
|
|
@@ -64,8 +73,8 @@ export const SetupCompleteRequestSchema = z.object({
|
|
|
64
73
|
// Optional because the wizard has two shapes. On a fresh instance it
|
|
65
74
|
// collects a database selection; when DATABASE_URL was already injected
|
|
66
75
|
// the database is configured and read-only, and the request carries the
|
|
67
|
-
// admin only. The ROUTE enforces the pairing in both directions
|
|
68
|
-
// routes/setup.ts
|
|
76
|
+
// admin only. The ROUTE enforces the pairing in both directions (
|
|
77
|
+
// routes/setup.ts) because "optional" alone would let a caller silently
|
|
69
78
|
// send a selection that is ignored.
|
|
70
79
|
database: z
|
|
71
80
|
.discriminatedUnion("dialect", [
|
|
@@ -77,7 +86,7 @@ export const SetupCompleteRequestSchema = z.object({
|
|
|
77
86
|
starter: SetupStarterSelectionSchema.optional(),
|
|
78
87
|
});
|
|
79
88
|
// What happened to the requested starter. "failed" never fails setup
|
|
80
|
-
// itself
|
|
89
|
+
// itself (the admin account and database config always stand), so this
|
|
81
90
|
// rides alongside success: true rather than replacing it. `reason` is only
|
|
82
91
|
// present on failure.
|
|
83
92
|
export const SetupStarterResultSchema = z.object({
|
|
@@ -94,12 +103,12 @@ export const SetupStarterResultSchema = z.object({
|
|
|
94
103
|
});
|
|
95
104
|
export const SetupCompleteResponseSchema = z.object({
|
|
96
105
|
success: z.literal(true),
|
|
97
|
-
// ABSENT (not null) when no starter was requested
|
|
106
|
+
// ABSENT (not null) when no starter was requested: the skip-path
|
|
98
107
|
// response stays byte-identical to the pre-starter shape.
|
|
99
108
|
starter: SetupStarterResultSchema.optional(),
|
|
100
109
|
// ABSENT unless setup completed but could not write its configuration
|
|
101
|
-
// to disk. Setup itself still succeeded
|
|
102
|
-
// provisioned database stand
|
|
110
|
+
// to disk. Setup itself still succeeded (the admin account and the
|
|
111
|
+
// provisioned database stand), so this rides alongside success: true
|
|
103
112
|
// rather than replacing it, exactly as `starter` does.
|
|
104
113
|
configWarning: z.string().min(1).optional(),
|
|
105
114
|
});
|
|
@@ -14,6 +14,6 @@ export const SnapshotSchema = z.object({
|
|
|
14
14
|
createdBy: z.string().uuid(),
|
|
15
15
|
items: z.array(SnapshotItemSchema),
|
|
16
16
|
});
|
|
17
|
-
// Timeline listings
|
|
17
|
+
// Timeline listings leave items out on purpose: a snapshot's items array
|
|
18
18
|
// scales with tree size and the timeline only needs the row facts.
|
|
19
19
|
export const SnapshotMetaSchema = SnapshotSchema.omit({ items: true });
|
|
@@ -22,7 +22,7 @@ export const CreateTemplateRequestSchema = z
|
|
|
22
22
|
})
|
|
23
23
|
.strict();
|
|
24
24
|
// baseVersion is optional-conflict-detection only (S195): it never enters
|
|
25
|
-
// the name/content refine below
|
|
25
|
+
// the name/content refine below: a request with only a baseVersion still
|
|
26
26
|
// fails that check, same as before this field existed.
|
|
27
27
|
export const UpdateTemplateRequestSchema = z
|
|
28
28
|
.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
/** GET /api/themes
|
|
2
|
+
/** GET /api/themes: installed, enabled theme plugins' token overrides.
|
|
3
3
|
* tokens is the manifest's contributions.themeTokens passed through
|
|
4
4
|
* verbatim; its inner shape is validated at install time by the SDK's
|
|
5
5
|
* themeTokensSchema, so here it is an opaque record (color/radius). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
/** GET /api/themes
|
|
2
|
+
/** GET /api/themes: installed, enabled theme plugins' token overrides.
|
|
3
3
|
* tokens is the manifest's contributions.themeTokens passed through
|
|
4
4
|
* verbatim; its inner shape is validated at install time by the SDK's
|
|
5
5
|
* themeTokensSchema, so here it is an opaque record (color/radius). */
|
|
@@ -3,7 +3,7 @@ import { HomeLayoutSchema } from "./home.schema.js";
|
|
|
3
3
|
import { RoleIdSchema } from "./role.schema.js";
|
|
4
4
|
// S272: `role` is the id of a row in `roles`, validated as a slug here and
|
|
5
5
|
// for existence on the server. Before S272 it was a two-value enum.
|
|
6
|
-
// What user management reads
|
|
6
|
+
// What user management reads, never the passwordHash.
|
|
7
7
|
export const UserSummarySchema = z.object({
|
|
8
8
|
id: z.string().uuid(),
|
|
9
9
|
email: z.string().email(),
|
|
@@ -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))
|
|
@@ -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 {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { BuiltInTheme } from '../theme-types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Dark theme overrides (S177/S178): warm charcoal, not GitHub-black. The
|
|
4
|
-
* light blue (#7CC0E8) becomes the ACTION colour itself
|
|
4
|
+
* light blue (#7CC0E8) becomes the ACTION colour itself: primary-600 is
|
|
5
5
|
* remapped to it, and text.inverse flips to near-black so `bg-primary-600
|
|
6
6
|
* text-text-inverse` (every primary button) stays legible without any
|
|
7
7
|
* component knowing which theme is active. Status scales remap the steps
|
|
8
|
-
* components use accordingly (100 fill, 600, and the AA text step
|
|
9
|
-
* for success/danger, 800 for warning). Colour only
|
|
8
|
+
* components use accordingly (100 fill, 600, and the AA text step: 700
|
|
9
|
+
* for success/danger, 800 for warning). Colour only; the
|
|
10
10
|
* Theme System contract keeps typography/spacing/shadow/motion in the
|
|
11
11
|
* base set.
|
|
12
12
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dark theme overrides (S177/S178): warm charcoal, not GitHub-black. The
|
|
3
|
-
* light blue (#7CC0E8) becomes the ACTION colour itself
|
|
3
|
+
* light blue (#7CC0E8) becomes the ACTION colour itself: primary-600 is
|
|
4
4
|
* remapped to it, and text.inverse flips to near-black so `bg-primary-600
|
|
5
5
|
* text-text-inverse` (every primary button) stays legible without any
|
|
6
6
|
* component knowing which theme is active. Status scales remap the steps
|
|
7
|
-
* components use accordingly (100 fill, 600, and the AA text step
|
|
8
|
-
* for success/danger, 800 for warning). Colour only
|
|
7
|
+
* components use accordingly (100 fill, 600, and the AA text step: 700
|
|
8
|
+
* for success/danger, 800 for warning). Colour only; the
|
|
9
9
|
* Theme System contract keeps typography/spacing/shadow/motion in the
|
|
10
10
|
* base set.
|
|
11
11
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BuiltInTheme } from '../theme-types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Light needs no overrides
|
|
3
|
+
* Light needs no overrides: the base token set generated to :root
|
|
4
4
|
* (tokens.ts) already IS the light theme. Still modeled as a real
|
|
5
5
|
* BuiltInTheme, not a special case: applying any theme is always
|
|
6
6
|
* "set data-theme to this id," whether or not that theme happens to
|