@manyducks.co/dolla 2.0.0-alpha.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +132 -573
  2. package/dist/core/context.d.ts +23 -0
  3. package/dist/core/debug.d.ts +19 -0
  4. package/dist/core/index.d.ts +24 -0
  5. package/dist/core/markup/helpers.d.ts +34 -0
  6. package/dist/core/markup/html.d.ts +3 -0
  7. package/dist/core/markup/html.test.d.ts +1 -0
  8. package/dist/core/markup/nodes/dom.d.ts +14 -0
  9. package/dist/core/markup/nodes/dynamic.d.ts +16 -0
  10. package/dist/core/markup/nodes/element.d.ts +14 -0
  11. package/dist/core/markup/nodes/portal.d.ts +15 -0
  12. package/dist/core/markup/nodes/repeat.d.ts +21 -0
  13. package/dist/core/markup/nodes/view.d.ts +17 -0
  14. package/dist/core/markup/scheduler.d.ts +1 -0
  15. package/dist/core/markup/types.d.ts +62 -0
  16. package/dist/core/markup/utils.d.ts +22 -0
  17. package/dist/core/markup/utils.test.d.ts +1 -0
  18. package/dist/core/ref.d.ts +13 -0
  19. package/dist/core/root.d.ts +36 -0
  20. package/dist/core/signals.d.ts +70 -0
  21. package/dist/core/signals.test.d.ts +1 -0
  22. package/dist/core/symbols.d.ts +2 -0
  23. package/dist/core-BLkJ-xuh.js +242 -0
  24. package/dist/core-BLkJ-xuh.js.map +1 -0
  25. package/dist/http/index.d.ts +43 -0
  26. package/dist/http.js +90 -0
  27. package/dist/http.js.map +1 -0
  28. package/dist/index.js +4 -1428
  29. package/dist/jsx-dev-runtime.d.ts +4 -2
  30. package/dist/jsx-dev-runtime.js +12 -16
  31. package/dist/jsx-dev-runtime.js.map +1 -1
  32. package/dist/jsx-runtime.d.ts +5 -3
  33. package/dist/jsx-runtime.js +17 -18
  34. package/dist/jsx-runtime.js.map +1 -1
  35. package/dist/router/index.d.ts +4 -0
  36. package/dist/router/matcher.test.d.ts +1 -0
  37. package/dist/router/router.d.ts +23 -0
  38. package/dist/router/router.test.d.ts +1 -0
  39. package/dist/router/store.d.ts +12 -0
  40. package/dist/router/types.d.ts +152 -0
  41. package/dist/router/utils.d.ts +99 -0
  42. package/dist/router/utils.test.d.ts +1 -0
  43. package/dist/router.js +429 -0
  44. package/dist/router.js.map +1 -0
  45. package/dist/signals-CMJPGr_M.js +354 -0
  46. package/dist/signals-CMJPGr_M.js.map +1 -0
  47. package/dist/translate/index.d.ts +82 -0
  48. package/dist/translate.js +125 -0
  49. package/dist/translate.js.map +1 -0
  50. package/dist/types.d.ts +83 -29
  51. package/dist/utils.d.ts +46 -12
  52. package/dist/utils.test.d.ts +1 -0
  53. package/dist/view-cBN-hn_T.js +360 -0
  54. package/dist/view-cBN-hn_T.js.map +1 -0
  55. package/dist/virtual/index.d.ts +1 -0
  56. package/dist/virtual/list.d.ts +53 -0
  57. package/index.d.ts +2 -2
  58. package/package.json +34 -17
  59. package/build.js +0 -34
  60. package/dist/index.d.ts +0 -21
  61. package/dist/index.js.map +0 -1
  62. package/dist/markup.d.ts +0 -108
  63. package/dist/modules/dolla.d.ts +0 -111
  64. package/dist/modules/http.d.ts +0 -57
  65. package/dist/modules/i18n.d.ts +0 -59
  66. package/dist/modules/render.d.ts +0 -17
  67. package/dist/modules/router.d.ts +0 -152
  68. package/dist/nodes/cond.d.ts +0 -26
  69. package/dist/nodes/html.d.ts +0 -31
  70. package/dist/nodes/observer.d.ts +0 -29
  71. package/dist/nodes/outlet.d.ts +0 -22
  72. package/dist/nodes/portal.d.ts +0 -19
  73. package/dist/nodes/repeat.d.ts +0 -34
  74. package/dist/nodes/text.d.ts +0 -19
  75. package/dist/passthrough-9kwwjgWk.js +0 -1279
  76. package/dist/passthrough-9kwwjgWk.js.map +0 -1
  77. package/dist/routing.d.ts +0 -79
  78. package/dist/state.d.ts +0 -101
  79. package/dist/typeChecking.d.ts +0 -191
  80. package/dist/view.d.ts +0 -65
  81. package/dist/views/default-crash-view.d.ts +0 -18
  82. package/dist/views/passthrough.d.ts +0 -5
  83. package/notes/context-vars.md +0 -21
  84. package/notes/readme-scratch.md +0 -222
  85. package/notes/route-middleware.md +0 -42
  86. package/notes/scratch.md +0 -233
  87. package/notes/views.md +0 -195
  88. package/tests/state.test.js +0 -135
  89. package/vite.config.js +0 -28
  90. /package/dist/{routing.test.d.ts → core/context.test.d.ts} +0 -0
