@floegence/floe-webapp-core 0.101.50 → 0.101.52

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,77 +1,77 @@
1
- import { use as W, insert as j, createComponent as D, effect as X, setAttribute as h, setStyleProperty as b, memo as G, className as tt, template as F, delegateEvents as et } from "solid-js/web";
1
+ import { use as W, insert as j, createComponent as D, effect as N, setAttribute as c, setStyleProperty as k, memo as G, className as tt, template as Y, delegateEvents as et } from "solid-js/web";
2
2
  import { createSignal as J, createMemo as it, onMount as nt, onCleanup as at, For as Q, Show as V } from "solid-js";
3
- import { imageAnnotationMarkup as Z, validateImageAnnotation as Y, imagePointFromClient as ot } from "./imageAnnotation.js";
4
- var rt = /* @__PURE__ */ F("<div data-floe-image-annotation style=width:100%;height:100%;overscroll-behavior:contain><div style=display:grid;place-items:center><svg xmlns=http://www.w3.org/2000/svg role=img style=display:block;user-select:none;flex:none><image></image><g data-annotation-target>"), dt = /* @__PURE__ */ F("<svg><g style=pointer-events:none></svg>", !1, !0, !1), lt = /* @__PURE__ */ F("<svg><rect data-annotation-target fill=white stroke=#111827></svg>", !1, !0, !1);
3
+ import { imageAnnotationMarkup as Z, validateImageAnnotation as X, imagePointFromClient as ot } from "./imageAnnotation.js";
4
+ var rt = /* @__PURE__ */ Y("<div data-floe-image-annotation style=width:100%;height:100%;overscroll-behavior:contain><div style=display:grid;place-items:center><svg xmlns=http://www.w3.org/2000/svg role=img style=display:block;user-select:none;flex:none><image></image><g data-annotation-target>"), dt = /* @__PURE__ */ Y("<svg><g style=pointer-events:none></svg>", !1, !0, !1), lt = /* @__PURE__ */ Y("<svg><rect data-annotation-target fill=white stroke=#111827></svg>", !1, !0, !1);
5
5
  function gt(e) {
6
- let v, u;
6
+ let f, v;
7
7
  const [P, $] = J({
8
8
  width: 1,
9
9
  height: 1
10
- }), [N, M] = J();
11
- let k, f;
12
- const L = () => N() ?? e.annotation, m = it(() => Math.min(P().width / e.width, P().height / e.height) * Math.max(1, e.zoom ?? 1)), _ = () => e.showAnnotation !== !1 && L() && Y(e, L()) ? Z(e, L(), e.marker ?? (e.activeIndex !== void 0 ? e.activeIndex + 1 : 1)) : "";
10
+ }), [F, M] = J();
11
+ let x, m;
12
+ const L = () => F() ?? e.annotation, w = it(() => Math.min(P().width / e.width, P().height / e.height) * Math.max(1, e.zoom ?? 1)), _ = () => e.showAnnotation !== !1 && L() && X(e, L()) ? Z(e, L(), e.marker ?? (e.activeIndex !== void 0 ? e.activeIndex + 1 : 1)) : "";
13
13
  nt(() => {
14
14
  let i = 0;
15
- const d = () => {
15
+ const o = () => {
16
16
  i = 0;
17
- const r = v.clientWidth, c = v.clientHeight;
18
- $((s) => s.width === r && s.height === c ? s : {
19
- width: r,
20
- height: c
17
+ const d = f.clientWidth, h = f.clientHeight;
18
+ $((g) => g.width === d && g.height === h ? g : {
19
+ width: d,
20
+ height: h
21
21
  });
22
- }, a = new ResizeObserver(() => {
23
- i || (i = requestAnimationFrame(d));
22
+ }, n = new ResizeObserver(() => {
23
+ i || (i = requestAnimationFrame(o));
24
24
  });
25
- a.observe(v), d(), at(() => {
26
- a.disconnect(), cancelAnimationFrame(i);
25
+ n.observe(f), o(), at(() => {
26
+ n.disconnect(), cancelAnimationFrame(i);
27
27
  });
28
28
  });
29
- const T = (i, d = !1) => ot(e, u.getBoundingClientRect(), {
29
+ const T = (i, o = !1) => ot(e, v.getBoundingClientRect(), {
30
30
  x: i.clientX,
31
31
  y: i.clientY
32
- }, d), w = () => !!e.onChange && !e.disabled && !e.panning, B = (i) => {
33
- if (f?.id === i.pointerId) {
34
- v.scrollLeft = f.left + f.x - i.clientX, v.scrollTop = f.top + f.y - i.clientY;
32
+ }, o), y = () => !!e.onChange && !e.disabled && !e.panning, B = (i) => {
33
+ if (m?.id === i.pointerId) {
34
+ f.scrollLeft = m.left + m.x - i.clientX, f.scrollTop = m.top + m.y - i.clientY;
35
35
  return;
36
36
  }
37
- const d = k;
38
- if (!d || d.id !== i.pointerId || d.src !== e.src || !w()) return;
39
- const a = T(i, !0);
40
- if (!a) return;
41
- const r = d.original;
42
- if (r && d.corner === void 0) {
43
- const c = r.kind === "rectangle" ? r.width : 0, s = r.kind === "rectangle" ? r.height : 0;
37
+ const o = x;
38
+ if (!o || o.id !== i.pointerId || o.src !== e.src || !y()) return;
39
+ const n = T(i, !0);
40
+ if (!n) return;
41
+ const d = o.original;
42
+ if (d && o.corner === void 0) {
43
+ const h = d.kind === "rectangle" ? d.width : 0, g = d.kind === "rectangle" ? d.height : 0;
44
44
  M({
45
- ...r,
46
- x: Math.max(0, Math.min(e.width - c, r.x + a.x - d.start.x)),
47
- y: Math.max(0, Math.min(e.height - s, r.y + a.y - d.start.y))
45
+ ...d,
46
+ x: Math.max(0, Math.min(e.width - h, d.x + n.x - o.start.x)),
47
+ y: Math.max(0, Math.min(e.height - g, d.y + n.y - o.start.y))
48
48
  });
49
49
  } else {
50
- const c = r?.kind === "rectangle" && d.corner !== void 0 ? {
51
- x: r.x + (d.corner % 2 ? 0 : r.width),
52
- y: r.y + (d.corner < 2 ? r.height : 0)
53
- } : d.start, s = Math.abs(a.x - c.x), I = Math.abs(a.y - c.y);
54
- Math.hypot(i.clientX - d.client.x, i.clientY - d.client.y) < 5 && !r ? M({
50
+ const h = d?.kind === "rectangle" && o.corner !== void 0 ? {
51
+ x: d.x + (o.corner % 2 ? 0 : d.width),
52
+ y: d.y + (o.corner < 2 ? d.height : 0)
53
+ } : o.start, g = Math.abs(n.x - h.x), I = Math.abs(n.y - h.y);
54
+ Math.hypot(i.clientX - o.client.x, i.clientY - o.client.y) >= 5 && (o.dragged = !0), !o.dragged && !d ? M(o.pin ? void 0 : {
55
55
  kind: "point",
56
- ...c
57
- }) : s > 0 && I > 0 && M({
56
+ ...h
57
+ }) : g > 0 && I > 0 && M({
58
58
  kind: "rectangle",
59
- x: Math.min(c.x, a.x),
60
- y: Math.min(c.y, a.y),
61
- width: s,
59
+ x: Math.min(h.x, n.x),
60
+ y: Math.min(h.y, n.y),
61
+ width: g,
62
62
  height: I
63
63
  });
64
64
  }
65
- }, E = (i, d = !1) => {
66
- if (f?.id === i.pointerId) {
67
- f = void 0, u.hasPointerCapture(i.pointerId) && u.releasePointerCapture(i.pointerId);
65
+ }, E = (i, o = !1) => {
66
+ if (m?.id === i.pointerId) {
67
+ m = void 0, v.hasPointerCapture(i.pointerId) && v.releasePointerCapture(i.pointerId);
68
68
  return;
69
69
  }
70
- const a = k;
71
- if (!a || a.id !== i.pointerId) return;
72
- d || B(i);
73
- const r = N();
74
- k = void 0, M(void 0), u.hasPointerCapture(i.pointerId) && u.releasePointerCapture(i.pointerId), !d && a.src === e.src && w() && r && Y(e, r) && e.onChange?.(r);
70
+ const n = x;
71
+ if (!n || n.id !== i.pointerId) return;
72
+ o || B(i);
73
+ const d = F();
74
+ x = void 0, M(void 0), v.hasPointerCapture(i.pointerId) && v.releasePointerCapture(i.pointerId), !(o || n.src !== e.src || !y()) && (n.pin && !n.dragged ? e.annotations?.[n.pin.index] === n.pin.annotation && e.onSelect?.(n.pin.index) : d && X(e, d) && e.onChange?.(d));
75
75
  }, p = () => {
76
76
  const i = L();
77
77
  return i?.kind === "rectangle" ? [{
@@ -89,11 +89,11 @@ function gt(e) {
89
89
  }] : [];
90
90
  };
91
91
  return (() => {
92
- var i = rt(), d = i.firstChild, a = d.firstChild, r = a.firstChild, c = r.nextSibling, s = v;
93
- typeof s == "function" ? W(s, i) : v = i, a.$$keydown = (t) => {
94
- if (!w()) return;
92
+ var i = rt(), o = i.firstChild, n = o.firstChild, d = n.firstChild, h = d.nextSibling, g = f;
93
+ typeof g == "function" ? W(g, i) : f = i, n.$$keydown = (t) => {
94
+ if (!y()) return;
95
95
  if (t.key === "Escape") {
96
- k = void 0, M(void 0);
96
+ x = void 0, M(void 0);
97
97
  return;
98
98
  }
99
99
  const l = {
@@ -104,81 +104,88 @@ function gt(e) {
104
104
  }[t.key];
105
105
  if (!l && t.key !== "Enter" && t.key !== " ") return;
106
106
  t.preventDefault();
107
- const o = e.annotation ?? {
107
+ const r = e.annotation ?? {
108
108
  kind: "point",
109
109
  x: e.width / 2,
110
110
  y: e.height / 2
111
- }, n = t.shiftKey ? 10 : 1;
111
+ }, a = t.shiftKey ? 10 : 1;
112
112
  e.onChange?.({
113
- ...o,
114
- x: Math.max(0, Math.min(e.width - (o.kind === "rectangle" ? o.width : 0), o.x + (l?.[0] ?? 0) * n)),
115
- y: Math.max(0, Math.min(e.height - (o.kind === "rectangle" ? o.height : 0), o.y + (l?.[1] ?? 0) * n))
113
+ ...r,
114
+ x: Math.max(0, Math.min(e.width - (r.kind === "rectangle" ? r.width : 0), r.x + (l?.[0] ?? 0) * a)),
115
+ y: Math.max(0, Math.min(e.height - (r.kind === "rectangle" ? r.height : 0), r.y + (l?.[1] ?? 0) * a))
116
116
  });
117
- }, a.addEventListener("lostpointercapture", (t) => E(t, !0)), a.addEventListener("pointercancel", (t) => E(t, !0)), a.$$pointerup = (t) => E(t), a.$$pointermove = B, a.$$pointerdown = (t) => {
118
- if (e.panning && t.button === 0 && !f) {
119
- f = {
117
+ }, n.addEventListener("lostpointercapture", (t) => E(t, !0)), n.addEventListener("pointercancel", (t) => E(t, !0)), n.$$pointerup = (t) => E(t), n.$$pointermove = B, n.$$pointerdown = (t) => {
118
+ if (e.panning && t.button === 0 && !m) {
119
+ m = {
120
120
  id: t.pointerId,
121
121
  x: t.clientX,
122
122
  y: t.clientY,
123
- left: v.scrollLeft,
124
- top: v.scrollTop
125
- }, u.setPointerCapture(t.pointerId), t.preventDefault();
123
+ left: f.scrollLeft,
124
+ top: f.scrollTop
125
+ }, v.setPointerCapture(t.pointerId), t.preventDefault();
126
126
  return;
127
127
  }
128
- if (!w() || t.button !== 0 || k) return;
128
+ if (!y() || t.button !== 0 || x) return;
129
129
  const l = T(t);
130
130
  if (!l) return;
131
- const o = t.target, n = o.closest("[data-annotation-index]")?.getAttribute("data-annotation-index");
132
- if (n != null && Number(n) !== e.activeIndex) {
133
- e.onSelect?.(Number(n)), t.preventDefault();
131
+ const r = t.target, a = r.closest("[data-annotation-index]")?.getAttribute("data-annotation-index"), s = a == null ? void 0 : e.annotations?.[Number(a)];
132
+ if (s && (e.annotation || e.activeIndex !== void 0)) {
133
+ e.onSelect?.(Number(a)), t.preventDefault();
134
134
  return;
135
135
  }
136
- const g = o.getAttribute("data-corner");
137
- k = {
136
+ const u = r.getAttribute("data-corner");
137
+ x = {
138
138
  id: t.pointerId,
139
139
  start: l,
140
140
  client: {
141
141
  x: t.clientX,
142
142
  y: t.clientY
143
143
  },
144
+ dragged: !1,
144
145
  src: e.src,
145
- ...o.closest("[data-annotation-target]") ? {
146
+ ...s ? {
147
+ pin: {
148
+ index: Number(a),
149
+ annotation: s
150
+ }
151
+ } : {},
152
+ ...r.closest("[data-annotation-target]") ? {
146
153
  original: e.annotation
147
154
  } : {},
148
- ...g !== null ? {
149
- corner: Number(g)
155
+ ...u !== null ? {
156
+ corner: Number(u)
150
157
  } : {}
151
- }, M(k.original ?? {
158
+ }, M(x.pin ? void 0 : x.original ?? {
152
159
  kind: "point",
153
160
  ...l
154
- }), u.setPointerCapture(t.pointerId), u.focus({
161
+ }), v.setPointerCapture(t.pointerId), v.focus({
155
162
  preventScroll: !0
156
163
  }), t.preventDefault();
157
164
  };
158
- var I = u;
159
- return typeof I == "function" ? W(I, a) : u = a, j(a, D(Q, {
165
+ var I = v;
166
+ return typeof I == "function" ? W(I, n) : v = n, j(n, D(Q, {
160
167
  get each() {
161
168
  return e.annotations?.slice(0, 99);
162
169
  },
163
170
  children: (t, l) => D(V, {
164
171
  get when() {
165
- return G(() => e.showAnnotation !== !1 && l() !== e.activeIndex)() && Y(e, t);
172
+ return G(() => e.showAnnotation !== !1 && l() !== e.activeIndex)() && X(e, t);
166
173
  },
167
174
  get children() {
168
- var o = dt();
169
- return X((n) => {
170
- var g = l(), x = Z(e, t, l() + 1), y = e.cursor ?? (e.onSelect ? "pointer" : void 0);
171
- return g !== n.e && h(o, "data-annotation-index", n.e = g), x !== n.t && (o.innerHTML = n.t = x), y !== n.a && b(o, "cursor", n.a = y), n;
175
+ var r = dt();
176
+ return N((a) => {
177
+ var s = l(), u = Z(e, t, l() + 1), b = e.cursor ?? (e.onSelect ? "pointer" : void 0);
178
+ return s !== a.e && c(r, "data-annotation-index", a.e = s), u !== a.t && (r.innerHTML = a.t = u), b !== a.a && k(r, "cursor", a.a = b), a;
172
179
  }, {
173
180
  e: void 0,
174
181
  t: void 0,
175
182
  a: void 0
176
- }), o;
183
+ }), r;
177
184
  }
178
185
  })
179
- }), c), j(a, D(V, {
186
+ }), h), j(n, D(V, {
180
187
  get when() {
181
- return G(() => !!w())() && e.showAnnotation !== !1;
188
+ return G(() => !!y())() && e.showAnnotation !== !1;
182
189
  },
183
190
  get children() {
184
191
  return D(Q, {
@@ -186,10 +193,10 @@ function gt(e) {
186
193
  return p();
187
194
  },
188
195
  children: (t, l) => (() => {
189
- var o = lt();
190
- return X((n) => {
191
- var g = l(), x = t.x - 5 / m(), y = t.y - 5 / m(), C = 10 / m(), A = 10 / m(), S = 1 / m(), z = e.cursor ?? (l() === 0 || l() === 3 ? "nwse-resize" : "nesw-resize");
192
- return g !== n.e && h(o, "data-corner", n.e = g), x !== n.t && h(o, "x", n.t = x), y !== n.a && h(o, "y", n.a = y), C !== n.o && h(o, "width", n.o = C), A !== n.i && h(o, "height", n.i = A), S !== n.n && h(o, "stroke-width", n.n = S), z !== n.s && b(o, "cursor", n.s = z), n;
196
+ var r = lt();
197
+ return N((a) => {
198
+ var s = l(), u = t.x - 5 / w(), b = t.y - 5 / w(), C = 10 / w(), A = 10 / w(), S = 1 / w(), z = e.cursor ?? (l() === 0 || l() === 3 ? "nwse-resize" : "nesw-resize");
199
+ return s !== a.e && c(r, "data-corner", a.e = s), u !== a.t && c(r, "x", a.t = u), b !== a.a && c(r, "y", a.a = b), C !== a.o && c(r, "width", a.o = C), A !== a.i && c(r, "height", a.i = A), S !== a.n && c(r, "stroke-width", a.n = S), z !== a.s && k(r, "cursor", a.s = z), a;
193
200
  }, {
194
201
  e: void 0,
195
202
  t: void 0,
@@ -198,13 +205,13 @@ function gt(e) {
198
205
  i: void 0,
199
206
  n: void 0,
200
207
  s: void 0
201
- }), o;
208
+ }), r;
202
209
  })()
203
210
  });
204
211
  }
205
- }), null), X((t) => {
206
- var l = e.class, o = (e.zoom ?? 1) > 1 ? "auto" : "hidden", n = (e.zoom ?? 1) > 1 ? "stable" : "auto", g = `${Math.max(P().width, e.width * m())}px`, x = `${Math.max(P().height, e.height * m())}px`, y = e.width * m(), C = e.height * m(), A = `0 0 ${e.width} ${e.height}`, S = e.label, z = w() ? 0 : void 0, H = w() || e.panning ? "none" : "auto", R = e.cursor ?? (e.panning ? "grab" : w() ? "crosshair" : "default"), q = e.src, K = e.width, O = e.height, U = _();
207
- return l !== t.e && tt(i, t.e = l), o !== t.t && b(i, "overflow", t.t = o), n !== t.a && b(i, "scrollbar-gutter", t.a = n), g !== t.o && b(d, "width", t.o = g), x !== t.i && b(d, "height", t.i = x), y !== t.n && h(a, "width", t.n = y), C !== t.s && h(a, "height", t.s = C), A !== t.h && h(a, "viewBox", t.h = A), S !== t.r && h(a, "aria-label", t.r = S), z !== t.d && h(a, "tabindex", t.d = z), H !== t.l && b(a, "touch-action", t.l = H), R !== t.u && b(a, "cursor", t.u = R), q !== t.c && h(r, "href", t.c = q), K !== t.w && h(r, "width", t.w = K), O !== t.m && h(r, "height", t.m = O), U !== t.f && (c.innerHTML = t.f = U), t;
212
+ }), null), N((t) => {
213
+ var l = e.class, r = (e.zoom ?? 1) > 1 ? "auto" : "hidden", a = (e.zoom ?? 1) > 1 ? "stable" : "auto", s = `${Math.max(P().width, e.width * w())}px`, u = `${Math.max(P().height, e.height * w())}px`, b = e.width * w(), C = e.height * w(), A = `0 0 ${e.width} ${e.height}`, S = e.label, z = y() ? 0 : void 0, H = y() || e.panning ? "none" : "auto", R = e.cursor ?? (e.panning ? "grab" : y() ? "crosshair" : "default"), q = e.src, K = e.width, O = e.height, U = _();
214
+ return l !== t.e && tt(i, t.e = l), r !== t.t && k(i, "overflow", t.t = r), a !== t.a && k(i, "scrollbar-gutter", t.a = a), s !== t.o && k(o, "width", t.o = s), u !== t.i && k(o, "height", t.i = u), b !== t.n && c(n, "width", t.n = b), C !== t.s && c(n, "height", t.s = C), A !== t.h && c(n, "viewBox", t.h = A), S !== t.r && c(n, "aria-label", t.r = S), z !== t.d && c(n, "tabindex", t.d = z), H !== t.l && k(n, "touch-action", t.l = H), R !== t.u && k(n, "cursor", t.u = R), q !== t.c && c(d, "href", t.c = q), K !== t.w && c(d, "width", t.w = K), O !== t.m && c(d, "height", t.m = O), U !== t.f && (h.innerHTML = t.f = U), t;
208
215
  }, {
209
216
  e: void 0,
210
217
  t: void 0,
@@ -1,6 +1,8 @@
1
1
  import { type JSX } from 'solid-js';
2
2
  import type { FloeThemePreset } from '../../themes';
3
+ import { type ThemeStudioProps } from './ThemeStudio';
3
4
  export interface ThemePickerProps {
5
+ studio?: ThemeStudioProps;
4
6
  mode: string;
5
7
  modes: readonly {
6
8
  value: string;
@@ -1,35 +1,36 @@
1
- import { insert as d, createComponent as f, effect as y, setAttribute as o, memo as j, setStyleProperty as u, template as m, use as z, delegateEvents as B } from "solid-js/web";
2
- import { createUniqueId as J, onCleanup as K, createEffect as N, For as x, Show as Q } from "solid-js";
3
- import { Check as V } from "../icons/index.js";
4
- var W = /* @__PURE__ */ m("<p role=alert class=floe-theme-picker__error>"), X = /* @__PURE__ */ m("<div class=floe-theme-picker><div class=floe-theme-picker__toolbar><div role=radiogroup class=floe-theme-picker__modes></div><span role=status aria-live=polite class=floe-theme-picker__status></span></div><div role=radiogroup class=floe-theme-picker__presets>"), Y = /* @__PURE__ */ m("<button type=button role=radio>"), Z = /* @__PURE__ */ m("<button type=button role=radio><span class=floe-theme-picker__preview aria-hidden=true><span class=floe-theme-picker__preview-sidebar></span><span class=floe-theme-picker__preview-body><i></i><span></span></span></span><span class=floe-theme-picker__caption><span></span><span class=floe-theme-picker__check aria-hidden=true>"), p = /* @__PURE__ */ m("<i>");
5
- function ie(t) {
6
- const I = J();
7
- let $, g, C = !1;
8
- K(() => {
9
- C = !0;
10
- }), N(() => {
11
- const l = t.presets.map((n) => n.name);
12
- !g || l.includes(g) || queueMicrotask(() => {
13
- if (C) return;
1
+ import { insert as d, createComponent as u, effect as y, setAttribute as o, memo as z, mergeProps as B, setStyleProperty as v, template as f, use as J, delegateEvents as K } from "solid-js/web";
2
+ import { createUniqueId as N, onCleanup as Q, createEffect as V, For as x, Show as I } from "solid-js";
3
+ import { Check as W } from "../icons/index.js";
4
+ import { ThemeStudio as X } from "./ThemeStudio.js";
5
+ var Y = /* @__PURE__ */ f("<p role=alert class=floe-theme-picker__error>"), Z = /* @__PURE__ */ f("<div class=floe-theme-picker><div class=floe-theme-picker__toolbar><div role=radiogroup class=floe-theme-picker__modes></div><span role=status aria-live=polite class=floe-theme-picker__status></span></div><div role=radiogroup class=floe-theme-picker__presets>"), p = /* @__PURE__ */ f("<button type=button role=radio>"), ee = /* @__PURE__ */ f("<button type=button role=radio><span class=floe-theme-picker__preview aria-hidden=true><span class=floe-theme-picker__preview-sidebar></span><span class=floe-theme-picker__preview-body><i></i><span></span></span></span><span class=floe-theme-picker__caption><span></span><span class=floe-theme-picker__check aria-hidden=true>"), re = /* @__PURE__ */ f("<i>");
6
+ function ne(t) {
7
+ const O = N();
8
+ let $, g, S = !1;
9
+ Q(() => {
10
+ S = !0;
11
+ }), V(() => {
12
+ const n = t.presets.map((l) => l.name);
13
+ !g || n.includes(g) || queueMicrotask(() => {
14
+ if (S) return;
14
15
  $?.querySelector('[aria-checked="true"]')?.focus({
15
16
  preventScroll: !0
16
17
  });
17
18
  });
18
19
  });
19
- const S = (l) => {
20
- const n = [...l.currentTarget.querySelectorAll('[role="radio"]')], c = n.indexOf(l.target);
20
+ const C = (n) => {
21
+ const l = [...n.currentTarget.querySelectorAll('[role="radio"]')], c = l.indexOf(n.target);
21
22
  if (c < 0) return;
22
- const v = l.key === "Home" ? 0 : l.key === "End" ? n.length - 1 : ["ArrowRight", "ArrowDown"].includes(l.key) ? (c + 1) % n.length : ["ArrowLeft", "ArrowUp"].includes(l.key) ? (c - 1 + n.length) % n.length : null;
23
- v !== null && (l.preventDefault(), n[v]?.focus(), n[v]?.click());
23
+ const h = n.key === "Home" ? 0 : n.key === "End" ? l.length - 1 : ["ArrowRight", "ArrowDown"].includes(n.key) ? (c + 1) % l.length : ["ArrowLeft", "ArrowUp"].includes(n.key) ? (c - 1 + l.length) % l.length : null;
24
+ h !== null && (n.preventDefault(), l[h]?.focus(), l[h]?.click());
24
25
  };
25
26
  return (() => {
26
- var l = X(), n = l.firstChild, c = n.firstChild, v = c.nextSibling, s = n.nextSibling;
27
- c.$$keydown = S, d(c, f(x, {
27
+ var n = Z(), l = n.firstChild, c = l.firstChild, h = c.nextSibling, s = l.nextSibling;
28
+ c.$$keydown = C, d(c, u(x, {
28
29
  get each() {
29
30
  return t.modes;
30
31
  },
31
32
  children: (e) => (() => {
32
- var i = Y();
33
+ var i = p();
33
34
  return i.$$click = () => {
34
35
  t.pending || t.onModeChange(e.value);
35
36
  }, d(i, () => e.label), y((a) => {
@@ -42,34 +43,39 @@ function ie(t) {
42
43
  o: void 0
43
44
  }), i;
44
45
  })()
45
- })), d(v, (() => {
46
- var e = j(() => !!t.pending);
46
+ })), d(h, (() => {
47
+ var e = z(() => !!t.pending);
47
48
  return () => e() ? t.pendingLabel : "";
48
- })()), s.$$keydown = S, s.$$focusout = (e) => {
49
+ })()), d(l, u(I, {
50
+ get when() {
51
+ return t.studio;
52
+ },
53
+ children: (e) => u(X, B(e))
54
+ }), null), s.$$keydown = C, s.$$focusout = (e) => {
49
55
  e.relatedTarget && !e.currentTarget.contains(e.relatedTarget) && (g = void 0);
50
56
  }, s.$$focusin = (e) => {
51
57
  g = e.target.closest("[data-theme-preset]")?.dataset.themePreset;
52
58
  };
53
59
  var P = $;
54
- return typeof P == "function" ? z(P, s) : $ = s, d(s, f(x, {
60
+ return typeof P == "function" ? J(P, s) : $ = s, d(s, u(x, {
55
61
  get each() {
56
62
  return t.presets;
57
63
  },
58
64
  children: (e) => (() => {
59
- var i = Z(), a = i.firstChild, b = a.firstChild, k = b.nextSibling, _ = k.firstChild, w = _.nextSibling, O = a.nextSibling, A = O.firstChild, R = A.nextSibling;
65
+ var i = ee(), a = i.firstChild, b = a.firstChild, k = b.nextSibling, _ = k.firstChild, w = _.nextSibling, R = a.nextSibling, A = R.firstChild, j = A.nextSibling;
60
66
  return i.$$click = () => {
61
67
  t.pending || t.onPresetChange(e);
62
- }, d(w, f(x, {
68
+ }, d(w, u(x, {
63
69
  get each() {
64
70
  return e.preview?.colors?.slice(0, 4);
65
71
  },
66
72
  children: (r) => (() => {
67
- var h = p();
68
- return u(h, "background", r), h;
73
+ var m = re();
74
+ return v(m, "background", r), m;
69
75
  })()
70
- })), d(A, () => t.presetLabel(e)), d(R, f(V, {})), y((r) => {
71
- var h = e.name, L = t.presetLabel(e), T = t.selectedPreset === e.name, q = t.selectedPreset === e.name ? 0 : -1, E = !!t.pending, D = t.pending === e.name, M = e.preview?.background, U = e.preview?.surface, F = e.preview?.sidebar, G = e.preview?.border, H = e.preview?.primary;
72
- return h !== r.e && o(i, "data-theme-preset", r.e = h), L !== r.t && o(i, "aria-label", r.t = L), T !== r.a && o(i, "aria-checked", r.a = T), q !== r.o && o(i, "tabindex", r.o = q), E !== r.i && o(i, "aria-disabled", r.i = E), D !== r.n && o(i, "aria-busy", r.n = D), M !== r.s && u(a, "--theme-preview-bg", r.s = M), U !== r.h && u(a, "--theme-preview-surface", r.h = U), F !== r.r && u(a, "--theme-preview-sidebar", r.r = F), G !== r.d && u(a, "--theme-preview-border", r.d = G), H !== r.l && u(a, "--theme-preview-primary", r.l = H), r;
76
+ })), d(A, () => t.presetLabel(e)), d(j, u(W, {})), y((r) => {
77
+ var m = e.name, L = t.presetLabel(e), T = t.selectedPreset === e.name, q = t.selectedPreset === e.name ? 0 : -1, E = !!t.pending, D = t.pending === e.name, M = e.preview?.background, U = e.preview?.surface, F = e.preview?.sidebar, G = e.preview?.border, H = e.preview?.primary;
78
+ return m !== r.e && o(i, "data-theme-preset", r.e = m), L !== r.t && o(i, "aria-label", r.t = L), T !== r.a && o(i, "aria-checked", r.a = T), q !== r.o && o(i, "tabindex", r.o = q), E !== r.i && o(i, "aria-disabled", r.i = E), D !== r.n && o(i, "aria-busy", r.n = D), M !== r.s && v(a, "--theme-preview-bg", r.s = M), U !== r.h && v(a, "--theme-preview-surface", r.h = U), F !== r.r && v(a, "--theme-preview-sidebar", r.r = F), G !== r.d && v(a, "--theme-preview-border", r.d = G), H !== r.l && v(a, "--theme-preview-primary", r.l = H), r;
73
79
  }, {
74
80
  e: void 0,
75
81
  t: void 0,
@@ -84,13 +90,13 @@ function ie(t) {
84
90
  l: void 0
85
91
  }), i;
86
92
  })()
87
- })), d(l, f(Q, {
93
+ })), d(n, u(I, {
88
94
  get when() {
89
95
  return t.error;
90
96
  },
91
97
  get children() {
92
- var e = W();
93
- return o(e, "id", `${I}-error`), d(e, () => t.error), e;
98
+ var e = Y();
99
+ return o(e, "id", `${O}-error`), d(e, () => t.error), e;
94
100
  }
95
101
  }), null), y((e) => {
96
102
  var i = t.modeLabel, a = t.presetsLabel;
@@ -98,10 +104,10 @@ function ie(t) {
98
104
  }, {
99
105
  e: void 0,
100
106
  t: void 0
101
- }), l;
107
+ }), n;
102
108
  })();
103
109
  }
104
- B(["keydown", "focusin", "focusout", "click"]);
110
+ K(["keydown", "focusin", "focusout", "click"]);
105
111
  export {
106
- ie as ThemePicker
112
+ ne as ThemePicker
107
113
  };
@@ -0,0 +1,11 @@
1
+ import { type FloeThemeDocument } from '../../themes';
2
+ export type ThemeStudioLabel = 'create' | 'edit' | 'import' | 'export' | 'generate' | 'name' | 'colors' | 'advanced' | 'save' | 'cancel' | 'invalid' | 'failed' | 'background' | 'foreground' | 'primary' | 'card' | 'sidebar' | 'border';
3
+ export interface ThemeStudioProps {
4
+ active: boolean;
5
+ current: FloeThemeDocument;
6
+ currentID?: string;
7
+ label: (key: ThemeStudioLabel) => string;
8
+ save: (document: FloeThemeDocument, existingID?: string) => Promise<void>;
9
+ generate?: (base: FloeThemeDocument) => void;
10
+ }
11
+ export declare function ThemeStudio(props: ThemeStudioProps): import("solid-js").JSX.Element;