@pioneercompany/app-sdk 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PioneerError = void 0;
3
+ exports.THEME_CONFIG_COLOR_KEYS = exports.THEME_COLOR_KEYS = exports.PioneerError = void 0;
4
4
  exports.connectApp = connectApp;
5
5
  const error_js_1 = require("../error.js");
6
6
  var error_js_2 = require("../error.js");
7
7
  Object.defineProperty(exports, "PioneerError", { enumerable: true, get: function () { return error_js_2.PioneerError; } });
8
+ const theme_js_1 = require("./theme.js");
9
+ var theme_js_2 = require("./theme.js");
10
+ Object.defineProperty(exports, "THEME_COLOR_KEYS", { enumerable: true, get: function () { return theme_js_2.THEME_COLOR_KEYS; } });
11
+ Object.defineProperty(exports, "THEME_CONFIG_COLOR_KEYS", { enumerable: true, get: function () { return theme_js_2.THEME_CONFIG_COLOR_KEYS; } });
8
12
  /** Resolves immediately: Pioneer has no theme handshake or readiness event. */
9
13
  async function connectApp(options = {}) {
10
14
  if (typeof window === "undefined")
@@ -56,17 +60,12 @@ async function connectApp(options = {}) {
56
60
  }
57
61
  return;
58
62
  }
59
- if (!data || data.type !== "pioneer.theme" || !data.palette)
63
+ if (!data || data.type !== "pioneer.theme")
60
64
  return;
61
- const value = data.palette;
62
- if (value.appearance !== "dark" && value.appearance !== "light")
65
+ const theme = (0, theme_js_1.decodeTheme)(data.theme);
66
+ if (!theme)
63
67
  return;
