@synnaxlabs/x 0.26.7 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +20 -18
- package/dist/compare.cjs +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +39 -39
- package/dist/{index-DCwgKLH_.js → index-DPWtMAJa.js} +12 -8
- package/dist/index-DYgqYo6X.cjs +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +172 -158
- package/dist/kv.cjs +1 -1
- package/dist/kv.js +2 -4
- package/dist/observe.cjs +1 -1
- package/dist/observe.js +26 -16
- package/dist/path-577Fmn5N.cjs +1 -0
- package/dist/path-B-1-i3qC.js +72 -0
- package/dist/{series-CaeAWaDJ.js → series-DIZdmPCa.js} +65 -50
- package/dist/{series-CNcMldp_.cjs → series-DMsaUp_n.cjs} +7 -7
- package/dist/src/binary/encoder.d.ts +0 -1
- package/dist/src/change/change.d.ts +0 -1
- package/dist/src/clamp/clamp.d.ts +0 -1
- package/dist/src/compare/compare.d.ts +5 -1
- package/dist/src/compare/compare.d.ts.map +1 -1
- package/dist/src/control/control.d.ts +0 -1
- package/dist/src/control/index.d.ts.map +1 -1
- package/dist/src/deep/delete.d.ts +0 -1
- package/dist/src/deep/equal.d.ts +0 -1
- package/dist/src/deep/merge.d.ts +0 -1
- package/dist/src/deep/path.d.ts +78 -3
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/errors/errors.d.ts.map +1 -1
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/id/id.d.ts +0 -1
- package/dist/src/identity.d.ts +0 -1
- package/dist/src/kv/types.d.ts +16 -0
- package/dist/src/kv/types.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts +34 -5
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/mock/MockGLBufferController.d.ts +5 -6
- package/dist/src/mock/MockGLBufferController.d.ts.map +1 -1
- package/dist/src/numeric/index.d.ts.map +1 -1
- package/dist/src/numeric/numeric.d.ts.map +1 -1
- package/dist/src/observe/observe.d.ts +24 -2
- package/dist/src/observe/observe.d.ts.map +1 -1
- package/dist/src/primitive.d.ts +1 -2
- package/dist/src/primitive.d.ts.map +1 -1
- package/dist/src/record.d.ts +0 -1
- package/dist/src/renderable.d.ts +0 -1
- package/dist/src/runtime/os.d.ts +0 -1
- package/dist/src/search.d.ts +0 -1
- package/dist/src/spatial/base.d.ts +0 -1
- package/dist/src/spatial/bounds/bounds.d.ts +0 -1
- package/dist/src/spatial/box/box.d.ts +0 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts +0 -1
- package/dist/src/spatial/direction/direction.d.ts +0 -1
- package/dist/src/spatial/location/location.d.ts +0 -1
- package/dist/src/spatial/position/position.d.ts +0 -1
- package/dist/src/spatial/scale/scale.d.ts +0 -1
- package/dist/src/spatial/xy/xy.d.ts +0 -1
- package/dist/src/telem/generate.d.ts +0 -1
- package/dist/src/telem/series.d.ts +0 -1
- package/dist/src/telem/telem.d.ts +19 -1
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/zodutil/zodutil.d.ts +0 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +1 -1
- package/dist/types-BpAJW2TM.js +11 -0
- package/dist/types-zRwnQ1hc.cjs +1 -0
- package/dist/zodutil.cjs +1 -1
- package/dist/zodutil.js +1 -1
- package/package.json +3 -3
- package/src/caseconv/caseconv.spec.ts +9 -0
- package/src/compare/compare.ts +6 -0
- package/src/control/index.ts +9 -0
- package/src/deep/path.spec.ts +29 -0
- package/src/deep/path.ts +102 -10
- package/src/errors/errors.ts +9 -0
- package/src/errors/index.ts +9 -0
- package/src/kv/types.ts +13 -0
- package/src/migrate/migrate.spec.ts +78 -0
- package/src/migrate/migrate.ts +69 -9
- package/src/mock/MockGLBufferController.ts +7 -7
- package/src/numeric/index.ts +9 -0
- package/src/numeric/numeric.ts +9 -0
- package/src/observe/observe.ts +30 -1
- package/src/primitive.ts +1 -1
- package/src/telem/series.spec.ts +14 -0
- package/src/telem/series.ts +1 -1
- package/src/telem/telem.ts +26 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/index-CvHP07Bs.cjs +0 -1
- package/dist/path-Coj1BKMh.cjs +0 -1
- package/dist/path-DH9iaDDf.js +0 -58
package/dist/index.js
CHANGED
|
@@ -1,196 +1,210 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (
|
|
4
|
-
import { e as
|
|
5
|
-
import { a as
|
|
6
|
-
import { c as
|
|
7
|
-
import { c as
|
|
8
|
-
import { i as w, a as
|
|
9
|
-
import { c as
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var $ = (r, o, e) => o in r ? T(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e;
|
|
3
|
+
var m = (r, o, e) => $(r, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { e as I } from "./index-CzjnpuXF.js";
|
|
5
|
+
import { a as F } from "./index-C9i674Sf.js";
|
|
6
|
+
import { c as X } from "./change-DLl6DccR.js";
|
|
7
|
+
import { c as rr, s as er } from "./scale-BgCpxgAk.js";
|
|
8
|
+
import { L as b, G as y, E as k, i as w, a as j, b as A } from "./index-DPWtMAJa.js";
|
|
9
|
+
import { c as tr, d as nr, p as sr } from "./index-DPWtMAJa.js";
|
|
10
10
|
import { z as i } from "zod";
|
|
11
|
-
import { debounce as
|
|
12
|
-
import { deep as
|
|
13
|
-
import { d as
|
|
14
|
-
import { isObject as
|
|
15
|
-
import {
|
|
16
|
-
import { b as
|
|
17
|
-
import { observe as
|
|
18
|
-
import { getEntries as
|
|
19
|
-
import { e as
|
|
20
|
-
import { Search as
|
|
21
|
-
import { b as
|
|
22
|
-
import { d as
|
|
23
|
-
import { d as
|
|
24
|
-
import { l as
|
|
25
|
-
import { p as
|
|
26
|
-
import { s as
|
|
27
|
-
import { x as
|
|
28
|
-
import { nullToArr as
|
|
29
|
-
import { unique as
|
|
30
|
-
import { URL as
|
|
31
|
-
import { RoutedWorker as
|
|
11
|
+
import { debounce as ar, throttle as cr } from "./debounce.js";
|
|
12
|
+
import { deep as fr } from "./deep.js";
|
|
13
|
+
import { d as mr, D as pr, M as gr, R as dr, S as xr, e as br, c as yr, b as Sr, T as hr, a as vr, g as Er, h as Mr, i as Tr, f as $r, t as kr } from "./series-DIZdmPCa.js";
|
|
14
|
+
import { isObject as jr } from "./identity.js";
|
|
15
|
+
import { t as Or } from "./types-BpAJW2TM.js";
|
|
16
|
+
import { b as Nr, m as zr } from "./bounds-CpboA0q6.js";
|
|
17
|
+
import { observe as Lr } from "./observe.js";
|
|
18
|
+
import { getEntries as Vr, unknownRecordZ as Dr } from "./record.js";
|
|
19
|
+
import { e as _r } from "./external-CO221aaF.js";
|
|
20
|
+
import { Search as Cr } from "./search.js";
|
|
21
|
+
import { b as Br } from "./box-B5SaODGu.js";
|
|
22
|
+
import { d as Qr } from "./dimensions-D-1PnJVI.js";
|
|
23
|
+
import { d as Ir } from "./direction-CScbfCdT.js";
|
|
24
|
+
import { l as Fr } from "./location-C6sCnzhU.js";
|
|
25
|
+
import { p as Xr } from "./position-BY9oBMZB.js";
|
|
26
|
+
import { s as re } from "./spatial-DozyssiN.js";
|
|
27
|
+
import { x as oe } from "./xy-CrgPnICw.js";
|
|
28
|
+
import { nullToArr as ne, toArray as se } from "./toArray.js";
|
|
29
|
+
import { unique as ae } from "./unique.js";
|
|
30
|
+
import { URL as le, buildQueryString as fe } from "./url.js";
|
|
31
|
+
import { RoutedWorker as me, TypedWorker as pe, createMockWorkers as ge } from "./worker.js";
|
|
32
32
|
const a = class a extends Number {
|
|
33
33
|
};
|
|
34
34
|
m(a, "Absolute", 255), m(a, "Default", 1), m(a, "z", i.union([
|
|
35
35
|
i.instanceof(a),
|
|
36
|
-
i.number().int().min(0).max(255).transform((
|
|
37
|
-
i.instanceof(Number).transform((
|
|
36
|
+
i.number().int().min(0).max(255).transform((o) => new a(o)),
|
|
37
|
+
i.instanceof(Number).transform((o) => new a(o))
|
|
38
38
|
]));
|
|
39
|
-
let
|
|
40
|
-
const
|
|
39
|
+
let x = a;
|
|
40
|
+
const v = i.object({
|
|
41
41
|
name: i.string(),
|
|
42
42
|
key: i.string()
|
|
43
|
-
}),
|
|
44
|
-
subject:
|
|
45
|
-
resource:
|
|
46
|
-
authority:
|
|
47
|
-
}),
|
|
48
|
-
let
|
|
49
|
-
return
|
|
50
|
-
}),
|
|
43
|
+
}), O = (r) => i.object({
|
|
44
|
+
subject: v,
|
|
45
|
+
resource: r,
|
|
46
|
+
authority: x.z
|
|
47
|
+
}), R = (...r) => (o) => o.filter((e) => {
|
|
48
|
+
let t = !1;
|
|
49
|
+
return e.to != null && (t = r.includes(e.to.resource)), e.from != null && !t && (t = r.includes(e.from.resource)), t;
|
|
50
|
+
}), _ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
51
|
__proto__: null,
|
|
52
|
-
Authority:
|
|
53
|
-
filterTransfersByChannelKey:
|
|
54
|
-
stateZ:
|
|
55
|
-
subjectZ:
|
|
52
|
+
Authority: x,
|
|
53
|
+
filterTransfersByChannelKey: R,
|
|
54
|
+
stateZ: O,
|
|
55
|
+
subjectZ: v
|
|
56
56
|
}, Symbol.toStringTag, { value: "Module" })), c = class c extends Error {
|
|
57
57
|
constructor() {
|
|
58
58
|
super(c.MESSAGE);
|
|
59
59
|
}
|
|
60
60
|
/** Returns true if the error or message is a cancellation error" */
|
|
61
|
-
matches(
|
|
62
|
-
return typeof
|
|
61
|
+
matches(o) {
|
|
62
|
+
return typeof o == "string" ? o.includes(c.MESSAGE) : o instanceof c || o.message.includes(c.MESSAGE);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
m(c, "MESSAGE", "canceled");
|
|
66
|
-
let
|
|
67
|
-
const
|
|
66
|
+
let S = c;
|
|
67
|
+
const N = new S(), q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
68
68
|
__proto__: null,
|
|
69
|
-
CANCELED:
|
|
70
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
69
|
+
CANCELED: N
|
|
70
|
+
}, Symbol.toStringTag, { value: "Module" })), C = (r) => r ? -1 : 1, h = i.string().regex(/^\d+\.\d+\.\d+$/), p = (r, o, e = {}) => {
|
|
71
|
+
e.checkMajor ?? (e.checkMajor = !0), e.checkMinor ?? (e.checkMinor = !0), e.checkPatch ?? (e.checkPatch = !0);
|
|
72
|
+
const t = h.parse(r), l = h.parse(o), [g, f, u] = t.split(".").map(Number), [n, s, d] = l.split(".").map(Number);
|
|
73
|
+
if (e.checkMajor) {
|
|
74
|
+
if (g < n) return b;
|
|
75
|
+
if (g > n) return y;
|
|
76
|
+
}
|
|
77
|
+
if (e.checkMinor) {
|
|
78
|
+
if (f < s) return b;
|
|
79
|
+
if (f > s) return y;
|
|
80
|
+
}
|
|
81
|
+
if (e.checkPatch) {
|
|
82
|
+
if (u < d) return b;
|
|
83
|
+
if (u > d) return y;
|
|
84
|
+
}
|
|
85
|
+
return k;
|
|
86
|
+
}, z = (r, o, e = {}) => w(p(r, o, e)), E = (r, o, e = {}) => j(p(r, o, e)), G = (r, o, e = {}) => A(p(r, o, e)), L = ({
|
|
87
|
+
name: r,
|
|
88
|
+
migrate: o
|
|
89
|
+
}) => (e) => {
|
|
77
90
|
try {
|
|
78
|
-
const
|
|
79
|
-
return console.log(`${
|
|
80
|
-
} catch (
|
|
81
|
-
throw console.log(`${
|
|
91
|
+
const t = o(e);
|
|
92
|
+
return console.log(`${r} migrated: ${e.version} -> ${t.version}`), t;
|
|
93
|
+
} catch (t) {
|
|
94
|
+
throw console.log(`${r} failed to migrate from ${e.version}`), console.error(t), t;
|
|
82
95
|
}
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
migrations:
|
|
86
|
-
targetSchema:
|
|
87
|
-
def:
|
|
96
|
+
}, P = ({
|
|
97
|
+
name: r,
|
|
98
|
+
migrations: o,
|
|
99
|
+
targetSchema: e,
|
|
100
|
+
def: t
|
|
88
101
|
}) => {
|
|
89
|
-
const l = Object.keys(
|
|
102
|
+
const l = Object.keys(o).sort(p).pop();
|
|
90
103
|
if (l == null)
|
|
91
|
-
return (
|
|
92
|
-
if (
|
|
104
|
+
return (n) => {
|
|
105
|
+
if (n.version !== t.version)
|
|
93
106
|
return console.log(
|
|
94
|
-
`${
|
|
107
|
+
`${r} version ${n.version} is newer than latest version of ${t.version}.
|
|
95
108
|
Returning default instead.
|
|
96
109
|
`
|
|
97
|
-
),
|
|
110
|
+
), t;
|
|
98
111
|
try {
|
|
99
|
-
return
|
|
100
|
-
} catch (
|
|
101
|
-
return console.log(`${
|
|
112
|
+
return e != null ? e.parse(n) : n;
|
|
113
|
+
} catch (s) {
|
|
114
|
+
return console.log(`${r} failed to parse default. Exiting with default`), console.error(s), t;
|
|
102
115
|
}
|
|
103
116
|
};
|
|
104
|
-
const
|
|
105
|
-
let
|
|
106
|
-
const
|
|
117
|
+
const g = Object.keys(o).length;
|
|
118
|
+
let f = !1;
|
|
119
|
+
const u = (n) => {
|
|
107
120
|
try {
|
|
108
|
-
if (
|
|
109
|
-
return console.log(
|
|
110
|
-
const
|
|
111
|
-
return
|
|
112
|
-
} catch (
|
|
121
|
+
if (g === 0 || E(n.version, l))
|
|
122
|
+
return console.log(f ? `${r} ${n.version} now up to date` : `${r} version ${n.version} is up to date with target version ${t.version}`), n;
|
|
123
|
+
const s = n.version, d = o[s], M = d(n);
|
|
124
|
+
return f = !0, u(M);
|
|
125
|
+
} catch (s) {
|
|
113
126
|
return console.log(
|
|
114
|
-
`${
|
|
115
|
-
), console.error(
|
|
127
|
+
`${r} failed to migrate from ${n.version} to ${l}`
|
|
128
|
+
), console.error(s), t;
|
|
116
129
|
}
|
|
117
130
|
};
|
|
118
|
-
return (
|
|
131
|
+
return (n) => {
|
|
119
132
|
try {
|
|
120
|
-
return
|
|
121
|
-
} catch (
|
|
122
|
-
return console.log(`${
|
|
133
|
+
return u(n);
|
|
134
|
+
} catch (s) {
|
|
135
|
+
return console.log(`${r} failed to parse final result. Exiting with default`), console.error(s), t;
|
|
123
136
|
}
|
|
124
137
|
};
|
|
125
|
-
},
|
|
138
|
+
}, W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
126
139
|
__proto__: null,
|
|
127
|
-
compareSemVer:
|
|
128
|
-
createMigration:
|
|
129
|
-
migrator:
|
|
130
|
-
semVerNewer:
|
|
131
|
-
semVerOlder:
|
|
132
|
-
semVerZ:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
compareSemVer: p,
|
|
141
|
+
createMigration: L,
|
|
142
|
+
migrator: P,
|
|
143
|
+
semVerNewer: E,
|
|
144
|
+
semVerOlder: G,
|
|
145
|
+
semVerZ: h,
|
|
146
|
+
versionsEqual: z
|
|
147
|
+
}, Symbol.toStringTag, { value: "Module" })), B = (r) => {
|
|
148
|
+
if (r === void 0 || typeof r == "string" || typeof r == "number")
|
|
149
|
+
return r;
|
|
150
|
+
if (r.toString === void 0) throw new Error("invalid renderer");
|
|
151
|
+
return r.toString();
|
|
152
|
+
}, H = (r) => Array.isArray(r) ? [...r] : typeof r == "object" && r !== null ? { ...r } : r;
|
|
139
153
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
154
|
+
mr as DataType,
|
|
155
|
+
pr as Density,
|
|
156
|
+
gr as MultiSeries,
|
|
157
|
+
dr as Rate,
|
|
158
|
+
me as RoutedWorker,
|
|
159
|
+
Cr as Search,
|
|
160
|
+
xr as Series,
|
|
161
|
+
br as Size,
|
|
162
|
+
yr as TimeRange,
|
|
163
|
+
Sr as TimeSpan,
|
|
164
|
+
hr as TimeStamp,
|
|
165
|
+
pe as TypedWorker,
|
|
166
|
+
le as URL,
|
|
167
|
+
vr as addSamples,
|
|
168
|
+
I as binary,
|
|
169
|
+
Nr as bounds,
|
|
170
|
+
Br as box,
|
|
171
|
+
fe as buildQueryString,
|
|
172
|
+
F as caseconv,
|
|
173
|
+
X as change,
|
|
174
|
+
rr as clamp,
|
|
175
|
+
tr as compare,
|
|
176
|
+
_ as control,
|
|
177
|
+
Er as convertDataType,
|
|
178
|
+
B as convertRenderV,
|
|
179
|
+
ge as createMockWorkers,
|
|
180
|
+
ar as debounce,
|
|
181
|
+
fr as deep,
|
|
182
|
+
Qr as dimensions,
|
|
183
|
+
Ir as direction,
|
|
184
|
+
q as errors,
|
|
185
|
+
Vr as getEntries,
|
|
186
|
+
Mr as id,
|
|
187
|
+
C as invert,
|
|
188
|
+
Tr as isCrudeSeries,
|
|
189
|
+
jr as isObject,
|
|
190
|
+
nr as isStringer,
|
|
191
|
+
$r as isTelemValue,
|
|
192
|
+
Or as kv,
|
|
193
|
+
Fr as location,
|
|
194
|
+
zr as math,
|
|
195
|
+
W as migrate,
|
|
196
|
+
ne as nullToArr,
|
|
197
|
+
Lr as observe,
|
|
198
|
+
Xr as position,
|
|
199
|
+
sr as primitiveIsZero,
|
|
200
|
+
_r as runtime,
|
|
201
|
+
er as scale,
|
|
202
|
+
H as shallowCopy,
|
|
203
|
+
re as spatial,
|
|
204
|
+
cr as throttle,
|
|
205
|
+
se as toArray,
|
|
206
|
+
kr as typedArrayZ,
|
|
207
|
+
ae as unique,
|
|
208
|
+
Dr as unknownRecordZ,
|
|
209
|
+
oe as xy
|
|
196
210
|
};
|
package/dist/kv.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./types-zRwnQ1hc.cjs");exports.kv=e.types;
|
package/dist/kv.js
CHANGED
package/dist/observe.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var a=(
|
|
1
|
+
"use strict";var l=Object.defineProperty;var a=(r,e,s)=>e in r?l(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var t=(r,e,s)=>a(r,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class h{constructor(e,s){t(this,"handlers");t(this,"transform");t(this,"closer");this.transform=e,this.handlers=s??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let s=e;if(this.transform!=null){const[n,o]=this.transform(e);if(!o)return;s=n}this.handlers.forEach((n,o)=>o(s))}setCloser(e){this.closer=e}async close(){var e;return await((e=this.closer)==null?void 0:e.call(this))}}class i{constructor(e){t(this,"handlers");this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((s,n)=>n(e))}}const c=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:i,Observer:h},Symbol.toStringTag,{value:"Module"}));exports.observe=c;
|
package/dist/observe.js
CHANGED
|
@@ -1,41 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
5
|
-
constructor(e,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var a = (r, e, s) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
+
var t = (r, e, s) => a(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
class h {
|
|
5
|
+
constructor(e, s) {
|
|
6
|
+
t(this, "handlers");
|
|
7
|
+
t(this, "transform");
|
|
8
|
+
t(this, "closer");
|
|
9
|
+
this.transform = e, this.handlers = s ?? /* @__PURE__ */ new Map();
|
|
9
10
|
}
|
|
11
|
+
/** Implements the observable interface. */
|
|
10
12
|
onChange(e) {
|
|
11
13
|
return this.handlers.set(e, null), () => this.handlers.delete(e);
|
|
12
14
|
}
|
|
15
|
+
/** Notifies all handlers that the value of the observable has changed. */
|
|
13
16
|
notify(e) {
|
|
14
|
-
let
|
|
17
|
+
let s = e;
|
|
15
18
|
if (this.transform != null) {
|
|
16
|
-
const [
|
|
17
|
-
if (!
|
|
18
|
-
|
|
19
|
+
const [n, l] = this.transform(e);
|
|
20
|
+
if (!l) return;
|
|
21
|
+
s = n;
|
|
19
22
|
}
|
|
20
|
-
this.handlers.forEach((
|
|
23
|
+
this.handlers.forEach((n, l) => l(s));
|
|
24
|
+
}
|
|
25
|
+
setCloser(e) {
|
|
26
|
+
this.closer = e;
|
|
27
|
+
}
|
|
28
|
+
async close() {
|
|
29
|
+
var e;
|
|
30
|
+
return await ((e = this.closer) == null ? void 0 : e.call(this));
|
|
21
31
|
}
|
|
22
32
|
}
|
|
23
33
|
class i {
|
|
24
34
|
constructor(e) {
|
|
25
|
-
|
|
35
|
+
t(this, "handlers");
|
|
26
36
|
this.handlers = e ?? /* @__PURE__ */ new Map();
|
|
27
37
|
}
|
|
28
38
|
onChange(e) {
|
|
29
39
|
return this.handlers.set(e, null), () => this.handlers.delete(e);
|
|
30
40
|
}
|
|
31
41
|
notify(e) {
|
|
32
|
-
this.handlers.forEach((
|
|
42
|
+
this.handlers.forEach((s, n) => n(e));
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
45
|
const d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
36
46
|
__proto__: null,
|
|
37
47
|
BaseObserver: i,
|
|
38
|
-
Observer:
|
|
48
|
+
Observer: h
|
|
39
49
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
40
50
|
export {
|
|
41
51
|
d as observe
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=(l,n,t=".")=>{const r=l.split(t);return r.map((s,o)=>{const i=n(s,o,r);return i==null?null:typeof i=="string"?i:i.join(t)}).filter(s=>s!=null).join(t)},a=(l,n,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:r,getter:e=(i,u)=>i[u]}=t,s=n.split(t.separator);if(s.length===1&&s[0]==="")return l;let o=l;for(const i of s){const u=e(o,i);if(u==null){if(r)return null;throw new Error(`Path ${n} does not exist. ${i} is null`)}o=u}return o},f=(l,n,t)=>{const r=n.split(".");let e=l;for(let s=0;s<r.length-1;s++){const o=r[s];e[o]==null&&(e[o]={}),e=e[o]}e[r[r.length-1]]=t},h=(l,n)=>{const t=n.split(".");let r=l;for(let e=0;e<t.length-1;e++){const s=t[e];if(r[s]==null)return;r=r[s]}if(Array.isArray(r)){const e=parseInt(t[t.length-1],10);if(isNaN(e))return;r.splice(e,1);return}delete r[t[t.length-1]]},p=(l,n)=>{const t=l.split(".");return n<0?t[t.length+n]:t[n]},g=(l,n)=>{try{return a(l,n),!0}catch{return!1}},m=(l,n)=>{if(n.length===0)return!0;const t=l.split("."),r=n.split(".");if(r.length>t.length)return!1;for(let e=0;e<r.length;e++){const s=t[e],o=r[e];if(o!=="*"&&s!==o)return!1}return!0};exports.element=p;exports.get=a;exports.has=g;exports.pathsMatch=m;exports.remove=h;exports.set=f;exports.transformPath=c;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const c = (l, e, t = ".") => {
|
|
2
|
+
const r = l.split(t);
|
|
3
|
+
return r.map((s, o) => {
|
|
4
|
+
const a = e(s, o, r);
|
|
5
|
+
return a == null ? null : typeof a == "string" ? a : a.join(t);
|
|
6
|
+
}).filter((s) => s != null).join(t);
|
|
7
|
+
}, u = (l, e, t = { optional: !1, separator: "." }) => {
|
|
8
|
+
t.separator ?? (t.separator = ".");
|
|
9
|
+
const { optional: r, getter: n = (a, i) => a[i] } = t, s = e.split(t.separator);
|
|
10
|
+
if (s.length === 1 && s[0] === "") return l;
|
|
11
|
+
let o = l;
|
|
12
|
+
for (const a of s) {
|
|
13
|
+
const i = n(o, a);
|
|
14
|
+
if (i == null) {
|
|
15
|
+
if (r) return null;
|
|
16
|
+
throw new Error(`Path ${e} does not exist. ${a} is null`);
|
|
17
|
+
}
|
|
18
|
+
o = i;
|
|
19
|
+
}
|
|
20
|
+
return o;
|
|
21
|
+
}, f = (l, e, t) => {
|
|
22
|
+
const r = e.split(".");
|
|
23
|
+
let n = l;
|
|
24
|
+
for (let s = 0; s < r.length - 1; s++) {
|
|
25
|
+
const o = r[s];
|
|
26
|
+
n[o] == null && (n[o] = {}), n = n[o];
|
|
27
|
+
}
|
|
28
|
+
n[r[r.length - 1]] = t;
|
|
29
|
+
}, p = (l, e) => {
|
|
30
|
+
const t = e.split(".");
|
|
31
|
+
let r = l;
|
|
32
|
+
for (let n = 0; n < t.length - 1; n++) {
|
|
33
|
+
const s = t[n];
|
|
34
|
+
if (r[s] == null) return;
|
|
35
|
+
r = r[s];
|
|
36
|
+
}
|
|
37
|
+
if (Array.isArray(r)) {
|
|
38
|
+
const n = parseInt(t[t.length - 1], 10);
|
|
39
|
+
if (isNaN(n)) return;
|
|
40
|
+
r.splice(n, 1);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
delete r[t[t.length - 1]];
|
|
44
|
+
}, h = (l, e) => {
|
|
45
|
+
const t = l.split(".");
|
|
46
|
+
return e < 0 ? t[t.length + e] : t[e];
|
|
47
|
+
}, g = (l, e) => {
|
|
48
|
+
try {
|
|
49
|
+
return u(l, e), !0;
|
|
50
|
+
} catch {
|
|
51
|
+
return !1;
|
|
52
|
+
}
|
|
53
|
+
}, m = (l, e) => {
|
|
54
|
+
if (e.length === 0) return !0;
|
|
55
|
+
const t = l.split("."), r = e.split(".");
|
|
56
|
+
if (r.length > t.length) return !1;
|
|
57
|
+
for (let n = 0; n < r.length; n++) {
|
|
58
|
+
const s = t[n], o = r[n];
|
|
59
|
+
if (o !== "*" && s !== o)
|
|
60
|
+
return !1;
|
|
61
|
+
}
|
|
62
|
+
return !0;
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
h as e,
|
|
66
|
+
u as g,
|
|
67
|
+
g as h,
|
|
68
|
+
m as p,
|
|
69
|
+
p as r,
|
|
70
|
+
f as s,
|
|
71
|
+
c as t
|
|
72
|
+
};
|