@manyducks.co/dolla 2.0.0-alpha.66 → 2.0.0-alpha.68

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 (46) hide show
  1. package/README.md +24 -75
  2. package/dist/core/context.d.ts +11 -25
  3. package/dist/{hooks/index.d.ts → core/hooks.d.ts} +19 -26
  4. package/dist/core/index.d.ts +5 -4
  5. package/dist/core/markup.d.ts +6 -31
  6. package/dist/core/nodes/dynamic.d.ts +1 -1
  7. package/dist/core/nodes/element.d.ts +0 -1
  8. package/dist/core/ref.d.ts +1 -0
  9. package/dist/core/signals.d.ts +26 -19
  10. package/dist/core/views/for.d.ts +2 -2
  11. package/dist/core/views/show.d.ts +3 -3
  12. package/dist/http.js +1 -1
  13. package/dist/i18n.js +121 -122
  14. package/dist/i18n.js.map +1 -1
  15. package/dist/{index-BEDDzyd9.js → index-BLYt-mrI.js} +23 -24
  16. package/dist/index-BLYt-mrI.js.map +1 -0
  17. package/dist/index.js +145 -97
  18. package/dist/index.js.map +1 -1
  19. package/dist/jsx-dev-runtime.js +1 -1
  20. package/dist/jsx-runtime.js +1 -1
  21. package/dist/logger-IE5c3t-c.js +566 -0
  22. package/dist/logger-IE5c3t-c.js.map +1 -0
  23. package/dist/markup-8Olu6qoy.js +1063 -0
  24. package/dist/markup-8Olu6qoy.js.map +1 -0
  25. package/dist/router.js +1 -1
  26. package/dist/{typeChecking-_dGK_0uR.js → typeChecking-Cw-4pIto.js} +7 -3
  27. package/dist/{typeChecking-_dGK_0uR.js.map → typeChecking-Cw-4pIto.js.map} +1 -1
  28. package/docs/hooks.md +17 -17
  29. package/docs/mixins.md +10 -7
  30. package/docs/ref.md +14 -14
  31. package/docs/router.md +8 -5
  32. package/package.json +1 -5
  33. package/vite.config.js +0 -1
  34. package/dist/core/scheduler.d.ts +0 -25
  35. package/dist/hooks.js +0 -70
  36. package/dist/hooks.js.map +0 -1
  37. package/dist/index-BEDDzyd9.js.map +0 -1
  38. package/dist/logger-CmXtRdEI.js +0 -82
  39. package/dist/logger-CmXtRdEI.js.map +0 -1
  40. package/dist/markup-DjDexAN5.js +0 -1179
  41. package/dist/markup-DjDexAN5.js.map +0 -1
  42. package/dist/ref-BD79iqlg.js +0 -15
  43. package/dist/ref-BD79iqlg.js.map +0 -1
  44. package/dist/signals-CkfFHd0d.js +0 -488
  45. package/dist/signals-CkfFHd0d.js.map +0 -1
  46. /package/dist/{hooks/index.test.d.ts → core/hooks.test.d.ts} +0 -0
package/README.md CHANGED
@@ -15,52 +15,53 @@ Dolla is a batteries-included JavaScript frontend framework covering the needs o
15
15
  - 📍 Lightweight [localization](./docs/i18n.md) system (store translated strings in JSON files and call the `t` function to get them).
