@odla-ai/brand 0.7.0 → 0.7.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/README.md +1 -1
- package/dist/{index-r36KQK5n.d.cts → index-r6SGidYT.d.cts} +6 -1
- package/dist/{index-r36KQK5n.d.ts → index-r6SGidYT.d.ts} +6 -1
- package/dist/index.cjs +28 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/tokens/index.d.cts +1 -1
- package/dist/tokens/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-
|
|
2
|
-
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-
|
|
1
|
+
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-r6SGidYT.cjs';
|
|
2
|
+
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-r6SGidYT.cjs';
|
|
3
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
4
4
|
|
|
5
5
|
/** One entry of the bundle's base64 asset manifest, without its payload. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-
|
|
2
|
-
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-
|
|
1
|
+
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-r6SGidYT.js';
|
|
2
|
+
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-r6SGidYT.js';
|
|
3
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
4
4
|
|
|
5
5
|
/** One entry of the bundle's base64 asset manifest, without its payload. */
|
package/dist/index.js
CHANGED
|
@@ -463,6 +463,7 @@ var DESIGN_CONTENT_TYPES = /* @__PURE__ */ new Set(["text/html"]);
|
|
|
463
463
|
var HEX_RGB = /^#[0-9a-f]{3}$/;
|
|
464
464
|
var HEX_RRGGBB = /^#[0-9a-f]{6}$/;
|
|
465
465
|
var HEX_ALPHA = /^#[0-9a-f]{4}$|^#[0-9a-f]{8}$/;
|
|
466
|
+
var UI_TOKEN_NAME = /^--ui-[a-z0-9-]+$/;
|
|
466
467
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
467
468
|
function assertHex(value, label = "color") {
|
|
468
469
|
if (typeof value !== "string")
|
|
@@ -529,6 +530,21 @@ function assertTypographySection(c) {
|
|
|
529
530
|
out.scale = c.scale;
|
|
530
531
|
}
|
|
531
532
|
if (c.notes !== void 0) out.notes = capString(c.notes, "content.notes", 2e3);
|
|
533
|
+
if (c.tokenOverrides !== void 0) {
|
|
534
|
+
if (!isRecord(c.tokenOverrides))
|
|
535
|
+
throw new BrandInputError("content.tokenOverrides must be an object");
|
|
536
|
+
const entries = Object.entries(c.tokenOverrides);
|
|
537
|
+
if (entries.length > 64)
|
|
538
|
+
throw new BrandInputError("content.tokenOverrides must have at most 64 entries");
|
|
539
|
+
out.tokenOverrides = Object.fromEntries(entries.map(([name, raw]) => {
|
|
540
|
+
if (!UI_TOKEN_NAME.test(name))
|
|
541
|
+
throw new BrandInputError(`content.tokenOverrides.${name} must be a --ui-* token name`);
|
|
542
|
+
const value = capString(raw, `content.tokenOverrides.${name}`, 500);
|
|
543
|
+
if (/[;{}]/.test(value) || /url\s*\(/i.test(value))
|
|
544
|
+
throw new BrandInputError(`content.tokenOverrides.${name} contains an unsafe CSS value`);
|
|
545
|
+
return [name, value];
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
532
548
|
return out;
|
|
533
549
|
}
|
|
534
550
|
function assertVoiceSection(c) {
|
|
@@ -2953,7 +2969,8 @@ async function handleDesignPreview(ctx, req, bookId, assetId) {
|
|
|
2953
2969
|
const asset = await linkedAsset(ctx, book, assetId);
|
|
2954
2970
|
if (asset.kind !== DESIGN_ASSET_KIND) throw new BrandNotFoundError(`design ${assetId}`);
|
|
2955
2971
|
const signed = await ctx.db.storage.sign(asset.path, SIGNED_READ_TTL_SECONDS);
|
|
2956
|
-
const
|
|
2972
|
+
const fetchPrivateAsset = ctx.fetchPrivateAsset;
|
|
2973
|
+
const fetched = await fetchPrivateAsset(signed, {
|
|
2957
2974
|
headers: { accept: "text/html" },
|
|
2958
2975
|
redirect: "manual",
|
|
2959
2976
|
signal: req.signal
|
|
@@ -3052,7 +3069,10 @@ var proposalGuardEquals = (snapshot) => ({ ...snapshot });
|
|
|
3052
3069
|
|
|
3053
3070
|
// src/routes/proposal-effects.ts
|
|
3054
3071
|
async function tokenSnapshot(swatches, typography, input, paletteId, paletteReceiptId, paletteActionDigest, typographyReceiptId, typographyActionDigest) {
|
|
3055
|
-
const compiled = compileBrandTokens({
|
|
3072
|
+
const compiled = compileBrandTokens({
|
|
3073
|
+
swatches,
|
|
3074
|
+
...typography ? { typography, overrides: typography.tokenOverrides } : {}
|
|
3075
|
+
});
|
|
3056
3076
|
const sources = {
|
|
3057
3077
|
paletteId,
|
|
3058
3078
|
paletteReceiptId,
|
|
@@ -3838,7 +3858,8 @@ async function handleBrandDiscussionAsset(ctx, req, target) {
|
|
|
3838
3858
|
await ctx.db.storage.sign(before.path, SIGN_TTL_SECONDS)
|
|
3839
3859
|
);
|
|
3840
3860
|
if (!signed) throw new BrandInputError("private asset signing failed");
|
|
3841
|
-
const
|
|
3861
|
+
const fetchPrivateAsset = ctx.fetchPrivateAsset;
|
|
3862
|
+
const response = await fetchPrivateAsset(signed, {
|
|
3842
3863
|
headers: { accept: contentType },
|
|
3843
3864
|
redirect: "manual",
|
|
3844
3865
|
signal: req.signal
|
|
@@ -4075,7 +4096,10 @@ function createBrandRoutes(options) {
|
|
|
4075
4096
|
newId: options.newId ?? (() => crypto.randomUUID()),
|
|
4076
4097
|
maxUploadBytes: options.maxUploadBytes ?? 8 * 1024 * 1024,
|
|
4077
4098
|
discussionBasePath: options.discussionBasePath ?? "/",
|
|
4078
|
-
|
|
4099
|
+
// Bound: this is stored on the context and invoked from route handlers,
|
|
4100
|
+
// where a property call would set the receiver to that context and
|
|
4101
|
+
// Cloudflare's fetch refuses a foreign receiver ("Illegal invocation").
|
|
4102
|
+
fetchPrivateAsset: options.fetchPrivateAsset ?? globalThis.fetch.bind(globalThis),
|
|
4079
4103
|
previewFrameAncestors: options.previewFrameAncestors ?? ["'self'"]
|
|
4080
4104
|
};
|
|
4081
4105
|
return async (req) => {
|