@manyducks.co/dolla 2.0.0 → 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 (112) hide show
  1. package/README.md +133 -284
  2. package/dist/core/context.d.ts +22 -146
  3. package/dist/core/debug.d.ts +19 -0
  4. package/dist/core/index.d.ts +15 -16
  5. package/dist/core/markup/helpers.d.ts +34 -0
  6. package/dist/core/markup/html.d.ts +3 -0
  7. package/dist/core/{nodes → markup/nodes}/dom.d.ts +5 -4
  8. package/dist/core/markup/nodes/dynamic.d.ts +16 -0
  9. package/dist/core/markup/nodes/element.d.ts +14 -0
  10. package/dist/core/markup/nodes/portal.d.ts +15 -0
  11. package/dist/core/markup/nodes/repeat.d.ts +21 -0
  12. package/dist/core/markup/nodes/view.d.ts +17 -0
  13. package/dist/core/markup/scheduler.d.ts +1 -0
  14. package/dist/core/markup/types.d.ts +62 -0
  15. package/dist/core/markup/utils.d.ts +22 -0
  16. package/dist/core/ref.d.ts +6 -12
  17. package/dist/core/root.d.ts +36 -0
  18. package/dist/core/signals.d.ts +46 -76
  19. package/dist/core/symbols.d.ts +2 -0
  20. package/dist/core-BLkJ-xuh.js +242 -0
  21. package/dist/core-BLkJ-xuh.js.map +1 -0
  22. package/dist/http/index.d.ts +21 -33
  23. package/dist/http.js +89 -149
  24. package/dist/http.js.map +1 -1
  25. package/dist/index.js +4 -174
  26. package/dist/jsx-dev-runtime.d.ts +4 -3
  27. package/dist/jsx-dev-runtime.js +12 -9
  28. package/dist/jsx-dev-runtime.js.map +1 -1
  29. package/dist/jsx-runtime.d.ts +5 -4
  30. package/dist/jsx-runtime.js +17 -12
  31. package/dist/jsx-runtime.js.map +1 -1
  32. package/dist/router/index.d.ts +4 -3
  33. package/dist/router/router.d.ts +19 -162
  34. package/dist/router/store.d.ts +12 -0
  35. package/dist/router/types.d.ts +152 -0
  36. package/dist/router/utils.d.ts +99 -0
  37. package/dist/router/utils.test.d.ts +1 -0
  38. package/dist/router.js +428 -5
  39. package/dist/router.js.map +1 -1
  40. package/dist/signals-CMJPGr_M.js +354 -0
  41. package/dist/signals-CMJPGr_M.js.map +1 -0
  42. package/dist/translate/index.d.ts +82 -0
  43. package/dist/translate.js +125 -0
  44. package/dist/translate.js.map +1 -0
  45. package/dist/types.d.ts +21 -39
  46. package/dist/utils.d.ts +41 -29
  47. package/dist/utils.test.d.ts +1 -0
  48. package/dist/view-cBN-hn_T.js +360 -0
  49. package/dist/view-cBN-hn_T.js.map +1 -0
  50. package/dist/virtual/index.d.ts +1 -0
  51. package/dist/virtual/list.d.ts +53 -0
  52. package/package.json +19 -16
  53. package/dist/core/app.d.ts +0 -24
  54. package/dist/core/env.d.ts +0 -3
  55. package/dist/core/hooks.d.ts +0 -70
  56. package/dist/core/logger.d.ts +0 -42
  57. package/dist/core/logger.test.d.ts +0 -0
  58. package/dist/core/markup.d.ts +0 -82
  59. package/dist/core/markup.test.d.ts +0 -0
  60. package/dist/core/nodes/_markup.d.ts +0 -36
  61. package/dist/core/nodes/dynamic.d.ts +0 -22
  62. package/dist/core/nodes/element.d.ts +0 -27
  63. package/dist/core/nodes/portal.d.ts +0 -18
  64. package/dist/core/nodes/repeat.d.ts +0 -27
  65. package/dist/core/nodes/view.d.ts +0 -25
  66. package/dist/core/views/default-crash-view.d.ts +0 -25
  67. package/dist/core/views/for.d.ts +0 -21
  68. package/dist/core/views/fragment.d.ts +0 -7
  69. package/dist/core/views/portal.d.ts +0 -16
  70. package/dist/core/views/show.d.ts +0 -25
  71. package/dist/fragment-BahD_BJA.js +0 -7
  72. package/dist/fragment-BahD_BJA.js.map +0 -1
  73. package/dist/i18n/index.d.ts +0 -134
  74. package/dist/i18n.js +0 -309
  75. package/dist/i18n.js.map +0 -1
  76. package/dist/index-DRJlxs-Q.js +0 -535
  77. package/dist/index-DRJlxs-Q.js.map +0 -1
  78. package/dist/index.js.map +0 -1
  79. package/dist/logger-Aqi9m1CF.js +0 -565
  80. package/dist/logger-Aqi9m1CF.js.map +0 -1
  81. package/dist/markup-8jNhoqDe.js +0 -1089
  82. package/dist/markup-8jNhoqDe.js.map +0 -1
  83. package/dist/router/hooks.d.ts +0 -2
  84. package/dist/router/router.utils.d.ts +0 -93
  85. package/dist/typeChecking-5kmX0ulW.js +0 -65
  86. package/dist/typeChecking-5kmX0ulW.js.map +0 -1
  87. package/dist/typeChecking.d.ts +0 -95
  88. package/docs/buildless.md +0 -132
  89. package/docs/components.md +0 -238
  90. package/docs/hooks.md +0 -356
  91. package/docs/http.md +0 -178
  92. package/docs/i18n.md +0 -220
  93. package/docs/index.md +0 -10
  94. package/docs/markup.md +0 -136
  95. package/docs/mixins.md +0 -176
  96. package/docs/ref.md +0 -77
  97. package/docs/router.md +0 -281
  98. package/docs/setup.md +0 -137
  99. package/docs/signals.md +0 -262
  100. package/docs/stores.md +0 -113
  101. package/docs/views.md +0 -356
  102. package/notes/atomic.md +0 -452
  103. package/notes/elimination.md +0 -33
  104. package/notes/observable.md +0 -180
  105. package/notes/scratch.md +0 -565
  106. package/notes/splitting.md +0 -5
  107. package/notes/views.md +0 -195
  108. package/vite.config.js +0 -22
  109. /package/dist/core/{hooks.test.d.ts → markup/html.test.d.ts} +0 -0
  110. /package/dist/core/{ref.test.d.ts → markup/utils.test.d.ts} +0 -0
  111. /package/dist/router/{router.utils.test.d.ts → matcher.test.d.ts} +0 -0
  112. /package/dist/{typeChecking.test.d.ts → router/router.test.d.ts} +0 -0
