@nivaro/react 0.3.16 → 0.3.18

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.
Files changed (28) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +51 -1
  4. package/dist/index.js +243 -240
  5. package/dist/shared/components/CollectionBrowserView.js +439 -438
  6. package/dist/shared/components/ItemEditForm.js +3758 -3708
  7. package/dist/shared/components/ProfileView.js +38 -23
  8. package/dist/shared/components/RecordReadView.js +452 -430
  9. package/dist/shared/components/bulk/BulkActionButtons.js +113 -106
  10. package/dist/shared/components/chat/ChannelArchive.js +16 -17
  11. package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
  12. package/dist/shared/components/chat/ChatPanel.js +992 -930
  13. package/dist/shared/components/chat/Composer.js +307 -303
  14. package/dist/shared/components/chat/chat-core.js +8 -4
  15. package/dist/shared/components/chat/chat-drafts.js +60 -43
  16. package/dist/shared/components/item-edit/InlineTableField.js +159 -158
  17. package/dist/shared/components/item-edit/RecordLiveSync.js +169 -155
  18. package/dist/shared/components/item-edit/RelationCombobox.js +274 -247
  19. package/dist/shared/components/item-edit/RowHistorySheet.js +62 -62
  20. package/dist/shared/components/item-edit/picker-search.js +28 -0
  21. package/dist/shared/components/panels/RevisionsPanel.js +268 -260
  22. package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
  23. package/dist/shared/components/profile/BrowserPushCard.js +135 -89
  24. package/dist/shared/components/profile/push-failure.js +76 -0
  25. package/dist/shared/lib/display-prefs.js +90 -0
  26. package/dist/shared/lib/request-gate.js +140 -127
  27. package/dist/shared/lib/theme-accents.js +21 -16
  28. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
