@odla-ai/brand 0.1.0 → 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.
- package/README.md +4 -2
- package/dist/chunk-APLECQBR.js +1010 -0
- package/dist/chunk-APLECQBR.js.map +1 -0
- package/dist/index-bj73h3qo.d.cts +409 -0
- package/dist/index-bj73h3qo.d.ts +409 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -409
- package/dist/index.d.ts +3 -409
- package/dist/index.js +57 -957
- package/dist/index.js.map +1 -1
- package/dist/tokens/index.cjs +912 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +29 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/** The odla-db namespaces @odla-ai/brand installs and writes. */
|
|
2
|
+
declare const BRAND_NS: {
|
|
3
|
+
readonly book: "brand_book";
|
|
4
|
+
readonly section: "brand_section";
|
|
5
|
+
readonly palette: "brand_palette";
|
|
6
|
+
readonly proposal: "brand_proposal";
|
|
7
|
+
readonly asset: "brand_asset";
|
|
8
|
+
};
|
|
9
|
+
/** Brand-book lifecycle: authored → adopted → retired (delete is owner-only). */
|
|
10
|
+
declare const BOOK_STATUSES: readonly ["draft", "active", "archived"];
|
|
11
|
+
/** Where a brand book stands in its lifecycle. */
|
|
12
|
+
type BookStatus = (typeof BOOK_STATUSES)[number];
|
|
13
|
+
/** The section kinds a book carries — one row per kind, upserted by natural key. */
|
|
14
|
+
declare const SECTION_KINDS: readonly ["palette", "typography", "voice", "logo", "imagery"];
|
|
15
|
+
/** Which facet of the brand a section documents. */
|
|
16
|
+
type SectionKind = (typeof SECTION_KINDS)[number];
|
|
17
|
+
/** Section review state: agent drafts, a human approves. */
|
|
18
|
+
declare const SECTION_STATUSES: readonly ["draft", "approved"];
|
|
19
|
+
/** Whether a section's content has human sign-off. */
|
|
20
|
+
type SectionStatus = (typeof SECTION_STATUSES)[number];
|
|
21
|
+
/** Palette lifecycle — palettes are never row-deleted, only archived. */
|
|
22
|
+
declare const PALETTE_STATUSES: readonly ["active", "archived"];
|
|
23
|
+
/** Whether a palette is the live one or a retired predecessor. */
|
|
24
|
+
type PaletteStatus = (typeof PALETTE_STATUSES)[number];
|
|
25
|
+
/** How a palette came to be: pulled from an asset, derived from a seed color,
|
|
26
|
+
* or entered by hand. */
|
|
27
|
+
declare const PALETTE_SOURCES: readonly ["extracted", "derived", "manual"];
|
|
28
|
+
/** Provenance of a palette's swatches. */
|
|
29
|
+
type PaletteSource = (typeof PALETTE_SOURCES)[number];
|
|
30
|
+
/** What a proposal proposes (palettes are the first-class case). */
|
|
31
|
+
declare const PROPOSAL_KINDS: readonly ["palette", "typography", "voice", "logo"];
|
|
32
|
+
/** Which brand facet a proposal targets. */
|
|
33
|
+
type ProposalKind = (typeof PROPOSAL_KINDS)[number];
|
|
34
|
+
/** Proposal lifecycle: open until a HUMAN accepts/rejects it (or a newer
|
|
35
|
+
* proposal supersedes it) — agents never resolve their own proposals. */
|
|
36
|
+
declare const PROPOSAL_STATUSES: readonly ["open", "accepted", "rejected", "superseded"];
|
|
37
|
+
/** Where a proposal stands in the human-gated review flow. */
|
|
38
|
+
type ProposalStatus = (typeof PROPOSAL_STATUSES)[number];
|
|
39
|
+
/** What kind of upload an asset row records. */
|
|
40
|
+
declare const ASSET_KINDS: readonly ["logo", "wordmark", "inspiration", "document", "font", "other"];
|
|
41
|
+
/** The declared purpose of an uploaded asset. */
|
|
42
|
+
type AssetKind = (typeof ASSET_KINDS)[number];
|
|
43
|
+
/** Every swatch role a palette may assign. `chart` may repeat (a series);
|
|
44
|
+
* `custom` is the escape hatch for roles the token compiler doesn't map. */
|
|
45
|
+
declare const SWATCH_ROLES: readonly ["primary", "secondary", "highlight", "bg", "surface", "text", "neutral", "good", "warn", "danger", "chart", "custom"];
|
|
46
|
+
|
|
47
|
+
/** Scalar values odla-db attrs and where-clauses accept. */
|
|
48
|
+
type BrandScalar = string | number | boolean | null;
|
|
49
|
+
/** Natural-key lookup ref for idempotent upserts (odla-db `Lookup` shape). */
|
|
50
|
+
interface BrandLookup {
|
|
51
|
+
ns: string;
|
|
52
|
+
attr: string;
|
|
53
|
+
value: BrandScalar;
|
|
54
|
+
}
|
|
55
|
+
/** How an op names its row: a raw entity id, or a natural-key lookup. */
|
|
56
|
+
type BrandEntityRef = string | BrandLookup;
|
|
57
|
+
/** Attr payload of one op. Typed `any` on purpose: the real odla-db
|
|
58
|
+
* `transact` constrains attrs to its own `Value` type, and `any` is the one
|
|
59
|
+
* shape assignable in both directions with no cast. */
|
|
60
|
+
type BrandAttrs = Record<string, any>;
|
|
61
|
+
/** One transact operation (update = attr-merge upsert; merge = deep-merge
|
|
62
|
+
* into a json attribute; retract = clear the named attributes, since a typed
|
|
63
|
+
* scalar can't store null). */
|
|
64
|
+
type BrandOp = {
|
|
65
|
+
t: "update";
|
|
66
|
+
ns: string;
|
|
67
|
+
id: BrandEntityRef;
|
|
68
|
+
attrs: BrandAttrs;
|
|
69
|
+
} | {
|
|
70
|
+
t: "merge";
|
|
71
|
+
ns: string;
|
|
72
|
+
id: BrandEntityRef;
|
|
73
|
+
attrs: BrandAttrs;
|
|
74
|
+
} | {
|
|
75
|
+
t: "retract";
|
|
76
|
+
ns: string;
|
|
77
|
+
id: BrandEntityRef;
|
|
78
|
+
attrs: string[];
|
|
79
|
+
} | {
|
|
80
|
+
t: "delete";
|
|
81
|
+
ns: string;
|
|
82
|
+
id: BrandEntityRef;
|
|
83
|
+
};
|
|
84
|
+
/** A row as odla-db returns it: hydrated id plus attrs. */
|
|
85
|
+
type BrandRow = {
|
|
86
|
+
id: string;
|
|
87
|
+
} & Record<string, unknown>;
|
|
88
|
+
/** Query result: namespace → rows. */
|
|
89
|
+
type BrandResult = Record<string, BrandRow[]>;
|
|
90
|
+
/** The role a swatch plays in the palette (what the token compiler maps). */
|
|
91
|
+
type SwatchRole = (typeof SWATCH_ROLES)[number];
|
|
92
|
+
/** One palette color: a role, a `#rrggbb` hex, and optional naming/why. */
|
|
93
|
+
interface Swatch {
|
|
94
|
+
role: SwatchRole;
|
|
95
|
+
hex: string;
|
|
96
|
+
name?: string;
|
|
97
|
+
rationale?: string;
|
|
98
|
+
}
|
|
99
|
+
/** `palette`-kind section content: the accepted palette, denormalized. */
|
|
100
|
+
interface PaletteSection {
|
|
101
|
+
paletteId: string;
|
|
102
|
+
name: string;
|
|
103
|
+
swatches: Swatch[];
|
|
104
|
+
}
|
|
105
|
+
/** `typography`-kind section content. `scale` is a modular type-scale ratio. */
|
|
106
|
+
interface TypographySection {
|
|
107
|
+
fontDisplay?: string;
|
|
108
|
+
fontBody?: string;
|
|
109
|
+
fontMono?: string;
|
|
110
|
+
scale?: number;
|
|
111
|
+
notes?: string;
|
|
112
|
+
}
|
|
113
|
+
/** `voice`-kind section content: tone plus writing principles/examples. */
|
|
114
|
+
interface VoiceSection {
|
|
115
|
+
tone: string;
|
|
116
|
+
principles: string[];
|
|
117
|
+
examples?: string[];
|
|
118
|
+
}
|
|
119
|
+
/** `logo`-kind section content: usage rules and don'ts. */
|
|
120
|
+
interface LogoSection {
|
|
121
|
+
clearspace?: string;
|
|
122
|
+
minSize?: string;
|
|
123
|
+
usage: string[];
|
|
124
|
+
donts: string[];
|
|
125
|
+
}
|
|
126
|
+
/** `imagery`-kind section content: photographic/illustration direction. */
|
|
127
|
+
interface ImagerySection {
|
|
128
|
+
style: string;
|
|
129
|
+
guidance: string[];
|
|
130
|
+
}
|
|
131
|
+
/** Agent-produced description of an uploaded asset (validated + capped). */
|
|
132
|
+
interface AssetAnalysis {
|
|
133
|
+
description: string;
|
|
134
|
+
dominantColors: string[];
|
|
135
|
+
tags: string[];
|
|
136
|
+
}
|
|
137
|
+
/** The compiled-token cache stored on `brand_book.tokens`. `warnings` carries
|
|
138
|
+
* the compiler's `TokenWarning[]` (typed loosely here so the row types don't
|
|
139
|
+
* depend on the token compiler's module). */
|
|
140
|
+
interface BrandTokensSnapshot {
|
|
141
|
+
light: Record<string, string>;
|
|
142
|
+
dark: Record<string, string>;
|
|
143
|
+
warnings: unknown[];
|
|
144
|
+
compiledAt: number;
|
|
145
|
+
}
|
|
146
|
+
/** A brand book row: the auth roster (`memberIds`, including the bot agent
|
|
147
|
+
* id) plus the active palette and compiled-token cache. */
|
|
148
|
+
interface BrandBook {
|
|
149
|
+
id: string;
|
|
150
|
+
slug: string;
|
|
151
|
+
name: string;
|
|
152
|
+
status: BookStatus;
|
|
153
|
+
ownerId: string;
|
|
154
|
+
memberIds: string[];
|
|
155
|
+
channelId?: string;
|
|
156
|
+
activePaletteId?: string;
|
|
157
|
+
tokens?: BrandTokensSnapshot;
|
|
158
|
+
summary?: string;
|
|
159
|
+
createdAt: number;
|
|
160
|
+
updatedAt: number;
|
|
161
|
+
}
|
|
162
|
+
/** A section row — one per (book, kind), upserted by its natural `key`. */
|
|
163
|
+
interface BrandSection {
|
|
164
|
+
id: string;
|
|
165
|
+
key: string;
|
|
166
|
+
bookId: string;
|
|
167
|
+
kind: SectionKind;
|
|
168
|
+
status: SectionStatus;
|
|
169
|
+
content: Record<string, unknown>;
|
|
170
|
+
audience: string[];
|
|
171
|
+
updatedBy: string;
|
|
172
|
+
updatedAt: number;
|
|
173
|
+
}
|
|
174
|
+
/** A palette row. Swatches are json ON the palette, not a namespace: the
|
|
175
|
+
* palette is the atomic proposal/approval unit and swatches are never
|
|
176
|
+
* queried across palettes. */
|
|
177
|
+
interface BrandPalette {
|
|
178
|
+
id: string;
|
|
179
|
+
bookId: string;
|
|
180
|
+
name: string;
|
|
181
|
+
status: PaletteStatus;
|
|
182
|
+
swatches: Swatch[];
|
|
183
|
+
seedHex?: string;
|
|
184
|
+
source: PaletteSource;
|
|
185
|
+
rationale?: string;
|
|
186
|
+
proposalId?: string;
|
|
187
|
+
audience: string[];
|
|
188
|
+
createdAt: number;
|
|
189
|
+
updatedAt: number;
|
|
190
|
+
}
|
|
191
|
+
/** A proposal row: agent output parked for explicit human resolution. */
|
|
192
|
+
interface BrandProposal {
|
|
193
|
+
id: string;
|
|
194
|
+
bookId: string;
|
|
195
|
+
kind: ProposalKind;
|
|
196
|
+
status: ProposalStatus;
|
|
197
|
+
payload: Record<string, unknown>;
|
|
198
|
+
rationale: string;
|
|
199
|
+
sourceAssetId?: string;
|
|
200
|
+
messageId?: string;
|
|
201
|
+
audience: string[];
|
|
202
|
+
createdBy: string;
|
|
203
|
+
createdAt: number;
|
|
204
|
+
resolvedBy?: string;
|
|
205
|
+
resolvedAt?: number;
|
|
206
|
+
resolutionNote?: string;
|
|
207
|
+
}
|
|
208
|
+
/** An asset row mirroring one real uploaded file (worker-mediated; rules
|
|
209
|
+
* close the namespace). Delete is a tombstone (`deletedAt`), never a row
|
|
210
|
+
* delete, so analyses/proposals referencing it stay coherent. */
|
|
211
|
+
interface BrandAsset {
|
|
212
|
+
id: string;
|
|
213
|
+
bookId: string;
|
|
214
|
+
kind: AssetKind;
|
|
215
|
+
path: string;
|
|
216
|
+
url: string;
|
|
217
|
+
contentType: string;
|
|
218
|
+
size: number;
|
|
219
|
+
title?: string;
|
|
220
|
+
analysis?: AssetAnalysis;
|
|
221
|
+
analyzedAt?: number;
|
|
222
|
+
audience: string[];
|
|
223
|
+
uploadedBy: string;
|
|
224
|
+
createdAt: number;
|
|
225
|
+
deletedAt?: number;
|
|
226
|
+
}
|
|
227
|
+
/** What `db.storage.upload` resolves to (odla-db's file record shape). */
|
|
228
|
+
interface BrandFileRecord {
|
|
229
|
+
id: string;
|
|
230
|
+
path: string;
|
|
231
|
+
url: string;
|
|
232
|
+
size: number;
|
|
233
|
+
contentType: string;
|
|
234
|
+
}
|
|
235
|
+
/** Bodies `storage.upload` accepts — a practical subset of the platform's
|
|
236
|
+
* `BodyInit` (which has no ambient type under a DOM-less lib). The real
|
|
237
|
+
* @odla-ai/db client accepts a superset, so it still structurally satisfies
|
|
238
|
+
* {@link BrandStorage}. */
|
|
239
|
+
type BrandUploadBody = string | Blob | ArrayBuffer | Uint8Array | ReadableStream<Uint8Array>;
|
|
240
|
+
/** The injected file store — @odla-ai/db's `storage` API satisfies this. */
|
|
241
|
+
interface BrandStorage {
|
|
242
|
+
upload(path: string, data: BrandUploadBody, contentType?: string): Promise<BrandFileRecord>;
|
|
243
|
+
delete(path: string): Promise<void>;
|
|
244
|
+
}
|
|
245
|
+
/** The injected odla client (structural — a real @odla-ai/db `AdminDb`
|
|
246
|
+
* satisfies it). `transact` accepts flat op arrays and `mutationId` gives
|
|
247
|
+
* exactly-once application (`duplicate: true` on replay). */
|
|
248
|
+
interface BrandDb {
|
|
249
|
+
query(q: Record<string, unknown>): Promise<Record<string, unknown[]>>;
|
|
250
|
+
transact(ops: unknown[], opts?: {
|
|
251
|
+
mutationId?: string;
|
|
252
|
+
}): Promise<{
|
|
253
|
+
txId: number;
|
|
254
|
+
duplicate?: boolean;
|
|
255
|
+
}>;
|
|
256
|
+
storage: BrandStorage;
|
|
257
|
+
}
|
|
258
|
+
/** Who is acting: a human member or the book's bot agent. */
|
|
259
|
+
interface BrandActor {
|
|
260
|
+
id: string;
|
|
261
|
+
kind: "human" | "agent";
|
|
262
|
+
email?: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The @odla-ai/ui required tier (js/tokens.js REQUIRED_TOKENS), in the ui
|
|
267
|
+
* contract's order. The compiler always emits a concrete value for every
|
|
268
|
+
* one of these.
|
|
269
|
+
*/
|
|
270
|
+
declare const BRAND_REQUIRED_TOKENS: readonly ["--ui-bg", "--ui-surface", "--ui-surface-2", "--ui-text", "--ui-text-muted", "--ui-text-faint", "--ui-border", "--ui-border-strong", "--ui-accent", "--ui-accent-strong", "--ui-accent-soft", "--ui-on-accent", "--ui-good", "--ui-good-soft", "--ui-warn", "--ui-warn-soft", "--ui-danger", "--ui-danger-soft", "--ui-code-bg", "--ui-code-text", "--ui-shadow", "--ui-font-sans", "--ui-font-serif", "--ui-font-mono", "--ui-font-display"];
|
|
271
|
+
/**
|
|
272
|
+
* Accent-composing derived roles from the ui defaulted tier. All five
|
|
273
|
+
* accent-family members of the :where([data-ui-accent]) re-declaration set
|
|
274
|
+
* (--ui-accent-glow, --ui-accent-2, --ui-accent-2-soft, --ui-highlight,
|
|
275
|
+
* --ui-focus) plus --ui-shadow-strong, which composes var(--ui-shadow) —
|
|
276
|
+
* a token this compiler re-declares, so the island rule applies to it too.
|
|
277
|
+
*/
|
|
278
|
+
declare const BRAND_DERIVED_TOKENS: readonly ["--ui-accent-glow", "--ui-accent-2", "--ui-accent-2-soft", "--ui-highlight", "--ui-focus", "--ui-shadow-strong"];
|
|
279
|
+
/**
|
|
280
|
+
* Chart roles the compiler emits: the six series slots (real palette
|
|
281
|
+
* swatches when the palette carries them, ui var() compositions otherwise)
|
|
282
|
+
* and the four accent-composing chart roles the :where([data-ui-accent])
|
|
283
|
+
* block re-declares (band, band-strong, flow, glow).
|
|
284
|
+
*/
|
|
285
|
+
declare const BRAND_CHART_TOKENS: readonly ["--ui-chart-1", "--ui-chart-2", "--ui-chart-3", "--ui-chart-4", "--ui-chart-5", "--ui-chart-6", "--ui-chart-band", "--ui-chart-band-strong", "--ui-chart-flow", "--ui-chart-glow"];
|
|
286
|
+
/**
|
|
287
|
+
* Chat surface roles (js/tokens.js CHAT_TOKENS, complete). Two are in the
|
|
288
|
+
* accent-swap set (user-bg, tool-accent); the other four compose surface /
|
|
289
|
+
* text tokens the compiler also re-declares, so an island stays coherent.
|
|
290
|
+
*/
|
|
291
|
+
declare const BRAND_CHAT_TOKENS: readonly ["--ui-chat-user-bg", "--ui-chat-user-text", "--ui-chat-assistant-bg", "--ui-chat-thinking-bg", "--ui-chat-thinking-text", "--ui-chat-tool-accent"];
|
|
292
|
+
/**
|
|
293
|
+
* Every token the compiler emits, in emission order — also the deterministic
|
|
294
|
+
* declaration order renderTokensCss uses, so golden CSS fixtures are stable.
|
|
295
|
+
*/
|
|
296
|
+
declare const BRAND_EMITTED_TOKENS: readonly string[];
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* A compiled token map: `--ui-*` custom-property name → CSS value. Values
|
|
300
|
+
* are either concrete (hex, font stack, shadow) or composition strings
|
|
301
|
+
* (`var(--ui-accent)`, `color-mix(in srgb, var(--ui-accent) 10%, transparent)`)
|
|
302
|
+
* that recompute wherever the map is declared — which is what lets one
|
|
303
|
+
* object serve as both a :root theme and a scoped override-island payload.
|
|
304
|
+
*/
|
|
305
|
+
type BrandTokens = Record<string, string>;
|
|
306
|
+
/**
|
|
307
|
+
* A non-fatal compiler note: a missing swatch role that fell back to a
|
|
308
|
+
* derived value, a dropped invalid input, or a color the compiler had to
|
|
309
|
+
* move to clear a WCAG contrast bar (then `adjustedFrom` carries the
|
|
310
|
+
* original hex).
|
|
311
|
+
*/
|
|
312
|
+
interface TokenWarning {
|
|
313
|
+
/** The `--ui-*` token the note is about. */
|
|
314
|
+
token: string;
|
|
315
|
+
/** Human-readable explanation, actionable for the brand author. */
|
|
316
|
+
message: string;
|
|
317
|
+
/** The original hex, when the compiler adjusted a color for contrast. */
|
|
318
|
+
adjustedFrom?: string;
|
|
319
|
+
}
|
|
320
|
+
/** Input to {@link import("./compile").compileBrandTokens}. */
|
|
321
|
+
interface CompileInput {
|
|
322
|
+
/** The palette to compile — typically a brand_palette row's swatches. */
|
|
323
|
+
swatches: Swatch[];
|
|
324
|
+
/** Optional typography section; fonts get system-stack fallbacks appended. */
|
|
325
|
+
typography?: TypographySection;
|
|
326
|
+
/** Author escape hatch: applied verbatim onto the light map, last. */
|
|
327
|
+
overrides?: BrandTokens;
|
|
328
|
+
}
|
|
329
|
+
/** The compiler's result: light + derived dark token maps, plus notes. */
|
|
330
|
+
interface CompiledBrandTokens {
|
|
331
|
+
/** Light-mode tokens (every name in BRAND_EMITTED_TOKENS, plus overrides). */
|
|
332
|
+
light: BrandTokens;
|
|
333
|
+
/** Dark-mode tokens derived from `light` — same key set. */
|
|
334
|
+
dark: BrandTokens;
|
|
335
|
+
/** Fallbacks taken and contrast adjustments made; empty on a clean palette. */
|
|
336
|
+
warnings: TokenWarning[];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Seed used when the palette has no usable chromatic swatch at all — the
|
|
341
|
+
* @odla-ai/ui neutral default accent (css/tokens.css restrained blue).
|
|
342
|
+
*/
|
|
343
|
+
declare const DEFAULT_ACCENT_SEED = "#3b5e8c";
|
|
344
|
+
/** What {@link mapPaletteToTokens} returns. */
|
|
345
|
+
interface MapResult {
|
|
346
|
+
/** The light-mode token map — every name in BRAND_EMITTED_TOKENS. */
|
|
347
|
+
tokens: BrandTokens;
|
|
348
|
+
/** Fallbacks taken and contrast adjustments made. */
|
|
349
|
+
warnings: TokenWarning[];
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Maps a palette (+ optional typography) onto the full light-mode
|
|
353
|
+
* @odla-ai/ui token set. Never throws on bad palettes: invalid swatches are
|
|
354
|
+
* dropped, missing roles derive from the accent via derivePalette, and every
|
|
355
|
+
* degradation is recorded as a {@link TokenWarning}.
|
|
356
|
+
*/
|
|
357
|
+
declare function mapPaletteToTokens(input: CompileInput): MapResult;
|
|
358
|
+
|
|
359
|
+
/** Darkest OKLab L a flipped neutral may take — the dark bg floor (never black). */
|
|
360
|
+
declare const DARK_FLIP_L_MIN = 0.2;
|
|
361
|
+
/** Lightest OKLab L a flipped neutral may take — keeps flipped text off pure white. */
|
|
362
|
+
declare const DARK_FLIP_L_MAX = 0.95;
|
|
363
|
+
/**
|
|
364
|
+
* Derives the dark-mode token map from a light one (see the file header for
|
|
365
|
+
* the flip / re-lighten / passthrough rules). Pure and total: tokens the
|
|
366
|
+
* rules don't recognize — including non-hex values in recognized slots —
|
|
367
|
+
* pass through unchanged, and the result always has exactly the input's
|
|
368
|
+
* key set. Deterministic, never throws.
|
|
369
|
+
*/
|
|
370
|
+
declare function deriveDarkTokens(light: BrandTokens): BrandTokens;
|
|
371
|
+
|
|
372
|
+
/** Options for {@link renderTokensCss}. */
|
|
373
|
+
interface RenderTokensCssOptions {
|
|
374
|
+
/** Dark-mode tokens (deriveDarkTokens output). Omit for a light-only sheet. */
|
|
375
|
+
dark?: BrandTokens;
|
|
376
|
+
/**
|
|
377
|
+
* Selector the light block declares on (default ":root"). A scoped
|
|
378
|
+
* selector (e.g. `[data-brand="acme"]`) gets its dark blocks nested under
|
|
379
|
+
* the document-level theme guards instead of replacing them.
|
|
380
|
+
*/
|
|
381
|
+
selector?: string;
|
|
382
|
+
/**
|
|
383
|
+
* Also emit a `.ui-invert` block carrying the full dark payload, so the
|
|
384
|
+
* subtree renders dark regardless of the global mode. Requires `dark`.
|
|
385
|
+
*/
|
|
386
|
+
includeInvert?: boolean;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Renders a compiled token map (plus optional dark map) as CSS text shaped
|
|
390
|
+
* like an @odla-ai/ui theme tokens file — see the file header for the block
|
|
391
|
+
* structure and ordering guarantees. Deterministic for a given input.
|
|
392
|
+
*/
|
|
393
|
+
declare function renderTokensCss(light: BrandTokens, opts?: RenderTokensCssOptions): string;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Compiles a brand palette into @odla-ai/ui design tokens: a light map
|
|
397
|
+
* covering every name in BRAND_EMITTED_TOKENS (plus overrides), a dark map
|
|
398
|
+
* derived from it (same key set), and the warnings accumulated along the
|
|
399
|
+
* way — missing-role fallbacks and contrast adjustments (`adjustedFrom`).
|
|
400
|
+
*
|
|
401
|
+
* Both maps double as runtime override-island payloads: every derived
|
|
402
|
+
* default that composes the accent family is re-declared, so applying the
|
|
403
|
+
* map on any element recomputes charts, softs, focus and chat roles against
|
|
404
|
+
* the brand palette (see roles.ts). Deterministic; never throws on bad
|
|
405
|
+
* palettes.
|
|
406
|
+
*/
|
|
407
|
+
declare function compileBrandTokens(input: CompileInput): CompiledBrandTokens;
|
|
408
|
+
|
|
409
|
+
export { SWATCH_ROLES as $, type AssetAnalysis as A, type BrandDb as B, type BrandStorage as C, type BrandTokens as D, type BrandTokensSnapshot as E, type BrandUploadBody as F, type CompileInput as G, type CompiledBrandTokens as H, DARK_FLIP_L_MAX as I, DARK_FLIP_L_MIN as J, DEFAULT_ACCENT_SEED as K, type ImagerySection as L, type LogoSection as M, type MapResult as N, PALETTE_STATUSES as O, PALETTE_SOURCES as P, PROPOSAL_KINDS as Q, PROPOSAL_STATUSES as R, type Swatch as S, type PaletteSection as T, type PaletteSource as U, type PaletteStatus as V, type ProposalKind as W, type ProposalStatus as X, type RenderTokensCssOptions as Y, SECTION_KINDS as Z, SECTION_STATUSES as _, type BrandBook as a, type SwatchRole as a0, type TokenWarning as a1, type TypographySection as a2, type VoiceSection as a3, compileBrandTokens as a4, deriveDarkTokens as a5, mapPaletteToTokens as a6, renderTokensCss as a7, type BrandOp as b, type BrandEntityRef as c, type SectionKind as d, type SectionStatus as e, type BrandProposal as f, type AssetKind as g, type BrandActor as h, ASSET_KINDS as i, BOOK_STATUSES as j, BRAND_CHART_TOKENS as k, BRAND_CHAT_TOKENS as l, BRAND_DERIVED_TOKENS as m, BRAND_EMITTED_TOKENS as n, BRAND_NS as o, BRAND_REQUIRED_TOKENS as p, type BookStatus as q, type BrandAsset as r, type BrandAttrs as s, type BrandFileRecord as t, type BrandLookup as u, type BrandPalette as v, type BrandResult as w, type BrandRow as x, type BrandScalar as y, type BrandSection as z };
|
package/dist/index.cjs
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
23
|
ASSET_CONTENT_TYPES: () => ASSET_CONTENT_TYPES,
|
|
24
24
|
ASSET_KINDS: () => ASSET_KINDS,
|
|
25
25
|
BOOK_STATUSES: () => BOOK_STATUSES,
|
|
@@ -130,7 +130,7 @@ __export(index_exports, {
|
|
|
130
130
|
updateBookOps: () => updateBookOps,
|
|
131
131
|
upsertSectionOps: () => upsertSectionOps
|
|
132
132
|
});
|
|
133
|
-
module.exports = __toCommonJS(
|
|
133
|
+
module.exports = __toCommonJS(src_exports);
|
|
134
134
|
|
|
135
135
|
// src/constants.ts
|
|
136
136
|
var BRAND_NS = {
|