@calmdown/pyxis 1.0.0-rc.1 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-dev.d.ts +23 -20
- package/dist/core-dev.js +112 -95
- package/dist/core-dev.js.map +1 -1
- package/dist/core.d.ts +23 -20
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/main.d.ts +4 -2
- package/dist/main.js +1 -0
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
* Puts `T` into a union with `null` and `undefined`.
|
|
4
4
|
*/
|
|
5
5
|
type Nil<T> = T | null | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* Converts the union `U` into an intersection type.
|
|
8
|
-
*/
|
|
9
|
-
type Intersection<U, TEmpty = {}> = [U] extends [never] ? TEmpty : (U extends any ? (u: U) => void : never) extends ((i: infer I) => void) ? I : never;
|
|
10
6
|
/**
|
|
11
7
|
* A type describing any map of intrinsic elements and their props.
|
|
12
8
|
*/
|
|
@@ -84,7 +80,7 @@ declare function withLifecycle<TArgs extends [arg?: any], TReturn>(lifecycle: Li
|
|
|
84
80
|
*/
|
|
85
81
|
declare const S_ATOM: unique symbol;
|
|
86
82
|
/** Contract for Atoms where they need to be read. */
|
|
87
|
-
interface
|
|
83
|
+
interface ReadAtom<out T> extends DependencyList {
|
|
88
84
|
/** Pyxis Atom type guard marker. */
|
|
89
85
|
readonly [S_ATOM]: true;
|
|
90
86
|
/**
|
|
@@ -103,7 +99,7 @@ interface ReadonlyAtom<out T> extends DependencyList {
|
|
|
103
99
|
* @see {@link read}
|
|
104
100
|
* @see {@link write}
|
|
105
101
|
*/
|
|
106
|
-
interface Atom<T = unknown> extends
|
|
102
|
+
interface Atom<T = unknown> extends ReadAtom<T> {
|
|
107
103
|
/**
|
|
108
104
|
* Sets the value of this Atom. Does nothing if this Atom is readonly. Only use this method when
|
|
109
105
|
* the target is guaranteed to be an Atom, otherwise it is recommended to use the `write` or
|
|
@@ -133,7 +129,7 @@ type MaybeAtom<T> = Atom<T> | T;
|
|
|
133
129
|
* @see {@link peek}
|
|
134
130
|
* @see {@link isAtom}
|
|
135
131
|
*/
|
|
136
|
-
type
|
|
132
|
+
type MaybeReadAtom<T> = ReadAtom<T> | T;
|
|
137
133
|
/**
|
|
138
134
|
* Creates an empty Atom; i.e. value set to `undefined`.
|
|
139
135
|
*/
|
|
@@ -148,7 +144,7 @@ declare function atomOf<T>(initialValue: MaybeAtom<T>, lifecycle?: Lifecycle, de
|
|
|
148
144
|
* Atom type guard, checks if the provided input is an Atom.
|
|
149
145
|
*/
|
|
150
146
|
declare function isAtom<T = unknown>(input: Nil<MaybeAtom<T>>): input is Atom<T>;
|
|
151
|
-
declare function isAtom<T = unknown>(input: Nil<
|
|
147
|
+
declare function isAtom<T = unknown>(input: Nil<MaybeReadAtom<T>>): input is ReadAtom<T>;
|
|
152
148
|
declare function isAtom<T = unknown>(input: unknown): input is Atom<T>;
|
|
153
149
|
/**
|
|
154
150
|
* Checks if the provided input is an Atom and reads its value. Non-atom inputs are returned as-is.
|
|
@@ -158,7 +154,7 @@ declare function isAtom<T = unknown>(input: unknown): input is Atom<T>;
|
|
|
158
154
|
* @see {@link peek}
|
|
159
155
|
* @see {@link update}
|
|
160
156
|
*/
|
|
161
|
-
declare function read<A>(input: A): A extends
|
|
157
|
+
declare function read<A>(input: A): A extends MaybeReadAtom<infer T> ? T : never;
|
|
162
158
|
/**
|
|
163
159
|
* Checks if the provided input is an Atom and reads its value. Non-atom inputs are returned as-is.
|
|
164
160
|
* Does NOT report read access when inside an effect.
|
|
@@ -167,7 +163,7 @@ declare function read<A>(input: A): A extends MaybeReadonlyAtom<infer T> ? T : n
|
|
|
167
163
|
* @see {@link write}
|
|
168
164
|
* @see {@link update}
|
|
169
165
|
*/
|
|
170
|
-
declare function peek<A>(input: A): A extends
|
|
166
|
+
declare function peek<A>(input: A): A extends MaybeReadAtom<infer T> ? T : never;
|
|
171
167
|
/**
|
|
172
168
|
* Checks if the provided input is an Atom, writes its value and returns the new value.
|
|
173
169
|
*
|
|
@@ -228,7 +224,7 @@ type JsxChildrenProp<T> = T extends readonly [any, any, ...any[]] ? T extends re
|
|
|
228
224
|
/**
|
|
229
225
|
* Primitive types accepted to render as text.
|
|
230
226
|
*/
|
|
231
|
-
type JsxText =
|
|
227
|
+
type JsxText = MaybeReadAtom<Nil<string | number | boolean | bigint>>;
|
|
232
228
|
/**
|
|
233
229
|
* Describes the objects returned by JSX factories.
|
|
234
230
|
*
|
|
@@ -322,9 +318,9 @@ interface ReadonlyList<T> extends Iterable<T>, DependencyList {
|
|
|
322
318
|
*/
|
|
323
319
|
delta(): ListDelta<T> | null;
|
|
324
320
|
/**
|
|
325
|
-
* Gets the underlying array of items. The array is read-only,
|
|
326
|
-
*
|
|
327
|
-
*
|
|
321
|
+
* Gets the underlying array of items. The array is read-only, mutating it will cause observers
|
|
322
|
+
* to go out of sync.
|
|
323
|
+
* Non-reactive in effects and derivations.
|
|
328
324
|
*/
|
|
329
325
|
raw(): readonly T[];
|
|
330
326
|
/**
|
|
@@ -521,7 +517,7 @@ interface Extension<TNode, TExtensionKey extends string = string, TIntrinsicElem
|
|
|
521
517
|
readonly set: (node: TNode, prop: string, value: any, group: MountingGroup<TNode>) => void;
|
|
522
518
|
}
|
|
523
519
|
type ExtensionsType<TNode> = { [_ in string]?: Extension<TNode>; };
|
|
524
|
-
type ExtensionProps<TExtensionKey extends string, TProps extends PropsType> =
|
|
520
|
+
type ExtensionProps<TExtensionKey extends string, TProps extends PropsType> = { readonly [TExtPropKey in `${TExtensionKey}:${keyof TProps & string}`]?: (TExtPropKey extends `${TExtensionKey}:${infer TPropKey}` ? TProps[TPropKey] : never); };
|
|
525
521
|
//#endregion
|
|
526
522
|
//#region src/Renderer.d.ts
|
|
527
523
|
interface Renderer<TNode, TIntrinsicElements extends ElementsType = ElementsType> {
|
|
@@ -600,13 +596,13 @@ interface ShowDataProps<T> {
|
|
|
600
596
|
when?: MaybeAtom<boolean>;
|
|
601
597
|
proxy?: never;
|
|
602
598
|
data: MaybeAtom<T>;
|
|
603
|
-
children: [template: DataTemplate<T> |
|
|
599
|
+
children: [template: DataTemplate<T> | ReadAtom<Nil<DataTemplate<T>>>];
|
|
604
600
|
}
|
|
605
601
|
interface ShowProxyDataProps<T, P extends readonly (keyof T)[]> {
|
|
606
602
|
when?: MaybeAtom<boolean>;
|
|
607
603
|
proxy: P;
|
|
608
604
|
data: MaybeAtom<T>;
|
|
609
|
-
children: [template: DataTemplate<Proxied<T, P>> |
|
|
605
|
+
children: [template: DataTemplate<Proxied<T, P>> | ReadAtom<Nil<DataTemplate<Proxied<T, P>>>>];
|
|
610
606
|
}
|
|
611
607
|
/**
|
|
612
608
|
* The built-in Show Component dynamically mounting and unmounting a Template
|
|
@@ -650,7 +646,7 @@ declare function consumerOf<T>(context: Context<T>): Atom<T> | null;
|
|
|
650
646
|
* `consumerOf(context)`.
|
|
651
647
|
* @see {@link consumerOf}
|
|
652
648
|
*/
|
|
653
|
-
declare function host<
|
|
649
|
+
declare function host<C>(context: C, defaultValue?: C extends Context<infer T> ? T : never, devId?: string): C extends Context<infer T> ? ContextAtom<T> : never;
|
|
654
650
|
//#endregion
|
|
655
651
|
//#region src/data/Effect.d.ts
|
|
656
652
|
interface EffectBlock {
|
|
@@ -665,6 +661,11 @@ interface Effect<T> {}
|
|
|
665
661
|
* unmount.
|
|
666
662
|
*/
|
|
667
663
|
declare function effect(block: EffectBlock, lifecycle?: Lifecycle): void;
|
|
664
|
+
/**
|
|
665
|
+
* Runs a block of code removed from any effects. Accessing atoms within this block will be ignored
|
|
666
|
+
* by any effect that may otherwise be observing this code.
|
|
667
|
+
*/
|
|
668
|
+
declare function noEffect<T>(block: () => T): T;
|
|
668
669
|
//#endregion
|
|
669
670
|
//#region src/data/Derivation.d.ts
|
|
670
671
|
/**
|
|
@@ -723,8 +724,10 @@ declare function peeks(strings: TemplateStringsArray, ...values: JsxText[]): str
|
|
|
723
724
|
//#region src/Builder.d.ts
|
|
724
725
|
interface PyxisBuilder<TNode, TIntrinsicElements extends ElementsType> {
|
|
725
726
|
build: () => Renderer<TNode, TIntrinsicElements>;
|
|
726
|
-
extend: <TExtensionKey extends string, TExtendedIntrinsicElements extends ElementsType>(extensionKey: TExtensionKey, extension: (extensionKey: TExtensionKey, intrinsicElements: TIntrinsicElements) => TExtendedIntrinsicElements) => PyxisBuilder<TNode, TExtendedIntrinsicElements
|
|
727
|
+
extend: <TExtensionKey extends string, TExtendedIntrinsicElements extends ElementsType>(extensionKey: TExtensionKey, extension: (extensionKey: TExtensionKey, intrinsicElements: TIntrinsicElements) => TExtendedIntrinsicElements) => PyxisBuilder<TNode, Merged<TExtendedIntrinsicElements>>;
|
|
727
728
|
}
|
|
729
|
+
type MergeIntersection<T> = { [K in keyof T]: T[K]; } & {};
|
|
730
|
+
type Merged<T> = { [K in keyof T]: MergeIntersection<T[K]>; };
|
|
728
731
|
declare function pyxis<TNode, TIntrinsicElements extends ElementsType>(adapter: Adapter<TNode, TIntrinsicElements>): PyxisBuilder<TNode, TIntrinsicElements>;
|
|
729
732
|
//#endregion
|
|
730
733
|
//#region src/jsx.d.ts
|
|
@@ -733,5 +736,5 @@ declare function jsx<TProps extends PropsType>(component: Component<TProps>, pro
|
|
|
733
736
|
declare function jsxs(tagName: string, props: PropsType, key?: any): JsxResult;
|
|
734
737
|
declare function jsxs<TProps extends PropsType>(component: Component<TProps>, props: TProps, key?: any): JsxResult;
|
|
735
738
|
//#endregion
|
|
736
|
-
export { type Adapter, type Atom, ChangeKind, type Component, type Context, type DataTemplate, type Derivation, type EffectBlock, type ElementsOf, type ElementsType, type Equals, type Extension, type ExtensionProps, type ExtensionsType, Fragment, type FragmentProps, type HNode,
|
|
739
|
+
export { type Adapter, type Atom, ChangeKind, type Component, type Context, type DataTemplate, type Derivation, type EffectBlock, type ElementsOf, type ElementsType, type Equals, type Extension, type ExtensionProps, type ExtensionsType, Fragment, type FragmentProps, type HNode, Iterator, type JsxChildren, type JsxChildrenProp, type JsxObject, type JsxProps, type JsxResult, type JsxText, type Lifecycle, type List, type ListChange, type ListCleared, type ListDelta, type ListItemChanged, type ListItemInserted, type ListItemRemoved, type MaybeAtom, type MaybeReadAtom, type MountBlock, type MountingGroup, Native, type Nil, type NodeType, type PropsOf, type PropsType, type Proxied, type ProxyAtom, type ProxyIteratorProps, type PyxisBuilder, type ReadAtom, type ReadonlyList, RefExtension, type RefExtensionType, type RefFn, type RemountIteratorProps, type Renderer, type S_ATOM, type S_NODE_TYPE, Show, type ShowProps, type TickFn, type UnmountBlock, type WithChildren, atomOf, bind, component, consumerOf, createContext, derived, effect, fork, getLifecycle, host, insert, isAtom, jsx, jsxs, listOf, mount, mountJsx, mounted, noEffect, peek, peeks, proxyOf, pyxis, read, reads, sync, tick, tock, track, unmount, unmounted, untrack, update, withLifecycle, write };
|
|
737
740
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e){return e.$fn(e.$a0,e.$a1)}function t(e,t=s()){n(t,{$fn:r,$a0:t,$a1:e})}function n(e,t){(e.$onMount??=[]).push(t)}function r(e,t){let n=t();n&&a(e,{$fn:n})}function i(e,t=s()){a(t,{$fn:e})}function a(e,t){(e.$onUnmount??=[]).push(t)}let o=null;function s(){return o}function c(e){let t=o;return o=e,t}function l(e,t,n){let r=o;o=e;try{return t(n)}finally{o=r}}function u(e,t,n){d(e,t,{$fn:n}),n()}function d(e,t,n){t.$dt?(t.$dt.$an=n,n.$ap=t.$dt):t.$dh=n,n.$target=t,t.$dt=n,e.$dt?(e.$dt.$ln=n,n.$lp=e.$dt):e.$dh=n,n.$lifecycle=e,e.$dt=n}function f(e){let t=e.$target;if(!t)return;e.$ap?e.$ap.$an=e.$an:t.$dh===e&&(t.$dh=e.$an),e.$an?e.$an.$ap=e.$ap:t.$dt===e&&(t.$dt=e.$ap),e.$target=null,e.$ap=null,e.$an=null;let n=e.$lifecycle;e.$lp?e.$lp.$ln=e.$ln:n.$dh===e&&(n.$dh=e.$ln),e.$ln?e.$ln.$lp=e.$lp:n.$dt===e&&(n.$dt=e.$lp),e.$lifecycle=null,e.$lp=null,e.$ln=null}function p(e){let t=e.$dh,n,r;for(;t;)n=t.$target,t.$ap?t.$ap.$an=t.$an:n.$dh===t&&(n.$dh=t.$an),t.$an?t.$an.$ap=t.$ap:n.$dt===t&&(n.$dt=t.$ap),r=t.$ln,t.$lifecycle=null,t.$target=null,t.$ap=null,t.$an=null,t.$lp=null,t.$ln=null,t=r;e.$dh=null,e.$dt=null}function m(t){let n=!1,r=[],i=[],a={$epoch:1,$onTick:r,$onTock:i,$scheduleTick:()=>{n||(n=!0,t(o))}},o=()=>{try{let t=0,n;for(;t<r.length;t+=1)n=r[t],n.$life===n.$lifecycle.$life&&e(n);for(t=0;t<i.length;t+=1)n=i[t],n.$life===n.$lifecycle.$life&&e(n)}finally{n=!1,r.length=0,i.length=0,a.$epoch+=1}};return a}function h(e,t,n){let r=e.$scheduler;n.$se!==r.$epoch&&(n.$lifecycle=e,n.$life=e.$life,n.$se=r.$epoch,t.push(n),r.$scheduleTick())}function g(e,t){h(e,e.$scheduler.$onTick,t)}function _(e,t=s()){h(t,t.$scheduler.$onTick,{$fn:e})}function v(e,t){h(e,e.$scheduler.$onTock,t)}function y(e,t=s()){h(t,t.$scheduler.$onTock,{$fn:e})}function b(e,t=s()){S({$lifecycle:t,$life:t.$life,$block:e,$react:x,$cycle:0})}function x(e,t){if(e.$cycle>t){f(this);return}g(e.$lifecycle,e.$resolve??={$fn:S,$a0:e})}function S(e){e.$life===e.$lifecycle.$life&&(e.$dispose?.(),e.$dispose=T(e),!e.$tracksUnmount&&e.$dispose&&(e.$tracksUnmount=!0,a(e.$lifecycle,{$fn:C,$a0:e})))}function C(e){e.$dispose?.(),e.$dispose=null}let w=null;function T(e){e.$deps??=new WeakMap,e.$cycle+=1;let t=w,n=c(e.$lifecycle);w=e;try{return e.$block()}finally{c(n),w=t}}function E(e){if(!w||w.$life!==w.$lifecycle.$life)return;let t=w.$deps.get(e);t?(t.$a1=w.$cycle,t.$lifecycle||d(w.$lifecycle,e,t)):(d(w.$lifecycle,e,t={$fn:w.$react,$a0:w,$a1:w.$cycle}),w.$deps.set(e,t))}const D=Symbol();function O(e,t=s()){return j(e)?e:{[D]:!0,$value:e,$tracksValue:!0,$lifecycle:t,$lastValue:e,get:k,set:A}}function k(){return this.$value}function A(e){return Object.is(this.$value,e)?!1:(this.$value=e,!0)}function j(e){return typeof e==`object`&&!!e&&e[D]===!0}function M(e){return j(e)?(E(e),e.get()):e}function ee(e){return j(e)?e.get():e}function te(e,t,n=!1){return j(e)?((e.set(t)||n)&&(e.$force||=n,g(e.$lifecycle,e.$notify??={$fn:N,$a0:e})),e.get()):e}function ne(e,t,n=!1){return j(e)?((e.set(t(e.get()))||n)&&(e.$force||=n,g(e.$lifecycle,e.$notify??={$fn:N,$a0:e})),e.get()):e}function N(t){if(t.$tracksValue){let e=t.get();if(Object.is(t.$lastValue,e)&&!t.$force)return;t.$lastValue=e}t.$force=!1;let n=t.$dh,r;for(;n;)r=n.$an,e(n),n=r}function re(e,t,n,r,i,a){let{adapter:o}=t.$ng,s=null;j(e)?u(t.$ng,e,()=>{s=o.text(e.get()?.toString()??``,s)}):s=o.text(e.toString(),null),W(s,null,t,n,i,a)}function ie(){return{$symbol:Symbol()}}let P,F=!1;function ae(){return P}function I(e){P=e,F=!1}function oe(e){let{$symbol:t}=e,n=P,r;for(;n&&!(r=n[t]);)n=n.$parent;return r??null}function se(e,t){(!F||!P)&&(F=!0,P={$parent:P});let n=s(),r={[D]:!0,$lifecycle:n,$tracksValue:!0,$value:t,get:le,set:ue};if(t===void 0){let t=oe(e);t&&(r.get=ce,r.$ancestor=t,d(n,t,r.$dep={$fn:N,$a0:r}))}return P[e.$symbol]=r,r}function ce(){return this.$ancestor.get()}function le(){return this.$value}function ue(e){let t;return this.$ancestor?(t=this.$ancestor.get(),f(this.$dep),this.$dep=null,this.$ancestor=null,this.get=le):t=this.$value,this.$value=e,!Object.is(t,e)}const L=Symbol();function de(e,t){let n={adapter:e,mounted:!1,$isGroup:!0,$scheduler:m(e.tick),$extensions:t,$life:1,$pg:null,$ng:null,unmount:()=>H(n),mount:(t,r)=>{let i=!!e.batch,a=i?e.batch():t;V(r,n,a,t,null,i),i&&e.insert(a,t,null)}};return n.$ng=n,n}function R(e,t=null){let n=e.$ng,r={adapter:n.adapter,mounted:!1,$isGroup:!0,$scheduler:n.$scheduler,$extensions:n.$extensions,$life:1,$context:ae(),$pg:n,$ng:null};return r.$ng=r,z(r,e,t),r}function z(e,t,n=null){n?.$pg===t?n.$hp?(e.$hp=n.$hp,e.$hn=n,n.$hp.$hn=e,n.$hp=e):(e.$hp=null,e.$hn=t.$hh,t.$hh===n&&(n.$hp=e),t.$hh=e):(t.$ht?(t.$ht.$hn=e,e.$hp=t.$ht):t.$hh=e,t.$ht=e)}function B(e){e.$hp?e.$hp.$hn=e.$hn:e.$pg?.$hh===e&&(e.$pg.$hh=e.$hn),e.$hn?e.$hn.$hp=e.$hp:e.$pg?.$ht===e&&(e.$pg.$ht=e.$hp),e.$hp=null,e.$hn=null}function V(e,t,n,r,i,a){if(t.mounted){pe(t,n,i);return}let o=c(t);I(t.$context);try{U(e,t,n,r,i,a)}finally{c(o),t.mounted=!0,t.$pg?.mounted!==!1&&fe(t)}}function fe(t){let n=t.$hh;for(;n;)fe(n),n=n.$hn;let r;if(t.$isGroup&&t.mounted&&(r=t.$onMount)){let n=c(t);try{r.forEach(e)}finally{r.length=0,c(n)}}}function pe(e,t,n){let{adapter:r}=e,i=e.$hh;for(;i;)i.$isNative?r.insert(i.$nn,t,n):pe(i,t,n),i=i.$hn}function H(t,n=!0){if(t.$isGroup){if(t.mounted){let n;if(n=t.$onUnmount){let r=c(t);try{n.forEach(e)}finally{n.length=0,c(r)}}t.mounted=!1,t.$life+=1}p(t)}let{adapter:r}=t.$ng,i=t.$hh,a;for(;i;)i.$isNative&&n?(r.remove(i.$nn),H(i,!1)):H(i,n),a=i.$hn,i.$hp=null,i.$hn=null,i=a;t.$hh=null,t.$ht=null}function U(e,t,n,r,i,a){switch(typeof e){case`object`:if(e===null)break;if(Array.isArray(e)){let{length:o}=e,s=0;for(;s<o;s+=1)U(e[s],t,n,r,i,a);break}if(!j(e)){e[L]?.(e,t,n,r,i,a);break}case`string`:case`number`:case`boolean`:case`bigint`:re(e,t,n,r,i,a);break}}function W(e,t,n,r,i,a){let o=n;if(o.$isGroup){let t=null;if(i){let e=n.$ht;for(;e;){if(e.$isNative&&e.$nn===i){t=e;break}e=e.$hp}}z(o={$isNative:!0,$pg:o,$ng:o,$nn:e},n,t)}U(t,o,e,e,null,a),n.$ng.adapter.insert(e,r,i)}function me(e,t,n,r,i,a){U(e.children,t,n,r,i,a)}let he=function(e){return e[e.Change=1]=`Change`,e[e.Insert=2]=`Insert`,e[e.Remove=3]=`Remove`,e[e.Clear=4]=`Clear`,e}({});function G(){return{changes:[],lengthChange:0}}function ge({changes:e},t,n,r){let i=q(e,t,be);if(i<0)e.splice(~i,0,{kind:1,index:t,oldItem:n,newItem:r});else{let a=e[i];switch(a.kind){case 1:case 2:a.newItem=r;break;case 3:e.splice(i+1,0,{kind:1,index:t,oldItem:n,newItem:r});break}}}function _e(e,t,n){let{changes:r}=e,i=q(r,t,xe);if(i<0)i=~i,r.splice(i,0,{kind:2,index:t,newItem:n});else{let e=r[i];switch(e.kind){case 1:case 2:r.splice(i,0,{kind:2,index:t,newItem:n});break;case 3:e.kind=1,e.newItem=n;break}}let{length:a}=r;for(;++i<a;)r[i].index+=1;e.lengthChange+=1}function K(e,t,n){let{changes:r}=e,i=q(r,t,be);if(i<0)i=~i,r.splice(i,0,{kind:3,index:t,oldItem:n});else{let e=r[i];switch(e.kind){case 1:e.kind=3,e.newItem=void 0;break;case 2:r.splice(i--,1);break;case 3:r.splice(++i,0,{kind:3,index:t,oldItem:n});break}}let{length:a}=r;for(;++i<a;)--r[i].index;--e.lengthChange}function ve(e,t){let{changes:n}=e;n.length=0,n.push({kind:4,index:-1}),e.lengthChange-=t}function ye(e,t,n,r){let i=0,a=t.length,o=n.length;for(;i<a&&i<o&&r(t[i],n[i]);)i+=1;if(i===a&&i===o)return;for(;a>i&&o>i&&r(t[a-1],n[o-1]);)--a,--o;let s=(Math.min(a,o)+1)*2,c=a+o,l={$eq:r,$list0:t,$list1:n,$index0:i,$index1:i,$N:a,$M:o,$Z:s,$c:0,$buffer:new(c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array)(s+s),$stack:[],$stackTop:0,$pxs:-1,$pxe:-1,$pys:-1,$pye:-1,$oxs:-1,$oxe:-1,$oys:-1,$oye:-1},u=0,d,f,p,m,h,g;do{if(Se(l),l.$c===1)d=l.$oxs,f=l.$oxe,p=l.$oys,m=l.$oye;else if(l.$pxs>=0)d=l.$pxs,f=l.$pxe,p=l.$pys,m=l.$pye;else break;for(h=d;h<f;h+=1)K(e,d+u,t[h]);for(g=p;g<m;g+=1)_e(e,d+u,n[g]),u+=1;u-=f-d}while(l.$c<2)}const be=(e,t,n,r,i)=>{let a=n;for(;++a<i&&e[a].index===t;);return a-1},xe=(e,t,n,r,i)=>{let a=n;for(;--a>=r&&e[a].index===t;);return a+1};function q(e,t,n){let r=0,i=e.length,a,o;for(;r<i;)if(a=r+i>>>1,o=e[a].index,t<o)i=a;else if(t>o)r=a+1;else return n(e,t,a,r,i);return~r}function Se(e){let{$list0:t,$list1:n,$buffer:r,$stack:i,$eq:a}=e,{$index0:o,$index1:s,$N:c,$M:l,$Z:u,$c:d,$stackTop:f}=e,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(;;)switch(d){case 0:Z_block:for(;c>0&&l>0;){p=c-l,m=c+l,h=m&1,g=o+c-1,_=s+l-1,b=(m+h)/2,r.fill(0,0,u+u);h_loop:for(y=0;y<=b;y+=1){for(S=2*Math.max(0,y-l)-y,C=y-2*Math.max(0,y-c),x=S;x<=C;x+=2){for(w=r[x-1-u*Math.floor((x-1)/u)],T=r[x+1-u*Math.floor((x+1)/u)],E=x===-y||x!==y&&w<T?T:w+1,D=E-x,O=E,k=D;O<c&&k<l&&a(t[o+O],n[s+k]);)O+=1,k+=1;if(r[x-u*Math.floor(x/u)]=O,h===1&&(v=p-x)>=1-y&&v<y&&O+r[u+v-u*Math.floor(v/u)]>=c)if(y>1||O!==E){i[f++]=o+O,i[f++]=s+k,i[f++]=c-O,i[f++]=l-k,c=E,l=D,u=2*(Math.min(c,l)+1);continue Z_block}else break h_loop}for(x=S;x<=C;x+=2){for(A=r[u+x-1-u*Math.floor((x-1)/u)],j=r[u+x+1-u*Math.floor((x+1)/u)],E=x===-y||x!==y&&A<j?j:A+1,D=E-x,O=E,k=D;O<c&&k<l&&a(t[g-O],n[_-k]);)O+=1,k+=1;if(r[u+x-u*Math.floor(x/u)]=O,h===0&&(v=p-x)>=-y&&v<=y&&O+r[v-u*Math.floor(v/u)]>=c)if(y>0||O!==E){i[f++]=o+c-E,i[f++]=s+l-D,i[f++]=E,i[f++]=D,c-=O,l-=k,u=2*(Math.min(c,l)+1);continue Z_block}else break h_loop}}if(c!==l){l>c?(o+=c,s+=c,l-=c,c=0):(o+=l,s+=l,c-=l,l=0);break}}if(c+l!==0){if(e.$pxe===o||e.$pye===s)e.$pxe=o+c,e.$pye=s+l;else if(M=e.$pxs,e.$oxs=e.$pxs,e.$oxe=e.$pxe,e.$oys=e.$pys,e.$oye=e.$pye,e.$pxs=o,e.$pxe=o+c,e.$pys=s,e.$pye=s+l,M>=0){e.$index0=o,e.$index1=s,e.$N=c,e.$M=l,e.$Z=u,e.$stackTop=f,e.$c=1;return}}case 1:if(f===0){e.$c=2;return}l=i[--f],c=i[--f],s=i[--f],o=i[--f],u=2*(Math.min(c,l)+1),d=0}}function Ce(e,t=s()){let n={[D]:!0,$lifecycle:t,use:we,get:De};return n.use(e,!1),n}function we(e,t=!0){this.$dep&&f(this.$dep);let n=this.get();j(e)?(this.$bound=e,this.$value=null,this.get=Te,this.set=Ee,d(this.$lifecycle,e,this.$dep??={$fn:N,$a0:this})):(this.$bound=null,this.$value=e,this.get=De,this.set=Oe),t&&!Object.is(n,this.get())&&g(this.$lifecycle,this.$notify??={$fn:N,$a0:this})}function Te(){return this.$bound.get()}function Ee(e){let t=this.$bound;return t.set(e)&&g(t.$lifecycle,t.$notify??={$fn:N,$a0:t}),!1}function De(){return this.$value}function Oe(){return!1}const ke={};function J(e,t,n){let r=Ae(t)?t:ke,i={},{length:a}=n,o=0,s;for(;o<a;o+=1)s=n[o],i[s]=Ce(r[s],e);return i.proxied=t,i}function Y(e,t,n){let r=Ae(t)?t:ke,{length:i}=n;e.proxied=t;let a=0,o;for(;a<i;a+=1)o=n[a],e[o].use(r[o])}function Ae(e){return typeof e==`object`&&!!e}function je(e,t,n,r,i,a){let o=e.source,s=e.proxy,c=s!==void 0,u=e.children[0],f=R(t),{adapter:p}=f,m=!!p.batch,h=p.marker(),g,_=!!o.$delta;d(f,o,{$fn:()=>{if(_){_=!1;return}let{changes:e,lengthChange:t}=o.$delta,n=e.length,i=g.length+t,a=Array(i),d=[],v=[],y,b=0,x=0,S=0,C=0,w,T,E,D=!1,O=r,k=null;for(;x<n;x+=1){for(w=e[x];C<w.index;)a[C++]=g[S++];switch(w.kind){case 1:y=a[C++]=g[S++],c?Y(y.$data,w.newItem,s):(H(y),T=g[S]?.$marker??h,W(y.$marker,null,y,r,T,!1),V(l(y,u,y.$data=w.newItem),y,r,r,T,!1));break;case 2:!c||b<t?(y=a[C++]=R(f,g[S]),y.$marker=p.marker(),y.$data=c?J(y,w.newItem,s):w.newItem,b+=1,T=g[S]?.$marker??h,D||(m?(D=!0,O=p.batch(),k=null):k=T),W(y.$marker,null,y,O,k,D),V(l(y,u,y.$data),y,O,r,k,D),D&&(b>=t||!(E=e[x+1])||E.kind!==2||E.index!==C)&&(p.insert(O,r,T),O=r,D=!1)):d.push({$index:C++,$item:w.newItem});break;case 3:y=g[S++],c?v.push(y):H(y),B(y);break;case 4:if(c)v=g,v.forEach(B),S=g.length;else for(;S<g.length;)y=g[S++],H(y),B(y);break}}for(;C<i;)a[C++]=g[S++];let A=d.length-1,j=v.length-1;for(;A>=0;)E=d[A--],y=a[E.$index]=v[j--],Y(y.$data,E.$item,s),z(y,f,T=a[E.$index+1]),V(l(y,u,y.$data),y,r,r,T?.$marker??h,!1);for(;j>=0;)y=v[j--],H(y),B(y);g=a}});{let e=n,t=i,d=m&&!a&&o.$items.length>0;d&&(e=p.batch(),t=null);let _=d||a;g=o.$items.map(n=>{let i=R(f);return i.$marker=p.marker(),i.$data=c?J(i,n,s):n,W(i.$marker,null,i,e,t,_),V(l(i,u,i.$data),i,e,r,t,_),i}),W(h,null,f,e,t,_),d&&p.insert(e,n,i)}V(null,f,n,r,i,a)}const Me=/^([^:]+?):(.+)$/,X=Symbol();function Z(e,t,n,r,i,a){let o=t.$ng,{adapter:s,$extensions:c}=o,l=s.element(e[X]),d,f,p;for(d in e)if(f=Me.exec(d),p=e[d],f)c[f[1]]?.set(l,f[2],p,o);else if(d!==`children`)if(j(p)){let e=d,t=p;u(o,t,()=>{s.set(l,e,t.get())})}else s.set(l,d,p);W(l,e.children,t,n,i,a)}function Ne(e,t,n,r,i,a){let o=e.when;if(!j(o)&&o===!1)return;let{children:s,data:c}=e,u=e.proxy,f=Object.hasOwn(e,`data`)?s[0]:()=>s,p=c;u&&(j(c)?(p=J(t.$ng,c.get(),u),d(t.$ng,c,{$fn:()=>{Y(p,c.get(),u)}})):p=J(t.$ng,c,u));let m=t.$ng.adapter,h=!!m.batch;if(!(j(o)||j(f)||!u&&j(c))){let e=h&&!a,o=n,s=i;e&&(o=m.batch(),s=null),U(f(p),t,o,r,s,e||a),e&&m.insert(o,n,i);return}let g=R(t),_=i;b(()=>{if(M(o)===!1)return;let e=h&&!a,t=n,i=_;return e&&(t=m.batch(),i=null),V(l(g,M(f),M(p)),g,t,r,i,e||a),e&&m.insert(t,n,_),()=>H(g)},t.$ng),_=m.marker(),W(_,null,t,n,i,a),a=!1,n=r}function Pe(e,t=s()){let n={[D]:!0,$dirty:!1,$value:null,$tracksValue:!0,$lifecycle:t,$life:t.$life,$lastValue:null,$cycle:0,$block:e,$react:Fe,get:Ie,set:Le},r=T(n);return n.$value=r,n.$lastValue=r,n}function Fe(e,t){if(e.$life!==e.$lifecycle.$life||e.$cycle>t){f(this);return}e.$dirty=!0,g(e.$lifecycle,e.$notify??={$fn:N,$a0:e})}function Ie(){return this.$dirty&&this.$life===this.$lifecycle.$life&&(this.$value=T(this),this.$dirty=!1),this.$value}function Le(){return!1}function Re(e,t=s()){return{$lifecycle:t,$items:e?Array.from(e):[],$delta:null,[Symbol.iterator]:Ge,size:Be,get:Ve,delta:He,raw:Ue,forEach:We,set:Ke,clear:qe,insertAt:Je,insertFirst:Ye,insertLast:Xe,remove:Ze,removeAt:Qe,removeFirst:$e,removeLast:et}}function ze(e,t,n=tt){let r=e.$items;e.$items=t.slice(),ye(e.$delta??=G(),r,t,n),$(e)}function Be(){return E(this),this.$items.length}function Ve(e){return E(this),this.$items[e]}function He(){return E(this),this.$delta}function Ue(){return E(this),this.$items}function We(e,t){E(this),this.$items.forEach(e,t)}function Ge(){return E(this),this.$items[Symbol.iterator]()}function Ke(e,t){Q(this,e);let n=this.$items[e];Object.is(t,n)||(this.$items[e]=t,this.$dh&&(ge(this.$delta??=G(),e,n,t),$(this)))}function qe(){let e=this.$items.length;this.$items.length=0,this.$dh&&(ve(this.$delta??=G(),e),$(this))}function Je(e,t){let{$items:n}=this;e===n.length?n.push(t):(Q(this,e),this.$items.splice(e,0,t)),this.$dh&&(_e(this.$delta??=G(),e,t),$(this))}function Ye(e){this.insertAt(0,e)}function Xe(e){this.insertAt(this.$items.length,e)}function Ze(e){let t=this.$items.indexOf(e);return t===-1?!1:(this.removeAt(t),!0)}function Qe(e){Q(this,e);let t=this.$items.splice(e,1)[0];return this.$dh&&(K(this.$delta??=G(),e,t),$(this)),t}function $e(){return this.$items.length>0?this.removeAt(0):void 0}function et(){let{length:e}=this.$items;return e>0?this.removeAt(e-1):void 0}function Q(e,t){if(t>=e.$items.length||t<0)throw RangeError()}function tt(e,t){return Object.is(e,t)}function $(e){g(e.$lifecycle,e.$notify??={$fn:nt,$a0:e}),v(e.$lifecycle,e.$cleanup??={$fn:rt,$a0:e})}function nt(t){let n=t.$dh,r;for(;n;)r=n.$an,e(n),n=r}function rt(e){e.$delta=null}const it={set:(e,t,r)=>{let i;switch(t){case`atom`:if(!j(r))return;i=at;break;case`call`:if(typeof r!=`function`)return;i=ot;break;default:return}let o=s();n(o,{$fn:i,$a0:r,$a1:e}),a(o,{$fn:i,$a0:r,$a1:null})}};function at(e,t){e.set(t)}function ot(e,t){e(t)}function st(e,t,n){let{length:r}=n,i=0,a=t[0];for(;i<r;)a+=e(n[i])+t[++i];return a}function ct(e,...t){return st(M,e,t)}function lt(e,...t){return st(ee,e,t)}function ut(e){let t={},n={build:()=>de(e,t),extend:(e,r)=>(t[e]=r,n)};return n}function dt(e){return(t,n,r,i,a,o)=>{let s=ae();try{I(s),U(e(t),n,r,i,a,o)}finally{I(s)}}}const ft=Object.freeze([]);function pt(e,t,n){let{children:r}=t;return t.children=r===void 0?ft:Array.isArray(r)?r:[r],t.key??=n,typeof e==`string`?(t[L]=Z,t[X]=e):t[L]=e,t}function mt(e,t,n){return t.key??=n,typeof e==`string`?(t[L]=Z,t[X]=e):t[L]=e,t}export{he as ChangeKind,me as Fragment,je as Iterator,Z as Native,it as RefExtension,Ne as Show,O as atomOf,u as bind,dt as component,oe as consumerOf,ie as createContext,Pe as derived,b as effect,R as fork,s as getLifecycle,se as host,W as insert,j as isAtom,pt as jsx,mt as jsxs,Re as listOf,V as mount,U as mountJsx,t as mounted,ee as peek,lt as peeks,Ce as proxyOf,ut as pyxis,M as read,ct as reads,ze as sync,_ as tick,y as tock,z as track,H as unmount,i as unmounted,B as untrack,ne as update,l as withLifecycle,te as write};
|
|
1
|
+
function e(e){return e.$fn(e.$a0,e.$a1)}function t(e,t=s()){n(t,{$fn:r,$a0:t,$a1:e})}function n(e,t){(e.$onMount??=[]).push(t)}function r(e,t){let n=t();n&&a(e,{$fn:n})}function i(e,t=s()){a(t,{$fn:e})}function a(e,t){(e.$onUnmount??=[]).push(t)}let o=null;function s(){return o}function c(e){let t=o;return o=e,t}function l(e,t,n){let r=o;o=e;try{return t(n)}finally{o=r}}function u(e,t,n){d(e,t,{$fn:n}),n()}function d(e,t,n){t.$dt?(t.$dt.$an=n,n.$ap=t.$dt):t.$dh=n,n.$target=t,t.$dt=n,e.$dt?(e.$dt.$ln=n,n.$lp=e.$dt):e.$dh=n,n.$lifecycle=e,e.$dt=n}function f(e){let t=e.$target;if(!t)return;e.$ap?e.$ap.$an=e.$an:t.$dh===e&&(t.$dh=e.$an),e.$an?e.$an.$ap=e.$ap:t.$dt===e&&(t.$dt=e.$ap),e.$target=null,e.$ap=null,e.$an=null;let n=e.$lifecycle;e.$lp?e.$lp.$ln=e.$ln:n.$dh===e&&(n.$dh=e.$ln),e.$ln?e.$ln.$lp=e.$lp:n.$dt===e&&(n.$dt=e.$lp),e.$lifecycle=null,e.$lp=null,e.$ln=null}function p(e){let t=e.$dh,n,r;for(;t;)n=t.$target,t.$ap?t.$ap.$an=t.$an:n.$dh===t&&(n.$dh=t.$an),t.$an?t.$an.$ap=t.$ap:n.$dt===t&&(n.$dt=t.$ap),r=t.$ln,t.$lifecycle=null,t.$target=null,t.$ap=null,t.$an=null,t.$lp=null,t.$ln=null,t=r;e.$dh=null,e.$dt=null}function m(t){let n=!1,r=[],i=[],a={$epoch:1,$onTick:r,$onTock:i,$scheduleTick:()=>{n||(n=!0,t(o))}},o=()=>{try{let t=0,n;for(;t<r.length;t+=1)n=r[t],n.$life===n.$lifecycle.$life&&e(n);for(t=0;t<i.length;t+=1)n=i[t],n.$life===n.$lifecycle.$life&&e(n)}finally{n=!1,r.length=0,i.length=0,a.$epoch+=1}};return a}function h(e,t,n){let r=e.$scheduler;n.$se!==r.$epoch&&(n.$lifecycle=e,n.$life=e.$life,n.$se=r.$epoch,t.push(n),r.$scheduleTick())}function g(e,t){h(e,e.$scheduler.$onTick,t)}function _(e,t=s()){h(t,t.$scheduler.$onTick,{$fn:e})}function v(e,t){h(e,e.$scheduler.$onTock,t)}function y(e,t=s()){h(t,t.$scheduler.$onTock,{$fn:e})}function b(e,t=s()){S({$lifecycle:t,$life:t.$life,$block:e,$react:x,$cycle:0})}function x(e,t){if(e.$cycle>t){f(this);return}g(e.$lifecycle,e.$resolve??={$fn:S,$a0:e})}function S(e){e.$life===e.$lifecycle.$life&&(e.$dispose?.(),e.$dispose=T(e),!e.$tracksUnmount&&e.$dispose&&(e.$tracksUnmount=!0,a(e.$lifecycle,{$fn:C,$a0:e})))}function C(e){e.$dispose?.(),e.$dispose=null}let w=null;function T(e){e.$deps??=new WeakMap,e.$cycle+=1;let t=w,n=c(e.$lifecycle);w=e;try{return e.$block()}finally{c(n),w=t}}function E(e){if(!w||w.$life!==w.$lifecycle.$life)return;let t=w.$deps.get(e);t?(t.$a1=w.$cycle,t.$lifecycle||d(w.$lifecycle,e,t)):(d(w.$lifecycle,e,t={$fn:w.$react,$a0:w,$a1:w.$cycle}),w.$deps.set(e,t))}function D(e){let t=w;w=null;try{return e()}finally{w=t}}const O=Symbol();function k(e,t=s()){return M(e)?e:{[O]:!0,$value:e,$tracksValue:!0,$lifecycle:t,$lastValue:e,get:A,set:j}}function A(){return this.$value}function j(e){return Object.is(this.$value,e)?!1:(this.$value=e,!0)}function M(e){return typeof e==`object`&&!!e&&e[O]===!0}function N(e){return M(e)?(E(e),e.get()):e}function ee(e){return M(e)?e.get():e}function te(e,t,n=!1){return M(e)?((e.set(t)||n)&&(e.$force||=n,g(e.$lifecycle,e.$notify??={$fn:P,$a0:e})),e.get()):e}function ne(e,t,n=!1){return M(e)?((e.set(t(e.get()))||n)&&(e.$force||=n,g(e.$lifecycle,e.$notify??={$fn:P,$a0:e})),e.get()):e}function P(t){if(t.$tracksValue){let e=t.get();if(Object.is(t.$lastValue,e)&&!t.$force)return;t.$lastValue=e}t.$force=!1;let n=t.$dh,r;for(;n;)r=n.$an,e(n),n=r}function re(e,t,n,r,i,a){let{adapter:o}=t.$ng,s=null;M(e)?u(t.$ng,e,()=>{s=o.text(e.get()?.toString()??``,s)}):s=o.text(e.toString(),null),H(s,null,t,n,i,a)}const F=Symbol();function ie(e,t){let n={adapter:e,mounted:!1,$isGroup:!0,$scheduler:m(e.tick),$extensions:t,$life:1,$pg:null,$ng:null,unmount:()=>B(n),mount:(t,r)=>{let i=!!e.batch,a=i?e.batch():t;z(r,n,a,t,null,i),i&&e.insert(a,t,null)}};return n.$ng=n,n}function I(e,t=null){let n=e.$ng,r={adapter:n.adapter,mounted:!1,$isGroup:!0,$scheduler:n.$scheduler,$extensions:n.$extensions,$life:1,$pg:n,$ng:null};return r.$ng=r,L(r,e,t),r}function L(e,t,n=null){n?.$pg===t?n.$hp?(e.$hp=n.$hp,e.$hn=n,n.$hp.$hn=e,n.$hp=e):(e.$hp=null,e.$hn=t.$hh,t.$hh===n&&(n.$hp=e),t.$hh=e):(t.$ht?(t.$ht.$hn=e,e.$hp=t.$ht):t.$hh=e,t.$ht=e)}function R(e){e.$hp?e.$hp.$hn=e.$hn:e.$pg?.$hh===e&&(e.$pg.$hh=e.$hn),e.$hn?e.$hn.$hp=e.$hp:e.$pg?.$ht===e&&(e.$pg.$ht=e.$hp),e.$hp=null,e.$hn=null}function z(e,t,n,r,i,a){if(t.mounted){oe(t,n,i);return}let o=c(t);try{V(e,t,n,r,i,a)}finally{c(o),t.mounted=!0,t.$pg?.mounted!==!1&&ae(t)}}function ae(t){let n=t.$hh;for(;n;)ae(n),n=n.$hn;let r;if(t.$isGroup&&t.mounted&&(r=t.$onMount)){let n=c(t);try{r.forEach(e)}finally{r.length=0,c(n)}}}function oe(e,t,n){let{adapter:r}=e,i=e.$hh;for(;i;)i.$isNative?r.insert(i.$nn,t,n):oe(i,t,n),i=i.$hn}function B(t,n=!0){if(t.$isGroup){if(t.mounted){let n;if(n=t.$onUnmount){let r=c(t);try{n.forEach(e)}finally{n.length=0,c(r)}}t.mounted=!1,t.$life+=1}p(t)}let{adapter:r}=t.$ng,i=t.$hh,a;for(;i;)i.$isNative&&n?(r.remove(i.$nn),B(i,!1)):B(i,n),a=i.$hn,i.$hp=null,i.$hn=null,i=a;t.$hh=null,t.$ht=null}function V(e,t,n,r,i,a){switch(typeof e){case`object`:if(e===null)break;if(Array.isArray(e)){let{length:o}=e,s=0;for(;s<o;s+=1)V(e[s],t,n,r,i,a);break}if(!M(e)){e[F]?.(e,t,n,r,i,a);break}case`string`:case`number`:case`boolean`:case`bigint`:re(e,t,n,r,i,a);break}}function H(e,t,n,r,i,a){let o=n;if(o.$isGroup){let t=null;if(i){let e=n.$ht;for(;e;){if(e.$isNative&&e.$nn===i){t=e;break}e=e.$hp}}L(o={$isNative:!0,$pg:o,$ng:o,$nn:e},n,t)}V(t,o,e,e,null,a),n.$ng.adapter.insert(e,r,i)}function se(e,t,n,r,i,a){V(e.children,t,n,r,i,a)}function ce(){return{$symbol:Symbol()}}let U=null,W=!1;function G(){return U}function K(e){U=e,W=!1}function le(e){let{$symbol:t}=e,n=U,r;for(;n&&!(r=n[t]);)n=n.$parent;return r??null}function ue(e,t){(!W||!U)&&(W=!0,U={$parent:U});let n=s(),r={[O]:!0,$lifecycle:n,$tracksValue:!0,$value:t,get:fe,set:pe};if(t===void 0){let t=le(e);t&&(r.get=de,r.$ancestor=t,d(n,t,r.$dep={$fn:P,$a0:r}))}return U[e.$symbol]=r,r}function de(){return this.$ancestor.get()}function fe(){return this.$value}function pe(e){let t;return this.$ancestor?(t=this.$ancestor.get(),f(this.$dep),this.$dep=null,this.$ancestor=null,this.get=fe):t=this.$value,this.$value=e,!Object.is(t,e)}let me=function(e){return e[e.Change=1]=`Change`,e[e.Insert=2]=`Insert`,e[e.Remove=3]=`Remove`,e[e.Clear=4]=`Clear`,e}({});function q(){return{changes:[],lengthChange:0}}function he({changes:e},t,n,r){let i=J(e,t,be);if(i<0)e.splice(~i,0,{kind:1,index:t,oldItem:n,newItem:r});else{let a=e[i];switch(a.kind){case 1:case 2:a.newItem=r;break;case 3:e.splice(i+1,0,{kind:1,index:t,oldItem:n,newItem:r});break}}}function ge(e,t,n){let{changes:r}=e,i=J(r,t,xe);if(i<0)i=~i,r.splice(i,0,{kind:2,index:t,newItem:n});else{let e=r[i];switch(e.kind){case 1:case 2:r.splice(i,0,{kind:2,index:t,newItem:n});break;case 3:e.kind=1,e.newItem=n;break}}let{length:a}=r;for(;++i<a;)r[i].index+=1;e.lengthChange+=1}function _e(e,t,n){let{changes:r}=e,i=J(r,t,be);if(i<0)i=~i,r.splice(i,0,{kind:3,index:t,oldItem:n});else{let e=r[i];switch(e.kind){case 1:e.kind=3,e.newItem=void 0;break;case 2:r.splice(i--,1);break;case 3:r.splice(++i,0,{kind:3,index:t,oldItem:n});break}}let{length:a}=r;for(;++i<a;)--r[i].index;--e.lengthChange}function ve(e,t){let{changes:n}=e;n.length=0,n.push({kind:4,index:-1}),e.lengthChange-=t}function ye(e,t,n,r){let i=0,a=t.length,o=n.length;for(;i<a&&i<o&&r(t[i],n[i]);)i+=1;if(i===a&&i===o)return;for(;a>i&&o>i&&r(t[a-1],n[o-1]);)--a,--o;let s=(Math.min(a,o)+1)*2,c=a+o,l={$eq:r,$list0:t,$list1:n,$index0:i,$index1:i,$N:a,$M:o,$Z:s,$c:0,$buffer:new(c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array)(s+s),$stack:[],$stackTop:0,$pxs:-1,$pxe:-1,$pys:-1,$pye:-1,$oxs:-1,$oxe:-1,$oys:-1,$oye:-1},u=0,d,f,p,m,h,g;do{if(Se(l),l.$c===1)d=l.$oxs,f=l.$oxe,p=l.$oys,m=l.$oye;else if(l.$pxs>=0)d=l.$pxs,f=l.$pxe,p=l.$pys,m=l.$pye;else break;for(h=d;h<f;h+=1)_e(e,d+u,t[h]);for(g=p;g<m;g+=1)ge(e,d+u,n[g]),u+=1;u-=f-d}while(l.$c<2)}const be=(e,t,n,r,i)=>{let a=n;for(;++a<i&&e[a].index===t;);return a-1},xe=(e,t,n,r,i)=>{let a=n;for(;--a>=r&&e[a].index===t;);return a+1};function J(e,t,n){let r=0,i=e.length,a,o;for(;r<i;)if(a=r+i>>>1,o=e[a].index,t<o)i=a;else if(t>o)r=a+1;else return n(e,t,a,r,i);return~r}function Se(e){let{$list0:t,$list1:n,$buffer:r,$stack:i,$eq:a}=e,{$index0:o,$index1:s,$N:c,$M:l,$Z:u,$c:d,$stackTop:f}=e,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(;;)switch(d){case 0:Z_block:for(;c>0&&l>0;){p=c-l,m=c+l,h=m&1,g=o+c-1,_=s+l-1,b=(m+h)/2,r.fill(0,0,u+u);h_loop:for(y=0;y<=b;y+=1){for(S=2*Math.max(0,y-l)-y,C=y-2*Math.max(0,y-c),x=S;x<=C;x+=2){for(w=r[x-1-u*Math.floor((x-1)/u)],T=r[x+1-u*Math.floor((x+1)/u)],E=x===-y||x!==y&&w<T?T:w+1,D=E-x,O=E,k=D;O<c&&k<l&&a(t[o+O],n[s+k]);)O+=1,k+=1;if(r[x-u*Math.floor(x/u)]=O,h===1&&(v=p-x)>=1-y&&v<y&&O+r[u+v-u*Math.floor(v/u)]>=c)if(y>1||O!==E){i[f++]=o+O,i[f++]=s+k,i[f++]=c-O,i[f++]=l-k,c=E,l=D,u=2*(Math.min(c,l)+1);continue Z_block}else break h_loop}for(x=S;x<=C;x+=2){for(A=r[u+x-1-u*Math.floor((x-1)/u)],j=r[u+x+1-u*Math.floor((x+1)/u)],E=x===-y||x!==y&&A<j?j:A+1,D=E-x,O=E,k=D;O<c&&k<l&&a(t[g-O],n[_-k]);)O+=1,k+=1;if(r[u+x-u*Math.floor(x/u)]=O,h===0&&(v=p-x)>=-y&&v<=y&&O+r[v-u*Math.floor(v/u)]>=c)if(y>0||O!==E){i[f++]=o+c-E,i[f++]=s+l-D,i[f++]=E,i[f++]=D,c-=O,l-=k,u=2*(Math.min(c,l)+1);continue Z_block}else break h_loop}}if(c!==l){l>c?(o+=c,s+=c,l-=c,c=0):(o+=l,s+=l,c-=l,l=0);break}}if(c+l!==0){if(e.$pxe===o||e.$pye===s)e.$pxe=o+c,e.$pye=s+l;else if(M=e.$pxs,e.$oxs=e.$pxs,e.$oxe=e.$pxe,e.$oys=e.$pys,e.$oye=e.$pye,e.$pxs=o,e.$pxe=o+c,e.$pys=s,e.$pye=s+l,M>=0){e.$index0=o,e.$index1=s,e.$N=c,e.$M=l,e.$Z=u,e.$stackTop=f,e.$c=1;return}}case 1:if(f===0){e.$c=2;return}l=i[--f],c=i[--f],s=i[--f],o=i[--f],u=2*(Math.min(c,l)+1),d=0}}function Ce(e,t=s()){let n={[O]:!0,$lifecycle:t,use:we,get:De};return n.use(e,!1),n}function we(e,t=!0){this.$dep&&f(this.$dep);let n=this.get();M(e)?(this.$bound=e,this.$value=null,this.get=Te,this.set=Ee,d(this.$lifecycle,e,this.$dep??={$fn:P,$a0:this})):(this.$bound=null,this.$value=e,this.get=De,this.set=Oe),t&&!Object.is(n,this.get())&&g(this.$lifecycle,this.$notify??={$fn:P,$a0:this})}function Te(){return this.$bound.get()}function Ee(e){let t=this.$bound;return t.set(e)&&g(t.$lifecycle,t.$notify??={$fn:P,$a0:t}),!1}function De(){return this.$value}function Oe(){return!1}const ke={};function Y(e,t,n){let r=Ae(t)?t:ke,i={},{length:a}=n,o=0,s;for(;o<a;o+=1)s=n[o],i[s]=Ce(r[s],e);return i.proxied=t,i}function X(e,t,n){let r=Ae(t)?t:ke,{length:i}=n;e.proxied=t;let a=0,o;for(;a<i;a+=1)o=n[a],e[o].use(r[o])}function Ae(e){return typeof e==`object`&&!!e}function je(e,t,n,r,i,a){let o=e.source,s=e.proxy,c=s!==void 0,u=e.children[0],f=I(t),p=G(),{adapter:m}=f,h=!!m.batch,g=m.marker(),_,v=!!o.$delta;d(f,o,{$fn:()=>{if(v){v=!1;return}let{changes:e,lengthChange:t}=o.$delta,n=e.length,i=_.length+t,a=Array(i),d=[],y=[],b,x=0,S=0,C=0,w=0,T,E,D,O=!1,k=r,A=null;for(;S<n;S+=1){for(T=e[S];w<T.index;)a[w++]=_[C++];switch(T.kind){case 1:b=a[w++]=_[C++],c?X(b.$data,T.newItem,s):(B(b),E=_[C]?.$marker??g,H(b.$marker,null,b,r,E,!1),K(p),z(l(b,u,b.$data=T.newItem),b,r,r,E,!1));break;case 2:!c||x<t?(b=a[w++]=I(f,_[C]),b.$marker=m.marker(),b.$data=c?Y(b,T.newItem,s):T.newItem,x+=1,E=_[C]?.$marker??g,O||(h?(O=!0,k=m.batch(),A=null):A=E),H(b.$marker,null,b,k,A,O),K(p),z(l(b,u,b.$data),b,k,r,A,O),O&&(x>=t||!(D=e[S+1])||D.kind!==2||D.index!==w)&&(m.insert(k,r,E),k=r,O=!1)):d.push({$index:w++,$item:T.newItem});break;case 3:b=_[C++],c?y.push(b):B(b),R(b);break;case 4:if(c)y=_,y.forEach(R),C=_.length;else for(;C<_.length;)b=_[C++],B(b),R(b);break}}for(;w<i;)a[w++]=_[C++];let j=d.length-1,M=y.length-1;for(;j>=0;)D=d[j--],b=a[D.$index]=y[M--],X(b.$data,D.$item,s),L(b,f,E=a[D.$index+1]),K(p),z(l(b,u,b.$data),b,r,r,E?.$marker??g,!1);for(;M>=0;)b=y[M--],B(b),R(b);_=a}});{let e=n,t=i,d=h&&!a&&o.$items.length>0;d&&(e=m.batch(),t=null);let p=d||a;_=o.$items.map(n=>{let i=I(f);return i.$marker=m.marker(),i.$data=c?Y(i,n,s):n,H(i.$marker,null,i,e,t,p),z(l(i,u,i.$data),i,e,r,t,p),i}),H(g,null,f,e,t,p),d&&m.insert(e,n,i)}z(null,f,n,r,i,a)}const Me=/^([^:]+?):(.+)$/,Z=Symbol();function Q(e,t,n,r,i,a){let o=t.$ng,{adapter:s,$extensions:c}=o,l=s.element(e[Z]),d,f,p;for(d in e)if(f=Me.exec(d),p=e[d],f)c[f[1]]?.set(l,f[2],p,o);else if(d!==`children`)if(M(p)){let e=d,t=p;u(o,t,()=>{s.set(l,e,t.get())})}else s.set(l,d,p);H(l,e.children,t,n,i,a)}function Ne(e,t,n,r,i,a){let o=e.when;if(!M(o)&&o===!1)return;let{children:s,data:c}=e,u=e.proxy,f=Object.hasOwn(e,`data`)?s[0]:()=>s,p=c;u&&(M(c)?(p=Y(t.$ng,c.get(),u),d(t.$ng,c,{$fn:()=>{X(p,c.get(),u)}})):p=Y(t.$ng,c,u));let m=t.$ng.adapter,h=!!m.batch;if(!(M(o)||M(f)||!u&&M(c))){let e=h&&!a,o=n,s=i;e&&(o=m.batch(),s=null),V(f(p),t,o,r,s,e||a),e&&m.insert(o,n,i);return}let g=I(t),_=G(),v=i;b(()=>{if(N(o)===!1)return;let e=h&&!a,t=n,i=v;return e&&(t=m.batch(),i=null),K(_),z(l(g,N(f),N(p)),g,t,r,i,e||a),e&&m.insert(t,n,v),()=>B(g)},t.$ng),v=m.marker(),H(v,null,t,n,i,a),a=!1,n=r}function Pe(e,t=s()){let n={[O]:!0,$dirty:!1,$value:null,$tracksValue:!0,$lifecycle:t,$life:t.$life,$lastValue:null,$cycle:0,$block:e,$react:Fe,get:Ie,set:Le},r=T(n);return n.$value=r,n.$lastValue=r,n}function Fe(e,t){if(e.$life!==e.$lifecycle.$life||e.$cycle>t){f(this);return}e.$dirty=!0,g(e.$lifecycle,e.$notify??={$fn:P,$a0:e})}function Ie(){return this.$dirty&&this.$life===this.$lifecycle.$life&&(this.$value=T(this),this.$dirty=!1),this.$value}function Le(){return!1}function Re(e,t=s()){return{$lifecycle:t,$items:e?Array.from(e):[],$delta:null,[Symbol.iterator]:Ge,size:Be,get:Ve,delta:He,raw:Ue,forEach:We,set:Ke,clear:qe,insertAt:Je,insertFirst:Ye,insertLast:Xe,remove:Ze,removeAt:Qe,removeFirst:$e,removeLast:et}}function ze(e,t,n=nt){let r=e.$items;e.$items=t.slice(),ye(e.$delta??=q(),r,t,n),$(e)}function Be(){return E(this),this.$items.length}function Ve(e){return E(this),this.$items[e]}function He(){return E(this),this.$delta}function Ue(){return this.$items}function We(e,t){E(this),this.$items.forEach(e,t)}function Ge(){return E(this),this.$items[Symbol.iterator]()}function Ke(e,t){tt(this,e);let n=this.$items[e];Object.is(t,n)||(this.$items[e]=t,this.$dh&&(he(this.$delta??=q(),e,n,t),$(this)))}function qe(){let e=this.$items.length;this.$items.length=0,this.$dh&&(ve(this.$delta??=q(),e),$(this))}function Je(e,t){let{$items:n}=this;e===n.length?n.push(t):(tt(this,e),this.$items.splice(e,0,t)),this.$dh&&(ge(this.$delta??=q(),e,t),$(this))}function Ye(e){this.insertAt(0,e)}function Xe(e){this.insertAt(this.$items.length,e)}function Ze(e){let t=this.$items.indexOf(e);return t===-1?!1:(this.removeAt(t),!0)}function Qe(e){tt(this,e);let t=this.$items.splice(e,1)[0];return this.$dh&&(_e(this.$delta??=q(),e,t),$(this)),t}function $e(){return this.$items.length>0?this.removeAt(0):void 0}function et(){let{length:e}=this.$items;return e>0?this.removeAt(e-1):void 0}function tt(e,t){if(t>=e.$items.length||t<0)throw RangeError()}function nt(e,t){return Object.is(e,t)}function $(e){g(e.$lifecycle,e.$notify??={$fn:rt,$a0:e}),v(e.$lifecycle,e.$cleanup??={$fn:it,$a0:e})}function rt(t){let n=t.$dh,r;for(;n;)r=n.$an,e(n),n=r}function it(e){e.$delta=null}const at={set:(e,t,r)=>{let i;switch(t){case`atom`:if(!M(r))return;i=ot;break;case`call`:if(typeof r!=`function`)return;i=st;break;default:return}let o=s();n(o,{$fn:i,$a0:r,$a1:e}),a(o,{$fn:i,$a0:r,$a1:null})}};function ot(e,t){e.set(t)}function st(e,t){e(t)}function ct(e,t,n){let{length:r}=n,i=0,a=t[0];for(;i<r;)a+=e(n[i])+t[++i];return a}function lt(e,...t){return ct(N,e,t)}function ut(e,...t){return ct(ee,e,t)}function dt(e){let t={},n={build:()=>ie(e,t),extend:(e,r)=>(t[e]=r,n)};return n}function ft(e){return(t,n,r,i,a,o)=>{let s=G();try{K(s),V(e(t),n,r,i,a,o)}finally{K(s)}}}const pt=Object.freeze([]);function mt(e,t,n){let{children:r}=t;return t.children=r===void 0?pt:Array.isArray(r)?r:[r],t.key??=n,typeof e==`string`?(t[F]=Q,t[Z]=e):t[F]=e,t}function ht(e,t,n){return t.key??=n,typeof e==`string`?(t[F]=Q,t[Z]=e):t[F]=e,t}export{me as ChangeKind,se as Fragment,je as Iterator,Q as Native,at as RefExtension,Ne as Show,k as atomOf,u as bind,ft as component,le as consumerOf,ce as createContext,Pe as derived,b as effect,I as fork,s as getLifecycle,ue as host,H as insert,M as isAtom,mt as jsx,ht as jsxs,Re as listOf,z as mount,V as mountJsx,t as mounted,D as noEffect,ee as peek,ut as peeks,Ce as proxyOf,dt as pyxis,N as read,lt as reads,ze as sync,_ as tick,y as tock,L as track,B as unmount,i as unmounted,R as untrack,ne as update,l as withLifecycle,te as write};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|