@redis-ui/components 47.3.3 → 47.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppSelectionMenu/components/Compose/Compose.cjs +1 -1
- package/dist/AppSelectionMenu/components/Compose/Compose.js +1 -1
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.cjs +1 -1
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.js +1 -1
- package/dist/Checkbox/components/Compose/Compose.cjs +1 -1
- package/dist/Checkbox/components/Compose/Compose.js +1 -1
- package/dist/Checkbox/components/Indicator/Indicator.style.cjs +2 -2
- package/dist/Checkbox/components/Indicator/Indicator.style.js +3 -3
- package/dist/Drawer/components/Description/Description.cjs +1 -1
- package/dist/Drawer/components/Description/Description.js +1 -1
- package/dist/Drawer/components/Header/components/Title/Title.cjs +1 -1
- package/dist/Drawer/components/Header/components/Title/Title.js +1 -1
- package/dist/Inputs/PasswordInput/components/PasswordInput.context.cjs +1 -1
- package/dist/Inputs/PasswordInput/components/PasswordInput.context.js +1 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +1 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +1 -1
- package/dist/Inputs/components/Context/InputValue.context.d.ts +1 -1
- package/dist/Inputs/components/Context/InputValueProvider.cjs +1 -1
- package/dist/Inputs/components/Context/InputValueProvider.js +1 -1
- package/dist/Inputs/components/Context/NumericInputValueProvider.cjs +1 -1
- package/dist/Inputs/components/Context/NumericInputValueProvider.js +1 -1
- package/dist/Inputs/components/InputTag/InputTag.cjs +1 -1
- package/dist/Inputs/components/InputTag/InputTag.js +1 -1
- package/dist/Loader/Loader.cjs +1 -1
- package/dist/Loader/Loader.js +1 -1
- package/dist/Modal/components/Content/components/Description/Description.cjs +1 -1
- package/dist/Modal/components/Content/components/Description/Description.js +1 -1
- package/dist/Modal/components/Content/components/Header/components/Title/Title.cjs +1 -1
- package/dist/Modal/components/Content/components/Header/components/Title/Title.js +1 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.cjs +1 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.d.ts +1 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.js +1 -1
- package/dist/MultiSelect/components/Content/components/SelectAll/SelectAll.cjs +11 -7
- package/dist/MultiSelect/components/Content/components/SelectAll/SelectAll.js +12 -8
- package/dist/RadioGroup/components/Compose/Compose.cjs +2 -2
- package/dist/RadioGroup/components/Compose/Compose.js +2 -2
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.cjs +1 -1
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.js +1 -1
- package/dist/Section/components/Compose/Compose.cjs +1 -1
- package/dist/Section/components/Compose/Compose.js +1 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.cjs +1 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.js +1 -1
- package/dist/Select/components/Context/hooks/useSelectContextApi.d.ts +1 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.cjs +1 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.js +1 -1
- package/dist/Slider/components/Compose/Compose.cjs +1 -1
- package/dist/Slider/components/Compose/Compose.js +1 -1
- package/dist/Switch/components/Compose/Compose.cjs +1 -1
- package/dist/Switch/components/Compose/Compose.js +1 -1
- package/dist/Toast/Toaster.style.cjs +2 -2
- package/dist/Toast/Toaster.style.js +2 -2
- package/dist/Toast/core/mapping.helpers.cjs +1 -1
- package/dist/Toast/core/mapping.helpers.js +1 -1
- package/dist/Typography/hooks/useEllipsisTooltip.d.ts +1 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.cjs +108 -62
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +108 -62
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.cjs +5 -4
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +5 -4
- package/dist/node_modules/@radix-ui/react-collection/dist/index.cjs +4 -2
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +5 -3
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +16 -2
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +16 -2
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +8 -8
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +6 -4
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +6 -4
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +4 -3
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +4 -3
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +4 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +4 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-menu/dist/index.cjs +8 -5
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +8 -5
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +6 -4
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +6 -4
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +4 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +4 -1
- package/dist/node_modules/@radix-ui/react-presence/dist/index.cjs +16 -6
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +16 -5
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +3 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +3 -1
- package/dist/node_modules/@radix-ui/react-progress/dist/index.cjs +2 -2
- package/dist/node_modules/@radix-ui/react-progress/dist/index.js +2 -2
- package/dist/node_modules/@radix-ui/{react-slider → react-progress}/node_modules/@radix-ui/react-context/dist/index.cjs +2 -1
- package/dist/node_modules/@radix-ui/{react-switch → react-progress}/node_modules/@radix-ui/react-context/dist/index.js +2 -1
- package/dist/node_modules/@radix-ui/{react-slider → react-progress}/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/{react-switch → react-progress}/node_modules/@radix-ui/react-primitive/dist/index.js +4 -2
- package/dist/node_modules/@radix-ui/{react-slider → react-progress}/node_modules/@radix-ui/react-slot/dist/index.cjs +14 -4
- package/dist/node_modules/@radix-ui/react-progress/node_modules/@radix-ui/react-slot/dist/index.js +97 -0
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.cjs +16 -11
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +16 -11
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +11 -6
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +11 -6
- package/dist/node_modules/@radix-ui/react-select/dist/index.cjs +56 -35
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +57 -36
- package/dist/node_modules/@radix-ui/react-slider/dist/index.cjs +35 -35
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +10 -10
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +55 -39
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +54 -38
- package/dist/node_modules/@radix-ui/react-switch/dist/index.cjs +27 -23
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +17 -13
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.cjs +2 -1
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +2 -1
- package/dist/node_modules/@radix-ui/react-toggle/dist/index.cjs +4 -3
- package/dist/node_modules/@radix-ui/react-toggle/dist/index.js +4 -3
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +33 -17
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +33 -17
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +29 -16
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +29 -16
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +14 -11
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +14 -11
- package/dist/node_modules/@tanstack/hotkeys/dist/constants.cjs +389 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/constants.js +383 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/format.cjs +22 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/format.js +22 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.cjs +363 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.js +363 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.cjs +111 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.js +107 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/match.cjs +59 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/match.js +59 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/parse.cjs +143 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/parse.js +141 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.cjs +10 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.js +8 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs +121 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.js +120 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.cjs +9 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.js +9 -0
- package/dist/node_modules/@tanstack/store/dist/alien.cjs +183 -0
- package/dist/node_modules/@tanstack/store/dist/alien.js +182 -0
- package/dist/node_modules/@tanstack/store/dist/atom.cjs +161 -0
- package/dist/node_modules/@tanstack/store/dist/atom.js +160 -0
- package/dist/node_modules/@tanstack/store/dist/store.cjs +25 -0
- package/dist/node_modules/@tanstack/store/dist/store.js +25 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +8 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +8 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.cjs +3 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +3 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +4 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +4 -2
- package/dist/{node_modules/@radix-ui/react-switch → packages/components}/node_modules/@radix-ui/react-primitive/dist/index.cjs +5 -3
- package/dist/{node_modules/@radix-ui/react-slider → packages/components}/node_modules/@radix-ui/react-primitive/dist/index.js +1 -1
- package/dist/packages/components/node_modules/@radix-ui/react-slot/dist/index.cjs +99 -0
- package/dist/{node_modules/@radix-ui/react-slider → packages/components}/node_modules/@radix-ui/react-slot/dist/index.js +14 -4
- package/dist/packages/components/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +32 -0
- package/dist/packages/components/node_modules/@radix-ui/react-visually-hidden/dist/index.js +30 -0
- package/dist/{node_modules → packages/components/node_modules}/react-toastify/dist/react-toastify.esm.cjs +3 -3
- package/dist/{node_modules → packages/components/node_modules}/react-toastify/dist/react-toastify.esm.js +2 -2
- package/package.json +19 -15
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/number/dist/index.cjs +0 -6
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/number/dist/index.js +0 -6
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/primitive/dist/index.cjs +0 -9
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/primitive/dist/index.js +0 -9
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.cjs +0 -81
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -31
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -28
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-context/dist/index.js +0 -67
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-direction/dist/index.cjs +0 -12
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-direction/dist/index.js +0 -10
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +0 -57
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -55
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -7
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -5
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-previous/dist/index.cjs +0 -19
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-size/dist/index.cjs +0 -41
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-size/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/primitive/dist/index.cjs +0 -9
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/primitive/dist/index.js +0 -9
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -31
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -28
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-context/dist/index.cjs +0 -69
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot/dist/index.cjs +0 -82
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot/dist/index.js +0 -80
- package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.cjs +0 -289
- 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;
|