@hintergrund/ui 0.2.3 → 0.3.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,4 +1,4 @@
1
- import { d as an, f as Ct } from "./Builder-H8tY8V9I.js";
1
+ import { x as an, z as Ct } from "./BuilderAgentPane-EOT6JCrB.js";
2
2
  import { s as on } from "./deferred-tools-BZWMWBYN.js";
3
3
  import { h as cn } from "./headers-D4iLzGaS.js";
4
4
  import { p as Ot, a as ln } from "./json-parse-LZdWp-Nd.js";
@@ -1,12 +1,12 @@
1
1
  import { O as y, a as p, r as f, i as R, b as g } from "./client-Cd7yMX39.js";
2
- import { d as _, e as I } from "./Builder-H8tY8V9I.js";
2
+ import { x as _, y as I } from "./BuilderAgentPane-EOT6JCrB.js";
3
3
  import { f as O, n as v } from "./error-body-BUPcH4GF.js";
4
4
  import { h as P } from "./headers-D4iLzGaS.js";
5
5
  import { g as m } from "./provider-env-D2VjEV3S.js";
6
6
  import { r as b } from "./provider-retry-BsigVlMg.js";
7
7
  import { c as h, b as w } from "./transform-messages-CsKsy6b4.js";
8
8
  import { c as N } from "./openai-prompt-cache-BJwqbEDx.js";
9
- import { p as U, c as z, a as S } from "./openai-responses-shared-DqdzMfa_.js";
9
+ import { p as U, c as z, a as S } from "./openai-responses-shared-DGHcHw_F.js";
10
10
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(r) {
11
11
  return Promise.resolve().then(r);
12
12
  } });
