diff --git a/crates/brk_server/src/lib.rs b/crates/brk_server/src/lib.rs index 87f0cf669..9b940085f 100644 --- a/crates/brk_server/src/lib.rs +++ b/crates/brk_server/src/lib.rs @@ -7,7 +7,7 @@ use std::{ fs, io::Cursor, path::{Path, PathBuf}, - time::{Duration, Instant}, + time::Duration, }; use api::{ApiRoutes, DTS}; diff --git a/websites/kibo.money/packages/lightweight-charts/types.d.ts b/websites/kibo.money/packages/lightweight-charts/types.d.ts index 10f56aaed..934db5fe8 100644 --- a/websites/kibo.money/packages/lightweight-charts/types.d.ts +++ b/websites/kibo.money/packages/lightweight-charts/types.d.ts @@ -1,5 +1,5 @@ import { Signal } from "../solid-signals/types"; -import { Accessor } from "../solid-signals/2024-11-02/types/signals"; +import { Accessor } from "../solid-signals/v0.2.4-treeshaked/types/signals"; import { DeepPartial, BaselineStyleOptions, diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/script.js b/websites/kibo.money/packages/solid-signals/2024-11-02/script.js deleted file mode 100644 index 5aa36cbba..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/script.js +++ /dev/null @@ -1,789 +0,0 @@ -// @ts-nocheck - -// src/core/error.ts -var NotReadyError = class extends Error {}; -var NoOwnerError = class extends Error { - constructor() { - super(""); - } -}; -var ContextNotFoundError = class extends Error { - constructor() { - super(""); - } -}; - -// src/utils.ts -function isUndefined(value) { - return typeof value === "undefined"; -} - -// src/core/constants.ts -var STATE_CLEAN = 0; -var STATE_CHECK = 1; -var STATE_DIRTY = 2; -var STATE_DISPOSED = 3; - -// src/core/owner.ts -var currentOwner = null; -var defaultContext = {}; -function getOwner() { - return currentOwner; -} -function setOwner(owner) { - const out = currentOwner; - currentOwner = owner; - return out; -} -var Owner = class { - // We flatten the owner tree into a linked list so that we don't need a pointer to .firstChild - // However, the children are actually added in reverse creation order - // See comment at the top of the file for an example of the _nextSibling traversal - l = null; - g = null; - j = null; - a = STATE_CLEAN; - e = null; - h = defaultContext; - f = null; - constructor(signal = false) { - if (currentOwner && !signal) currentOwner.append(this); - } - append(child) { - child.l = this; - child.j = this; - if (this.g) this.g.j = child; - child.g = this.g; - this.g = child; - if (child.h !== this.h) { - child.h = { ...this.h, ...child.h }; - } - if (this.f) { - child.f = !child.f ? this.f : [...child.f, ...this.f]; - } - } - dispose(self = true) { - if (this.a === STATE_DISPOSED) return; - let head = self ? this.j || this.l : this, - current = this.g, - next = null; - while (current && current.l === this) { - current.dispose(true); - current.n(); - next = current.g; - current.g = null; - current = next; - } - if (self) this.n(); - if (current) current.j = !self ? this : this.j; - if (head) head.g = current; - } - n() { - if (this.j) this.j.g = null; - this.l = null; - this.j = null; - this.h = defaultContext; - this.f = null; - this.a = STATE_DISPOSED; - this.emptyDisposal(); - } - emptyDisposal() { - if (!this.e) return; - if (Array.isArray(this.e)) { - for (let i = 0; i < this.e.length; i++) { - const callable = this.e[i]; - callable.call(callable); - } - } else { - this.e.call(this.e); - } - this.e = null; - } - handleError(error) { - if (!this.f) throw error; - let i = 0, - len = this.f.length; - for (i = 0; i < len; i++) { - try { - this.f[i](error); - break; - } catch (e) { - error = e; - } - } - if (i === len) throw error; - } -}; -function createContext(defaultValue, description) { - return { id: Symbol(description), defaultValue }; -} -function getContext(context, owner = currentOwner) { - if (!owner) { - throw new NoOwnerError(); - } - const value = hasContext(context, owner) - ? owner.h[context.id] - : context.defaultValue; - if (isUndefined(value)) { - throw new ContextNotFoundError(); - } - return value; -} -function setContext(context, value, owner = currentOwner) { - if (!owner) { - throw new NoOwnerError(); - } - owner.h = { - ...owner.h, - [context.id]: isUndefined(value) ? context.defaultValue : value, - }; -} -function hasContext(context, owner = currentOwner) { - return !isUndefined(owner?.h[context.id]); -} -function onCleanup(disposable) { - if (!currentOwner) return; - const node = currentOwner; - if (!node.e) { - node.e = disposable; - } else if (Array.isArray(node.e)) { - node.e.push(disposable); - } else { - node.e = [node.e, disposable]; - } -} - -// src/core/flags.ts -var ERROR_OFFSET = 0; -var ERROR_BIT = 1 << ERROR_OFFSET; -var LOADING_OFFSET = 1; -var LOADING_BIT = 1 << LOADING_OFFSET; -var DEFAULT_FLAGS = ERROR_BIT; - -// src/core/scheduler.ts -var scheduled = false; -var runningScheduled = false; -var Computations = []; -var RenderEffects = []; -var Effects = []; -function flushSync() { - if (!runningScheduled) runScheduled(); -} -function flushQueue() { - if (scheduled) return; - scheduled = true; - queueMicrotask(runScheduled); -} -function runTop(node) { - const ancestors = []; - for (let current = node; current !== null; current = current.l) { - if (current.a !== STATE_CLEAN) { - ancestors.push(current); - } - } - for (let i = ancestors.length - 1; i >= 0; i--) { - if (ancestors[i].a !== STATE_DISPOSED) ancestors[i].m(); - } -} -function runScheduled() { - if (!Effects.length && !RenderEffects.length && !Computations.length) { - scheduled = false; - return; - } - runningScheduled = true; - try { - runPureQueue(Computations); - runPureQueue(RenderEffects); - runPureQueue(Effects); - } finally { - const renderEffects = RenderEffects; - const effects = Effects; - Computations = []; - Effects = []; - RenderEffects = []; - scheduled = false; - runningScheduled = false; - incrementClock(); - runEffectQueue(renderEffects); - runEffectQueue(effects); - } -} -function runPureQueue(queue) { - for (let i = 0; i < queue.length; i++) { - if (queue[i].a !== STATE_CLEAN) runTop(queue[i]); - } -} -function runEffectQueue(queue) { - for (let i = 0; i < queue.length; i++) { - if (queue[i].q && queue[i].a !== STATE_DISPOSED) { - queue[i].r(queue[i].d, queue[i].o); - queue[i].q = false; - queue[i].o = queue[i].d; - } - } -} - -// src/core/core.ts -var currentObserver = null; -var currentMask = DEFAULT_FLAGS; -var newSources = null; -var newSourcesIndex = 0; -var newFlags = 0; -var clock = 0; -var syncResolve = false; -var updateCheck = null; -function getObserver() { - return currentObserver; -} -function incrementClock() { - clock++; -} -var UNCHANGED = Symbol(0); -var Computation2 = class extends Owner { - b = null; - c = null; - d; - s; - // Used in __DEV__ mode, hopefully removed in production - B; - // Using false is an optimization as an alternative to _equals: () => false - // which could enable more efficient DIRTY notification - t = isEqual; - x; - /** Whether the computation is an error or has ancestors that are unresolved */ - i = 0; - /** Which flags raised by sources are handled, vs. being passed through. */ - p = DEFAULT_FLAGS; - u = null; - v = null; - w = -1; - constructor(initialValue, compute2, options) { - super(compute2 === null); - this.s = compute2; - this.a = compute2 ? STATE_DIRTY : STATE_CLEAN; - this.d = initialValue; - if (options?.equals !== void 0) this.t = options.equals; - if (options?.unobserved) this.x = options?.unobserved; - } - y() { - if (this.s) this.m(); - if (!this.b || this.b.length) track(this); - newFlags |= this.i & ~currentMask; - if (this.i & ERROR_BIT) { - throw this.d; - } else { - return this.d; - } - } - /** - * Return the current value of this computation - * Automatically re-executes the surrounding computation when the value changes - */ - read() { - return this.y(); - } - /** - * Return the current value of this computation - * Automatically re-executes the surrounding computation when the value changes - * - * If the computation has any unresolved ancestors, this function waits for the value to resolve - * before continuing - */ - wait() { - if (!syncResolve && this.loading()) { - throw new NotReadyError(); - } - return this.y(); - } - /** - * Return true if the computation is the value is dependent on an unresolved promise - * Triggers re-execution of the computation when the loading state changes - * - * This is useful especially when effects want to re-execute when a computation's - * loading state changes - */ - loading() { - if (this.v === null) { - this.v = loadingState(this); - } - return this.v.read(); - } - /** - * Return true if the computation is the computation threw an error - * Triggers re-execution of the computation when the error state changes - */ - error() { - if (this.u === null) { - this.u = errorState(this); - } - return this.u.read(); - } - /** Update the computation with a new value. */ - write(value, flags = 0, raw = false) { - const newValue = - !raw && typeof value === "function" ? value(this.d) : value; - const valueChanged = - newValue !== UNCHANGED && - (!!(flags & ERROR_BIT) || this.t === false || !this.t(this.d, newValue)); - if (valueChanged) this.d = newValue; - const changedFlagsMask = this.i ^ flags, - changedFlags = changedFlagsMask & flags; - this.i = flags; - this.w = clock + 1; - if (this.c) { - for (let i = 0; i < this.c.length; i++) { - if (valueChanged) { - this.c[i].k(STATE_DIRTY); - } else if (changedFlagsMask) { - this.c[i].z(changedFlagsMask, changedFlags); - } - } - } - return this.d; - } - /** - * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK - */ - k(state) { - if (this.a >= state) return; - this.a = state; - if (this.c) { - for (let i = 0; i < this.c.length; i++) { - this.c[i].k(STATE_CHECK); - } - } - } - /** - * Notify the computation that one of its sources has changed flags. - * - * @param mask A bitmask for which flag(s) were changed. - * @param newFlags The source's new flags, masked to just the changed ones. - */ - z(mask, newFlags2) { - if (this.a >= STATE_DIRTY) return; - if (mask & this.p) { - this.k(STATE_DIRTY); - return; - } - if (this.a >= STATE_CHECK) return; - const prevFlags = this.i & mask; - const deltaFlags = prevFlags ^ newFlags2; - if (newFlags2 === prevFlags); - else if (deltaFlags & prevFlags & mask) { - this.k(STATE_CHECK); - } else { - this.i ^= deltaFlags; - if (this.c) { - for (let i = 0; i < this.c.length; i++) { - this.c[i].z(mask, newFlags2); - } - } - } - } - A(error) { - this.write(error, this.i | ERROR_BIT); - } - /** - * This is the core part of the reactivity system, which makes sure that the values are updated - * before they are read. We've also adapted it to return the loading state of the computation, - * so that we can propagate that to the computation's observers. - * - * This function will ensure that the value and states we read from the computation are up to date - */ - m() { - if (this.a === STATE_DISPOSED) { - throw new Error("Tried to read a disposed computation"); - } - if (this.a === STATE_CLEAN) { - return; - } - let observerFlags = 0; - if (this.a === STATE_CHECK) { - for (let i = 0; i < this.b.length; i++) { - this.b[i].m(); - observerFlags |= this.b[i].i; - if (this.a === STATE_DIRTY) { - break; - } - } - } - if (this.a === STATE_DIRTY) { - update(this); - } else { - this.write(UNCHANGED, observerFlags); - this.a = STATE_CLEAN; - } - } - /** - * Remove ourselves from the owner graph and the computation graph - */ - n() { - if (this.a === STATE_DISPOSED) return; - if (this.b) removeSourceObservers(this, 0); - super.n(); - } -}; -function loadingState(node) { - const prevOwner = setOwner(node.l); - const options = void 0; - const computation = new Computation2( - void 0, - () => { - track(node); - node.m(); - return !!(node.i & LOADING_BIT); - }, - options, - ); - computation.p = ERROR_BIT | LOADING_BIT; - setOwner(prevOwner); - return computation; -} -function errorState(node) { - const prevOwner = setOwner(node.l); - const options = void 0; - const computation = new Computation2( - void 0, - () => { - track(node); - node.m(); - return !!(node.i & ERROR_BIT); - }, - options, - ); - computation.p = ERROR_BIT; - setOwner(prevOwner); - return computation; -} -function track(computation) { - if (currentObserver) { - if ( - !newSources && - currentObserver.b && - currentObserver.b[newSourcesIndex] === computation - ) { - newSourcesIndex++; - } else if (!newSources) newSources = [computation]; - else if (computation !== newSources[newSources.length - 1]) { - newSources.push(computation); - } - if (updateCheck) { - updateCheck.d = computation.w > currentObserver.w; - } - } -} -function update(node) { - const prevSources = newSources, - prevSourcesIndex = newSourcesIndex, - prevFlags = newFlags; - newSources = null; - newSourcesIndex = 0; - newFlags = 0; - try { - node.dispose(false); - node.emptyDisposal(); - const result = compute(node, node.s, node); - node.write(result, newFlags, true); - } catch (error) { - if (error instanceof NotReadyError) { - node.write(UNCHANGED, newFlags | LOADING_BIT); - } else { - node.A(error); - } - } finally { - if (newSources) { - if (node.b) removeSourceObservers(node, newSourcesIndex); - if (node.b && newSourcesIndex > 0) { - node.b.length = newSourcesIndex + newSources.length; - for (let i = 0; i < newSources.length; i++) { - node.b[newSourcesIndex + i] = newSources[i]; - } - } else { - node.b = newSources; - } - let source; - for (let i = newSourcesIndex; i < node.b.length; i++) { - source = node.b[i]; - if (!source.c) source.c = [node]; - else source.c.push(node); - } - } else if (node.b && newSourcesIndex < node.b.length) { - removeSourceObservers(node, newSourcesIndex); - node.b.length = newSourcesIndex; - } - newSources = prevSources; - newSourcesIndex = prevSourcesIndex; - newFlags = prevFlags; - node.a = STATE_CLEAN; - } -} -function removeSourceObservers(node, index) { - let source; - let swap; - for (let i = index; i < node.b.length; i++) { - source = node.b[i]; - if (source.c) { - swap = source.c.indexOf(node); - source.c[swap] = source.c[source.c.length - 1]; - source.c.pop(); - if (!source.c.length) source.x?.(); - } - } -} -function isEqual(a, b) { - return a === b; -} -function untrack(fn) { - if (currentObserver === null) return fn(); - return compute(getOwner(), fn, null); -} -function hasUpdated(fn) { - const current = updateCheck; - updateCheck = { d: false }; - try { - fn(); - return updateCheck.d; - } finally { - updateCheck = current; - } -} -function isPending(fn) { - try { - fn(); - return false; - } catch (e) { - return e instanceof NotReadyError; - } -} -function latest(fn) { - const prevFlags = newFlags; - syncResolve = true; - try { - return fn(); - } catch { - } finally { - newFlags = prevFlags; - syncResolve = false; - } -} -function compute(owner, compute2, observer) { - const prevOwner = setOwner(owner), - prevObserver = currentObserver, - prevMask = currentMask; - currentObserver = observer; - currentMask = observer?.p ?? DEFAULT_FLAGS; - try { - return compute2(observer ? observer.d : void 0); - } finally { - setOwner(prevOwner); - currentObserver = prevObserver; - currentMask = prevMask; - } -} -var EagerComputation = class extends Computation2 { - constructor(initialValue, compute2, options) { - super(initialValue, compute2, options); - this.m(); - Computations.push(this); - } - k(state) { - if (this.a >= state) return; - if (this.a === STATE_CLEAN) { - Computations.push(this); - flushQueue(); - } - super.k(state); - } -}; - -// src/core/effect.ts -var BaseEffect = class extends Computation2 { - r; - q = false; - o; - constructor(initialValue, compute2, effect, options) { - super(initialValue, compute2, options); - this.r = effect; - this.o = initialValue; - } - write(value) { - if (value === UNCHANGED) return this.d; - this.d = value; - this.q = true; - return value; - } - A(error) { - this.handleError(error); - } - n() { - this.r = void 0; - this.o = void 0; - super.n(); - } -}; -var Effect = class extends BaseEffect { - constructor(initialValue, compute2, effect, options) { - super(initialValue, compute2, effect, options); - Effects.push(this); - flushQueue(); - } - k(state) { - if (this.a >= state) return; - if (this.a === STATE_CLEAN) { - Effects.push(this); - flushQueue(); - } - this.a = state; - } -}; -var RenderEffect = class extends BaseEffect { - constructor(initialValue, compute2, effect, options) { - super(initialValue, compute2, effect, options); - this.m(); - RenderEffects.push(this); - } - k(state) { - if (this.a >= state) return; - if (this.a === STATE_CLEAN) { - RenderEffects.push(this); - flushQueue(); - } - this.a = state; - } -}; - -// src/signals.ts -function createSignal(first, second, third) { - if (typeof first === "function") { - const memo = createMemo((p) => { - const node2 = new Computation2( - first(p ? untrack(p[0]) : second), - null, - third, - ); - return [node2.read.bind(node2), node2.write.bind(node2)]; - }); - return [() => memo()[0](), (value) => memo()[1](value)]; - } - const node = new Computation2(first, null, second); - return [node.read.bind(node), node.write.bind(node)]; -} -function createAsync(fn, initial, options) { - const lhs = new EagerComputation( - { - d: initial, - }, - (p) => { - const value = p?.d; - const source = fn(value); - const isPromise = source instanceof Promise; - const iterator = source[Symbol.asyncIterator]; - if (!isPromise && !iterator) { - return { - wait() { - return source; - }, - d: source, - }; - } - const signal = new Computation2(value, null, options); - signal.write(UNCHANGED, LOADING_BIT); - if (isPromise) { - source.then( - (value2) => { - signal.write(value2, 0); - }, - (error) => { - signal.write(error, ERROR_BIT); - }, - ); - } else { - let abort = false; - onCleanup(() => (abort = true)); - (async () => { - try { - for await (let value2 of source) { - if (abort) return; - signal.write(value2, 0); - } - } catch (error) { - signal.write(error, ERROR_BIT); - } - })(); - } - return signal; - }, - ); - return () => lhs.wait().wait(); -} -function createMemo(compute2, initialValue, options) { - let node = new Computation2(initialValue, compute2, options); - let value; - return () => { - if (node) { - value = node.wait(); - if (!node.b?.length) node = void 0; - } - return value; - }; -} -function createEffect(compute2, effect, initialValue, options) { - void new Effect(initialValue, compute2, effect, void 0); -} -function createRenderEffect(compute2, effect, initialValue, options) { - void new RenderEffect(initialValue, compute2, effect, void 0); -} -function createRoot(init) { - const owner = new Owner(); - return compute( - owner, - !init.length ? init : () => init(() => owner.dispose()), - null, - ); -} -function runWithOwner(owner, run) { - try { - return compute(owner, run, null); - } catch (error) { - owner?.handleError(error); - return void 0; - } -} -function catchError(fn, handler) { - const owner = new Owner(); - owner.f = owner.f ? [handler, ...owner.f] : [handler]; - try { - compute(owner, fn, null); - } catch (error) { - owner.handleError(error); - } -} - -export { - Computation2 as Computation, - ContextNotFoundError, - NoOwnerError, - NotReadyError, - Owner, - catchError, - createAsync, - createContext, - createEffect, - createMemo, - createRenderEffect, - createRoot, - createSignal, - flushSync, - getContext, - getObserver, - getOwner, - hasContext, - hasUpdated, - isEqual, - isPending, - latest, - onCleanup, - runWithOwner, - setContext, - untrack, -}; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/constants.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/constants.d.ts deleted file mode 100644 index c27fe1bc4..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/constants.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * See https://dev.to/modderme123/super-charging-fine-grained-reactive-performance-47ph - * State clean corresponds to a node where all the sources are fully up to date - * State check corresponds to a node where some sources (including grandparents) may have changed - * State dirty corresponds to a node where the direct parents of a node has changed - */ -export declare const STATE_CLEAN = 0; -export declare const STATE_CHECK = 1; -export declare const STATE_DIRTY = 2; -export declare const STATE_DISPOSED = 3; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/core.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/core.d.ts deleted file mode 100644 index 0c11181b6..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/core.d.ts +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Nodes for constructing a graph of reactive values and reactive computations. - * - * - The graph is acyclic. - * - The user inputs new values into the graph by calling .write() on one more computation nodes. - * - The user retrieves computed results from the graph by calling .read() on one or more computation nodes. - * - The library is responsible for running any necessary computations so that .read() is up to date - * with all prior .write() calls anywhere in the graph. - * - We call the input nodes 'roots' and the output nodes 'leaves' of the graph here. - * - Changes flow from roots to leaves. It would be effective but inefficient to immediately - * propagate all changes from a root through the graph to descendant leaves. Instead, we defer - * change most change propagation computation until a leaf is accessed. This allows us to - * coalesce computations and skip altogether recalculating unused sections of the graph. - * - Each computation node tracks its sources and its observers (observers are other - * elements that have this node as a source). Source and observer links are updated automatically - * as observer computations re-evaluate and call get() on their sources. - * - Each node stores a cache state (clean/check/dirty) to support the change propagation algorithm: - * - * In general, execution proceeds in three passes: - * - * 1. write() propagates changes down the graph to the leaves - * direct children are marked as dirty and their deeper descendants marked as check - * (no computations are evaluated) - * 2. read() requests that parent nodes updateIfNecessary(), which proceeds recursively up the tree - * to decide whether the node is clean (parents unchanged) or dirty (parents changed) - * 3. updateIfNecessary() evaluates the computation if the node is dirty (the computations are - * executed in root to leaf order) - */ -import { type Flags } from "./flags.js"; -import { Owner } from "./owner.js"; -export interface SignalOptions { - name?: string; - equals?: ((prev: T, next: T) => boolean) | false; - unobserved?: () => void; -} -interface SourceType { - _observers: ObserverType[] | null; - _unobserved?: () => void; - _updateIfNecessary: () => void; - _stateFlags: Flags; - _time: number; -} -interface ObserverType { - _sources: SourceType[] | null; - _notify: (state: number) => void; - _handlerMask: Flags; - _notifyFlags: (mask: Flags, newFlags: Flags) => void; - _time: number; -} -/** - * Returns the current observer. - */ -export declare function getObserver(): ObserverType | null; -export declare function incrementClock(): void; -export declare const UNCHANGED: unique symbol; -export type UNCHANGED = typeof UNCHANGED; -export declare class Computation extends Owner implements SourceType, ObserverType { - _sources: SourceType[] | null; - _observers: ObserverType[] | null; - _value: T | undefined; - _compute: null | ((p?: T) => T); - _name: string | undefined; - _equals: false | ((a: T, b: T) => boolean); - _unobserved: (() => void) | undefined; - /** Whether the computation is an error or has ancestors that are unresolved */ - _stateFlags: number; - /** Which flags raised by sources are handled, vs. being passed through. */ - _handlerMask: number; - _error: Computation | null; - _loading: Computation | null; - _time: number; - constructor(initialValue: T | undefined, compute: null | ((p?: T) => T), options?: SignalOptions); - _read(): T; - /** - * Return the current value of this computation - * Automatically re-executes the surrounding computation when the value changes - */ - read(): T; - /** - * Return the current value of this computation - * Automatically re-executes the surrounding computation when the value changes - * - * If the computation has any unresolved ancestors, this function waits for the value to resolve - * before continuing - */ - wait(): T; - /** - * Return true if the computation is the value is dependent on an unresolved promise - * Triggers re-execution of the computation when the loading state changes - * - * This is useful especially when effects want to re-execute when a computation's - * loading state changes - */ - loading(): boolean; - /** - * Return true if the computation is the computation threw an error - * Triggers re-execution of the computation when the error state changes - */ - error(): boolean; - /** Update the computation with a new value. */ - write(value: T | ((currentValue: T) => T) | UNCHANGED, flags?: number, raw?: boolean): T; - /** - * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK - */ - _notify(state: number): void; - /** - * Notify the computation that one of its sources has changed flags. - * - * @param mask A bitmask for which flag(s) were changed. - * @param newFlags The source's new flags, masked to just the changed ones. - */ - _notifyFlags(mask: Flags, newFlags: Flags): void; - _setError(error: unknown): void; - /** - * This is the core part of the reactivity system, which makes sure that the values are updated - * before they are read. We've also adapted it to return the loading state of the computation, - * so that we can propagate that to the computation's observers. - * - * This function will ensure that the value and states we read from the computation are up to date - */ - _updateIfNecessary(): void; - /** - * Remove ourselves from the owner graph and the computation graph - */ - _disposeNode(): void; -} -/** - * Reruns a computation's _compute function, producing a new value and keeping track of dependencies. - * - * It handles the updating of sources and observers, disposal of previous executions, - * and error handling if the _compute function throws. It also sets the node as loading - * if it reads any parents that are currently loading. - */ -export declare function update(node: Computation): void; -export declare function isEqual(a: T, b: T): boolean; -/** - * Returns the current value stored inside the given compute function without triggering any - * dependencies. Use `untrack` if you want to also disable owner tracking. - */ -export declare function untrack(fn: () => T): T; -/** - * Returns true if the given functinon contains signals that have been updated since the last time - * the parent computation was run. - */ -export declare function hasUpdated(fn: () => any): boolean; -/** - * Returns true if the given function contains async signals that are not ready yet. - */ -export declare function isPending(fn: () => any): boolean; -export declare function latest(fn: () => T): T | undefined; -/** - * A convenient wrapper that calls `compute` with the `owner` and `observer` and is guaranteed - * to reset the global context after the computation is finished even if an error is thrown. - */ -export declare function compute(owner: Owner | null, compute: (val: T) => T, observer: Computation): T; -export declare function compute(owner: Owner | null, compute: (val: undefined) => T, observer: null): T; -export declare class EagerComputation extends Computation { - constructor(initialValue: T, compute: () => T, options?: SignalOptions); - _notify(state: number): void; -} -export {}; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/effect.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/effect.d.ts deleted file mode 100644 index 618740acf..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/effect.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Computation, type SignalOptions } from "./core.js"; -/** - * Effects are the leaf nodes of our reactive graph. When their sources change, they are - * automatically added to the queue of effects to re-execute, which will cause them to fetch their - * sources and recompute - */ -export declare class BaseEffect extends Computation { - _effect: (val: T, prev: T | undefined) => void; - _modified: boolean; - _prevValue: T | undefined; - constructor(initialValue: T, compute: () => T, effect: (val: T, prev: T | undefined) => void, options?: SignalOptions); - write(value: T): T; - _setError(error: unknown): void; - _disposeNode(): void; -} -export declare class Effect extends BaseEffect { - constructor(initialValue: T, compute: () => T, effect: (val: T, prev: T | undefined) => void, options?: SignalOptions); - _notify(state: number): void; -} -export declare class RenderEffect extends BaseEffect { - constructor(initialValue: T, compute: () => T, effect: (val: T, prev: T | undefined) => void, options?: SignalOptions); - _notify(state: number): void; -} diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/error.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/error.d.ts deleted file mode 100644 index b91a59791..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/error.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export declare class NotReadyError extends Error { -} -export declare class NoOwnerError extends Error { - constructor(); -} -export declare class ContextNotFoundError extends Error { - constructor(); -} -export interface ErrorHandler { - (error: unknown): void; -} diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/flags.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/flags.d.ts deleted file mode 100644 index b11fbb1d1..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/flags.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type Flags = number; -export declare const ERROR_OFFSET = 0; -export declare const ERROR_BIT: number; -export declare const ERROR: unique symbol; -export declare const LOADING_OFFSET = 1; -export declare const LOADING_BIT: number; -export declare const LOADING: unique symbol; -export declare const DEFAULT_FLAGS: number; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/index.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/index.d.ts deleted file mode 100644 index 4a2fe21a3..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { ContextNotFoundError, NoOwnerError, NotReadyError, type ErrorHandler } from "./error.js"; -export { Owner, createContext, getContext, setContext, hasContext, getOwner, onCleanup, type Context, type ContextRecord, type Disposable } from "./owner.js"; -export { Computation, EagerComputation, getObserver, isEqual, untrack, hasUpdated, isPending, latest, UNCHANGED, compute, type SignalOptions } from "./core.js"; -export { Effect, RenderEffect } from "./effect.js"; -export { flushSync } from "./scheduler.js"; -export * from "./flags.js"; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/owner.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/owner.d.ts deleted file mode 100644 index 0d5371f56..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/owner.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Owner tracking is used to enable nested tracking scopes with automatic cleanup. - * We also use owners to also keep track of which error handling context we are in. - * - * If you write the following - * - * const a = createOwner(() => { - * const b = createOwner(() => {}); - * - * const c = createOwner(() => { - * const d = createOwner(() => {}); - * }); - * - * const e = createOwner(() => {}); - * }); - * - * The owner tree will look like this: - * - * a - * /|\ - * b-c-e - * | - * d - * - * Following the _nextSibling pointers of each owner will first give you its children, and then its siblings (in reverse). - * a -> e -> c -> d -> b - * - * Note that the owner tree is largely orthogonal to the reactivity tree, and is much closer to the component tree. - */ -import { type ErrorHandler } from "./error.js"; -export type ContextRecord = Record; -export interface Disposable { - (): void; -} -/** - * Returns the currently executing parent owner. - */ -export declare function getOwner(): Owner | null; -export declare function setOwner(owner: Owner | null): Owner | null; -export declare class Owner { - _parent: Owner | null; - _nextSibling: Owner | null; - _prevSibling: Owner | null; - _state: number; - _disposal: Disposable | Disposable[] | null; - _context: ContextRecord; - _handlers: ErrorHandler[] | null; - constructor(signal?: boolean); - append(child: Owner): void; - dispose(this: Owner, self?: boolean): void; - _disposeNode(): void; - emptyDisposal(): void; - handleError(error: unknown): void; -} -export interface Context { - readonly id: symbol; - readonly defaultValue: T | undefined; -} -/** - * Context provides a form of dependency injection. It is used to save from needing to pass - * data as props through intermediate components. This function creates a new context object - * that can be used with `getContext` and `setContext`. - * - * A default value can be provided here which will be used when a specific value is not provided - * via a `setContext` call. - */ -export declare function createContext(defaultValue?: T, description?: string): Context; -/** - * Attempts to get a context value for the given key. - * - * @throws `NoOwnerError` if there's no owner at the time of call. - * @throws `ContextNotFoundError` if a context value has not been set yet. - */ -export declare function getContext(context: Context, owner?: Owner | null): T; -/** - * Attempts to set a context value on the parent scope with the given key. - * - * @throws `NoOwnerError` if there's no owner at the time of call. - */ -export declare function setContext(context: Context, value?: T, owner?: Owner | null): void; -/** - * Whether the given context is currently defined. - */ -export declare function hasContext(context: Context, owner?: Owner | null): boolean; -/** - * Runs the given function when the parent owner computation is being disposed. - */ -export declare function onCleanup(disposable: Disposable): void; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/scheduler.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/scheduler.d.ts deleted file mode 100644 index 2ba7596b1..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/core/scheduler.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Effect, RenderEffect } from "./effect.js"; -import { Computation } from "./core.js"; -export declare let Computations: Computation[], RenderEffects: RenderEffect[], Effects: Effect[]; -/** - * By default, changes are batched on the microtask queue which is an async process. You can flush - * the queue synchronously to get the latest updates by calling `flushSync()`. - */ -export declare function flushSync(): void; -export declare function flushQueue(): void; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/index.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/index.d.ts deleted file mode 100644 index ce1cb0c07..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, createContext, getContext, setContext, hasContext, getOwner, onCleanup, getObserver, isEqual, untrack, hasUpdated, isPending, latest } from "./core/index.js"; -export type { ErrorHandler, SignalOptions, Context, ContextRecord, Disposable } from "./core/index.js"; -export { flushSync } from "./core/scheduler.js"; -export * from "./signals.js"; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/map.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/map.d.ts deleted file mode 100644 index d6a650658..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/map.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Accessor } from "./signals.js"; -export type Maybe = T | void | null | undefined | false; -/** - * Reactive map helper that caches each list item by reference to reduce unnecessary mapping on - * updates. - * - * @see {@link https://github.com/solidjs/x-reactivity#maparray} - */ -export declare function mapArray(list: Accessor>, map: (value: Accessor, index: Accessor) => MappedItem, options?: { - keyed?: boolean | ((item: Item) => any); - name?: string; -}): Accessor; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/signals.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/signals.d.ts deleted file mode 100644 index 206e5879e..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/signals.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { SignalOptions } from "./core/index.js"; -import { Owner } from "./core/index.js"; -export interface Accessor { - (): T; -} -export interface Setter { - (value: T | SetValue): T; -} -export interface SetValue { - (currentValue: T): T; -} -export type Signal = [read: Accessor, write: Setter]; -/** - * Wraps the given value into a signal. The signal will return the current value when invoked - * `fn()`, and provide a simple write API via `write()`. The value can now be observed - * when used inside other computations created with `computed` and `effect`. - */ -export declare function createSignal(initialValue: Exclude, options?: SignalOptions): Signal; -export declare function createSignal(fn: (prev?: T) => T, initialValue?: T, options?: SignalOptions): Signal; -export declare function createAsync(fn: (prev?: T) => Promise | AsyncIterable | T, initial?: T, options?: SignalOptions): Accessor; -/** - * Creates a new computation whose value is computed and returned by the given function. The given - * compute function is _only_ re-run when one of it's dependencies are updated. Dependencies are - * are all signals that are read during execution. - */ -export declare function createMemo(compute: (prev?: T) => T, initialValue?: T, options?: SignalOptions): Accessor; -/** - * Invokes the given function each time any of the signals that are read inside are updated - * (i.e., their value changes). The effect is immediately invoked on initialization. - */ -export declare function createEffect(compute: () => T, effect: (v: T) => (() => void) | void, initialValue?: T, options?: { - name?: string; -}): void; -/** - * Invokes the given function each time any of the signals that are read inside are updated - * (i.e., their value changes). The effect is immediately invoked on initialization. - */ -export declare function createRenderEffect(compute: () => T, effect: (v: T) => (() => void) | void, initialValue?: T, options?: { - name?: string; -}): void; -/** - * Creates a computation root which is given a `dispose()` function to dispose of all inner - * computations. - */ -export declare function createRoot(init: ((dispose: () => void) => T) | (() => T)): T; -/** - * Runs the given function in the given owner so that error handling and cleanups continue to work. - * - * Warning: Usually there are simpler ways of modeling a problem that avoid using this function - */ -export declare function runWithOwner(owner: Owner | null, run: () => T): T | undefined; -/** - * Runs the given function when an error is thrown in a child owner. If the error is thrown again - * inside the error handler, it will trigger the next available parent owner handler. - */ -export declare function catchError(fn: () => T, handler: (error: unknown) => void): void; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/store/index.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/store/index.d.ts deleted file mode 100644 index d5a0b1b9d..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/store/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./store.js"; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/store/store.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/store/store.d.ts deleted file mode 100644 index 4e05cd1d8..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/store/store.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export type Store = Readonly; -export type StoreSetter = (fn: (state: T) => void) => void; -declare const $TRACK: unique symbol, $PROXY: unique symbol; -export { $PROXY, $TRACK }; -export type StoreNode = Record; -export declare namespace SolidStore { - interface Unwrappable { - } -} -export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable]; -export declare function isWrappable(obj: T | NotWrappable): obj is T; -/** - * Returns the underlying data in the store without a proxy. - * @param item store proxy object - * @example - * ```js - * const initial = {z...}; - * const [state, setState] = createStore(initial); - * initial === state; // => false - * initial === unwrap(state); // => true - * ``` - */ -export declare function unwrap(item: T, set?: Set): T; -export declare function createStore(store: T | Store): [get: Store, set: StoreSetter]; -export declare function createStore(fn: (store: T) => void, store: T | Store): [get: Store, set: StoreSetter]; -/** - * Creates a mutable derived value - * - * @see {@link https://github.com/solidjs/x-reactivity#createprojection} - */ -export declare function createProjection(fn: (draft: T) => void, initialValue: T): Readonly; diff --git a/websites/kibo.money/packages/solid-signals/2024-11-02/types/utils.d.ts b/websites/kibo.money/packages/solid-signals/2024-11-02/types/utils.d.ts deleted file mode 100644 index 6db6309f2..000000000 --- a/websites/kibo.money/packages/solid-signals/2024-11-02/types/utils.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isUndefined(value: any): value is undefined; diff --git a/websites/kibo.money/packages/solid-signals/types.d.ts b/websites/kibo.money/packages/solid-signals/types.d.ts index d56de24a8..04a7ca1f3 100644 --- a/websites/kibo.money/packages/solid-signals/types.d.ts +++ b/websites/kibo.money/packages/solid-signals/types.d.ts @@ -1,4 +1,4 @@ -import { Accessor, Setter } from "./2024-11-02/types/signals"; +import { Accessor, Setter } from "./v0.2.4-treeshaked/types/signals"; export type Signal = Accessor & { set: Setter; reset: VoidFunction }; export type Signals = Awaited; diff --git a/websites/kibo.money/packages/solid-signals/v0.2.4-treeshaked/script.js b/websites/kibo.money/packages/solid-signals/v0.2.4-treeshaked/script.js index a0a0b5de9..8e530d95b 100644 --- a/websites/kibo.money/packages/solid-signals/v0.2.4-treeshaked/script.js +++ b/websites/kibo.money/packages/solid-signals/v0.2.4-treeshaked/script.js @@ -637,17 +637,6 @@ var Effect = class extends Computation { } } }; -var EagerComputation = class extends Computation { - constructor(initialValue, compute2, options) { - super(initialValue, compute2, options); - !options?.defer && this.p(); - } - k(state, skipQueue) { - if (this.a >= state && !this.x) return; - if (this.a === STATE_CLEAN && !skipQueue) this.f.enqueue(EFFECT_PURE, this); - super.k(state, skipQueue); - } -}; // src/signals.ts function createSignal(first, second, third) { @@ -696,21 +685,6 @@ function createRoot(init) { function runWithOwner(owner, run) { return compute(owner, run, null); } -function resolve(fn) { - return new Promise((res, rej) => { - createRoot((dispose) => { - new EagerComputation(void 0, () => { - try { - res(fn()); - } catch (err) { - if (err instanceof NotReadyError) throw err; - rej(err); - } - dispose(); - }); - }); - }); -} export { Owner, @@ -721,7 +695,6 @@ export { flushSync, getOwner, onCleanup, - resolve, runWithOwner, untrack, }; diff --git a/websites/kibo.money/packages/solid-signals/wrapper.js b/websites/kibo.money/packages/solid-signals/wrapper.js index 351cce69c..1ab5f67bd 100644 --- a/websites/kibo.money/packages/solid-signals/wrapper.js +++ b/websites/kibo.money/packages/solid-signals/wrapper.js @@ -1,78 +1,99 @@ // @ts-check /** - * @import { SignalOptions } from "./2024-11-02/types/core/core" - * @import { getOwner as GetOwner, onCleanup as OnCleanup, Owner } from "./2024-11-02/types/core/owner" - * @import { createSignal as CreateSignal, createEffect as CreateEffect, Accessor, Setter, createMemo as CreateMemo, createRoot as CreateRoot, runWithOwner as RunWithOwner } from "./2024-11-02/types/signals"; + * @import { SignalOptions } from "./v0.2.4-treeshaked/types/core/core" + * @import { getOwner as GetOwner, onCleanup as OnCleanup, Owner } from "./v0.2.4-treeshaked/types/core/owner" + * @import { createSignal as CreateSignal, createEffect as CreateEffect, Accessor, Setter, createMemo as CreateMemo, createRoot as CreateRoot, runWithOwner as RunWithOwner } from "./v0.2.4-treeshaked/types/signals"; * @import { Signal } from "./types"; */ -const importSignals = import("./2024-11-02/script.js").then((_signals) => { - const signals = { - createSolidSignal: /** @type {CreateSignal} */ (_signals.createSignal), - createSolidEffect: /** @type {CreateEffect} */ (_signals.createEffect), - createEffect: /** @type {CreateEffect} */ (compute, effect) => { - let dispose = /** @type {VoidFunction | null} */ (null); - // @ts-ignore - _signals.createEffect(compute, (v) => { - dispose?.(); - signals.createRoot((_dispose) => { - dispose = _dispose; - effect(v); - }); - signals.onCleanup(() => dispose?.()); - }); - signals.onCleanup(() => dispose?.()); - }, - createMemo: /** @type {CreateMemo} */ (_signals.createMemo), - createRoot: /** @type {CreateRoot} */ (_signals.createRoot), - getOwner: /** @type {GetOwner} */ (_signals.getOwner), - runWithOwner: /** @type {RunWithOwner} */ (_signals.runWithOwner), - onCleanup: /** @type {OnCleanup} */ (_signals.onCleanup), - flushSync: _signals.flushSync, - /** - * @template T - * @param {T} initialValue - * @param {SignalOptions & {save?: {keyPrefix: string; key: string; serialize: (v: T) => string; deserialize: (v: string) => T; serializeParam?: boolean}}} [options] - * @returns {Signal} - */ - createSignal(initialValue, options) { - const [get, set] = this.createSolidSignal( - /** @type {any} */ (initialValue), - options, - ); - - // @ts-ignore - get.set = set; - - // @ts-ignore - get.reset = () => set(initialValue); - - if (options?.save) { - const save = options.save; - - const paramKey = save.key; - const storageKey = `${save.keyPrefix}-${paramKey}`; - - let serialized = /** @type {string | null} */ (null); - if (options.save.serializeParam !== false) { - serialized = new URLSearchParams(window.location.search).get( - paramKey, - ); +const importSignals = import("./v0.2.4-treeshaked/script.js").then( + (_signals) => { + const signals = { + createSolidSignal: /** @type {typeof CreateSignal} */ ( + _signals.createSignal + ), + createSolidEffect: /** @type {typeof CreateEffect} */ ( + _signals.createEffect + ), + createEffect: /** @type {typeof CreateEffect} */ ( + // @ts-ignore + (compute, effect) => { + let dispose = /** @type {VoidFunction | null} */ (null); + // @ts-ignore + _signals.createEffect(compute, (v) => { + dispose?.(); + signals.createRoot((_dispose) => { + dispose = _dispose; + effect(v); + }); + signals.onCleanup(() => dispose?.()); + }); + signals.onCleanup(() => dispose?.()); } + ), + createMemo: /** @type {typeof CreateMemo} */ (_signals.createMemo), + createRoot: /** @type {typeof CreateRoot} */ (_signals.createRoot), + getOwner: /** @type {typeof GetOwner} */ (_signals.getOwner), + runWithOwner: /** @type {typeof RunWithOwner} */ (_signals.runWithOwner), + onCleanup: /** @type {typeof OnCleanup} */ (_signals.onCleanup), + flushSync: _signals.flushSync, + /** + * @template T + * @param {T} initialValue + * @param {SignalOptions & {save?: {keyPrefix: string; key: string; serialize: (v: T) => string; deserialize: (v: string) => T; serializeParam?: boolean}}} [options] + * @returns {Signal} + */ + createSignal(initialValue, options) { + const [get, set] = this.createSolidSignal( + /** @type {any} */ (initialValue), + options, + ); - if (serialized === null) { - serialized = localStorage.getItem(storageKey); - } - if (serialized) { - set(save.deserialize(serialized)); - } + // @ts-ignore + get.set = set; - let firstEffect = true; - this.createEffect(get, (value) => { - if (!save) return; + // @ts-ignore + get.reset = () => set(initialValue); + + if (options?.save) { + const save = options.save; + + const paramKey = save.key; + const storageKey = `${save.keyPrefix}-${paramKey}`; + + let serialized = /** @type {string | null} */ (null); + if (options.save.serializeParam !== false) { + serialized = new URLSearchParams(window.location.search).get( + paramKey, + ); + } + + if (serialized === null) { + serialized = localStorage.getItem(storageKey); + } + if (serialized) { + set(() => save.deserialize(serialized)); + } + + let firstEffect = true; + this.createEffect(get, (value) => { + if (!save) return; + + if (!firstEffect) { + if ( + value !== undefined && + value !== null && + (initialValue === undefined || + initialValue === null || + save.serialize(value) !== save.serialize(initialValue)) + ) { + localStorage.setItem(storageKey, save.serialize(value)); + } else { + localStorage.removeItem(storageKey); + } + } - if (!firstEffect) { if ( value !== undefined && value !== null && @@ -80,35 +101,23 @@ const importSignals = import("./2024-11-02/script.js").then((_signals) => { initialValue === null || save.serialize(value) !== save.serialize(initialValue)) ) { - localStorage.setItem(storageKey, save.serialize(value)); + writeParam(paramKey, save.serialize(value)); } else { - localStorage.removeItem(storageKey); + removeParam(paramKey); } - } - if ( - value !== undefined && - value !== null && - (initialValue === undefined || - initialValue === null || - save.serialize(value) !== save.serialize(initialValue)) - ) { - writeParam(paramKey, save.serialize(value)); - } else { - removeParam(paramKey); - } + firstEffect = false; + }); + } - firstEffect = false; - }); - } + // @ts-ignore + return get; + }, + }; - // @ts-ignore - return get; - }, - }; - - return signals; -}); + return signals; + }, +); /** * @param {string} key diff --git a/websites/kibo.money/scripts/main.js b/websites/kibo.money/scripts/main.js index 10b62ac52..9621356ce 100644 --- a/websites/kibo.money/scripts/main.js +++ b/websites/kibo.money/scripts/main.js @@ -5,9 +5,9 @@ * @import { Marker, CreatePaneParameters, HoveredLegend, ChartPane, SplitSeries, SingleSeries, CreateSplitSeriesParameters, LineSeriesBlueprint, CandlestickSeriesBlueprint, BaselineSeriesBlueprint, CreateBaseSeriesParameters, BaseSeries, RemoveSeriesBlueprintFluff, SplitSeriesBlueprint, AnySeries, PriceSeriesType } from "../packages/lightweight-charts/types"; * @import * as _ from "../packages/ufuzzy/v1.0.14/types" * @import { createChart as CreateClassicChart, LineStyleOptions, DeepPartial, ChartOptions, IChartApi, IHorzScaleBehavior, WhitespaceData, ISeriesApi, Time, LineData, LogicalRange, SeriesType, BaselineStyleOptions, SeriesOptionsCommon } from "../packages/lightweight-charts/v5.0.5-treeshaked/types" - * @import { SignalOptions } from "../packages/solid-signals/2024-11-02/types/core/core" - * @import { getOwner as GetOwner, onCleanup as OnCleanup, Owner } from "../packages/solid-signals/2024-11-02/types/core/owner" - * @import { createSignal as CreateSignal, createEffect as CreateEffect, Accessor, Setter, createMemo as CreateMemo, createRoot as CreateRoot, runWithOwner as RunWithOwner } from "../packages/solid-signals/2024-11-02/types/signals"; + * @import { SignalOptions } from "../packages/solid-signals/v0.2.4-treeshaked/types/core/core" + * @import { getOwner as GetOwner, onCleanup as OnCleanup, Owner } from "../packages/solid-signals/v0.2.4-treeshaked/types/core/owner" + * @import { createSignal as CreateSignal, createEffect as CreateEffect, Accessor, Setter, createMemo as CreateMemo, createRoot as CreateRoot, runWithOwner as RunWithOwner } from "../packages/solid-signals/v0.2.4-treeshaked/types/signals"; * @import {Signal, Signals} from "../packages/solid-signals/types"; * @import {Addressindex, Dateindex, Decadeindex, Difficultyepoch, Index, Halvingepoch, Height, Monthindex, P2PK33index, P2PK65index, P2PKHindex, P2SHindex, P2TRindex, P2WPKHindex, P2WSHindex, Txindex, Txinindex, Txoutindex, VecId, Weekindex, Yearindex, VecIdToIndexes, Quarterindex} from "./vecid-to-indexes" */ @@ -541,11 +541,11 @@ function createUtils() { select.append(optGroup); list.forEach((option) => { optGroup.append(this.createOption(option)); - setters[option.value] = () => signal.set(option); + setters[option.value] = () => signal.set(() => option); }); } else { select.append(this.createOption(anyOption)); - setters[anyOption.value] = () => signal.set(anyOption); + setters[anyOption.value] = () => signal.set(() => anyOption); } if (index !== list.length - 1) { select.append(window.document.createElement("hr")); diff --git a/websites/kibo.money/scripts/service-worker.js b/websites/kibo.money/scripts/service-worker.js index 8514a2e08..489837db4 100644 --- a/websites/kibo.money/scripts/service-worker.js +++ b/websites/kibo.money/scripts/service-worker.js @@ -20,8 +20,8 @@ self.addEventListener("install", (_event) => { "/scripts/simulation.js", "/styles/simulation.css", "/packages/lean-qr/v2.3.4/script.js", - "/packages/lightweight-charts/v5.0.4/script.js", - "/packages/solid-signals/2024-11-02/script.js", + "/packages/lightweight-charts/v5.0.5-treeshaked/script.js", + "/packages/solid-signals/v0.2.4-treeshaked/script.js", "/packages/ufuzzy/v1.0.14/script.js", ]); }), diff --git a/websites/kibo.money/scripts/types/self.d.ts b/websites/kibo.money/scripts/types/self.d.ts index f30214585..8266f5115 100644 --- a/websites/kibo.money/scripts/types/self.d.ts +++ b/websites/kibo.money/scripts/types/self.d.ts @@ -1,7 +1,7 @@ import { Accessor, Setter, -} from "../../packages/solid-signals/2024-11-02/types/signals"; +} from "../../packages/solid-signals/v0.2.4-treeshaked/types/signals"; import { DeepPartial, BaselineStyleOptions,