package/dist/types.d.ts CHANGED
@@ -1,17 +1,21 @@
1
1
  import type * as CSS from "csstype";
2
- import { Ref, type Markup } from "./markup.js";
3
- import { SettableState, State } from "./state.js";
2
+ import type { ComponentState, Context } from "./core/context.js";
3
+ import type { Markup, MarkupNode } from "./core/markup/types.js";
4
+ import type { Getter } from "./core/signals.js";
5
+ export type Env = "production" | "development";
4
6
  /**
5
7
  * Represents everything that can be handled as a DOM node.
6
8
  * These are all the items considered valid to pass as children to any element.
7
9
  */
8
- export type Renderable = string | number | Markup | false | null | undefined | State<any> | (string | number | Markup | false | null | undefined | State<any>)[];
9
- export type Stringable = {
10
- toString(): string;
11
- };
12
- type MaybeState<T> = T | State<T> | State<T | undefined>;
13
- type OptionalProperty<T> = T | State<T> | State<T | undefined>;
14
- type RequiredProperty<T> = T | State<T>;
10
+ export type Renderable = string | number | Node | Markup | MarkupNode | false | null | undefined | void | Getter<any> | Renderable[];
11
+ export interface BaseProps {
12
+ children?: Renderable;
13
+ }
14
+ export type View<Props = {}, State = Record<string | symbol, any>> = (this: Context<ComponentState & State>, props: Props, context: Context<ComponentState & State>) => Renderable;
15
+ export type Store<Props, Value, State = Record<string | symbol, any>> = (this: Context<ComponentState & State>, props: Props, context: Context<ComponentState & State>) => Value;
16
+ export type MaybeGetter<T> = Getter<T> | T;
17
+ type RequiredProperty<T> = Getter<T> | T;
18
+ type OptionalProperty<T> = Getter<T> | Getter<T | undefined> | T;
15
19
  type AutocapitalizeValues = "off" | "on" | "none" | "sentences" | "words" | "characters";
16
20
  type ContentEditableValues = true | false | "true" | "false" | "plaintext-only" | "inherit";
17
21
  type ClassListValues = string | ClassMap | Array<string | ClassMap | (string | ClassMap)[]>;
@@ -24,20 +28,24 @@ type InputModeValues = "decimal" | "email" | "none" | "numeric" | "search" | "te
24
28
  */
