@typed/ui 1.0.0-beta.6 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert.d.ts +35 -41
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +23 -20
- package/dist/Button.d.ts +34 -78
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +16 -12
- package/dist/Carousel.d.ts +35 -236
- package/dist/Carousel.d.ts.map +1 -1
- package/dist/Carousel.js +13 -136
- package/dist/Checkbox.d.ts +55 -90
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +44 -38
- package/dist/Collection.d.ts +15 -15
- package/dist/Collection.js +7 -7
- package/dist/Combobox.d.ts +38 -187
- package/dist/Combobox.d.ts.map +1 -1
- package/dist/Combobox.js +9 -80
- package/dist/Component.d.ts +30 -24
- package/dist/Component.d.ts.map +1 -1
- package/dist/Component.js +23 -12
- package/dist/Composite.d.ts +50 -50
- package/dist/Composite.js +20 -20
- package/dist/Dialog.d.ts +34 -34
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +16 -14
- package/dist/Disclosure.d.ts +15 -15
- package/dist/Disclosure.js +6 -6
- package/dist/Dom/Events.d.ts +4 -4
- package/dist/Dom/Events.js +4 -4
- package/dist/Dom/Props.d.ts +9 -9
- package/dist/Dom/Props.js +4 -4
- package/dist/Dom/Refs.d.ts +2 -2
- package/dist/Dom/Refs.js +1 -1
- package/dist/Dom/Render.d.ts +2 -2
- package/dist/Dom/Render.js +2 -2
- package/dist/Dom/Types.d.ts +33 -33
- package/dist/Dom/index.d.ts +5 -5
- package/dist/Dom/index.d.ts.map +1 -1
- package/dist/Dom/index.js +4 -4
- package/dist/Dom.d.ts +1 -1
- package/dist/Dom.js +1 -1
- package/dist/Focusable.d.ts +5 -5
- package/dist/Focusable.js +1 -1
- package/dist/Form.d.ts +565 -533
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +350 -195
- package/dist/Grid.d.ts +39 -220
- package/dist/Grid.d.ts.map +1 -1
- package/dist/Grid.js +12 -107
- package/dist/Group.d.ts +50 -69
- package/dist/Group.d.ts.map +1 -1
- package/dist/Group.js +33 -25
- package/dist/Heading.d.ts +41 -40
- package/dist/Heading.d.ts.map +1 -1
- package/dist/Heading.js +26 -16
- package/dist/Hovercard.d.ts +18 -18
- package/dist/Hovercard.js +6 -6
- package/dist/HttpRouter.d.ts +3 -3
- package/dist/HttpRouter.js +5 -5
- package/dist/Link.d.ts +17 -21
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +11 -0
- package/dist/Listbox.d.ts +31 -163
- package/dist/Listbox.d.ts.map +1 -1
- package/dist/Listbox.js +9 -80
- package/dist/Menu.d.ts +67 -376
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +17 -179
- package/dist/Menubar.d.ts +24 -142
- package/dist/Menubar.d.ts.map +1 -1
- package/dist/Menubar.js +8 -66
- package/dist/Meter.d.ts +72 -132
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +35 -42
- package/dist/NativeDetails.d.ts +1 -1
- package/dist/NativeDetails.js +1 -1
- package/dist/NativeDialog.d.ts +7 -5
- package/dist/NativeDialog.d.ts.map +1 -1
- package/dist/NativeDialog.js +42 -4
- package/dist/NativePopover.d.ts +6 -4
- package/dist/NativePopover.d.ts.map +1 -1
- package/dist/NativePopover.js +43 -5
- package/dist/Popover.d.ts +18 -19
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +7 -8
- package/dist/RadioGroup.d.ts +86 -188
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +55 -105
- package/dist/Role.d.ts +4 -4
- package/dist/Role.js +1 -1
- package/dist/Select.d.ts +109 -220
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +67 -117
- package/dist/Separator.d.ts +30 -26
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +16 -10
- package/dist/Slider.d.ts +64 -111
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +47 -42
- package/dist/SpinButton.d.ts +64 -111
- package/dist/SpinButton.d.ts.map +1 -1
- package/dist/SpinButton.js +47 -42
- package/dist/Storybook.d.ts +2 -2
- package/dist/Storybook.js +1 -1
- package/dist/Switch.d.ts +52 -91
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +30 -36
- package/dist/Tabs.d.ts +44 -224
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +10 -94
- package/dist/Toolbar.d.ts +24 -142
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +8 -66
- package/dist/Tooltip.d.ts +20 -20
- package/dist/Tooltip.js +6 -6
- package/dist/Tree.d.ts +43 -229
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +12 -113
- package/dist/TreeGrid.d.ts +45 -264
- package/dist/TreeGrid.d.ts.map +1 -1
- package/dist/TreeGrid.js +13 -125
- package/dist/VisuallyHidden.d.ts +41 -27
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +27 -10
- package/dist/WindowSplitter.d.ts +68 -108
- package/dist/WindowSplitter.d.ts.map +1 -1
- package/dist/WindowSplitter.js +106 -23
- package/package.json +9 -8
package/dist/Combobox.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* the state and pure operations without mounting UI, or supply custom hosts without replacing native
|
|
9
9
|
* events and browser-owned focus.
|
|
10
10
|
*
|
|
11
|
+
* Learn the interaction in the [Combobox guide](/explore/ui-combobox).
|
|
12
|
+
*
|
|
11
13
|
* @since 1.0.0
|
|
12
14
|
* @category modules
|
|
13
15
|
* @packageDocumentation
|
|
@@ -24,15 +26,6 @@ import * as NativePopover from "./NativePopover.js";
|
|
|
24
26
|
* Effect Schema used by makeState to encode, decode, and hydrate Combobox state.
|
|
25
27
|
*
|
|
26
28
|
* @remarks
|
|
27
|
-
* ## Why
|
|
28
|
-
*
|
|
29
|
-
* A public schema makes hydration and serialized state use the same runtime validation as direct
|
|
30
|
-
* construction.
|
|
31
|
-
*
|
|
32
|
-
* ## Ownership and lifetime
|
|
33
|
-
*
|
|
34
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
35
|
-
*
|
|
36
29
|
* @example
|
|
37
30
|
* ```ts
|
|
38
31
|
* import * as Schema from "effect/Schema";
|
|
@@ -41,7 +34,7 @@ import * as NativePopover from "./NativePopover.js";
|
|
|
41
34
|
* const decodeState = Schema.decodeUnknownEffect(Combobox.StateSchema);
|
|
42
35
|
* ```
|
|
43
36
|
* @since 1.0.0
|
|
44
|
-
* @category
|
|
37
|
+
* @category Query and popup state
|
|
45
38
|
*/
|
|
46
39
|
export const StateSchema = Schema.Struct({
|
|
47
40
|
id: Schema.String,
|
|
@@ -58,12 +51,6 @@ export const StateSchema = Schema.Struct({
|
|
|
58
51
|
* null, loop to true, and virtual focus is enabled.
|
|
59
52
|
*
|
|
60
53
|
* @remarks
|
|
61
|
-
* ## Why
|
|
62
|
-
*
|
|
63
|
-
* State and collection ownership can be composed and tested independently from any renderer.
|
|
64
|
-
*
|
|
65
|
-
* ## Ownership and lifetime
|
|
66
|
-
*
|
|
67
54
|
* The returned Effect creates the RefSubject when run. That state is renderer-independent;
|
|
68
55
|
* collection registrations belong to the separate Scope that runs register or ref, not to state
|
|
69
56
|
* creation.
|
|
@@ -82,7 +69,7 @@ export const StateSchema = Schema.Struct({
|
|
|
82
69
|
* );
|
|
83
70
|
* ```
|
|
84
71
|
* @since 1.0.0
|
|
85
|
-
* @category
|
|
72
|
+
* @category Query and popup state
|
|
86
73
|
*/
|
|
87
74
|
export function makeState(initial) {
|
|
88
75
|
return RefSubject.hydrate(StateSchema, {
|
|
@@ -100,12 +87,6 @@ export function makeState(initial) {
|
|
|
100
87
|
* Creates a scoped Collection for Combobox items.
|
|
101
88
|
*
|
|
102
89
|
* @remarks
|
|
103
|
-
* ## Why
|
|
104
|
-
*
|
|
105
|
-
* State and collection ownership can be composed and tested independently from any renderer.
|
|
106
|
-
*
|
|
107
|
-
* ## Ownership and lifetime
|
|
108
|
-
*
|
|
109
90
|
* The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
|
|
110
91
|
* owned by the Scope that runs register, independently of this construction Effect.
|
|
111
92
|
*
|
|
@@ -122,31 +103,18 @@ export function makeState(initial) {
|
|
|
122
103
|
* );
|
|
123
104
|
* ```
|
|
124
105
|
* @since 1.0.0
|
|
125
|
-
* @category
|
|
106
|
+
* @category Suggestion registration
|
|
126
107
|
*/
|
|
127
108
|
export const makeCollection = Collection.makeState;
|
|
128
109
|
/**
|
|
129
110
|
* Stores the input value, clears activeId, and opens the popup in one state update.
|
|
130
111
|
*
|
|
131
112
|
* @remarks
|
|
132
|
-
* ## Why
|
|
133
|
-
*
|
|
134
113
|
* The operation exposes Combobox's transition directly so callers can compose it in Effect
|
|
135
114
|
* programs and native event handlers.
|
|
136
115
|
*
|
|
137
|
-
* ## Ownership and lifetime
|
|
138
|
-
*
|
|
139
|
-
* The returned Effect performs the update or DOM side effect only when run, preserves the declared
|
|
140
|
-
* error and service channels, and retains no resources after completion.
|
|
141
|
-
*
|
|
142
|
-
* ## Example
|
|
143
|
-
*
|
|
144
|
-
* Import with `import { setValue } from "@typed/ui/Combobox";` Extend the [Combobox.makeState
|
|
145
|
-
* runnable setup](/reference/%40typed%2Fui%2FCombobox%23makeState). Inside the linked Effect
|
|
146
|
-
* program invoke `yield* setValue(state, "New York")`, then read state to observe that value,
|
|
147
|
-
* `activeId: null`, and `open: true`.
|
|
148
116
|
* @since 1.0.0
|
|
149
|
-
* @category
|
|
117
|
+
* @category Query and popup state
|
|
150
118
|
*/
|
|
151
119
|
export function setValue(state, value) {
|
|
152
120
|
return RefSubject.update(state, (current) => ({ ...current, value, activeId: null, open: true }));
|
|
@@ -239,25 +207,12 @@ function visibleItems(collection) {
|
|
|
239
207
|
* handles Arrow, Enter, and Escape when a collection is supplied.
|
|
240
208
|
*
|
|
241
209
|
* @remarks
|
|
242
|
-
* ## Why
|
|
243
|
-
*
|
|
244
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
245
|
-
* through the shared DOM boundary.
|
|
246
|
-
*
|
|
247
|
-
* ## Ownership and lifetime
|
|
248
|
-
*
|
|
249
210
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
250
211
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
251
212
|
* unrelated nodes and attributes remain caller-owned.
|
|
252
213
|
*
|
|
253
|
-
* ## Example
|
|
254
|
-
*
|
|
255
|
-
* Import with `import { Input } from "@typed/ui/Combobox";` Extend the [Combobox.makeState runnable
|
|
256
|
-
* setup](/reference/%40typed%2Fui%2FCombobox%23makeState). Replace the linked program's final
|
|
257
|
-
* snapshot read with `Input({ state, placeholder: "Choose a city" })`; render that Fx before the
|
|
258
|
-
* same Scope closes.
|
|
259
214
|
* @since 1.0.0
|
|
260
|
-
* @category
|
|
215
|
+
* @category Editable input
|
|
261
216
|
*/
|
|
262
217
|
export function Input(options, host) {
|
|
263
218
|
return Dom.renderHost()(options, host, inputProps(options), "", (props) => html `<input ...${props} />`);
|
|
@@ -296,25 +251,12 @@ function popoverProps(options) {
|
|
|
296
251
|
* scrolls the selected option when opened.
|
|
297
252
|
*
|
|
298
253
|
* @remarks
|
|
299
|
-
* ## Why
|
|
300
|
-
*
|
|
301
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
302
|
-
* through the shared DOM boundary.
|
|
303
|
-
*
|
|
304
|
-
* ## Ownership and lifetime
|
|
305
|
-
*
|
|
306
254
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
307
255
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
308
256
|
* unrelated nodes and attributes remain caller-owned.
|
|
309
257
|
*
|
|
310
|
-
* ## Example
|
|
311
|
-
*
|
|
312
|
-
* Import with `import { Popover } from "@typed/ui/Combobox";` Extend the [Combobox.makeState
|
|
313
|
-
* runnable setup](/reference/%40typed%2Fui%2FCombobox%23makeState). Replace the linked program's
|
|
314
|
-
* final snapshot read with `Popover({ state, content: "Cities" })`; render that Fx before the same
|
|
315
|
-
* Scope closes.
|
|
316
258
|
* @since 1.0.0
|
|
317
|
-
* @category
|
|
259
|
+
* @category Suggestion popup
|
|
318
260
|
*/
|
|
319
261
|
export function Popover(options, host) {
|
|
320
262
|
return Dom.renderHost()(options, host, popoverProps(options), options.content, (props, content) => {
|
|
@@ -346,25 +288,12 @@ function itemProps(options) {
|
|
|
346
288
|
* select on click.
|
|
347
289
|
*
|
|
348
290
|
* @remarks
|
|
349
|
-
* ## Why
|
|
350
|
-
*
|
|
351
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
352
|
-
* through the shared DOM boundary.
|
|
353
|
-
*
|
|
354
|
-
* ## Ownership and lifetime
|
|
355
|
-
*
|
|
356
291
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
357
292
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
358
293
|
* unrelated nodes and attributes remain caller-owned.
|
|
359
294
|
*
|
|
360
|
-
* ## Example
|
|
361
|
-
*
|
|
362
|
-
* Import with `import { Item } from "@typed/ui/Combobox";` Extend the [Combobox.makeState runnable
|
|
363
|
-
* setup](/reference/%40typed%2Fui%2FCombobox%23makeState). Replace the linked program's final
|
|
364
|
-
* snapshot read with `Item({ state, id: "nyc", value: "New York", content: "New York" })`; render
|
|
365
|
-
* that Fx before the same Scope closes.
|
|
366
295
|
* @since 1.0.0
|
|
367
|
-
* @category
|
|
296
|
+
* @category Suggestions
|
|
368
297
|
*/
|
|
369
298
|
export function Item(options, host) {
|
|
370
299
|
return Dom.renderHost()(options, host, itemProps(options), options.content, (props, content) => html `<div ...${props}>${content}</div>`);
|
package/dist/Component.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Scope from "effect/Scope";
|
|
2
3
|
import { Fx } from "@typed/fx";
|
|
3
4
|
import { type Renderable } from "@typed/template";
|
|
4
5
|
type ComponentFx<Yield extends Effect.Effect<any, any, any>, Result extends Renderable.Any> = [
|
|
5
|
-
Fx.Fx<Renderable.Success<Result>, Effect.Error<Yield> | Renderable.Error<Result>, Effect.Services<Yield> | Renderable.Services<Result
|
|
6
|
+
Fx.Fx<Renderable.Success<Result>, Effect.Error<Yield> | Renderable.Error<Result>, Effect.Services<Yield> | Renderable.Services<Result> | Scope.Scope>
|
|
6
7
|
] extends [Fx.Fx<infer Success, infer Error, infer Services>] ? Fx.Fx<Success, Error, Services> : never;
|
|
7
8
|
type ComponentResult<Args extends ReadonlyArray<any>, Result> = Args extends readonly [] ? Result : (...args: Args) => Result;
|
|
8
9
|
/**
|
|
@@ -17,11 +18,11 @@ type ComponentResult<Args extends ReadonlyArray<any>, Result> = Args extends rea
|
|
|
17
18
|
*
|
|
18
19
|
* ## Ownership and lifetime
|
|
19
20
|
*
|
|
20
|
-
* These types acquire nothing. The `Fx` produced by `component` is lazy;
|
|
21
|
-
*
|
|
21
|
+
* These types acquire nothing. The `Fx` produced by `component` is lazy;
|
|
22
|
+
* each run forks its parent `Scope` for yielded effects, subscriptions, and cleanup.
|
|
22
23
|
*
|
|
23
24
|
* @since 1.0.0
|
|
24
|
-
* @category
|
|
25
|
+
* @category Component construction
|
|
25
26
|
*/
|
|
26
27
|
export declare namespace component {
|
|
27
28
|
/**
|
|
@@ -37,7 +38,8 @@ export declare namespace component {
|
|
|
37
38
|
* ## Ownership and lifetime
|
|
38
39
|
*
|
|
39
40
|
* Calling a `Gen` value constructs a lazy `Fx` and starts no work. Resources
|
|
40
|
-
* yielded by the generator belong to
|
|
41
|
+
* yielded by the generator belong to a child forked from the running Fx's
|
|
42
|
+
* required parent Scope. The returned renderable shares that same child.
|
|
41
43
|
*
|
|
42
44
|
* @example
|
|
43
45
|
* ```ts
|
|
@@ -51,32 +53,32 @@ export declare namespace component {
|
|
|
51
53
|
* ```
|
|
52
54
|
*
|
|
53
55
|
* @since 1.0.0
|
|
54
|
-
* @category
|
|
56
|
+
* @category Generator overloads
|
|
55
57
|
*/
|
|
56
58
|
type Gen = {
|
|
57
|
-
/** Creates a component directly for a zero-argument body. @since 1.0.0 @category
|
|
59
|
+
/** Creates a component directly for a zero-argument body. @since 1.0.0 @category Zero-argument components */
|
|
58
60
|
<Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any>(body: () => Generator<Yield, Result, any>): ComponentFx<Yield, Result>;
|
|
59
|
-
/** Creates a component function while preserving the generator's parameters. @since 1.0.0 @category
|
|
61
|
+
/** Creates a component function while preserving the generator's parameters. @since 1.0.0 @category Parameterized components */
|
|
60
62
|
<Args extends readonly [any, ...ReadonlyArray<any>], Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any>(body: (...args: Args) => Generator<Yield, Result, any>): (...args: Args) => ComponentFx<Yield, Result>;
|
|
61
|
-
/** Applies one argument-aware transformation to the generated Fx. @since 1.0.0 @category
|
|
63
|
+
/** Applies one argument-aware transformation to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
62
64
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A): ComponentResult<Args, A>;
|
|
63
|
-
/** Applies two ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
65
|
+
/** Applies two ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
64
66
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B): ComponentResult<Args, B>;
|
|
65
|
-
/** Applies three ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
67
|
+
/** Applies three ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
66
68
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C): ComponentResult<Args, C>;
|
|
67
|
-
/** Applies four ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
69
|
+
/** Applies four ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
68
70
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D): ComponentResult<Args, D>;
|
|
69
|
-
/** Applies five ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
71
|
+
/** Applies five ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
70
72
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D, E>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D, e: (_: D, ...args: Args) => E): ComponentResult<Args, E>;
|
|
71
|
-
/** Applies six ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
73
|
+
/** Applies six ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
72
74
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D, E, F>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D, e: (_: D, ...args: Args) => E, f: (_: E, ...args: Args) => F): ComponentResult<Args, F>;
|
|
73
|
-
/** Applies seven ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
75
|
+
/** Applies seven ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
74
76
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D, E, F, G>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D, e: (_: D, ...args: Args) => E, f: (_: E, ...args: Args) => F, g: (_: F, ...args: Args) => G): ComponentResult<Args, G>;
|
|
75
|
-
/** Applies eight ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
77
|
+
/** Applies eight ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
76
78
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D, E, F, G, H>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D, e: (_: D, ...args: Args) => E, f: (_: E, ...args: Args) => F, g: (_: F, ...args: Args) => G, h: (_: G, ...args: Args) => H): ComponentResult<Args, H>;
|
|
77
|
-
/** Applies nine ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
79
|
+
/** Applies nine ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
78
80
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D, E, F, G, H, I>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D, e: (_: D, ...args: Args) => E, f: (_: E, ...args: Args) => F, g: (_: F, ...args: Args) => G, h: (_: G, ...args: Args) => H, i: (_: H, ...args: Args) => I): ComponentResult<Args, I>;
|
|
79
|
-
/** Applies ten ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category
|
|
81
|
+
/** Applies ten ordered argument-aware transformations to the generated Fx. @since 1.0.0 @category Argument-aware pipelines */
|
|
80
82
|
<Args extends ReadonlyArray<any>, Yield extends Effect.Effect<any, any, any>, const Result extends Renderable.Any, A, B, C, D, E, F, G, H, I, J>(body: (...args: Args) => Generator<Yield, Result, any>, a: (_: ComponentFx<Yield, Result>, ...args: Args) => A, b: (_: A, ...args: Args) => B, c: (_: B, ...args: Args) => C, d: (_: C, ...args: Args) => D, e: (_: D, ...args: Args) => E, f: (_: E, ...args: Args) => F, g: (_: F, ...args: Args) => G, h: (_: G, ...args: Args) => H, i: (_: H, ...args: Args) => I, j: (_: I, ...args: Args) => J): ComponentResult<Args, J>;
|
|
81
83
|
};
|
|
82
84
|
}
|
|
@@ -96,10 +98,14 @@ export declare namespace component {
|
|
|
96
98
|
*
|
|
97
99
|
* ## Ownership and lifetime
|
|
98
100
|
*
|
|
99
|
-
* Construction is lazy. Each run
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
101
|
+
* Construction is lazy. Each run forks the required parent Scope and provides
|
|
102
|
+
* that child to both yielded effects and the lifted returned renderable. The
|
|
103
|
+
* child stays open throughout subscription and closes on completion, failure,
|
|
104
|
+
* or interruption; closing the parent also closes every child. Sibling runs
|
|
105
|
+
* therefore own separate resources. A DOM template stays subscribed after its
|
|
106
|
+
* first emission, so its child remains open while the template is mounted.
|
|
107
|
+
* Even a scalar component requires Scope. The constructor does not own DOM
|
|
108
|
+
* outside its returned renderable.
|
|
103
109
|
*
|
|
104
110
|
* ## Composition
|
|
105
111
|
*
|
|
@@ -120,7 +126,7 @@ export declare namespace component {
|
|
|
120
126
|
* ```
|
|
121
127
|
*
|
|
122
128
|
* @since 1.0.0
|
|
123
|
-
* @category
|
|
129
|
+
* @category Component construction
|
|
124
130
|
*/
|
|
125
131
|
export declare const component: component.Gen;
|
|
126
132
|
export {};
|
package/dist/Component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../src/Component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../src/Component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEtE,KAAK,WAAW,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,SAAS,UAAU,CAAC,GAAG,IAAI;IAC5F,EAAE,CAAC,EAAE,CACH,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAC1B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,EAC9C,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CACnE;CACF,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,OAAO,EAAE,MAAM,KAAK,EAAE,MAAM,QAAQ,CAAC,CAAC,GACzD,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,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AI,EAAE,IAAI,KAAK,CAAC,EAC7B,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,GAC5B,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;KAC7B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,CAAC,GAwBjC,CAAC"}
|
package/dist/Component.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Scope from "effect/Scope";
|
|
1
3
|
import { Fx } from "@typed/fx";
|
|
2
4
|
import { liftRenderableToFx } from "@typed/template";
|
|
3
5
|
/**
|
|
@@ -16,10 +18,14 @@ import { liftRenderableToFx } from "@typed/template";
|
|
|
16
18
|
*
|
|
17
19
|
* ## Ownership and lifetime
|
|
18
20
|
*
|
|
19
|
-
* Construction is lazy. Each run
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* Construction is lazy. Each run forks the required parent Scope and provides
|
|
22
|
+
* that child to both yielded effects and the lifted returned renderable. The
|
|
23
|
+
* child stays open throughout subscription and closes on completion, failure,
|
|
24
|
+
* or interruption; closing the parent also closes every child. Sibling runs
|
|
25
|
+
* therefore own separate resources. A DOM template stays subscribed after its
|
|
26
|
+
* first emission, so its child remains open while the template is mounted.
|
|
27
|
+
* Even a scalar component requires Scope. The constructor does not own DOM
|
|
28
|
+
* outside its returned renderable.
|
|
23
29
|
*
|
|
24
30
|
* ## Composition
|
|
25
31
|
*
|
|
@@ -40,21 +46,26 @@ import { liftRenderableToFx } from "@typed/template";
|
|
|
40
46
|
* ```
|
|
41
47
|
*
|
|
42
48
|
* @since 1.0.0
|
|
43
|
-
* @category
|
|
49
|
+
* @category Component construction
|
|
44
50
|
*/
|
|
45
51
|
export const component = function (body, ...pipeables) {
|
|
46
52
|
if (body.length === 0) {
|
|
47
|
-
let result =
|
|
48
|
-
const renderable = yield* body();
|
|
49
|
-
return liftRenderableToFx(renderable);
|
|
50
|
-
});
|
|
53
|
+
let result = instance(() => body());
|
|
51
54
|
for (const pipeable of pipeables) {
|
|
52
55
|
result = pipeable(result);
|
|
53
56
|
}
|
|
54
57
|
return result;
|
|
55
58
|
}
|
|
56
|
-
return Fx.fn(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
return Fx.fn(
|
|
60
|
+
// Fx.fn needs a generator; instance owns acquisition inside the child Scope.
|
|
61
|
+
// oxlint-disable-next-line require-yield
|
|
62
|
+
function* (...args) {
|
|
63
|
+
return instance(() => body(...args));
|
|
59
64
|
}, ...pipeables);
|
|
60
65
|
};
|
|
66
|
+
function instance(body) {
|
|
67
|
+
return Fx.make((sink) => Effect.flatMap(Scope.Scope, (parent) => Effect.acquireUseRelease(Scope.fork(parent), (child) => Scope.provide(Fx.gen(function* () {
|
|
68
|
+
const renderable = yield* body();
|
|
69
|
+
return liftRenderableToFx(renderable);
|
|
70
|
+
}).run(sink), child), (child, exit) => Scope.close(child, exit))));
|
|
71
|
+
}
|