@redis-ui/components 47.4.0 → 47.5.1

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.
Files changed (32) hide show
  1. package/dist/MultiSelect/components/Content/components/SelectAll/SelectAll.cjs +11 -7
  2. package/dist/MultiSelect/components/Content/components/SelectAll/SelectAll.js +12 -8
  3. package/dist/node_modules/@tanstack/hotkeys/dist/constants.cjs +389 -0
  4. package/dist/node_modules/@tanstack/hotkeys/dist/constants.js +383 -0
  5. package/dist/node_modules/@tanstack/hotkeys/dist/format.cjs +22 -0
  6. package/dist/node_modules/@tanstack/hotkeys/dist/format.js +22 -0
  7. package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.cjs +363 -0
  8. package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.js +363 -0
  9. package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.cjs +111 -0
  10. package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.js +107 -0
  11. package/dist/node_modules/@tanstack/hotkeys/dist/match.cjs +59 -0
  12. package/dist/node_modules/@tanstack/hotkeys/dist/match.js +59 -0
  13. package/dist/node_modules/@tanstack/hotkeys/dist/parse.cjs +143 -0
  14. package/dist/node_modules/@tanstack/hotkeys/dist/parse.js +141 -0
  15. package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.cjs +10 -0
  16. package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.js +8 -0
  17. package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs +121 -0
  18. package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.js +120 -0
  19. package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.cjs +9 -0
  20. package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.js +9 -0
  21. package/dist/node_modules/@tanstack/store/dist/alien.cjs +183 -0
  22. package/dist/node_modules/@tanstack/store/dist/alien.js +182 -0
  23. package/dist/node_modules/@tanstack/store/dist/atom.cjs +161 -0
  24. package/dist/node_modules/@tanstack/store/dist/atom.js +160 -0
  25. package/dist/node_modules/@tanstack/store/dist/store.cjs +25 -0
  26. package/dist/node_modules/@tanstack/store/dist/store.js +25 -0
  27. package/package.json +3 -3
  28. package/skills/redis-ui-components/SKILL.md +1 -1
  29. package/skills/redis-ui-components/references/Icons.md +3 -3
  30. package/skills/redis-ui-components/references/SideBar.md +8 -8
  31. package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.cjs +0 -289
  32. package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js +0 -288