25
29
  export interface ElementProps {
26
30
  /**
27
- * HTML attributes to assign to the element.
31
+ * Sets the value as an HTML attribute.
32
+ */
33
+ [key: `attr:${string}`]: OptionalProperty<any>;
34
+ /**
35
+ * Sets the value directly on the HTMLElement as a property.
28
36
  */
29
- attributes?: OptionalProperty<Record<string, any>>;
37
+ [key: `prop:${string}`]: OptionalProperty<any>;
30
38
  /**
31
- * Object of event listeners.
39
+ * Attaches an event listener to the element (with `addEventListener`).
32
40
  */
33
- eventListeners?: OptionalProperty<Record<string, EventHandler<Event>>>;
41
+ [key: `on:${string}`]: OptionalProperty<EventHandler<Event>>;
34
42
  /**
35
43
  * CSS classes to be applied to this element. In addition to the standard space-separated list of class names,
36
44
  * this property also supports a class map object with class names as keys and booleans as values.
37
45
  * Class names in a class map will be applied to the element while their values are true. Also supports an
38
46
  * array of strings and class maps.
39
47
  *
40
- * Alias of `className`.
48
+ * @alias className
41
49
  *
42
50
  * @example
43
51
  * <div class="one-class" />
@@ -57,6 +65,8 @@ export interface ElementProps {
57
65
  * Class names in a class map will be applied to the element while their values are true. Also supports an
58
66
  * array of strings and class maps.
59
67
  *
68
+ * @alias class
69
+ *
60
70
  * @example
61
71
  * <div className="one-class" />
62
72
  *
@@ -71,22 +81,39 @@ export interface ElementProps {
71
81
  className?: OptionalProperty<ClassListValues>;
72
82
  /**
73
83
  * A unique string to identify this element.
84
+ *
85
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
74
86
  */
75
87
  id?: OptionalProperty<string>;
88
+ /**
89
+ * Renders a string of HTML as the children of this element.
90
+ * Equivalent to setting `innerHTML` on a DOM element.
91
+ *
92
+ * `NOTE` This property does no sanitization. If it's in the string, it's in the DOM. Be mindful when handling user-generated content.
93
+ */
94
+ innerHTML?: OptionalProperty<string>;
95
+ /**
96
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/popover
97
+ */
98
+ popover?: OptionalProperty<"auto" | "hint" | "manual" | true | false>;
99
+ /**
100
+ * Specifies the element's [WAI-ARIA role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles).
101
+ *
102
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/role
103
+ */
104
+ role?: OptionalProperty<string>;
76
105
  /**
77
106
  * Scroll position from the left (on the X axis), if this element is scrollable.
107
+ *
108
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
78
109
  */
79
110
  scrollLeft?: OptionalProperty<number>;
80
111
  /**
81
112
  * Scroll position from the top (on the Y axis) if this element is scrollable.
82
- */
83
- scrollTop?: OptionalProperty<number>;
84
- /**
85
- * Enables or disables checking for spelling errors in an element's content.
86
113
  *
87
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck
114
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop
88
115
  */
89
- spellcheck?: OptionalProperty<boolean>;
116
+ scrollTop?: OptionalProperty<number>;
90
117
  /**
91
118
  * Specifies whether an element's content should be translated when the page is localized.
92
119
  *
@@ -105,12 +132,18 @@ export interface ElementProps {
105
132
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot
106
133
  */
107
134
  slot?: OptionalProperty<string>;
135
+ /**
136
+ * Enables or disables checking for spelling errors in an element's content.
137
+ *
138
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck
139
+ */
140
+ spellCheck?: OptionalProperty<boolean>;
108
141
  /**
109
142
  * Inline styles applied to the element. Can be passed as a string or as an object.
110
143
  *
111
144
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
112
145
  */
113
- style?: string | CSSProperties | State<string> | State<CSSProperties> | State<string | CSSProperties> | State<string | undefined> | State<CSSProperties | undefined> | State<string | CSSProperties | undefined>;
146
+ style?: string | CSSProperties | Getter<string> | Getter<CSSProperties> | Getter<string | CSSProperties> | Getter<string | undefined> | Getter<CSSProperties | undefined> | Getter<string | CSSProperties | undefined>;
114
147
  /**
115
148
  * Fired when a CSS animation unexpectedly aborts.
116
149
  *
@@ -178,6 +211,12 @@ export interface ElementProps {
178
211
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event
179
212
  */
180
213
  onCompositionUpdate?: OptionalProperty<EventHandler<CompositionEvent>>;
214
+ /**
215
+ * Fired when the user attempts to open a context menu. Typically triggered by clicking the right mouse button.
216
+ *
217
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event
218
+ */
219
+ onContextMenu?: OptionalProperty<EventHandler<PointerEvent>>;
181
220
  /**
182
221
  * Fired when a pointing device button is rapidly clicked twice while the pointer is inside the element.
183
222
  *
@@ -452,6 +491,12 @@ export interface ElementProps {
452
491
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event
453
492
  */
454
493
  oncompositionupdate?: OptionalProperty<EventHandler<CompositionEvent>>;
494
+ /**
495
+ * Fired when the user attempts to open a context menu. Typically triggered by clicking the right mouse button.
496
+ *
497
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event
498
+ */
499
+ oncontextmenu?: OptionalProperty<EventHandler<PointerEvent>>;
455
500
  /**
456
501
  * Fired when a pointing device button is rapidly clicked twice while the pointer is inside the element.
457
502
  *
@@ -661,6 +706,10 @@ export interface ElementProps {
661
706
  onwheel?: OptionalProperty<EventHandler<WheelEvent>>;
662
707
  }
663
708
  export interface HTMLElementProps extends ElementProps {
709
+ /**
710
+ * Data attribute.
711
+ */
712
+ [key: `data-${string}`]: OptionalProperty<any>;
664
713
  /**
665
714
  * Sets the key a user can press to jump to this element.
666
715
  *
@@ -683,6 +732,12 @@ export interface HTMLElementProps extends ElementProps {
683
732
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable
684
733
  */
685
734
  contentEditable?: OptionalProperty<ContentEditableValues>;
735
+ /**
736
+ * Stores values on the element as attributes prefixed with `data-`.
737
+ *
738
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
739
+ */
740
+ dataset?: OptionalProperty<Record<string, string>>;
686
741
  /**
687
742
  * Specifies text directionality of the content of this element. Some languages, such as Arabic, are written from right to left (specified here as "rtl").
688
743
  *
@@ -729,7 +784,6 @@ export interface HTMLElementProps extends ElementProps {
729
784
  /**
730
785
  * TODO: Add support. Currently experimental.
731
786
  */
732
- role?: OptionalProperty<string>;
733
787
  /**
734
788
  * This element's position in the tab order, or the order this element will be focused as the user cycles through elements with the tab key.
735
789
  *
@@ -937,8 +991,6 @@ export interface HTMLElementProps extends ElementProps {
937
991
  */
938
992
  onpaste?: OptionalProperty<EventHandler<ClipboardEvent>>;
939
993
  }