64
- const colors = ["background", "foreground", "muted", "border", "accent", "accent-foreground"];
65
- for (const key of colors) {
66
- if (typeof value[key] !== "string" || value[key].length > 128 || !CSS.supports("color", value[key]))
67
- return;
68
- }
69
- current = Object.freeze({ appearance: value.appearance, ...Object.fromEntries(colors.map(key => [key, value[key]])) });
68
+ current = theme;
70
69
  for (const listener of [...listeners]) {
71
70
  if (disposed)
72
71
  break;
@@ -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ChB,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAC/C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;gBACpC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,CAAC,MAAM,CAAC,IAAA,kBAAO,EAAC,YAAY,CAAC,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,59 @@
1
+ /** JSON theme snapshot: native field names are retained without aliases. */
2
+ export type ThemeMode = "light" | "dark";
3
+ export type ThemeValue = null | boolean | number | string | readonly ThemeValue[] | ThemeObject;
4
+ export interface ThemeObject {
5
+ readonly [key: string]: ThemeValue | undefined;
6
+ }
7
+ /** Resolved native colors, including roles absent from a user's theme file. */
8
+ export declare const THEME_COLOR_KEYS: readonly ["accent", "accent_foreground", "accordion", "background", "border", "button", "button_active", "button_foreground", "button_hover", "button_danger", "button_danger_active", "button_danger_foreground", "button_danger_hover", "button_info", "button_info_active", "button_info_foreground", "button_info_hover", "button_primary", "button_primary_active", "button_primary_foreground", "button_primary_hover", "button_secondary", "button_secondary_active", "button_secondary_foreground", "button_secondary_hover", "button_success", "button_success_active", "button_success_foreground", "button_success_hover", "button_warning", "button_warning_active", "button_warning_foreground", "button_warning_hover", "group_box", "group_box_foreground", "caret", "chart_1", "chart_2", "chart_3", "chart_4", "chart_5", "chart_bullish", "chart_bearish", "chart_grid", "danger", "danger_active", "danger_foreground", "danger_hover", "description_list_label", "description_list_label_foreground", "drag_border", "drop_target", "foreground", "info", "info_active", "info_foreground", "info_hover", "input", "link", "link_active", "link_hover", "list", "list_active", "list_active_border", "list_even", "list_head", "list_hover", "muted", "muted_foreground", "popover", "popover_foreground", "primary", "primary_active", "primary_foreground", "primary_hover", "progress_bar", "ring", "scrollbar", "scrollbar_thumb", "scrollbar_thumb_hover", "secondary", "secondary_active", "secondary_foreground", "secondary_hover", "selection", "sidebar", "sidebar_accent", "sidebar_accent_foreground", "sidebar_border", "sidebar_foreground", "sidebar_primary", "sidebar_primary_foreground", "skeleton", "slider_bar", "slider_thumb", "success", "success_foreground", "success_hover", "success_active", "switch", "switch_thumb", "tab", "tab_active", "tab_active_foreground", "tab_bar", "tab_bar_segmented", "tab_foreground", "table", "table_active", "table_active_border", "table_even", "table_head", "table_head_foreground", "table_foot", "table_foot_foreground", "table_hover", "table_row_border", "title_bar", "title_bar_border", "status_bar", "status_bar_border", "warning", "warning_active", "warning_hover", "warning_foreground", "overlay", "window_border", "red", "red_light", "green", "green_light", "blue", "blue_light", "yellow", "yellow_light", "magenta", "magenta_light", "cyan", "cyan_light"];
9
+ export type ThemeColorName = typeof THEME_COLOR_KEYS[number];
10
+ export type ThemeColors = Readonly<Record<ThemeColorName, string> & Record<string, string>>;
11
+ /** Theme-file keys from the complete GPUI ThemeConfigColors schema. */
12
+ export declare const THEME_CONFIG_COLOR_KEYS: readonly ["accent.background", "accent.foreground", "accordion.background", "background", "border", "button.background", "button.active.background", "button.foreground", "button.hover.background", "button.danger.background", "button.danger.active.background", "button.danger.foreground", "button.danger.hover.background", "button.info.background", "button.info.active.background", "button.info.foreground", "button.info.hover.background", "button.primary.background", "button.primary.active.background", "button.primary.foreground", "button.primary.hover.background", "button.secondary.background", "button.secondary.active.background", "button.secondary.foreground", "button.secondary.hover.background", "button.success.background", "button.success.active.background", "button.success.foreground", "button.success.hover.background", "button.warning.background", "button.warning.active.background", "button.warning.foreground", "button.warning.hover.background", "group_box.background", "group_box.foreground", "group_box.title.foreground", "caret", "chart.1", "chart.2", "chart.3", "chart.4", "chart.5", "chart.bullish", "chart.bearish", "chart.grid", "danger.background", "danger.active.background", "danger.foreground", "danger.hover.background", "description_list.label.background", "description_list.label.foreground", "drag.border", "drop_target.background", "foreground", "info.background", "info.active.background", "info.foreground", "info.hover.background", "input.border", "link", "link.active", "link.hover", "list.background", "list.active.background", "list.active.border", "list.even.background", "list.head.background", "list.hover.background", "muted.background", "muted.foreground", "popover.background", "popover.foreground", "primary.background", "primary.active.background", "primary.foreground", "primary.hover.background", "progress.bar.background", "ring", "scrollbar.background", "scrollbar.thumb.background", "scrollbar.thumb.hover.background", "secondary.background", "secondary.active.background", "secondary.foreground", "secondary.hover.background", "selection.background", "sidebar.background", "sidebar.accent.background", "sidebar.accent.foreground", "sidebar.border", "sidebar.foreground", "sidebar.primary.background", "sidebar.primary.foreground", "skeleton.background", "slider.background", "slider.thumb.background", "success.background", "success.foreground", "success.hover.background", "success.active.background", "switch.background", "switch.thumb.background", "tab.background", "tab.active.background", "tab.active.foreground", "tab_bar.background", "tab_bar.segmented.background", "tab.foreground", "table.background", "table.active.background", "table.active.border", "table.even.background", "table.head.background", "table.head.foreground", "table.foot.background", "table.foot.foreground", "table.hover.background", "table.row.border", "title_bar.background", "title_bar.border", "status_bar.background", "status_bar.border", "warning.background", "warning.active.background", "warning.hover.background", "warning.foreground", "overlay", "window.border", "base.blue", "base.blue.light", "base.cyan", "base.cyan.light", "base.green", "base.green.light", "base.magenta", "base.magenta.light", "base.red", "base.red.light", "base.yellow", "base.yellow.light"];
13
+ export type ThemeConfigColorName = typeof THEME_CONFIG_COLOR_KEYS[number];
14
+ export type ThemeConfigColors = Readonly<Partial<Record<ThemeConfigColorName, string | null>> & ThemeObject>;
15
+ export interface ThemeConfig extends ThemeObject {
16
+ readonly name: string;
17
+ readonly mode: ThemeMode;
18
+ readonly is_default?: boolean;
19
+ readonly "font.size"?: number | null;
20
+ readonly "font.family"?: string | null;
21
+ readonly "mono_font.size"?: number | null;
22
+ readonly "mono_font.family"?: string | null;
23
+ readonly radius?: number | null;
24
+ readonly "radius.lg"?: number | null;
25
+ readonly "window.radius"?: number | null;
26
+ readonly shadow?: boolean | null;
27
+ readonly colors: ThemeConfigColors;
28
+ readonly highlight?: ThemeObject | null;
29
+ }
30
+ export interface ThemeToken extends ThemeObject {
31
+ readonly color: string;
32
+ readonly background: ThemeValue;
33
+ }
34
+ /** All serializable native Theme fields, plus its full semantic projection. */
35
+ export interface Theme extends ThemeObject {
36
+ readonly mode: ThemeMode;
37
+ readonly colors: ThemeColors;
38
+ readonly light_theme: ThemeConfig;
39
+ readonly dark_theme: ThemeConfig;
40
+ readonly tokens: Readonly<Record<string, ThemeToken>>;
41
+ readonly semantic_tokens: ThemeObject;
42
+ readonly highlight_theme: ThemeObject;
43
+ readonly font_family: string;
44
+ readonly font_size: number;
45
+ readonly mono_font_family: string;
46
+ readonly mono_font_size: number;
47
+ readonly radius: number;
48
+ readonly radius_lg: number;
49
+ readonly window_radius: number;
50
+ readonly shadow: boolean;
51
+ readonly focus_ring: boolean;
52
+ readonly transparent: string;
53
+ readonly scrollbar_mode: string;
54
+ readonly list: ThemeObject;
55
+ readonly sheet: ThemeObject;
56
+ }
57
+ /** Clone/freeze the complete JSON tree; never project it onto a field whitelist. */
58
+ export declare function decodeTheme(value: unknown): Readonly<Theme> | null;
59
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/client/theme.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,UAAU,EAAE,GAAG,WAAW,CAAC;AAChG,MAAM,WAAW,WAAW;IAAG,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;CAAE;AAE/E,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,00EA4InB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,C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exports.THEME_COLOR_KEYS = void 0;
4
+ exports.decodeTheme = decodeTheme;
5
+ /** Resolved native colors, including roles absent from a user's theme file. */
6
+ exports.THEME_COLOR_KEYS = [
7
+ "accent",
8
+ "accent_foreground",
9
+ "accordion",
10
+ "background",
11
+ "border",
12
+ "button",
13
+ "button_active",
14
+ "button_foreground",
15
+ "button_hover",
16
+ "button_danger",
17
+ "button_danger_active",
18
+ "button_danger_foreground",
19
+ "button_danger_hover",
20
+ "button_info",
21
+ "button_info_active",
22
+ "button_info_foreground",
23
+ "button_info_hover",
24
+ "button_primary",
25
+ "button_primary_active",
26
+ "button_primary_foreground",
27
+ "button_primary_hover",
28
+ "button_secondary",
29
+ "button_secondary_active",
30
+ "button_secondary_foreground",
31
+ "button_secondary_hover",
32
+ "button_success",
33
+ "button_success_active",
34
+ "button_success_foreground",
35
+ "button_success_hover",
36
+ "button_warning",
37
+ "button_warning_active",
38
+ "button_warning_foreground",
39
+ "button_warning_hover",
40
+ "group_box",
41
+ "group_box_foreground",
42
+ "caret",
43
+ "chart_1",
44
+ "chart_2",
45
+ "chart_3",
46
+ "chart_4",
47
+ "chart_5",
48
+ "chart_bullish",
49
+ "chart_bearish",
50
+ "chart_grid",
51
+ "danger",
52
+ "danger_active",
53
+ "danger_foreground",
54
+ "danger_hover",
55
+ "description_list_label",
56
+ "description_list_label_foreground",
57
+ "drag_border",
58
+ "drop_target",
59
+ "foreground",
60
+ "info",
61
+ "info_active",
62
+ "info_foreground",
63
+ "info_hover",
64
+ "input",
65
+ "link",
66
+ "link_active",
67
+ "link_hover",
68
+ "list",
69
+ "list_active",
70
+ "list_active_border",
71
+ "list_even",
72
+ "list_head",
73
+ "list_hover",
74
+ "muted",
75
+ "muted_foreground",
76
+ "popover",
77
+ "popover_foreground",
78
+ "primary",
79
+ "primary_active",
80
+ "primary_foreground",
81
+ "primary_hover",
82
+ "progress_bar",
83
+ "ring",
84
+ "scrollbar",
85
+ "scrollbar_thumb",
86
+ "scrollbar_thumb_hover",
87
+ "secondary",
88
+ "secondary_active",
89
+ "secondary_foreground",
90
+ "secondary_hover",
91
+ "selection",
92
+ "sidebar",
93
+ "sidebar_accent",
94
+ "sidebar_accent_foreground",
95
+ "sidebar_border",
96
+ "sidebar_foreground",
97
+ "sidebar_primary",
98
+ "sidebar_primary_foreground",
99
+ "skeleton",
100
+ "slider_bar",
101
+ "slider_thumb",
102
+ "success",
103
+ "success_foreground",
104
+ "success_hover",
105
+ "success_active",
106
+ "switch",
107
+ "switch_thumb",
108
+ "tab",
109
+ "tab_active",
110
+ "tab_active_foreground",
111
+ "tab_bar",
112
+ "tab_bar_segmented",
113
+ "tab_foreground",
114
+ "table",
115
+ "table_active",
116
+ "table_active_border",
117
+ "table_even",
118
+ "table_head",
119
+ "table_head_foreground",
120
+ "table_foot",
121
+ "table_foot_foreground",
122
+ "table_hover",
123
+ "table_row_border",
124
+ "title_bar",
125
+ "title_bar_border",
126
+ "status_bar",
127
+ "status_bar_border",
128
+ "warning",
129
+ "warning_active",
130
+ "warning_hover",
131
+ "warning_foreground",
132
+ "overlay",
133
+ "window_border",
134
+ "red",
135
+ "red_light",
136
+ "green",
137
+ "green_light",
138
+ "blue",
139
+ "blue_light",
140
+ "yellow",
141
+ "yellow_light",
142
+ "magenta",
143
+ "magenta_light",
144
+ "cyan",
145
+ "cyan_light",
146
+ ];
147
+ /** Theme-file keys from the complete GPUI ThemeConfigColors schema. */
148
+ exports.THEME_CONFIG_COLOR_KEYS = [
149
+ "accent.background",
150
+ "accent.foreground",
151
+ "accordion.background",
152
+ "background",
153
+ "border",
154
+ "button.background",
155
+ "button.active.background",
156
+ "button.foreground",
157
+ "button.hover.background",
158
+ "button.danger.background",
159
+ "button.danger.active.background",
160
+ "button.danger.foreground",
161
+ "button.danger.hover.background",
162
+ "button.info.background",
163
+ "button.info.active.background",
164
+ "button.info.foreground",
165
+ "button.info.hover.background",
166
+ "button.primary.background",
167
+ "button.primary.active.background",
168
+ "button.primary.foreground",
169
+ "button.primary.hover.background",
170
+ "button.secondary.background",
171
+ "button.secondary.active.background",
172
+ "button.secondary.foreground",
173
+ "button.secondary.hover.background",
174
+ "button.success.background",
175
+ "button.success.active.background",
176
+ "button.success.foreground",
177
+ "button.success.hover.background",
178
+ "button.warning.background",
179
+ "button.warning.active.background",
180
+ "button.warning.foreground",
181
+ "button.warning.hover.background",
182
+ "group_box.background",
183
+ "group_box.foreground",
184
+ "group_box.title.foreground",
185
+ "caret",
186
+ "chart.1",
187
+ "chart.2",
188
+ "chart.3",
189
+ "chart.4",
190
+ "chart.5",
191
+ "chart.bullish",
192
+ "chart.bearish",
193
+ "chart.grid",
194
+ "danger.background",
195
+ "danger.active.background",
196
+ "danger.foreground",
197
+ "danger.hover.background",
198
+ "description_list.label.background",
199
+ "description_list.label.foreground",
200
+ "drag.border",
201
+ "drop_target.background",
202
+ "foreground",
203
+ "info.background",
204
+ "info.active.background",
205
+ "info.foreground",
206
+ "info.hover.background",
207
+ "input.border",
208
+ "link",
209
+ "link.active",
210
+ "link.hover",
211
+ "list.background",
212
+ "list.active.background",
213
+ "list.active.border",
214
+ "list.even.background",
215
+ "list.head.background",
216
+ "list.hover.background",
217
+ "muted.background",
218
+ "muted.foreground",
219
+ "popover.background",
220
+ "popover.foreground",
221
+ "primary.background",
222
+ "primary.active.background",
223
+ "primary.foreground",
224
+ "primary.hover.background",
225
+ "progress.bar.background",
226
+ "ring",
227
+ "scrollbar.background",
228
+ "scrollbar.thumb.background",
229
+ "scrollbar.thumb.hover.background",
230
+ "secondary.background",
231
+ "secondary.active.background",
232
+ "secondary.foreground",
233
+ "secondary.hover.background",
234
+ "selection.background",
235
+ "sidebar.background",
236
+ "sidebar.accent.background",
237
+ "sidebar.accent.foreground",
238
+ "sidebar.border",
239
+ "sidebar.foreground",
240
+ "sidebar.primary.background",
241
+ "sidebar.primary.foreground",
242
+ "skeleton.background",
243
+ "slider.background",
244
+ "slider.thumb.background",
245
+ "success.background",
246
+ "success.foreground",
247
+ "success.hover.background",
248
+ "success.active.background",
249
+ "switch.background",
250
+ "switch.thumb.background",
251
+ "tab.background",
252
+ "tab.active.background",
253
+ "tab.active.foreground",
254
+ "tab_bar.background",
255
+ "tab_bar.segmented.background",
256
+ "tab.foreground",
257
+ "table.background",
258
+ "table.active.background",
259
+ "table.active.border",
260
+ "table.even.background",
261
+ "table.head.background",
262
+ "table.head.foreground",
263
+ "table.foot.background",
264
+ "table.foot.foreground",
265
+ "table.hover.background",
266
+ "table.row.border",
267
+ "title_bar.background",
268
+ "title_bar.border",
269
+ "status_bar.background",
270
+ "status_bar.border",
271
+ "warning.background",
272
+ "warning.active.background",
273
+ "warning.hover.background",
274
+ "warning.foreground",
275
+ "overlay",
276
+ "window.border",
277
+ "base.blue",
278
+ "base.blue.light",
279
+ "base.cyan",
280
+ "base.cyan.light",
281
+ "base.green",
282
+ "base.green.light",
283
+ "base.magenta",
284
+ "base.magenta.light",
285
+ "base.red",
286
+ "base.red.light",
287
+ "base.yellow",
288
+ "base.yellow.light",
289
+ ];
290
+ function object(value) {
291
+ return value !== null && typeof value === "object" && !Array.isArray(value);
292
+ }
293
+ const mode = (value) => value === "light" || value === "dark";
294
+ const color = (value) => typeof value === "string" && value.length <= 128 && CSS.supports("color", value);
295
+ /** Clone/freeze the complete JSON tree; never project it onto a field whitelist. */
296
+ function decodeTheme(value) {
297
+ let nodes = 0;
298
+ let characters = 0;
299
+ const ancestors = new Set();
300
+ const clone = (value, depth) => {
301
+ if (++nodes > 50000 || depth > 32)
302
+ throw new Error("Theme exceeds limits");
303
+ if (value === null || typeof value === "boolean")
304
+ return value;
305
+ if (typeof value === "number" && Number.isFinite(value))
306
+ return value;
307
+ if (typeof value === "string") {
308
+ characters += value.length;
309
+ if (value.length > 65536 || characters > 1024 * 1024)
310
+ throw new Error("Theme exceeds limits");
311
+ return value;
312
+ }
313
+ if (typeof value !== "object" || ancestors.has(value))
314
+ throw new Error("Invalid theme JSON");
315
+ const prototype = Object.getPrototypeOf(value);
316
+ if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null)
317
+ throw new Error("Invalid theme object");
318
+ ancestors.add(value);
319
+ try {
320
+ if (Array.isArray(value)) {
321
+ if (value.length > 50000 - nodes)
322
+ throw new Error("Theme exceeds limits");
323
+ return Object.freeze(Array.from(value, item => clone(item, depth + 1)));
324
+ }
325
+ const source = Object.entries(value);
326
+ if (source.length > 50000 - nodes)
327
+ throw new Error("Theme exceeds limits");
328
+ const entries = source.map(([key, item]) => {
329
+ characters += key.length;
330
+ if (key.length > 256 || characters > 1024 * 1024)
331
+ throw new Error("Theme exceeds limits");
332
+ return [key, clone(item, depth + 1)];
333
+ });
334
+ return Object.freeze(Object.fromEntries(entries));
335
+ }
336
+ finally {
337
+ ancestors.delete(value);
338
+ }
339
+ };
340
+ try {
341
+ const theme = clone(value, 0);
342
+ if (!object(theme) || !mode(theme.mode))
343
+ return null;
344
+ const colors = theme.colors;
345
+ if (!object(colors) || !exports.THEME_COLOR_KEYS.every(key => color(colors[key])))
346
+ return null;
347
+ if (!Object.values(colors).every(color))
348
+ return null;
349
+ for (const [key, expected] of [["light_theme", "light"], ["dark_theme", "dark"]]) {
350
+ const config = theme[key];
351
+ if (!object(config) || config.mode !== expected || typeof config.name !== "string" || !object(config.colors))
352
+ return null;
353
+ if (!Object.values(config.colors).every(value => value === null || typeof value === "string"))
354
+ return null;
355
+ for (const key of ["font.size", "mono_font.size", "radius", "radius.lg", "window.radius"]) {
356
+ const value = config[key];
357
+ if (value !== undefined && value !== null && (typeof value !== "number" || value < 0))
358
+ return null;
359
+ }
360
+ for (const key of ["font.family", "mono_font.family"]) {
361
+ if (config[key] !== undefined && config[key] !== null && typeof config[key] !== "string")
362
+ return null;
363
+ }
364
+ if (config.is_default !== undefined && typeof config.is_default !== "boolean")
365
+ return null;
366
+ if (config.shadow !== undefined && config.shadow !== null && typeof config.shadow !== "boolean")
367
+ return null;
368
+ if (config.highlight !== undefined && config.highlight !== null && !object(config.highlight))
369
+ return null;
370
+ }
371
+ for (const key of ["font_family", "mono_font_family", "scrollbar_mode"]) {
372
+ if (typeof theme[key] !== "string")
373
+ return null;
374
+ }
375
+ for (const key of ["font_size", "mono_font_size", "radius", "radius_lg", "window_radius"]) {
376
+ const value = theme[key];
377
+ if (typeof value !== "number" || value < 0)
378
+ return null;
379
+ }
380
+ if (typeof theme.shadow !== "boolean" || typeof theme.focus_ring !== "boolean" || !color(theme.transparent))
381
+ return null;
382
+ for (const key of ["tokens", "semantic_tokens", "highlight_theme", "list", "sheet"]) {
383
+ if (!object(theme[key]))
384
+ return null;
385
+ }
386
+ for (const token of Object.values(theme.tokens)) {
387
+ if (!object(token) || !color(token.color) || !("background" in token))
388
+ return null;
389
+ }
390
+ return theme;
391
+ }
392
+ catch {
393
+ return null;
394
+ }
395
+ }
396
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/client/theme.ts"],"names":[],"mappings":";;;AA2VA,kCAsEC;AA5ZD,+EAA+E;AAClE,QAAA,gBAAgB,GAAG;IAC9B,QAAQ;IACR,mBAAmB;IACnB,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,sBAAsB;IACtB,0BAA0B;IAC1B,qBAAqB;IACrB,aAAa;IACb,oBAAoB;IACpB,wBAAwB;IACxB,mBAAmB;IACnB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,sBAAsB;IACtB,kBAAkB;IAClB,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;IACxB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,sBAAsB;IACtB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,sBAAsB;IACtB,WAAW;IACX,sBAAsB;IACtB,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,eAAe;IACf,eAAe;IACf,YA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,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC;QACzH,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YACpF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;QACvC,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAqB,CAAC,EAAE,CAAC;YAC/D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;QACrF,CAAC;QACD,OAAO,KAAc,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAC1B,CAAC"}
package/docs/contract.md CHANGED
@@ -36,21 +36,33 @@ view URL, never execution credentials.
36
36
  ## Theme
