@manyducks.co/dolla 2.0.0-alpha.28 → 2.0.0-alpha.29
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 +29 -527
- package/dist/core/nodes/repeat.d.ts +1 -1
- package/dist/core/nodes/view.d.ts +4 -0
- package/dist/core/store.d.ts +18 -1
- package/dist/index.js +60 -56
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/{passthrough-1MySicTa.js → passthrough-eH8w4zJi.js} +471 -436
- package/dist/passthrough-eH8w4zJi.js.map +1 -0
- package/docs/http.md +8 -0
- package/docs/i18n.md +35 -2
- package/docs/index.md +10 -0
- package/docs/router.md +65 -12
- package/docs/setup.md +8 -0
- package/docs/state.md +11 -3
- package/docs/stores.md +62 -0
- package/docs/views.md +305 -2
- package/package.json +1 -1
- package/dist/passthrough-1MySicTa.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
var Ut = Object.defineProperty;
|
|
2
|
-
var ot = (
|
|
3
|
-
throw TypeError(
|
|
2
|
+
var ot = (r) => {
|
|
3
|
+
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var Lt = (
|
|
6
|
-
var o = (
|
|
7
|
-
var O = (
|
|
8
|
-
function
|
|
9
|
-
return
|
|
5
|
+
var Lt = (r, t, e) => t in r ? Ut(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
6
|
+
var o = (r, t, e) => Lt(r, typeof t != "symbol" ? t + "" : t, e), ut = (r, t, e) => t.has(r) || ot("Cannot " + e);
|
|
7
|
+
var O = (r, t, e) => (ut(r, t, "read from private field"), e ? e.call(r) : t.get(r)), F = (r, t, e) => t.has(r) ? ot("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), P = (r, t, e, n) => (ut(r, t, "write to private field"), n ? n.call(r, e) : t.set(r, e), e);
|
|
8
|
+
function Mt(r) {
|
|
9
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
10
10
|
}
|
|
11
|
-
var T = { exports: {} },
|
|
11
|
+
var T = { exports: {} }, at;
|
|
12
12
|
function Rt() {
|
|
13
|
-
return
|
|
13
|
+
return at || (at = 1, function(r, t) {
|
|
14
14
|
Object.defineProperty(t, "__esModule", { value: !0 });
|
|
15
15
|
var e = /* @__PURE__ */ function() {
|
|
16
|
-
function h(
|
|
16
|
+
function h(c, f) {
|
|
17
17
|
var l = [], d = !0, p = !1, _ = void 0;
|
|
18
18
|
try {
|
|
19
|
-
for (var x, y =
|
|
19
|
+
for (var x, y = c[Symbol.iterator](); !(d = (x = y.next()).done) && (l.push(x.value), !(f && l.length === f)); d = !0) ;
|
|
20
20
|
} catch (g) {
|
|
21
21
|
p = !0, _ = g;
|
|
22
22
|
} finally {
|
|
@@ -28,119 +28,119 @@ function Rt() {
|
|
|
28
28
|
}
|
|
29
29
|
return l;
|
|
30
30
|
}
|
|
31
|
-
return function(
|
|
32
|
-
if (Array.isArray(
|
|
33
|
-
if (Symbol.iterator in Object(
|
|
31
|
+
return function(c, f) {
|
|
32
|
+
if (Array.isArray(c)) return c;
|
|
33
|
+
if (Symbol.iterator in Object(c)) return h(c, f);
|
|
34
34
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
35
35
|
};
|
|
36
|
-
}(),
|
|
37
|
-
return h.reduce(function(
|
|
38
|
-
return 16 > f ?
|
|
36
|
+
}(), n = function(h) {
|
|
37
|
+
return h.reduce(function(c, f) {
|
|
38
|
+
return 16 > f ? c + "0" + f.toString(16) : c + f.toString(16);
|
|
39
39
|
}, "#");
|
|
40
|
-
}, s = function(h,
|
|
41
|
-
var l = 0.5 > f ? f * (1 +
|
|
42
|
-
var
|
|
43
|
-
return w = w < 1 / 6 ? g + 6 * (C - g) * w : w < 1 / 2 ? C : w < 2 / 3 ? g + 6 * (C - g) * (2 / 3 - w) : g,
|
|
40
|
+
}, s = function(h, c, f) {
|
|
41
|
+
var l = 0.5 > f ? f * (1 + c) : f + c - f * c, d = 2 * f - l, p = function(g, C, S) {
|
|
42
|
+
var z = Math.round, w = 0 > S ? S + 1 : 1 < S ? S - 1 : S;
|
|
43
|
+
return w = w < 1 / 6 ? g + 6 * (C - g) * w : w < 1 / 2 ? C : w < 2 / 3 ? g + 6 * (C - g) * (2 / 3 - w) : g, z(255 * w);
|
|
44
44
|
}, _ = p(d, l, h + 1 / 3), x = p(d, l, h), y = p(d, l, h - 1 / 3);
|
|
45
45
|
return [_, x, y];
|
|
46
|
-
}, i = function(h,
|
|
46
|
+
}, i = function(h, c, f, l) {
|
|
47
47
|
var d = h % 1007 / 1007, p = function(g, C, S) {
|
|
48
48
|
return g * (S - C) + C;
|
|
49
|
-
}, _ = p(d,
|
|
49
|
+
}, _ = p(d, c.min, c.max), x = p(d, f.min, f.max), y = p(d, l.max, l.min);
|
|
50
50
|
return [_, x, y];
|
|
51
51
|
}, u = function(h) {
|
|
52
|
-
return h.split("").reduce(function(
|
|
53
|
-
return
|
|
52
|
+
return h.split("").reduce(function(c, f, l) {
|
|
53
|
+
return c * f.charCodeAt(0) * l + 1;
|
|
54
54
|
}, 1);
|
|
55
|
-
},
|
|
56
|
-
var
|
|
55
|
+
}, a = function(h) {
|
|
56
|
+
var c = h.str, f = h.hue, l = f === void 0 ? { min: 0, max: 360 } : f, d = h.sat, p = d === void 0 ? { min: 0.35, max: 0.65 } : d, _ = h.light, x = _ === void 0 ? { min: 0.3, max: 0.7 } : _, y = h.hashFunction, g = y === void 0 ? u : y, C = h.scheme, S = C === void 0 ? "hex" : C, z = i(g(c), l, p, x), w = e(z, 3), nt = w[0], rt = w[1], st = w[2], it = s(nt / 360, rt, st), jt = n(it);
|
|
57
57
|
return S === "hsl" ? [nt, rt, st] : S === "rgb" ? it : jt;
|
|
58
58
|
};
|
|
59
|
-
t.default =
|
|
59
|
+
t.default = a, r.exports = t.default;
|
|
60
60
|
}(T, T.exports)), T.exports;
|
|
61
61
|
}
|
|
62
62
|
var Dt = Rt();
|
|
63
|
-
const zt = /* @__PURE__ */
|
|
64
|
-
function N(
|
|
65
|
-
const t = typeof
|
|
63
|
+
const zt = /* @__PURE__ */ Mt(Dt);
|
|
64
|
+
function N(r) {
|
|
65
|
+
const t = typeof r;
|
|
66
66
|
switch (t) {
|
|
67
67
|
case "undefined":
|
|
68
68
|
return t;
|
|
69
69
|
case "number":
|
|
70
|
-
return isNaN(
|
|
70
|
+
return isNaN(r) ? "NaN" : t;
|
|
71
71
|
case "function":
|
|
72
|
-
return /^\s*class\s+/.test(
|
|
72
|
+
return /^\s*class\s+/.test(r.toString()) ? "class" : t;
|
|
73
73
|
case "object":
|
|
74
|
-
return
|
|
74
|
+
return r === null ? "null" : r instanceof Promise ? "promise" : r instanceof Map ? "map" : r instanceof Set ? "set" : Array.isArray(r) ? "array" : t;
|
|
75
75
|
default:
|
|
76
76
|
return t;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function xe(
|
|
80
|
-
if (!
|
|
79
|
+
function xe(r, t) {
|
|
80
|
+
if (!r)
|
|
81
81
|
throw new TypeError(
|
|
82
|
-
R(
|
|
82
|
+
R(r, t || "Failed assertion. Value is not truthy. Got type: %t, value: %v")
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
function A(
|
|
86
|
-
return Array.isArray(
|
|
85
|
+
function A(r) {
|
|
86
|
+
return Array.isArray(r);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const t =
|
|
90
|
-
return
|
|
88
|
+
function kt(...r) {
|
|
89
|
+
const t = r[0], e = (n) => A(n) && n.every((s) => t(s));
|
|
90
|
+
return r.length < 2 ? e : e(r[1]);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
const t =
|
|
92
|
+
function Me(...r) {
|
|
93
|
+
const t = r[0], e = b(r[2]) ? r[2] : "Expected an array of valid items. Got type: %t, value: %v", n = (s) => {
|
|
94
94
|
if (A(s) && s.every((i) => t(i)))
|
|
95
95
|
return !0;
|
|
96
96
|
throw new TypeError(R(s, e));
|
|
97
97
|
};
|
|
98
|
-
return
|
|
98
|
+
return r.length < 2 ? n : n(r[1]);
|
|
99
99
|
}
|
|
100
|
-
function b(
|
|
101
|
-
return typeof
|
|
100
|
+
function b(r) {
|
|
101
|
+
return typeof r == "string";
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
if (b(
|
|
103
|
+
function ke(r, t) {
|
|
104
|
+
if (b(r))
|
|
105
105
|
return !0;
|
|
106
|
-
throw new TypeError(R(
|
|
106
|
+
throw new TypeError(R(r, t ?? "Expected a string. Got type: %t, value: %v"));
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return typeof
|
|
108
|
+
function q(r) {
|
|
109
|
+
return typeof r == "function" && !Kt(r);
|
|
110
110
|
}
|
|
111
|
-
function Gt(
|
|
112
|
-
return typeof
|
|
111
|
+
function Gt(r) {
|
|
112
|
+
return typeof r == "number" && !isNaN(r);
|
|
113
113
|
}
|
|
114
|
-
function Kt(
|
|
115
|
-
return typeof
|
|
114
|
+
function Kt(r) {
|
|
115
|
+
return typeof r == "function" && /^\s*class\s+/.test(r.toString());
|
|
116
116
|
}
|
|
117
|
-
function be(...
|
|
118
|
-
const t =
|
|
117
|
+
function be(...r) {
|
|
118
|
+
const t = r[0], e = b(r[2]) ? r[2] : `Expected instance of ${t.name}. Got type: %t, value: %v`, n = (s) => {
|
|
119
119
|
if (s instanceof t)
|
|
120
120
|
return !0;
|
|
121
121
|
throw new TypeError(R(s, e));
|
|
122
122
|
};
|
|
123
|
-
return
|
|
123
|
+
return r.length < 2 ? n : n(r[1]);
|
|
124
124
|
}
|
|
125
|
-
function bt(
|
|
126
|
-
return
|
|
125
|
+
function bt(r) {
|
|
126
|
+
return r != null && typeof r == "object" && !A(r);
|
|
127
127
|
}
|
|
128
|
-
function R(
|
|
128
|
+
function R(r, t) {
|
|
129
129
|
var s;
|
|
130
|
-
const e = N(
|
|
131
|
-
return t.replaceAll("%t", e).replaceAll("%v",
|
|
130
|
+
const e = N(r), n = ((s = r == null ? void 0 : r.toString) == null ? void 0 : s.call(r)) || String(r);
|
|
131
|
+
return t.replaceAll("%t", e).replaceAll("%v", n);
|
|
132
132
|
}
|
|
133
|
-
var
|
|
133
|
+
var G, ct;
|
|
134
134
|
function Bt() {
|
|
135
|
-
return
|
|
135
|
+
return ct || (ct = 1, G = function r(t, e) {
|
|
136
136
|
if (t === e) return !0;
|
|
137
137
|
if (t && e && typeof t == "object" && typeof e == "object") {
|
|
138
138
|
if (t.constructor !== e.constructor) return !1;
|
|
139
|
-
var
|
|
139
|
+
var n, s, i;
|
|
140
140
|
if (Array.isArray(t)) {
|
|
141
|
-
if (
|
|
142
|
-
for (s =
|
|
143
|
-
if (!
|
|
141
|
+
if (n = t.length, n != e.length) return !1;
|
|
142
|
+
for (s = n; s-- !== 0; )
|
|
143
|
+
if (!r(t[s], e[s])) return !1;
|
|
144
144
|
return !0;
|
|
145
145
|
}
|
|
146
146
|
if (t instanceof Map && e instanceof Map) {
|
|
@@ -148,7 +148,7 @@ function Bt() {
|
|
|
148
148
|
for (s of t.entries())
|
|
149
149
|
if (!e.has(s[0])) return !1;
|
|
150
150
|
for (s of t.entries())
|
|
151
|
-
if (!
|
|
151
|
+
if (!r(s[1], e.get(s[0]))) return !1;
|
|
152
152
|
return !0;
|
|
153
153
|
}
|
|
154
154
|
if (t instanceof Set && e instanceof Set) {
|
|
@@ -158,108 +158,108 @@ function Bt() {
|
|
|
158
158
|
return !0;
|
|
159
159
|
}
|
|
160
160
|
if (ArrayBuffer.isView(t) && ArrayBuffer.isView(e)) {
|
|
161
|
-
if (
|
|
162
|
-
for (s =
|
|
161
|
+
if (n = t.length, n != e.length) return !1;
|
|
162
|
+
for (s = n; s-- !== 0; )
|
|
163
163
|
if (t[s] !== e[s]) return !1;
|
|
164
164
|
return !0;
|
|
165
165
|
}
|
|
166
166
|
if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
|
|
167
167
|
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
|
|
168
168
|
if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
|
|
169
|
-
if (i = Object.keys(t),
|
|
170
|
-
for (s =
|
|
169
|
+
if (i = Object.keys(t), n = i.length, n !== Object.keys(e).length) return !1;
|
|
170
|
+
for (s = n; s-- !== 0; )
|
|
171
171
|
if (!Object.prototype.hasOwnProperty.call(e, i[s])) return !1;
|
|
172
|
-
for (s =
|
|
172
|
+
for (s = n; s-- !== 0; ) {
|
|
173
173
|
var u = i[s];
|
|
174
|
-
if (!
|
|
174
|
+
if (!r(t[u], e[u])) return !1;
|
|
175
175
|
}
|
|
176
176
|
return !0;
|
|
177
177
|
}
|
|
178
178
|
return t !== t && e !== e;
|
|
179
|
-
}),
|
|
179
|
+
}), G;
|
|
180
180
|
}
|
|
181
181
|
var Ht = Bt();
|
|
182
|
-
const Yt = /* @__PURE__ */
|
|
182
|
+
const Yt = /* @__PURE__ */ Mt(Ht), Zt = () => {
|
|
183
183
|
};
|
|
184
|
-
let
|
|
185
|
-
function
|
|
186
|
-
return
|
|
184
|
+
let K = 1;
|
|
185
|
+
function Z() {
|
|
186
|
+
return K = K % Number.MAX_SAFE_INTEGER + 1, K.toString(36) + Date.now().toString(36);
|
|
187
187
|
}
|
|
188
|
-
function Et(
|
|
189
|
-
return Object.is(
|
|
188
|
+
function Et(r, t) {
|
|
189
|
+
return Object.is(r, t);
|
|
190
190
|
}
|
|
191
|
-
function Ee(
|
|
192
|
-
if (Object.is(
|
|
193
|
-
const e = N(
|
|
191
|
+
function Ee(r, t) {
|
|
192
|
+
if (Object.is(r, t)) return !0;
|
|
193
|
+
const e = N(r);
|
|
194
194
|
if (e !== N(t))
|
|
195
195
|
return !1;
|
|
196
196
|
switch (e) {
|
|
197
197
|
case "object":
|
|
198
|
-
let
|
|
199
|
-
for (const s in
|
|
200
|
-
if (
|
|
201
|
-
|
|
198
|
+
let n = 0;
|
|
199
|
+
for (const s in r) {
|
|
200
|
+
if (r[s] !== t[s]) return !1;
|
|
201
|
+
n++;
|
|
202
202
|
}
|
|
203
|
-
return Object.keys(t).length ===
|
|
203
|
+
return Object.keys(t).length === n;
|
|
204
204
|
case "array":
|
|
205
|
-
if (
|
|
206
|
-
for (let s = 0; s <
|
|
207
|
-
if (
|
|
205
|
+
if (r.length !== t.length) return !1;
|
|
206
|
+
for (let s = 0; s < r.length; s++)
|
|
207
|
+
if (r[s] !== t[s]) return !1;
|
|
208
208
|
return !0;
|
|
209
209
|
case "map":
|
|
210
|
-
if (
|
|
211
|
-
for (const s of
|
|
212
|
-
if (
|
|
210
|
+
if (r.size !== t.size) return !1;
|
|
211
|
+
for (const s of r.keys())
|
|
212
|
+
if (r[s] !== t[s]) return !1;
|
|
213
213
|
return !0;
|
|
214
214
|
case "set":
|
|
215
|
-
if (
|
|
216
|
-
return
|
|
217
|
-
for (const s of
|
|
218
|
-
if (
|
|
215
|
+
if (q(r.symmetricDifference))
|
|
216
|
+
return r.symmetricDifference(t).size === 0;
|
|
217
|
+
for (const s of r.keys())
|
|
218
|
+
if (r[s] !== t.get(s)) return !1;
|
|
219
219
|
return !0;
|
|
220
220
|
}
|
|
221
221
|
return !1;
|
|
222
222
|
}
|
|
223
223
|
const Ae = Yt;
|
|
224
|
-
function Jt(
|
|
225
|
-
const e = (
|
|
224
|
+
function Jt(r, t) {
|
|
225
|
+
const e = (n) => {
|
|
226
226
|
const s = {};
|
|
227
|
-
for (const i in
|
|
228
|
-
|
|
227
|
+
for (const i in n)
|
|
228
|
+
r.includes(i) || (s[i] = n[i]);
|
|
229
229
|
return s;
|
|
230
230
|
};
|
|
231
231
|
return t == null ? e : e(t);
|
|
232
232
|
}
|
|
233
|
-
function Oe(
|
|
233
|
+
function Oe(r) {
|
|
234
234
|
return zt({
|
|
235
|
-
str:
|
|
235
|
+
str: r,
|
|
236
236
|
sat: { min: 0.35, max: 0.55 },
|
|
237
237
|
light: { min: 0.6, max: 0.6 }
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
-
function Ne(
|
|
241
|
-
if (
|
|
242
|
-
return (
|
|
240
|
+
function Ne(r) {
|
|
241
|
+
if (r instanceof RegExp)
|
|
242
|
+
return (n) => r.test(n);
|
|
243
243
|
const t = {
|
|
244
244
|
positive: [],
|
|
245
245
|
negative: []
|
|
246
|
-
}, e =
|
|
247
|
-
for (let
|
|
246
|
+
}, e = r.split(",").map((n) => n.trim()).filter((n) => n !== "");
|
|
247
|
+
for (let n of e) {
|
|
248
248
|
let s = "positive";
|
|
249
|
-
|
|
249
|
+
n.startsWith("-") && (s = "negative", n = n.slice(1)), n === "*" ? t[s].push(function() {
|
|
250
250
|
return !0;
|
|
251
|
-
}) :
|
|
252
|
-
return i.startsWith(
|
|
251
|
+
}) : n.endsWith("*") ? t[s].push(function(i) {
|
|
252
|
+
return i.startsWith(n.slice(0, n.length - 1));
|
|
253
253
|
}) : t[s].push(function(i) {
|
|
254
|
-
return i ===
|
|
254
|
+
return i === n;
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
-
return function(
|
|
257
|
+
return function(n) {
|
|
258
258
|
const { positive: s, negative: i } = t;
|
|
259
|
-
return !(i.some((u) => u(
|
|
259
|
+
return !(i.some((u) => u(n)) || s.length > 0 && !s.some((u) => u(n)));
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
var Xt = Object.defineProperty, Qt = (
|
|
262
|
+
var Xt = Object.defineProperty, Qt = (r, t, e) => t in r ? Xt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, ht = (r, t, e) => Qt(r, typeof t != "symbol" ? t + "" : t, e);
|
|
263
263
|
class j {
|
|
264
264
|
constructor() {
|
|
265
265
|
ht(this, "_l", /* @__PURE__ */ new Map()), ht(this, "_a", (t) => {
|
|
@@ -268,29 +268,29 @@ class j {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
emit(t, ...e) {
|
|
271
|
-
let
|
|
272
|
-
for (const s of
|
|
271
|
+
let n = this.listeners(t);
|
|
272
|
+
for (const s of n)
|
|
273
273
|
try {
|
|
274
274
|
s(...e);
|
|
275
275
|
} catch (i) {
|
|
276
276
|
let u = this._l.get("error");
|
|
277
277
|
if (u != null && u.length)
|
|
278
|
-
for (const
|
|
279
|
-
|
|
278
|
+
for (const a of u)
|
|
279
|
+
a(i, t, s, ...e);
|
|
280
280
|
else throw i;
|
|
281
281
|
}
|
|
282
|
-
return t != "*" && this.emit("*", t, ...e) ||
|
|
282
|
+
return t != "*" && this.emit("*", t, ...e) || n.length > 0;
|
|
283
283
|
}
|
|
284
284
|
on(t, e) {
|
|
285
285
|
return this.listeners(t).push(e), this;
|
|
286
286
|
}
|
|
287
287
|
off(t, e) {
|
|
288
|
-
const
|
|
289
|
-
return
|
|
288
|
+
const n = this.listeners(t);
|
|
289
|
+
return n.splice(n.indexOf(e), 1), this;
|
|
290
290
|
}
|
|
291
291
|
once(t, e) {
|
|
292
|
-
return this.on(t, (...
|
|
293
|
-
e(...
|
|
292
|
+
return this.on(t, (...n) => {
|
|
293
|
+
e(...n), this.off(t, e);
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
296
|
clear() {
|
|
@@ -319,20 +319,20 @@ class Ve {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
V = new WeakMap(), E = new WeakMap();
|
|
322
|
-
const
|
|
322
|
+
const B = Symbol.for("DollaStatsStore");
|
|
323
323
|
function lt() {
|
|
324
|
-
const
|
|
324
|
+
const r = new j(), t = {
|
|
325
325
|
watcherCount: 0,
|
|
326
326
|
viewCount: 0
|
|
327
327
|
};
|
|
328
|
-
return
|
|
329
|
-
t.viewCount += e,
|
|
330
|
-
}),
|
|
331
|
-
t.watcherCount += e,
|
|
332
|
-
}), { emitter:
|
|
328
|
+
return r.on("_incrementViewCount", (e) => {
|
|
329
|
+
t.viewCount += e, r.emit("statsChanged");
|
|
330
|
+
}), r.on("_incrementWatcherCount", (e) => {
|
|
331
|
+
t.watcherCount += e, r.emit("statsChanged");
|
|
332
|
+
}), { emitter: r, stats: t };
|
|
333
333
|
}
|
|
334
334
|
function W() {
|
|
335
|
-
return typeof window < "u" ? (window[
|
|
335
|
+
return typeof window < "u" ? (window[B] || (window[B] = lt()), window[B]) : lt();
|
|
336
336
|
}
|
|
337
337
|
function At() {
|
|
338
338
|
W().emitter.emit("_incrementWatcherCount", 1);
|
|
@@ -346,20 +346,20 @@ function te() {
|
|
|
346
346
|
function ee() {
|
|
347
347
|
W().emitter.emit("_incrementViewCount", -1);
|
|
348
348
|
}
|
|
349
|
-
const Nt = Symbol.for("DollaState"), Vt = Symbol.for("DollaRef"), $t = Symbol.for("DollaMarkup"),
|
|
350
|
-
function m(
|
|
351
|
-
return (
|
|
349
|
+
const Nt = Symbol.for("DollaState"), Vt = Symbol.for("DollaRef"), $t = Symbol.for("DollaMarkup"), M = Symbol.for("DollaMarkupElement"), ne = Symbol.for("DollaStore"), Wt = Symbol.for("DollaStoreFactory");
|
|
350
|
+
function m(r) {
|
|
351
|
+
return (r == null ? void 0 : r[Nt]) === !0;
|
|
352
352
|
}
|
|
353
|
-
function re(
|
|
354
|
-
return m(
|
|
353
|
+
function re(r) {
|
|
354
|
+
return m(r) ? r.get() : r;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
return m(
|
|
356
|
+
function J(r) {
|
|
357
|
+
return m(r) ? r : new X({
|
|
358
358
|
get() {
|
|
359
|
-
return
|
|
359
|
+
return r;
|
|
360
360
|
},
|
|
361
361
|
watch(t, e = {}) {
|
|
362
|
-
return e != null && e.lazy || t(
|
|
362
|
+
return e != null && e.lazy || t(r), Zt;
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
}
|
|
@@ -386,14 +386,14 @@ class se {
|
|
|
386
386
|
}
|
|
387
387
|
watch(t, e) {
|
|
388
388
|
return this.watchers.push(t), e != null && e.lazy || t(this.value), At(), () => {
|
|
389
|
-
const
|
|
390
|
-
|
|
389
|
+
const n = this.watchers.indexOf(t);
|
|
390
|
+
n > -1 && this.watchers.splice(n, 1), Ot();
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
var mt;
|
|
395
395
|
mt = Nt;
|
|
396
|
-
class
|
|
396
|
+
class X {
|
|
397
397
|
constructor(t) {
|
|
398
398
|
o(this, mt, !0);
|
|
399
399
|
o(this, "__value");
|
|
@@ -406,13 +406,13 @@ class J {
|
|
|
406
406
|
return this.__value.watch(t, e);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
const e = new se(
|
|
411
|
-
return [new
|
|
409
|
+
function Y(r, t) {
|
|
410
|
+
const e = new se(r, t);
|
|
411
|
+
return [new X(e), (s) => e.set(s)];
|
|
412
412
|
}
|
|
413
413
|
const ft = Symbol("EMPTY");
|
|
414
414
|
class ie {
|
|
415
|
-
constructor(t, e,
|
|
415
|
+
constructor(t, e, n) {
|
|
416
416
|
o(this, "equals", Et);
|
|
417
417
|
/**
|
|
418
418
|
* Array of states this holder's value is derived from.
|
|
@@ -425,7 +425,7 @@ class ie {
|
|
|
425
425
|
/**
|
|
426
426
|
*
|
|
427
427
|
*/
|
|
428
|
-
o(this, "sourceWatcher",
|
|
428
|
+
o(this, "sourceWatcher", D());
|
|
429
429
|
/**
|
|
430
430
|
* Array of functions awaiting notification when this holder's value changes.
|
|
431
431
|
*/
|
|
@@ -450,7 +450,7 @@ class ie {
|
|
|
450
450
|
* When value is a State, this function will stop watching its value.
|
|
451
451
|
*/
|
|
452
452
|
o(this, "stopWatchingCurrentValue");
|
|
453
|
-
this.sources = t.map(
|
|
453
|
+
this.sources = t.map(J), this.fn = e, n != null && n.equals && (this.equals = n.equals), this.previousSourceValues = new Array(t.length).fill(ft, 0, t.length);
|
|
454
454
|
}
|
|
455
455
|
/*==========================*\
|
|
456
456
|
|| "Public" methods ||
|
|
@@ -460,9 +460,9 @@ class ie {
|
|
|
460
460
|
}
|
|
461
461
|
watch(t, e) {
|
|
462
462
|
this.isWatchingSources || this.startWatchingSources();
|
|
463
|
-
const
|
|
464
|
-
return
|
|
465
|
-
|
|
463
|
+
const n = this.watchers;
|
|
464
|
+
return n.push(t), e != null && e.lazy || t(this.rawValue), At(), () => {
|
|
465
|
+
n.splice(n.indexOf(t), 1), this.isWatchingSources && n.length === 0 && this.stopWatchingSources(), Ot();
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
468
|
/*==========================*\
|
|
@@ -474,10 +474,10 @@ class ie {
|
|
|
474
474
|
}
|
|
475
475
|
update() {
|
|
476
476
|
const t = this.sources, e = this.previousSourceValues;
|
|
477
|
-
let
|
|
477
|
+
let n = !1, s;
|
|
478
478
|
for (let i = 0; i < t.length; i++)
|
|
479
|
-
s = t[i].get(), !
|
|
480
|
-
|
|
479
|
+
s = t[i].get(), !n && !this.equals(s, e[i]) && (n = !0), e[i] = s;
|
|
480
|
+
n && this.setValue(this.fn(...e));
|
|
481
481
|
}
|
|
482
482
|
getValue() {
|
|
483
483
|
return this.isWatchingSources || this.update(), this.rawValue;
|
|
@@ -489,9 +489,9 @@ class ie {
|
|
|
489
489
|
}
|
|
490
490
|
startWatchingSources() {
|
|
491
491
|
const t = this.previousSourceValues;
|
|
492
|
-
for (let
|
|
493
|
-
this.sourceWatcher.watch([this.sources[
|
|
494
|
-
if (t[
|
|
492
|
+
for (let n = 0; n < this.sources.length; n++)
|
|
493
|
+
this.sourceWatcher.watch([this.sources[n]], (s) => {
|
|
494
|
+
if (t[n] = s, this.isWatchingSources) {
|
|
495
495
|
const i = this.fn(...t);
|
|
496
496
|
this.equals(i, this.value) || this.setValue(i);
|
|
497
497
|
}
|
|
@@ -504,41 +504,41 @@ class ie {
|
|
|
504
504
|
this.sourceWatcher.stopAll(), this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.isWatchingSources = !1;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function oe(
|
|
508
|
-
const
|
|
509
|
-
return new
|
|
507
|
+
function oe(r, t, e) {
|
|
508
|
+
const n = new ie(r, t, e);
|
|
509
|
+
return new X(n);
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
const
|
|
511
|
+
function D() {
|
|
512
|
+
const r = [];
|
|
513
513
|
return {
|
|
514
514
|
watch(t, e) {
|
|
515
515
|
if (t.length === 0)
|
|
516
516
|
throw new TypeError("Expected at least one state to watch.");
|
|
517
|
-
t = t.map(
|
|
518
|
-
let
|
|
519
|
-
return t.length > 1 ?
|
|
520
|
-
let s =
|
|
521
|
-
s > -1 &&
|
|
517
|
+
t = t.map(J);
|
|
518
|
+
let n;
|
|
519
|
+
return t.length > 1 ? n = oe(t, e).watch(() => null) : n = t[0].watch(e), r.push(n), () => {
|
|
520
|
+
let s = r.indexOf(n);
|
|
521
|
+
s > -1 && r.splice(s, 1), n();
|
|
522
522
|
};
|
|
523
523
|
},
|
|
524
524
|
stopAll() {
|
|
525
|
-
for (;
|
|
526
|
-
|
|
525
|
+
for (; r.length > 0; )
|
|
526
|
+
r.pop()();
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
529
|
}
|
|
530
|
-
function $e(
|
|
530
|
+
function $e(r) {
|
|
531
531
|
function t() {
|
|
532
532
|
if (arguments.length === 1)
|
|
533
|
-
|
|
533
|
+
r = arguments[0];
|
|
534
534
|
else if (arguments.length > 1)
|
|
535
535
|
throw new Error(`Too many arguments. Expected 0 or 1. Got: ${arguments.length}`);
|
|
536
|
-
return
|
|
536
|
+
return r;
|
|
537
537
|
}
|
|
538
538
|
return t[Vt] = !0, t;
|
|
539
539
|
}
|
|
540
|
-
function ue(
|
|
541
|
-
return (
|
|
540
|
+
function ue(r) {
|
|
541
|
+
return (r == null ? void 0 : r[Vt]) === !0;
|
|
542
542
|
}
|
|
543
543
|
var $;
|
|
544
544
|
class Q {
|
|
@@ -560,13 +560,16 @@ class Q {
|
|
|
560
560
|
// stopImmediatePropagation() {}
|
|
561
561
|
}
|
|
562
562
|
$ = new WeakMap();
|
|
563
|
-
let
|
|
563
|
+
let ae = class {
|
|
564
564
|
constructor(t) {
|
|
565
565
|
o(this, "__store");
|
|
566
566
|
this.__store = t;
|
|
567
567
|
const e = Object.getOwnPropertyDescriptors(this.__store._logger);
|
|
568
|
-
for (const
|
|
569
|
-
|
|
568
|
+
for (const n in e)
|
|
569
|
+
n !== "setName" && Object.defineProperty(this, n, e[n]);
|
|
570
|
+
}
|
|
571
|
+
get isMounted() {
|
|
572
|
+
return this.__store.isMounted;
|
|
570
573
|
}
|
|
571
574
|
setName(t) {
|
|
572
575
|
return this.__store._logger.setName(t), this;
|
|
@@ -604,9 +607,22 @@ let ce = class {
|
|
|
604
607
|
onUnmount(t) {
|
|
605
608
|
this.__store._emitter.on("unmounted", t);
|
|
606
609
|
}
|
|
610
|
+
watch(t, e) {
|
|
611
|
+
const n = this.__store;
|
|
612
|
+
if (n.isMounted)
|
|
613
|
+
return n._watcher.watch(t, e);
|
|
614
|
+
{
|
|
615
|
+
let s, i = !1;
|
|
616
|
+
return n._emitter.on("mounted", () => {
|
|
617
|
+
i || (s = n._watcher.watch(t, e));
|
|
618
|
+
}), () => {
|
|
619
|
+
s != null && (i = !0, s());
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
}
|
|
607
623
|
};
|
|
608
|
-
class
|
|
609
|
-
constructor(t, e,
|
|
624
|
+
class ce {
|
|
625
|
+
constructor(t, e, n) {
|
|
610
626
|
o(this, "key");
|
|
611
627
|
o(this, "_fn");
|
|
612
628
|
o(this, "_options");
|
|
@@ -614,57 +630,68 @@ class ae {
|
|
|
614
630
|
* Value is guaranteed to be set after `attach` is called.
|
|
615
631
|
*/
|
|
616
632
|
o(this, "value");
|
|
633
|
+
o(this, "isMounted", !1);
|
|
617
634
|
o(this, "_elementContext");
|
|
618
635
|
o(this, "_emitter", new j());
|
|
619
636
|
o(this, "_logger");
|
|
620
|
-
this
|
|
637
|
+
o(this, "_watcher", D());
|
|
638
|
+
this.key = t, this._fn = e, this._options = n;
|
|
639
|
+
}
|
|
640
|
+
get name() {
|
|
641
|
+
return this._fn.name;
|
|
621
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Attaches this Store to the elementContext.
|
|
645
|
+
* Returns false if there was already an instance attached, and true otherwise.
|
|
646
|
+
*/
|
|
622
647
|
attach(t) {
|
|
623
|
-
|
|
624
|
-
|
|
648
|
+
if (t.stores.has(this.key))
|
|
649
|
+
return !1;
|
|
650
|
+
this._elementContext = t, this._logger = t.root.createLogger(this._fn.name), this._emitter.on("error", (n, s, ...i) => {
|
|
651
|
+
console.log({ error: n, eventName: s, args: i }), this._logger.crash(n);
|
|
625
652
|
});
|
|
626
|
-
const e = new
|
|
653
|
+
const e = new ae(this);
|
|
627
654
|
try {
|
|
628
655
|
this.value = this._fn.call(e, this._options, e);
|
|
629
|
-
} catch (
|
|
630
|
-
this._logger.crash(
|
|
656
|
+
} catch (n) {
|
|
657
|
+
this._logger.crash(n);
|
|
631
658
|
}
|
|
632
|
-
t.stores.set(this.key, this);
|
|
659
|
+
return t.stores.set(this.key, this), !0;
|
|
633
660
|
}
|
|
634
661
|
handleMount() {
|
|
635
|
-
this._emitter.emit("mounted");
|
|
662
|
+
this.isMounted = !0, this._emitter.emit("mounted");
|
|
636
663
|
}
|
|
637
664
|
handleUnmount() {
|
|
638
|
-
this._emitter.emit("unmounted"), this._emitter.clear();
|
|
665
|
+
this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
|
|
639
666
|
}
|
|
640
667
|
}
|
|
641
|
-
function he(
|
|
642
|
-
return (
|
|
668
|
+
function he(r) {
|
|
669
|
+
return (r == null ? void 0 : r[Wt]) === !0;
|
|
643
670
|
}
|
|
644
|
-
function le(
|
|
645
|
-
return (
|
|
671
|
+
function le(r) {
|
|
672
|
+
return (r == null ? void 0 : r[ne]) === !0;
|
|
646
673
|
}
|
|
647
|
-
function Fe(
|
|
648
|
-
const t =
|
|
649
|
-
function e(
|
|
650
|
-
return new
|
|
674
|
+
function Fe(r) {
|
|
675
|
+
const t = Z();
|
|
676
|
+
function e(n) {
|
|
677
|
+
return new ce(t, r, n);
|
|
651
678
|
}
|
|
652
679
|
return e[Wt] = !0, e.key = t, e;
|
|
653
680
|
}
|
|
654
|
-
class
|
|
681
|
+
class H extends Error {
|
|
655
682
|
}
|
|
656
|
-
function fe(
|
|
657
|
-
for (var t, e,
|
|
658
|
-
s === 1 && (l || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ?
|
|
659
|
-
},
|
|
660
|
-
|
|
661
|
-
for (var f = 0; f <
|
|
662
|
-
` || t === "\r" ? (h(), s = 2) : i += t), s === 3 && i === "!--" && (s = 4,
|
|
683
|
+
function fe(r) {
|
|
684
|
+
for (var t, e, n = arguments, s = 1, i = "", u = "", a = [0], h = function(l) {
|
|
685
|
+
s === 1 && (l || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? a.push(l ? n[l] : i) : s === 3 && (l || i) ? (a[1] = l ? n[l] : i, s = 2) : s === 2 && i === "..." && l ? a[2] = Object.assign(a[2] || {}, n[l]) : s === 2 && i && !l ? (a[2] = a[2] || {})[i] = !0 : s >= 5 && (s === 5 ? ((a[2] = a[2] || {})[e] = l ? i ? i + n[l] : n[l] : i, s = 6) : (l || i) && (a[2][e] += l ? i + n[l] : i)), i = "";
|
|
686
|
+
}, c = 0; c < r.length; c++) {
|
|
687
|
+
c && (s === 1 && h(), h(c));
|
|
688
|
+
for (var f = 0; f < r[c].length; f++) t = r[c][f], s === 1 ? t === "<" ? (h(), a = [a, "", null], s = 3) : i += t : s === 4 ? i === "--" && t === ">" ? (s = 1, i = "") : i = t + i[0] : u ? t === u ? u = "" : i += t : t === '"' || t === "'" ? u = t : t === ">" ? (h(), s = 1) : s && (t === "=" ? (s = 5, e = i, i = "") : t === "/" && (s < 5 || r[c][f + 1] === ">") ? (h(), s === 3 && (a = a[0]), s = a, (a = a[0]).push(this.apply(null, s.slice(1))), s = 0) : t === " " || t === " " || t === `
|
|
689
|
+
` || t === "\r" ? (h(), s = 2) : i += t), s === 3 && i === "!--" && (s = 4, a = a[0]);
|
|
663
690
|
}
|
|
664
|
-
return h(),
|
|
691
|
+
return h(), a.length > 2 ? a.slice(1) : a[1];
|
|
665
692
|
}
|
|
666
693
|
var _t;
|
|
667
|
-
_t =
|
|
694
|
+
_t = M;
|
|
668
695
|
class dt {
|
|
669
696
|
constructor(t) {
|
|
670
697
|
o(this, _t, !0);
|
|
@@ -681,11 +708,11 @@ class dt {
|
|
|
681
708
|
this.node.parentNode && !t && this.node.parentNode.removeChild(this.node);
|
|
682
709
|
}
|
|
683
710
|
}
|
|
684
|
-
const de = (
|
|
711
|
+
const de = (r) => /^on[A-Z]/.test(r);
|
|
685
712
|
var gt;
|
|
686
|
-
gt =
|
|
713
|
+
gt = M;
|
|
687
714
|
class pe {
|
|
688
|
-
constructor({ tag: t, props: e, children:
|
|
715
|
+
constructor({ tag: t, props: e, children: n, elementContext: s }) {
|
|
689
716
|
o(this, gt, !0);
|
|
690
717
|
o(this, "node");
|
|
691
718
|
o(this, "props");
|
|
@@ -693,7 +720,7 @@ class pe {
|
|
|
693
720
|
o(this, "children", []);
|
|
694
721
|
o(this, "stopCallbacks", []);
|
|
695
722
|
o(this, "elementContext");
|
|
696
|
-
o(this, "uniqueId",
|
|
723
|
+
o(this, "uniqueId", Z());
|
|
697
724
|
o(this, "_batchWrite");
|
|
698
725
|
// Track the ref so we can nullify it on unmount.
|
|
699
726
|
o(this, "ref");
|
|
@@ -707,7 +734,7 @@ class pe {
|
|
|
707
734
|
this.props = {
|
|
708
735
|
...Jt(["ref", "class", "className"], e),
|
|
709
736
|
class: e.className ?? e.class
|
|
710
|
-
},
|
|
737
|
+
}, n && (this.childMarkup = n), this.elementContext = s, this.children = k(this.elementContext, this.childMarkup);
|
|
711
738
|
}
|
|
712
739
|
get isMounted() {
|
|
713
740
|
return this.node.parentNode != null;
|
|
@@ -716,8 +743,8 @@ class pe {
|
|
|
716
743
|
if (t == null)
|
|
717
744
|
throw new Error(`HTML element requires a parent element as the first argument to connect. Got: ${t}`);
|
|
718
745
|
if (!this.isMounted) {
|
|
719
|
-
for (let
|
|
720
|
-
const s = this.children[
|
|
746
|
+
for (let n = 0; n < this.children.length; n++) {
|
|
747
|
+
const s = this.children[n], i = n > 0 ? this.children[n - 1].node : void 0;
|
|
721
748
|
s.mount(this.node, i);
|
|
722
749
|
}
|
|
723
750
|
this.applyProps(this.node, this.props), this.props.style && this.applyStyles(this.node, this.props.style, this.stopCallbacks), this.props.class && this.applyClasses(this.node, this.props.class, this.stopCallbacks);
|
|
@@ -729,11 +756,11 @@ class pe {
|
|
|
729
756
|
unmount(t = !1) {
|
|
730
757
|
var e;
|
|
731
758
|
if (this.isMounted) {
|
|
732
|
-
for (const
|
|
733
|
-
|
|
759
|
+
for (const n of this.children)
|
|
760
|
+
n.unmount(!0);
|
|
734
761
|
t || (e = this.node.parentNode) == null || e.removeChild(this.node), this.ref && this.ref(void 0), this.canClickAway = !1;
|
|
735
|
-
for (const
|
|
736
|
-
|
|
762
|
+
for (const n of this.stopCallbacks)
|
|
763
|
+
n();
|
|
737
764
|
this.stopCallbacks = [];
|
|
738
765
|
}
|
|
739
766
|
}
|
|
@@ -743,73 +770,73 @@ class pe {
|
|
|
743
770
|
_mutate(t, e) {
|
|
744
771
|
this.isMounted ? this._batchWrite(t, e) : t();
|
|
745
772
|
}
|
|
746
|
-
attachProp(t, e,
|
|
773
|
+
attachProp(t, e, n) {
|
|
747
774
|
m(t) ? this.stopCallbacks.push(
|
|
748
775
|
t.watch((s) => {
|
|
749
|
-
this._mutate(() => e(s),
|
|
776
|
+
this._mutate(() => e(s), n);
|
|
750
777
|
})
|
|
751
|
-
) : this._mutate(() => e(t),
|
|
778
|
+
) : this._mutate(() => e(t), n);
|
|
752
779
|
}
|
|
753
780
|
applyProps(t, e) {
|
|
754
|
-
for (const
|
|
755
|
-
const s = e[
|
|
756
|
-
if (
|
|
781
|
+
for (const n in e) {
|
|
782
|
+
const s = e[n];
|
|
783
|
+
if (n === "attributes") {
|
|
757
784
|
const i = s;
|
|
758
785
|
for (const u in i)
|
|
759
786
|
this.attachProp(
|
|
760
787
|
i[u],
|
|
761
|
-
(
|
|
762
|
-
|
|
788
|
+
(a) => {
|
|
789
|
+
a == null ? t.removeAttribute(u) : t.setAttribute(u, String(a));
|
|
763
790
|
},
|
|
764
791
|
this.getUpdateKey("attr", u)
|
|
765
792
|
);
|
|
766
|
-
} else if (
|
|
793
|
+
} else if (n === "eventListeners") {
|
|
767
794
|
const i = s;
|
|
768
795
|
for (const u in i) {
|
|
769
|
-
const
|
|
770
|
-
t.addEventListener(u,
|
|
771
|
-
t.removeEventListener(u,
|
|
796
|
+
const a = m(s) ? (h) => s.get()(h) : s;
|
|
797
|
+
t.addEventListener(u, a), this.stopCallbacks.push(() => {
|
|
798
|
+
t.removeEventListener(u, a);
|
|
772
799
|
});
|
|
773
800
|
}
|
|
774
|
-
} else if (
|
|
775
|
-
const i = (
|
|
776
|
-
this.canClickAway && !t.contains(
|
|
801
|
+
} else if (n === "onClickOutside" || n === "onclickoutside") {
|
|
802
|
+
const i = (a) => {
|
|
803
|
+
this.canClickAway && !t.contains(a.target) && (m(s) ? s.get()(a) : s(a));
|
|
777
804
|
}, u = { capture: !0 };
|
|
778
805
|
window.addEventListener("click", i, u), this.stopCallbacks.push(() => {
|
|
779
806
|
window.removeEventListener("click", i, u);
|
|
780
807
|
});
|
|
781
|
-
} else if (de(
|
|
782
|
-
const i =
|
|
808
|
+
} else if (de(n)) {
|
|
809
|
+
const i = n.slice(2).toLowerCase(), u = m(s) ? (a) => s.get()(a) : s;
|
|
783
810
|
t.addEventListener(i, u), this.stopCallbacks.push(() => {
|
|
784
811
|
t.removeEventListener(i, u);
|
|
785
812
|
});
|
|
786
|
-
} else if (
|
|
813
|
+
} else if (n.includes("-"))
|
|
787
814
|
this.attachProp(
|
|
788
815
|
s,
|
|
789
816
|
(i) => {
|
|
790
|
-
i == null ? t.removeAttribute(
|
|
817
|
+
i == null ? t.removeAttribute(n) : t.setAttribute(n, String(i));
|
|
791
818
|
},
|
|
792
|
-
this.getUpdateKey("attr",
|
|
819
|
+
this.getUpdateKey("attr", n)
|
|
793
820
|
);
|
|
794
|
-
else if (!me.includes(
|
|
821
|
+
else if (!me.includes(n))
|
|
795
822
|
if (this.elementContext.isSVG)
|
|
796
823
|
this.attachProp(
|
|
797
824
|
s,
|
|
798
825
|
(i) => {
|
|
799
|
-
i != null ? t.setAttribute(
|
|
826
|
+
i != null ? t.setAttribute(n, String(e[n])) : t.removeAttribute(n);
|
|
800
827
|
},
|
|
801
|
-
this.getUpdateKey("attr",
|
|
828
|
+
this.getUpdateKey("attr", n)
|
|
802
829
|
);
|
|
803
830
|
else
|
|
804
|
-
switch (
|
|
831
|
+
switch (n) {
|
|
805
832
|
case "contentEditable":
|
|
806
833
|
case "value":
|
|
807
834
|
this.attachProp(
|
|
808
835
|
s,
|
|
809
836
|
(i) => {
|
|
810
|
-
t[
|
|
837
|
+
t[n] = String(i);
|
|
811
838
|
},
|
|
812
|
-
this.getUpdateKey("prop",
|
|
839
|
+
this.getUpdateKey("prop", n)
|
|
813
840
|
);
|
|
814
841
|
break;
|
|
815
842
|
case "for":
|
|
@@ -836,7 +863,7 @@ class pe {
|
|
|
836
863
|
case "translate":
|
|
837
864
|
case "type":
|
|
838
865
|
case "title": {
|
|
839
|
-
const i =
|
|
866
|
+
const i = n.toLowerCase();
|
|
840
867
|
this.attachProp(
|
|
841
868
|
s,
|
|
842
869
|
(u) => {
|
|
@@ -853,142 +880,142 @@ class pe {
|
|
|
853
880
|
(i) => {
|
|
854
881
|
typeof i == "string" ? t.autocomplete = i : i ? t.autocomplete = "on" : t.autocomplete = "off";
|
|
855
882
|
},
|
|
856
|
-
this.getUpdateKey("prop",
|
|
883
|
+
this.getUpdateKey("prop", n)
|
|
857
884
|
);
|
|
858
885
|
break;
|
|
859
886
|
default: {
|
|
860
887
|
this.attachProp(
|
|
861
888
|
s,
|
|
862
889
|
(i) => {
|
|
863
|
-
t[
|
|
890
|
+
t[n] = i;
|
|
864
891
|
},
|
|
865
|
-
this.getUpdateKey("prop",
|
|
892
|
+
this.getUpdateKey("prop", n)
|
|
866
893
|
);
|
|
867
894
|
break;
|
|
868
895
|
}
|
|
869
896
|
}
|
|
870
897
|
}
|
|
871
898
|
}
|
|
872
|
-
applyStyles(t, e,
|
|
899
|
+
applyStyles(t, e, n) {
|
|
873
900
|
const s = [];
|
|
874
901
|
if (m(e)) {
|
|
875
902
|
let i;
|
|
876
|
-
const u = e.watch((
|
|
903
|
+
const u = e.watch((a) => {
|
|
877
904
|
this._mutate(
|
|
878
905
|
() => {
|
|
879
|
-
|
|
906
|
+
q(i) && i(), t.style.cssText = "", i = this.applyStyles(t, a, n);
|
|
880
907
|
},
|
|
881
908
|
this.getUpdateKey("styles", "*")
|
|
882
909
|
);
|
|
883
910
|
});
|
|
884
|
-
|
|
911
|
+
n.push(u), s.push(u);
|
|
885
912
|
} else {
|
|
886
913
|
const i = Pt(e);
|
|
887
914
|
for (const u in i) {
|
|
888
|
-
const { value:
|
|
889
|
-
if (m(
|
|
890
|
-
const
|
|
915
|
+
const { value: a, priority: h } = i[u];
|
|
916
|
+
if (m(a)) {
|
|
917
|
+
const c = a.watch((f) => {
|
|
891
918
|
this._mutate(() => {
|
|
892
919
|
f ? t.style.setProperty(u, String(f), h) : t.style.removeProperty(u);
|
|
893
920
|
});
|
|
894
921
|
});
|
|
895
|
-
|
|
896
|
-
} else
|
|
922
|
+
n.push(c), s.push(c);
|
|
923
|
+
} else a != null && t.style.setProperty(u, String(a));
|
|
897
924
|
}
|
|
898
925
|
}
|
|
899
926
|
return function() {
|
|
900
927
|
for (const u of s)
|
|
901
|
-
u(),
|
|
928
|
+
u(), n.splice(n.indexOf(u), 1);
|
|
902
929
|
};
|
|
903
930
|
}
|
|
904
|
-
applyClasses(t, e,
|
|
931
|
+
applyClasses(t, e, n) {
|
|
905
932
|
const s = [];
|
|
906
933
|
if (m(e)) {
|
|
907
934
|
let i;
|
|
908
|
-
const u = e.watch((
|
|
935
|
+
const u = e.watch((a) => {
|
|
909
936
|
this._mutate(
|
|
910
937
|
() => {
|
|
911
|
-
|
|
938
|
+
q(i) && i(), t.removeAttribute("class"), i = this.applyClasses(t, a, n);
|
|
912
939
|
},
|
|
913
940
|
this.getUpdateKey("attr", "class")
|
|
914
941
|
);
|
|
915
942
|
});
|
|
916
|
-
|
|
943
|
+
n.push(u), s.push(u);
|
|
917
944
|
} else {
|
|
918
945
|
const i = Ft(e);
|
|
919
946
|
for (const u in i) {
|
|
920
|
-
const
|
|
921
|
-
if (m(
|
|
922
|
-
const h =
|
|
947
|
+
const a = i[u];
|
|
948
|
+
if (m(a)) {
|
|
949
|
+
const h = a.watch((c) => {
|
|
923
950
|
this._mutate(() => {
|
|
924
|
-
|
|
951
|
+
c ? t.classList.add(u) : t.classList.remove(u);
|
|
925
952
|
});
|
|
926
953
|
});
|
|
927
|
-
|
|
928
|
-
} else
|
|
954
|
+
n.push(h), s.push(h);
|
|
955
|
+
} else a && t.classList.add(u);
|
|
929
956
|
}
|
|
930
957
|
}
|
|
931
958
|
return function() {
|
|
932
959
|
for (const u of s)
|
|
933
|
-
u(),
|
|
960
|
+
u(), n.splice(n.indexOf(u), 1);
|
|
934
961
|
};
|
|
935
962
|
}
|
|
936
963
|
}
|
|
937
|
-
function Ft(
|
|
964
|
+
function Ft(r) {
|
|
938
965
|
let t = {};
|
|
939
|
-
if (b(
|
|
940
|
-
const e =
|
|
941
|
-
for (const
|
|
942
|
-
t[
|
|
943
|
-
} else bt(
|
|
966
|
+
if (b(r)) {
|
|
967
|
+
const e = r.split(" ");
|
|
968
|
+
for (const n of e)
|
|
969
|
+
t[n] = !0;
|
|
970
|
+
} else bt(r) ? Object.assign(t, r) : Array.isArray(r) && Array.from(r).filter(Boolean).forEach((e) => {
|
|
944
971
|
Object.assign(t, Ft(e));
|
|
945
972
|
});
|
|
946
973
|
return delete t.undefined, t;
|
|
947
974
|
}
|
|
948
|
-
function Pt(
|
|
975
|
+
function Pt(r) {
|
|
949
976
|
let t = {};
|
|
950
|
-
if (b(
|
|
951
|
-
const e =
|
|
952
|
-
for (const
|
|
953
|
-
const [s, i] =
|
|
977
|
+
if (b(r)) {
|
|
978
|
+
const e = r.split(";").filter((n) => n.trim() !== "");
|
|
979
|
+
for (const n of e) {
|
|
980
|
+
const [s, i] = n.split(":"), u = {
|
|
954
981
|
value: i
|
|
955
982
|
};
|
|
956
983
|
i.includes("!important") ? (u.priority = "important", u.value = i.replace("!important", "").trim()) : u.value = i.trim(), t[pt(s.trim())] = u;
|
|
957
984
|
}
|
|
958
985
|
}
|
|
959
|
-
if (bt(
|
|
960
|
-
for (const e in
|
|
961
|
-
e.startsWith("--") ? t[e] = { value:
|
|
962
|
-
else Array.isArray(
|
|
986
|
+
if (bt(r))
|
|
987
|
+
for (const e in r)
|
|
988
|
+
e.startsWith("--") ? t[e] = { value: r[e] } : t[pt(e)] = { value: r[e] };
|
|
989
|
+
else Array.isArray(r) && Array.from(r).filter((e) => e != null).forEach((e) => {
|
|
963
990
|
Object.assign(t, Pt(e));
|
|
964
991
|
});
|
|
965
992
|
return t;
|
|
966
993
|
}
|
|
967
|
-
function pt(
|
|
968
|
-
return
|
|
994
|
+
function pt(r) {
|
|
995
|
+
return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
|
|
969
996
|
}
|
|
970
997
|
const me = ["ref", "children", "class", "style", "data"];
|
|
971
998
|
var wt;
|
|
972
|
-
wt =
|
|
999
|
+
wt = M;
|
|
973
1000
|
class _e {
|
|
974
|
-
constructor({ sources: t, renderFn: e, elementContext:
|
|
1001
|
+
constructor({ sources: t, renderFn: e, elementContext: n }) {
|
|
975
1002
|
o(this, wt, !0);
|
|
976
1003
|
o(this, "node", document.createTextNode(""));
|
|
977
1004
|
o(this, "children", []);
|
|
978
1005
|
o(this, "renderFn");
|
|
979
1006
|
o(this, "elementContext");
|
|
980
|
-
o(this, "watcher",
|
|
1007
|
+
o(this, "watcher", D());
|
|
981
1008
|
o(this, "sources");
|
|
982
|
-
this.sources = t, this.renderFn = e, this.elementContext =
|
|
1009
|
+
this.sources = t, this.renderFn = e, this.elementContext = n;
|
|
983
1010
|
}
|
|
984
1011
|
get isMounted() {
|
|
985
1012
|
return this.node.parentNode != null;
|
|
986
1013
|
}
|
|
987
1014
|
mount(t, e) {
|
|
988
|
-
this.isMounted || (t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), this.watcher.watch(this.sources, (...
|
|
989
|
-
const s = this.renderFn(...
|
|
990
|
-
if (!
|
|
991
|
-
throw console.error(s,
|
|
1015
|
+
this.isMounted || (t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), this.watcher.watch(this.sources, (...n) => {
|
|
1016
|
+
const s = this.renderFn(...n);
|
|
1017
|
+
if (!qt(s))
|
|
1018
|
+
throw console.error(s, n), new TypeError(
|
|
992
1019
|
`Observer received invalid value to render. Got type: ${N(s)}, value: ${s}`
|
|
993
1020
|
);
|
|
994
1021
|
this.update(A(s) ? s : [s]);
|
|
@@ -1004,20 +1031,20 @@ class _e {
|
|
|
1004
1031
|
this.children = [];
|
|
1005
1032
|
}
|
|
1006
1033
|
update(t) {
|
|
1007
|
-
var i, u,
|
|
1034
|
+
var i, u, a;
|
|
1008
1035
|
if (this.cleanup(!1), t == null || t.length === 0 || !this.isMounted)
|
|
1009
1036
|
return;
|
|
1010
|
-
const e = t.flatMap((h) =>
|
|
1037
|
+
const e = t.flatMap((h) => It(h) ? h : k(this.elementContext, tt(h)));
|
|
1011
1038
|
for (const h of e) {
|
|
1012
|
-
const
|
|
1013
|
-
h.mount(this.node.parentNode,
|
|
1039
|
+
const c = ((i = this.children.at(-1)) == null ? void 0 : i.node) || this.node;
|
|
1040
|
+
h.mount(this.node.parentNode, c), this.children.push(h);
|
|
1014
1041
|
}
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1042
|
+
const n = this.node.parentNode, s = ((a = (u = this.children.at(-1)) == null ? void 0 : u.node) == null ? void 0 : a.nextSibling) ?? null;
|
|
1043
|
+
n.insertBefore(this.node, s);
|
|
1017
1044
|
}
|
|
1018
1045
|
}
|
|
1019
1046
|
var yt;
|
|
1020
|
-
yt =
|
|
1047
|
+
yt = M;
|
|
1021
1048
|
class Tt {
|
|
1022
1049
|
constructor(t) {
|
|
1023
1050
|
o(this, yt, !0);
|
|
@@ -1029,8 +1056,8 @@ class Tt {
|
|
|
1029
1056
|
this.source = t;
|
|
1030
1057
|
}
|
|
1031
1058
|
mount(t, e) {
|
|
1032
|
-
this.isMounted || (this.isMounted = !0, t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), m(this.source) ? this.stopCallback = this.source.watch((
|
|
1033
|
-
this.update(
|
|
1059
|
+
this.isMounted || (this.isMounted = !0, t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), m(this.source) ? this.stopCallback = this.source.watch((n) => {
|
|
1060
|
+
this.update(n);
|
|
1034
1061
|
}) : this.update(this.elements));
|
|
1035
1062
|
}
|
|
1036
1063
|
unmount(t = !1) {
|
|
@@ -1042,18 +1069,18 @@ class Tt {
|
|
|
1042
1069
|
this.elements = [];
|
|
1043
1070
|
}
|
|
1044
1071
|
update(t) {
|
|
1045
|
-
var e,
|
|
1072
|
+
var e, n;
|
|
1046
1073
|
if (this.cleanup(!1), t.length > 0) {
|
|
1047
1074
|
for (let s = 0; s < t.length; s++) {
|
|
1048
1075
|
const i = t[s], u = s > 0 ? this.elements[s - 1] : void 0;
|
|
1049
1076
|
i.mount(this.node.parentElement, u == null ? void 0 : u.node), this.elements.push(i);
|
|
1050
1077
|
}
|
|
1051
|
-
(
|
|
1078
|
+
(n = this.node.parentNode) == null || n.insertBefore(this.node, ((e = this.elements.at(-1)) == null ? void 0 : e.node) ?? null);
|
|
1052
1079
|
}
|
|
1053
1080
|
}
|
|
1054
1081
|
}
|
|
1055
1082
|
var St;
|
|
1056
|
-
St =
|
|
1083
|
+
St = M;
|
|
1057
1084
|
class ge {
|
|
1058
1085
|
constructor(t) {
|
|
1059
1086
|
o(this, St, !0);
|
|
@@ -1065,28 +1092,31 @@ class ge {
|
|
|
1065
1092
|
return this.element ? this.element.isMounted : !1;
|
|
1066
1093
|
}
|
|
1067
1094
|
mount(t, e) {
|
|
1068
|
-
const { content:
|
|
1069
|
-
|
|
1095
|
+
const { content: n, parent: s } = this.config;
|
|
1096
|
+
It(n) ? this.element = n : this.element = I(k(this.config.elementContext, tt(n))), this.element.mount(s);
|
|
1070
1097
|
}
|
|
1071
1098
|
unmount(t = !1) {
|
|
1072
1099
|
var e;
|
|
1073
1100
|
(e = this.element) != null && e.isMounted && this.element.unmount(t);
|
|
1074
1101
|
}
|
|
1075
1102
|
}
|
|
1076
|
-
function Pe(
|
|
1077
|
-
return
|
|
1103
|
+
function Pe(r) {
|
|
1104
|
+
return r;
|
|
1078
1105
|
}
|
|
1079
1106
|
class we {
|
|
1080
1107
|
constructor(t) {
|
|
1081
1108
|
o(this, "__view");
|
|
1082
1109
|
this.__view = t;
|
|
1083
1110
|
const e = Object.getOwnPropertyDescriptors(this.__view._logger);
|
|
1084
|
-
for (const
|
|
1085
|
-
|
|
1111
|
+
for (const n in e)
|
|
1112
|
+
n !== "setName" && Object.defineProperty(this, n, e[n]);
|
|
1086
1113
|
}
|
|
1087
1114
|
get uid() {
|
|
1088
1115
|
return this.__view.uniqueId;
|
|
1089
1116
|
}
|
|
1117
|
+
get isMounted() {
|
|
1118
|
+
return this.__view.isMounted;
|
|
1119
|
+
}
|
|
1090
1120
|
setName(t) {
|
|
1091
1121
|
return this.__view._logger.setName(t), this.__view._elementContext.viewName = t, this;
|
|
1092
1122
|
}
|
|
@@ -1118,24 +1148,29 @@ class we {
|
|
|
1118
1148
|
return this.__view._elementContext.emitter.emit(t, new Q(t, e));
|
|
1119
1149
|
}
|
|
1120
1150
|
attachStore(t) {
|
|
1121
|
-
t.attach(this.__view._elementContext)
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1151
|
+
if (t.attach(this.__view._elementContext))
|
|
1152
|
+
this.__view._emitter.on("mounted", () => {
|
|
1153
|
+
t.handleMount();
|
|
1154
|
+
}), this.__view._emitter.on("unmounted", () => {
|
|
1155
|
+
t.handleUnmount();
|
|
1156
|
+
});
|
|
1157
|
+
else {
|
|
1158
|
+
let n = t.name ? `'${t.name}'` : "this store";
|
|
1159
|
+
this.__view._logger.warn(`An instance of ${n} was already attached to this context.`);
|
|
1160
|
+
}
|
|
1126
1161
|
}
|
|
1127
1162
|
useStore(t) {
|
|
1128
1163
|
if (he(t)) {
|
|
1129
1164
|
const e = t.key;
|
|
1130
|
-
let
|
|
1131
|
-
for (; s =
|
|
1132
|
-
|
|
1165
|
+
let n = this.__view._elementContext, s;
|
|
1166
|
+
for (; s = n.stores.get(e), s == null && n.parent != null; )
|
|
1167
|
+
n = n.parent;
|
|
1133
1168
|
if (s == null)
|
|
1134
|
-
throw new
|
|
1169
|
+
throw new H("Store not found on this context.");
|
|
1135
1170
|
return s.value;
|
|
1136
|
-
} else throw le(t) ? new
|
|
1171
|
+
} else throw le(t) ? new H(
|
|
1137
1172
|
"Received a Store instance. Please pass the Store factory function to useStore without calling it."
|
|
1138
|
-
) : new
|
|
1173
|
+
) : new H("Invalid store.");
|
|
1139
1174
|
}
|
|
1140
1175
|
beforeMount(t) {
|
|
1141
1176
|
this.__view._emitter.on("beforeMount", t);
|
|
@@ -1150,13 +1185,13 @@ class we {
|
|
|
1150
1185
|
this.__view._emitter.on("unmounted", t);
|
|
1151
1186
|
}
|
|
1152
1187
|
watch(t, e) {
|
|
1153
|
-
const
|
|
1154
|
-
if (
|
|
1155
|
-
return
|
|
1188
|
+
const n = this.__view;
|
|
1189
|
+
if (n.isMounted)
|
|
1190
|
+
return n._watcher.watch(t, e);
|
|
1156
1191
|
{
|
|
1157
1192
|
let s, i = !1;
|
|
1158
|
-
return
|
|
1159
|
-
i || (s =
|
|
1193
|
+
return n._emitter.on("mounted", () => {
|
|
1194
|
+
i || (s = n._watcher.watch(t, e));
|
|
1160
1195
|
}), () => {
|
|
1161
1196
|
s != null && (i = !0, s());
|
|
1162
1197
|
};
|
|
@@ -1167,11 +1202,11 @@ class we {
|
|
|
1167
1202
|
}
|
|
1168
1203
|
}
|
|
1169
1204
|
var vt;
|
|
1170
|
-
vt =
|
|
1205
|
+
vt = M;
|
|
1171
1206
|
const et = class et {
|
|
1172
|
-
constructor(t, e,
|
|
1207
|
+
constructor(t, e, n, s = []) {
|
|
1173
1208
|
o(this, vt, !0);
|
|
1174
|
-
o(this, "uniqueId",
|
|
1209
|
+
o(this, "uniqueId", Z());
|
|
1175
1210
|
o(this, "_elementContext");
|
|
1176
1211
|
o(this, "_logger");
|
|
1177
1212
|
o(this, "_view");
|
|
@@ -1180,7 +1215,7 @@ const et = class et {
|
|
|
1180
1215
|
o(this, "_childMarkup");
|
|
1181
1216
|
o(this, "_$children");
|
|
1182
1217
|
o(this, "_setChildren");
|
|
1183
|
-
o(this, "_watcher",
|
|
1218
|
+
o(this, "_watcher", D());
|
|
1184
1219
|
o(this, "_emitter", new j());
|
|
1185
1220
|
o(this, "isMounted", !1);
|
|
1186
1221
|
this._elementContext = {
|
|
@@ -1190,11 +1225,11 @@ const et = class et {
|
|
|
1190
1225
|
viewName: e.name,
|
|
1191
1226
|
emitter: new j(),
|
|
1192
1227
|
stores: /* @__PURE__ */ new Map()
|
|
1193
|
-
}, this._logger = t.root.createLogger(e.name, { uid: this.uniqueId }), this._view = e, this._props =
|
|
1194
|
-
this._logger.error({ error: i, eventName: u, args:
|
|
1228
|
+
}, this._logger = t.root.createLogger(e.name || "🌇 anonymous view", { uid: this.uniqueId }), this._view = e, this._props = n, this._childMarkup = s, [this._$children, this._setChildren] = Y([]), this._emitter.on("error", (i, u, ...a) => {
|
|
1229
|
+
this._logger.error({ error: i, eventName: u, args: a }), this._logger.crash(i);
|
|
1195
1230
|
}), this._elementContext.emitter.on("*", (i, u) => {
|
|
1196
|
-
var
|
|
1197
|
-
u instanceof Q && (u.propagationStopped || (
|
|
1231
|
+
var a;
|
|
1232
|
+
u instanceof Q && (u.propagationStopped || (a = this._elementContext.parent) == null || a.emitter.emit(i, u));
|
|
1198
1233
|
});
|
|
1199
1234
|
}
|
|
1200
1235
|
/*===============================*\
|
|
@@ -1205,8 +1240,8 @@ const et = class et {
|
|
|
1205
1240
|
return (t = this._element) == null ? void 0 : t.node;
|
|
1206
1241
|
}
|
|
1207
1242
|
mount(t, e) {
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1243
|
+
const n = this.isMounted;
|
|
1244
|
+
n || (this._initialize(), this._emitter.emit("beforeMount")), this._element && this._element.mount(t, e), n || (this.isMounted = !0, te(), requestAnimationFrame(() => {
|
|
1210
1245
|
this._emitter.emit("mounted");
|
|
1211
1246
|
}));
|
|
1212
1247
|
}
|
|
@@ -1225,31 +1260,31 @@ const et = class et {
|
|
|
1225
1260
|
const t = new we(this);
|
|
1226
1261
|
let e;
|
|
1227
1262
|
try {
|
|
1228
|
-
this._childMarkup.length && this._setChildren(
|
|
1229
|
-
} catch (
|
|
1230
|
-
throw
|
|
1263
|
+
e = this._view.call(t, this._props, t), this._childMarkup.length && this._setChildren(k(this._elementContext, this._childMarkup));
|
|
1264
|
+
} catch (n) {
|
|
1265
|
+
throw n instanceof Error && this._logger.crash(n), n;
|
|
1231
1266
|
}
|
|
1232
1267
|
if (e !== null) if (e instanceof Node)
|
|
1233
|
-
this._element =
|
|
1234
|
-
else if (L(e) ||
|
|
1235
|
-
this._element =
|
|
1268
|
+
this._element = I(k(this._elementContext, v("$node", { value: e })));
|
|
1269
|
+
else if (L(e) || kt(L, e))
|
|
1270
|
+
this._element = I(k(this._elementContext, e));
|
|
1236
1271
|
else if (m(e))
|
|
1237
|
-
this._element =
|
|
1238
|
-
|
|
1272
|
+
this._element = I(
|
|
1273
|
+
k(this._elementContext, v("$observer", { sources: [e], renderFn: (n) => n }))
|
|
1239
1274
|
);
|
|
1240
1275
|
else {
|
|
1241
|
-
const
|
|
1276
|
+
const n = new TypeError(
|
|
1242
1277
|
`Expected '${this._view.name}' function to return a DOM node, Markup element, Readable or null. Got: ${N(e)}`
|
|
1243
1278
|
);
|
|
1244
|
-
this._logger.crash(
|
|
1279
|
+
this._logger.crash(n);
|
|
1245
1280
|
}
|
|
1246
1281
|
}
|
|
1247
1282
|
};
|
|
1248
1283
|
let U = et;
|
|
1249
1284
|
var Ct;
|
|
1250
|
-
Ct =
|
|
1285
|
+
Ct = M;
|
|
1251
1286
|
class ye {
|
|
1252
|
-
constructor({ elementContext: t, $items: e, renderFn:
|
|
1287
|
+
constructor({ elementContext: t, $items: e, renderFn: n, keyFn: s }) {
|
|
1253
1288
|
o(this, Ct, !0);
|
|
1254
1289
|
o(this, "node", document.createTextNode(""));
|
|
1255
1290
|
o(this, "$items");
|
|
@@ -1258,16 +1293,16 @@ class ye {
|
|
|
1258
1293
|
o(this, "elementContext");
|
|
1259
1294
|
o(this, "renderFn");
|
|
1260
1295
|
o(this, "keyFn");
|
|
1261
|
-
this.elementContext = t, this.$items = e, this.renderFn =
|
|
1296
|
+
this.elementContext = t, this.$items = e, this.renderFn = n, this.keyFn = s;
|
|
1262
1297
|
}
|
|
1263
1298
|
get isMounted() {
|
|
1264
1299
|
return this.node.parentNode != null;
|
|
1265
1300
|
}
|
|
1266
1301
|
mount(t, e) {
|
|
1267
|
-
this.isMounted || (t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), this.stopCallback = this.$items.watch((
|
|
1302
|
+
this.isMounted || (t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), this.stopCallback = this.$items.watch((n) => {
|
|
1268
1303
|
this.isMounted ? this.elementContext.root.batch.write(() => {
|
|
1269
|
-
this._update(Array.from(
|
|
1270
|
-
}) : this._update(Array.from(
|
|
1304
|
+
this._update(Array.from(n));
|
|
1305
|
+
}) : this._update(Array.from(n));
|
|
1271
1306
|
}));
|
|
1272
1307
|
}
|
|
1273
1308
|
unmount(t = !1) {
|
|
@@ -1280,28 +1315,28 @@ class ye {
|
|
|
1280
1315
|
this.connectedItems = [];
|
|
1281
1316
|
}
|
|
1282
1317
|
_update(t) {
|
|
1283
|
-
var u,
|
|
1318
|
+
var u, a, h;
|
|
1284
1319
|
if (t.length === 0 || !this.isMounted)
|
|
1285
1320
|
return this._cleanup(!1);
|
|
1286
1321
|
const e = [];
|
|
1287
|
-
let
|
|
1288
|
-
for (const
|
|
1322
|
+
let n = 0;
|
|
1323
|
+
for (const c of t)
|
|
1289
1324
|
e.push({
|
|
1290
|
-
key: this.keyFn(
|
|
1291
|
-
value:
|
|
1292
|
-
index:
|
|
1325
|
+
key: this.keyFn(c, n),
|
|
1326
|
+
value: c,
|
|
1327
|
+
index: n++
|
|
1293
1328
|
});
|
|
1294
1329
|
const s = [];
|
|
1295
|
-
for (const
|
|
1296
|
-
e.find((l) => l.key ===
|
|
1297
|
-
for (const
|
|
1298
|
-
const f = this.connectedItems.find((l) => l.key ===
|
|
1330
|
+
for (const c of this.connectedItems)
|
|
1331
|
+
e.find((l) => l.key === c.key) || c.element.unmount(!1);
|
|
1332
|
+
for (const c of e) {
|
|
1333
|
+
const f = this.connectedItems.find((l) => l.key === c.key);
|
|
1299
1334
|
if (f)
|
|
1300
|
-
f.setValue(
|
|
1335
|
+
f.setValue(c.value), f.setIndex(c.index), s[c.index] = f;
|
|
1301
1336
|
else {
|
|
1302
|
-
const [l, d] =
|
|
1303
|
-
s[
|
|
1304
|
-
key:
|
|
1337
|
+
const [l, d] = Y(c.value), [p, _] = Y(c.index);
|
|
1338
|
+
s[c.index] = {
|
|
1339
|
+
key: c.key,
|
|
1305
1340
|
$value: l,
|
|
1306
1341
|
setValue: d,
|
|
1307
1342
|
$index: p,
|
|
@@ -1314,152 +1349,152 @@ class ye {
|
|
|
1314
1349
|
};
|
|
1315
1350
|
}
|
|
1316
1351
|
}
|
|
1317
|
-
for (let
|
|
1318
|
-
const f = s[
|
|
1352
|
+
for (let c = 0; c < s.length; c++) {
|
|
1353
|
+
const f = s[c], l = ((u = s[c - 1]) == null ? void 0 : u.element.node) ?? this.node;
|
|
1319
1354
|
f.element.mount(this.node.parentNode, l);
|
|
1320
1355
|
}
|
|
1321
1356
|
this.connectedItems = s;
|
|
1322
|
-
const i = ((
|
|
1357
|
+
const i = ((a = s.at(-1)) == null ? void 0 : a.element.node) ?? this.node;
|
|
1323
1358
|
(h = this.node.parentNode) == null || h.insertBefore(this.node, i.nextSibling);
|
|
1324
1359
|
}
|
|
1325
1360
|
}
|
|
1326
|
-
function Se({ $value:
|
|
1327
|
-
return e(n, t,
|
|
1361
|
+
function Se({ $value: r, $index: t, renderFn: e }, n) {
|
|
1362
|
+
return n.setName("@RepeatItem"), e.call(n, r, t, n);
|
|
1328
1363
|
}
|
|
1329
|
-
function L(
|
|
1330
|
-
return (
|
|
1364
|
+
function L(r) {
|
|
1365
|
+
return (r == null ? void 0 : r[$t]) === !0;
|
|
1331
1366
|
}
|
|
1332
|
-
function
|
|
1333
|
-
return (
|
|
1367
|
+
function It(r) {
|
|
1368
|
+
return (r == null ? void 0 : r[M]) === !0;
|
|
1334
1369
|
}
|
|
1335
|
-
function tt(
|
|
1336
|
-
return A(
|
|
1370
|
+
function tt(r) {
|
|
1371
|
+
return A(r) || (r = [r]), r.flat(1 / 0).filter((t) => t != null && t !== !1).map((t) => L(t) ? t : t instanceof Node ? v("$node", { value: t }) : m(t) ? v("$observer", {
|
|
1337
1372
|
sources: [t],
|
|
1338
1373
|
renderFn: (e) => e
|
|
1339
1374
|
}) : v("$text", { value: t }));
|
|
1340
1375
|
}
|
|
1341
|
-
function v(
|
|
1342
|
-
return new ve(
|
|
1376
|
+
function v(r, t, ...e) {
|
|
1377
|
+
return new ve(r, t, ...e);
|
|
1343
1378
|
}
|
|
1344
1379
|
var xt;
|
|
1345
1380
|
xt = $t;
|
|
1346
1381
|
class ve {
|
|
1347
|
-
constructor(t, e, ...
|
|
1382
|
+
constructor(t, e, ...n) {
|
|
1348
1383
|
o(this, xt, !0);
|
|
1349
1384
|
o(this, "type");
|
|
1350
1385
|
o(this, "props");
|
|
1351
1386
|
o(this, "children");
|
|
1352
|
-
this.type = t, this.props = e, this.children = tt(
|
|
1387
|
+
this.type = t, this.props = e, this.children = tt(n);
|
|
1353
1388
|
}
|
|
1354
1389
|
}
|
|
1355
1390
|
const Te = fe.bind(v);
|
|
1356
|
-
function
|
|
1391
|
+
function Ie(r, t, e) {
|
|
1357
1392
|
return v("$observer", {
|
|
1358
|
-
sources: [
|
|
1359
|
-
renderFn: (
|
|
1393
|
+
sources: [r],
|
|
1394
|
+
renderFn: (n) => n && t ? t : !n && e ? e : null
|
|
1360
1395
|
});
|
|
1361
1396
|
}
|
|
1362
|
-
function
|
|
1363
|
-
const
|
|
1364
|
-
return v("$repeat", { $items:
|
|
1397
|
+
function qe(r, t, e) {
|
|
1398
|
+
const n = J(r);
|
|
1399
|
+
return v("$repeat", { $items: n, keyFn: t, renderFn: e });
|
|
1365
1400
|
}
|
|
1366
|
-
function je(
|
|
1367
|
-
return v("$portal", { parent:
|
|
1401
|
+
function je(r, t) {
|
|
1402
|
+
return v("$portal", { parent: r, content: t });
|
|
1368
1403
|
}
|
|
1369
|
-
function
|
|
1370
|
-
return (A(t) ? t : [t]).map((
|
|
1371
|
-
if (
|
|
1372
|
-
return new U(
|
|
1373
|
-
if (b(
|
|
1374
|
-
switch (
|
|
1404
|
+
function k(r, t) {
|
|
1405
|
+
return (A(t) ? t : [t]).map((n) => {
|
|
1406
|
+
if (q(n.type))
|
|
1407
|
+
return new U(r, n.type, n.props, n.children);
|
|
1408
|
+
if (b(n.type))
|
|
1409
|
+
switch (n.type) {
|
|
1375
1410
|
case "$node": {
|
|
1376
|
-
const s =
|
|
1411
|
+
const s = n.props;
|
|
1377
1412
|
return new dt(s.value);
|
|
1378
1413
|
}
|
|
1379
1414
|
case "$text": {
|
|
1380
|
-
const s =
|
|
1415
|
+
const s = n.props;
|
|
1381
1416
|
return new dt(document.createTextNode(String(s.value)));
|
|
1382
1417
|
}
|
|
1383
1418
|
case "$repeat": {
|
|
1384
|
-
const s =
|
|
1419
|
+
const s = n.props;
|
|
1385
1420
|
return new ye({
|
|
1386
1421
|
$items: s.$items,
|
|
1387
1422
|
keyFn: s.keyFn,
|
|
1388
1423
|
renderFn: s.renderFn,
|
|
1389
|
-
elementContext:
|
|
1424
|
+
elementContext: r
|
|
1390
1425
|
});
|
|
1391
1426
|
}
|
|
1392
1427
|
case "$observer": {
|
|
1393
|
-
const s =
|
|
1428
|
+
const s = n.props;
|
|
1394
1429
|
return new _e({
|
|
1395
1430
|
sources: s.sources,
|
|
1396
1431
|
renderFn: s.renderFn,
|
|
1397
|
-
elementContext:
|
|
1432
|
+
elementContext: r
|
|
1398
1433
|
});
|
|
1399
1434
|
}
|
|
1400
1435
|
case "$outlet": {
|
|
1401
|
-
const s =
|
|
1436
|
+
const s = n.props;
|
|
1402
1437
|
return new Tt(s.$children);
|
|
1403
1438
|
}
|
|
1404
1439
|
case "$portal": {
|
|
1405
|
-
const s =
|
|
1440
|
+
const s = n.props;
|
|
1406
1441
|
return new ge({
|
|
1407
1442
|
content: s.content,
|
|
1408
1443
|
parent: s.parent,
|
|
1409
|
-
elementContext:
|
|
1444
|
+
elementContext: r
|
|
1410
1445
|
});
|
|
1411
1446
|
}
|
|
1412
1447
|
default:
|
|
1413
|
-
if (
|
|
1414
|
-
throw new Error(`Unknown markup type: ${
|
|
1448
|
+
if (n.type.startsWith("$"))
|
|
1449
|
+
throw new Error(`Unknown markup type: ${n.type}`);
|
|
1415
1450
|
return new pe({
|
|
1416
|
-
tag:
|
|
1417
|
-
props:
|
|
1418
|
-
children:
|
|
1419
|
-
elementContext:
|
|
1451
|
+
tag: n.type,
|
|
1452
|
+
props: n.props ?? {},
|
|
1453
|
+
children: n.children,
|
|
1454
|
+
elementContext: r
|
|
1420
1455
|
});
|
|
1421
1456
|
}
|
|
1422
1457
|
else
|
|
1423
|
-
throw new TypeError(`Expected a string or view function. Got: ${
|
|
1458
|
+
throw new TypeError(`Expected a string or view function. Got: ${n.type}`);
|
|
1424
1459
|
});
|
|
1425
1460
|
}
|
|
1426
|
-
function
|
|
1427
|
-
return
|
|
1461
|
+
function I(r) {
|
|
1462
|
+
return r.length === 1 ? r[0] : new Tt(r);
|
|
1428
1463
|
}
|
|
1429
|
-
function
|
|
1430
|
-
return
|
|
1464
|
+
function qt(r) {
|
|
1465
|
+
return r == null || r === !1 || b(r) || Gt(r) || L(r) || m(r) || kt(qt, r);
|
|
1431
1466
|
}
|
|
1432
|
-
function Ue(
|
|
1467
|
+
function Ue(r, t) {
|
|
1433
1468
|
return t.outlet();
|
|
1434
1469
|
}
|
|
1435
1470
|
export {
|
|
1436
1471
|
Zt as A,
|
|
1437
1472
|
Oe as B,
|
|
1438
1473
|
Q as C,
|
|
1439
|
-
|
|
1440
|
-
|
|
1474
|
+
I as D,
|
|
1475
|
+
k as E,
|
|
1441
1476
|
Fe as F,
|
|
1442
1477
|
Et as G,
|
|
1443
1478
|
je as H,
|
|
1444
|
-
|
|
1479
|
+
qe as I,
|
|
1445
1480
|
Pe as J,
|
|
1446
1481
|
Ue as P,
|
|
1447
1482
|
Ve as S,
|
|
1448
1483
|
U as V,
|
|
1449
1484
|
b as a,
|
|
1450
1485
|
Ae as b,
|
|
1451
|
-
|
|
1486
|
+
Y as c,
|
|
1452
1487
|
oe as d,
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1488
|
+
q as e,
|
|
1489
|
+
ke as f,
|
|
1490
|
+
Me as g,
|
|
1456
1491
|
xe as h,
|
|
1457
1492
|
bt as i,
|
|
1458
1493
|
Te as j,
|
|
1459
|
-
|
|
1460
|
-
|
|
1494
|
+
Ie as k,
|
|
1495
|
+
D as l,
|
|
1461
1496
|
Ne as m,
|
|
1462
|
-
|
|
1497
|
+
J as n,
|
|
1463
1498
|
re as o,
|
|
1464
1499
|
j as p,
|
|
1465
1500
|
m as q,
|
|
@@ -1468,9 +1503,9 @@ export {
|
|
|
1468
1503
|
N as t,
|
|
1469
1504
|
ue as u,
|
|
1470
1505
|
he as v,
|
|
1471
|
-
|
|
1506
|
+
H as w,
|
|
1472
1507
|
le as x,
|
|
1473
1508
|
be as y,
|
|
1474
1509
|
v as z
|
|
1475
1510
|
};
|
|
1476
|
-
//# sourceMappingURL=passthrough-
|
|
1511
|
+
//# sourceMappingURL=passthrough-eH8w4zJi.js.map
|