940
- export interface SVGElementProps extends ElementProps {
941
- }
942
994
  /**
943
995
  * Mapping of event props to event names.
944
996
  */
@@ -1210,7 +1262,7 @@ export type CSSProperties = {
1210
1262
  [K in keyof Styles]: OptionalProperty<Styles[K]>;
1211
1263
  };
1212
1264
  export interface ClassMap {
1213
- [className: string]: MaybeState<any>;
1265
+ [className: string]: OptionalProperty<any>;
1214
1266
  }
1215
1267
  export type EventHandler<E> = (event: E) => void;
1216
1268
  export interface PropertiesOf<E extends HTMLElement> extends HTMLElementProps {
@@ -1220,8 +1272,9 @@ export interface PropertiesOf<E extends HTMLElement> extends HTMLElementProps {
1220
1272
  children?: any;
1221
1273
  /**
1222
1274
  * Receives a reference to the DOM node when rendered.
1275
+ * Returns a cleanup function that is called when the node is removed.
1223
1276
  */
1224
- ref?: Ref<E> | Ref<HTMLElement> | Ref<Element> | Ref<Node>;
1277
+ ref?: ((value: E) => () => void) | ((value: HTMLElement) => () => void) | ((value: Element) => () => void) | ((value: Node) => () => void);
1225
1278
  }
1226
1279
  /**
1227
1280
  * The following elements are defined based on the WHATWG HTML spec:
@@ -2098,7 +2151,7 @@ interface HTMLMediaElementProps<T extends HTMLMediaElement> extends HTMLElementP
2098
2151
  *
2099
2152
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject
2100
2153
  */
2101
- srcObject?: MediaStream | MediaSource | Blob | File | State<MediaStream> | State<MediaStream | undefined> | State<MediaSource> | State<MediaSource | undefined> | State<Blob> | State<Blob | undefined> | State<File> | State<File | undefined>;
2154
+ srcObject?: MediaStream | MediaSource | Blob | File | Getter<MediaStream> | Getter<MediaStream | undefined> | Getter<MediaSource> | Getter<MediaSource | undefined> | Getter<Blob> | Getter<Blob | undefined> | Getter<File> | Getter<File | undefined>;
2102
2155
  /**
2103
2156
  * The current audio volume of the media element. Must be a number between 0 and 1.
2104
2157
  *
@@ -2597,7 +2650,7 @@ interface HTMLImageElementProps extends PropertiesOf<HTMLImageElement> {
2597
2650
  *
2598
2651
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes
2599
2652
  */
2600
- sizes?: MaybeState<string>;
2653
+ sizes?: OptionalProperty<string>;
2601
2654
  /**
2602
2655
  * The image URL.
2603
2656
  *
@@ -3143,7 +3196,6 @@ interface HTMLInputElementProps extends PropertiesOf<HTMLInputElement> {
3143
3196
  step?: OptionalProperty<number>;
3144
3197
  type?: OptionalProperty<InputType>;
3145
3198
  value?: OptionalProperty<string>;
3146
- $$value?: SettableState<any>;
3147
3199
  width?: OptionalProperty<string | number> | OptionalProperty<string> | OptionalProperty<number>;
3148
3200
  title?: OptionalProperty<string>;
3149
3201
  /**
@@ -3353,4 +3405,6 @@ interface HTMLCanvasElementProps extends PropertiesOf<HTMLCanvasElement> {
3353
3405
  */
3354
3406
  height?: OptionalProperty<string | number> | OptionalProperty<string> | OptionalProperty<number>;
3355
3407
  }
3408
+ export interface IntrinsicElements {
3409
+ }
3356
3410
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,9 +1,4 @@
1
- export declare const noOp: () => void;
2
- export declare function deepEqual(one: any, two: any): boolean;
3
- /**
4
- * Takes an old value and a new value. Returns a merged copy if both are objects, otherwise returns the new value.
5
- */
6
- export declare function merge(one: unknown, two: unknown): any;
1
+ export declare function uniqueId(): string;
7
2
  /**
8
3
  * Returns a new object without the specified keys.
9
4
  * If called without object, returns a function that takes an object
@@ -13,12 +8,51 @@ export declare function merge(one: unknown, two: unknown): any;
13
8
  * @param object - An object to clone without the omitted keys.
14
9
  */
