foldkit 0.154.0 → 0.155.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.
- package/dist/asyncData/asyncData.d.ts.map +1 -1
- package/dist/brand/brand.d.ts.map +1 -1
- package/dist/calendar/arithmetic.d.ts.map +1 -1
- package/dist/calendar/calendarDate.d.ts.map +1 -1
- package/dist/calendar/comparison.d.ts.map +1 -1
- package/dist/calendar/info.d.ts.map +1 -1
- package/dist/calendar/today.d.ts.map +1 -1
- package/dist/canvas/paint.d.ts.map +1 -1
- package/dist/canvas/view.d.ts.map +1 -1
- package/dist/command/brand.d.ts.map +1 -1
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/interruptible/interruptible.d.ts.map +1 -1
- package/dist/controlledDomState.d.ts.map +1 -1
- package/dist/customElement/index.d.ts +6 -3
- package/dist/customElement/index.d.ts.map +1 -1
- package/dist/devTools/historyQuery.d.ts.map +1 -1
- package/dist/devTools/protocol.d.ts +113 -113
- package/dist/devTools/protocol.d.ts.map +1 -1
- package/dist/devTools/schemaSummarize.d.ts.map +1 -1
- package/dist/devTools/serialize.d.ts.map +1 -1
- package/dist/devTools/store.d.ts.map +1 -1
- package/dist/devTools/submodelPath.d.ts.map +1 -1
- package/dist/devTools/summarize.d.ts +6 -6
- package/dist/devTools/summarize.d.ts.map +1 -1
- package/dist/devTools/webSocketBridge.d.ts +1 -1
- package/dist/devTools/webSocketBridge.d.ts.map +1 -1
- package/dist/devTools/webSocketBridge.js +4 -4
- package/dist/dom/dom.d.ts +11 -5
- package/dist/dom/dom.d.ts.map +1 -1
- package/dist/dom/dom.js +10 -5
- package/dist/dom/elementMovement.d.ts.map +1 -1
- package/dist/dom/inert.d.ts.map +1 -1
- package/dist/dom/waitForAnimation.d.ts.map +1 -1
- package/dist/domReflection.d.ts.map +1 -1
- package/dist/effectExtensions/optionExtensions.d.ts.map +1 -1
- package/dist/effectExtensions/stringExtensions.d.ts.map +1 -1
- package/dist/experimental/machine/machine.d.ts.map +1 -1
- package/dist/experimental/server/entry.d.ts.map +1 -1
- package/dist/experimental/server/host.d.ts.map +1 -1
- package/dist/experimental/server/serialize.d.ts.map +1 -1
- package/dist/experimental/server/server.d.ts.map +1 -1
- package/dist/experimental/server/template.d.ts.map +1 -1
- package/dist/fieldValidation/fieldValidation.d.ts +35 -0
- package/dist/fieldValidation/fieldValidation.d.ts.map +1 -1
- package/dist/fieldValidation/fieldValidation.js +31 -1
- package/dist/fieldValidation/public.d.ts +1 -1
- package/dist/fieldValidation/public.d.ts.map +1 -1
- package/dist/fieldValidation/public.js +1 -1
- package/dist/fieldValidation/rule.d.ts.map +1 -1
- package/dist/file/file.d.ts.map +1 -1
- package/dist/file/reader.d.ts.map +1 -1
- package/dist/file/select.d.ts.map +1 -1
- package/dist/html/boundary.d.ts.map +1 -1
- package/dist/html/childAttribute.d.ts.map +1 -1
- package/dist/html/dragZoneTracking.d.ts +1 -1
- package/dist/html/dragZoneTracking.d.ts.map +1 -1
- package/dist/html/index.d.ts +7 -20
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +12 -15
- package/dist/html/runtimeSingleton.d.ts.map +1 -1
- package/dist/html/submodel.d.ts.map +1 -1
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrationMarkers.d.ts.map +1 -1
- package/dist/managedResource/managedResource.d.ts +5 -3
- package/dist/managedResource/managedResource.d.ts.map +1 -1
- package/dist/managedResource/managedResource.js +5 -3
- package/dist/mount/index.d.ts +167 -114
- package/dist/mount/index.d.ts.map +1 -1
- package/dist/mount/index.js +47 -63
- package/dist/nativeInnerHtml.d.ts.map +1 -1
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/urlRequest.d.ts +2 -2
- package/dist/navigation/urlRequest.d.ts.map +1 -1
- package/dist/port/port.d.ts.map +1 -1
- package/dist/propertyProvenance.d.ts.map +1 -1
- package/dist/propsModule.d.ts.map +1 -1
- package/dist/propsModule.js +3 -3
- package/dist/route/parser.d.ts.map +1 -1
- package/dist/route/transition.d.ts +4 -4
- package/dist/route/transition.d.ts.map +1 -1
- package/dist/runtime/browserListeners.d.ts.map +1 -1
- package/dist/runtime/crashUI.d.ts.map +1 -1
- package/dist/runtime/deepFreeze.d.ts.map +1 -1
- package/dist/runtime/hmrScroll.d.ts.map +1 -1
- package/dist/runtime/preserveScheduler.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +115 -28
- package/dist/runtime/viewTransition.d.ts.map +1 -1
- package/dist/snabbdom/eventlisteners.d.ts.map +1 -1
- package/dist/snabbdom/h.d.ts.map +1 -1
- package/dist/snabbdom/init.d.ts.map +1 -1
- package/dist/snabbdom/init.js +45 -25
- package/dist/snabbdom/vnode.d.ts.map +1 -1
- package/dist/struct/index.d.ts.map +1 -1
- package/dist/subscription/animationFrame.d.ts.map +1 -1
- package/dist/subscription/fromEvent.d.ts.map +1 -1
- package/dist/subscription/subscription.d.ts +2 -2
- package/dist/subscription/subscription.d.ts.map +1 -1
- package/dist/tagName.d.ts.map +1 -1
- package/dist/test/apps/attributes.d.ts.map +1 -1
- package/dist/test/apps/bubbling.d.ts.map +1 -1
- package/dist/test/apps/colorPicker.d.ts +1 -1
- package/dist/test/apps/colorPicker.d.ts.map +1 -1
- package/dist/test/apps/contextMenu.d.ts +6 -6
- package/dist/test/apps/contextMenu.d.ts.map +1 -1
- package/dist/test/apps/contextMenu.js +3 -3
- package/dist/test/apps/counter.d.ts +10 -10
- package/dist/test/apps/counter.d.ts.map +1 -1
- package/dist/test/apps/crashOnRender.d.ts +3 -3
- package/dist/test/apps/crashOnRender.d.ts.map +1 -1
- package/dist/test/apps/drafts.d.ts +2 -2
- package/dist/test/apps/drafts.d.ts.map +1 -1
- package/dist/test/apps/feedSocket.d.ts +15 -15
- package/dist/test/apps/feedSocket.d.ts.map +1 -1
- package/dist/test/apps/fileUpload.d.ts +1 -1
- package/dist/test/apps/fileUpload.d.ts.map +1 -1
- package/dist/test/apps/focusBoundary.d.ts.map +1 -1
- package/dist/test/apps/formChild.d.ts +18 -18
- package/dist/test/apps/formChild.d.ts.map +1 -1
- package/dist/test/apps/interactions.d.ts +7 -7
- package/dist/test/apps/interactions.d.ts.map +1 -1
- package/dist/test/apps/keypress.d.ts +2 -2
- package/dist/test/apps/keypress.d.ts.map +1 -1
- package/dist/test/apps/login.d.ts +12 -12
- package/dist/test/apps/login.d.ts.map +1 -1
- package/dist/test/apps/logoutButton.d.ts.map +1 -1
- package/dist/test/apps/mountPanel.d.ts +9 -9
- package/dist/test/apps/mountPanel.d.ts.map +1 -1
- package/dist/test/apps/mountPanel.js +24 -13
- package/dist/test/apps/multiRole.d.ts.map +1 -1
- package/dist/test/apps/pointer.d.ts +2 -2
- package/dist/test/apps/pointer.d.ts.map +1 -1
- package/dist/test/apps/resumeUpload.d.ts +8 -8
- package/dist/test/apps/resumeUpload.d.ts.map +1 -1
- package/dist/test/apps/scorePanel.d.ts.map +1 -1
- package/dist/test/apps/selectiveKeys.d.ts +2 -2
- package/dist/test/apps/selectiveKeys.d.ts.map +1 -1
- package/dist/test/apps/uploads.d.ts +15 -15
- package/dist/test/apps/uploads.d.ts.map +1 -1
- package/dist/test/apps/uploads.js +3 -3
- package/dist/test/internal.d.ts.map +1 -1
- package/dist/test/matchers.d.ts.map +1 -1
- package/dist/test/query.d.ts.map +1 -1
- package/dist/test/scene.d.ts +136 -58
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +75 -32
- package/dist/test/story.d.ts +30 -5
- package/dist/test/story.d.ts.map +1 -1
- package/dist/update/update.d.ts.map +1 -1
- package/dist/url/index.d.ts.map +1 -1
- package/dist/vdom.d.ts.map +1 -1
- package/dist/vdom.js +6 -8
- package/package.json +6 -8
package/dist/mount/index.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export type MountDefinitionTypeId = typeof MountDefinitionTypeId;
|
|
|
22
22
|
* the element unmounts, the runtime interrupts the fiber, which closes the
|
|
23
23
|
* Stream's scope and runs any registered `acquireRelease` finalizers.
|
|
24
24
|
*
|
|
25
|
-
* Authors
|
|
26
|
-
* `
|
|
25
|
+
* Authors don't construct this shape directly. `Mount.define` builds it from
|
|
26
|
+
* an `execute` returning `Effect<Message>` for the one-shot case; only
|
|
27
27
|
* `Mount.defineStream` exposes the raw Stream shape for continuous-event
|
|
28
28
|
* cases. */
|
|
29
29
|
export type MountAction<Message, E = never> = Readonly<{
|
|
@@ -54,16 +54,34 @@ export interface MountDefinitionWithArgs<Name extends string, Fields extends Sch
|
|
|
54
54
|
* Union over the no-args and with-args shapes; consumers that only need
|
|
55
55
|
* name/identity can accept this. */
|
|
56
56
|
export type MountDefinition<Name extends string = string, ResultMessage = any> = MountDefinitionNoArgs<Name, ResultMessage> | MountDefinitionWithArgs<Name, any, ResultMessage>;
|
|
57
|
+
/** @internal Rejects an args field named `element`. `execute` receives the live
|
|
58
|
+
* element under that name, so an arg of the same name would shadow it. The
|
|
59
|
+
* literal is the type error a colliding declaration produces. */
|
|
60
|
+
type ElementFieldIsReserved = 'Mount args cannot declare `element`: execute already receives the live element';
|
|
57
61
|
/**
|
|
58
|
-
* Defines a one-shot Mount.
|
|
59
|
-
*
|
|
60
|
-
*
|
|
62
|
+
* Defines a one-shot Mount. Every input is a named field: `args` declares the
|
|
63
|
+
* args Schema, `messages` lists the Messages this Mount can produce, and
|
|
64
|
+
* `execute` holds the work. `execute` receives the live `Element` as `element`
|
|
65
|
+
* alongside the declared args, and returns an `Effect<Message>` that runs once
|
|
66
|
+
* when the element mounts and produces exactly one Message.
|
|
67
|
+
*
|
|
68
|
+
* `args` is optional. Omit it and the Definition is callable as `Definition()`;
|
|
69
|
+
* declare it and the Definition is callable as `Definition(args)`. `execute`
|
|
70
|
+
* keeps the same shape either way, because a Mount always has an element. An
|
|
71
|
+
* args field named `element` is rejected where you declare it, since it would
|
|
72
|
+
* collide with the element `execute` receives.
|
|
73
|
+
*
|
|
74
|
+
* Constructing a MountAction never runs `execute`. The runtime calls it when
|
|
75
|
+
* the element enters the DOM, so nothing the body does happens inside the pure
|
|
76
|
+
* view that built the action.
|
|
77
|
+
*
|
|
78
|
+
* Cleanup composes via `Effect.acquireRelease` inside the Effect: registered
|
|
61
79
|
* finalizers run when the element unmounts. The Mount's scope stays open
|
|
62
80
|
* across the element's full lifetime, even after the Effect completes.
|
|
63
81
|
*
|
|
64
82
|
* At least one result Message schema is required. The Effect's success
|
|
65
|
-
* type is `Schema.Schema.Type<
|
|
66
|
-
* result,
|
|
83
|
+
* type is `Schema.Schema.Type<Messages[number]>`; without a declared
|
|
84
|
+
* result, `execute` would have to return `Effect.never`, leaving
|
|
67
85
|
* `update` with no record of the work and removing DevTools, Scene,
|
|
68
86
|
* and time-travel replay's reference point. Fire-and-forget Mounts
|
|
69
87
|
* follow the same convention as fire-and-forget Commands: declare a
|
|
@@ -71,15 +89,14 @@ export type MountDefinition<Name extends string = string, ResultMessage = any> =
|
|
|
71
89
|
* effect stays observable; `update` simply has nothing meaningful to
|
|
72
90
|
* do with the acknowledgment.
|
|
73
91
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* `
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* and using `release` only for self-contained teardown.
|
|
92
|
+
* Cleanup is asynchronous with respect to snabbdom's `destroy` hook: the
|
|
93
|
+
* runtime forks `Fiber.interrupt` and returns immediately, so finalizers run
|
|
94
|
+
* on a separate fiber after `destroy` has already completed. For idempotent
|
|
95
|
+
* DOM operations (`element.remove()`, observer `disconnect()`,
|
|
96
|
+
* `removeEventListener`) this is fine; if your cleanup has ordering
|
|
97
|
+
* requirements relative to other DOM removals, prefer doing the imperative
|
|
98
|
+
* work synchronously inside `acquire` and using `release` only for
|
|
99
|
+
* self-contained teardown.
|
|
83
100
|
*
|
|
84
101
|
* **Construct resources INSIDE the acquire body, never before it.**
|
|
85
102
|
* `Effect.acquireRelease` only guarantees atomicity of "acquire body
|
|
@@ -100,20 +117,20 @@ export type MountDefinition<Name extends string = string, ResultMessage = any> =
|
|
|
100
117
|
*
|
|
101
118
|
* @example One-shot, no cleanup (read element geometry on mount)
|
|
102
119
|
* ```ts
|
|
103
|
-
* const MeasurePanelWidth = Mount.define(
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* )
|
|
120
|
+
* const MeasurePanelWidth = Mount.define('MeasurePanelWidth', {
|
|
121
|
+
* messages: [MeasuredPanelWidth],
|
|
122
|
+
* execute: ({ element }) =>
|
|
123
|
+
* Effect.sync(() =>
|
|
124
|
+
* MeasuredPanelWidth({ width: element.getBoundingClientRect().width }),
|
|
125
|
+
* ),
|
|
126
|
+
* })
|
|
111
127
|
* ```
|
|
112
128
|
*
|
|
113
129
|
* @example One-shot with cleanup (portal-to-body)
|
|
114
130
|
* ```ts
|
|
115
|
-
* const PortalToBody = Mount.define('PortalToBody',
|
|
116
|
-
*
|
|
131
|
+
* const PortalToBody = Mount.define('PortalToBody', {
|
|
132
|
+
* messages: [CompletedPortalToBody],
|
|
133
|
+
* execute: ({ element }) =>
|
|
117
134
|
* Effect.gen(function* () {
|
|
118
135
|
* yield* Effect.acquireRelease(
|
|
119
136
|
* Effect.sync(() => document.body.appendChild(element)),
|
|
@@ -121,27 +138,26 @@ export type MountDefinition<Name extends string = string, ResultMessage = any> =
|
|
|
121
138
|
* )
|
|
122
139
|
* return CompletedPortalToBody()
|
|
123
140
|
* }),
|
|
124
|
-
* )
|
|
141
|
+
* })
|
|
125
142
|
* ```
|
|
126
143
|
*
|
|
127
144
|
* @example With args
|
|
128
145
|
* ```ts
|
|
129
|
-
* const AnchorPopover = Mount.define(
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* )
|
|
146
|
+
* const AnchorPopover = Mount.define('AnchorPopover', {
|
|
147
|
+
* args: { buttonId: S.String, anchor: AnchorConfig },
|
|
148
|
+
* messages: [CompletedAnchorPopover],
|
|
149
|
+
* execute: ({ element, buttonId, anchor }) =>
|
|
150
|
+
* Effect.gen(function* () {
|
|
151
|
+
* yield* Effect.acquireRelease(
|
|
152
|
+
* Effect.sync(() => anchorSetup(element, { buttonId, anchor })),
|
|
153
|
+
* cleanup => Effect.sync(cleanup),
|
|
154
|
+
* )
|
|
155
|
+
* return CompletedAnchorPopover()
|
|
156
|
+
* }),
|
|
157
|
+
* })
|
|
142
158
|
* ```
|
|
143
159
|
*
|
|
144
|
-
* **Args are captured at mount, not refreshed across renders.**
|
|
160
|
+
* **Args are captured at mount, not refreshed across renders.** `execute`
|
|
145
161
|
* runs once when the element enters the DOM. Subsequent renders construct
|
|
146
162
|
* fresh `MountAction` values with updated arg values, but those values are
|
|
147
163
|
* captured in closures that never execute. `OnMount` only binds to
|
|
@@ -164,19 +180,46 @@ export type MountDefinition<Name extends string = string, ResultMessage = any> =
|
|
|
164
180
|
* applying `user-select: none` to the document while a drag is in progress
|
|
165
181
|
* and undoing it when the drag ends).)
|
|
166
182
|
*/
|
|
167
|
-
export declare function define<const Name extends string,
|
|
168
|
-
|
|
183
|
+
export declare function define<const Name extends string, Fields extends Schema.Struct.Fields, const Messages extends readonly [Schema.Top, ...ReadonlyArray<Schema.Top>]>(name: Name, config: Readonly<{
|
|
184
|
+
args: Fields & Readonly<{
|
|
185
|
+
element?: ElementFieldIsReserved;
|
|
186
|
+
}>;
|
|
187
|
+
messages: Messages;
|
|
188
|
+
execute: (input: Readonly<{
|
|
189
|
+
element: Element;
|
|
190
|
+
}> & Schema.Schema.Type<Schema.Struct<Fields>>) => Effect.Effect<Schema.Schema.Type<Messages[number]>, never, Scope.Scope>;
|
|
191
|
+
}>): MountDefinitionWithArgs<Name, Fields, Schema.Schema.Type<Messages[number]>>;
|
|
192
|
+
export declare function define<const Name extends string, const Messages extends readonly [Schema.Top, ...ReadonlyArray<Schema.Top>]>(name: Name, config: Readonly<{
|
|
193
|
+
args?: never;
|
|
194
|
+
messages: Messages;
|
|
195
|
+
execute: (input: Readonly<{
|
|
196
|
+
element: Element;
|
|
197
|
+
}>) => Effect.Effect<Schema.Schema.Type<Messages[number]>, never, Scope.Scope>;
|
|
198
|
+
}>): MountDefinitionNoArgs<Name, Schema.Schema.Type<Messages[number]>>;
|
|
169
199
|
/**
|
|
170
|
-
* Defines a streaming Mount.
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* `
|
|
174
|
-
*
|
|
175
|
-
*
|
|
200
|
+
* Defines a streaming Mount. Every input is a named field, exactly as in
|
|
201
|
+
* `Mount.define`: `args` declares the args Schema, `messages` lists the
|
|
202
|
+
* Messages this Mount can produce, and `execute` holds the work. `execute`
|
|
203
|
+
* receives the live `Element` as `element` alongside the declared args, and
|
|
204
|
+
* returns a `Stream<Message>` whose lifetime is bound to the element's
|
|
205
|
+
* lifetime: each emitted Message is dispatched, and the Stream's scope is
|
|
206
|
+
* closed (running any registered `Effect.acquireRelease` finalizers) when the
|
|
207
|
+
* element unmounts. Use this form when the Mount emits a continuum of events
|
|
208
|
+
* from observers or listeners attached to the element.
|
|
209
|
+
*
|
|
210
|
+
* `args` is optional. Omit it and the Definition is callable as `Definition()`;
|
|
211
|
+
* declare it and the Definition is callable as `Definition(args)`. `execute`
|
|
212
|
+
* keeps the same shape either way, because a Mount always has an element. An
|
|
213
|
+
* args field named `element` is rejected where you declare it, since it would
|
|
214
|
+
* collide with the element `execute` receives.
|
|
215
|
+
*
|
|
216
|
+
* Constructing a MountAction never runs `execute`. The runtime calls it when
|
|
217
|
+
* the element enters the DOM, so nothing the body does happens inside the pure
|
|
218
|
+
* view that built the action.
|
|
176
219
|
*
|
|
177
220
|
* At least one result Message schema is required. The Stream's emission
|
|
178
|
-
* type is `Schema.Schema.Type<
|
|
179
|
-
* result,
|
|
221
|
+
* type is `Schema.Schema.Type<Messages[number]>`; without a declared
|
|
222
|
+
* result, `execute` would have to return `Stream<never>`, leaving
|
|
180
223
|
* `update` with no record of the work and removing DevTools, Scene,
|
|
181
224
|
* and time-travel replay's reference point. Fire-and-forget Mounts
|
|
182
225
|
* follow the same convention as fire-and-forget Commands: declare a
|
|
@@ -184,10 +227,8 @@ export declare function define<const Name extends string, Fields extends Schema.
|
|
|
184
227
|
* effect stays observable; `update` simply has nothing meaningful to
|
|
185
228
|
* do with the acknowledgment. Re-check the cause.
|
|
186
229
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* snabbdom's `destroy` hook is the same as `Mount.define` (asynchronous via
|
|
190
|
-
* `Fiber.interrupt`).
|
|
230
|
+
* Cleanup timing relative to snabbdom's `destroy` hook is the same as
|
|
231
|
+
* `Mount.define` (asynchronous via `Fiber.interrupt`).
|
|
191
232
|
*
|
|
192
233
|
* For a Mount that produces exactly one Message at acquire and then holds
|
|
193
234
|
* lifecycle-scoped resources, use `Mount.define` with `Effect<Message>`.
|
|
@@ -196,75 +237,87 @@ export declare function define<const Name extends string, Fields extends Schema.
|
|
|
196
237
|
*
|
|
197
238
|
* @example Continuous scroll events from an element
|
|
198
239
|
* ```ts
|
|
199
|
-
* const SyncSidebarScroll = Mount.defineStream(
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* )
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* )
|
|
240
|
+
* const SyncSidebarScroll = Mount.defineStream('SyncSidebarScroll', {
|
|
241
|
+
* messages: [ScrolledSidebar],
|
|
242
|
+
* execute: ({ element }) =>
|
|
243
|
+
* Stream.callback<typeof ScrolledSidebar.Type>(queue =>
|
|
244
|
+
* Effect.gen(function* () {
|
|
245
|
+
* yield* Effect.acquireRelease(
|
|
246
|
+
* Effect.sync(() => {
|
|
247
|
+
* const handler = () =>
|
|
248
|
+
* Queue.offerUnsafe(
|
|
249
|
+
* queue,
|
|
250
|
+
* ScrolledSidebar({ scroll: element.scrollTop }),
|
|
251
|
+
* )
|
|
252
|
+
* element.addEventListener('scroll', handler, { passive: true })
|
|
253
|
+
* return handler
|
|
254
|
+
* }),
|
|
255
|
+
* handler =>
|
|
256
|
+
* Effect.sync(() =>
|
|
257
|
+
* element.removeEventListener('scroll', handler),
|
|
258
|
+
* ),
|
|
259
|
+
* )
|
|
260
|
+
* return yield* Effect.never
|
|
261
|
+
* }),
|
|
262
|
+
* ),
|
|
263
|
+
* })
|
|
224
264
|
* ```
|
|
225
265
|
*
|
|
226
266
|
* @example IntersectionObserver events
|
|
227
267
|
* ```ts
|
|
228
|
-
* const ObserveHeroVisibility = Mount.defineStream(
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* )
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
* )
|
|
268
|
+
* const ObserveHeroVisibility = Mount.defineStream('ObserveHeroVisibility', {
|
|
269
|
+
* messages: [ChangedHeroVisibility],
|
|
270
|
+
* execute: ({ element }) =>
|
|
271
|
+
* Stream.callback<typeof ChangedHeroVisibility.Type>(queue =>
|
|
272
|
+
* Effect.gen(function* () {
|
|
273
|
+
* yield* Effect.acquireRelease(
|
|
274
|
+
* Effect.sync(() => {
|
|
275
|
+
* const observer = new IntersectionObserver(entries => {
|
|
276
|
+
* pipe(
|
|
277
|
+
* Array.head(entries),
|
|
278
|
+
* Option.match({
|
|
279
|
+
* onNone: Function.constVoid,
|
|
280
|
+
* onSome: entry =>
|
|
281
|
+
* Queue.offerUnsafe(
|
|
282
|
+
* queue,
|
|
283
|
+
* ChangedHeroVisibility({
|
|
284
|
+
* isVisible: entry.isIntersecting,
|
|
285
|
+
* }),
|
|
286
|
+
* ),
|
|
287
|
+
* }),
|
|
288
|
+
* )
|
|
289
|
+
* })
|
|
290
|
+
* observer.observe(element)
|
|
291
|
+
* return observer
|
|
292
|
+
* }),
|
|
293
|
+
* observer => Effect.sync(() => observer.disconnect()),
|
|
294
|
+
* )
|
|
295
|
+
* return yield* Effect.never
|
|
296
|
+
* }),
|
|
297
|
+
* ),
|
|
298
|
+
* })
|
|
260
299
|
* ```
|
|
261
300
|
*
|
|
262
301
|
* The args-captured-at-mount and Subscriptions-vs-Mount guidance from
|
|
263
302
|
* `Mount.define` apply identically here. See that constructor's docs for
|
|
264
303
|
* the mental model.
|
|
265
304
|
*/
|
|
266
|
-
export declare function defineStream<const Name extends string,
|
|
267
|
-
|
|
305
|
+
export declare function defineStream<const Name extends string, Fields extends Schema.Struct.Fields, const Messages extends readonly [Schema.Top, ...ReadonlyArray<Schema.Top>]>(name: Name, config: Readonly<{
|
|
306
|
+
args: Fields & Readonly<{
|
|
307
|
+
element?: ElementFieldIsReserved;
|
|
308
|
+
}>;
|
|
309
|
+
messages: Messages;
|
|
310
|
+
execute: (input: Readonly<{
|
|
311
|
+
element: Element;
|
|
312
|
+
}> & Schema.Schema.Type<Schema.Struct<Fields>>) => Stream.Stream<Schema.Schema.Type<Messages[number]>, never, never>;
|
|
313
|
+
}>): MountDefinitionWithArgs<Name, Fields, Schema.Schema.Type<Messages[number]>>;
|
|
314
|
+
export declare function defineStream<const Name extends string, const Messages extends readonly [Schema.Top, ...ReadonlyArray<Schema.Top>]>(name: Name, config: Readonly<{
|
|
315
|
+
args?: never;
|
|
316
|
+
messages: Messages;
|
|
317
|
+
execute: (input: Readonly<{
|
|
318
|
+
element: Element;
|
|
319
|
+
}>) => Stream.Stream<Schema.Schema.Type<Messages[number]>, never, never>;
|
|
320
|
+
}>): MountDefinitionNoArgs<Name, Schema.Schema.Type<Messages[number]>>;
|
|
268
321
|
/** Lifts a `MountAction` from one Message universe to another by mapping its
|
|
269
322
|
* dispatched Messages through a transform. Used by Submodel components to
|
|
270
323
|
* emit lifecycle action results into the parent's Message union via the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EAIN,MAAM,EACN,KAAK,EACL,MAAM,EACP,MAAM,QAAQ,CAAA;;sBAWO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI;oBACxD,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI;;AAV1E;;;;;4CAK4C;AAC5C,qBAAa,YAAa,SAAQ,iBAMN;CAAG;AAE/B,mDAAmD;AAEnD,eAAO,MAAM,qBAAqB,EAAE,OAAO,MAEN,CAAA;AAErC,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAA;AAEhE;;;;;;;;;;aAUa;AACb,MAAM,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,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EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;CAU9E,CAAA"}
|
package/dist/mount/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, Effect, Function, Predicate, Queue,
|
|
1
|
+
import { Context, Effect, Function, Predicate, Queue, Stream, } from 'effect';
|
|
2
2
|
/** Effect service tag that observes Mount lifecycle events. The runtime
|
|
3
3
|
* provides an implementation that buffers events for DevTools history;
|
|
4
4
|
* the OnMount snabbdom hooks call `started` synchronously when an element
|
|
@@ -10,78 +10,62 @@ export class MountTracker extends Context.Service()('@foldkit/MountTracker') {
|
|
|
10
10
|
/** Type-level brand for MountDefinition values. */
|
|
11
11
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
12
12
|
export const MountDefinitionTypeId = Symbol.for('foldkit/MountDefinition');
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/** @internal Stamps a callable Definition with its Mount name and the
|
|
14
|
+
* {@link MountDefinitionTypeId} brand, so `Scene` matchers and the runtime
|
|
15
|
+
* recognise it. Internal to the Mount module. */
|
|
16
|
+
const brandAsDefinition = (definition, name) => {
|
|
17
|
+
Object.defineProperty(definition, 'name', {
|
|
18
|
+
value: name,
|
|
19
|
+
configurable: true,
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(definition, MountDefinitionTypeId, {
|
|
22
|
+
value: MountDefinitionTypeId,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const wrapEffectAsStream = (toEffect) => (element) => Stream.callback(queue => Effect.gen(function* () {
|
|
26
|
+
const message = yield* toEffect(element);
|
|
15
27
|
Queue.offerUnsafe(queue, message);
|
|
16
28
|
return yield* Effect.never;
|
|
17
29
|
}));
|
|
18
|
-
export function define(name,
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
args,
|
|
26
|
-
f: wrapEffectAsStream(factoryBuilder(args)),
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(definition, 'name', {
|
|
29
|
-
value: name,
|
|
30
|
-
configurable: true,
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(definition, MountDefinitionTypeId, {
|
|
33
|
-
value: MountDefinitionTypeId,
|
|
34
|
-
});
|
|
35
|
-
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
36
|
-
return definition;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return (factory) => {
|
|
40
|
-
const definition = () => ({ name, f: wrapEffectAsStream(factory) });
|
|
41
|
-
Object.defineProperty(definition, 'name', {
|
|
42
|
-
value: name,
|
|
43
|
-
configurable: true,
|
|
30
|
+
export function define(name, config) {
|
|
31
|
+
const isArgsDeclared = Predicate.isNotUndefined(config.args);
|
|
32
|
+
if (isArgsDeclared) {
|
|
33
|
+
const definition = (args) => ({
|
|
34
|
+
name,
|
|
35
|
+
args,
|
|
36
|
+
f: wrapEffectAsStream(element => config.execute({ ...args, element })),
|
|
44
37
|
});
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
brandAsDefinition(definition, name);
|
|
39
|
+
return definition;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const definition = () => ({
|
|
43
|
+
name,
|
|
44
|
+
f: wrapEffectAsStream(element => config.execute({ element })),
|
|
47
45
|
});
|
|
48
|
-
|
|
46
|
+
brandAsDefinition(definition, name);
|
|
49
47
|
return definition;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export function defineStream(name, ...rest) {
|
|
53
|
-
const [maybeArgs] = rest;
|
|
54
|
-
const isArgsRecord = Predicate.isObject(maybeArgs) && !Schema.isSchema(maybeArgs);
|
|
55
|
-
if (isArgsRecord) {
|
|
56
|
-
return (factoryBuilder) => {
|
|
57
|
-
const definition = (args) => ({
|
|
58
|
-
name,
|
|
59
|
-
args,
|
|
60
|
-
f: factoryBuilder(args),
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(definition, 'name', {
|
|
63
|
-
value: name,
|
|
64
|
-
configurable: true,
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(definition, MountDefinitionTypeId, {
|
|
67
|
-
value: MountDefinitionTypeId,
|
|
68
|
-
});
|
|
69
|
-
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
70
|
-
return definition;
|
|
71
|
-
};
|
|
72
48
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
49
|
+
}
|
|
50
|
+
export function defineStream(name, config) {
|
|
51
|
+
const isArgsDeclared = Predicate.isNotUndefined(config.args);
|
|
52
|
+
if (isArgsDeclared) {
|
|
53
|
+
const definition = (args) => ({
|
|
54
|
+
name,
|
|
55
|
+
args,
|
|
56
|
+
f: (element) => config.execute({ ...args, element }),
|
|
78
57
|
});
|
|
79
|
-
|
|
80
|
-
|
|
58
|
+
brandAsDefinition(definition, name);
|
|
59
|
+
return definition;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const definition = () => ({
|
|
63
|
+
name,
|
|
64
|
+
f: (element) => config.execute({ element }),
|
|
81
65
|
});
|
|
82
|
-
|
|
66
|
+
brandAsDefinition(definition, name);
|
|
83
67
|
return definition;
|
|
84
|
-
}
|
|
68
|
+
}
|
|
85
69
|
}
|
|
86
70
|
/** Lifts a `MountAction` from one Message universe to another by mapping its
|
|
87
71
|
* dispatched Messages through a transform. Used by Submodel components to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeInnerHtml.d.ts","sourceRoot":"","sources":["../src/nativeInnerHtml.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"nativeInnerHtml.d.ts","sourceRoot":"","sources":["../src/nativeInnerHtml.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,YAAa,OAAO,KAAG,MAGtD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,YAAa,OAAO,SAAS,MAAM,KAAG,IAEtE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,sFAAsF;AACtF,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,sFAAsF;AACtF,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAIpD,CAAA;AAEJ,8FAA8F;AAC9F,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAIvD,CAAA;AAEJ,yCAAyC;AACzC,eAAO,MAAM,IAAI,QAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CACA,CAAA;AAE1C,4CAA4C;AAC5C,eAAO,MAAM,OAAO,QAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CACA,CAAA;AAE7C,yDAAyD;AACzD,eAAO,MAAM,IAAI,SAAU,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACL,CAAA;AAEjD;4GAC4G;AAC5G,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAGrD,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { Schema as S } from 'effect';
|
|
|
2
2
|
/** Union of `Internal` and `External` URL request types. */
|
|
3
3
|
export declare const UrlRequest: import("../schema/index.js").TaggedUnion<{
|
|
4
4
|
readonly Internal: {
|
|
5
|
-
|
|
5
|
+
url: S.Struct<{
|
|
6
6
|
readonly protocol: S.String;
|
|
7
7
|
readonly host: S.String;
|
|
8
8
|
readonly port: S.Option<S.String>;
|
|
@@ -12,7 +12,7 @@ export declare const UrlRequest: import("../schema/index.js").TaggedUnion<{
|
|
|
12
12
|
}>;
|
|
13
13
|
};
|
|
14
14
|
readonly External: {
|
|
15
|
-
|
|
15
|
+
href: S.String;
|
|
16
16
|
};
|
|
17
17
|
}>;
|
|
18
18
|
/** Union of `Internal` and `External` URL request types. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlRequest.d.ts","sourceRoot":"","sources":["../../src/navigation/urlRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAKpC,4DAA4D;AAC5D,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"urlRequest.d.ts","sourceRoot":"","sources":["../../src/navigation/urlRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAKpC,4DAA4D;AAC5D,eAAO,MAAM,UAAU;;QACT,GAAG;;;;;;;;;;QACH,IAAI;;EAChB,CAAA;AACF,4DAA4D;AAC5D,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA"}
|
package/dist/port/port.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/port/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAIvE,gDAAgD;AAEhD,eAAO,MAAM,aAAa,EAAE,OAAO,MAEN,CAAA;AAE7B,gDAAgD;AAChD,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AAM,YAAY,GAAI,KAAK,EAAE,OAAO,EAAE,OAAO,QAC5C,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,aAClB,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,oHACc,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,EAAE,OAAO,QAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,SACvB,KAAK,KACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAcjB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyProvenance.d.ts","sourceRoot":"","sources":["../src/propertyProvenance.ts"],"names":[],"mappings":"AAgCA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"propertyProvenance.d.ts","sourceRoot":"","sources":["../src/propertyProvenance.ts"],"names":[],"mappings":"AAgCA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,UACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SACvB,MAAM,KACZ,IAIF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,UAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QACxB,MAAM,KACX,IAOF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,UAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QACxB,MAAM,KACX,IAEF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UACvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,KACnD,OASF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,UACxB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,QAC9C,MAAM,KACX,OAKF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propsModule.d.ts","sourceRoot":"","sources":["../src/propsModule.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"propsModule.d.ts","sourceRoot":"","sources":["../src/propsModule.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAyNjD,eAAO,MAAM,WAAW,EAAE,MAIzB,CAAA"}
|
package/dist/propsModule.js
CHANGED
|
@@ -13,9 +13,9 @@ const writeProperty = (element, name, value) => {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
17
|
+
const elementProperties = element;
|
|
18
|
+
elementProperties[name] = value;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const isAutonomousCustomElement = (element) => (element.namespaceURI === null || element.namespaceURI === HTML_NAMESPACE) &&
|