37
37
 
38
38
  The iframe parent, or the direct dev page's own window, posts
39
- {type:'pioneer.theme',palette:{appearance,background,foreground,
40
- muted,border,accent,'accent-foreground'}}. appearance is light/dark; colors are
41
- valid CSS colors of at most 128 characters. Embedded pages check source===parent
42
- without demanding a non-opaque origin. Top-level pages check source===window AND
43
- origin===location.origin. Theme is public styling data, never an identity proof.
44
- No environment variable, handshake or ready event is involved. Import is inert
45
- and SSR-safe; call connectApp at browser module initialization before iframe load
46
- (production) or DOMContentLoaded (dev). It installs its listener synchronously,
47
- before awaiting the returned promise. Dev injection sends at initialization and
48
- DOMContentLoaded; native load/theme updates may send again, but a late connection
49
- cannot request a resend. current starts null until a valid message. subscribe
50
- immediately delivers known current, then future updates. Connections own separate
51
- state/listeners; disposing one leaves another active. Reconnecting after disposal
52
- starts null. No palette is synthesized outside Pioneer. SDK never mutates DOM,
53
- styles or hydration markup: the application owns state and rendering.
39
+ `{type:'pioneer.theme', theme: snapshot}`. SDK 0.2 uses the complete serialized native
40
+ Theme, rather than 0.1's selected flat `palette`. Native names and nesting remain
41
+ intact: `mode`, resolved `colors`, `light_theme`, `dark_theme`, `tokens`, fonts,
42
+ radii, shadow/focus/scrollbar settings, list/sheet settings and syntax highlighting.
43
+ `semantic_tokens` also carries the full native semantic projection. Both theme
44
+ configs retain all theme-file keys, including nullable inherited colors and
45
+ highlight settings. Resolved colors are CSS strings; raw config values may use
46
+ native color names or gradients. Unknown fields and nested JSON values survive.
47
+
48
+ The source is checked before decoding: embedded pages accept only their parent;
49
+ top-level pages require self plus exact origin. The SDK validates the snapshot's
50
+ required shape, resolved CSS colors and finite numeric settings, then clones and
51
+ deep-freezes the entire tree without a projection whitelist. JSON is bounded to
52
+ 50,000 values, 32 nesting levels, 1 MiB of key/string characters and 64 KiB per
53
+ string. Invalid, oversized or cyclic snapshots do not replace the last valid one.
54
+ Theme remains public styling data, never an identity proof or backend authority.
55
+
56
+ Connect during module initialization before iframe load (production) or
57
+ DOMContentLoaded (dev). The listener installs synchronously; `current` starts null
58
+ and late subscribers receive the known immutable snapshot immediately. Clients
59
+ are independent; disposal removes their listeners. There is no handshake/resend,
60
+ DOM mutation or synthesized host palette. Full snapshots update on native theme
61
+ changes, including edits only to the inactive Light/Dark config. Native delivery
62
+ caches snapshots on theme notifications rather than serializing them each poll.
63
+
64
+ SDK 0.2 intentionally does not interpret old `palette` messages. Update Desktop
65
+ and the SDK together. See [the complete format and migration](theme.md).
54
66
 
55
67
  ## View presentation
56
68