package/dist/types.d.ts CHANGED
@@ -1,30 +1,21 @@
1
1
  import type * as CSS from "csstype";
2
- import type { Markup, MarkupNode } from "./core/markup.js";
3
- import type { Signal } from "./core/signals.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";
4
5
  export type Env = "production" | "development";
5
6
  /**
6
7
  * Represents everything that can be handled as a DOM node.
7
8
  * These are all the items considered valid to pass as children to any element.
8
9
  */
9
- export type Renderable = string | number | Node | Markup | MarkupNode | false | null | undefined | Signal<any> | (string | number | Node | Markup | MarkupNode | false | null | undefined | Signal<any>)[];
10
+ export type Renderable = string | number | Node | Markup | MarkupNode | false | null | undefined | void | Getter<any> | Renderable[];
10
11
  export interface BaseProps {
11
12
  children?: Renderable;
12
13
  }
13
- /**
14
- *
15
- */
16
- export type View<Props> = (props: Props) => Renderable;
17
- /**
18
- *
19
- */
20
- export type Store<Options, Value> = (options: Options) => Value;
21
- /**
22
- *
23
- */
24
- export type Mixin<E extends Element = Element> = (element: E) => void;
25
- type MaybeSignal<T> = T | Signal<T> | Signal<T | undefined>;
26
- type OptionalProperty<T> = MaybeSignal<T>;
27
- type RequiredProperty<T> = T | Signal<T>;
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;
28
19
  type AutocapitalizeValues = "off" | "on" | "none" | "sentences" | "words" | "characters";
29
20
  type ContentEditableValues = true | false | "true" | "false" | "plaintext-only" | "inherit";