15
10
  export declare function omit<O extends Record<any, any>>(keys: (keyof O)[], object: O): Record<any, any>;
16
- export declare function getDefaultConsole(): any;
17
- export declare function colorFromString(value: string): string;
18
- export type MatcherFunction = (value: string) => boolean;
19
11
  /**
20
- * Parses a filter string into a matcher function.
12
+ * Throws a TypeError unless `condition` is truthy.
13
+ *
14
+ * @param value - Value whose truthiness is in question.
15
+ * @param errorMessage - Optional message for the thrown TypeError.
16
+ */
17
+ export declare function assert<T = any>(value: T, errorMessage: string): asserts value is NonNullable<T>;
18
+ /**
19
+ * Returns true if `value` is an array.
20
+ */
21
+ export declare function isArray(value: unknown): value is Array<unknown>;
22
+ /**
23
+ * Returns true when `value` is an array and `check` returns true for every item.
24
+ *
25
+ * @param check - Function to check items against.
26
+ * @param value - A possible array.
27
+ */
28
+ export declare function isArrayOf<T>(check: (item: unknown) => boolean, value: unknown): value is T[];
29
+ export declare function isArrayOf<T>(check: (item: unknown) => boolean): (value: unknown) => value is T[];
30
+ /**
31
+ * Returns true if `value` is a string.
32
+ */
33
+ export declare function isString(value: unknown): value is string;
34
+ /**
35
+ * Returns true if `value` is a function (but not a class).
36
+ */
37
+ export declare function isFunction<T = (...args: unknown[]) => unknown>(value: unknown): value is T;
38
+ export declare function isClass(value: unknown): boolean;
39
+ /**
40
+ * Returns true if `value` is a number.
41
+ */
42
+ export declare function isNumber(value: unknown): value is number;
43
+ /**
44
+ * Returns `true` if `value` is an instance of `constructor`.
21
45
  *
22
- * @param pattern - A string or regular expression that specifies a pattern for names of loggers whose messages you want to display.
46
+ * @param constructor - The constructor `value` must be an instance of.
47
+ * @param value - A value that may be an instance of `constructor`.
48
+ */
49
+ export declare function isInstanceOf<T extends Function>(constructor: T, value: unknown): value is T;
50
+ export declare function isInstanceOf<T extends Function>(constructor: T): (value: unknown) => value is T;
51
+ /**
52
+ * Returns true if `value` is a JavaScript Promise.
53
+ */
54
+ export declare function isPromise<T = unknown>(value: unknown): value is Promise<T>;
55
+ /**
56
+ * Returns true if `value` is a plain JavaScript object.
23
57
  */