@@ -120,18 +120,18 @@ const Z = (r, a, e) => {
120
120
  throw new Error(`No API key for provider: ${r.provider}`);
121
121
  const i = C(r, o, e), u = h(a.tools, r.compat?.supportsOpenAIGrammarTools ?? !1);
122
122
  let c = G(r, a, e, n, u);
123
- const d = await e?.onPayload?.(c, r);
124
- d !== void 0 && (c = d);
123
+ const l = await e?.onPayload?.(c, r);
124
+ l !== void 0 && (c = l);
125
125
  const A = {
126
126
  ...e?.signal ? { signal: e.signal } : {},
127
127
  ...e?.timeoutMs !== void 0 ? { timeout: e.timeoutMs } : {},
128
128
  maxRetries: 0
129
- }, { data: E, response: l } = await b(() => i.responses.create(c, A).withResponse(), {
129
+ }, { data: E, response: d } = await b(() => i.responses.create(c, A).withResponse(), {
130
130
  maxRetries: e?.maxRetries,
131
131
  maxRetryDelayMs: e?.maxRetryDelayMs,
132
132
  signal: e?.signal
133
133
  });
134
- if (await e?.onResponse?.({ status: l.status, headers: P(l.headers) }, r), t.push({ type: "start", partial: s }), await U(E, s, t, r, { grammarToolInputProperties: u }), e?.signal?.aborted)
134
+ if (await e?.onResponse?.({ status: d.status, headers: P(d.headers) }, r), t.push({ type: "start", partial: s }), await U(E, s, t, r, { grammarToolInputProperties: u }), e?.signal?.aborted)
135
135
  throw new Error("Request was aborted");
136
136
  if (s.stopReason === "pending")
137
137
  throw new Error("Azure OpenAI Responses stream ended without a stop reason");
@@ -0,0 +1,95 @@
1
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(t) {
2
+ return Promise.resolve().then(t);
3
+ } });
4
+ const c = ["google", "deepseek"], f = {
5
+ google: "GEMINI_API_KEY",
6
+ deepseek: "DEEPSEEK_API_KEY"
7
+ }, p = {
8
+ google: "Google Gemini",
9
+ deepseek: "DeepSeek"
10
+ }, l = ["Arial", "Georgia", "Courier New"], s = {
11
+ logoPath: null,
12
+ displayFont: "Arial",
13
+ bodyFont: "Arial",
14
+ cornerRadius: "soft",
15
+ colors: { background: "#f6f8fa", surface: "#ffffff", text: "#24292f", muted: "#59636e", primary: "#2563eb", accent: "#7c3aed" }
16
+ };
17
+ function e(t) {
18
+ if (typeof t != "string" || !/^frontend\/static\/[a-zA-Z0-9_./-]+$/.test(t) || t.includes(".."))
19
+ throw new Error("Use a repository asset under frontend/static/.");
20
+ return t.slice(15);
21
+ }
22
+ function i(t) {
23
+ if (!t || typeof t != "object" || Array.isArray(t))
24
+ throw new Error("Invalid brand.");
25
+ const o = t;
26
+ if (!o.colors || typeof o.colors != "object" || Array.isArray(o.colors))
27
+ throw new Error("Invalid brand palette.");
28
+ for (const r of Object.keys(o.colors))
29
+ if (!Object.prototype.hasOwnProperty.call(s.colors, r))
30
+ throw new Error(`Unknown brand color: ${r}`);
31
+ for (const r of Object.keys(s.colors))
32
+ if (!/^#[\da-f]{6}$/i.test(o.colors?.[r] ?? ""))
33
+ throw new Error(`Invalid brand color: ${r}`);
34
+ if (!["sharp", "soft", "round"].includes(o.cornerRadius))
35
+ throw new Error("Invalid corner radius.");
36
+ for (const r of ["bodyFont", "displayFont"]) {
37
+ if (typeof o[r] != "string" || !/^[a-zA-Z0-9 -]{1,60}$/.test(o[r]))
38
+ throw new Error("Invalid font name.");
39
+ const n = o[`${r}Path`];
40
+ if (n != null && typeof n != "string")
41
+ throw new Error("Invalid font asset path.");
42
+ if (n) {
43
+ if (e(n), !/\.(ttf|otf)$/i.test(n))
44
+ throw new Error("Fonts must be TTF or OTF files.");
45
+ } else if (!l.includes(o[r]))
46
+ throw new Error(`Provide a repository font file for ${o[r]}.`);
47
+ }
48
+ if (o.logoPath !== void 0 && o.logoPath !== null && typeof o.logoPath != "string")
49
+ throw new Error("Invalid logo asset path.");
50
+ if (o.logoPath && (e(o.logoPath), !/\.(png|jpe?g)$/i.test(o.logoPath)))
51
+ throw new Error("Use a PNG or JPEG logo for website, email and PDF support.");
52
+ return {
53
+ logoPath: o.logoPath ?? null,
54
+ displayFont: o.displayFont,
55
+ bodyFont: o.bodyFont,
56
+ displayFontPath: o.displayFontPath ?? null,
57
+ bodyFontPath: o.bodyFontPath ?? null,
58
+ cornerRadius: o.cornerRadius,
59
+ colors: { ...o.colors }
60
+ };
61
+ }
62
+ function a(t) {
63
+ return `'${t}', ${t === "Georgia" ? "Georgia, serif" : t === "Courier New" ? "monospace" : "Arial, sans-serif"}`;
64
+ }
65
+ function h(t) {
66
+ const o = i(t);
67
+ return `/* Generated from website/brand.json. Edit the brand, not this file. */
68
+ ${["bodyFont", "displayFont"].map((n) => o[`${n}Path`] ? `@font-face{font-family:'${o[n]}';src:url('${e(o[`${n}Path`])}');font-display:swap;}` : "").join(`
69
+ `)}
70
+ :root{${Object.entries(o.colors).map(([n, d]) => `--brand-${n}:${d};`).join("")}
71
+ --brand-body-font:${a(o.bodyFont)};--brand-display-font:${a(o.displayFont)};--brand-radius:${o.cornerRadius === "sharp" ? 0 : o.cornerRadius === "soft" ? 8 : 20}px;}
72
+ body{background:var(--brand-background);color:var(--brand-text);font-family:var(--brand-body-font);}
73
+ h1,h2,h3,h4,h5,h6{font-family:var(--brand-display-font);}
74
+ [data-brand-logo]{${o.logoPath ? `content:url('${e(o.logoPath)}');` : "display:none;"}max-width:180px;max-height:64px;object-fit:contain;}
75
+ `;
76
+ }
77
+ function u(t, o = "<p>If you have any questions, please contact us.</p>") {
78
+ const r = i(t), n = r.colors;
79
+ return {
80
+ primaryColor: n.primary,
81
+ footerHtml: o,
82
+ headingFont: a(r.displayFont),
83
+ html: `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"></head><body style="margin:0;background:${n.background};color:${n.text};"><div style="padding:40px 16px;font-family:${a(r.bodyFont)};font-size:14px;line-height:1.5;"><div style="max-width:580px;margin:auto;background:${n.surface};border-radius:${r.cornerRadius === "sharp" ? 0 : r.cornerRadius === "soft" ? 8 : 20}px;padding:32px;">{{logo}}{{content}}</div><div style="max-width:580px;margin:20px auto;color:${n.muted};text-align:center;font-size:12px;">{{footer}}{{unsubscribe}}</div></div></body></html>`
84
+ };
85
+ }
86
+ export {
87
+ p as A,
88
+ l as B,
89
+ s as D,
90
+ c as a,
91
+ f as b,
92
+ h as c,
93
+ u as e,
94
+ i as v
95
+ };
package/dist/builder.js CHANGED
@@ -1,8 +1,23 @@
1
- import "./global-Bk9T4Af5.js";
2
- import { B as i } from "./Builder-H8tY8V9I.js";
1
+ import { Z as n, _ as a, a0 as i, a3 as u, a9 as l, ad as p } from "./global-1QvFLK43.js";
2
+ import { B as c } from "./BuilderAgentPane-EOT6JCrB.js";
3
3
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
4
4
  return Promise.resolve().then(e);
5
5
  } });
6
+ function d(e, r) {
7
+ a(r, !0);
8
+ let t = i(r, "projectId", 7, "");
9
+ u();
10
+ var o = {
11
+ get projectId() {
12
+ return t();
13
+ },
14
+ set projectId(s = "") {
15
+ t(s), p();
16
+ }
17
+ };
18
+ return c(e, { floating: !1 }), l(o);
19
+ }
20
+ customElements.define("hintergrund-builder", n(d, { projectId: {} }, [], []));
6
21
  export {
7
- i as default
22
+ d as default
8
23
  };