30
21
  type ClassListValues = string | ClassMap | Array<string | ClassMap | (string | ClassMap)[]>;
@@ -48,12 +39,6 @@ export interface ElementProps {
48
39
  * Attaches an event listener to the element (with `addEventListener`).
49
40
  */
50
41
  [key: `on:${string}`]: OptionalProperty<EventHandler<Event>>;
51
- /**
52
- * HTML attributes to assign to the element.
53
- */
54
- /**
55
- * Object of event listeners.
56
- */
57
42
  /**
58
43
  * CSS classes to be applied to this element. In addition to the standard space-separated list of class names,
59
44
  * this property also supports a class map object with class names as keys and booleans as values.
@@ -158,7 +143,7 @@ export interface ElementProps {
158
143
  *
159
144
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
160
145
  */
161
- style?: string | CSSProperties | Signal<string> | Signal<CSSProperties> | Signal<string | CSSProperties> | Signal<string | undefined> | Signal<CSSProperties | undefined> | Signal<string | CSSProperties | undefined>;
146
+ style?: string | CSSProperties | Getter<string> | Getter<CSSProperties> | Getter<string | CSSProperties> | Getter<string | undefined> | Getter<CSSProperties | undefined> | Getter<string | CSSProperties | undefined>;
162
147
  /**
163
148
  * Fired when a CSS animation unexpectedly aborts.
164
149
  *
@@ -721,6 +706,10 @@ export interface ElementProps {
721
706
  onwheel?: OptionalProperty<EventHandler<WheelEvent>>;
722
707
  }
723
708
  export interface HTMLElementProps extends ElementProps {
709
+ /**
710
+ * Data attribute.
711
+ */
712
+ [key: `data-${string}`]: OptionalProperty<any>;
724
713
  /**
725
714
  * Sets the key a user can press to jump to this element.
726
715
  *
@@ -1002,12 +991,6 @@ export interface HTMLElementProps extends ElementProps {
1002
991
  */
1003
992
  onpaste?: OptionalProperty<EventHandler<ClipboardEvent>>;
1004
993
  }
1005
- export interface SVGElementProps extends ElementProps {
1006
- /**
1007
- * A mixin function or an array of mixin functions to be applied to this element.
1008
- */
1009
- mixin?: Mixin<SVGElement> | Mixin<SVGElement>[];
1010
- }
1011
994
  /**
1012
995
  * Mapping of event props to event names.
1013
996
  */
@@ -1279,7 +1262,7 @@ export type CSSProperties = {
1279
1262
  [K in keyof Styles]: OptionalProperty<Styles[K]>;
1280
1263
  };
1281
1264
  export interface ClassMap {
1282
- [className: string]: MaybeSignal<any>;
1265
+ [className: string]: OptionalProperty<any>;
1283
1266
  }
1284
1267
  export type EventHandler<E> = (event: E) => void;
1285
1268
  export interface PropertiesOf<E extends HTMLElement> extends HTMLElementProps {
@@ -1289,12 +1272,9 @@ export interface PropertiesOf<E extends HTMLElement> extends HTMLElementProps {
1289
1272
  children?: any;
1290
1273
  /**
1291
1274
  * Receives a reference to the DOM node when rendered.
1275
+ * Returns a cleanup function that is called when the node is removed.
1292
1276
  */
1293
- ref?: ((value: E | undefined) => void) | ((value: HTMLElement | undefined) => void) | ((value: Element | undefined) => void) | ((value: Node | undefined) => void);
1294
- /**
1295
- * A mixin function or an array of mixin functions to be applied to this element.
1296
- */
1297
- mixin?: Mixin<E> | Mixin<E>[];
1277
+ ref?: ((value: E) => () => void) | ((value: HTMLElement) => () => void) | ((value: Element) => () => void) | ((value: Node) => () => void);
1298
1278
  }
1299
1279
  /**
1300
1280
  * The following elements are defined based on the WHATWG HTML spec:
@@ -2171,7 +2151,7 @@ interface HTMLMediaElementProps<T extends HTMLMediaElement> extends HTMLElementP
2171
2151
  *
2172
2152
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject
2173
2153
  */
2174
- srcObject?: MediaStream | MediaSource | Blob | File | Signal<MediaStream> | Signal<MediaStream | undefined> | Signal<MediaSource> | Signal<MediaSource | undefined> | Signal<Blob> | Signal<Blob | undefined> | Signal<File> | Signal<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>;
2175
2155
  /**
2176
2156
  * The current audio volume of the media element. Must be a number between 0 and 1.
2177
2157
  *
@@ -2670,7 +2650,7 @@ interface HTMLImageElementProps extends PropertiesOf<HTMLImageElement> {
2670
2650
  *
2671
2651
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes
2672
2652
  */
2673
- sizes?: MaybeSignal<string>;
2653
+ sizes?: OptionalProperty<string>;
2674
2654
  /**
2675
2655
  * The image URL.
2676
2656
  *
@@ -3425,4 +3405,6 @@ interface HTMLCanvasElementProps extends PropertiesOf<HTMLCanvasElement> {
3425
3405
  */
3426
3406
  height?: OptionalProperty<string | number> | OptionalProperty<string> | OptionalProperty<number>;
3427
3407
  }