@@ -0,0 +1,183 @@
1
+ //#region ../../node_modules/@tanstack/store/dist/alien.js
2
+ var ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
3
+ ReactiveFlags[ReactiveFlags["None"] = 0] = "None";
4
+ ReactiveFlags[ReactiveFlags["Mutable"] = 1] = "Mutable";
5
+ ReactiveFlags[ReactiveFlags["Watching"] = 2] = "Watching";
6
+ ReactiveFlags[ReactiveFlags["RecursedCheck"] = 4] = "RecursedCheck";
7
+ ReactiveFlags[ReactiveFlags["Recursed"] = 8] = "Recursed";
8
+ ReactiveFlags[ReactiveFlags["Dirty"] = 16] = "Dirty";
9
+ ReactiveFlags[ReactiveFlags["Pending"] = 32] = "Pending";
10
+ return ReactiveFlags;
11
+ }({});
12
+ /* @__NO_SIDE_EFFECTS__ */
13
+ function createReactiveSystem({ update, notify, unwatched }) {
14
+ return {
15
+ link,
16
+ unlink,
17
+ propagate,
18
+ checkDirty,
19
+ shallowPropagate
20
+ };
21
+ function link(dep, sub, version) {
22
+ const prevDep = sub.depsTail;
23
+ if (prevDep !== void 0 && prevDep.dep === dep) return;
24
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
25
+ if (nextDep !== void 0 && nextDep.dep === dep) {
26
+ nextDep.version = version;
27
+ sub.depsTail = nextDep;
28
+ return;
29
+ }
30
+ const prevSub = dep.subsTail;
31
+ if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
32
+ const newLink = sub.depsTail = dep.subsTail = {
33
+ version,
34
+ dep,
35
+ sub,
36
+ prevDep,
37
+ nextDep,
38
+ prevSub,
39
+ nextSub: void 0
40
+ };
41
+ if (nextDep !== void 0) nextDep.prevDep = newLink;
42
+ if (prevDep !== void 0) prevDep.nextDep = newLink;
43
+ else sub.deps = newLink;
44
+ if (prevSub !== void 0) prevSub.nextSub = newLink;
45
+ else dep.subs = newLink;
46
+ }
47
+ function unlink(link, sub = link.sub) {
48
+ const dep = link.dep;
49
+ const prevDep = link.prevDep;
50
+ const nextDep = link.nextDep;
51
+ const nextSub = link.nextSub;
52
+ const prevSub = link.prevSub;
53
+ if (nextDep !== void 0) nextDep.prevDep = prevDep;
54
+ else sub.depsTail = prevDep;
55
+ if (prevDep !== void 0) prevDep.nextDep = nextDep;
56
+ else sub.deps = nextDep;
57
+ if (nextSub !== void 0) nextSub.prevSub = prevSub;
58
+ else dep.subsTail = prevSub;
59
+ if (prevSub !== void 0) prevSub.nextSub = nextSub;
60
+ else if ((dep.subs = nextSub) === void 0) unwatched(dep);
61
+ return nextDep;
62
+ }
63
+ function propagate(link) {
64
+ let next = link.nextSub;
65
+ let stack;
66
+ top: do {
67
+ const sub = link.sub;
68
+ let flags = sub.flags;
69
+ if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending))) sub.flags = flags | ReactiveFlags.Pending;
70
+ else if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed))) flags = ReactiveFlags.None;
71
+ else if (!(flags & ReactiveFlags.RecursedCheck)) sub.flags = flags & ~ReactiveFlags.Recursed | ReactiveFlags.Pending;
72
+ else if (!(flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && isValidLink(link, sub)) {
73
+ sub.flags = flags | (ReactiveFlags.Recursed | ReactiveFlags.Pending);
74
+ flags &= ReactiveFlags.Mutable;
75
+ } else flags = ReactiveFlags.None;
76
+ if (flags & ReactiveFlags.Watching) notify(sub);
77
+ if (flags & ReactiveFlags.Mutable) {
78
+ const subSubs = sub.subs;
79
+ if (subSubs !== void 0) {
80
+ const nextSub = (link = subSubs).nextSub;
81
+ if (nextSub !== void 0) {
82
+ stack = {
83
+ value: next,
84
+ prev: stack
85
+ };
86
+ next = nextSub;
87
+ }
88
+ continue;
89
+ }
90
+ }
91
+ if ((link = next) !== void 0) {
92
+ next = link.nextSub;
93
+ continue;
94
+ }
95
+ while (stack !== void 0) {
96
+ link = stack.value;
97
+ stack = stack.prev;
98
+ if (link !== void 0) {
99
+ next = link.nextSub;
100
+ continue top;
101
+ }
102
+ }
103
+ break;
104
+ } while (true);
105
+ }
106
+ function checkDirty(link, sub) {
107
+ let stack;
108
+ let checkDepth = 0;
109
+ let dirty = false;
110
+ top: do {
111
+ const dep = link.dep;
112
+ const flags = dep.flags;
113
+ if (sub.flags & ReactiveFlags.Dirty) dirty = true;
114
+ else if ((flags & (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) === (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) {
115
+ if (update(dep)) {
116
+ const subs = dep.subs;
117
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
118
+ dirty = true;
119
+ }
120
+ } else if ((flags & (ReactiveFlags.Mutable | ReactiveFlags.Pending)) === (ReactiveFlags.Mutable | ReactiveFlags.Pending)) {
121
+ if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
122
+ value: link,
123
+ prev: stack
124
+ };
125
+ link = dep.deps;
126
+ sub = dep;
127
+ ++checkDepth;
128
+ continue;
129
+ }
130
+ if (!dirty) {
131
+ const nextDep = link.nextDep;
132
+ if (nextDep !== void 0) {
133
+ link = nextDep;
134
+ continue;
135
+ }
136
+ }
137
+ while (checkDepth--) {
138
+ const firstSub = sub.subs;
139
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
140
+ if (hasMultipleSubs) {
141
+ link = stack.value;
142
+ stack = stack.prev;
143
+ } else link = firstSub;
144
+ if (dirty) {
145
+ if (update(sub)) {
146
+ if (hasMultipleSubs) shallowPropagate(firstSub);
147
+ sub = link.sub;
148
+ continue;
149
+ }
150
+ dirty = false;
151
+ } else sub.flags &= ~ReactiveFlags.Pending;
152
+ sub = link.sub;
153
+ const nextDep = link.nextDep;
154
+ if (nextDep !== void 0) {
155
+ link = nextDep;
156
+ continue top;
157
+ }
158
+ }
159
+ return dirty;
160
+ } while (true);
161
+ }
162
+ function shallowPropagate(link) {
163
+ do {
164
+ const sub = link.sub;
165
+ const flags = sub.flags;
166
+ if ((flags & (ReactiveFlags.Pending | ReactiveFlags.Dirty)) === ReactiveFlags.Pending) {
167
+ sub.flags = flags | ReactiveFlags.Dirty;
168
+ if ((flags & (ReactiveFlags.Watching | ReactiveFlags.RecursedCheck)) === ReactiveFlags.Watching) notify(sub);
169
+ }
170
+ } while ((link = link.nextSub) !== void 0);
171
+ }
172
+ function isValidLink(checkLink, sub) {
173
+ let link = sub.depsTail;
174
+ while (link !== void 0) {
175
+ if (link === checkLink) return true;
176
+ link = link.prevDep;
177
+ }
178
+ return false;
179
+ }
180
+ }
181
+ //#endregion
182
+ exports.ReactiveFlags = ReactiveFlags;
183
+ exports.createReactiveSystem = createReactiveSystem;
@@ -0,0 +1,182 @@
1
+ //#region ../../node_modules/@tanstack/store/dist/alien.js
2
+ var ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
3
+ ReactiveFlags[ReactiveFlags["None"] = 0] = "None";
4
+ ReactiveFlags[ReactiveFlags["Mutable"] = 1] = "Mutable";
5
+ ReactiveFlags[ReactiveFlags["Watching"] = 2] = "Watching";
6
+ ReactiveFlags[ReactiveFlags["RecursedCheck"] = 4] = "RecursedCheck";
7
+ ReactiveFlags[ReactiveFlags["Recursed"] = 8] = "Recursed";
8
+ ReactiveFlags[ReactiveFlags["Dirty"] = 16] = "Dirty";
9
+ ReactiveFlags[ReactiveFlags["Pending"] = 32] = "Pending";
10
+ return ReactiveFlags;
11
+ }({});
12
+ /* @__NO_SIDE_EFFECTS__ */
13
+ function createReactiveSystem({ update, notify, unwatched }) {
14
+ return {
15
+ link,
16
+ unlink,
17
+ propagate,
18
+ checkDirty,
19
+ shallowPropagate
20
+ };
21
+ function link(dep, sub, version) {
22
+ const prevDep = sub.depsTail;
23
+ if (prevDep !== void 0 && prevDep.dep === dep) return;
24
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
25
+ if (nextDep !== void 0 && nextDep.dep === dep) {
26
+ nextDep.version = version;
27
+ sub.depsTail = nextDep;
28
+ return;
29
+ }
30
+ const prevSub = dep.subsTail;
31
+ if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
32
+ const newLink = sub.depsTail = dep.subsTail = {
33
+ version,
34
+ dep,
35
+ sub,
36
+ prevDep,
37
+ nextDep,
38
+ prevSub,
39
+ nextSub: void 0
40
+ };
41
+ if (nextDep !== void 0) nextDep.prevDep = newLink;
42
+ if (prevDep !== void 0) prevDep.nextDep = newLink;
43
+ else sub.deps = newLink;
44
+ if (prevSub !== void 0) prevSub.nextSub = newLink;
45
+ else dep.subs = newLink;
46
+ }
47
+ function unlink(link, sub = link.sub) {
48
+ const dep = link.dep;
49
+ const prevDep = link.prevDep;
50
+ const nextDep = link.nextDep;
51
+ const nextSub = link.nextSub;
52
+ const prevSub = link.prevSub;
53
+ if (nextDep !== void 0) nextDep.prevDep = prevDep;
54
+ else sub.depsTail = prevDep;
55
+ if (prevDep !== void 0) prevDep.nextDep = nextDep;
56
+ else sub.deps = nextDep;
57
+ if (nextSub !== void 0) nextSub.prevSub = prevSub;
58
+ else dep.subsTail = prevSub;
59
+ if (prevSub !== void 0) prevSub.nextSub = nextSub;
60
+ else if ((dep.subs = nextSub) === void 0) unwatched(dep);
61
+ return nextDep;
62
+ }
63
+ function propagate(link) {
64
+ let next = link.nextSub;
65
+ let stack;
66
+ top: do {
67
+ const sub = link.sub;
68
+ let flags = sub.flags;
69
+ if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending))) sub.flags = flags | ReactiveFlags.Pending;
70
+ else if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed))) flags = ReactiveFlags.None;
71
+ else if (!(flags & ReactiveFlags.RecursedCheck)) sub.flags = flags & ~ReactiveFlags.Recursed | ReactiveFlags.Pending;
72
+ else if (!(flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && isValidLink(link, sub)) {
73
+ sub.flags = flags | (ReactiveFlags.Recursed | ReactiveFlags.Pending);
74
+ flags &= ReactiveFlags.Mutable;
75
+ } else flags = ReactiveFlags.None;
76
+ if (flags & ReactiveFlags.Watching) notify(sub);
77
+ if (flags & ReactiveFlags.Mutable) {
78
+ const subSubs = sub.subs;
79
+ if (subSubs !== void 0) {
80
+ const nextSub = (link = subSubs).nextSub;
81
+ if (nextSub !== void 0) {
82
+ stack = {
83
+ value: next,
84
+ prev: stack
85
+ };
86
+ next = nextSub;
87
+ }
88
+ continue;
89
+ }
90
+ }
91
+ if ((link = next) !== void 0) {
92
+ next = link.nextSub;
93
+ continue;
94
+ }
95
+ while (stack !== void 0) {
96
+ link = stack.value;
97
+ stack = stack.prev;
98
+ if (link !== void 0) {
99
+ next = link.nextSub;
100
+ continue top;
101
+ }
102
+ }
103
+ break;
104
+ } while (true);
105
+ }
106
+ function checkDirty(link, sub) {
107
+ let stack;
108
+ let checkDepth = 0;
109
+ let dirty = false;
110
+ top: do {
111
+ const dep = link.dep;
112
+ const flags = dep.flags;
113
+ if (sub.flags & ReactiveFlags.Dirty) dirty = true;
114
+ else if ((flags & (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) === (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) {
115
+ if (update(dep)) {
116
+ const subs = dep.subs;
117
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
118
+ dirty = true;
119
+ }
120
+ } else if ((flags & (ReactiveFlags.Mutable | ReactiveFlags.Pending)) === (ReactiveFlags.Mutable | ReactiveFlags.Pending)) {
121
+ if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
122
+ value: link,
123
+ prev: stack
124
+ };
125
+ link = dep.deps;
126
+ sub = dep;
127
+ ++checkDepth;
128
+ continue;
129
+ }
130
+ if (!dirty) {
131
+ const nextDep = link.nextDep;
132
+ if (nextDep !== void 0) {
133
+ link = nextDep;
134
+ continue;
135
+ }
136
+ }
137
+ while (checkDepth--) {
138
+ const firstSub = sub.subs;
139
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
140
+ if (hasMultipleSubs) {
141
+ link = stack.value;
142
+ stack = stack.prev;
143
+ } else link = firstSub;
144
+ if (dirty) {
145
+ if (update(sub)) {
146
+ if (hasMultipleSubs) shallowPropagate(firstSub);
147
+ sub = link.sub;
148
+ continue;
149
+ }
150
+ dirty = false;
151
+ } else sub.flags &= ~ReactiveFlags.Pending;
152
+ sub = link.sub;
153
+ const nextDep = link.nextDep;
154
+ if (nextDep !== void 0) {
155
+ link = nextDep;
156
+ continue top;
157
+ }
158
+ }
159
+ return dirty;
160
+ } while (true);
161
+ }
162
+ function shallowPropagate(link) {
163
+ do {
164
+ const sub = link.sub;
165
+ const flags = sub.flags;
166
+ if ((flags & (ReactiveFlags.Pending | ReactiveFlags.Dirty)) === ReactiveFlags.Pending) {
167
+ sub.flags = flags | ReactiveFlags.Dirty;
168
+ if ((flags & (ReactiveFlags.Watching | ReactiveFlags.RecursedCheck)) === ReactiveFlags.Watching) notify(sub);
169
+ }
170
+ } while ((link = link.nextSub) !== void 0);
171
+ }
172
+ function isValidLink(checkLink, sub) {
173
+ let link = sub.depsTail;
174
+ while (link !== void 0) {
175
+ if (link === checkLink) return true;
176
+ link = link.prevDep;
177
+ }
178
+ return false;
179
+ }
180
+ }
181
+ //#endregion
182
+ export { ReactiveFlags, createReactiveSystem };
@@ -0,0 +1,161 @@
1
+ const require_alien = require("./alien.cjs");
2
+ //#region ../../node_modules/@tanstack/store/dist/atom.js
3
+ function toObserver(nextHandler, errorHandler, completionHandler) {
4
+ const isObserver = typeof nextHandler === "object";
5
+ const self = isObserver ? nextHandler : void 0;
6
+ return {
7
+ next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
8
+ error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
9
+ complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
10
+ };
11
+ }
12
+ var queuedEffects = [];
13
+ var cycle = 0;
14
+ var { link, unlink, propagate, checkDirty, shallowPropagate } = /* @__PURE__ */ require_alien.createReactiveSystem({
15
+ update(atom) {
16
+ return atom._update();
17
+ },
18
+ notify(effect) {
19
+ queuedEffects[queuedEffectsLength++] = effect;
20
+ effect.flags &= ~require_alien.ReactiveFlags.Watching;
21
+ },
22
+ unwatched(atom) {
23
+ if (atom.depsTail !== void 0) {
24
+ atom.depsTail = void 0;
25
+ atom.flags = require_alien.ReactiveFlags.Mutable | require_alien.ReactiveFlags.Dirty;
26
+ purgeDeps(atom);
27
+ }
28
+ }
29
+ });
30
+ var notifyIndex = 0;
31
+ var queuedEffectsLength = 0;
32
+ var activeSub;
33
+ var batchDepth = 0;
34
+ function purgeDeps(sub) {
35
+ const depsTail = sub.depsTail;
36
+ let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
37
+ while (dep !== void 0) dep = unlink(dep, sub);
38
+ }
39
+ function flush() {
40
+ if (batchDepth > 0) return;
41
+ while (notifyIndex < queuedEffectsLength) {
42
+ const effect = queuedEffects[notifyIndex];
43
+ queuedEffects[notifyIndex++] = void 0;
44
+ effect.notify();
45
+ }
46
+ notifyIndex = 0;
47
+ queuedEffectsLength = 0;
48
+ }
49
+ function createAtom(valueOrFn, options) {
50
+ const isComputed = typeof valueOrFn === "function";
51
+ const getter = valueOrFn;
52
+ const atom = {
53
+ _snapshot: isComputed ? void 0 : valueOrFn,
54
+ subs: void 0,
55
+ subsTail: void 0,
56
+ deps: void 0,
57
+ depsTail: void 0,
58
+ flags: isComputed ? require_alien.ReactiveFlags.None : require_alien.ReactiveFlags.Mutable,
59
+ get() {
60
+ if (activeSub !== void 0) link(atom, activeSub, cycle);
61
+ return atom._snapshot;
62
+ },
63
+ subscribe(observerOrFn) {
64
+ const obs = toObserver(observerOrFn);
65
+ const observed = { current: false };
66
+ const e = effect(() => {
67
+ atom.get();
68
+ if (!observed.current) observed.current = true;
69
+ else obs.next?.(atom._snapshot);
70
+ });
71
+ return { unsubscribe: () => {
72
+ e.stop();
73
+ } };
74
+ },
75
+ _update(getValue) {
76
+ const prevSub = activeSub;
77
+ const compare = options?.compare ?? Object.is;
78
+ if (isComputed) {
79
+ activeSub = atom;
80
+ ++cycle;
81
+ atom.depsTail = void 0;
82
+ } else if (getValue === void 0) return false;
83
+ if (isComputed) atom.flags = require_alien.ReactiveFlags.Mutable | require_alien.ReactiveFlags.RecursedCheck;
84
+ try {
85
+ const oldValue = atom._snapshot;
86
+ const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
87
+ if (oldValue === void 0 || !compare(oldValue, newValue)) {
88
+ atom._snapshot = newValue;
89
+ return true;
90
+ }
91
+ return false;
92
+ } finally {
93
+ activeSub = prevSub;
94
+ if (isComputed) atom.flags &= ~require_alien.ReactiveFlags.RecursedCheck;
95
+ purgeDeps(atom);
96
+ }
97
+ }
98
+ };
99
+ if (isComputed) {
100
+ atom.flags = require_alien.ReactiveFlags.Mutable | require_alien.ReactiveFlags.Dirty;
101
+ atom.get = function() {
102
+ const flags = atom.flags;
103
+ if (flags & require_alien.ReactiveFlags.Dirty || flags & require_alien.ReactiveFlags.Pending && checkDirty(atom.deps, atom)) {
104
+ if (atom._update()) {
105
+ const subs = atom.subs;
106
+ if (subs !== void 0) shallowPropagate(subs);
107
+ }
108
+ } else if (flags & require_alien.ReactiveFlags.Pending) atom.flags = flags & ~require_alien.ReactiveFlags.Pending;
109
+ if (activeSub !== void 0) link(atom, activeSub, cycle);
110
+ return atom._snapshot;
111
+ };
112
+ } else atom.set = function(valueOrFn) {
113
+ if (atom._update(valueOrFn)) {
114
+ const subs = atom.subs;
115
+ if (subs !== void 0) {
116
+ propagate(subs);
117
+ shallowPropagate(subs);
118
+ flush();
119
+ }
120
+ }
121
+ };
122
+ return atom;
123
+ }
124
+ function effect(fn) {
125
+ const run = () => {
126
+ const prevSub = activeSub;
127
+ activeSub = effectObj;
128
+ ++cycle;
129
+ effectObj.depsTail = void 0;
130
+ effectObj.flags = require_alien.ReactiveFlags.Watching | require_alien.ReactiveFlags.RecursedCheck;
131
+ try {
132
+ return fn();
133
+ } finally {
134
+ activeSub = prevSub;
135
+ effectObj.flags &= ~require_alien.ReactiveFlags.RecursedCheck;
136
+ purgeDeps(effectObj);
137
+ }
138
+ };
139
+ const effectObj = {
140
+ deps: void 0,
141
+ depsTail: void 0,
142
+ subs: void 0,
143
+ subsTail: void 0,
144
+ flags: require_alien.ReactiveFlags.Watching | require_alien.ReactiveFlags.RecursedCheck,
145
+ notify() {
146
+ const flags = this.flags;
147
+ if (flags & require_alien.ReactiveFlags.Dirty || flags & require_alien.ReactiveFlags.Pending && checkDirty(this.deps, this)) run();
148
+ else this.flags = require_alien.ReactiveFlags.Watching;
149
+ },
150
+ stop() {
151
+ this.flags = require_alien.ReactiveFlags.None;
152
+ this.depsTail = void 0;
153
+ purgeDeps(this);
154
+ }
155
+ };
156
+ run();
157
+ return effectObj;
158
+ }
159
+ //#endregion
160
+ exports.createAtom = createAtom;
161
+ exports.toObserver = toObserver;
@@ -0,0 +1,160 @@
1
+ import { ReactiveFlags, createReactiveSystem } from "./alien.js";
2
+ //#region ../../node_modules/@tanstack/store/dist/atom.js
3
+ function toObserver(nextHandler, errorHandler, completionHandler) {
4
+ const isObserver = typeof nextHandler === "object";
5
+ const self = isObserver ? nextHandler : void 0;
6
+ return {
7
+ next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
8
+ error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
9
+ complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
10
+ };
11
+ }
12
+ var queuedEffects = [];
13
+ var cycle = 0;
14
+ var { link, unlink, propagate, checkDirty, shallowPropagate } = /* @__PURE__ */ createReactiveSystem({
15
+ update(atom) {
16
+ return atom._update();
17
+ },
18
+ notify(effect) {
19
+ queuedEffects[queuedEffectsLength++] = effect;
20
+ effect.flags &= ~ReactiveFlags.Watching;
21
+ },
22
+ unwatched(atom) {
23
+ if (atom.depsTail !== void 0) {
24
+ atom.depsTail = void 0;
25
+ atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
26
+ purgeDeps(atom);
27
+ }
28
+ }
29
+ });
30
+ var notifyIndex = 0;
31
+ var queuedEffectsLength = 0;
32
+ var activeSub;
33
+ var batchDepth = 0;
34
+ function purgeDeps(sub) {
35
+ const depsTail = sub.depsTail;
36
+ let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
37
+ while (dep !== void 0) dep = unlink(dep, sub);
38
+ }
39
+ function flush() {
40
+ if (batchDepth > 0) return;
41
+ while (notifyIndex < queuedEffectsLength) {
42
+ const effect = queuedEffects[notifyIndex];
43
+ queuedEffects[notifyIndex++] = void 0;
44
+ effect.notify();
45
+ }
46
+ notifyIndex = 0;
47
+ queuedEffectsLength = 0;
48
+ }
49
+ function createAtom(valueOrFn, options) {
50
+ const isComputed = typeof valueOrFn === "function";
51
+ const getter = valueOrFn;
52
+ const atom = {
53
+ _snapshot: isComputed ? void 0 : valueOrFn,
54
+ subs: void 0,
55
+ subsTail: void 0,
56
+ deps: void 0,
57
+ depsTail: void 0,
58
+ flags: isComputed ? ReactiveFlags.None : ReactiveFlags.Mutable,
59
+ get() {
60
+ if (activeSub !== void 0) link(atom, activeSub, cycle);
61
+ return atom._snapshot;
62
+ },
63
+ subscribe(observerOrFn) {
64
+ const obs = toObserver(observerOrFn);
65
+ const observed = { current: false };
66
+ const e = effect(() => {
67
+ atom.get();
68
+ if (!observed.current) observed.current = true;
69
+ else obs.next?.(atom._snapshot);
70
+ });
71
+ return { unsubscribe: () => {
72
+ e.stop();
73
+ } };
74
+ },
75
+ _update(getValue) {
76
+ const prevSub = activeSub;
77
+ const compare = options?.compare ?? Object.is;
78
+ if (isComputed) {
79
+ activeSub = atom;
80
+ ++cycle;
81
+ atom.depsTail = void 0;
82
+ } else if (getValue === void 0) return false;
83
+ if (isComputed) atom.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
84
+ try {
85
+ const oldValue = atom._snapshot;
86
+ const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
87
+ if (oldValue === void 0 || !compare(oldValue, newValue)) {
88
+ atom._snapshot = newValue;
89
+ return true;
90
+ }
91
+ return false;
92
+ } finally {
93
+ activeSub = prevSub;
94
+ if (isComputed) atom.flags &= ~ReactiveFlags.RecursedCheck;
95
+ purgeDeps(atom);
96
+ }
97
+ }
98
+ };
99
+ if (isComputed) {
100
+ atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
101
+ atom.get = function() {
102
+ const flags = atom.flags;
103
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(atom.deps, atom)) {
104
+ if (atom._update()) {
105
+ const subs = atom.subs;
106
+ if (subs !== void 0) shallowPropagate(subs);
107
+ }
108
+ } else if (flags & ReactiveFlags.Pending) atom.flags = flags & ~ReactiveFlags.Pending;
109
+ if (activeSub !== void 0) link(atom, activeSub, cycle);
110
+ return atom._snapshot;
111
+ };
112
+ } else atom.set = function(valueOrFn) {
113
+ if (atom._update(valueOrFn)) {
114
+ const subs = atom.subs;
115
+ if (subs !== void 0) {
116
+ propagate(subs);
117
+ shallowPropagate(subs);
118
+ flush();
119
+ }
120
+ }
121
+ };
122
+ return atom;
123
+ }
124
+ function effect(fn) {
125
+ const run = () => {
126
+ const prevSub = activeSub;
127
+ activeSub = effectObj;
128
+ ++cycle;
129
+ effectObj.depsTail = void 0;
130
+ effectObj.flags = ReactiveFlags.Watching | ReactiveFlags.RecursedCheck;
131
+ try {
132
+ return fn();
133
+ } finally {
134
+ activeSub = prevSub;
135
+ effectObj.flags &= ~ReactiveFlags.RecursedCheck;
136
+ purgeDeps(effectObj);
137
+ }
138
+ };
139
+ const effectObj = {
140
+ deps: void 0,
141
+ depsTail: void 0,
142
+ subs: void 0,
143
+ subsTail: void 0,
144
+ flags: ReactiveFlags.Watching | ReactiveFlags.RecursedCheck,
145
+ notify() {
146
+ const flags = this.flags;
147
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) run();
148
+ else this.flags = ReactiveFlags.Watching;
149
+ },
150
+ stop() {
151
+ this.flags = ReactiveFlags.None;
152
+ this.depsTail = void 0;
153
+ purgeDeps(this);
154
+ }
155
+ };
156
+ run();
157
+ return effectObj;
158
+ }
159
+ //#endregion
160
+ export { createAtom, toObserver };
@@ -0,0 +1,25 @@
1
+ const require_atom = require("./atom.cjs");
2
+ //#region ../../node_modules/@tanstack/store/dist/store.js
3
+ var Store = class {
4
+ constructor(valueOrFn, actionsFactory) {
5
+ this.atom = require_atom.createAtom(valueOrFn);
6
+ this.get = this.get.bind(this);
7
+ this.setState = this.setState.bind(this);
8
+ this.subscribe = this.subscribe.bind(this);
9
+ if (actionsFactory) this.actions = actionsFactory(this);
10
+ }
11
+ setState(updater) {
12
+ this.atom.set(updater);
13
+ }
14
+ get state() {
15
+ return this.atom.get();
16
+ }
17
+ get() {
18
+ return this.state;
19
+ }
20
+ subscribe(observerOrFn) {
21
+ return this.atom.subscribe(require_atom.toObserver(observerOrFn));
22
+ }
23
+ };
24
+ //#endregion
25
+ exports.Store = Store;