Sort le serveur dans une crate pmoserver
This commit is contained in:
21
pmoapp/webapp/node_modules/alien-signals/LICENSE
generated
vendored
Normal file
21
pmoapp/webapp/node_modules/alien-signals/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024-present Johnson Chu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
189
pmoapp/webapp/node_modules/alien-signals/README.md
generated
vendored
Normal file
189
pmoapp/webapp/node_modules/alien-signals/README.md
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
<p align="center">
|
||||
<img src="assets/logo.png" width="250"><br>
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://npmjs.com/package/alien-signals"><img src="https://badgen.net/npm/v/alien-signals" alt="npm package"></a>
|
||||
<a href="https://deepwiki.com/stackblitz/alien-signals"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
|
||||
</p>
|
||||
|
||||
# alien-signals
|
||||
|
||||
This project explores a push-pull based signal algorithm. Its current implementation is similar to or related to certain other frontend projects:
|
||||
|
||||
- Propagation algorithm of Vue 3
|
||||
- Preact’s double-linked-list approach (https://preactjs.com/blog/signal-boosting/)
|
||||
- Inner effects scheduling of Svelte
|
||||
- Graph-coloring approach of Reactively (https://milomg.dev/2022-12-01/reactivity)
|
||||
|
||||
We impose some constraints (such as not using Array/Set/Map and disallowing function recursion in [the algorithmic core](https://github.com/stackblitz/alien-signals/blob/master/src/system.ts)) to ensure performance. We found that under these conditions, maintaining algorithmic simplicity offers more significant improvements than complex scheduling strategies.
|
||||
|
||||
Even though Vue 3.4 is already optimized, alien-signals is still noticeably faster. (I wrote code for both, and since they share similar algorithms, they’re quite comparable.)
|
||||
|
||||
<img width="1210" alt="Image" src="https://github.com/user-attachments/assets/88448f6d-4034-4389-89aa-9edf3da77254" />
|
||||
|
||||
> Benchmark repo: https://github.com/transitive-bullshit/js-reactivity-benchmark
|
||||
|
||||
## Background
|
||||
|
||||
I spent considerable time [optimizing Vue 3.4’s reactivity system](https://github.com/vuejs/core/pull/5912), gaining experience along the way. Since Vue 3.5 [switched to a pull-based algorithm similar to Preact](https://github.com/vuejs/core/pull/10397), I decided to continue researching a push-pull based implementation in a separate project. Our end goal is to implement fully incremental AST parsing and virtual code generation in Vue language tools, based on alien-signals.
|
||||
|
||||
## Other Language Implementations
|
||||
|
||||
- **Dart:** [medz/alien-signals-dart](https://github.com/medz/alien-signals-dart)
|
||||
- **Lua:** [YanqingXu/alien-signals-in-lua](https://github.com/YanqingXu/alien-signals-in-lua)
|
||||
- **Lua 5.4:** [xuhuanzy/alien-signals-lua](https://github.com/xuhuanzy/alien-signals-lua)
|
||||
- **Luau:** [Nicell/alien-signals-luau](https://github.com/Nicell/alien-signals-luau)
|
||||
- **Java:** [CTRL-Neo-Studios/java-alien-signals](https://github.com/CTRL-Neo-Studios/java-alien-signals)
|
||||
- **C#:** [CTRL-Neo-Studios/csharp-alien-signals](https://github.com/CTRL-Neo-Studios/csharp-alien-signals)
|
||||
- **Go:** [delaneyj/alien-signals-go](https://github.com/delaneyj/alien-signals-go)
|
||||
|
||||
## Derived Projects
|
||||
|
||||
- [Rajaniraiyn/react-alien-signals](https://github.com/Rajaniraiyn/react-alien-signals): React bindings for the alien-signals API
|
||||
- [CCherry07/alien-deepsignals](https://github.com/CCherry07/alien-deepsignals): Use alien-signals with the interface of a plain JavaScript object
|
||||
- [hunghg255/reactjs-signal](https://github.com/hunghg255/reactjs-signal): Share Store State with Signal Pattern
|
||||
- [gn8-ai/universe-alien-signals](https://github.com/gn8-ai/universe-alien-signals): Enables simple use of the Alien Signals state management system in modern frontend frameworks
|
||||
- [WebReflection/alien-signals](https://github.com/WebReflection/alien-signals): Preact signals like API and a class based approach for easy brand check
|
||||
- [@lift-html/alien](https://github.com/JLarky/lift-html/tree/main/packages/alien): Integrating alien-signals into lift-html
|
||||
|
||||
## Adoption
|
||||
|
||||
- [vuejs/core](https://github.com/vuejs/core): The core algorithm has been ported to v3.6 (PR: https://github.com/vuejs/core/pull/12349)
|
||||
- [statelyai/xstate](https://github.com/statelyai/xstate): The core algorithm has been ported to implement the atom architecture (PR: https://github.com/statelyai/xstate/pull/5250)
|
||||
- [flamrdevs/xignal](https://github.com/flamrdevs/xignal): Infrastructure for the reactive system
|
||||
- [vuejs/language-tools](https://github.com/vuejs/language-tools): Used in the language-core package for virtual code generation
|
||||
- [unuse](https://github.com/un-ts/unuse): A framework-agnostic `use` library inspired by `VueUse`
|
||||
|
||||
## Usage
|
||||
|
||||
#### Basic APIs
|
||||
|
||||
```ts
|
||||
import { signal, computed, effect } from 'alien-signals';
|
||||
|
||||
const count = signal(1);
|
||||
const doubleCount = computed(() => count() * 2);
|
||||
|
||||
effect(() => {
|
||||
console.log(`Count is: ${count()}`);
|
||||
}); // Console: Count is: 1
|
||||
|
||||
console.log(doubleCount()); // 2
|
||||
|
||||
count(2); // Console: Count is: 2
|
||||
|
||||
console.log(doubleCount()); // 4
|
||||
```
|
||||
|
||||
#### Effect Scope
|
||||
|
||||
```ts
|
||||
import { signal, effect, effectScope } from 'alien-signals';
|
||||
|
||||
const count = signal(1);
|
||||
|
||||
const stopScope = effectScope(() => {
|
||||
effect(() => {
|
||||
console.log(`Count in scope: ${count()}`);
|
||||
}); // Console: Count in scope: 1
|
||||
});
|
||||
|
||||
count(2); // Console: Count in scope: 2
|
||||
|
||||
stopScope();
|
||||
|
||||
count(3); // No console output
|
||||
```
|
||||
|
||||
#### Creating Your Own Surface API
|
||||
|
||||
You can reuse alien-signals’ core algorithm via `createReactiveSystem()` to build your own signal API. For implementation examples, see:
|
||||
|
||||
- [Starter template](https://github.com/johnsoncodehk/alien-signals-starter) (implements `.get()` & `.set()` methods like the [Signals proposal](https://github.com/tc39/proposal-signals))
|
||||
- [stackblitz/alien-signals/src/index.ts](https://github.com/stackblitz/alien-signals/blob/master/src/index.ts)
|
||||
- [proposal-signals/signal-polyfill#44](https://github.com/proposal-signals/signal-polyfill/pull/44)
|
||||
|
||||
|
||||
## About `propagate` and `checkDirty` functions
|
||||
|
||||
In order to eliminate recursive calls and improve performance, we record the last link node of the previous loop in `propagate` and `checkDirty` functions, and implement the rollback logic to return to this node.
|
||||
|
||||
This results in code that is difficult to understand, and you don't necessarily get the same performance improvements in other languages, so we record the original implementation without eliminating recursive calls here for reference.
|
||||
|
||||
#### `propagate`
|
||||
|
||||
```ts
|
||||
function propagate(link: Link): void {
|
||||
do {
|
||||
const sub = link.sub;
|
||||
|
||||
let flags = sub.flags;
|
||||
|
||||
if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
|
||||
sub.flags = flags | ReactiveFlags.Pending;
|
||||
} else if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed))) {
|
||||
flags = ReactiveFlags.None;
|
||||
} else if (!(flags & ReactiveFlags.RecursedCheck)) {
|
||||
sub.flags = (flags & ~ReactiveFlags.Recursed) | ReactiveFlags.Pending;
|
||||
} else if (!(flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && isValidLink(link, sub)) {
|
||||
sub.flags = flags | ReactiveFlags.Recursed | ReactiveFlags.Pending;
|
||||
flags &= ReactiveFlags.Mutable;
|
||||
} else {
|
||||
flags = ReactiveFlags.None;
|
||||
}
|
||||
|
||||
if (flags & ReactiveFlags.Watching) {
|
||||
notify(sub);
|
||||
}
|
||||
|
||||
if (flags & ReactiveFlags.Mutable) {
|
||||
const subSubs = sub.subs;
|
||||
if (subSubs !== undefined) {
|
||||
propagate(subSubs);
|
||||
}
|
||||
}
|
||||
|
||||
link = link.nextSub!;
|
||||
} while (link !== undefined);
|
||||
}
|
||||
```
|
||||
|
||||
#### `checkDirty`
|
||||
|
||||
```ts
|
||||
function checkDirty(link: Link, sub: ReactiveNode): boolean {
|
||||
do {
|
||||
const dep = link.dep;
|
||||
const depFlags = dep.flags;
|
||||
|
||||
if (sub.flags & ReactiveFlags.Dirty) {
|
||||
return true;
|
||||
} else if ((depFlags & (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) === (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) {
|
||||
if (update(dep)) {
|
||||
const subs = dep.subs!;
|
||||
if (subs.nextSub !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if ((depFlags & (ReactiveFlags.Mutable | ReactiveFlags.Pending)) === (ReactiveFlags.Mutable | ReactiveFlags.Pending)) {
|
||||
if (checkDirty(dep.deps!, dep)) {
|
||||
if (update(dep)) {
|
||||
const subs = dep.subs!;
|
||||
if (subs.nextSub !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
dep.flags = depFlags & ~ReactiveFlags.Pending;
|
||||
}
|
||||
}
|
||||
|
||||
link = link.nextDep!;
|
||||
} while (link !== undefined);
|
||||
|
||||
return false;
|
||||
}
|
||||
```
|
||||
297
pmoapp/webapp/node_modules/alien-signals/cjs/index.cjs
generated
vendored
Normal file
297
pmoapp/webapp/node_modules/alien-signals/cjs/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getActiveSub = getActiveSub;
|
||||
exports.setActiveSub = setActiveSub;
|
||||
exports.getBatchDepth = getBatchDepth;
|
||||
exports.startBatch = startBatch;
|
||||
exports.endBatch = endBatch;
|
||||
exports.isSignal = isSignal;
|
||||
exports.isComputed = isComputed;
|
||||
exports.isEffect = isEffect;
|
||||
exports.isEffectScope = isEffectScope;
|
||||
exports.signal = signal;
|
||||
exports.computed = computed;
|
||||
exports.effect = effect;
|
||||
exports.effectScope = effectScope;
|
||||
const system_js_1 = require("./system.cjs");
|
||||
let cycle = 0;
|
||||
const queuedEffects = [];
|
||||
const { link, unlink, propagate, checkDirty, shallowPropagate, } = (0, system_js_1.createReactiveSystem)({
|
||||
update(signal) {
|
||||
if ('getter' in signal) {
|
||||
return updateComputed(signal);
|
||||
}
|
||||
else {
|
||||
return updateSignal(signal, signal.value);
|
||||
}
|
||||
},
|
||||
notify,
|
||||
unwatched(node) {
|
||||
if ('getter' in node) {
|
||||
let toRemove = node.deps;
|
||||
if (toRemove !== undefined) {
|
||||
node.flags = 17;
|
||||
do {
|
||||
toRemove = unlink(toRemove, node);
|
||||
} while (toRemove !== undefined);
|
||||
}
|
||||
}
|
||||
else if ('fn' in node) {
|
||||
effectOper.call(node);
|
||||
}
|
||||
else if (!('previousValue' in node)) {
|
||||
effectScopeOper.call(node);
|
||||
}
|
||||
},
|
||||
});
|
||||
let batchDepth = 0;
|
||||
let notifyIndex = 0;
|
||||
let queuedEffectsLength = 0;
|
||||
let activeSub;
|
||||
function getActiveSub() {
|
||||
return activeSub;
|
||||
}
|
||||
function setActiveSub(sub) {
|
||||
const prevSub = activeSub;
|
||||
activeSub = sub;
|
||||
return prevSub;
|
||||
}
|
||||
function getBatchDepth() {
|
||||
return batchDepth;
|
||||
}
|
||||
function startBatch() {
|
||||
++batchDepth;
|
||||
}
|
||||
function endBatch() {
|
||||
if (!--batchDepth) {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
function isSignal(fn) {
|
||||
return fn.name === 'bound signalOper';
|
||||
}
|
||||
function isComputed(fn) {
|
||||
return fn.name === 'bound computedOper';
|
||||
}
|
||||
function isEffect(fn) {
|
||||
return fn.name === 'bound effectOper';
|
||||
}
|
||||
function isEffectScope(fn) {
|
||||
return fn.name === 'bound effectScopeOper';
|
||||
}
|
||||
function signal(initialValue) {
|
||||
return signalOper.bind({
|
||||
previousValue: initialValue,
|
||||
value: initialValue,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
flags: 1,
|
||||
});
|
||||
}
|
||||
function computed(getter) {
|
||||
return computedOper.bind({
|
||||
value: undefined,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
deps: undefined,
|
||||
depsTail: undefined,
|
||||
flags: 0,
|
||||
getter: getter,
|
||||
});
|
||||
}
|
||||
function effect(fn) {
|
||||
const e = {
|
||||
fn,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
deps: undefined,
|
||||
depsTail: undefined,
|
||||
flags: 2,
|
||||
};
|
||||
const prevSub = setActiveSub(e);
|
||||
if (prevSub !== undefined) {
|
||||
link(e, prevSub, 0);
|
||||
}
|
||||
try {
|
||||
e.fn();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
}
|
||||
return effectOper.bind(e);
|
||||
}
|
||||
function effectScope(fn) {
|
||||
const e = {
|
||||
deps: undefined,
|
||||
depsTail: undefined,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
flags: 0,
|
||||
};
|
||||
const prevSub = setActiveSub(e);
|
||||
if (prevSub !== undefined) {
|
||||
link(e, prevSub, 0);
|
||||
}
|
||||
try {
|
||||
fn();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
}
|
||||
return effectScopeOper.bind(e);
|
||||
}
|
||||
function updateComputed(c) {
|
||||
++cycle;
|
||||
c.depsTail = undefined;
|
||||
c.flags = 5;
|
||||
const prevSub = setActiveSub(c);
|
||||
try {
|
||||
const oldValue = c.value;
|
||||
return oldValue !== (c.value = c.getter(oldValue));
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
c.flags &= ~4;
|
||||
purgeDeps(c);
|
||||
}
|
||||
}
|
||||
function updateSignal(s, value) {
|
||||
s.flags = 1;
|
||||
return s.previousValue !== (s.previousValue = value);
|
||||
}
|
||||
function notify(e) {
|
||||
const flags = e.flags;
|
||||
if (!(flags & 64)) {
|
||||
e.flags = flags | 64;
|
||||
const subs = e.subs;
|
||||
if (subs !== undefined) {
|
||||
notify(subs.sub);
|
||||
}
|
||||
else {
|
||||
queuedEffects[queuedEffectsLength++] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
function run(e, flags) {
|
||||
if (flags & 16
|
||||
|| (flags & 32
|
||||
&& (checkDirty(e.deps, e)
|
||||
|| (e.flags = flags & ~32, false)))) {
|
||||
++cycle;
|
||||
e.depsTail = undefined;
|
||||
e.flags = 6;
|
||||
const prevSub = setActiveSub(e);
|
||||
try {
|
||||
e.fn();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
e.flags &= ~4;
|
||||
purgeDeps(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
let link = e.deps;
|
||||
while (link !== undefined) {
|
||||
const dep = link.dep;
|
||||
const depFlags = dep.flags;
|
||||
if (depFlags & 64) {
|
||||
run(dep, dep.flags = depFlags & ~(64));
|
||||
}
|
||||
link = link.nextDep;
|
||||
}
|
||||
}
|
||||
}
|
||||
function flush() {
|
||||
while (notifyIndex < queuedEffectsLength) {
|
||||
const effect = queuedEffects[notifyIndex];
|
||||
queuedEffects[notifyIndex++] = undefined;
|
||||
run(effect, effect.flags &= ~(64));
|
||||
}
|
||||
notifyIndex = 0;
|
||||
queuedEffectsLength = 0;
|
||||
}
|
||||
function computedOper() {
|
||||
const flags = this.flags;
|
||||
if (flags & 16
|
||||
|| (flags & 32
|
||||
&& (checkDirty(this.deps, this)
|
||||
|| (this.flags = flags & ~32, false)))) {
|
||||
if (updateComputed(this)) {
|
||||
const subs = this.subs;
|
||||
if (subs !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!flags) {
|
||||
this.flags = 1;
|
||||
const prevSub = setActiveSub(this);
|
||||
try {
|
||||
this.value = this.getter();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
}
|
||||
}
|
||||
const sub = activeSub;
|
||||
if (sub !== undefined) {
|
||||
link(this, sub, cycle);
|
||||
}
|
||||
return this.value;
|
||||
}
|
||||
function signalOper(...value) {
|
||||
if (value.length) {
|
||||
if (this.value !== (this.value = value[0])) {
|
||||
this.flags = 17;
|
||||
const subs = this.subs;
|
||||
if (subs !== undefined) {
|
||||
propagate(subs);
|
||||
if (!batchDepth) {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const value = this.value;
|
||||
if (this.flags & 16) {
|
||||
if (updateSignal(this, value)) {
|
||||
const subs = this.subs;
|
||||
if (subs !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
}
|
||||
}
|
||||
let sub = activeSub;
|
||||
while (sub !== undefined) {
|
||||
if (sub.flags & 3) {
|
||||
link(this, sub, cycle);
|
||||
break;
|
||||
}
|
||||
sub = sub.subs?.sub;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function effectOper() {
|
||||
effectScopeOper.call(this);
|
||||
this.flags = 0;
|
||||
}
|
||||
function effectScopeOper() {
|
||||
let dep = this.deps;
|
||||
while (dep !== undefined) {
|
||||
dep = unlink(dep, this);
|
||||
}
|
||||
const sub = this.subs;
|
||||
if (sub !== undefined) {
|
||||
unlink(sub);
|
||||
}
|
||||
}
|
||||
function purgeDeps(sub) {
|
||||
const depsTail = sub.depsTail;
|
||||
let toRemove = depsTail !== undefined ? depsTail.nextDep : sub.deps;
|
||||
while (toRemove !== undefined) {
|
||||
toRemove = unlink(toRemove, sub);
|
||||
}
|
||||
}
|
||||
238
pmoapp/webapp/node_modules/alien-signals/cjs/system.cjs
generated
vendored
Normal file
238
pmoapp/webapp/node_modules/alien-signals/cjs/system.cjs
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReactiveFlags = void 0;
|
||||
exports.createReactiveSystem = createReactiveSystem;
|
||||
var ReactiveFlags;
|
||||
(function (ReactiveFlags) {
|
||||
ReactiveFlags[ReactiveFlags["None"] = 0] = "None";
|
||||
ReactiveFlags[ReactiveFlags["Mutable"] = 1] = "Mutable";
|
||||
ReactiveFlags[ReactiveFlags["Watching"] = 2] = "Watching";
|
||||
ReactiveFlags[ReactiveFlags["RecursedCheck"] = 4] = "RecursedCheck";
|
||||
ReactiveFlags[ReactiveFlags["Recursed"] = 8] = "Recursed";
|
||||
ReactiveFlags[ReactiveFlags["Dirty"] = 16] = "Dirty";
|
||||
ReactiveFlags[ReactiveFlags["Pending"] = 32] = "Pending";
|
||||
})(ReactiveFlags || (exports.ReactiveFlags = ReactiveFlags = {}));
|
||||
function createReactiveSystem({ update, notify, unwatched, }) {
|
||||
return {
|
||||
link,
|
||||
unlink,
|
||||
propagate,
|
||||
checkDirty,
|
||||
shallowPropagate,
|
||||
};
|
||||
function link(dep, sub, version) {
|
||||
const prevDep = sub.depsTail;
|
||||
if (prevDep !== undefined && prevDep.dep === dep) {
|
||||
return;
|
||||
}
|
||||
const nextDep = prevDep !== undefined ? prevDep.nextDep : sub.deps;
|
||||
if (nextDep !== undefined && nextDep.dep === dep) {
|
||||
nextDep.version = version;
|
||||
sub.depsTail = nextDep;
|
||||
return;
|
||||
}
|
||||
const prevSub = dep.subsTail;
|
||||
if (prevSub !== undefined && prevSub.version === version && prevSub.sub === sub) {
|
||||
return;
|
||||
}
|
||||
const newLink = sub.depsTail
|
||||
= dep.subsTail
|
||||
= {
|
||||
version,
|
||||
dep,
|
||||
sub,
|
||||
prevDep,
|
||||
nextDep,
|
||||
prevSub,
|
||||
nextSub: undefined,
|
||||
};
|
||||
if (nextDep !== undefined) {
|
||||
nextDep.prevDep = newLink;
|
||||
}
|
||||
if (prevDep !== undefined) {
|
||||
prevDep.nextDep = newLink;
|
||||
}
|
||||
else {
|
||||
sub.deps = newLink;
|
||||
}
|
||||
if (prevSub !== undefined) {
|
||||
prevSub.nextSub = newLink;
|
||||
}
|
||||
else {
|
||||
dep.subs = newLink;
|
||||
}
|
||||
}
|
||||
function unlink(link, sub = link.sub) {
|
||||
const dep = link.dep;
|
||||
const prevDep = link.prevDep;
|
||||
const nextDep = link.nextDep;
|
||||
const nextSub = link.nextSub;
|
||||
const prevSub = link.prevSub;
|
||||
if (nextDep !== undefined) {
|
||||
nextDep.prevDep = prevDep;
|
||||
}
|
||||
else {
|
||||
sub.depsTail = prevDep;
|
||||
}
|
||||
if (prevDep !== undefined) {
|
||||
prevDep.nextDep = nextDep;
|
||||
}
|
||||
else {
|
||||
sub.deps = nextDep;
|
||||
}
|
||||
if (nextSub !== undefined) {
|
||||
nextSub.prevSub = prevSub;
|
||||
}
|
||||
else {
|
||||
dep.subsTail = prevSub;
|
||||
}
|
||||
if (prevSub !== undefined) {
|
||||
prevSub.nextSub = nextSub;
|
||||
}
|
||||
else if ((dep.subs = nextSub) === undefined) {
|
||||
unwatched(dep);
|
||||
}
|
||||
return nextDep;
|
||||
}
|
||||
function propagate(link) {
|
||||
let next = link.nextSub;
|
||||
let stack;
|
||||
top: do {
|
||||
const sub = link.sub;
|
||||
let flags = sub.flags;
|
||||
if (!(flags & 60)) {
|
||||
sub.flags = flags | 32;
|
||||
}
|
||||
else if (!(flags & 12)) {
|
||||
flags = 0;
|
||||
}
|
||||
else if (!(flags & 4)) {
|
||||
sub.flags = (flags & ~8) | 32;
|
||||
}
|
||||
else if (!(flags & 48) && isValidLink(link, sub)) {
|
||||
sub.flags = flags | 40;
|
||||
flags &= 1;
|
||||
}
|
||||
else {
|
||||
flags = 0;
|
||||
}
|
||||
if (flags & 2) {
|
||||
notify(sub);
|
||||
}
|
||||
if (flags & 1) {
|
||||
const subSubs = sub.subs;
|
||||
if (subSubs !== undefined) {
|
||||
const nextSub = (link = subSubs).nextSub;
|
||||
if (nextSub !== undefined) {
|
||||
stack = { value: next, prev: stack };
|
||||
next = nextSub;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((link = next) !== undefined) {
|
||||
next = link.nextSub;
|
||||
continue;
|
||||
}
|
||||
while (stack !== undefined) {
|
||||
link = stack.value;
|
||||
stack = stack.prev;
|
||||
if (link !== undefined) {
|
||||
next = link.nextSub;
|
||||
continue top;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
function checkDirty(link, sub) {
|
||||
let stack;
|
||||
let checkDepth = 0;
|
||||
let dirty = false;
|
||||
top: do {
|
||||
const dep = link.dep;
|
||||
const flags = dep.flags;
|
||||
if (sub.flags & 16) {
|
||||
dirty = true;
|
||||
}
|
||||
else if ((flags & 17) === 17) {
|
||||
if (update(dep)) {
|
||||
const subs = dep.subs;
|
||||
if (subs.nextSub !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
else if ((flags & 33) === 33) {
|
||||
if (link.nextSub !== undefined || link.prevSub !== undefined) {
|
||||
stack = { value: link, prev: stack };
|
||||
}
|
||||
link = dep.deps;
|
||||
sub = dep;
|
||||
++checkDepth;
|
||||
continue;
|
||||
}
|
||||
if (!dirty) {
|
||||
const nextDep = link.nextDep;
|
||||
if (nextDep !== undefined) {
|
||||
link = nextDep;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
while (checkDepth--) {
|
||||
const firstSub = sub.subs;
|
||||
const hasMultipleSubs = firstSub.nextSub !== undefined;
|
||||
if (hasMultipleSubs) {
|
||||
link = stack.value;
|
||||
stack = stack.prev;
|
||||
}
|
||||
else {
|
||||
link = firstSub;
|
||||
}
|
||||
if (dirty) {
|
||||
if (update(sub)) {
|
||||
if (hasMultipleSubs) {
|
||||
shallowPropagate(firstSub);
|
||||
}
|
||||
sub = link.sub;
|
||||
continue;
|
||||
}
|
||||
dirty = false;
|
||||
}
|
||||
else {
|
||||
sub.flags &= ~32;
|
||||
}
|
||||
sub = link.sub;
|
||||
const nextDep = link.nextDep;
|
||||
if (nextDep !== undefined) {
|
||||
link = nextDep;
|
||||
continue top;
|
||||
}
|
||||
}
|
||||
return dirty;
|
||||
} while (true);
|
||||
}
|
||||
function shallowPropagate(link) {
|
||||
do {
|
||||
const sub = link.sub;
|
||||
const flags = sub.flags;
|
||||
if ((flags & 48) === 32) {
|
||||
sub.flags = flags | 16;
|
||||
if (flags & 2) {
|
||||
notify(sub);
|
||||
}
|
||||
}
|
||||
} while ((link = link.nextSub) !== undefined);
|
||||
}
|
||||
function isValidLink(checkLink, sub) {
|
||||
let link = sub.depsTail;
|
||||
while (link !== undefined) {
|
||||
if (link === checkLink) {
|
||||
return true;
|
||||
}
|
||||
link = link.prevDep;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
282
pmoapp/webapp/node_modules/alien-signals/esm/index.mjs
generated
vendored
Normal file
282
pmoapp/webapp/node_modules/alien-signals/esm/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,282 @@
|
||||
import { createReactiveSystem } from './system.mjs';
|
||||
let cycle = 0;
|
||||
const queuedEffects = [];
|
||||
const { link, unlink, propagate, checkDirty, shallowPropagate, } = createReactiveSystem({
|
||||
update(signal) {
|
||||
if ('getter' in signal) {
|
||||
return updateComputed(signal);
|
||||
}
|
||||
else {
|
||||
return updateSignal(signal, signal.value);
|
||||
}
|
||||
},
|
||||
notify,
|
||||
unwatched(node) {
|
||||
if ('getter' in node) {
|
||||
let toRemove = node.deps;
|
||||
if (toRemove !== undefined) {
|
||||
node.flags = 17;
|
||||
do {
|
||||
toRemove = unlink(toRemove, node);
|
||||
} while (toRemove !== undefined);
|
||||
}
|
||||
}
|
||||
else if ('fn' in node) {
|
||||
effectOper.call(node);
|
||||
}
|
||||
else if (!('previousValue' in node)) {
|
||||
effectScopeOper.call(node);
|
||||
}
|
||||
},
|
||||
});
|
||||
let batchDepth = 0;
|
||||
let notifyIndex = 0;
|
||||
let queuedEffectsLength = 0;
|
||||
let activeSub;
|
||||
export function getActiveSub() {
|
||||
return activeSub;
|
||||
}
|
||||
export function setActiveSub(sub) {
|
||||
const prevSub = activeSub;
|
||||
activeSub = sub;
|
||||
return prevSub;
|
||||
}
|
||||
export function getBatchDepth() {
|
||||
return batchDepth;
|
||||
}
|
||||
export function startBatch() {
|
||||
++batchDepth;
|
||||
}
|
||||
export function endBatch() {
|
||||
if (!--batchDepth) {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
export function isSignal(fn) {
|
||||
return fn.name === 'bound signalOper';
|
||||
}
|
||||
export function isComputed(fn) {
|
||||
return fn.name === 'bound computedOper';
|
||||
}
|
||||
export function isEffect(fn) {
|
||||
return fn.name === 'bound effectOper';
|
||||
}
|
||||
export function isEffectScope(fn) {
|
||||
return fn.name === 'bound effectScopeOper';
|
||||
}
|
||||
export function signal(initialValue) {
|
||||
return signalOper.bind({
|
||||
previousValue: initialValue,
|
||||
value: initialValue,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
flags: 1,
|
||||
});
|
||||
}
|
||||
export function computed(getter) {
|
||||
return computedOper.bind({
|
||||
value: undefined,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
deps: undefined,
|
||||
depsTail: undefined,
|
||||
flags: 0,
|
||||
getter: getter,
|
||||
});
|
||||
}
|
||||
export function effect(fn) {
|
||||
const e = {
|
||||
fn,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
deps: undefined,
|
||||
depsTail: undefined,
|
||||
flags: 2,
|
||||
};
|
||||
const prevSub = setActiveSub(e);
|
||||
if (prevSub !== undefined) {
|
||||
link(e, prevSub, 0);
|
||||
}
|
||||
try {
|
||||
e.fn();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
}
|
||||
return effectOper.bind(e);
|
||||
}
|
||||
export function effectScope(fn) {
|
||||
const e = {
|
||||
deps: undefined,
|
||||
depsTail: undefined,
|
||||
subs: undefined,
|
||||
subsTail: undefined,
|
||||
flags: 0,
|
||||
};
|
||||
const prevSub = setActiveSub(e);
|
||||
if (prevSub !== undefined) {
|
||||
link(e, prevSub, 0);
|
||||
}
|
||||
try {
|
||||
fn();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
}
|
||||
return effectScopeOper.bind(e);
|
||||
}
|
||||
function updateComputed(c) {
|
||||
++cycle;
|
||||
c.depsTail = undefined;
|
||||
c.flags = 5;
|
||||
const prevSub = setActiveSub(c);
|
||||
try {
|
||||
const oldValue = c.value;
|
||||
return oldValue !== (c.value = c.getter(oldValue));
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
c.flags &= ~4;
|
||||
purgeDeps(c);
|
||||
}
|
||||
}
|
||||
function updateSignal(s, value) {
|
||||
s.flags = 1;
|
||||
return s.previousValue !== (s.previousValue = value);
|
||||
}
|
||||
function notify(e) {
|
||||
const flags = e.flags;
|
||||
if (!(flags & 64)) {
|
||||
e.flags = flags | 64;
|
||||
const subs = e.subs;
|
||||
if (subs !== undefined) {
|
||||
notify(subs.sub);
|
||||
}
|
||||
else {
|
||||
queuedEffects[queuedEffectsLength++] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
function run(e, flags) {
|
||||
if (flags & 16
|
||||
|| (flags & 32
|
||||
&& (checkDirty(e.deps, e)
|
||||
|| (e.flags = flags & ~32, false)))) {
|
||||
++cycle;
|
||||
e.depsTail = undefined;
|
||||
e.flags = 6;
|
||||
const prevSub = setActiveSub(e);
|
||||
try {
|
||||
e.fn();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
e.flags &= ~4;
|
||||
purgeDeps(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
let link = e.deps;
|
||||
while (link !== undefined) {
|
||||
const dep = link.dep;
|
||||
const depFlags = dep.flags;
|
||||
if (depFlags & 64) {
|
||||
run(dep, dep.flags = depFlags & ~(64));
|
||||
}
|
||||
link = link.nextDep;
|
||||
}
|
||||
}
|
||||
}
|
||||
function flush() {
|
||||
while (notifyIndex < queuedEffectsLength) {
|
||||
const effect = queuedEffects[notifyIndex];
|
||||
queuedEffects[notifyIndex++] = undefined;
|
||||
run(effect, effect.flags &= ~(64));
|
||||
}
|
||||
notifyIndex = 0;
|
||||
queuedEffectsLength = 0;
|
||||
}
|
||||
function computedOper() {
|
||||
const flags = this.flags;
|
||||
if (flags & 16
|
||||
|| (flags & 32
|
||||
&& (checkDirty(this.deps, this)
|
||||
|| (this.flags = flags & ~32, false)))) {
|
||||
if (updateComputed(this)) {
|
||||
const subs = this.subs;
|
||||
if (subs !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!flags) {
|
||||
this.flags = 1;
|
||||
const prevSub = setActiveSub(this);
|
||||
try {
|
||||
this.value = this.getter();
|
||||
}
|
||||
finally {
|
||||
activeSub = prevSub;
|
||||
}
|
||||
}
|
||||
const sub = activeSub;
|
||||
if (sub !== undefined) {
|
||||
link(this, sub, cycle);
|
||||
}
|
||||
return this.value;
|
||||
}
|
||||
function signalOper(...value) {
|
||||
if (value.length) {
|
||||
if (this.value !== (this.value = value[0])) {
|
||||
this.flags = 17;
|
||||
const subs = this.subs;
|
||||
if (subs !== undefined) {
|
||||
propagate(subs);
|
||||
if (!batchDepth) {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const value = this.value;
|
||||
if (this.flags & 16) {
|
||||
if (updateSignal(this, value)) {
|
||||
const subs = this.subs;
|
||||
if (subs !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
}
|
||||
}
|
||||
let sub = activeSub;
|
||||
while (sub !== undefined) {
|
||||
if (sub.flags & 3) {
|
||||
link(this, sub, cycle);
|
||||
break;
|
||||
}
|
||||
sub = sub.subs?.sub;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function effectOper() {
|
||||
effectScopeOper.call(this);
|
||||
this.flags = 0;
|
||||
}
|
||||
function effectScopeOper() {
|
||||
let dep = this.deps;
|
||||
while (dep !== undefined) {
|
||||
dep = unlink(dep, this);
|
||||
}
|
||||
const sub = this.subs;
|
||||
if (sub !== undefined) {
|
||||
unlink(sub);
|
||||
}
|
||||
}
|
||||
function purgeDeps(sub) {
|
||||
const depsTail = sub.depsTail;
|
||||
let toRemove = depsTail !== undefined ? depsTail.nextDep : sub.deps;
|
||||
while (toRemove !== undefined) {
|
||||
toRemove = unlink(toRemove, sub);
|
||||
}
|
||||
}
|
||||
234
pmoapp/webapp/node_modules/alien-signals/esm/system.mjs
generated
vendored
Normal file
234
pmoapp/webapp/node_modules/alien-signals/esm/system.mjs
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
export var ReactiveFlags;
|
||||
(function (ReactiveFlags) {
|
||||
ReactiveFlags[ReactiveFlags["None"] = 0] = "None";
|
||||
ReactiveFlags[ReactiveFlags["Mutable"] = 1] = "Mutable";
|
||||
ReactiveFlags[ReactiveFlags["Watching"] = 2] = "Watching";
|
||||
ReactiveFlags[ReactiveFlags["RecursedCheck"] = 4] = "RecursedCheck";
|
||||
ReactiveFlags[ReactiveFlags["Recursed"] = 8] = "Recursed";
|
||||
ReactiveFlags[ReactiveFlags["Dirty"] = 16] = "Dirty";
|
||||
ReactiveFlags[ReactiveFlags["Pending"] = 32] = "Pending";
|
||||
})(ReactiveFlags || (ReactiveFlags = {}));
|
||||
export function createReactiveSystem({ update, notify, unwatched, }) {
|
||||
return {
|
||||
link,
|
||||
unlink,
|
||||
propagate,
|
||||
checkDirty,
|
||||
shallowPropagate,
|
||||
};
|
||||
function link(dep, sub, version) {
|
||||
const prevDep = sub.depsTail;
|
||||
if (prevDep !== undefined && prevDep.dep === dep) {
|
||||
return;
|
||||
}
|
||||
const nextDep = prevDep !== undefined ? prevDep.nextDep : sub.deps;
|
||||
if (nextDep !== undefined && nextDep.dep === dep) {
|
||||
nextDep.version = version;
|
||||
sub.depsTail = nextDep;
|
||||
return;
|
||||
}
|
||||
const prevSub = dep.subsTail;
|
||||
if (prevSub !== undefined && prevSub.version === version && prevSub.sub === sub) {
|
||||
return;
|
||||
}
|
||||
const newLink = sub.depsTail
|
||||
= dep.subsTail
|
||||
= {
|
||||
version,
|
||||
dep,
|
||||
sub,
|
||||
prevDep,
|
||||
nextDep,
|
||||
prevSub,
|
||||
nextSub: undefined,
|
||||
};
|
||||
if (nextDep !== undefined) {
|
||||
nextDep.prevDep = newLink;
|
||||
}
|
||||
if (prevDep !== undefined) {
|
||||
prevDep.nextDep = newLink;
|
||||
}
|
||||
else {
|
||||
sub.deps = newLink;
|
||||
}
|
||||
if (prevSub !== undefined) {
|
||||
prevSub.nextSub = newLink;
|
||||
}
|
||||
else {
|
||||
dep.subs = newLink;
|
||||
}
|
||||
}
|
||||
function unlink(link, sub = link.sub) {
|
||||
const dep = link.dep;
|
||||
const prevDep = link.prevDep;
|
||||
const nextDep = link.nextDep;
|
||||
const nextSub = link.nextSub;
|
||||
const prevSub = link.prevSub;
|
||||
if (nextDep !== undefined) {
|
||||
nextDep.prevDep = prevDep;
|
||||
}
|
||||
else {
|
||||
sub.depsTail = prevDep;
|
||||
}
|
||||
if (prevDep !== undefined) {
|
||||
prevDep.nextDep = nextDep;
|
||||
}
|
||||
else {
|
||||
sub.deps = nextDep;
|
||||
}
|
||||
if (nextSub !== undefined) {
|
||||
nextSub.prevSub = prevSub;
|
||||
}
|
||||
else {
|
||||
dep.subsTail = prevSub;
|
||||
}
|
||||
if (prevSub !== undefined) {
|
||||
prevSub.nextSub = nextSub;
|
||||
}
|
||||
else if ((dep.subs = nextSub) === undefined) {
|
||||
unwatched(dep);
|
||||
}
|
||||
return nextDep;
|
||||
}
|
||||
function propagate(link) {
|
||||
let next = link.nextSub;
|
||||
let stack;
|
||||
top: do {
|
||||
const sub = link.sub;
|
||||
let flags = sub.flags;
|
||||
if (!(flags & 60)) {
|
||||
sub.flags = flags | 32;
|
||||
}
|
||||
else if (!(flags & 12)) {
|
||||
flags = 0;
|
||||
}
|
||||
else if (!(flags & 4)) {
|
||||
sub.flags = (flags & ~8) | 32;
|
||||
}
|
||||
else if (!(flags & 48) && isValidLink(link, sub)) {
|
||||
sub.flags = flags | 40;
|
||||
flags &= 1;
|
||||
}
|
||||
else {
|
||||
flags = 0;
|
||||
}
|
||||
if (flags & 2) {
|
||||
notify(sub);
|
||||
}
|
||||
if (flags & 1) {
|
||||
const subSubs = sub.subs;
|
||||
if (subSubs !== undefined) {
|
||||
const nextSub = (link = subSubs).nextSub;
|
||||
if (nextSub !== undefined) {
|
||||
stack = { value: next, prev: stack };
|
||||
next = nextSub;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((link = next) !== undefined) {
|
||||
next = link.nextSub;
|
||||
continue;
|
||||
}
|
||||
while (stack !== undefined) {
|
||||
link = stack.value;
|
||||
stack = stack.prev;
|
||||
if (link !== undefined) {
|
||||
next = link.nextSub;
|
||||
continue top;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
function checkDirty(link, sub) {
|
||||
let stack;
|
||||
let checkDepth = 0;
|
||||
let dirty = false;
|
||||
top: do {
|
||||
const dep = link.dep;
|
||||
const flags = dep.flags;
|
||||
if (sub.flags & 16) {
|
||||
dirty = true;
|
||||
}
|
||||
else if ((flags & 17) === 17) {
|
||||
if (update(dep)) {
|
||||
const subs = dep.subs;
|
||||
if (subs.nextSub !== undefined) {
|
||||
shallowPropagate(subs);
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
else if ((flags & 33) === 33) {
|
||||
if (link.nextSub !== undefined || link.prevSub !== undefined) {
|
||||
stack = { value: link, prev: stack };
|
||||
}
|
||||
link = dep.deps;
|
||||
sub = dep;
|
||||
++checkDepth;
|
||||
continue;
|
||||
}
|
||||
if (!dirty) {
|
||||
const nextDep = link.nextDep;
|
||||
if (nextDep !== undefined) {
|
||||
link = nextDep;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
while (checkDepth--) {
|
||||
const firstSub = sub.subs;
|
||||
const hasMultipleSubs = firstSub.nextSub !== undefined;
|
||||
if (hasMultipleSubs) {
|
||||
link = stack.value;
|
||||
stack = stack.prev;
|
||||
}
|
||||
else {
|
||||
link = firstSub;
|
||||
}
|
||||
if (dirty) {
|
||||
if (update(sub)) {
|
||||
if (hasMultipleSubs) {
|
||||
shallowPropagate(firstSub);
|
||||
}
|
||||
sub = link.sub;
|
||||
continue;
|
||||
}
|
||||
dirty = false;
|
||||
}
|
||||
else {
|
||||
sub.flags &= ~32;
|
||||
}
|
||||
sub = link.sub;
|
||||
const nextDep = link.nextDep;
|
||||
if (nextDep !== undefined) {
|
||||
link = nextDep;
|
||||
continue top;
|
||||
}
|
||||
}
|
||||
return dirty;
|
||||
} while (true);
|
||||
}
|
||||
function shallowPropagate(link) {
|
||||
do {
|
||||
const sub = link.sub;
|
||||
const flags = sub.flags;
|
||||
if ((flags & 48) === 32) {
|
||||
sub.flags = flags | 16;
|
||||
if (flags & 2) {
|
||||
notify(sub);
|
||||
}
|
||||
}
|
||||
} while ((link = link.nextSub) !== undefined);
|
||||
}
|
||||
function isValidLink(checkLink, sub) {
|
||||
let link = sub.depsTail;
|
||||
while (link !== undefined) {
|
||||
if (link === checkLink) {
|
||||
return true;
|
||||
}
|
||||
link = link.prevDep;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
65
pmoapp/webapp/node_modules/alien-signals/package.json
generated
vendored
Normal file
65
pmoapp/webapp/node_modules/alien-signals/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "alien-signals",
|
||||
"version": "3.0.0",
|
||||
"license": "MIT",
|
||||
"description": "The lightest signal library.",
|
||||
"packageManager": "pnpm@9.12.0",
|
||||
"types": "./types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./esm/index.mjs",
|
||||
"require": "./cjs/index.cjs"
|
||||
},
|
||||
"./cjs": {
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./cjs/index.cjs",
|
||||
"require": "./cjs/index.cjs"
|
||||
},
|
||||
"./esm": {
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./esm/index.mjs",
|
||||
"require": "./esm/index.mjs"
|
||||
},
|
||||
"./system": {
|
||||
"types": "./types/system.d.ts",
|
||||
"import": "./esm/system.mjs",
|
||||
"require": "./cjs/system.cjs"
|
||||
},
|
||||
"./cjs/system": {
|
||||
"types": "./types/system.d.ts",
|
||||
"import": "./cjs/system.cjs",
|
||||
"require": "./cjs/system.cjs"
|
||||
},
|
||||
"./esm/system": {
|
||||
"types": "./types/system.d.ts",
|
||||
"import": "./esm/system.mjs",
|
||||
"require": "./esm/system.mjs"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"cjs/*.cjs",
|
||||
"esm/*.mjs",
|
||||
"types/*.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/johnsoncodehk/signals.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run check && npm run test",
|
||||
"check": "tsslint --project tsconfig.json",
|
||||
"build": "node ./build.js",
|
||||
"test": "npm run build && vitest run",
|
||||
"bench": "npm run build && node --jitless --expose-gc benchs/propagate.mjs",
|
||||
"memory": "npm run build && node --expose-gc benchs/memoryUsage.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsslint/cli": "latest",
|
||||
"@tsslint/config": "latest",
|
||||
"mitata": "latest",
|
||||
"typescript": "latest",
|
||||
"vitest": "latest",
|
||||
"jest-extended": "latest"
|
||||
}
|
||||
}
|
||||
21
pmoapp/webapp/node_modules/alien-signals/types/index.d.ts
generated
vendored
Normal file
21
pmoapp/webapp/node_modules/alien-signals/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { type ReactiveNode } from './system.js';
|
||||
export declare function getActiveSub(): ReactiveNode | undefined;
|
||||
export declare function setActiveSub(sub: ReactiveNode | undefined): ReactiveNode | undefined;
|
||||
export declare function getBatchDepth(): number;
|
||||
export declare function startBatch(): void;
|
||||
export declare function endBatch(): void;
|
||||
export declare function isSignal(fn: () => void): boolean;
|
||||
export declare function isComputed(fn: () => void): boolean;
|
||||
export declare function isEffect(fn: () => void): boolean;
|
||||
export declare function isEffectScope(fn: () => void): boolean;
|
||||
export declare function signal<T>(): {
|
||||
(): T | undefined;
|
||||
(value: T | undefined): void;
|
||||
};
|
||||
export declare function signal<T>(initialValue: T): {
|
||||
(): T;
|
||||
(value: T): void;
|
||||
};
|
||||
export declare function computed<T>(getter: (previousValue?: T) => T): () => T;
|
||||
export declare function effect(fn: () => void): () => void;
|
||||
export declare function effectScope(fn: () => void): () => void;
|
||||
36
pmoapp/webapp/node_modules/alien-signals/types/system.d.ts
generated
vendored
Normal file
36
pmoapp/webapp/node_modules/alien-signals/types/system.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
export interface ReactiveNode {
|
||||
deps?: Link;
|
||||
depsTail?: Link;
|
||||
subs?: Link;
|
||||
subsTail?: Link;
|
||||
flags: ReactiveFlags;
|
||||
}
|
||||
export interface Link {
|
||||
version: number;
|
||||
dep: ReactiveNode;
|
||||
sub: ReactiveNode;
|
||||
prevSub: Link | undefined;
|
||||
nextSub: Link | undefined;
|
||||
prevDep: Link | undefined;
|
||||
nextDep: Link | undefined;
|
||||
}
|
||||
export declare enum ReactiveFlags {
|
||||
None = 0,
|
||||
Mutable = 1,
|
||||
Watching = 2,
|
||||
RecursedCheck = 4,
|
||||
Recursed = 8,
|
||||
Dirty = 16,
|
||||
Pending = 32
|
||||
}
|
||||
export declare function createReactiveSystem({ update, notify, unwatched, }: {
|
||||
update(sub: ReactiveNode): boolean;
|
||||
notify(sub: ReactiveNode): void;
|
||||
unwatched(sub: ReactiveNode): void;
|
||||
}): {
|
||||
link: (dep: ReactiveNode, sub: ReactiveNode, version: number) => void;
|
||||
unlink: (link: Link, sub?: ReactiveNode) => Link | undefined;
|
||||
propagate: (link: Link) => void;
|
||||
checkDirty: (link: Link, sub: ReactiveNode) => boolean;
|
||||
shallowPropagate: (link: Link) => void;
|
||||
};
|
||||
Reference in New Issue
Block a user