foldkit 0.162.0 → 0.163.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/README.md +4 -4
- package/dist/asyncData/asyncData.d.ts +1 -1
- package/dist/asyncData/asyncData.js +1 -1
- package/dist/devTools/store.d.ts.map +1 -1
- package/dist/devTools/store.js +16 -16
- package/dist/experimental/machine/machine.d.ts +4 -4
- package/dist/experimental/machine/machine.js +3 -3
- package/dist/experimental/server/server.d.ts +9 -6
- package/dist/experimental/server/server.d.ts.map +1 -1
- package/dist/experimental/server/server.js +3 -28
- package/dist/html/index.d.ts +31 -20
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +1 -1
- package/dist/runtime/deepFreeze.d.ts +1 -1
- package/dist/runtime/deepFreeze.js +1 -1
- package/dist/runtime/documentMetadata.d.ts.map +1 -1
- package/dist/runtime/documentMetadata.js +69 -47
- package/dist/runtime/managedResourceFibers.d.ts +1 -1
- package/dist/runtime/managedResourceFibers.d.ts.map +1 -1
- package/dist/runtime/managedResourceFibers.js +3 -2
- package/dist/runtime/subscriptionFibers.d.ts +1 -1
- package/dist/runtime/subscriptionFibers.d.ts.map +1 -1
- package/dist/runtime/subscriptionFibers.js +3 -2
- package/dist/struct/index.d.ts +4 -4
- package/dist/struct/index.d.ts.map +1 -1
- package/dist/struct/index.js +4 -4
- package/dist/struct/public.d.ts +1 -1
- package/dist/struct/public.d.ts.map +1 -1
- package/dist/struct/public.js +1 -1
- package/dist/submodel/submodel.d.ts +3 -3
- package/dist/subscription/fromEvent.d.ts +47 -33
- package/dist/subscription/fromEvent.d.ts.map +1 -1
- package/dist/subscription/fromEvent.js +30 -25
- package/dist/subscription/keyBindings.d.ts +13 -11
- package/dist/subscription/keyBindings.d.ts.map +1 -1
- package/dist/subscription/keyBindings.js +9 -7
- package/dist/subscription/public.d.ts +1 -1
- package/dist/subscription/public.d.ts.map +1 -1
- package/dist/test/apps/bubbling.js +5 -5
- package/dist/test/apps/colorPicker.js +2 -2
- package/dist/test/apps/contentEditableEditor.js +3 -3
- package/dist/test/apps/contextMenu.js +2 -2
- package/dist/test/apps/counter.d.ts.map +1 -1
- package/dist/test/apps/counter.js +8 -5
- package/dist/test/apps/crashOnRender.js +3 -3
- package/dist/test/apps/drafts.js +3 -3
- package/dist/test/apps/feedSocket.js +5 -5
- package/dist/test/apps/fileUpload.js +2 -2
- package/dist/test/apps/focusBoundary.js +3 -3
- package/dist/test/apps/formChild.js +4 -4
- package/dist/test/apps/interactions.js +7 -7
- package/dist/test/apps/keypress.js +3 -3
- package/dist/test/apps/keypressSelf.js +2 -2
- package/dist/test/apps/login.js +7 -7
- package/dist/test/apps/mountPanel.js +4 -4
- package/dist/test/apps/multiRole.js +2 -2
- package/dist/test/apps/pointer.d.ts +5 -1
- package/dist/test/apps/pointer.d.ts.map +1 -1
- package/dist/test/apps/pointer.js +16 -7
- package/dist/test/apps/resumeUpload.js +5 -5
- package/dist/test/apps/scorePanel.js +2 -2
- package/dist/test/apps/selectiveKeys.d.ts.map +1 -1
- package/dist/test/apps/selectiveKeys.js +5 -3
- package/dist/test/apps/uploads.d.ts.map +1 -1
- package/dist/test/apps/uploads.js +13 -7
- package/dist/test/query.js +5 -5
- package/dist/test/scene.d.ts +6 -2
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +27 -3
- package/dist/update/update.d.ts +4 -4
- package/dist/update/update.js +3 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ import { Schema } from 'effect'
|
|
|
45
45
|
import { Runtime, Update } from 'foldkit'
|
|
46
46
|
import { Document, HtmlBuilder } from 'foldkit/html'
|
|
47
47
|
import { defineMessageUnion } from 'foldkit/message'
|
|
48
|
-
import {
|
|
48
|
+
import { modifyFields } from 'foldkit/struct'
|
|
49
49
|
|
|
50
50
|
// MODEL
|
|
51
51
|
|
|
@@ -66,12 +66,12 @@ export type Message = typeof Message.Type
|
|
|
66
66
|
export const update = (model: Model, message: Message) =>
|
|
67
67
|
Message.match<Update.Return<Model, Message>>(message, {
|
|
68
68
|
ClickedDecrement: () => ({
|
|
69
|
-
model:
|
|
69
|
+
model: modifyFields(model, { count: count => count - 1 }),
|
|
70
70
|
}),
|
|
71
71
|
ClickedIncrement: () => ({
|
|
72
|
-
model:
|
|
72
|
+
model: modifyFields(model, { count: count => count + 1 }),
|
|
73
73
|
}),
|
|
74
|
-
ClickedReset: () => ({ model:
|
|
74
|
+
ClickedReset: () => ({ model: modifyFields(model, { count: () => 0 }) }),
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
// INIT
|
|
@@ -407,7 +407,7 @@ export declare const all: <const Inputs extends Iterable<AsyncData<any, any>> |
|
|
|
407
407
|
*
|
|
408
408
|
* // One update arm folds it in, whatever the previous state was:
|
|
409
409
|
* SettledLoadNotes: ({ result }) => ({
|
|
410
|
-
* model:
|
|
410
|
+
* model: modifyFields(model, { notes: AsyncData.settle(result) }),
|
|
411
411
|
* })
|
|
412
412
|
* ```
|
|
413
413
|
*/
|
|
@@ -418,7 +418,7 @@ export const all = (inputs) => {
|
|
|
418
418
|
*
|
|
419
419
|
* // One update arm folds it in, whatever the previous state was:
|
|
420
420
|
* SettledLoadNotes: ({ result }) => ({
|
|
421
|
-
* model:
|
|
421
|
+
* model: modifyFields(model, { notes: AsyncData.settle(result) }),
|
|
422
422
|
* })
|
|
423
423
|
* ```
|
|
424
424
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/devTools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,OAAO,EACP,OAAO,EAEP,MAAM,EAIN,eAAe,EAEhB,MAAM,QAAQ,CAAA;AAIf,eAAO,MAAM,UAAU,KAAK,CAAA;AAM5B,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,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Map, HashSet, Match, Option, Predicate, Record, String, SubscriptionRef, pipe, } from 'effect';
|
|
2
|
-
import {
|
|
2
|
+
import { modifyFields } from '../struct/index.js';
|
|
3
3
|
export const INIT_INDEX = -1;
|
|
4
4
|
const DEFAULT_KEYFRAME_INTERVAL = 31;
|
|
5
5
|
const DEFAULT_MAX_ENTRIES = 100;
|
|
@@ -126,14 +126,14 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
126
126
|
const nextStartIndex = state.startIndex + keyframeInterval;
|
|
127
127
|
const isPausedAtRetainedIndex = state.pausedAtIndex >= nextStartIndex ||
|
|
128
128
|
state.pausedAtIndex === INIT_INDEX;
|
|
129
|
-
return
|
|
129
|
+
return modifyFields(state, {
|
|
130
130
|
entries: Array.drop(keyframeInterval),
|
|
131
131
|
keyframes: HashMap.remove(state.startIndex),
|
|
132
132
|
startIndex: () => nextStartIndex,
|
|
133
133
|
isPaused: isPaused => isPaused && isPausedAtRetainedIndex,
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
|
-
const recordInit = (model, commands, mountStarts = []) => SubscriptionRef.update(stateRef, state =>
|
|
136
|
+
const recordInit = (model, commands, mountStarts = []) => SubscriptionRef.update(stateRef, state => modifyFields(state, {
|
|
137
137
|
maybeInitModel: () => Option.some(model),
|
|
138
138
|
initCommands: () => commands,
|
|
139
139
|
initMountStarts: () => mountStarts,
|
|
@@ -147,7 +147,7 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
147
147
|
? computeDiff(modelBeforeUpdate, modelAfterUpdate)
|
|
148
148
|
: emptyDiff;
|
|
149
149
|
const hasChangedFields = HashSet.size(diff.changedPaths) > 0;
|
|
150
|
-
const nextState =
|
|
150
|
+
const nextState = modifyFields(state, {
|
|
151
151
|
entries: Array.append({
|
|
152
152
|
tag: message._tag,
|
|
153
153
|
message,
|
|
@@ -171,12 +171,12 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
const recordResolvedCommand = (id, submodelPath) => SubscriptionRef.update(stateRef, state => {
|
|
174
|
-
const updateCommands = (commands) => pipe(commands, Array.findFirstIndex(command => command.id === id), Option.flatMap(index => Array.modify(commands, index, command =>
|
|
174
|
+
const updateCommands = (commands) => pipe(commands, Array.findFirstIndex(command => command.id === id), Option.flatMap(index => Array.modify(commands, index, command => modifyFields(command, {
|
|
175
175
|
maybeSubmodelPath: () => Option.some(submodelPath),
|
|
176
176
|
}))));
|
|
177
177
|
const maybeInitCommands = updateCommands(state.initCommands);
|
|
178
178
|
if (Option.isSome(maybeInitCommands)) {
|
|
179
|
-
return
|
|
179
|
+
return modifyFields(state, {
|
|
180
180
|
initCommands: () => maybeInitCommands.value,
|
|
181
181
|
});
|
|
182
182
|
}
|
|
@@ -186,11 +186,11 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
186
186
|
}
|
|
187
187
|
const maybeEntries = Array.modify(state.entries, maybeEntryIndex.value, entry => Option.match(updateCommands(entry.commands), {
|
|
188
188
|
onNone: () => entry,
|
|
189
|
-
onSome: nextCommands =>
|
|
189
|
+
onSome: nextCommands => modifyFields(entry, { commands: () => nextCommands }),
|
|
190
190
|
}));
|
|
191
191
|
return Option.match(maybeEntries, {
|
|
192
192
|
onNone: () => state,
|
|
193
|
-
onSome: nextEntries =>
|
|
193
|
+
onSome: nextEntries => modifyFields(state, { entries: () => nextEntries }),
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
196
|
/** Attaches Mount lifecycle events from the most recent render to the
|
|
@@ -209,11 +209,11 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
209
209
|
return state;
|
|
210
210
|
}
|
|
211
211
|
return Array.match(state.entries, {
|
|
212
|
-
onEmpty: () =>
|
|
212
|
+
onEmpty: () => modifyFields(state, {
|
|
213
213
|
initMountStarts: Array.appendAll(mountStarts),
|
|
214
214
|
}),
|
|
215
|
-
onNonEmpty: entries =>
|
|
216
|
-
entries: () => Array.modifyLastNonEmpty(entries, last =>
|
|
215
|
+
onNonEmpty: entries => modifyFields(state, {
|
|
216
|
+
entries: () => Array.modifyLastNonEmpty(entries, last => modifyFields(last, {
|
|
217
217
|
mountStarts: Array.appendAll(mountStarts),
|
|
218
218
|
mountEnds: Array.appendAll(mountEnds),
|
|
219
219
|
})),
|
|
@@ -243,14 +243,14 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
243
243
|
return isTargetRetained
|
|
244
244
|
? [
|
|
245
245
|
false,
|
|
246
|
-
|
|
246
|
+
modifyFields(currentState, {
|
|
247
247
|
isPaused: () => true,
|
|
248
248
|
pausedAtIndex: () => index,
|
|
249
249
|
}),
|
|
250
250
|
]
|
|
251
251
|
: [
|
|
252
252
|
true,
|
|
253
|
-
|
|
253
|
+
modifyFields(currentState, {
|
|
254
254
|
isPaused: () => false,
|
|
255
255
|
}),
|
|
256
256
|
];
|
|
@@ -261,7 +261,7 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
261
261
|
return model;
|
|
262
262
|
});
|
|
263
263
|
const resume = Effect.gen(function* () {
|
|
264
|
-
yield* SubscriptionRef.update(stateRef, state =>
|
|
264
|
+
yield* SubscriptionRef.update(stateRef, state => modifyFields(state, {
|
|
265
265
|
isPaused: () => false,
|
|
266
266
|
}));
|
|
267
267
|
yield* bridge.markRenderPending;
|
|
@@ -274,7 +274,7 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
274
274
|
return state;
|
|
275
275
|
}
|
|
276
276
|
else {
|
|
277
|
-
return
|
|
277
|
+
return modifyFields(state, {
|
|
278
278
|
entries: () => [],
|
|
279
279
|
startIndex: () => 0,
|
|
280
280
|
pausedAtIndex: () => 0,
|
|
@@ -296,7 +296,7 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
296
296
|
onSome: ({ diff }) => diff,
|
|
297
297
|
}));
|
|
298
298
|
});
|
|
299
|
-
const updateLatestModel = (model) => SubscriptionRef.update(stateRef,
|
|
299
|
+
const updateLatestModel = (model) => SubscriptionRef.update(stateRef, modifyFields({ maybeLatestModel: () => Option.some(model) }));
|
|
300
300
|
return {
|
|
301
301
|
recordInit,
|
|
302
302
|
recordMessage,
|
|
@@ -78,7 +78,7 @@ type GuardValueOf<GuardResult> = [GuardResult] extends [boolean] ? void : Option
|
|
|
78
78
|
* The transition table: for each source state tag, the Messages it responds
|
|
79
79
|
* to and the Edge (or ordered guard list) each Message fires. States absent
|
|
80
80
|
* from the table, and Messages absent from a state's `on` record, are
|
|
81
|
-
* ignored:
|
|
81
|
+
* ignored: `Machine.step` reports them as `Ignored` rather than
|
|
82
82
|
* transitioning.
|
|
83
83
|
*
|
|
84
84
|
* @experimental Ships from `foldkit/experimental/machine`; expect breaking changes while the API settles.
|
|
@@ -190,8 +190,8 @@ export declare const otherwise: <State extends Tagged, Message extends Tagged, S
|
|
|
190
190
|
/**
|
|
191
191
|
* Declares that a Message is intentionally ignored when every preceding
|
|
192
192
|
* {@link when} guard declines. Evaluation stops at this fallback, and
|
|
193
|
-
*
|
|
194
|
-
* reported by
|
|
193
|
+
* `Machine.step` reports `ExplicitlyIgnored`. Edges listed after it are
|
|
194
|
+
* reported by `Machine.deadTransitions` as `ShadowedByIgnore`.
|
|
195
195
|
*
|
|
196
196
|
* @experimental Ships from `foldkit/experimental/machine`; expect breaking changes while the API settles.
|
|
197
197
|
*/
|
|
@@ -340,7 +340,7 @@ export type FoldConfig<ParentModel, State extends Tagged, Message extends Tagged
|
|
|
340
340
|
* machine: uploadMachine,
|
|
341
341
|
* read: (model: Model) => Option.some(model.upload),
|
|
342
342
|
* write: (model, nextUpload) =>
|
|
343
|
-
*
|
|
343
|
+
* modifyFields(model, { upload: () => nextUpload }),
|
|
344
344
|
* context: model => model.uploadQueues,
|
|
345
345
|
* })
|
|
346
346
|
*
|
|
@@ -106,8 +106,8 @@ export const otherwise = (edge) => ({
|
|
|
106
106
|
/**
|
|
107
107
|
* Declares that a Message is intentionally ignored when every preceding
|
|
108
108
|
* {@link when} guard declines. Evaluation stops at this fallback, and
|
|
109
|
-
*
|
|
110
|
-
* reported by
|
|
109
|
+
* `Machine.step` reports `ExplicitlyIgnored`. Edges listed after it are
|
|
110
|
+
* reported by `Machine.deadTransitions` as `ShadowedByIgnore`.
|
|
111
111
|
*
|
|
112
112
|
* @experimental Ships from `foldkit/experimental/machine`; expect breaking changes while the API settles.
|
|
113
113
|
*/
|
|
@@ -133,7 +133,7 @@ const transitionFoldedMachine = (config, model, state, message) => {
|
|
|
133
133
|
* machine: uploadMachine,
|
|
134
134
|
* read: (model: Model) => Option.some(model.upload),
|
|
135
135
|
* write: (model, nextUpload) =>
|
|
136
|
-
*
|
|
136
|
+
* modifyFields(model, { upload: () => nextUpload }),
|
|
137
137
|
* context: model => model.uploadQueues,
|
|
138
138
|
* })
|
|
139
139
|
*
|
|
@@ -222,12 +222,15 @@ export type RenderUrlFlagsOptions<Flags> = RenderUrlOptions & RenderFlagsOptions
|
|
|
222
222
|
* reconstruct, so the served DOM and the client's first render agree by
|
|
223
223
|
* construction even for codecs whose round trip is not the identity.
|
|
224
224
|
*
|
|
225
|
-
*
|
|
226
|
-
* `
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
225
|
+
* Canonical metadata has no request URL default. The result includes
|
|
226
|
+
* `canonical` only when the view supplies it. It includes `ogUrl` when the view
|
|
227
|
+
* supplies it, or uses an explicit canonical when `ogUrl` is omitted. When a
|
|
228
|
+
* field is absent from the result, `injectIntoTemplate` leaves the
|
|
229
|
+
* corresponding tag in the template unchanged.
|
|
230
|
+
*
|
|
231
|
+
* Derive the canonical URL from the typed route in the Model. `Request.url`
|
|
232
|
+
* gives routing applications the request to parse, but only the application
|
|
233
|
+
* knows which route and query values identify the page.
|
|
231
234
|
*
|
|
232
235
|
* @example
|
|
233
236
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|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,KAAK,EAAE,OAAO,CAAC,EAChD,OAAO,EAAE,gBAAgB,GACxB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;AAClD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAClD,MAAM,EAAE,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EACzD,OAAO,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjC,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;AAKlD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAC3C,MAAM,EAAE,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,EACzC,OAAO,EAAE,aAAa,GACrB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA"}
|
|
@@ -810,23 +810,6 @@ const parseUrl = (url) => Option.match(fromString(url), {
|
|
|
810
810
|
onNone: () => Effect.fail(new InvalidUrl({ url })),
|
|
811
811
|
onSome: Effect.succeed,
|
|
812
812
|
});
|
|
813
|
-
// The client defaults canonical to `origin + pathname + search` of the current
|
|
814
|
-
// location, which drops the fragment and normalizes host case and default
|
|
815
|
-
// ports. Building the server default with the WHATWG URL parser reproduces that
|
|
816
|
-
// exact string, so the metadata a crawler reads before hydration matches what
|
|
817
|
-
// the hydrated page computes.
|
|
818
|
-
const normalizedRequestUrl = (rawUrl) => {
|
|
819
|
-
if (rawUrl === undefined) {
|
|
820
|
-
return undefined;
|
|
821
|
-
}
|
|
822
|
-
try {
|
|
823
|
-
const parsed = new URL(rawUrl);
|
|
824
|
-
return `${parsed.origin}${parsed.pathname}${parsed.search}`;
|
|
825
|
-
}
|
|
826
|
-
catch {
|
|
827
|
-
return undefined;
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
813
|
const validateHydrationRoot = (body) => {
|
|
831
814
|
if (body === null) {
|
|
832
815
|
return Effect.fail(new InvalidHydrationRoot({ rootKind: 'Empty' }));
|
|
@@ -921,15 +904,7 @@ export function renderToString(config, options) {
|
|
|
921
904
|
catch: cause => new SerializationError({ cause }),
|
|
922
905
|
});
|
|
923
906
|
const flagsPayload = flagsHandoff !== undefined ? flagsHandoff.payloadScript : '';
|
|
924
|
-
|
|
925
|
-
// crawler reads carries the same canonical and Open Graph URL the hydrated
|
|
926
|
-
// page computes: canonical falls back to the request URL, and ogUrl to the
|
|
927
|
-
// resolved canonical, the chain the runtime applies on the client. A
|
|
928
|
-
// non-routing render has no request URL, so it inherits only an explicitly
|
|
929
|
-
// set canonical.
|
|
930
|
-
const resolvedCanonical = nextDocument.canonical ??
|
|
931
|
-
(hasRouting ? normalizedRequestUrl(options?.url) : undefined);
|
|
932
|
-
const resolvedOgUrl = nextDocument.ogUrl ?? resolvedCanonical;
|
|
907
|
+
const resolvedOgUrl = nextDocument.ogUrl ?? nextDocument.canonical;
|
|
933
908
|
return {
|
|
934
909
|
html: `${rootHtml}${flagsPayload}`,
|
|
935
910
|
title: nextDocument.title,
|
|
@@ -937,8 +912,8 @@ export function renderToString(config, options) {
|
|
|
937
912
|
...(nextDocument.dir !== undefined
|
|
938
913
|
? { dir: textDirectionToAttribute(nextDocument.dir) }
|
|
939
914
|
: {}),
|
|
940
|
-
...(
|
|
941
|
-
? { canonical:
|
|
915
|
+
...(nextDocument.canonical !== undefined
|
|
916
|
+
? { canonical: nextDocument.canonical }
|
|
942
917
|
: {}),
|
|
943
918
|
...(resolvedOgUrl !== undefined ? { ogUrl: resolvedOgUrl } : {}),
|
|
944
919
|
};
|
package/dist/html/index.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export type KeyboardModifiers = Readonly<{
|
|
|
56
56
|
metaKey: boolean;
|
|
57
57
|
}>;
|
|
58
58
|
/** A virtual DOM element. Constructed synchronously by the element factories
|
|
59
|
-
*
|
|
59
|
+
* on {@link HtmlBuilder}. The runtime patches a `VNode` (or `null` to
|
|
60
60
|
* render nothing) into the application container. */
|
|
61
61
|
export type Html = VNode | null;
|
|
62
62
|
export type Child = Html | string;
|
|
@@ -95,25 +95,33 @@ export type TextDirection = typeof TextDirection.Type;
|
|
|
95
95
|
* it after each render, and server rendering, which stamps it into the served
|
|
96
96
|
* shell so the direction is correct on first paint. */
|
|
97
97
|
export declare const textDirectionToAttribute: (direction: TextDirection) => 'ltr' | 'rtl' | 'auto';
|
|
98
|
-
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* (creating it if absent), syncs `ogUrl` to `<meta property="og:url">`
|
|
102
|
-
* (creating it if absent), and patches `body` into the application container.
|
|
98
|
+
/** The complete output of a page-owning view. The runtime patches `body` into
|
|
99
|
+
* the application container, writes `title` to `document.title`, and manages
|
|
100
|
+
* the optional document metadata.
|
|
103
101
|
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
102
|
+
* Supplied `lang` and `dir` values are written to the `<html>` element. An
|
|
103
|
+
* omitted value leaves the current attribute unchanged, including a value
|
|
104
|
+
* from the served HTML or an earlier render. Drive both fields from the Model
|
|
105
|
+
* when the application can switch languages at runtime.
|
|
106
106
|
*
|
|
107
|
-
* `
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* a crawler sees on first paint, because the runtime can only sync after the
|
|
112
|
-
* first render.
|
|
107
|
+
* `canonical` has no address-bar default. Derive it from the typed route in
|
|
108
|
+
* the Model, where the application can decide which route and query values
|
|
109
|
+
* identify the page. If the view never supplies it, the runtime leaves a
|
|
110
|
+
* served `<link rel="canonical">` unchanged or keeps the document without one.
|
|
113
111
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
112
|
+
* Before the client first writes `canonical` or `ogUrl`, it records the value
|
|
113
|
+
* already present on the corresponding element. A later omission restores
|
|
114
|
+
* that value, or removes the element if the runtime created it. During
|
|
115
|
+
* hydration, the recorded value may be metadata rendered for the initial
|
|
116
|
+
* route. `ogUrl` can be supplied independently; when omitted alongside an
|
|
117
|
+
* explicit `canonical`, it uses that canonical.
|
|
118
|
+
*
|
|
119
|
+
* Server rendering returns only the canonical supplied by the view. It
|
|
120
|
+
* returns `ogUrl` when supplied or falls back to an explicit canonical.
|
|
121
|
+
*
|
|
122
|
+
* This is the return type of a `makeApplication` view. An application embedded
|
|
123
|
+
* at a node should use `makeElement`; its view returns `Html` and never changes
|
|
124
|
+
* the `<head>` or `<html>` element. */
|
|
117
125
|
export type Document = Readonly<{
|
|
118
126
|
title: string;
|
|
119
127
|
lang?: string;
|
|
@@ -247,7 +255,7 @@ export type Attribute<Message> = Data.TaggedEnum<{
|
|
|
247
255
|
readonly f: (pointerType: string) => Option.Option<Message>;
|
|
248
256
|
};
|
|
249
257
|
OnPointerDown: {
|
|
250
|
-
readonly f: (pointerType: string, button: number, screenX: number, screenY: number, timeStamp: number, clientX: number, clientY: number) => Option.Option<Message>;
|
|
258
|
+
readonly f: (pointerType: string, button: number, screenX: number, screenY: number, timeStamp: number, clientX: number, clientY: number, pointerId: number, target: EventTarget | null) => Option.Option<Message>;
|
|
251
259
|
};
|
|
252
260
|
OnPointerUp: {
|
|
253
261
|
readonly f: (screenX: number, screenY: number, pointerType: string, timeStamp: number) => Option.Option<Message>;
|
|
@@ -1494,9 +1502,12 @@ type HtmlAttributes<Message> = {
|
|
|
1494
1502
|
readonly _tag: 'OnPointerLeave';
|
|
1495
1503
|
readonly f: (pointerType: string) => Option.Option<Message>;
|
|
1496
1504
|
};
|
|
1497
|
-
|
|
1505
|
+
/** Dispatches an optional Message on pointerdown. The final callback
|
|
1506
|
+
* arguments identify the pointer and its originating target, so a parent
|
|
1507
|
+
* gesture handler can distinguish touches and ignore nested controls. */
|
|
1508
|
+
OnPointerDown: (toMaybeMessage: (pointerType: string, button: number, screenX: number, screenY: number, timeStamp: number, clientX: number, clientY: number, pointerId: number, target: EventTarget | null) => Option.Option<Message>) => {
|
|
1498
1509
|
readonly _tag: 'OnPointerDown';
|
|
1499
|
-
readonly f: (pointerType: string, button: number, screenX: number, screenY: number, timeStamp: number, clientX: number, clientY: number) => Option.Option<Message>;
|
|
1510
|
+
readonly f: (pointerType: string, button: number, screenX: number, screenY: number, timeStamp: number, clientX: number, clientY: number, pointerId: number, target: EventTarget | null) => Option.Option<Message>;
|
|
1500
1511
|
};
|
|
1501
1512
|
OnPointerUp: (toMaybeMessage: (screenX: number, screenY: number, pointerType: string, timeStamp: number) => Option.Option<Message>) => {
|
|
1502
1513
|
readonly _tag: 'OnPointerUp';
|