24
- export declare function createMatcher(pattern: string | RegExp): MatcherFunction;
58
+ export declare function isObject<T = Record<string | number | symbol, unknown>>(value: unknown): value is T;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,360 @@
1
+ import { a as e, c as t, d as n, f as r, i, l as a, m as o, o as s, p as c, u as l } from "./signals-CMJPGr_M.js";
2
+ //#region src/core/context.ts
3
+ var u = Symbol("Context.mountListeners"), d = Symbol("Context.cleanupListeners");
4
+ function f(e) {
5
+ return Object.assign(Object.create(e ?? null), { isMounted: !1 });
6
+ }
7
+ function p(e) {
8
+ e.isMounted || (e.isMounted = !0, h(e, u));
9
+ }
10
+ function m(e) {
11
+ e.isMounted && (e.isMounted = !1, h(e, d));
12
+ }
13
+ function h(e, t) {
14
+ if (Object.hasOwn(e, t)) {
15
+ for (let n of e[t]) n();
16
+ e[t].length = 0;
17
+ }
18
+ }
19
+ function g(e, t) {
20
+ Object.hasOwn(e, u) ? e[u].push(t) : e[u] = [t];
21
+ }
22
+ function _(e, t) {
23
+ Object.hasOwn(e, d) ? e[d].push(t) : e[d] = [t];
24
+ }
25
+ function v(e, t) {
26
+ e.isMounted ? _(e, i(t)) : g(e, () => {
27
+ _(e, i(t));
28
+ });
29
+ }
30
+ var y = Symbol("Dolla.StoreId");
31
+ function b(e, n, ...r) {
32
+ n[y] ??= Symbol(n.name), t(!Object.hasOwn(e, n[y]), "Store was already provided on this context.");
33
+ let i = f(e);
34
+ return g(e, () => p(i)), _(e, () => m(i)), i.name = n.name, e[n[y]] = n.call(i, r[0], i);
35
+ }
36
+ function x(e, n) {
37
+ let r = n[y], i = r ? e[r] : void 0;
38
+ return t(i != null, `Store '${n.name}' is not provided by this context.`), i;
39
+ }
40
+ //#endregion
41
+ //#region src/core/markup/types.ts
42
+ var S = Symbol(), C = Symbol(), w = Symbol(), T = class {
43
+ static [w] = !0;
44
+ get [C]() {
45
+ return !0;
46
+ }
47
+ }, E = class extends T {
48
+ #e;
49
+ constructor(e, t) {
50
+ super(), this.#e = t;
51
+ }
52
+ getRoot() {
53
+ return this.#e;
54
+ }
55
+ isMounted() {
56
+ return this.#e.parentNode != null;
57
+ }
58
+ mount(e, t) {
59
+ G(e, this.#e, t);
60
+ }
61
+ unmount(e = !1) {
62
+ e || this.#e.parentNode?.removeChild(this.#e);
63
+ }
64
+ move(e, t) {
65
+ q(e, this.#e, t);
66
+ }
67
+ };
68
+ //#endregion
69
+ //#region src/core/markup/scheduler.ts
70
+ function D(e) {
71
+ e();
72
+ }
73
+ //#endregion
74
+ //#region src/core/markup/nodes/dynamic.ts
75
+ var O = class extends T {
76
+ #e = K("");
77
+ #t = [];
78
+ #n;
79
+ #r;
80
+ #i;
81
+ constructor(e, t) {
82
+ super(), this.#n = e, this.#r = t;
83
+ }
84
+ getRoot() {
85
+ return this.#e;
86
+ }
87
+ isMounted() {
88
+ return this.#e.parentNode != null;
89
+ }
90
+ mount(e, t) {
91
+ this.isMounted() || (G(e, this.#e, t), this.#i = s(this.#r, (e) => {
92
+ D(() => {
93
+ this.#o(e);
94
+ });
95
+ }));
96
+ }
97
+ unmount(e = !1) {
98
+ this.#i?.(), this.isMounted() && (e || this.#e.parentNode?.removeChild(this.#e), this.#a(e));
99
+ }
100
+ move(e, t) {
101
+ let n = t?.nextSibling ?? null;
102
+ if (e.moveBefore) try {
103
+ e.moveBefore(this.#e, n), n = this.#e.nextSibling;
104
+ for (let t = 0; t < this.#t.length; t++) {
105
+ let r = this.#t[t].getRoot();
106
+ r && e.moveBefore(r, n);
107
+ }
108
+ return;
109
+ } catch {}
110
+ e.insertBefore(this.#e, n), n = this.#e.nextSibling;
111
+ for (let t = 0; t < this.#t.length; t++) this.#t[t].move(e, this.#t[t - 1]?.getRoot() ?? this.#e);
112
+ }
113
+ #a(e) {
114
+ for (let t = 0; t < this.#t.length; t++) this.#t[t].unmount(e);
115
+ this.#t.length = 0;
116
+ }
117
+ #o(e) {
118
+ if (!this.isMounted()) return;
119
+ if ((typeof e == "string" || typeof e == "number") && this.#t.length === 1) {
120
+ let t = this.#t[0];
121
+ if (t instanceof E) {
122
+ let n = t.getRoot();
123
+ if (n && n.nodeType === Node.TEXT_NODE) {
124
+ n.nodeValue = String(e);
125
+ return;
126
+ }
127
+ }
128
+ }
129
+ if (this.#a(!1), e == null || e === !1) return;
130
+ let t = W(this.#n, e), n = this.#e.parentElement, r = this.#e;
131
+ for (let e = 0; e < t.length; e++) {
132
+ let i = t[e];
133
+ i.mount(n, r), this.#t.push(i);
134
+ let a = i.getRoot();
135
+ a && (r = a);
136
+ }
137
+ }
138
+ }, k = Symbol("parentElement"), A = Symbol("debug"), j = Symbol("isSVG"), M = ["ref", "children"], N = class extends T {
139
+ #e;
140
+ #t;
141
+ #n;
142
+ #r = !1;
143
+ #i = [];
144
+ #a = /* @__PURE__ */ new Set();
145
+ #o;
146
+ constructor(e, t, n) {
147
+ if (super(), this.#t = n, this.#n = e, t === "svg" ? (this.#n = f(e), this.#n[j] = !0, this.#r = !0) : this.#n[j] && t === "foreignObject" && (this.#n = f(e), this.#n[j] = !1, this.#r = !1), this.#n[j] ? this.#e = document.createElementNS("http://www.w3.org/2000/svg", t) : this.#e = document.createElement(t), this.#n[A]) {
148
+ let e = this.#n[Y];
149
+ e && (this.#e.dataset.view = e.context.name);
150
+ }
151
+ }
152
+ getRoot() {
153
+ return this.#e;
154
+ }
155
+ isMounted() {
156
+ return this.#e.parentNode != null;
157
+ }
158
+ mount(e, t) {
159
+ let n = this.isMounted();
160
+ if (!n && (this.#c(this.#e, o(M, this.#t)), this.#t.children)) {
161
+ this.#i = W(this.#n, this.#t.children);
162
+ for (let e of this.#i) e.mount(this.#e);
163
+ }
164
+ let r = t?.nextSibling ?? null;
165
+ if ((this.#e.parentNode !== e || this.#e.nextSibling !== r) && G(e, this.#e, r), !n) {
166
+ if (l(this.#t.ref)) {
167
+ let e = this.#t.ref(this.#e);
168
+ l(e) && (this.#o = e);
169
+ }
170
+ this.#r && p(this.#n);
171
+ }
172
+ }
173
+ unmount(e = !1) {
174
+ !e && this.#e.parentNode && this.#e.parentNode.removeChild(this.#e);
175
+ for (let e of this.#i) e.unmount(!0);
176
+ this.#a.forEach((e) => e()), this.#a.clear(), this.#r && m(this.#n), this.#o &&= (this.#o(), void 0), this.#i.length = 0;
177
+ }
178
+ move(e, t) {
179
+ if (e.moveBefore) try {
180
+ e.moveBefore(this.#e, t?.nextSibling ?? null);
181
+ return;
182
+ } catch {}
183
+ this.mount(e, t);
184
+ }
185
+ #s(e, t) {
186
+ l(e) ? this.#a.add(s(e, (e) => {
187
+ D(() => t(e));
188
+ })) : t(e);
189
+ }
190
+ #c(e, t) {
191
+ for (let n in t) {
192
+ let r = t[n];
193
+ if (n === "style") this.#l(e, r);
194
+ else if (n === "class" || n === "className") this.#u(e, r);
195
+ else if (n === "for") this.#s(r, (t) => {
196
+ e.htmlFor = t;
197
+ });
198
+ else if (n[0] === "." || n.startsWith("prop:")) {
199
+ let t = n.substring(5);
200
+ this.#s(r, (n) => {
201
+ e[t] = n;
202
+ });
203
+ } else if (n[0] === ":" || n.startsWith("attr:")) {
204
+ let t = n.substring(5).toLowerCase();
205
+ this.#s(r, (n) => {
206
+ R(e, t, n);
207
+ });
208
+ } else if (n[0] === "@" && l(r)) {
209
+ let t = n.substring(1);
210
+ this.#a.add(J(e, t, r));
211
+ } else if (n.startsWith("on") && l(r)) {
212
+ let t = n.toLowerCase().slice(2);
213
+ this.#a.add(J(e, t, r));
214
+ } else n in e && !this.#n[j] ? typeof e[n] == "boolean" ? this.#s(r, (t) => {
215
+ let r = !!t;
216
+ e[n] = r, R(e, n, r);
217
+ }) : this.#s(r, (t) => {
218
+ e[n] = t;
219
+ }) : this.#s(r, (t) => {
220
+ R(e, n, t);
221
+ });
222
+ }
223
+ }
224
+ #l(e, t) {
225
+ let n = /* @__PURE__ */ new Set(), r = (t) => {
226
+ n.forEach((e) => {
227
+ e(), this.#a.delete(e);
228
+ }), n.clear(), e.style.cssText = "";
229
+ let r = F(t);
230
+ for (let [t, { value: i, priority: a }] of Object.entries(r)) if (l(i)) {
231
+ let r = s(i, (n) => {
232
+ n ? e.style.setProperty(t, L(n), a) : e.style.removeProperty(t);
233
+ });
234
+ this.#a.add(r), n.add(r);
235
+ } else i != null && e.style.setProperty(t, L(i), a);
236
+ };
237
+ l(t) ? this.#a.add(s(t, r)) : r(t);
238
+ }
239
+ #u(e, t) {
240
+ let n = /* @__PURE__ */ new Set(), r = (t) => {
241
+ n.forEach((e) => {
242
+ e(), this.#a.delete(e);
243
+ }), n.clear(), R(e, "class", null);
244
+ let r = P(t);
245
+ for (let [t, i] of Object.entries(r)) if (t !== "undefined") if (l(i)) {
246
+ let r = s(i, (n) => e.classList.toggle(t, !!n));
247
+ this.#a.add(r), n.add(r);
248
+ } else i && e.classList.add(t);
249
+ };
250
+ l(t) ? this.#a.add(s(t, r)) : r(t);
251
+ }
252
+ };
253
+ function P(e) {
254
+ return c(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : a(e) ? Object.assign({}, ...e.filter(Boolean).map(P)) : r(e) ? e : {};
255
+ }
256
+ function F(e) {
257
+ return c(e) ? Object.fromEntries(e.split(";").filter((e) => e.trim()).map((e) => {
258
+ let [t, n] = e.split(":");
259
+ return [I(t.trim()), {
260
+ value: n.replace("!important", "").trim(),
261
+ priority: n.includes("!important") ? "important" : ""
262
+ }];
263
+ })) : a(e) ? Object.assign({}, ...e.filter(Boolean).map(F)) : r(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.startsWith("--") ? e : I(e), { value: t }])) : {};
264
+ }
265
+ function I(e) {
266
+ return e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e.toLowerCase());
267
+ }
268
+ function L(e) {
269
+ return n(e) ? `${e}px` : e;
270
+ }
271
+ function R(e, t, n) {
272
+ n ? e.setAttribute(t, String(n)) : e.removeAttribute(t);
273
+ }
274
+ //#endregion
275
+ //#region src/core/markup/utils.ts
276
+ function z(e, t) {
277
+ return {
278
+ [S]: !0,
279
+ type: e,
280
+ props: t
281
+ };
282
+ }
283
+ function B(e) {
284
+ return e && e[S];
285
+ }
286
+ function V(e) {
287
+ return e && e[C];
288
+ }
289
+ function H(e) {
290
+ return e && e[w];
291
+ }
292
+ function U(e, t = f()) {
293
+ let n = W(t, e);
294
+ return n.length === 1 ? n[0] : new O(t, () => n);
295
+ }
296
+ function W(e, ...t) {
297
+ let r = [];
298
+ function i(t) {
299
+ if (!(t == null || t === !1)) if (a(t)) for (let e = 0; e < t.length; e++) i(t[e]);
300
+ else if (c(t) || n(t)) r.push(new E(e, K(String(t))));
301
+ else if (B(t)) {
302
+ let { type: n, props: i } = t;
303
+ H(n) ? r.push(new n(e, ...i.args)) : l(n) ? r.push(new X(e, n, i)) : c(n) && r.push(new N(e, n, i));
304
+ } else V(t) ? r.push(t) : t instanceof Node ? r.push(new E(e, t)) : l(t) && r.push(new O(e, t));
305
+ }
306
+ for (let e = 0; e < t.length; e++) i(t[e]);
307
+ return r;
308
+ }
309
+ function G(e, t, n) {
310
+ n ? e.insertBefore(t, n?.nextSibling) : e.appendChild(t);
311
+ }
312
+ function K(e) {
313
+ return document.createTextNode(e);
314
+ }
315
+ function q(e, t, n) {
316
+ let r = n?.nextSibling ?? null;
317
+ if (e.moveBefore) try {
318
+ e.moveBefore(t, r);
319
+ return;
320
+ } catch {}
321
+ e.insertBefore(t, r);
322
+ }
323
+ function J(e, t, n) {
324
+ return e.addEventListener(t, n), () => e.removeEventListener(t, n);
325
+ }
326
+ //#endregion
327
+ //#region src/core/markup/nodes/view.ts
328
+ var Y = Symbol.for("ViewNode"), X = class extends T {
329
+ #e;
330
+ #t;
331
+ #n;
332
+ context;
333
+ constructor(e, t, n) {
334
+ super(), this.context = f(e), this.context[Y] = this, this.context.name = t.name, this.#e = n, this.#t = t;
335
+ }
336
+ getRoot() {
337
+ return this.#n?.getRoot();
338
+ }
339
+ isMounted() {
340
+ return this.context.isMounted;
341
+ }
342
+ mount(t, n) {
343
+ let r = this.isMounted();
344
+ if (!r) {
345
+ let t = e(() => this.#t.call(this.context, this.#e, this.context));
346
+ t != null && t !== !1 ? this.#n = U(t, this.context) : this.#n = new E(this.context, K(""));
347
+ }
348
+ this.#n.mount(t, n), r || p(this.context);
349
+ }
350
+ unmount(e = !1) {
351
+ this.#n?.unmount(e), m(this.context);
352
+ }
353
+ move(e, t) {
354
+ this.#n?.move(e, t);
355
+ }
356
+ };
357
+ //#endregion
358
+ export { _, K as a, m as b, A as c, D as d, T as f, p as g, x as h, z as i, k as l, f as m, G as n, q as o, b as p, J as r, U as s, X as t, O as u, v, g as y };
359
+
360
+ //# sourceMappingURL=view-cBN-hn_T.js.map