@cognolo/runtime 0.4.2
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/LICENSE +9 -0
- package/README.md +56 -0
- package/dist/agent.d.ts +290 -0
- package/dist/agent.js +245 -0
- package/dist/bundle.d.ts +192 -0
- package/dist/bundle.js +133 -0
- package/dist/cloud.d.ts +301 -0
- package/dist/cloud.js +383 -0
- package/dist/compact.d.ts +58 -0
- package/dist/compact.js +138 -0
- package/dist/context.d.ts +169 -0
- package/dist/context.js +144 -0
- package/dist/gate.d.ts +106 -0
- package/dist/gate.js +82 -0
- package/dist/guard.d.ts +15 -0
- package/dist/guard.js +26 -0
- package/dist/help.d.ts +44 -0
- package/dist/help.js +79 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +25 -0
- package/dist/init-cli.d.ts +40 -0
- package/dist/init-cli.js +317 -0
- package/dist/links.d.ts +39 -0
- package/dist/links.js +89 -0
- package/dist/look.d.ts +462 -0
- package/dist/look.js +362 -0
- package/dist/models.d.ts +79 -0
- package/dist/models.js +145 -0
- package/dist/outside.d.ts +102 -0
- package/dist/outside.js +204 -0
- package/dist/page.d.ts +59 -0
- package/dist/page.js +158 -0
- package/dist/passkey-browser.d.ts +40 -0
- package/dist/passkey-browser.js +48 -0
- package/dist/passkey.d.ts +64 -0
- package/dist/passkey.js +130 -0
- package/dist/pictures.d.ts +23 -0
- package/dist/pictures.js +58 -0
- package/dist/propose.d.ts +36 -0
- package/dist/propose.js +178 -0
- package/dist/rate.d.ts +97 -0
- package/dist/rate.js +147 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.js +7 -0
- package/dist/react/labels.d.ts +167 -0
- package/dist/react/labels.js +114 -0
- package/dist/react/logic.d.ts +77 -0
- package/dist/react/logic.js +140 -0
- package/dist/react/page-view.d.ts +3 -0
- package/dist/react/page-view.js +308 -0
- package/dist/react/panel.d.ts +179 -0
- package/dist/react/panel.js +749 -0
- package/dist/react/use-chat.d.ts +96 -0
- package/dist/react/use-chat.js +252 -0
- package/dist/research.d.ts +109 -0
- package/dist/research.js +207 -0
- package/dist/route.d.ts +405 -0
- package/dist/route.js +1493 -0
- package/dist/search.d.ts +70 -0
- package/dist/search.js +112 -0
- package/dist/sensitive.d.ts +54 -0
- package/dist/sensitive.js +209 -0
- package/dist/setup.d.ts +93 -0
- package/dist/setup.js +658 -0
- package/dist/store-sql.d.ts +52 -0
- package/dist/store-sql.js +150 -0
- package/dist/store.d.ts +166 -0
- package/dist/store.js +201 -0
- package/dist/text.d.ts +9 -0
- package/dist/text.js +21 -0
- package/dist/tool.d.ts +66 -0
- package/dist/tool.js +36 -0
- package/dist/trust.d.ts +13 -0
- package/dist/trust.js +18 -0
- package/dist/version.d.ts +40 -0
- package/dist/version.js +133 -0
- package/dist/webmcp-browser.d.ts +20 -0
- package/dist/webmcp-browser.js +61 -0
- package/dist/workflow.d.ts +253 -0
- package/dist/workflow.js +310 -0
- package/docs/store.md +330 -0
- package/package.json +71 -0
package/dist/look.d.ts
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
export interface CloudLook {
|
|
2
|
+
/** `#rrggbb`, the accent on a light panel (and on a dark one too when `accentDark` is missing). */
|
|
3
|
+
accent?: string;
|
|
4
|
+
/** `#rrggbb`, the accent on a dark panel. */
|
|
5
|
+
accentDark?: string;
|
|
6
|
+
scheme?: "light" | "dark" | "auto";
|
|
7
|
+
/** One of `THEMES`: the whole palette (background, text, muted text, bubble, border, default accent) in light and dark. */
|
|
8
|
+
theme?: ThemeId;
|
|
9
|
+
/**
|
|
10
|
+
* `#rrggbb`, the company's brand colour: over `theme`, it makes a light and a dark theme of its own (`brandTheme`), tinted
|
|
11
|
+
* in its hue as far as every contrast rule allows. Never a status hue. Locked with `theme`.
|
|
12
|
+
*/
|
|
13
|
+
brand?: string;
|
|
14
|
+
/** `large` makes all the panel's text bigger. Never smaller than normal. */
|
|
15
|
+
text?: "normal" | "large";
|
|
16
|
+
/** `rich` tints the theme's background, bubbles and borders with its colour (themes in `RICH_IDS` only), on a light panel. */
|
|
17
|
+
intensity?: "subtle" | "rich";
|
|
18
|
+
/** The same for a dark panel; light and dark versions are set apart, as they look very different. Missing: `intensity`. */
|
|
19
|
+
intensityDark?: "subtle" | "rich";
|
|
20
|
+
radius?: "square" | "slight" | "soft" | "round";
|
|
21
|
+
/** One of `APPROVALS`: the Approve green and the waiting card's amber, from tested sets only. High contrast ignores it. */
|
|
22
|
+
approval?: ApprovalId;
|
|
23
|
+
/** One of `APPROVE_GREENS`: the Approve button's green, over the approval set's own. Locked with `approval`. */
|
|
24
|
+
approveGreen?: GreenId;
|
|
25
|
+
/** `accent` fills the title bar with the accent colour, `color` with `headerColor`. */
|
|
26
|
+
header?: "plain" | "accent" | "color";
|
|
27
|
+
/** `#rrggbb` for `header: "color"`: any colour that isn't a status hue; its text is black or white, whichever reads. */
|
|
28
|
+
headerColor?: string;
|
|
29
|
+
/** Optional `#rrggbb` for the header on a dark panel, with `header: "color"` (same rules); without it `headerColor` is used on both. */
|
|
30
|
+
headerColorDark?: string;
|
|
31
|
+
/** `app` uses the page's own font; `serif` a serif stack. Never a font name. */
|
|
32
|
+
font?: "system" | "app" | "serif";
|
|
33
|
+
density?: "comfortable" | "compact";
|
|
34
|
+
/** `bubbles` draws messages as round, phone-style chat bubbles; `blocks` (the default) follows the corners setting. */
|
|
35
|
+
messages?: "blocks" | "bubbles";
|
|
36
|
+
title?: string;
|
|
37
|
+
/** The label of the button that opens the panel. */
|
|
38
|
+
launcher?: string;
|
|
39
|
+
greeting?: string;
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/** Example questions: they fill the message box, never send. */
|
|
42
|
+
examples?: string[];
|
|
43
|
+
/** The company's logo in the header, left of the title: a PNG, JPEG or WebP data URL of at most `LOGO_MAX_BYTES`. Never a web
|
|
44
|
+
* address (nothing is fetched) and never SVG (it can carry script). The panel shows it only on a plan with branding. */
|
|
45
|
+
logo?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Where the panel sits: `docked`, `card` or `window`. Used unless the app left it off `cognoloCloud({ layouts })`
|
|
48
|
+
* (all three are allowed when that is left out) or locked `layout`; the client drops any other before it reaches the panel.
|
|
49
|
+
*/
|
|
50
|
+
layout?: Layout;
|
|
51
|
+
}
|
|
52
|
+
/** What an app can lock with `lockLook`. Locking `accent` locks both shades, `intensity` both strengths, `header` its colour. */
|
|
53
|
+
export declare const LOOK_FIELDS: readonly ["accent", "scheme", "theme", "intensity", "approval", "radius", "header", "font", "density", "messages", "title", "launcher", "greeting", "placeholder", "examples", "logo", "layout", "text"];
|
|
54
|
+
/** Where the panel sits: a full-height side panel, a card in a bottom corner, or a window the person moves and resizes. */
|
|
55
|
+
export type Layout = "docked" | "card" | "window";
|
|
56
|
+
export declare const LAYOUTS: readonly Layout[];
|
|
57
|
+
export type LookField = (typeof LOOK_FIELDS)[number];
|
|
58
|
+
/** One scheme of a theme. `accent` is its default accent; every pair the panel draws is checked in tests. */
|
|
59
|
+
export interface Palette {
|
|
60
|
+
bg: string;
|
|
61
|
+
fg: string;
|
|
62
|
+
muted: string;
|
|
63
|
+
soft: string;
|
|
64
|
+
line: string;
|
|
65
|
+
accent: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The themes Cognolo ships. Backgrounds stay low in colour so the waiting and can't-be-undone cards always
|
|
69
|
+
* stand out; a test holds every theme to the contrast rules in `paletteProblems`. `classic` is the panel's own default.
|
|
70
|
+
*/
|
|
71
|
+
export declare const THEMES: {
|
|
72
|
+
readonly classic: {
|
|
73
|
+
readonly name: "Classic";
|
|
74
|
+
readonly light: {
|
|
75
|
+
readonly bg: "#ffffff";
|
|
76
|
+
readonly fg: "#0f172a";
|
|
77
|
+
readonly muted: "#55607a";
|
|
78
|
+
readonly soft: "#f1f5f9";
|
|
79
|
+
readonly line: "#e2e8f0";
|
|
80
|
+
readonly accent: "#4f46e5";
|
|
81
|
+
};
|
|
82
|
+
readonly dark: {
|
|
83
|
+
readonly bg: "#1f1f1f";
|
|
84
|
+
readonly fg: "#e5e5e5";
|
|
85
|
+
readonly muted: "#b4b4b4";
|
|
86
|
+
readonly soft: "#2a2a2a";
|
|
87
|
+
readonly line: "#3a3a3a";
|
|
88
|
+
readonly accent: "#a5b4fc";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly slate: {
|
|
92
|
+
readonly name: "Slate";
|
|
93
|
+
readonly light: {
|
|
94
|
+
readonly bg: "#f8fafc";
|
|
95
|
+
readonly fg: "#0f172a";
|
|
96
|
+
readonly muted: "#4b5563";
|
|
97
|
+
readonly soft: "#e8edf3";
|
|
98
|
+
readonly line: "#d5dde6";
|
|
99
|
+
readonly accent: "#1d4ed8";
|
|
100
|
+
};
|
|
101
|
+
readonly dark: {
|
|
102
|
+
readonly bg: "#0f172a";
|
|
103
|
+
readonly fg: "#e2e8f0";
|
|
104
|
+
readonly muted: "#a8b3c4";
|
|
105
|
+
readonly soft: "#1e293b";
|
|
106
|
+
readonly line: "#334155";
|
|
107
|
+
readonly accent: "#93c5fd";
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
readonly ocean: {
|
|
111
|
+
readonly name: "Ocean";
|
|
112
|
+
readonly light: {
|
|
113
|
+
readonly bg: "#f5fafd";
|
|
114
|
+
readonly fg: "#0c2a3a";
|
|
115
|
+
readonly muted: "#3f5a68";
|
|
116
|
+
readonly soft: "#e2f0f7";
|
|
117
|
+
readonly line: "#c9e0ec";
|
|
118
|
+
readonly accent: "#0e6a8a";
|
|
119
|
+
};
|
|
120
|
+
readonly dark: {
|
|
121
|
+
readonly bg: "#0b1b24";
|
|
122
|
+
readonly fg: "#dcecf3";
|
|
123
|
+
readonly muted: "#9fb9c6";
|
|
124
|
+
readonly soft: "#13303e";
|
|
125
|
+
readonly line: "#24495a";
|
|
126
|
+
readonly accent: "#7dd3fc";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly stone: {
|
|
130
|
+
readonly name: "Stone";
|
|
131
|
+
readonly light: {
|
|
132
|
+
readonly bg: "#fbfaf8";
|
|
133
|
+
readonly fg: "#1c1917";
|
|
134
|
+
readonly muted: "#57534e";
|
|
135
|
+
readonly soft: "#efece8";
|
|
136
|
+
readonly line: "#dedad4";
|
|
137
|
+
readonly accent: "#3d5a80";
|
|
138
|
+
};
|
|
139
|
+
readonly dark: {
|
|
140
|
+
readonly bg: "#1c1a18";
|
|
141
|
+
readonly fg: "#ece8e3";
|
|
142
|
+
readonly muted: "#b8b0a6";
|
|
143
|
+
readonly soft: "#2a2724";
|
|
144
|
+
readonly line: "#3d3934";
|
|
145
|
+
readonly accent: "#a9c1de";
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
readonly violet: {
|
|
149
|
+
readonly name: "Violet";
|
|
150
|
+
readonly light: {
|
|
151
|
+
readonly bg: "#fcfbff";
|
|
152
|
+
readonly fg: "#1e1533";
|
|
153
|
+
readonly muted: "#5b5470";
|
|
154
|
+
readonly soft: "#efecf8";
|
|
155
|
+
readonly line: "#ddd8ee";
|
|
156
|
+
readonly accent: "#6d28d9";
|
|
157
|
+
};
|
|
158
|
+
readonly dark: {
|
|
159
|
+
readonly bg: "#17131f";
|
|
160
|
+
readonly fg: "#ebe7f4";
|
|
161
|
+
readonly muted: "#b3abc6";
|
|
162
|
+
readonly soft: "#241e31";
|
|
163
|
+
readonly line: "#3a3250";
|
|
164
|
+
readonly accent: "#c4b5fd";
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
readonly graphite: {
|
|
168
|
+
readonly name: "Graphite";
|
|
169
|
+
readonly light: {
|
|
170
|
+
readonly bg: "#ffffff";
|
|
171
|
+
readonly fg: "#111111";
|
|
172
|
+
readonly muted: "#525252";
|
|
173
|
+
readonly soft: "#ececec";
|
|
174
|
+
readonly line: "#d9d9d9";
|
|
175
|
+
readonly accent: "#262626";
|
|
176
|
+
};
|
|
177
|
+
readonly dark: {
|
|
178
|
+
readonly bg: "#0a0a0a";
|
|
179
|
+
readonly fg: "#ededed";
|
|
180
|
+
readonly muted: "#b3b3b3";
|
|
181
|
+
readonly soft: "#1c1c1c";
|
|
182
|
+
readonly line: "#333333";
|
|
183
|
+
readonly accent: "#f5f5f5";
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
readonly contrast: {
|
|
187
|
+
readonly name: "High contrast";
|
|
188
|
+
readonly light: {
|
|
189
|
+
readonly bg: "#ffffff";
|
|
190
|
+
readonly fg: "#000000";
|
|
191
|
+
readonly muted: "#2b2b2b";
|
|
192
|
+
readonly soft: "#ebebeb";
|
|
193
|
+
readonly line: "#000000";
|
|
194
|
+
readonly accent: "#0000cc";
|
|
195
|
+
};
|
|
196
|
+
readonly dark: {
|
|
197
|
+
readonly bg: "#000000";
|
|
198
|
+
readonly fg: "#ffffff";
|
|
199
|
+
readonly muted: "#d6d6d6";
|
|
200
|
+
readonly soft: "#1f1f1f";
|
|
201
|
+
readonly line: "#ffffff";
|
|
202
|
+
readonly accent: "#66e0ff";
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export type ThemeId = keyof typeof THEMES;
|
|
207
|
+
export declare const THEME_IDS: ThemeId[];
|
|
208
|
+
/** The palette in use for a theme (the default when missing) and a scheme. */
|
|
209
|
+
export declare const paletteOf: (theme: ThemeId | undefined, scheme: "light" | "dark", intensity?: CloudLook["intensity"]) => Palette;
|
|
210
|
+
/** What the waiting and can't-be-undone cards and the decision bar sit on: fixed per scheme, so no theme mixes into them. */
|
|
211
|
+
export declare const CARD_SURFACE: {
|
|
212
|
+
readonly light: "#ffffff";
|
|
213
|
+
readonly dark: "#1f1f1f";
|
|
214
|
+
};
|
|
215
|
+
export declare const WAIT = "#fcd34d", IRREVERSIBLE = "#fca5a5";
|
|
216
|
+
/**
|
|
217
|
+
* The approval colours an owner may choose between: only these, never a colour of their own.
|
|
218
|
+
* Each keeps Approve green and the waiting card amber, and every set is tested against every theme. The can't-be-undone
|
|
219
|
+
* card's red and the Decline button are fixed. `tint` is how much of `wait` colours the waiting card and decision bar.
|
|
220
|
+
*/
|
|
221
|
+
export declare const APPROVALS: {
|
|
222
|
+
readonly standard: {
|
|
223
|
+
readonly name: "Standard";
|
|
224
|
+
readonly ok: {
|
|
225
|
+
readonly light: "#15803d";
|
|
226
|
+
readonly dark: "#4ade80";
|
|
227
|
+
};
|
|
228
|
+
readonly wait: "#fcd34d";
|
|
229
|
+
readonly tint: {
|
|
230
|
+
readonly light: 18;
|
|
231
|
+
readonly dark: 18;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
readonly warm: {
|
|
235
|
+
readonly name: "Warm";
|
|
236
|
+
readonly ok: {
|
|
237
|
+
readonly light: "#166534";
|
|
238
|
+
readonly dark: "#22c55e";
|
|
239
|
+
};
|
|
240
|
+
readonly wait: "#fbbf24";
|
|
241
|
+
readonly tint: {
|
|
242
|
+
readonly light: 18;
|
|
243
|
+
readonly dark: 18;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
readonly strong: {
|
|
247
|
+
readonly name: "Strong";
|
|
248
|
+
readonly ok: {
|
|
249
|
+
readonly light: "#166534";
|
|
250
|
+
readonly dark: "#4ade80";
|
|
251
|
+
};
|
|
252
|
+
readonly wait: "#fcd34d";
|
|
253
|
+
readonly tint: {
|
|
254
|
+
readonly light: 28;
|
|
255
|
+
readonly dark: 18;
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
export type ApprovalId = keyof typeof APPROVALS;
|
|
260
|
+
/**
|
|
261
|
+
* The greens an owner may pick for Approve, friendlier than the default. Each is a light-panel shade
|
|
262
|
+
* with white text and a dark-panel shade with black text, tested on every theme and approval set, kept apart from a
|
|
263
|
+
* pressed Decline for colour-blind people, and well away from the Teal accent so Approve never looks like Send.
|
|
264
|
+
*/
|
|
265
|
+
export declare const APPROVE_GREENS: {
|
|
266
|
+
readonly standard: {
|
|
267
|
+
readonly name: "Standard";
|
|
268
|
+
readonly light: "#15803d";
|
|
269
|
+
readonly dark: "#4ade80";
|
|
270
|
+
};
|
|
271
|
+
readonly forest: {
|
|
272
|
+
readonly name: "Forest";
|
|
273
|
+
readonly light: "#166534";
|
|
274
|
+
readonly dark: "#22c55e";
|
|
275
|
+
};
|
|
276
|
+
readonly leaf: {
|
|
277
|
+
readonly name: "Leaf";
|
|
278
|
+
readonly light: "#3d7a2a";
|
|
279
|
+
readonly dark: "#8fd67e";
|
|
280
|
+
};
|
|
281
|
+
readonly meadow: {
|
|
282
|
+
readonly name: "Meadow";
|
|
283
|
+
readonly light: "#357d33";
|
|
284
|
+
readonly dark: "#9ddf92";
|
|
285
|
+
};
|
|
286
|
+
readonly fern: {
|
|
287
|
+
readonly name: "Fern";
|
|
288
|
+
readonly light: "#2f7340";
|
|
289
|
+
readonly dark: "#7edb94";
|
|
290
|
+
};
|
|
291
|
+
readonly sage: {
|
|
292
|
+
readonly name: "Sage";
|
|
293
|
+
readonly light: "#557650";
|
|
294
|
+
readonly dark: "#aed3a2";
|
|
295
|
+
};
|
|
296
|
+
readonly moss: {
|
|
297
|
+
readonly name: "Moss";
|
|
298
|
+
readonly light: "#556b2f";
|
|
299
|
+
readonly dark: "#b5d38a";
|
|
300
|
+
};
|
|
301
|
+
readonly neon: {
|
|
302
|
+
readonly name: "Neon";
|
|
303
|
+
readonly light: "#4ade80";
|
|
304
|
+
readonly dark: "#5ef08f";
|
|
305
|
+
readonly ink: {
|
|
306
|
+
readonly light: "#052e16";
|
|
307
|
+
};
|
|
308
|
+
readonly edge: {
|
|
309
|
+
readonly light: "#15803d";
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
readonly lime: {
|
|
313
|
+
readonly name: "Lime";
|
|
314
|
+
readonly light: "#a3e635";
|
|
315
|
+
readonly dark: "#a3e635";
|
|
316
|
+
readonly ink: {
|
|
317
|
+
readonly light: "#1a2e05";
|
|
318
|
+
};
|
|
319
|
+
readonly edge: {
|
|
320
|
+
readonly light: "#4d7c0f";
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
/** One Approve green: its fill per panel, and optionally its own text colour and border per panel. */
|
|
325
|
+
export interface GreenDef {
|
|
326
|
+
name: string;
|
|
327
|
+
light: string;
|
|
328
|
+
dark: string;
|
|
329
|
+
ink?: {
|
|
330
|
+
light?: string;
|
|
331
|
+
dark?: string;
|
|
332
|
+
};
|
|
333
|
+
edge?: {
|
|
334
|
+
light?: string;
|
|
335
|
+
dark?: string;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
export type GreenId = keyof typeof APPROVE_GREENS;
|
|
339
|
+
/** A green's fill, text and border on a light or dark panel (text defaults to white on light and black on dark). */
|
|
340
|
+
export declare const greenParts: (id: GreenId, s: "light" | "dark") => {
|
|
341
|
+
fill: string;
|
|
342
|
+
ink: string;
|
|
343
|
+
edge: string;
|
|
344
|
+
};
|
|
345
|
+
export declare const GREEN_IDS: GreenId[];
|
|
346
|
+
export declare const APPROVAL_IDS: ApprovalId[];
|
|
347
|
+
/** The Approve button and the test-environment pill: their fill and the text on it, per scheme. */
|
|
348
|
+
export declare const OK_FILL: {
|
|
349
|
+
readonly light: "#15803d";
|
|
350
|
+
readonly dark: "#4ade80";
|
|
351
|
+
}, WARN_FILL: {
|
|
352
|
+
readonly light: "#b45309";
|
|
353
|
+
readonly dark: "#f59e0b";
|
|
354
|
+
};
|
|
355
|
+
export declare const ON_FILL: {
|
|
356
|
+
readonly light: "#ffffff";
|
|
357
|
+
readonly dark: "#000000";
|
|
358
|
+
};
|
|
359
|
+
export declare const DANGER_TEXT: {
|
|
360
|
+
readonly light: "#b91c1c";
|
|
361
|
+
readonly dark: "#f87171";
|
|
362
|
+
};
|
|
363
|
+
/** One line of plain text, at most `max` characters, or undefined when nothing is left. */
|
|
364
|
+
export declare function lookText(v: unknown, max: number): string | undefined;
|
|
365
|
+
/** The WCAG contrast ratio of two `#rrggbb` colours, 1 to 21. */
|
|
366
|
+
export declare function contrast(a: string, b: string): number;
|
|
367
|
+
/** Black or white, whichever reads better on the colour (always at least 4.5:1). */
|
|
368
|
+
export declare const textOn: (hex: string) => "#ffffff" | "#000000";
|
|
369
|
+
/** `a` mixed into `b` by `t` (0 to 1), as CSS `color-mix(in srgb, a t, b)`. */
|
|
370
|
+
export declare const mix: (a: string, b: string, t: number) => string;
|
|
371
|
+
export declare const HEX: RegExp;
|
|
372
|
+
/** OKLab of a colour. */
|
|
373
|
+
export declare function oklab(hex: string): [number, number, number];
|
|
374
|
+
/** How different two colours look (OKLab distance; about 0.02 is just noticeable). */
|
|
375
|
+
export declare const deltaE: (a: string, b: string) => number;
|
|
376
|
+
/** True when a colour could pass for the approval green, the waiting amber or the danger red: a hue near theirs, with colour in it. */
|
|
377
|
+
export declare function looksLikeStatus(hex: string): boolean;
|
|
378
|
+
/** Why an accent can't be used on this palette, or null: it must read at 3:1 on the background and the bubble. */
|
|
379
|
+
export declare function accentProblemOn(accent: string, p: Palette): string | null;
|
|
380
|
+
/** Why an accent can't be used in these schemes of the theme (both, for `auto`), or null when it can. */
|
|
381
|
+
export declare function accentProblem(accent: string, scheme?: CloudLook["scheme"], theme?: ThemeId, intensity?: CloudLook["intensity"]): string | null;
|
|
382
|
+
/**
|
|
383
|
+
* The nearest colour that reads on the palette, changing only its lightness (hue and colourfulness kept as far as sRGB
|
|
384
|
+
* allows). Null when it looks like a status colour: a lightness change never makes green safe.
|
|
385
|
+
*/
|
|
386
|
+
export declare function nudgeAccent(hex: string, p: Palette): string | null;
|
|
387
|
+
/** Twelve accents to pick from; each is nudged to read on the chosen theme (`nudgeAccent`). None is a status hue. */
|
|
388
|
+
export declare const SWATCHES: readonly [{
|
|
389
|
+
readonly name: "Indigo";
|
|
390
|
+
readonly hex: "#4f46e5";
|
|
391
|
+
}, {
|
|
392
|
+
readonly name: "Blue";
|
|
393
|
+
readonly hex: "#2563eb";
|
|
394
|
+
}, {
|
|
395
|
+
readonly name: "Sky";
|
|
396
|
+
readonly hex: "#0284c7";
|
|
397
|
+
}, {
|
|
398
|
+
readonly name: "Cyan";
|
|
399
|
+
readonly hex: "#0891b2";
|
|
400
|
+
}, {
|
|
401
|
+
readonly name: "Teal";
|
|
402
|
+
readonly hex: "#0f766e";
|
|
403
|
+
}, {
|
|
404
|
+
readonly name: "Navy";
|
|
405
|
+
readonly hex: "#1e3a8a";
|
|
406
|
+
}, {
|
|
407
|
+
readonly name: "Violet";
|
|
408
|
+
readonly hex: "#7c3aed";
|
|
409
|
+
}, {
|
|
410
|
+
readonly name: "Purple";
|
|
411
|
+
readonly hex: "#9333ea";
|
|
412
|
+
}, {
|
|
413
|
+
readonly name: "Fuchsia";
|
|
414
|
+
readonly hex: "#c026d3";
|
|
415
|
+
}, {
|
|
416
|
+
readonly name: "Plum";
|
|
417
|
+
readonly hex: "#86198f";
|
|
418
|
+
}, {
|
|
419
|
+
readonly name: "Slate";
|
|
420
|
+
readonly hex: "#475569";
|
|
421
|
+
}, {
|
|
422
|
+
readonly name: "Graphite";
|
|
423
|
+
readonly hex: "#262626";
|
|
424
|
+
}];
|
|
425
|
+
/**
|
|
426
|
+
* Every rule a palette must meet (empty when it meets them all). Text and muted text at 4.5:1 on the background, the bubble
|
|
427
|
+
* and both card tints; the accent at 4.5:1 on the background and bubble (it is also the link colour); the Approve and
|
|
428
|
+
* environment-pill fills at 3:1; danger text at 4.5:1; and the background, bubble and both card tints clearly different.
|
|
429
|
+
*/
|
|
430
|
+
export declare function paletteProblems(p: Palette, scheme: "light" | "dark", approval?: ApprovalId, green?: GreenId): string[];
|
|
431
|
+
/** The largest logo, in bytes once decoded. */
|
|
432
|
+
export declare const LOGO_MAX_BYTES: number;
|
|
433
|
+
/** A logo data URL, or undefined: the type must be PNG, JPEG or WebP and the bytes must really start like one, so a file that
|
|
434
|
+
* only claims to be an image (an SVG or an HTML page named .png) is dropped. */
|
|
435
|
+
export declare function cleanLogo(v: unknown): string | undefined;
|
|
436
|
+
/** The look from a bundle, field by field: anything wrong is left out. */
|
|
437
|
+
export declare function cleanLook(raw: unknown): CloudLook;
|
|
438
|
+
/** The look without the fields the app locked in its own code. Locking `accent` locks both shades. */
|
|
439
|
+
export declare function withoutLocked(look: CloudLook, locked: readonly LookField[]): CloudLook;
|
|
440
|
+
/** The colour strength in use on a light or a dark panel. */
|
|
441
|
+
export declare const strengthOf: (l: Pick<CloudLook, "intensity" | "intensityDark">, scheme: "light" | "dark") => "subtle" | "rich" | undefined;
|
|
442
|
+
/** The themes with a rich version (Graphite and High contrast stay as they are: tinting them defeats their purpose). */
|
|
443
|
+
export declare const RICH_IDS: readonly ["classic", "slate", "ocean", "stone", "violet"];
|
|
444
|
+
type RichId = (typeof RICH_IDS)[number];
|
|
445
|
+
/** Every rich theme, worked out once from the fixed table. */
|
|
446
|
+
export declare const RICH_THEMES: Record<RichId, {
|
|
447
|
+
light: Palette;
|
|
448
|
+
dark: Palette;
|
|
449
|
+
}>;
|
|
450
|
+
/**
|
|
451
|
+
* A theme made from one brand colour: Classic's text, with the background, bubble and border tinted in the
|
|
452
|
+
* brand's hue and the brand as the accent, its lightness nudged until it reads. It starts colourful and steps back until
|
|
453
|
+
* `paletteProblems` passes, the same rules every fixed theme meets, so the waiting and can't-be-undone cards still stand
|
|
454
|
+
* out. Null for anything but a plain #rrggbb that isn't a status hue (a brand green can't become the theme).
|
|
455
|
+
*/
|
|
456
|
+
export declare function brandTheme(hex: string): {
|
|
457
|
+
light: Palette;
|
|
458
|
+
dark: Palette;
|
|
459
|
+
} | null;
|
|
460
|
+
/** The palette a look uses on a light or dark panel: its brand theme when it has one, else its theme and colour strength. */
|
|
461
|
+
export declare const lookPalette: (l: Pick<CloudLook, "brand" | "theme" | "intensity" | "intensityDark">, scheme: "light" | "dark") => Palette;
|
|
462
|
+
export {};
|