- import { noteOwnWriteFromCommand as C } from "./own-writes.js";
2
- import { noteCredentialChanged as z, isIdentityRead as D, claimIdentityCall as M, signedOutError as $, noteSignedIn as Z, isSignedOutError as U, noteUnauthorized as x } from "./signed-out.js";
3
- function q(t) {
1
+ import { noteOwnWriteFromCommand as O } from "./own-writes.js";
2
+ import { noteCredentialChanged as z, isIdentityRead as M, claimIdentityCall as $, signedOutError as Z, noteSignedIn as H, isSignedOutError as U, noteUnauthorized as x } from "./signed-out.js";
3
+ function I(t) {
4
4
  if (!t || typeof t != "object") return "";
5
- const s = Object.entries(t).filter(([, o]) => o != null).map(([o, u]) => [o, String(u)]).sort(([o], [u]) => o < u ? -1 : o > u ? 1 : 0);
5
+ const s = Object.entries(t).filter(([, o]) => o != null).map(([o, i]) => [o, String(i)]).sort(([o], [i]) => o < i ? -1 : o > i ? 1 : 0);
6
6
  return s.length ? new URLSearchParams(s).toString() : "";
7
7
  }
8
8
  function P(t) {
9
9
  const s = (t._method ?? "GET").toUpperCase(), o = s === "GET" || t._body === void 0 ? "" : JSON.stringify(t._body);
10
- return `${s} ${t._path ?? ""} ${q(t._params)} ${o}`;
10
+ return `${s} ${t._path ?? ""} ${I(t._params)} ${o}`;
11
11
  }
12
- function A(t) {
12
+ function w(t) {
13
13
  return (t._method ?? "GET").toUpperCase() === "GET";
14
14
  }
15
- const I = /^\/(widgets-internal\/[^/]+\/render|items\/[^/]+\/[^/]+\/child-summary|items\/[^/]+\/auto-id-preview|config-conformance\/record\/.+\/check|pipelines\/instance\/[^/]+\/owners\/batch|addendums\/summary|at-risk\/evaluate|record-views\/.+\/touch)$/;
16
- function H(t) {
17
- return A(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : I.test((t._path ?? "").split("?")[0]);
15
+ const q = /^\/(widgets-internal\/[^/]+\/render|items\/[^/]+\/[^/]+\/child-summary|items\/[^/]+\/auto-id-preview|config-conformance\/record\/.+\/check|pipelines\/instance\/[^/]+\/owners\/batch|addendums\/summary|at-risk\/evaluate|record-views\/.+\/touch)$/;
16
+ function B(t) {
17
+ return w(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : q.test((t._path ?? "").split("?")[0]);
18
18
  }
19
19
  function T(t) {
20
20
  if (t == null || typeof t != "object") return t;
@@ -24,11 +24,11 @@ function T(t) {
24
24
  return t;
25
25
  }
26
26
  }
27
- const j = Symbol("nivaro.coalesced");
28
- function B(t) {
29
- return t[j] === !0;
27
+ const N = Symbol("nivaro.coalesced");
28
+ function F(t) {
29
+ return t[N] === !0;
30
30
  }
31
- const O = 20, F = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, W = /* @__PURE__ */ new Set(["aggregate", "export", "distinct", "resolve-paths", "batch-read"]), K = /* @__PURE__ */ new Set([
31
+ const b = 20, W = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, K = /* @__PURE__ */ new Set(["aggregate", "export", "distinct", "resolve-paths", "batch-read"]), J = /* @__PURE__ */ new Set([
32
32
  "fields",
33
33
  "filter",
34
34
  "sort",
@@ -44,29 +44,29 @@ const O = 20, F = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, W = /*
44
44
  function Y(t) {
45
45
  const s = t;
46
46
  if ((s._method ?? "GET").toUpperCase() !== "GET") return null;
47
- const o = F.exec(s._path ?? "");
47
+ const o = W.exec(s._path ?? "");
48
48
  if (!o) return null;
49
- const [, u, d] = o;
50
- if (d !== void 0 && W.has(d)) return null;
51
- const m = s._params ?? {}, a = {};
52
- for (const [r, c] of Object.entries(m))
53
- if (c !== void 0) {
54
- if (!K.has(r)) return null;
55
- a[r] = c;
49
+ const [, i, d] = o;
50
+ if (d !== void 0 && K.has(d)) return null;
51
+ const m = s._params ?? {}, c = {};
52
+ for (const [r, u] of Object.entries(m))
53
+ if (u !== void 0) {
54
+ if (!J.has(r)) return null;
55
+ c[r] = u;
56
56
  }
57
- return d === void 0 ? { collection: u, query: a } : { collection: u, id: d, query: a };
57
+ return d === void 0 ? { collection: i, query: c } : { collection: i, id: d, query: c };
58
58
  }
59
- function J(t) {
59
+ function Q(t) {
60
60
  let s = [], o;
61
- const u = (a) => t.request(a.command).then(a.resolve, a.reject), d = async (a) => {
62
- if (a.length === 1) return u(a[0]);
61
+ const i = (c) => t.request(c.command).then(c.resolve, c.reject), d = async (c) => {
62
+ if (c.length === 1) return i(c[0]);
63
63
  let r;
64
64
  try {
65
- const c = await t.request({
65
+ const u = await t.request({
66
66
  _method: "POST",
67
67
  _path: "/items/batch-read",
68
68
  _body: {
69
- reads: a.map((n, e) => ({
69
+ reads: c.map((n, e) => ({
70
70
  key: String(e),
71
71
  collection: n.read.collection,
72
72
  ...n.read.id !== void 0 ? { id: n.read.id } : {},
@@ -74,50 +74,50 @@ function J(t) {
74
74
  }))
75
75
  }
76
76
  });
77
- r = Array.isArray(c == null ? void 0 : c.results) ? c.results : void 0;
77
+ r = Array.isArray(u == null ? void 0 : u.results) ? u.results : void 0;
78
78
  } catch {
79
79
  r = void 0;
80
80
  }
81
- a.forEach((c, n) => {
81
+ c.forEach((u, n) => {
82
82
  const e = r == null ? void 0 : r[n];
83
83
  if ((e == null ? void 0 : e.status) !== 200 || e === void 0) {
84
- u(c);
84
+ i(u);
85
85
  return;
86
86
  }
87
- c.resolve(c.read.id !== void 0 ? { data: e.data } : { data: e.data, ...e.meta ?? {} });
87
+ u.resolve(u.read.id !== void 0 ? { data: e.data } : { data: e.data, ...e.meta ?? {} });
88
88
  });
89
89
  }, m = () => {
90
90
  o = void 0;
91
- const a = s;
91
+ const c = s;
92
92
  s = [];
93
- for (let r = 0; r < a.length; r += O)
94
- d(a.slice(r, r + O));
93
+ for (let r = 0; r < c.length; r += b)
94
+ d(c.slice(r, r + b));
95
95
  };
96
- return (a, r) => new Promise((c, n) => {
96
+ return (c, r) => new Promise((u, n) => {
97
97
  s.push({
98
98
  read: r,
99
- command: a,
100
- resolve: c,
99
+ command: c,
100
+ resolve: u,
101
101
  reject: n
102
102
  }), o === void 0 && (o = setTimeout(m, 0));
103
103
  });
104
104
  }
105
- const b = 50, Q = 10, V = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
106
- function X(t) {
105
+ const R = 50, V = 10, X = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
106
+ function ee(t) {
107
107
  const s = t;
108
- if ((s._method ?? "GET").toUpperCase() !== "GET" || q(s._params) !== "") return null;
109
- const o = V.exec(s._path ?? "");
108
+ if ((s._method ?? "GET").toUpperCase() !== "GET" || I(s._params) !== "") return null;
109
+ const o = X.exec(s._path ?? "");
110
110
  return o ? o[1] : null;
111
111
  }
112
- function ee() {
112
+ function te() {
113
113
  return Object.assign(new Error("Not found"), { status: 404, response: { error: "Not found" } });
114
114
  }
115
- function te(t) {
116
- let s = !0, o = [], u;
115
+ function ne(t) {
116
+ let s = !0, o = [], i;
117
117
  const d = (r) => t.request(r.command).then(r.resolve, r.reject), m = async (r) => {
118
- const c = [...new Set(r.map((i) => i.name))];
119
- if (c.length === 1 || !s) {
120
- for (const i of r) d(i);
118
+ const u = [...new Set(r.map((a) => a.name))];
119
+ if (u.length === 1 || !s) {
120
+ for (const a of r) d(a);
121
121
  return;
122
122
  }
123
123
  let n;
@@ -125,13 +125,13 @@ function te(t) {
125
125
  n = await t.request({
126
126
  _method: "GET",
127
127
  _path: "/collections",
128
- _params: { names: c.join(",") }
128
+ _params: { names: u.join(",") }
129
129
  });
130
- } catch (i) {
131
- const h = i == null ? void 0 : i.status;
130
+ } catch (a) {
131
+ const h = a == null ? void 0 : a.status;
132
132
  if (h === 400 || h === 404 || h === 405) s = !1;
133
133
  else if (h === 429 || h !== void 0 && h >= 500) {
134
- for (const p of r) p.reject(i);
134
+ for (const p of r) p.reject(a);
135
135
  return;
136
136
  }
137
137
  n = void 0;
@@ -139,152 +139,163 @@ function te(t) {
139
139
  const e = n == null ? void 0 : n.data;
140
140
  if (!e || typeof e != "object" || Array.isArray(e)) {
141
141
  Array.isArray(e) && (s = !1);
142
- for (const i of r) d(i);
142
+ for (const a of r) d(a);
143
143
  return;
144
144
  }
145
145
  const l = e, f = new Set(Array.isArray(n == null ? void 0 : n.missing) ? n.missing : []);
146
- for (const i of r)
147
- Object.hasOwn(l, i.name) ? i.resolve({ data: T(l[i.name]) }) : f.has(i.name) ? i.reject(ee()) : d(i);
148
- }, a = () => {
149
- u = void 0;
146
+ for (const a of r)
147
+ Object.hasOwn(l, a.name) ? a.resolve({ data: T(l[a.name]) }) : f.has(a.name) ? a.reject(te()) : d(a);
148
+ }, c = () => {
149
+ i = void 0;
150
150
  const r = o;
151
151
  o = [];
152
- const c = [], n = /* @__PURE__ */ new Map();
152
+ const u = [], n = /* @__PURE__ */ new Map();
153
153
  for (const e of r) {
154
154
  let l = n.get(e.name);
155
155
  if (!l) {
156
- const f = c[c.length - 1], i = f ? new Set(f.map((h) => h.name)).size : b;
157
- l = f && i < b ? f : [], l !== f && c.push(l), n.set(e.name, l);
156
+ const f = u[u.length - 1], a = f ? new Set(f.map((h) => h.name)).size : R;
157
+ l = f && a < R ? f : [], l !== f && u.push(l), n.set(e.name, l);
158
158
  }
159
159
  l.push(e);
160
160
  }
161
- for (const e of c) m(e);
161
+ for (const e of u) m(e);
162
162
  };
163
- return (r, c) => new Promise((n, e) => {
163
+ return (r, u) => new Promise((n, e) => {
164
164
  o.push({
165
- name: c,
165
+ name: u,
166
166
  command: r,
167
167
  resolve: n,
168
168
  reject: e
169
- }), u === void 0 && (u = setTimeout(a, Q));
169
+ }), i === void 0 && (i = setTimeout(c, V));
170
170
  });
171
171
  }
172
- const R = 3e3, ne = /^\/(collections\/[A-Za-z_][A-Za-z0-9_-]*|field-config\/[A-Za-z_][A-Za-z0-9_-]*|collection-layouts(\/active|\/summary\/[A-Za-z_][A-Za-z0-9_-]*)?|chat\/room-types|users\/me)$/, se = /^\/(record-views|item-locks|drafts|presence|rum|comments|notifications|tasks|field-rules\/evaluate|chat\/(?!room-types)|field-config\/[^/]+\/(evaluate-visibility|evaluate-defaults|evaluate-lock|cascade|project)$|items\/(?!nivaro_|directus_)[^/]+|users\/cards$|files\/verify$)/;
173
- function oe(t) {
172
+ const k = 3e3, se = /^\/(collections\/[A-Za-z_][A-Za-z0-9_-]*|field-config\/[A-Za-z_][A-Za-z0-9_-]*|collection-layouts(\/active|\/summary\/[A-Za-z_][A-Za-z0-9_-]*)?|chat\/room-types|users\/me)$/, oe = /^\/(record-views|item-locks|drafts|presence|rum|comments|notifications|tasks|field-rules\/evaluate|chat\/(?!room-types)|field-config\/[^/]+\/(evaluate-visibility|evaluate-defaults|evaluate-lock|cascade|project)$|items\/(?!nivaro_|directus_)[^/]+|users\/cards$|files\/verify$)/;
173
+ function re(t) {
174
174
  const s = (t._path ?? "").split("?")[0];
175
- return (t._method ?? "GET").toUpperCase() === "POST" && I.test(s) ? !0 : se.test(s);
175
+ return (t._method ?? "GET").toUpperCase() === "POST" && q.test(s) ? !0 : oe.test(s);
176
176
  }
177
- function re(t) {
177
+ function ae(t) {
178
178
  const s = t;
179
- if (!A(s) || !ne.test(s._path ?? "")) return !1;
179
+ if (!w(s) || !se.test(s._path ?? "")) return !1;
180
180
  const o = s._params;
181
181
  return !(o && o.item != null && /^\/collection-layouts\/active$/.test(s._path ?? ""));
182
182
  }
183
183
  let y = 0;
184
- function k() {
184
+ function D() {
185
185
  y++;
186
186
  }
187
+ let A = 0;
188
+ const ie = 50, ce = /^\/items\//;
189
+ function ue(t, s, o, i) {
190
+ if (s.epoch !== i) return !1;
191
+ const d = t._path ?? "";
192
+ return !ce.test(d) || o - s.at < ie;
193
+ }
187
194
  function G(t, s) {
188
195
  return t.then(
189
- (o) => (s && Z(), o),
196
+ (o) => (s && H(), o),
190
197
  (o) => {
191
198
  throw U(o, s) && x(s), o;
192
199
  }
193
200
  );
194
201
  }
195
- function le(t, s = {}) {
196
- if (B(t)) return t;
197
- const o = /* @__PURE__ */ new Map(), u = s.batchReads ? J(t) : null, d = s.batchCollections === !1 ? null : te(t), m = /* @__PURE__ */ new Map();
198
- let a = y;
202
+ function me(t, s = {}) {
203
+ if (F(t)) return t;
204
+ const o = /* @__PURE__ */ new Map(), i = s.batchReads ? Q(t) : null, d = s.batchCollections === !1 ? null : ne(t), m = /* @__PURE__ */ new Map();
205
+ let c = y;
199
206
  const r = (n, e, l) => {
200
207
  if (e !== y) return;
201
- a !== y && (m.clear(), a = y);
208
+ c !== y && (m.clear(), c = y);
202
209
  const f = Date.now();
203
- for (const [i, h] of m) f - h.at >= R && m.delete(i);
210
+ for (const [a, h] of m) f - h.at >= k && m.delete(a);
204
211
  m.set(n, { at: f, epoch: e, value: l });
205
- }, c = (n) => {
212
+ }, u = (n) => {
206
213
  const e = n;
207
- if (!A(e)) {
208
- C(e._method, e._path, e._body);
209
- const _ = !oe(e);
210
- _ && k();
211
- const w = G(t.request(n), !1);
212
- return (_ ? w.finally(k) : w).then((S) => (C(e._method, e._path, e._body, S), S));
214
+ if (!w(e)) {
215
+ O(e._method, e._path, e._body);
216
+ const _ = !re(e);
217
+ _ && D(), A++;
218
+ const S = G(t.request(n), !1).finally(() => {
219
+ A++;
220
+ });
221
+ return (_ ? S.finally(D) : S).then((C) => (O(e._method, e._path, e._body, C), C));
213
222
  }
214
- const l = P(e), f = re(e);
223
+ const l = P(e), f = ae(e);
215
224
  if (f) {
216
225
  const _ = m.get(l);
217
- if (_ && _.epoch === y && Date.now() - _.at < R)
226
+ if (_ && _.epoch === y && Date.now() - _.at < k)
218
227
  return Promise.resolve(T(_.value));
219
228
  }
220
- const i = o.get(l);
221
- if (i) return i.then(T);
222
- const h = D(e._method, e._path, e._params);
223
- if (h && !M()) return Promise.reject($());
224
- const p = u ? Y(e) : null, E = !p && d ? X(e) : null, L = G(
225
- p && u ? u(n, p) : E && d ? d(n, E) : t.request(n),
229
+ const a = o.get(l);
230
+ if (a && ue(e, a, Date.now(), A))
231
+ return a.p.then(T);
232
+ const h = M(e._method, e._path, e._params);
233
+ if (h && !$()) return Promise.reject(Z());
234
+ const p = i ? Y(e) : null, E = !p && d ? ee(e) : null, j = G(
235
+ p && i ? i(n, p) : E && d ? d(n, E) : t.request(n),
226
236
  h
227
- ), N = y, g = L.then((_) => (f && r(l, N, T(_)), _)).finally(() => {
228
- o.get(l) === g && o.delete(l);
237
+ ), L = y, g = j.then((_) => (f && r(l, L, T(_)), _)).finally(() => {
238
+ var _;
239
+ ((_ = o.get(l)) == null ? void 0 : _.p) === g && o.delete(l);
229
240
  });
230
- return o.set(l, g), g;
241
+ return o.set(l, { p: g, at: Date.now(), epoch: A }), g;
231
242
  };
232
243
  return new Proxy(t, {
233
244
  get(n, e, l) {
234
- if (e === "request") return c;
235
- if (e === j) return !0;
245
+ if (e === "request") return u;
246
+ if (e === N) return !0;
236
247
  if (e === "setToken" && typeof n.setToken == "function")
237
- return (i) => {
238
- n.setToken(i), z();
248
+ return (a) => {
249
+ n.setToken(a), z();
239
250
  };
240
251
  const f = Reflect.get(n, e, l);
241
252
  return typeof f == "function" ? f.bind(n) : f;
242
253
  }
243
254
  });
244
255
  }
245
- const ie = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
246
- function ae() {
256
+ const le = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
257
+ function fe() {
247
258
  for (const t of [...v]) t();
248
259
  }
249
- function fe(t) {
260
+ function _e(t) {
250
261
  return t.subscribe((s) => {
251
- s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && ae();
262
+ s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && fe();
252
263
  });
253
264
  }
254
- function de(t, s = {}) {
255
- let o = s.open ?? !0, u;
265
+ function pe(t, s = {}) {
266
+ let o = s.open ?? !0, i;
256
267
  const d = /* @__PURE__ */ new Map(), m = () => {
257
268
  const n = [...d.values()];
258
269
  d.clear();
259
270
  for (const e of n) e.release();
260
- }, a = () => {
261
- v.delete(a), m();
271
+ }, c = () => {
272
+ v.delete(c), m();
262
273
  }, r = (n) => {
263
274
  const e = n;
264
- if (o || !H(e) || ie.test(e._path ?? "")) return t.request(n);
275
+ if (o || !B(e) || le.test(e._path ?? "")) return t.request(n);
265
276
  const l = P(e), f = d.get(l);
266
277
  if (f) return f.promise.then(T);
267
- let i = () => {
278
+ let a = () => {
268
279
  };
269
280
  const p = new Promise((E) => {
270
- i = E;
281
+ a = E;
271
282
  }).then(() => t.request(n));
272
- return d.set(l, { promise: p, release: i }), v.add(a), p;
283
+ return d.set(l, { promise: p, release: a }), v.add(c), p;
273
284
  };
274
285
  return new Proxy(t, {
275
286
  get(n, e, l) {
276
287
  if (e === "request") return r;
277
288
  if (e === "open") return o;
278
289
  if (e === "setOpen")
279
- return (i) => {
280
- u !== void 0 && (clearTimeout(u), u = void 0);
290
+ return (a) => {
291
+ i !== void 0 && (clearTimeout(i), i = void 0);
281
292
  const h = o;
282
- o = i, i && !h && (v.delete(a), m());
293
+ o = a, a && !h && (v.delete(c), m());
283
294
  };
284
295
  if (e === "dispose")
285
296
  return () => {
286
- u === void 0 && (u = setTimeout(() => {
287
- u = void 0, o = !0, v.delete(a), m();
297
+ i === void 0 && (i = setTimeout(() => {
298
+ i = void 0, o = !0, v.delete(c), m();
288
299
  }, 0));
289
300
  };
290
301
  const f = Reflect.get(n, e, l);
@@ -293,17 +304,19 @@ function de(t, s = {}) {
293
304
  });
294
305
  }
295
306
  export {
296
- O as BATCH_READ_LIMIT,
297
- b as COLLECTION_BATCH_LIMIT,
298
- Q as COLLECTION_BATCH_WINDOW_MS,
299
- R as SETTLED_READ_MS,
300
- X as batchableCollectionMeta,
307
+ b as BATCH_READ_LIMIT,
308
+ R as COLLECTION_BATCH_LIMIT,
309
+ V as COLLECTION_BATCH_WINDOW_MS,
310
+ ie as RECORD_JOIN_MS,
311
+ k as SETTLED_READ_MS,
312
+ ee as batchableCollectionMeta,
301
313
  Y as batchableRead,
302
- de as createGatedClient,
303
- k as forgetSettledReads,
304
- B as isCoalesced,
305
- re as isSettledRead,
306
- ae as releaseGatedReads,
307
- fe as releaseGatedReadsOnSharedFetch,
308
- le as withGetCoalescing
314
+ pe as createGatedClient,
315
+ D as forgetSettledReads,
316
+ F as isCoalesced,
317
+ ae as isSettledRead,
318
+ ue as mayJoinInflight,
319
+ fe as releaseGatedReads,
320
+ _e as releaseGatedReadsOnSharedFetch,
321
+ me as withGetCoalescing
309
322
  };
@@ -3,31 +3,36 @@ const f = { key: "brand", label: "Brand", color: null }, l = [
3
3
  { key: "emerald", label: "Emerald", color: "#059669" },
4
4
  { key: "rose", label: "Rose", color: "#e11d48" }
5
5
  ], s = /^[a-z0-9][a-z0-9_-]{0,39}$/, a = /^#[0-9a-fA-F]{6}$/;
6
- function u(o) {
7
- if (o == null || o === "") return l;
8
- let n = o;
9
- if (typeof o == "string")
6
+ function u(e) {
7
+ if (e == null || e === "") return l;
8
+ let t = e;
9
+ if (typeof e == "string")
10
10
  try {
11
- n = JSON.parse(o);
11
+ t = JSON.parse(e);
12
12
  } catch {
13
13
  return l;
14
14
  }
15
- if (!Array.isArray(n)) return l;
16
- const r = [];
17
- for (const t of n) {
18
- if (!t || typeof t != "object") continue;
19
- const e = String(t.key ?? "").trim(), c = String(t.color ?? "").trim();
20
- if (!(!s.test(e) || e === "brand" || !a.test(c)) && !r.some((i) => i.key === e) && (r.push({
21
- key: e,
22
- label: String(t.label ?? e).slice(0, 40) || e,
15
+ if (!Array.isArray(t)) return l;
16
+ const o = [];
17
+ for (const n of t) {
18
+ if (!n || typeof n != "object") continue;
19
+ const r = String(n.key ?? "").trim(), c = String(n.color ?? "").trim();
20
+ if (!(!s.test(r) || r === "brand" || !a.test(c)) && !o.some((i) => i.key === r) && (o.push({
21
+ key: r,
22
+ label: String(n.label ?? r).slice(0, 40) || r,
23
23
  color: c.toLowerCase()
24
- }), r.length >= 6))
24
+ }), o.length >= 6))
25
25
  break;
26
26
  }
27
- return r;
27
+ return o;
28
+ }
29
+ function y(e, t = l) {
30
+ var o;
31
+ return typeof e != "string" || !e || e === "brand" ? null : ((o = t.find((n) => n.key === e)) == null ? void 0 : o.color) ?? null;
28
32
  }
29
33
  export {
30
34
  f as BRAND_ACCENT,
31
35
  l as DEFAULT_THEME_ACCENTS,
32
- u as parseThemeAccents
36
+ u as parseThemeAccents,
37
+ y as resolveAccentColor
33
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",