@manyducks.co/dolla 2.0.0-alpha.9 → 2.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 (108) hide show
  1. package/README.md +222 -512
  2. package/dist/core/app.d.ts +24 -0
  3. package/dist/core/context.d.ts +147 -0
  4. package/dist/core/env.d.ts +3 -0
  5. package/dist/core/hooks.d.ts +70 -0
  6. package/dist/core/hooks.test.d.ts +1 -0
  7. package/dist/core/index.d.ts +25 -0
  8. package/dist/core/logger.d.ts +42 -0
  9. package/dist/core/logger.test.d.ts +0 -0
  10. package/dist/core/markup.d.ts +82 -0
  11. package/dist/core/markup.test.d.ts +0 -0
  12. package/dist/core/nodes/_markup.d.ts +36 -0
  13. package/dist/core/nodes/dom.d.ts +13 -0
  14. package/dist/core/nodes/dynamic.d.ts +22 -0
  15. package/dist/core/nodes/element.d.ts +27 -0
  16. package/dist/core/nodes/portal.d.ts +18 -0
  17. package/dist/core/nodes/repeat.d.ts +27 -0
  18. package/dist/core/nodes/view.d.ts +25 -0
  19. package/dist/core/ref.d.ts +19 -0
  20. package/dist/core/ref.test.d.ts +1 -0
  21. package/dist/core/signals.d.ts +100 -0
  22. package/dist/core/signals.test.d.ts +1 -0
  23. package/dist/{views → core/views}/default-crash-view.d.ts +11 -4
  24. package/dist/core/views/for.d.ts +21 -0
  25. package/dist/core/views/fragment.d.ts +7 -0
  26. package/dist/core/views/portal.d.ts +16 -0
  27. package/dist/core/views/show.d.ts +25 -0
  28. package/dist/fragment-BahD_BJA.js +7 -0
  29. package/dist/fragment-BahD_BJA.js.map +1 -0
  30. package/dist/{modules/http.d.ts → http/index.d.ts} +3 -5
  31. package/dist/http.js +150 -0
  32. package/dist/http.js.map +1 -0
  33. package/dist/i18n/index.d.ts +134 -0
  34. package/dist/i18n.js +309 -0
  35. package/dist/i18n.js.map +1 -0
  36. package/dist/index-DRJlxs-Q.js +535 -0
  37. package/dist/index-DRJlxs-Q.js.map +1 -0
  38. package/dist/index.js +160 -1414
  39. package/dist/index.js.map +1 -1
  40. package/dist/jsx-dev-runtime.d.ts +3 -2
  41. package/dist/jsx-dev-runtime.js +5 -12
  42. package/dist/jsx-dev-runtime.js.map +1 -1
  43. package/dist/jsx-runtime.d.ts +4 -3
  44. package/dist/jsx-runtime.js +9 -15
  45. package/dist/jsx-runtime.js.map +1 -1
  46. package/dist/logger-Aqi9m1CF.js +565 -0
  47. package/dist/logger-Aqi9m1CF.js.map +1 -0
  48. package/dist/markup-8jNhoqDe.js +1089 -0
  49. package/dist/markup-8jNhoqDe.js.map +1 -0
  50. package/dist/router/hooks.d.ts +2 -0
  51. package/dist/router/index.d.ts +3 -0
  52. package/dist/router/router.d.ts +166 -0
  53. package/dist/{routing.d.ts → router/router.utils.d.ts} +17 -3
  54. package/dist/router/router.utils.test.d.ts +1 -0
  55. package/dist/router.js +6 -0
  56. package/dist/router.js.map +1 -0
  57. package/dist/typeChecking-5kmX0ulW.js +65 -0
  58. package/dist/typeChecking-5kmX0ulW.js.map +1 -0
  59. package/dist/typeChecking.d.ts +2 -98
  60. package/dist/typeChecking.test.d.ts +1 -0
  61. package/dist/types.d.ts +97 -25
  62. package/dist/utils.d.ts +25 -3
  63. package/docs/buildless.md +132 -0
  64. package/docs/components.md +238 -0
  65. package/docs/hooks.md +356 -0
  66. package/docs/http.md +178 -0
  67. package/docs/i18n.md +220 -0
  68. package/docs/index.md +10 -0
  69. package/docs/markup.md +136 -0
  70. package/docs/mixins.md +176 -0
  71. package/docs/ref.md +77 -0
  72. package/docs/router.md +281 -0
  73. package/docs/setup.md +137 -0
  74. package/docs/signals.md +262 -0
  75. package/docs/stores.md +113 -0
  76. package/docs/views.md +356 -0
  77. package/index.d.ts +2 -2
  78. package/notes/atomic.md +452 -0
  79. package/notes/elimination.md +33 -0
  80. package/notes/observable.md +180 -0
  81. package/notes/scratch.md +346 -14
  82. package/notes/splitting.md +5 -0
  83. package/package.json +29 -15
  84. package/vite.config.js +5 -11
  85. package/build.js +0 -34
  86. package/dist/index.d.ts +0 -21
  87. package/dist/markup.d.ts +0 -108
  88. package/dist/modules/dolla.d.ts +0 -111
  89. package/dist/modules/i18n.d.ts +0 -59
  90. package/dist/modules/render.d.ts +0 -17
  91. package/dist/modules/router.d.ts +0 -152
  92. package/dist/nodes/cond.d.ts +0 -26
  93. package/dist/nodes/html.d.ts +0 -31
  94. package/dist/nodes/observer.d.ts +0 -29
  95. package/dist/nodes/outlet.d.ts +0 -22
  96. package/dist/nodes/portal.d.ts +0 -19
  97. package/dist/nodes/repeat.d.ts +0 -34
  98. package/dist/nodes/text.d.ts +0 -19
  99. package/dist/passthrough-9kwwjgWk.js +0 -1279
  100. package/dist/passthrough-9kwwjgWk.js.map +0 -1
  101. package/dist/state.d.ts +0 -101
  102. package/dist/view.d.ts +0 -65
  103. package/dist/views/passthrough.d.ts +0 -5
  104. package/notes/context-vars.md +0 -21
  105. package/notes/readme-scratch.md +0 -222
  106. package/notes/route-middleware.md +0 -42
  107. package/tests/state.test.js +0 -135
  108. /package/dist/{routing.test.d.ts → core/context.test.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
- type TypeNames = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null" | "array" | "class" | "promise" | "NaN";
1
+ type TypeNames = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null" | "array" | "class" | "promise" | "map" | "set" | "NaN";
2
2
  /**
3
3
  * Extends `typeof` operator with more specific and useful type distinctions.
4
4
  */
5
- export declare function typeOf(value: unknown): TypeNames;
5
+ export declare function typeOf(value: any): TypeNames;
6
6
  /**
7
7
  * Throws a TypeError unless `condition` is truthy.
8
8
  *
@@ -18,12 +18,6 @@ export declare function isArray(value: unknown): value is Array<unknown>;
18
18
  * Throws an error if `value` is not an array.
19
19
  */
20
20
  export declare function assertArray(value: unknown, errorMessage?: string): value is Array<unknown>;
21
- /**
22
- * Returns a function that takes a `value` and ensures that it is an array for which `check` returns true for every item.
23
- *
24
- * @param check - Function to check items against.
25
- */
26
- export declare function isArrayOf<T>(check: (item: unknown) => boolean): (value: unknown) => value is T[];
27
21
  /**
28
22
  * Returns true when `value` is an array and `check` returns true for every item.
29
23
  *
@@ -31,12 +25,6 @@ export declare function isArrayOf<T>(check: (item: unknown) => boolean): (value:
31
25
  * @param value - A possible array.
32
26
  */
33
27
  export declare function isArrayOf<T>(check: (item: unknown) => boolean, value: unknown): value is T[];
34
- /**
35
- * Returns a function that takes a `value` and throws a TypeError unless it is an array for which `check` returns true for every item.
36
- *
37
- * @param check - Function to check items against.
38
- */
39
- export declare function assertArrayOf<T>(check: (item: unknown) => boolean): (value: unknown) => value is T[];
40
28
  /**
41
29
  * Throws a TypeError unless `value` is an array and `check` returns true for every item.
42
30
  *
@@ -45,14 +33,6 @@ export declare function assertArrayOf<T>(check: (item: unknown) => boolean): (va
45
33
  * @param errorMessage - A custom error message.
46
34
  */
47
35
  export declare function assertArrayOf<T>(check: (item: unknown) => boolean, value: unknown, errorMessage?: string): value is T[];
48
- /**
49
- * Returns true if `value` is equal to `true` or `false`.
50
- */
51
- export declare function isBoolean(value: unknown): value is boolean;
52
- /**
53
- * Throws a TypeError unless `value` is equal to `true` or `false`.
54
- */
55
- export declare function assertBoolean(value: unknown, errorMessage?: string): value is boolean;
56
36
  /**
57
37
  * Returns true if `value` is a string.
58
38
  */
@@ -77,34 +57,6 @@ export declare function isNumber(value: unknown): value is number;
77
57
  * Throws a TypeError unless `value` is a number.
78
58
  */
79
59
  export declare function assertNumber(value: unknown, errorMessage?: string): value is number;
80
- /**
81
- * Returns true if `value` implements the Promise protocol.
82
- * This matches true instances of Promise as well as any object that
83
- * implements `next`, `catch` and `finally` methods.
84
- *
85
- * To strictly match instances of Promise, use `isInstanceOf(Promise)`.
86
- */
87
- export declare function isPromise<T = unknown>(value: unknown): value is Promise<T>;
88
- /**
89
- * Throws a TypeError unless `value` implements the Promise protocol.
90
- * This matches true instances of Promise as well as any object that
91
- * implements `next`, `catch` and `finally` methods.
92
- *
93
- * To strictly allow only instances of Promise, use `Type.assertInstanceOf(Promise)`.
94
- */
95
- export declare function assertPromise<T = unknown>(value: unknown, errorMessage?: string): value is Promise<T>;
96
- /**
97
- * Returns true if `value` is a class.
98
- */
99
- export declare function isClass(value: unknown): value is {
100
- new (): unknown;
101
- };
102
- /**
103
- * Throws a TypeError unless `value` is a class.
104
- */
105
- export declare function assertClass(value: unknown, errorMessage?: string): value is {
106
- new (): unknown;
107
- };
108
60
  /**
109
61
  * Returns a function that takes a `value` and returns true if `value` is an instance of `constructor`.
110
62
  *
@@ -132,30 +84,6 @@ export declare function assertInstanceOf<T extends Function>(constructor: T): (v
132
84
  * @param errorMessage - A custom error message for when the assertion fails.
133
85
  */
134
86
  export declare function assertInstanceOf<T extends Function>(constructor: T, value: unknown, errorMessage?: string): value is T;
135
- /**
136
- * Returns true if `value` is a Map.
137
- */
138
- export declare function isMap<K = unknown, V = unknown>(value: any): value is Map<K, V>;
139
- /**
140
- * Throws a TypeError unless `value` is a Map.
141
- */
142
- export declare function assertMap<K = unknown, V = unknown>(value: any, errorMessage?: string): value is Map<K, V>;
143
- /**
144
- * Returns true if `value` is a Set.
145
- */
146
- export declare function isSet<T = unknown>(value: any): value is Set<T>;
147
- /**
148
- * Throws a TypeError if `value` is not a Set.
149
- */
150
- export declare function assertSet<T = unknown>(value: any, errorMessage?: string): value is Set<T>;
151
- /**
152
- * Returns true if `value` implements the Iterable protocol.
153
- */
154
- export declare function isIterable<T>(value: any): value is Iterable<T>;
155
- /**
156
- * Throws a TypeError unless `value` implements the Iterable protocol.
157
- */
158
- export declare function assertIterable<T>(value: any, errorMessage?: string): value is Iterable<T>;
159
87
  /**
160
88
  * Returns true if `value` is a plain JavaScript object.
161
89
  */
@@ -164,28 +92,4 @@ export declare function isObject(value: unknown): value is Record<string | numbe
164
92
  * Throws a TypeError unless `value` is a plain JavaScript object.
165
93
  */
166
94
  export declare function assertObject(value: unknown, errorMessage?: string): value is object;
167
- /**
168
- * Returns true if `value` is equal to `null`.
169
- */
170
- export declare function isNull(value: unknown): value is null;
171
- /**
172
- * Throws a TypeError unless `value` is equal to `null`.
173
- */
174
- export declare function assertNull(value: unknown, errorMessage?: string): value is null;
175
- /**
176
- * Returns true if `value` is equal to `undefined`.
177
- */
178
- export declare function isUndefined(value: unknown): value is undefined;
179
- /**
180
- * Throws a TypeError unless `value` is equal to `undefined`.
181
- */
182
- export declare function assertUndefined(value: unknown, errorMessage?: string): value is undefined;
183
- /**
184
- * Returns true if `value` is equal to `null` or `undefined`.
185
- */
186
- export declare function isEmpty(value: unknown): value is void;
187
- /**
188
- * Throws a TypeError unless `value` is equal to `null` or `undefined`.
189
- */
190
- export declare function assertEmpty(value: unknown, errorMessage?: string): value is void;
191
95
  export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/types.d.ts CHANGED
@@ -1,17 +1,30 @@
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 { Markup, MarkupNode } from "./core/markup.js";
3
+ import type { Signal } from "./core/signals.js";
4
+ export type Env = "production" | "development";
4
5
  /**
5
6
  * Represents everything that can be handled as a DOM node.
6
7
  * These are all the items considered valid to pass as children to any element.
7
8
  */
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>;
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 interface BaseProps {
11
+ children?: Renderable;
12
+ }
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>;
15
28
  type AutocapitalizeValues = "off" | "on" | "none" | "sentences" | "words" | "characters";
16
29
  type ContentEditableValues = true | false | "true" | "false" | "plaintext-only" | "inherit";
17
30
  type ClassListValues = string | ClassMap | Array<string | ClassMap | (string | ClassMap)[]>;
@@ -23,21 +36,31 @@ type InputModeValues = "decimal" | "email" | "none" | "numeric" | "search" | "te
23
36
  * Properties common to all Elements.
24
37
  */
25
38
  export interface ElementProps {
39
+ /**
40
+ * Sets the value as an HTML attribute.
41
+ */
42
+ [key: `attr:${string}`]: OptionalProperty<any>;
43
+ /**
44
+ * Sets the value directly on the HTMLElement as a property.
45
+ */
46
+ [key: `prop:${string}`]: OptionalProperty<any>;
47
+ /**
48
+ * Attaches an event listener to the element (with `addEventListener`).
49
+ */
50
+ [key: `on:${string}`]: OptionalProperty<EventHandler<Event>>;
26
51
  /**
27
52
  * HTML attributes to assign to the element.
28
53
  */
29
- attributes?: OptionalProperty<Record<string, any>>;
30
54
  /**
31
55
  * Object of event listeners.
32
56
  */
33
- eventListeners?: OptionalProperty<Record<string, EventHandler<Event>>>;
34
57
  /**
35
58
  * CSS classes to be applied to this element. In addition to the standard space-separated list of class names,
36
59
  * this property also supports a class map object with class names as keys and booleans as values.
37
60
  * Class names in a class map will be applied to the element while their values are true. Also supports an
38
61
  * array of strings and class maps.
39
62
  *
40
- * Alias of `className`.
63
+ * @alias className
41
64
  *
42
65
  * @example
43
66
  * <div class="one-class" />
@@ -57,6 +80,8 @@ export interface ElementProps {
57
80
  * Class names in a class map will be applied to the element while their values are true. Also supports an
58
81
  * array of strings and class maps.
59
82
  *
83
+ * @alias class
84
+ *
60
85
  * @example
61
86
  * <div className="one-class" />
62
87
  *
@@ -71,22 +96,39 @@ export interface ElementProps {
71
96
  className?: OptionalProperty<ClassListValues>;
72
97
  /**
73
98
  * A unique string to identify this element.
99
+ *
100
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
74
101
  */
75
102
  id?: OptionalProperty<string>;
103
+ /**
104
+ * Renders a string of HTML as the children of this element.
105
+ * Equivalent to setting `innerHTML` on a DOM element.
106
+ *
107
+ * `NOTE` This property does no sanitization. If it's in the string, it's in the DOM. Be mindful when handling user-generated content.
108
+ */
109
+ innerHTML?: OptionalProperty<string>;
110
+ /**
111
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/popover
112
+ */
113
+ popover?: OptionalProperty<"auto" | "hint" | "manual" | true | false>;
114
+ /**
115
+ * Specifies the element's [WAI-ARIA role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles).
116
+ *
117
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/role
118
+ */
119
+ role?: OptionalProperty<string>;
76
120
  /**
77
121
  * Scroll position from the left (on the X axis), if this element is scrollable.
122
+ *
123
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
78
124
  */
79
125
  scrollLeft?: OptionalProperty<number>;
80
126
  /**
81
127
  * 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
128
  *
87
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck
129
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop
88
130
  */
89
- spellcheck?: OptionalProperty<boolean>;
131
+ scrollTop?: OptionalProperty<number>;
90
132
  /**
91
133
  * Specifies whether an element's content should be translated when the page is localized.
92
134
  *
@@ -105,12 +147,18 @@ export interface ElementProps {
105
147
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot
106
148
  */
107
149
  slot?: OptionalProperty<string>;
150
+ /**
151
+ * Enables or disables checking for spelling errors in an element's content.
152
+ *
153
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck
154
+ */
155
+ spellCheck?: OptionalProperty<boolean>;
108
156
  /**
109
157
  * Inline styles applied to the element. Can be passed as a string or as an object.
110
158
  *
111
159
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
112
160
  */
113
- style?: string | CSSProperties | State<string> | State<CSSProperties> | State<string | CSSProperties> | State<string | undefined> | State<CSSProperties | undefined> | State<string | CSSProperties | undefined>;
161
+ style?: string | CSSProperties | Signal<string> | Signal<CSSProperties> | Signal<string | CSSProperties> | Signal<string | undefined> | Signal<CSSProperties | undefined> | Signal<string | CSSProperties | undefined>;
114
162
  /**
115
163
  * Fired when a CSS animation unexpectedly aborts.
116
164
  *
@@ -178,6 +226,12 @@ export interface ElementProps {
178
226
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event
179
227
  */
180
228
  onCompositionUpdate?: OptionalProperty<EventHandler<CompositionEvent>>;
229
+ /**
230
+ * Fired when the user attempts to open a context menu. Typically triggered by clicking the right mouse button.
231
+ *
232
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event
233
+ */
234
+ onContextMenu?: OptionalProperty<EventHandler<PointerEvent>>;
181
235
  /**
182
236
  * Fired when a pointing device button is rapidly clicked twice while the pointer is inside the element.
183
237
  *
@@ -452,6 +506,12 @@ export interface ElementProps {
452
506
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event
453
507
  */
454
508
  oncompositionupdate?: OptionalProperty<EventHandler<CompositionEvent>>;
509
+ /**
510
+ * Fired when the user attempts to open a context menu. Typically triggered by clicking the right mouse button.
511
+ *
512
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event
513
+ */
514
+ oncontextmenu?: OptionalProperty<EventHandler<PointerEvent>>;
455
515
  /**
456
516
  * Fired when a pointing device button is rapidly clicked twice while the pointer is inside the element.
457
517
  *
@@ -683,6 +743,12 @@ export interface HTMLElementProps extends ElementProps {
683
743
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable
684
744
  */
685
745
  contentEditable?: OptionalProperty<ContentEditableValues>;
746
+ /**
747
+ * Stores values on the element as attributes prefixed with `data-`.
748
+ *
749
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
750
+ */
751
+ dataset?: OptionalProperty<Record<string, string>>;
686
752
  /**
687
753
  * 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
754
  *
@@ -729,7 +795,6 @@ export interface HTMLElementProps extends ElementProps {
729
795
  /**
730
796
  * TODO: Add support. Currently experimental.
731
797
  */
732
- role?: OptionalProperty<string>;
733
798
  /**
734
799
  * 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
800
  *
@@ -938,6 +1003,10 @@ export interface HTMLElementProps extends ElementProps {
938
1003
  onpaste?: OptionalProperty<EventHandler<ClipboardEvent>>;
939
1004
  }
940
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>[];
941
1010
  }
942
1011
  /**
943
1012
  * Mapping of event props to event names.
@@ -1210,7 +1279,7 @@ export type CSSProperties = {
1210
1279
  [K in keyof Styles]: OptionalProperty<Styles[K]>;
1211
1280
  };
1212
1281
  export interface ClassMap {
1213
- [className: string]: MaybeState<any>;
1282
+ [className: string]: MaybeSignal<any>;
1214
1283
  }
1215
1284
  export type EventHandler<E> = (event: E) => void;
1216
1285
  export interface PropertiesOf<E extends HTMLElement> extends HTMLElementProps {
@@ -1221,7 +1290,11 @@ export interface PropertiesOf<E extends HTMLElement> extends HTMLElementProps {
1221
1290
  /**
1222
1291
  * Receives a reference to the DOM node when rendered.
1223
1292
  */
1224
- ref?: Ref<E> | Ref<HTMLElement> | Ref<Element> | Ref<Node>;
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>[];
1225
1298
  }
1226
1299
  /**
1227
1300
  * The following elements are defined based on the WHATWG HTML spec:
@@ -2098,7 +2171,7 @@ interface HTMLMediaElementProps<T extends HTMLMediaElement> extends HTMLElementP
2098
2171
  *
2099
2172
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject
2100
2173
  */
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>;
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>;
2102
2175
  /**
2103
2176
  * The current audio volume of the media element. Must be a number between 0 and 1.
2104
2177
  *
@@ -2597,7 +2670,7 @@ interface HTMLImageElementProps extends PropertiesOf<HTMLImageElement> {
2597
2670
  *
2598
2671
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes
2599
2672
  */
2600
- sizes?: MaybeState<string>;
2673
+ sizes?: MaybeSignal<string>;
2601
2674
  /**
2602
2675
  * The image URL.
2603
2676
  *
@@ -3143,7 +3216,6 @@ interface HTMLInputElementProps extends PropertiesOf<HTMLInputElement> {
3143
3216
  step?: OptionalProperty<number>;
3144
3217
  type?: OptionalProperty<InputType>;
3145
3218
  value?: OptionalProperty<string>;
3146
- $$value?: SettableState<any>;
3147
3219
  width?: OptionalProperty<string | number> | OptionalProperty<string> | OptionalProperty<number>;
3148
3220
  title?: OptionalProperty<string>;
3149
3221
  /**
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,19 @@
1
1
  export declare const noOp: () => void;
2
- export declare function deepEqual(one: any, two: any): boolean;
2
+ export declare function getUniqueId(): string;
3
+ export declare function getIntegerId(): number;
4
+ /**
5
+ * Equality check that passes if both values are the same object.
6
+ * This is the default equality check for states.
7
+ */
8
+ export declare function strictEqual(a: any, b: any): boolean;
9
+ /**
10
+ * Equality check that passes if both values are the same object, or if both are objects or arrays with equal keys and values.
11
+ */
12
+ export declare function shallowEqual(a: any, b: any): boolean;
13
+ /**
14
+ * Equality check that passes if two objects have equal values, even if they are not the same object.
15
+ */
16
+ export declare function deepEqual(a: any, b: any): boolean;
3
17
  /**
4
18
  * Takes an old value and a new value. Returns a merged copy if both are objects, otherwise returns the new value.
5
19
  */
@@ -13,8 +27,16 @@ export declare function merge(one: unknown, two: unknown): any;
13
27
  * @param object - An object to clone without the omitted keys.
14
28
  */
15
29
  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;
30
+ export declare function toArray<T>(value: T | T[]): T[];
31
+ export declare function toCamelCase(s: string): string;
32
+ /**
33
+ * Moves an element using `moveBefore` if the browser supports it, otherwise falls back to `insertBefore`.
34
+ */
35
+ export declare function moveBefore(parent: Node, node: Node, child: Node | null): void;
36
+ /**
37
+ * Takes any string and returns an OKLCH color.
38
+ */
39
+ export declare function okhash(value: string): string;
18
40
  export type MatcherFunction = (value: string) => boolean;
19
41
  /**
20
42
  * Parses a filter string into a matcher function.
@@ -0,0 +1,132 @@
1
+ # Going Buildless: The No-Stress Setup
2
+
3
+ Aight, so we've been talking about setting up Dolla with Vite, which is sick for real projects. But what if you just wanna vibe? What if you wanna throw together a quick demo on CodePen, or just mess around in a single HTML file without all the setup drama?
4
+
5
+ Bet. You can totally run Dolla **buildless**. No npm, no Vite, no `tsconfig.json`. Just you, a browser, and an HTML file.
6
+
7
+ The magic that makes this happen is a tiny library called [HTM (Hyperscript Tagged Markup)](https://github.com/developit/htm). It's basically JSX, but for the browser. It lets you write your UI using tagged template literals, which look a little weird at first but are actually super intuitive.
8
+
9
+ ## The Setup: One HTML File to Rule Them All
10
+
11
+ Fr, this is all you need. Just create an `index.html` file and paste this in.
12
+
13
+ ```html
14
+ <!doctype html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="UTF-8" />
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
19
+ <title>Dolla Buildless Demo</title>
20
+ </head>
21
+ <body>
22
+ <!-- Your app will go here! -->
23
+ <div id="app"></div>
24
+
25
+ <!-- This is the magic part -->
26
+ <script type="module">
27
+ // 1. Import what you need from a CDN
28
+ import { createApp, useSignal, createMarkup } from "https://esm.sh/@manyducks.co/dolla";
29
+ import htm from "https://esm.sh/htm";
30
+
31
+ // 2. Tell HTM to use Dolla's markup function
32
+ const html = htm.bind(createMarkup);
33
+
34
+ // 3. Write your component using the `html` tag
35
+ function App() {
36
+ const [$count, setCount] = useSignal(0);
37
+
38
+ return html`
39
+ <div>
40
+ <h1>Count: ${$count}</h1>
41
+ <button onClick=${() => setCount((c) => c + 1)}>Click Me!</button>
42
+ </div>
43
+ `;
44
+ }
45
+
46
+ // 4. Mount your app into the #app element
47
+ createApp(App).mount("#app");
48
+ </script>
49
+ </body>
50
+ </html>
51
+ ```
52
+
53
+ Just save that file and open it in your browser. That's it. You have a fully reactive Dolla app running. No terminal, no `npm install`.
54
+
55
+ ## How it Works: The `html` Tag
56
+
57
+ Let's break down the key part. This line:
58
+
59
+ ```js
60
+ const html = htm.bind(createMarkup);
61
+ ```
62
+
63
+ ...is the secret sauce. It creates a special "tag" for your template literals. Whenever you write `html\`...\``, HTM intercepts it and, instead of making a normal string, it uses Dolla's `createMarkup\` function to turn it into the same Markup Nodes that JSX would create.
64
+
65
+ So, this JSX:
66
+
67
+ ```jsx
68
+ <div class="greeting">Hello, {$name}</div>
69
+ ```
70
+
71
+ Becomes this with HTM:
72
+
73
+ ```js
74
+ html`<div class="greeting">Hello, ${$name}</div>`;
75
+ ```
76
+
77
+ It's basically the same thing, just with a slightly different syntax. You use `${...}` to embed any JavaScript expression, whether it's a signal, a string, or an event handler.
78
+
79
+ ## A More Complex Example
80
+
81
+ Let's see how our usual `Counter` example looks with HTM. It's almost identical.
82
+
83
+ ```html
84
+ <script type="module">
85
+ import { createApp, useSignal, useEffect, Show, createMarkup } from "https://esm.sh/@manyducks.co/dolla";
86
+ import htm from "https://esm.sh/htm";
87
+
88
+ const html = htm.bind(createMarkup);
89
+
90
+ function Counter() {
91
+ const [$count, setCount] = useSignal(0);
92
+
93
+ useEffect(() => {
94
+ console.log("The count is now:", $count());
95
+ });
96
+
97
+ return html`
98
+ <div>
99
+ <p>Count: ${$count}</p>
100
+ <button onClick=${() => setCount((c) => c + 1)}>+1</button>
101
+
102
+ {/* You can even use other components inside! */}
103
+ <${Show} when=${() => $count() > 5}>
104
+ <p>It's over 5!</p>
105
+ <//>
106
+ </div>
107
+ `;
108
+ }
109
+
110
+ createApp(Counter).mount("#app");
111
+ </script>
112
+ ```
113
+
114
+ The only weird part is using other components. You have to use the `${...}` syntax for the component itself, like `<${Show} ...>`. It's a little quirky, but you get used to it.
115
+
116
+ ## So, Why Bother?
117
+
118
+ Going buildless is the main character for a few situations:
119
+
120
+ - **Quick Prototypes & Demos:** You can spin up a reactive demo in seconds. Perfect for CodePen, Glitch, or just a file on your desktop.
121
+ - **Learning:** It's a sick way to learn Dolla without getting bogged down in build tool configuration.
122
+ - **Embedding in Existing Sites:** Got a simple static site and just want to add a little island of reactivity? This is perfect.
123
+
124
+ For a huge, complex production app, you'll probably still want a build step with Vite for stuff like code splitting, bundling, and all that optimization. But for getting started or for smaller projects, going buildless is a total power move.
125
+
126
+ ---
127
+
128
+ End.
129
+
130
+ - [🗂️ Docs](./index.md)
131
+ - [🏠 README](../README.md)
132
+ - [🦆 That's a lot of ducks.](https://www.manyducks.co)