@livestore/devtools-vite 0.3.0-dev.15 → 0.3.0-dev.17

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 { g as N } from "./devtools-react-bundle-BZklamRx.js";
1
+ import { g as N } from "./devtools-react-bundle-DsmLLpl2.js";
2
2
  function R(g, E) {
3
3
  for (var Q = 0; Q < E.length; Q++) {
4
4
  const A = E[Q];
@@ -1,4 +1,4 @@
1
- import { d as a } from "./devtools-react-bundle-BZklamRx.js";
1
+ import { d as a } from "./devtools-react-bundle-DsmLLpl2.js";
2
2
  export {
3
3
  a as run
4
4
  };
@@ -1,4 +1,4 @@
1
- import { s as Te, R as X, r as T } from "./devtools-react-bundle-BZklamRx.js";
1
+ import { s as Te, R as X, r as T } from "./devtools-react-bundle-DsmLLpl2.js";
2
2
  const Be = /* @__PURE__ */ Te("div")({
3
3
  name: "NumberOverlayEditorStyle",
4
4
  class: "gdg-n15fjm3e",
@@ -67,7 +67,7 @@ function Me(e) {
67
67
  });
68
68
  return r.current;
69
69
  }
70
- function ce(e, t) {
70
+ function se(e, t) {
71
71
  t === void 0 && (t = !0);
72
72
  var r = e[0] === "-", n = r && t;
73
73
  e = e.replace("-", "");
@@ -92,7 +92,7 @@ function ye(e, t, r) {
92
92
  n += e[i] || a;
93
93
  return n;
94
94
  }
95
- function ve(e, t) {
95
+ function de(e, t) {
96
96
  return Array(t + 1).join(e);
97
97
  }
98
98
  function be(e) {
@@ -103,17 +103,17 @@ function be(e) {
103
103
  return r + a;
104
104
  a = a.replace(".", "");
105
105
  var f = 1 + i, m = a.length;
106
- return f < 0 ? a = "0." + ve("0", Math.abs(f)) + a : f >= m ? a = a + ve("0", f - m) : a = (a.substring(0, f) || "0") + "." + a.substring(f), r + a;
106
+ return f < 0 ? a = "0." + de("0", Math.abs(f)) + a : f >= m ? a = a + de("0", f - m) : a = (a.substring(0, f) || "0") + "." + a.substring(f), r + a;
107
107
  }
108
108
  function ge(e, t, r) {
109
109
  if (["", "-"].indexOf(e) !== -1)
110
110
  return e;
111
- var n = (e.indexOf(".") !== -1 || r) && t, a = ce(e), i = a.beforeDecimal, f = a.afterDecimal, m = a.hasNegation, S = parseFloat("0." + (f || "0")), p = f.length <= t ? "0." + f : S.toFixed(t), h = p.split("."), d = i;
112
- i && Number(h[0]) && (d = i.split("").reverse().reduce(function(I, C, g) {
111
+ var n = (e.indexOf(".") !== -1 || r) && t, a = se(e), i = a.beforeDecimal, f = a.afterDecimal, m = a.hasNegation, S = parseFloat("0." + (f || "0")), p = f.length <= t ? "0." + f : S.toFixed(t), h = p.split("."), c = i;
112
+ i && Number(h[0]) && (c = i.split("").reverse().reduce(function(I, C, g) {
113
113
  return I.length > g ? (Number(I[0]) + Number(C)).toString() + I.substring(1, I.length) : C + I;
114
114
  }, h[0]));
115
- var x = ye(h[1] || "", t, r), y = m ? "-" : "", c = n ? "." : "";
116
- return "" + y + d + c + x;
115
+ var x = ye(h[1] || "", t, r), y = m ? "-" : "", s = n ? "." : "";
116
+ return "" + y + c + s + x;
117
117
  }
118
118
  function H(e, t) {
119
119
  if (e.value = e.value, e !== null) {
@@ -143,7 +143,7 @@ var Ve = Fe(function(e, t) {
143
143
  function Ke(e, t, r) {
144
144
  return Math.min(Math.max(e, t), r);
145
145
  }
146
- function de(e) {
146
+ function ce(e) {
147
147
  return Math.max(e.selectionStart, e.selectionEnd);
148
148
  }
149
149
  function We() {
@@ -172,18 +172,18 @@ function Ge(e, t, r, n, a, i, f) {
172
172
  return k;
173
173
  }), S = e.slice(0, m);
174
174
  !t && !r.startsWith(S) && (t = S, r = S + r, n = n + S.length);
175
- for (var p = r.length, h = e.length, d = {}, x = new Array(p), y = 0; y < p; y++) {
175
+ for (var p = r.length, h = e.length, c = {}, x = new Array(p), y = 0; y < p; y++) {
176
176
  x[y] = -1;
177
- for (var c = 0, I = h; c < I; c++) {
177
+ for (var s = 0, I = h; s < I; s++) {
178
178
  var C = f({
179
179
  currentValue: r,
180
180
  lastValue: t,
181
181
  formattedValue: e,
182
182
  currentValueIndex: y,
183
- formattedValueIndex: c
183
+ formattedValueIndex: s
184
184
  });
185
- if (C && d[c] !== !0) {
186
- x[y] = c, d[c] = !0;
185
+ if (C && c[s] !== !0) {
186
+ x[y] = s, c[s] = !0;
187
187
  break;
188
188
  }
189
189
  }
@@ -218,19 +218,19 @@ function Ze(e) {
218
218
  }
219
219
  function Ne(e, t, r, n, a, i) {
220
220
  i === void 0 && (i = q);
221
- var f = Me(function(c, I) {
221
+ var f = Me(function(s, I) {
222
222
  var C, g;
223
- return pe(c) ? (g = "", C = "") : typeof c == "number" || I ? (g = typeof c == "number" ? be(c) : c, C = n(g)) : (g = a(c, void 0), C = n(g)), { formattedValue: C, numAsString: g };
223
+ return pe(s) ? (g = "", C = "") : typeof s == "number" || I ? (g = typeof s == "number" ? be(s) : s, C = n(g)) : (g = a(s, void 0), C = n(g)), { formattedValue: C, numAsString: g };
224
224
  }), m = T.useState(function() {
225
225
  return f(Y(e) ? t : e, r);
226
- }), S = m[0], p = m[1], h = function(c, I) {
227
- c.formattedValue !== S.formattedValue && p({
228
- formattedValue: c.formattedValue,
229
- numAsString: c.value
230
- }), i(c, I);
231
- }, d = e, x = r;
232
- Y(e) && (d = S.numAsString, x = !0);
233
- var y = f(d, x);
226
+ }), S = m[0], p = m[1], h = function(s, I) {
227
+ s.formattedValue !== S.formattedValue && p({
228
+ formattedValue: s.formattedValue,
229
+ numAsString: s.value
230
+ }), i(s, I);
231
+ }, c = e, x = r;
232
+ Y(e) && (c = S.numAsString, x = !0);
233
+ var y = f(c, x);
234
234
  return T.useMemo(function() {
235
235
  p(y);
236
236
  }, [y.formattedValue]), [S, h];
@@ -250,12 +250,12 @@ function He(e) {
250
250
  f === void 0 && (f = ze);
251
251
  var m = e.removeFormatting;
252
252
  m === void 0 && (m = qe);
253
- var S = e.defaultValue, p = e.valueIsNumericString, h = e.onValueChange, d = e.isAllowed, x = e.onChange;
253
+ var S = e.defaultValue, p = e.valueIsNumericString, h = e.onValueChange, c = e.isAllowed, x = e.onChange;
254
254
  x === void 0 && (x = q);
255
255
  var y = e.onKeyDown;
256
256
  y === void 0 && (y = q);
257
- var c = e.onMouseUp;
258
- c === void 0 && (c = q);
257
+ var s = e.onMouseUp;
258
+ s === void 0 && (s = q);
259
259
  var I = e.onFocus;
260
260
  I === void 0 && (I = q);
261
261
  var C = e.onBlur;
@@ -264,120 +264,120 @@ function He(e) {
264
264
  B === void 0 && (B = Ze);
265
265
  var F = e.isValidInputCharacter;
266
266
  F === void 0 && (F = ae);
267
- var k = e.isCharacterSame, j = Se(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), z = Ne(g, S, !!p, f, m, h), P = z[0], V = P.formattedValue, L = P.numAsString, W = z[1], M = T.useRef(), U = T.useRef({ formattedValue: V, numAsString: L }), $ = function(u, o) {
268
- U.current = { formattedValue: u.formattedValue, numAsString: u.value }, W(u, o);
269
- }, J = T.useState(!1), ee = J[0], v = J[1], l = T.useRef(null), N = T.useRef({
267
+ var k = e.isCharacterSame, j = Se(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), z = Ne(g, S, !!p, f, m, h), P = z[0], V = P.formattedValue, L = P.numAsString, W = z[1], M = T.useRef(), U = T.useRef({ formattedValue: V, numAsString: L }), $ = function(o, u) {
268
+ U.current = { formattedValue: o.formattedValue, numAsString: o.value }, W(o, u);
269
+ }, J = T.useState(!1), ee = J[0], d = J[1], l = T.useRef(null), N = T.useRef({
270
270
  setCaretTimeout: null,
271
271
  focusTimeout: null
272
272
  });
273
273
  T.useEffect(function() {
274
- return v(!0), function() {
274
+ return d(!0), function() {
275
275
  clearTimeout(N.current.setCaretTimeout), clearTimeout(N.current.focusTimeout);
276
276
  };
277
277
  }, []);
278
- var R = f, A = function(u, o) {
279
- var s = parseFloat(o);
278
+ var R = f, A = function(o, u) {
279
+ var v = parseFloat(u);
280
280
  return {
281
- formattedValue: u,
282
- value: o,
283
- floatValue: isNaN(s) ? void 0 : s
281
+ formattedValue: o,
282
+ value: u,
283
+ floatValue: isNaN(v) ? void 0 : v
284
284
  };
285
- }, E = function(u, o, s) {
286
- u.selectionStart === 0 && u.selectionEnd === u.value.length || (H(u, o), N.current.setCaretTimeout = setTimeout(function() {
287
- u.value === s && u.selectionStart !== o && H(u, o);
285
+ }, E = function(o, u, v) {
286
+ o.selectionStart === 0 && o.selectionEnd === o.value.length || (H(o, u), N.current.setCaretTimeout = setTimeout(function() {
287
+ o.value === v && o.selectionStart !== u && H(o, u);
288
288
  }, 0));
289
- }, O = function(u, o, s) {
290
- return me(u, o, B(u), s);
291
- }, Q = function(u, o, s) {
292
- var w = B(o), _ = Ge(o, V, u, s, w, F, k);
293
- return _ = me(o, _, w), _;
294
- }, ue = function(u) {
295
- var o = u.formattedValue;
296
- o === void 0 && (o = "");
297
- var s = u.input, w = u.source, _ = u.event, D = u.numAsString, b;
298
- if (s) {
299
- var K = u.inputValue || s.value, G = de(s);
300
- s.value = o, b = Q(K, o, G), b !== void 0 && E(s, b, o);
289
+ }, O = function(o, u, v) {
290
+ return me(o, u, B(o), v);
291
+ }, Q = function(o, u, v) {
292
+ var w = B(u), _ = Ge(u, V, o, v, w, F, k);
293
+ return _ = me(u, _, w), _;
294
+ }, oe = function(o) {
295
+ var u = o.formattedValue;
296
+ u === void 0 && (u = "");
297
+ var v = o.input, w = o.source, _ = o.event, D = o.numAsString, b;
298
+ if (v) {
299
+ var K = o.inputValue || v.value, G = ce(v);
300
+ v.value = u, b = Q(K, u, G), b !== void 0 && E(v, b, u);
301
301
  }
302
- o !== V && $(A(o, D), { event: _, source: w });
302
+ u !== V && $(A(u, D), { event: _, source: w });
303
303
  };
304
304
  T.useEffect(function() {
305
- var u = U.current, o = u.formattedValue, s = u.numAsString;
306
- (V !== o || L !== s) && $(A(V, L), {
305
+ var o = U.current, u = o.formattedValue, v = o.numAsString;
306
+ (V !== u || L !== v) && $(A(V, L), {
307
307
  event: void 0,
308
308
  source: re.props
309
309
  });
310
310
  }, [V, L]);
311
- var te = l.current ? de(l.current) : void 0, ne = typeof window < "u" ? T.useLayoutEffect : T.useEffect;
311
+ var te = l.current ? ce(l.current) : void 0, ne = typeof window < "u" ? T.useLayoutEffect : T.useEffect;
312
312
  ne(function() {
313
- var u = l.current;
314
- if (V !== U.current.formattedValue && u) {
315
- var o = Q(U.current.formattedValue, V, te);
316
- u.value = V, E(u, o, V);
313
+ var o = l.current;
314
+ if (V !== U.current.formattedValue && o) {
315
+ var u = Q(U.current.formattedValue, V, te);
316
+ o.value = V, E(o, u, V);
317
317
  }
318
318
  }, [V]);
319
- var oe = function(u, o, s) {
320
- var w = o.target, _ = M.current ? Pe(M.current, w.selectionEnd) : Ve(V, u), D = Object.assign(Object.assign({}, _), { lastValue: V }), b = m(u, D), K = R(b);
321
- if (b = m(K, void 0), d && !d(A(K, b))) {
322
- var G = o.target, Z = de(G), le = Q(u, V, Z);
319
+ var ue = function(o, u, v) {
320
+ var w = u.target, _ = M.current ? Pe(M.current, w.selectionEnd) : Ve(V, o), D = Object.assign(Object.assign({}, _), { lastValue: V }), b = m(o, D), K = R(b);
321
+ if (b = m(K, void 0), c && !c(A(K, b))) {
322
+ var G = u.target, Z = ce(G), le = Q(o, V, Z);
323
323
  return G.value = V, E(G, le, V), !1;
324
324
  }
325
- return ue({
325
+ return oe({
326
326
  formattedValue: K,
327
327
  numAsString: b,
328
- inputValue: u,
329
- event: o,
330
- source: s,
331
- input: o.target
328
+ inputValue: o,
329
+ event: u,
330
+ source: v,
331
+ input: u.target
332
332
  }), !0;
333
- }, fe = function(u, o) {
334
- o === void 0 && (o = 0);
335
- var s = u.selectionStart, w = u.selectionEnd;
336
- M.current = { selectionStart: s, selectionEnd: w + o };
337
- }, De = function(u) {
338
- var o = u.target, s = o.value, w = oe(s, u, re.event);
339
- w && x(u), M.current = void 0;
340
- }, Ie = function(u) {
341
- var o = u.target, s = u.key, w = o.selectionStart, _ = o.selectionEnd, D = o.value;
333
+ }, fe = function(o, u) {
334
+ u === void 0 && (u = 0);
335
+ var v = o.selectionStart, w = o.selectionEnd;
336
+ M.current = { selectionStart: v, selectionEnd: w + u };
337
+ }, De = function(o) {
338
+ var u = o.target, v = u.value, w = ue(v, o, re.event);
339
+ w && x(o), M.current = void 0;
340
+ }, Ie = function(o) {
341
+ var u = o.target, v = o.key, w = u.selectionStart, _ = u.selectionEnd, D = u.value;
342
342
  D === void 0 && (D = "");
343
343
  var b;
344
- s === "ArrowLeft" || s === "Backspace" ? b = Math.max(w - 1, 0) : s === "ArrowRight" ? b = Math.min(w + 1, D.length) : s === "Delete" && (b = w);
344
+ v === "ArrowLeft" || v === "Backspace" ? b = Math.max(w - 1, 0) : v === "ArrowRight" ? b = Math.min(w + 1, D.length) : v === "Delete" && (b = w);
345
345
  var K = 0;
346
- s === "Delete" && w === _ && (K = 1);
347
- var G = s === "ArrowLeft" || s === "ArrowRight";
346
+ v === "Delete" && w === _ && (K = 1);
347
+ var G = v === "ArrowLeft" || v === "ArrowRight";
348
348
  if (b === void 0 || w !== _ && !G) {
349
- y(u), fe(o, K);
349
+ y(o), fe(u, K);
350
350
  return;
351
351
  }
352
352
  var Z = b;
353
353
  if (G) {
354
- var le = s === "ArrowLeft" ? "left" : "right";
355
- Z = O(D, b, le), Z !== b && u.preventDefault();
356
- } else s === "Delete" && !F(D[b]) ? Z = O(D, b, "right") : s === "Backspace" && !F(D[b]) && (Z = O(D, b, "left"));
357
- Z !== b && E(o, Z, D), y(u), fe(o, K);
358
- }, Ce = function(u) {
359
- var o = u.target, s = function() {
360
- var w = o.selectionStart, _ = o.selectionEnd, D = o.value;
354
+ var le = v === "ArrowLeft" ? "left" : "right";
355
+ Z = O(D, b, le), Z !== b && o.preventDefault();
356
+ } else v === "Delete" && !F(D[b]) ? Z = O(D, b, "right") : v === "Backspace" && !F(D[b]) && (Z = O(D, b, "left"));
357
+ Z !== b && E(u, Z, D), y(o), fe(u, K);
358
+ }, Ce = function(o) {
359
+ var u = o.target, v = function() {
360
+ var w = u.selectionStart, _ = u.selectionEnd, D = u.value;
361
361
  if (D === void 0 && (D = ""), w === _) {
362
362
  var b = O(D, w);
363
- b !== w && E(o, b, D);
363
+ b !== w && E(u, b, D);
364
364
  }
365
365
  };
366
- s(), requestAnimationFrame(function() {
367
- s();
368
- }), c(u), fe(o);
369
- }, Ee = function(u) {
370
- u.persist && u.persist();
371
- var o = u.target, s = u.currentTarget;
372
- l.current = o, N.current.focusTimeout = setTimeout(function() {
373
- var w = o.selectionStart, _ = o.selectionEnd, D = o.value;
366
+ v(), requestAnimationFrame(function() {
367
+ v();
368
+ }), s(o), fe(u);
369
+ }, Ee = function(o) {
370
+ o.persist && o.persist();
371
+ var u = o.target, v = o.currentTarget;
372
+ l.current = u, N.current.focusTimeout = setTimeout(function() {
373
+ var w = u.selectionStart, _ = u.selectionEnd, D = u.value;
374
374
  D === void 0 && (D = "");
375
375
  var b = O(D, w);
376
- b !== w && !(w === 0 && _ === D.length) && E(o, b, D), I(Object.assign(Object.assign({}, u), { currentTarget: s }));
376
+ b !== w && !(w === 0 && _ === D.length) && E(u, b, D), I(Object.assign(Object.assign({}, o), { currentTarget: v }));
377
377
  }, 0);
378
- }, Re = function(u) {
379
- l.current = null, clearTimeout(N.current.focusTimeout), clearTimeout(N.current.setCaretTimeout), C(u);
380
- }, Ae = ee && We() ? "numeric" : void 0, se = Object.assign({ inputMode: Ae }, j, {
378
+ }, Re = function(o) {
379
+ l.current = null, clearTimeout(N.current.focusTimeout), clearTimeout(N.current.setCaretTimeout), C(o);
380
+ }, Ae = ee && We() ? "numeric" : void 0, ve = Object.assign({ inputMode: Ae }, j, {
381
381
  type: t,
382
382
  value: V,
383
383
  onChange: De,
@@ -390,9 +390,9 @@ function He(e) {
390
390
  return a ? X.createElement(X.Fragment, null, a(V, j) || null) : X.createElement("span", Object.assign({}, j, { ref: i }), V);
391
391
  if (n) {
392
392
  var Oe = n;
393
- return X.createElement(Oe, Object.assign({}, se, { ref: i }));
393
+ return X.createElement(Oe, Object.assign({}, ve, { ref: i }));
394
394
  }
395
- return X.createElement("input", Object.assign({}, se, { ref: i }));
395
+ return X.createElement("input", Object.assign({}, ve, { ref: i }));
396
396
  }
397
397
  function he(e, t) {
398
398
  var r = t.decimalScale, n = t.fixedDecimalScale, a = t.prefix;
@@ -402,8 +402,8 @@ function he(e, t) {
402
402
  var f = t.allowNegative, m = t.thousandsGroupStyle;
403
403
  if (m === void 0 && (m = "thousand"), e === "" || e === "-")
404
404
  return e;
405
- var S = ie(t), p = S.thousandSeparator, h = S.decimalSeparator, d = r !== 0 && e.indexOf(".") !== -1 || r && n, x = ce(e, f), y = x.beforeDecimal, c = x.afterDecimal, I = x.addNegation;
406
- return r !== void 0 && (c = ye(c, r, !!n)), p && (y = Le(y, p, m)), a && (y = a + y), i && (c = c + i), I && (y = "-" + y), e = y + (d && h || "") + c, e;
405
+ var S = ie(t), p = S.thousandSeparator, h = S.decimalSeparator, c = r !== 0 && e.indexOf(".") !== -1 || r && n, x = se(e, f), y = x.beforeDecimal, s = x.afterDecimal, I = x.addNegation;
406
+ return r !== void 0 && (s = ye(s, r, !!n)), p && (y = Le(y, p, m)), a && (y = a + y), i && (s = s + i), I && (y = "-" + y), e = y + (c && h || "") + s, e;
407
407
  }
408
408
  function ie(e) {
409
409
  var t = e.decimalSeparator;
@@ -433,11 +433,11 @@ function Ye(e, t, r) {
433
433
  i === void 0 && (i = "");
434
434
  var f = r.suffix;
435
435
  f === void 0 && (f = "");
436
- var m = r.decimalScale, S = t.from, p = t.to, h = p.start, d = p.end, x = ie(r), y = x.allowedDecimalSeparators, c = x.decimalSeparator, I = e[d] === c;
436
+ var m = r.decimalScale, S = t.from, p = t.to, h = p.start, c = p.end, x = ie(r), y = x.allowedDecimalSeparators, s = x.decimalSeparator, I = e[c] === s;
437
437
  if (ae(e) && (e === i || e === f) && t.lastValue === "")
438
438
  return e;
439
- if (d - h === 1 && y.indexOf(e[h]) !== -1) {
440
- var C = m === 0 ? "" : c;
439
+ if (c - h === 1 && y.indexOf(e[h]) !== -1) {
440
+ var C = m === 0 ? "" : s;
441
441
  e = e.substring(0, h) + C + e.substring(h + 1, e.length);
442
442
  }
443
443
  var g = function(l, N, R) {
@@ -445,20 +445,20 @@ function Ye(e, t, r) {
445
445
  i.startsWith("-") ? A = !1 : l.startsWith("--") ? (A = !1, E = !0) : f.startsWith("-") && l.length === f.length ? A = !1 : l[0] === "-" && (A = !0);
446
446
  var O = A ? 1 : 0;
447
447
  return E && (O = 2), O && (l = l.substring(O), N -= O, R -= O), { value: l, start: N, end: R, hasNegation: A };
448
- }, B = g(e, h, d), F = B.hasNegation;
449
- n = B, e = n.value, h = n.start, d = n.end;
450
- var k = g(t.lastValue, S.start, S.end), j = k.start, z = k.end, P = k.value, V = e.substring(h, d);
448
+ }, B = g(e, h, c), F = B.hasNegation;
449
+ n = B, e = n.value, h = n.start, c = n.end;
450
+ var k = g(t.lastValue, S.start, S.end), j = k.start, z = k.end, P = k.value, V = e.substring(h, c);
451
451
  e.length && P.length && (j > P.length - f.length || z < i.length) && !(V && f.startsWith(V)) && (e = P);
452
452
  var L = 0;
453
- e.startsWith(i) ? L += i.length : h < i.length && (L = h), e = e.substring(L), d -= L;
453
+ e.startsWith(i) ? L += i.length : h < i.length && (L = h), e = e.substring(L), c -= L;
454
454
  var W = e.length, M = e.length - f.length;
455
- e.endsWith(f) ? W = M : (d > M || d > e.length - f.length) && (W = d), e = e.substring(0, W), e = Je(F ? "-" + e : e, a), e = (e.match(Qe(c)) || []).join("");
456
- var U = e.indexOf(c);
457
- e = e.replace(new RegExp(xe(c), "g"), function(l, N) {
455
+ e.endsWith(f) ? W = M : (c > M || c > e.length - f.length) && (W = c), e = e.substring(0, W), e = Je(F ? "-" + e : e, a), e = (e.match(Qe(s)) || []).join("");
456
+ var U = e.indexOf(s);
457
+ e = e.replace(new RegExp(xe(s), "g"), function(l, N) {
458
458
  return N === U ? "." : "";
459
459
  });
460
- var $ = ce(e, a), J = $.beforeDecimal, ee = $.afterDecimal, v = $.addNegation;
461
- return p.end - p.start < S.end - S.start && J === "" && I && !parseFloat(ee) && (e = v ? "-" : ""), e;
460
+ var $ = se(e, a), J = $.beforeDecimal, ee = $.afterDecimal, d = $.addNegation;
461
+ return p.end - p.start < S.end - S.start && J === "" && I && !parseFloat(ee) && (e = d ? "-" : ""), e;
462
462
  }
463
463
  function et(e, t) {
464
464
  var r = t.prefix;
@@ -496,28 +496,28 @@ function rt(e) {
496
496
  i === void 0 && (i = q);
497
497
  var f = e.thousandSeparator, m = e.decimalScale, S = e.fixedDecimalScale, p = e.prefix;
498
498
  p === void 0 && (p = "");
499
- var h = e.defaultValue, d = e.value, x = e.valueIsNumericString, y = e.onValueChange, c = Se(e, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), I = ie(e), C = I.decimalSeparator, g = I.allowedDecimalSeparators, B = function(v) {
500
- return he(v, e);
501
- }, F = function(v, l) {
502
- return Ye(v, l, e);
503
- }, k = Y(d) ? h : d, j = x ?? Xe(k, p, t);
504
- Y(d) ? Y(h) || (j = j || typeof h == "number") : j = j || typeof d == "number";
505
- var z = function(v) {
506
- return pe(v) ? v : (typeof v == "number" && (v = be(v)), j && typeof m == "number" ? ge(v, m, !!S) : v);
507
- }, P = Ne(z(d), z(h), !!j, B, F, y), V = P[0], L = V.numAsString, W = V.formattedValue, M = P[1], U = function(v) {
508
- var l = v.target, N = v.key, R = l.selectionStart, A = l.selectionEnd, E = l.value;
499
+ var h = e.defaultValue, c = e.value, x = e.valueIsNumericString, y = e.onValueChange, s = Se(e, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), I = ie(e), C = I.decimalSeparator, g = I.allowedDecimalSeparators, B = function(d) {
500
+ return he(d, e);
501
+ }, F = function(d, l) {
502
+ return Ye(d, l, e);
503
+ }, k = Y(c) ? h : c, j = x ?? Xe(k, p, t);
504
+ Y(c) ? Y(h) || (j = j || typeof h == "number") : j = j || typeof c == "number";
505
+ var z = function(d) {
506
+ return pe(d) ? d : (typeof d == "number" && (d = be(d)), j && typeof m == "number" ? ge(d, m, !!S) : d);
507
+ }, P = Ne(z(c), z(h), !!j, B, F, y), V = P[0], L = V.numAsString, W = V.formattedValue, M = P[1], U = function(d) {
508
+ var l = d.target, N = d.key, R = l.selectionStart, A = l.selectionEnd, E = l.value;
509
509
  if (E === void 0 && (E = ""), (N === "Backspace" || N === "Delete") && A < p.length) {
510
- v.preventDefault();
510
+ d.preventDefault();
511
511
  return;
512
512
  }
513
513
  if (R !== A) {
514
- a(v);
514
+ a(d);
515
515
  return;
516
516
  }
517
- N === "Backspace" && E[0] === "-" && R === p.length + 1 && r && H(l, 1), m && S && (N === "Backspace" && E[R - 1] === C ? (H(l, R - 1), v.preventDefault()) : N === "Delete" && E[R] === C && v.preventDefault()), g?.includes(N) && E[R] === C && H(l, R + 1);
517
+ N === "Backspace" && E[0] === "-" && R === p.length + 1 && r && H(l, 1), m && S && (N === "Backspace" && E[R - 1] === C ? (H(l, R - 1), d.preventDefault()) : N === "Delete" && E[R] === C && d.preventDefault()), g?.includes(N) && E[R] === C && H(l, R + 1);
518
518
  var O = f === !0 ? "," : f;
519
- N === "Backspace" && E[R - 1] === O && H(l, R - 1), N === "Delete" && E[R] === O && H(l, R + 1), a(v);
520
- }, $ = function(v) {
519
+ N === "Backspace" && E[R - 1] === O && H(l, R - 1), N === "Delete" && E[R] === O && H(l, R + 1), a(d);
520
+ }, $ = function(d) {
521
521
  var l = L;
522
522
  if (l.match(/\d/g) || (l = ""), n || (l = ke(l)), S && m && (l = ge(l, m, S)), l !== L) {
523
523
  var N = he(l, e);
@@ -526,20 +526,20 @@ function rt(e) {
526
526
  value: l,
527
527
  floatValue: parseFloat(l)
528
528
  }, {
529
- event: v,
529
+ event: d,
530
530
  source: re.event
531
531
  });
532
532
  }
533
- i(v);
534
- }, J = function(v) {
535
- return v === C ? !0 : ae(v);
536
- }, ee = function(v) {
537
- var l = v.currentValue, N = v.lastValue, R = v.formattedValue, A = v.currentValueIndex, E = v.formattedValueIndex, O = l[A], Q = R[E], ue = Ve(N, l), te = ue.to, ne = function(oe) {
538
- return F(oe).indexOf(".") + p.length;
533
+ i(d);
534
+ }, J = function(d) {
535
+ return d === C ? !0 : ae(d);
536
+ }, ee = function(d) {
537
+ var l = d.currentValue, N = d.lastValue, R = d.formattedValue, A = d.currentValueIndex, E = d.formattedValueIndex, O = l[A], Q = R[E], oe = Ve(N, l), te = oe.to, ne = function(ue) {
538
+ return F(ue).indexOf(".") + p.length;
539
539
  };
540
- return d === 0 && S && m && l[te.start] === C && ne(l) < A && ne(R) > E ? !1 : A >= te.start && A < te.end && g && g.includes(O) && Q === C ? !0 : O === Q;
540
+ return c === 0 && S && m && l[te.start] === C && ne(l) < A && ne(R) > E ? !1 : A >= te.start && A < te.end && g && g.includes(O) && Q === C ? !0 : O === Q;
541
541
  };
542
- return Object.assign(Object.assign({}, c), {
542
+ return Object.assign(Object.assign({}, s), {
543
543
  value: W,
544
544
  valueIsNumericString: !1,
545
545
  isValidInputCharacter: J,
@@ -547,8 +547,8 @@ function rt(e) {
547
547
  onValueChange: M,
548
548
  format: B,
549
549
  removeFormatting: F,
550
- getCaretBoundary: function(v) {
551
- return et(v, e);
550
+ getCaretBoundary: function(d) {
551
+ return et(d, e);
552
552
  },
553
553
  onKeyDown: U,
554
554
  onBlur: $
@@ -564,12 +564,12 @@ function we() {
564
564
  function nt() {
565
565
  return we() === "." ? "," : ".";
566
566
  }
567
- const ut = (e) => {
567
+ const ot = (e) => {
568
568
  const { value: t, onChange: r, disabled: n, highlight: a, validatedSelection: i, fixedDecimals: f, allowNegative: m, thousandSeparator: S, decimalSeparator: p } = e, h = T.useRef();
569
569
  return T.useLayoutEffect(() => {
570
570
  if (i !== void 0) {
571
- const d = typeof i == "number" ? [i, null] : i;
572
- h.current?.setSelectionRange(d[0], d[1]);
571
+ const c = typeof i == "number" ? [i, null] : i;
572
+ h.current?.setSelectionRange(c[0], c[1]);
573
573
  }
574
574
  }, [i]), T.createElement(
575
575
  Be,
@@ -578,7 +578,7 @@ const ut = (e) => {
578
578
  autoFocus: !0,
579
579
  getInputRef: h,
580
580
  className: "gdg-input",
581
- onFocus: (d) => d.target.setSelectionRange(a ? 0 : d.target.value.length, d.target.value.length),
581
+ onFocus: (c) => c.target.setSelectionRange(a ? 0 : c.target.value.length, c.target.value.length),
582
582
  disabled: n === !0,
583
583
  decimalScale: f,
584
584
  allowNegative: m,
@@ -592,5 +592,5 @@ const ut = (e) => {
592
592
  );
593
593
  };
594
594
  export {
595
- ut as default
595
+ ot as default
596
596
  };
@@ -0,0 +1,50 @@
1
+ import { Devtools } from '@livestore/common';
2
+ import { Schema } from '@livestore/utils/effect';
3
+ import type { Plugin } from 'vite';
4
+ export type PluginOptions = {
5
+ /**
6
+ * The path to the schema file. Needs to be a valid ESM import and relative to the root of the project.
7
+ *
8
+ * Example:
9
+ * ```ts
10
+ * import { devtoolsVitePlugin } from '@livestore/devtools-vite'
11
+ *
12
+ * devtoolsVitePlugin({
13
+ * schemaPath: './src/db/schema/index.js'
14
+ * // ...
15
+ * })
16
+ * ```
17
+ */
18
+ schemaPath: string;
19
+ license?: string;
20
+ mode?: Devtools.DevtoolsMode;
21
+ /**
22
+ * Where to serve the devtools UI.
23
+ *
24
+ * @default '/_livestore'
25
+ */
26
+ path?: string;
27
+ };
28
+ export declare const PluginOptions: Schema.Struct<{
29
+ schemaPath: typeof Schema.String;
30
+ license: Schema.optional<typeof Schema.String>;
31
+ mode: Schema.optional<Schema.Union<[Schema.TaggedStruct<"from-search-params", {}>, Schema.TaggedStruct<"expo", {
32
+ storeId: typeof Schema.String;
33
+ }>, Schema.TaggedStruct<"node", {
34
+ storeId: typeof Schema.String;
35
+ clientId: typeof Schema.String;
36
+ sessionId: typeof Schema.String;
37
+ url: typeof Schema.String;
38
+ }>, Schema.TaggedStruct<"web", {
39
+ storeId: typeof Schema.String;
40
+ clientId: typeof Schema.String;
41
+ sessionId: typeof Schema.String;
42
+ }>, Schema.TaggedStruct<"browser-extension", {
43
+ storeId: typeof Schema.String;
44
+ clientId: typeof Schema.String;
45
+ sessionId: typeof Schema.String;
46
+ }>]>>;
47
+ path: Schema.optional<typeof Schema.String>;
48
+ }>;
49
+ export declare const livestoreDevtoolsPlugin: (options: PluginOptions) => Plugin;
50
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;OAYG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAA;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,aAAa;;;;wBAuCgB,OAAQ,MAAM;;wBAChB,OAAQ,MAAM;yBAAsB,OAAQ,MAAM;0BAC1E,OAAO,MAAM;oBAAiB,OAAQ,MAAM;;wBAEvB,OAAQ,MAAM;yBACjC,OAAQ,MAAM;0BACZ,OACR,MAAH;;wBACK,OAAQ,MAEnB;yBAAsB,OACjB,MAAA;0BACM,OACN,MACP;;;EAhDC,CAAA;AAEF,eAAO,MAAM,uBAAuB,GAAI,SAAS,aAAa,KAAG,MA6GhE,CAAA"}