16
16
  - 🍳 Build system optional. [Write views in JSX](./docs/setup.md) or bring in [HTM](https://github.com/developit/htm) and use tagged template literals directly in the browser.
17
17
 
18
- Dolla's goals include:
18
+ Dolla's goals:
19
19
 
20
20
  - Be fun to create with.
21
21
  - Be snappy and responsive for real life apps.
22
- - Be compact as possible but not at the expense of necessary features.
22
+ - Be as compact as possible but not at the expense of necessary features.
23
23
 
24
- ## Why Dolla?
24
+ ## DEV TO-DO
25
25
 
26
- > TODO: Write about why Dolla was started and what it's all about.
27
-
28
- - Borne of frustration using React and similar libs (useEffect, referential equality, a pain to integrate other libs into its lifecycle, need to hunt for libraries to move much beyond Hello World).
29
- - Merges ideas from my favorite libraries and frameworks (Solid/Knockout, Choo, Svelte, i18next, etc) into one curated set designed to work well together.
30
- - Opinionated (with the _correct_ opinions).
31
- - Many mainstream libraries seem too big for what they do. The entirety of Dolla is less than half the size of [`react-router`](https://bundlephobia.com/package/react-router@7.1.5).
26
+ - Make sure docs are correct and accurate.
27
+ - Release v2.0.0
32
28
 
33
29
  ## An Example
34
30
 
35
31
  A basic view. Note that the view function is called exactly once when the view is first mounted. All changes to DOM nodes thereafter happen as a result of `$state` values changing.
36
32
 
37
33
  ```jsx
38
- import { $, effect, when, mount } from "@manyducks.co/dolla";
39
-
40
- function Counter(props, ctx) {
41
- const $count = $(0);
34
+ import { useSignal, useEffect, createApp } from "@manyducks.co/dolla";
42
35
 
43
- effect(() => {
44
- console.log("Count is: " + $count());
45
- // An effect will re-run whenever any signal accessed inside it receives a new value.
46
- });
36
+ function Counter() {
37
+ const [$count, setCount] = useSignal();
47
38
 
48
39
  function reset() {
49
- $count.set(0);
40
+ setCount(0);
50
41
  }
51
42
 
52
43
  function increment() {
53
- $count.set((current) => current + 1);
44
+ setCount((current) => current + 1);
54
45
  }
55
46
 
56
47
  function decrement() {
57
- $count.set((current) => current - 1);
48
+ setCount((current) => current - 1);
58
49
  }
59
50
 
51
+ // Runs once when the view is mounted, then again every time $count receives a new value.
52
+ useEffect(() => {
53
+ console.log("Count is: " + $count());
54
+ });
55
+
60
56
  return (
61
57
  <div>
62
- <p>Counter: {$count}</p>
63
58
  {/* Signals can be slotted into the DOM to render them */}
59
+ <p>Counter: {$count}</p>
60
+
61
+ {/* Signals are just functions that return a value, so you can compose them on the fly */}
62
+ <Show when={() => $count() > 100}>
63
+ <p>That's a lot of clicks.</p>
64
+ </Show>
64
65
 
65
66
  <div>
66
67
  <button onClick={increment}>+1</button>
@@ -71,60 +72,8 @@ function Counter(props, ctx) {
71
72
  );
72
73
  }
73
74
 
74
- mount(Counter, document.body);
75
- ```
76
-
77
- > TODO: Show small examples for routing and stores.
78
-
79
- ```js
80
- function MessageStore(options, ctx) {
81
- const message = $("Hello world!");
82
-
83
- ctx.effect(() => {
84
- ctx.log(`Message is now: ${message()}`);
85
- // Calling `get()` inside an effect (or compose) function will track that reactive value as a dependency.
86
- // Effects will re-run when a dependency updates.
87
- });
88
- // `ctx` refers to the context object; StoreContext in a store and ViewContext in a view.
89
- // Context objects contain methods for controlling the component, logging and attaching lifecycle hooks.
90
-
91
- return {
92
- $message: $(() => message()),
93
- setMessage: (value: string) => message.set(value.toUpperCase()),
94
- };
95
- }
96
-
97
- function App(props, ctx) {
98
- // Provide a store for this and all child views.
99
- ctx.addStore(MessageStore);
100
-
101
- const { $message, setMessage } = ctx.getStore(MessageStore);
102
- // Provides a MessageStore on this context and any child contexts.
103
- // When a store is provided its value is returned right away.
104
-
105
- return (
106
- <div>
107
- <MessageView />
108
- <MessageView />
109
- <MessageView />
110
-
111
- <input
112
- type="text"
113
- value={$message}
114
- onInput={(e) => {
115
- setMessage(e.currentTarget.value);
116
- }}
117
- />
118
- </div>
119
- );
120
- }
121
-
122
- function MessageView(props, ctx) {
123
- const { message } = ctx.getStore(MessageStore);
124
- // Gets the nearest instance of MessageStore. In this case the one provided at the parent.
125
-
126
- return <span>{message}</span>;
127
- }
75
+ const app = createApp(Counter);
76
+ app.mount(document.body);
128
77
  ```
129
78
 
130
79
  For more detail [check out the Docs](./docs/index.md).
@@ -2,12 +2,13 @@ import type { Store } from "../types";
2
2
  import { type Logger, type LoggerOptions } from "./logger";
3
3
  import { type EffectFn, type MaybeSignal, type UnsubscribeFn } from "./signals";
4
4
  export declare enum LifecycleEvent {
5
- WILL_MOUNT = 0,
6
- DID_MOUNT = 1,
7
- WILL_UNMOUNT = 2,
8
- DID_UNMOUNT = 3,
9
- DISPOSE = 4
5
+ WILL_MOUNT = "willMount",
6
+ DID_MOUNT = "didMount",
7
+ WILL_UNMOUNT = "willUnmount",
8
+ DID_UNMOUNT = "didUnmount",
9
+ DISPOSE = "dispose"
10
10
  }
11
+ export type LifecycleEventName = "willMount" | "didMount" | "willUnmount" | "didUnmount" | "dispose";
11
12
  type LifecycleListener = () => void;
12
13
  declare enum LifecycleState {
13
14
  Unmounted = 0,
@@ -87,16 +88,11 @@ export declare class Context implements Logger {
87
88
  /**
88
89
  * Returns a new Context with this one as its parent.
89
90
  */
90
- static linked(parent: Context, name: MaybeSignal<string>, options?: LinkedContextOptions): Context;
91
+ static createChildOf(parent: Context, name: MaybeSignal<string>, options?: LinkedContextOptions): Context;
91
92
  /**
92
93
  * Emit a lifecycle event to `context`.
93
94
  */
94
95
  static emit(context: Context, event: LifecycleEvent): void;
95
- /**
96
- * Traverses _parent contexts until arriving at one that doesn't have a parent itself.
97
- * Returns null if this context is the parent.
98
- */
99
- static getRoot(context: Context): Context | null;
100
96
  constructor(name: MaybeSignal<string>, options?: ContextOptions);
101
97
  /**
102
98
  * Returns the current name of this context.
@@ -117,21 +113,11 @@ export declare class Context implements Logger {
117
113
  */
118
114
  getStore<T>(store: Store<any, T>): T;
119
115
  /**
120
- * Schedule a callback function to run just before this context is mounted.
121
- */
122
- beforeMount(listener: LifecycleListener): () => void;
123
- /**
124
- * Schedule a callback function to run after this context is mounted.
125
- */
126
- onMount(listener: LifecycleListener): () => void;
127
- /**
128
- * Schedule a callback function to run just before this context is unmounted.
129
- */
130
- beforeUnmount(listener: LifecycleListener): () => void;
131
- /**
132
- * Schedule a callback function to run after this context is unmounted.
116
+ * Registers a `listener` to be called at a specific transition point during this context's lifecycle.
117
+ *
118
+ * Prefer `useMount` and `useUnmount` hooks for general usage.
133
119
  */
134
- onUnmount(listener: LifecycleListener): () => void;
120
+ onLifecycleTransition(event: LifecycleEventName, listener: LifecycleListener): () => void;
135
121
  effect(callback: EffectFn): UnsubscribeFn;
136
122
  /**
137
123
  * Gets the value stored at `key`, or returns `options.fallback` if none is set.
@@ -1,29 +1,28 @@
1
- import { type Context, type Logger, type Ref, type Store } from "../core";
1
+ import { type Context, type Ref, type Store } from "../core";
2
2
  import { type EffectFn, type MaybeSignal, type Setter, type Signal, type SignalOptions } from "../core/signals";
3
3
  /**
4
- * Returns the Context object of the View, Store or Mixin this hook is called in.
4
+ * Returns the Context object of the `View`, `Store` or `Mixin` this hook is called in.
5
+ *
6
+ * @param name - If passed, the context will be renamed. Context takes the name of the component function by default.
5
7
  */
6
- export declare function useContext(): Context;
8
+ export declare function useContext(name?: MaybeSignal<string>): Context;
7
9
  /**
8
- * Returns a logger. If a name is passed it will be used as a prefix for all console messages.
9
- * Otherwise the default name of the context will be used.
10
+ * Returns the nearest instance of a Store provided to this context.
10
11
  */
11
- export declare function useLogger(name?: MaybeSignal<string>): Logger;
12
+ export declare function useStore<T>(store: Store<any, T>): T;
12
13
  /**
13
- * Creates a new read-only Getter and a bound Setter function.
14
- * @deprecated prefer useSignal
14
+ * Adds a store to this context and returns the store instance.
15
15
  */
16
- export declare function useState<T>(value: T, options?: SignalOptions<T>): [Signal<T>, Setter<T>];
16
+ export declare function useStoreProvider<T, O>(store: Store<O, T>, options?: O): T;
17
17
  /**
18
- * Creates a new read-only Signal and a bound Setter function.
19
- * @deprecated prefer useSignal
18
+ * Schedules `callback` to run just after the component is mounted.
19
+ * If `callback` returns a function, that function will run when the context is unmounted.
20
20
  */
21
- export declare function useState<T>(value: undefined, options: SignalOptions<T>): [Signal<T | undefined>, Setter<T | undefined>];
21
+ export declare function useMount(callback: () => void | (() => void)): void;
22
22
  /**
23
- * Creates a new read-only Signal and a bound Setter function.
24
- * @deprecated prefer useSignal
23
+ * Schedules `callback` to run when the context is unmounted.
25
24
  */
26
- export declare function useState<T>(): [Signal<T | undefined>, Setter<T | undefined>];
25
+ export declare function useUnmount(callback: () => void): void;
27
26
  /**
28
27
  * Creates a new read-only Signal. Returns bound Getter and Setter functions.
29
28
  *
@@ -38,7 +37,6 @@ export declare function useSignal<T>(value: T, options?: SignalOptions<T>): [Sig
38
37
  export declare function useSignal<T>(value: undefined, options: SignalOptions<T>): [Signal<T | undefined>, Setter<T | undefined>];
39
38
  export declare function useSignal<T>(): [Signal<T | undefined>, Setter<T | undefined>];
40
39
  export declare function useMemo<T>(compute: (current?: T) => MaybeSignal<T>, deps?: Signal<any>[], options?: SignalOptions<T>): Signal<T>;
41
- export declare function useEffect(fn: EffectFn, deps?: Signal<any>[]): void;
42
40
  /**
43
41
  * Takes the current state and a dispatched action. Returns a new state based on the action.
44
42
  * Typically the body of this function will be a large switch statement.
@@ -53,9 +51,10 @@ export type Dispatcher<Action> = (action: Action) => void;
53
51
  */
54
52
  export declare function useReducer<State, Action>(reducer: Reducer<State, Action>, initialState: State): [Signal<State>, Dispatcher<Action>];
55
53
  /**
56
- * Uses a previously added Store. Takes the Store function itself and returns the nearest instance.
54
+ * Creates an effect bound to the current context.
55
+ * The `fn` is called when the component is mounted, then again each time the dependencies are updated until the component is unmounted.
57
56
  */
58
- export declare function useStore<T>(store: Store<any, T>): T;
57
+ export declare function useEffect(fn: EffectFn, deps?: Signal<any>[]): void;
59
58
  /**
60
59
  * A hybrid Ref which is both a function ref and a React-style object ref with a `current` property.
61
60
  * Both the `current` property and the function syntax access the same value.
@@ -65,13 +64,7 @@ export interface HybridRef<T> extends Ref<T> {
65
64
  }
66
65
  /**
67
66
  * Creates a Ref. Useful for getting references to DOM nodes.
67
+ *
68
+ * @deprecated use ref()
68
69
  */
69
70
  export declare function useRef<T>(initialValue?: T): HybridRef<T>;
70
- /**
71
- * Calls `callback` when the context is mounted. If `callback` returns a function, that function is called when the context is unmounted.
72
- */
73
- export declare function useMount(callback: () => void | (() => void)): void;
74
- /**
75
- * Calls `callback` when the context is unmounted.
76
- */
77
- export declare function useUnmount(callback: () => void): void;
@@ -1,13 +1,14 @@
1
1
  export { createApp } from "./app.js";
2
- export { $, batch, effect, get, memo as memo, writable, untracked } from "./signals.js";
3
- export type { MaybeSignal, Writable, Signal } from "./signals.js";
2
+ export { batch, effect, get, memo, readable, signal, untracked, writable } from "./signals.js";
3
+ export type { MaybeSignal, Signal, Writable, Setter } from "./signals.js";
4
+ export * from "./hooks.js";
4
5
  export { createContext } from "./context.js";
5
6
  export type { Context } from "./context.js";
6
- export { m, Markup, MarkupNode, portal, render, repeat, unless, when } from "./markup.js";
7
+ export { createMarkup, Markup, MarkupNode, render } from "./markup.js";
7
8
  export { ref, type Ref } from "./ref.js";
8
9
  export { For, type ForProps } from "./views/for.js";
9
- export { Show, type ShowProps } from "./views/show.js";
10
10
  export { Portal, type PortalProps } from "./views/portal.js";
11
+ export { Show, type ShowProps } from "./views/show.js";
11
12
  export { deepEqual, shallowEqual, strictEqual } from "../utils.js";
12
13
  export { getEnv, setEnv } from "./env.js";
13
14
  export { createLogger, onLoggerCrash, setLogFilter, setLogLevels } from "./logger.js";
@@ -2,7 +2,7 @@ import type { IntrinsicElements, Renderable, View } from "../types.js";
2
2
  import { Context } from "./context.js";
3
3
  import { MarkupNode } from "./nodes/_markup.js";
4
4
  import { KeyFn, RenderFn } from "./nodes/repeat.js";
5
- import { type MaybeSignal, type Signal } from "./signals.js";
5
+ import { type Signal } from "./signals.js";
6
6
  export { MarkupNode };
7
7
  type PropsOf<V extends string | View<any>> = V extends View<infer U> ? U : any;
8
8
  /**
@@ -53,50 +53,25 @@ export interface MarkupCustomElementProps {
53
53
  /**
54
54
  * Creates a `Markup` element that defines an HTML element.
55
55
  */
56
- export declare function m<T extends keyof IntrinsicElements>(tag: T, attrs: IntrinsicElements[T] & {
56
+ export declare function createMarkup<T extends keyof IntrinsicElements>(tag: T, attrs: IntrinsicElements[T] & {
57
57
  children?: Renderable;
58
58
  }): Markup;
59
59
  /**
60
60
  * Creates a `Markup` element that defines an HTML custom element.
61
61
  */
62
- export declare function m<T extends keyof MarkupCustomElementProps>(type: T, props: MarkupCustomElementProps[T]): Markup;
62
+ export declare function createMarkup<T extends keyof MarkupCustomElementProps>(type: T, props: MarkupCustomElementProps[T]): Markup;
63
63
  /**
64
64
  * Creates a `Markup` element that defines a `MarkupNode`.
65
65
  */
66
- export declare function m<T extends keyof MarkupNodeProps>(type: T, props: MarkupNodeProps[T]): Markup;
66
+ export declare function createMarkup<T extends keyof MarkupNodeProps>(type: T, props: MarkupNodeProps[T]): Markup;
67
67
  /**
68
68
  * Creates a `Markup` element that defines a view.
69
69
  */
70
- export declare function m<P extends {}>(type: View<P>, props?: P): Markup;
70
+ export declare function createMarkup<P extends {}>(type: View<P>, props?: P): Markup;
71
71
  /**
72
72
  * Creates a `Markup` element that defines a view.
73
73
  */
74
- export declare function m<P>(type: View<P>, props: P): Markup;
75
- /**
76
- * If `condition` is truthy, displays `thenContent`, otherwise `elseContent`.
77
- *
78
- * @deprecated use `Show` view with `when` prop.
79
- */
80
- export declare function when(condition: MaybeSignal<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
81
- /**
82
- * Inverted `when`. If `condition` is falsy, displays `thenContent`, otherwise `elseContent`.
83
- *
84
- * @deprecated use `Show` view with `unless` prop.
85
- */
86
- export declare function unless(condition: MaybeSignal<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
87
- /**
88
- * Calls `render` for each item in `items`. Dynamically adds and removes views as items change.
89
- * The result of `key` is used to compare items and decide if item was added, removed or updated.
90
- *
91
- * @deprecated use `For` view
92
- */
93
- export declare function repeat<T>(items: MaybeSignal<T[]>, key: KeyFn<T>, render: RenderFn<T>): Markup;
94
- /**
95
- * Renders `content` into a `parent` node anywhere in the page, rather than its usual position in the view.
96
- *
97
- * @deprecated use `Portal` view
98
- */
99
- export declare function portal(parent: Element, content: Renderable): Markup;
74
+ export declare function createMarkup<P>(type: View<P>, props: P): Markup;
100
75
  /**
101
76
  * Takes any `Renderable` value and returns a `MarkupNode` that will display it.
102
77
  */
@@ -1,5 +1,5 @@
1
1
  import type { Context } from "../context.js";
2
- import { Signal } from "../signals.js";
2
+ import { type Signal } from "../signals.js";
3
3
  import { MarkupNode } from "./_markup.js";
4
4
  /**
5
5
  * Renders any kind of content; markup, signals, DOM nodes, etc.
@@ -19,7 +19,6 @@ export declare class ElementNode extends MarkupNode {
19
19
  mount(parent: Node, after?: Node): void;
20
20
  unmount(skipDOM?: boolean): void;
21
21
  move(parent: Element, after?: Node): void;
22
- private update;
23
22
  private attachProp;
24
23
  private getKey;
25
24
  private applyProps;
@@ -1,3 +1,4 @@
1
+ export declare const EMPTY_REF: unique symbol;
1
2
  /**
2
3
  * A hybrid getter/setter function that stores the last value it was called with.
3
4
  * Guarantees a value is held at runtime by throwing an error if no value is set.
@@ -32,14 +32,33 @@ export interface SignalOptions<T> {
32
32
  */
33
33
  equals?: EqualityFn<T>;
34
34
  }
35
- export declare function $<T>(compute: (previousValue?: T) => MaybeSignal<T>, options?: MemoOptions<T>): Signal<T>;
36
- export declare function $<T>(): Writable<T | undefined>;
37
- export declare function $<T>(initialValue: undefined, options: SignalOptions<T | undefined>): Writable<T | undefined>;
38
- export declare function $<T>(initialValue: T, options?: SignalOptions<T>): Writable<T>;
39
35
  export declare function writable<T>(): Writable<T | undefined>;
40
36
  export declare function writable<T>(initialValue: undefined, options: SignalOptions<T | undefined>): Writable<T | undefined>;
41
37
  export declare function writable<T>(initialValue: T, options?: SignalOptions<T>): Writable<T>;
38
+ /**
39
+ * Ensures that a value is a read-only signal.
40
+ *
41
+ * @example
42
+ * const $number = readable(5); // converts plain values to signals
43
+ *
44
+ * const $number = writable(5);
45
+ * const $value = readable($number);
46
+ * $number(); // 5
47
+ * $value(); // 5
48
+ * $number.set(6);
49
+ * $number(); // 6
50
+ * $value(); // 6 (tracks value but can't be written)
51
+ */
42
52
  export declare function readable<T>(signal: MaybeSignal<T>): Signal<T>;
53
+ /**
54
+ * Creates a new signal, returning a getter and setter pair.
55
+ *
56
+ * @example
57
+ * const [$count, setCount] = signal(0);
58
+ */
59
+ export declare function signal<T>(initialValue: T, options?: SignalOptions<T>): [Signal<T>, Setter<T>];
60
+ export declare function signal<T>(initialValue: undefined, options: SignalOptions<T>): [Signal<T | undefined>, Setter<T | undefined>];
61
+ export declare function signal<T>(): [Signal<T | undefined>, Setter<T | undefined>];
43
62
  export interface MemoOptions<T> extends SignalOptions<T> {
44
63
  /**
45
64
  * An array of signals this `memo` depends on. If this is passed, calls to signals within `fn` will NOT be tracked.
@@ -71,23 +90,11 @@ export declare function get<T>(value: MaybeSignal<T>): T;
71
90
  */
72
91
  export type EffectFn = () => void | (() => void);
73
92
  export type UnsubscribeFn = () => void;
74
- export declare const INTERNAL_EFFECT: unique symbol;
75
- export interface EffectOptions {
76
- /**
77
- * An array of signals this effect depends on. If this is passed, calls to signals within `fn` will NOT be tracked.
78
- * Instead the `deps` array will be tracked and `fn` will re-run when any value in `deps` changes.
79
- */
80
- deps?: Signal<any>[];
81
- /**
82
- * For internal use.
83
- */
84
- _type?: symbol;
85
- }
86
93
  /**
87
94
  * Creates a tracked scope that re-runs whenever the values of any tracked reactives changes.
88
95
  * Reactives are tracked by accessing their `value` within the body of the function.
89
96
  *
90
- * NOTE: You must call the unsubscribe function to stop watching for changes.
91
- * If you are using an effect inside a View or Store, use `ctx.effect` instead, which cleans up automatically when the component unmounts.
97
+ * NOTE: You must call the unsubscribe function to clean up the effect.
98
+ * If you are using an effect inside a View or Store, try the `useEffect` hook instead, which cleans up automatically when the component unmounts.
92
99
  */
93
- export declare function effect(fn: EffectFn, options?: EffectOptions): UnsubscribeFn;
100
+ export declare function effect(fn: EffectFn): UnsubscribeFn;
@@ -1,12 +1,12 @@
1
1
  import type { Renderable } from "../../types";
2
2
  import type { Context } from "../context";
3
3
  import { type Key, RepeatNode } from "../nodes/repeat";
4
- import { type Signal } from "../signals";
4
+ import { type MaybeSignal, type Signal } from "../signals";
5
5
  export interface ForProps<T> {
6
6
  /**
7
7
  * An array of items to render.
8
8
  */
9
- each: Signal<T[]>;
9
+ each: MaybeSignal<T[]>;
10
10
  /**
11
11
  * A function to extract a unique key that identifies each item.
12
12
  * If no `key` function is passed, object identity (===) will be used.
@@ -1,16 +1,16 @@
1
1
  import type { Renderable } from "../../types";
2
2
  import type { Context } from "../context";
3
3
  import { DynamicNode } from "../nodes/dynamic";
4
- import { type Signal } from "../signals";
4
+ import { type MaybeSignal } from "../signals";
5
5
  export interface ShowProps {
6
6
  /**
7
7
  * If present, children will be rendered only when this signal holds a truthy value.
8
8
  */
9
- when?: Signal<any>;
9
+ when?: MaybeSignal<any>;
10
10
  /**
11
11
  * If present, children will be rendered only when this signal holds a falsy value.
12
12
  */
13
- unless?: Signal<any>;
13
+ unless?: MaybeSignal<any>;
14
14
  /**
15
15
  * Content to render if conditions permit.
16
16
  */
package/dist/http.js CHANGED
@@ -6,7 +6,7 @@ var g = (r, e, t) => e in r ? b(r, e, { enumerable: !0, configurable: !0, writab
6
6
  var a = (r, e, t) => g(r, typeof e != "symbol" ? e + "" : e, t), m = (r, e, t) => e.has(r) || f("Cannot " + t);
7
7
  var d = (r, e, t) => (m(r, e, "read from private field"), t ? t.call(r) : e.get(r)), c = (r, e, t) => e.has(r) ? f("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
8
8
  var o = (r, e, t) => (m(r, e, "access private method"), t);
9
- import { a as w } from "./typeChecking-_dGK_0uR.js";
9
+ import { a as w } from "./typeChecking-Cw-4pIto.js";
10
10
  var l, p, i, h;
11
11
  class O {
12
12
  constructor() {