@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.
- package/README.md +1 -1
- package/dist/devtools-bundle/{data-grid-overlay-editor-DESyH_1M.js → data-grid-overlay-editor-BdFchbb4.js} +1 -1
- package/dist/devtools-bundle/{devtools-react-bundle-BZklamRx.js → devtools-react-bundle-DsmLLpl2.js} +40549 -40165
- package/dist/devtools-bundle/{index-BQkqHAaL.js → index-JF3_QoI4.js} +1 -1
- package/dist/devtools-bundle/index.js +1 -1
- package/dist/devtools-bundle/{number-overlay-editor-9KG8yQED.js → number-overlay-editor-C8qhQV0G.js} +148 -148
- package/dist/plugin.d.ts +50 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +39 -16
- package/dist/plugin.js.map +1 -0
- package/package.json +1 -1
- package/dist/devtools.js +0 -2
package/dist/devtools-bundle/{number-overlay-editor-9KG8yQED.js → number-overlay-editor-C8qhQV0G.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as Te, R as X, r as T } from "./devtools-react-bundle-
|
|
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
|
|
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
|
|
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." +
|
|
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 =
|
|
112
|
-
i && Number(h[0]) && (
|
|
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 ? "-" : "",
|
|
116
|
-
return "" + y +
|
|
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
|
|
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,
|
|
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
|
|
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:
|
|
183
|
+
formattedValueIndex: s
|
|
184
184
|
});
|
|
185
|
-
if (C &&
|
|
186
|
-
x[y] =
|
|
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(
|
|
221
|
+
var f = Me(function(s, I) {
|
|
222
222
|
var C, g;
|
|
223
|
-
return pe(
|
|
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(
|
|
227
|
-
|
|
228
|
-
formattedValue:
|
|
229
|
-
numAsString:
|
|
230
|
-
}), i(
|
|
231
|
-
},
|
|
232
|
-
Y(e) && (
|
|
233
|
-
var y = f(
|
|
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,
|
|
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
|
|
258
|
-
|
|
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(
|
|
268
|
-
U.current = { formattedValue:
|
|
269
|
-
}, J = T.useState(!1), ee = J[0],
|
|
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
|
|
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(
|
|
279
|
-
var
|
|
278
|
+
var R = f, A = function(o, u) {
|
|
279
|
+
var v = parseFloat(u);
|
|
280
280
|
return {
|
|
281
|
-
formattedValue:
|
|
282
|
-
value:
|
|
283
|
-
floatValue: isNaN(
|
|
281
|
+
formattedValue: o,
|
|
282
|
+
value: u,
|
|
283
|
+
floatValue: isNaN(v) ? void 0 : v
|
|
284
284
|
};
|
|
285
|
-
}, E = function(
|
|
286
|
-
|
|
287
|
-
|
|
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(
|
|
290
|
-
return me(
|
|
291
|
-
}, Q = function(
|
|
292
|
-
var w = B(
|
|
293
|
-
return _ = me(
|
|
294
|
-
},
|
|
295
|
-
var
|
|
296
|
-
|
|
297
|
-
var
|
|
298
|
-
if (
|
|
299
|
-
var K =
|
|
300
|
-
|
|
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
|
-
|
|
302
|
+
u !== V && $(A(u, D), { event: _, source: w });
|
|
303
303
|
};
|
|
304
304
|
T.useEffect(function() {
|
|
305
|
-
var
|
|
306
|
-
(V !==
|
|
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 ?
|
|
311
|
+
var te = l.current ? ce(l.current) : void 0, ne = typeof window < "u" ? T.useLayoutEffect : T.useEffect;
|
|
312
312
|
ne(function() {
|
|
313
|
-
var
|
|
314
|
-
if (V !== U.current.formattedValue &&
|
|
315
|
-
var
|
|
316
|
-
|
|
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
|
|
320
|
-
var w =
|
|
321
|
-
if (b = m(K, void 0),
|
|
322
|
-
var G =
|
|
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
|
|
325
|
+
return oe({
|
|
326
326
|
formattedValue: K,
|
|
327
327
|
numAsString: b,
|
|
328
|
-
inputValue:
|
|
329
|
-
event:
|
|
330
|
-
source:
|
|
331
|
-
input:
|
|
328
|
+
inputValue: o,
|
|
329
|
+
event: u,
|
|
330
|
+
source: v,
|
|
331
|
+
input: u.target
|
|
332
332
|
}), !0;
|
|
333
|
-
}, fe = function(
|
|
334
|
-
|
|
335
|
-
var
|
|
336
|
-
M.current = { selectionStart:
|
|
337
|
-
}, De = function(
|
|
338
|
-
var
|
|
339
|
-
w && x(
|
|
340
|
-
}, Ie = function(
|
|
341
|
-
var
|
|
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
|
-
|
|
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
|
-
|
|
347
|
-
var G =
|
|
346
|
+
v === "Delete" && w === _ && (K = 1);
|
|
347
|
+
var G = v === "ArrowLeft" || v === "ArrowRight";
|
|
348
348
|
if (b === void 0 || w !== _ && !G) {
|
|
349
|
-
y(
|
|
349
|
+
y(o), fe(u, K);
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
352
|
var Z = b;
|
|
353
353
|
if (G) {
|
|
354
|
-
var le =
|
|
355
|
-
Z = O(D, b, le), Z !== b &&
|
|
356
|
-
} else
|
|
357
|
-
Z !== b && E(
|
|
358
|
-
}, Ce = function(
|
|
359
|
-
var
|
|
360
|
-
var w =
|
|
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(
|
|
363
|
+
b !== w && E(u, b, D);
|
|
364
364
|
}
|
|
365
365
|
};
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}),
|
|
369
|
-
}, Ee = function(
|
|
370
|
-
|
|
371
|
-
var
|
|
372
|
-
l.current =
|
|
373
|
-
var w =
|
|
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(
|
|
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(
|
|
379
|
-
l.current = null, clearTimeout(N.current.focusTimeout), clearTimeout(N.current.setCaretTimeout), C(
|
|
380
|
-
}, Ae = ee && We() ? "numeric" : void 0,
|
|
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({},
|
|
393
|
+
return X.createElement(Oe, Object.assign({}, ve, { ref: i }));
|
|
394
394
|
}
|
|
395
|
-
return X.createElement("input", Object.assign({},
|
|
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,
|
|
406
|
-
return r !== void 0 && (
|
|
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,
|
|
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 (
|
|
440
|
-
var C = m === 0 ? "" :
|
|
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,
|
|
449
|
-
n = B, e = n.value, h = n.start,
|
|
450
|
-
var k = g(t.lastValue, S.start, S.end), j = k.start, z = k.end, P = k.value, V = e.substring(h,
|
|
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),
|
|
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 : (
|
|
456
|
-
var U = e.indexOf(
|
|
457
|
-
e = e.replace(new RegExp(xe(
|
|
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 $ =
|
|
461
|
-
return p.end - p.start < S.end - S.start && J === "" && I && !parseFloat(ee) && (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,
|
|
500
|
-
return he(
|
|
501
|
-
}, F = function(
|
|
502
|
-
return Ye(
|
|
503
|
-
}, k = Y(
|
|
504
|
-
Y(
|
|
505
|
-
var z = function(
|
|
506
|
-
return pe(
|
|
507
|
-
}, P = Ne(z(
|
|
508
|
-
var l =
|
|
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
|
-
|
|
510
|
+
d.preventDefault();
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
513
|
if (R !== A) {
|
|
514
|
-
a(
|
|
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),
|
|
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(
|
|
520
|
-
}, $ = function(
|
|
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:
|
|
529
|
+
event: d,
|
|
530
530
|
source: re.event
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
|
-
i(
|
|
534
|
-
}, J = function(
|
|
535
|
-
return
|
|
536
|
-
}, ee = function(
|
|
537
|
-
var l =
|
|
538
|
-
return F(
|
|
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
|
|
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({},
|
|
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(
|
|
551
|
-
return et(
|
|
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
|
|
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
|
|
572
|
-
h.current?.setSelectionRange(
|
|
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: (
|
|
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
|
-
|
|
595
|
+
ot as default
|
|
596
596
|
};
|
package/dist/plugin.d.ts
ADDED
|
@@ -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"}
|