wrec 0.33.1 → 0.34.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.
|
@@ -45,7 +45,7 @@ var r = typeof window < "u" && window.document !== void 0, i = class extends Err
|
|
|
45
45
|
constructor(n, a, o) {
|
|
46
46
|
if (!n) throw new i("name cannot be empty");
|
|
47
47
|
if (e.#e.has(n)) throw new i(`WrecState with name "${n}" already exists`);
|
|
48
|
-
if (this.#r = n, this.#i = a, this.#a = t({}, this.#
|
|
48
|
+
if (this.#r = n, this.#i = a, this.#a = t({}, this.#s.bind(this)), a && r) {
|
|
49
49
|
let e = sessionStorage.getItem("wrec-state-" + n), t = e ? JSON.parse(e) : void 0;
|
|
50
50
|
t && (o = t);
|
|
51
51
|
}
|
|
@@ -76,18 +76,21 @@ var r = typeof window < "u" && window.document !== void 0, i = class extends Err
|
|
|
76
76
|
get id() {
|
|
77
77
|
return this.#n;
|
|
78
78
|
}
|
|
79
|
+
#o(e, t) {
|
|
80
|
+
return t.some((t) => e === t || e.startsWith(t + ".") || t.startsWith(e + "."));
|
|
81
|
+
}
|
|
79
82
|
log() {
|
|
80
83
|
console.log("WrecState:", this.#r);
|
|
81
84
|
for (let [e, t] of Object.entries(this.#a)) console.log(` ${e} = ${JSON.stringify(t)}`);
|
|
82
85
|
}
|
|
83
|
-
#
|
|
86
|
+
#s(e, t, n) {
|
|
84
87
|
let r = {
|
|
85
88
|
state: this,
|
|
86
89
|
statePath: e,
|
|
87
90
|
oldValue: t,
|
|
88
91
|
newValue: n
|
|
89
92
|
};
|
|
90
|
-
for (let { callback: t, statePaths: n } of this.#t) (n.length === 0 ||
|
|
93
|
+
for (let { callback: t, statePaths: n } of this.#t) (n.length === 0 || this.#o(e, n)) && t(r);
|
|
91
94
|
}
|
|
92
95
|
};
|
|
93
96
|
r && process.env.NODE_ENV === "development" && (window.WrecState = a);
|
|
@@ -811,9 +814,16 @@ var X = class e extends m {
|
|
|
811
814
|
...t
|
|
812
815
|
};
|
|
813
816
|
n?.unsubscribe();
|
|
814
|
-
let i = e.subscribe(({ statePath:
|
|
815
|
-
let
|
|
816
|
-
|
|
817
|
+
let i = e.subscribe(({ statePath: t, newValue: n }) => {
|
|
818
|
+
let i = r[t];
|
|
819
|
+
if (i) {
|
|
820
|
+
this.#R(i, n);
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
let a = Object.keys(r).find((e) => t.startsWith(e + ".") || e.startsWith(t + "."));
|
|
824
|
+
if (!a) return;
|
|
825
|
+
let s = r[a];
|
|
826
|
+
this.#R(s, o(e, a));
|
|
817
827
|
}, Object.keys(r));
|
|
818
828
|
this.#f.set(e, {
|
|
819
829
|
map: r,
|
package/dist/wrec-ssr.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./wrec-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./wrec-BugZmj1G.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var a = Object.defineProperty, o = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, c = Object.prototype.hasOwnProperty, l = (e, t) => () => (e && (t = e(e = 0)), t), u = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), d = (e, t) => {
|
|
4
4
|
let n = {};
|
package/dist/wrec.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./wrec-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./wrec-BugZmj1G.js";
|
|
2
2
|
export { i as Wrec, e as WrecState, n as createElement, r as css, t as html };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrec",
|
|
3
|
-
"description": "a
|
|
3
|
+
"description": "a library that greatly simplifies building web components",
|
|
4
4
|
"author": "R. Mark Volkmann",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.34.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|