3408
+ export interface IntrinsicElements {
3409
+ }
3428
3410
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,46 +1,58 @@
1
- export declare const noOp: () => void;
2
- export declare function getUniqueId(): string;
3
- export declare function getIntegerId(): number;
1
+ export declare function uniqueId(): string;
4
2
  /**
5
- * Equality check that passes if both values are the same object.
6
- * This is the default equality check for states.
3
+ * Returns a new object without the specified keys.
4
+ * If called without object, returns a function that takes an object
5
+ * and returns a version with the original keys omitted.
6
+ *
7
+ * @param keys - An array of keys to omit.
8
+ * @param object - An object to clone without the omitted keys.
7
9
  */
8
- export declare function strictEqual(a: any, b: any): boolean;
10
+ export declare function omit<O extends Record<any, any>>(keys: (keyof O)[], object: O): Record<any, any>;
9
11
  /**
10
- * Equality check that passes if both values are the same object, or if both are objects or arrays with equal keys and values.
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.
11
16
  */
12
- export declare function shallowEqual(a: any, b: any): boolean;
17
+ export declare function assert<T = any>(value: T, errorMessage: string): asserts value is NonNullable<T>;
13
18
  /**
14
- * Equality check that passes if two objects have equal values, even if they are not the same object.
19
+ * Returns true if `value` is an array.
15
20
  */
16
- export declare function deepEqual(a: any, b: any): boolean;
21
+ export declare function isArray(value: unknown): value is Array<unknown>;
17
22
  /**
18
- * Takes an old value and a new value. Returns a merged copy if both are objects, otherwise returns the new value.
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.
19
27
  */
20
- export declare function merge(one: unknown, two: unknown): any;
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[];
21
30
  /**
22
- * Returns a new object without the specified keys.
23
- * If called without object, returns a function that takes an object
24
- * and returns a version with the original keys omitted.
25
- *
26
- * @param keys - An array of keys to omit.
27
- * @param object - An object to clone without the omitted keys.
31
+ * Returns true if `value` is a string.
28
32
  */
29
- export declare function omit<O extends Record<any, any>>(keys: (keyof O)[], object: O): Record<any, any>;
30
- export declare function toArray<T>(value: T | T[]): T[];
31
- export declare function toCamelCase(s: string): string;
33
+ export declare function isString(value: unknown): value is string;
32
34
  /**
33
- * Moves an element using `moveBefore` if the browser supports it, otherwise falls back to `insertBefore`.
35
+ * Returns true if `value` is a function (but not a class).
34
36
  */
35
- export declare function moveBefore(parent: Node, node: Node, child: Node | null): void;
37
+ export declare function isFunction<T = (...args: unknown[]) => unknown>(value: unknown): value is T;
38
+ export declare function isClass(value: unknown): boolean;
36
39
  /**
37
- * Takes any string and returns an OKLCH color.
40
+ * Returns true if `value` is a number.
38
41
  */
39
- export declare function okhash(value: string): string;
40
- export type MatcherFunction = (value: string) => boolean;
42
+ export declare function isNumber(value: unknown): value is number;
41
43
  /**
42
- * Parses a filter string into a matcher function.
44
+ * Returns `true` if `value` is an instance of `constructor`.
43
45
  *
44
- * @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.
45
57
  */
46
- 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