foldkit 0.158.2 → 0.159.0-canary.4e90e99d9ad3
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 +2 -2
- package/dist/customElement/index.d.ts +15 -8
- package/dist/customElement/index.d.ts.map +1 -1
- package/dist/customElement/index.js +28 -5
- package/dist/customElement/public.d.ts +1 -1
- package/dist/customElement/public.d.ts.map +1 -1
- package/dist/dom/dom.d.ts +7 -4
- package/dist/dom/dom.d.ts.map +1 -1
- package/dist/dom/dom.js +8 -5
- package/dist/experimental/server/fetch.d.ts +42 -0
- package/dist/experimental/server/fetch.d.ts.map +1 -0
- package/dist/experimental/server/fetch.js +75 -0
- package/dist/experimental/server/index.d.ts +1 -0
- package/dist/experimental/server/index.d.ts.map +1 -1
- package/dist/experimental/server/index.js +1 -0
- package/dist/experimental/server/public.d.ts +2 -2
- package/dist/experimental/server/public.d.ts.map +1 -1
- package/dist/experimental/server/public.js +1 -1
- package/dist/experimental/server/server.d.ts +3 -2
- package/dist/experimental/server/server.d.ts.map +1 -1
- package/dist/experimental/server/template.js +4 -4
- package/dist/html/index.d.ts +42 -3
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +147 -10
- package/dist/hydrationMarker.d.ts +2 -2
- package/dist/hydrationMarker.d.ts.map +1 -1
- package/dist/hydrationMarker.js +2 -2
- package/dist/runtime/devToolsConfig.d.ts +3 -3
- package/dist/runtime/devToolsConfig.d.ts.map +1 -1
- package/dist/runtime/devToolsConfig.js +3 -3
- package/dist/runtime/hydrationHandoff.d.ts +5 -4
- package/dist/runtime/hydrationHandoff.d.ts.map +1 -1
- package/dist/runtime/hydrationHandoff.js +14 -13
- package/dist/runtime/{hmrProtocol.d.ts → modelPreservation.d.ts} +3 -3
- package/dist/runtime/modelPreservation.d.ts.map +1 -0
- package/dist/runtime/{hmrProtocol.js → modelPreservation.js} +2 -2
- package/dist/runtime/modelPreservationBridge.d.ts +4 -0
- package/dist/runtime/modelPreservationBridge.d.ts.map +1 -0
- package/dist/runtime/{hmrModelBridge.js → modelPreservationBridge.js} +7 -7
- package/dist/runtime/modelPreservationPublic.d.ts +2 -0
- package/dist/runtime/modelPreservationPublic.d.ts.map +1 -0
- package/dist/runtime/{hmrProtocolPublic.js → modelPreservationPublic.js} +1 -1
- package/dist/runtime/preserveScheduler.d.ts +1 -1
- package/dist/runtime/runtime.d.ts +8 -7
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +16 -16
- package/dist/runtime/{hmrScroll.d.ts → scrollPreservation.d.ts} +1 -1
- package/dist/runtime/scrollPreservation.d.ts.map +1 -0
- package/dist/runtime/{hmrScroll.js → scrollPreservation.js} +3 -3
- package/dist/runtime/slowPhase.d.ts +2 -1
- package/dist/runtime/slowPhase.d.ts.map +1 -1
- package/dist/runtime/start.d.ts +10 -7
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +21 -9
- package/dist/runtime/visibility.d.ts +2 -2
- package/dist/runtime/visibility.d.ts.map +1 -1
- package/dist/runtime/visibility.js +2 -2
- package/dist/schema/index.d.ts +42 -12
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +12 -10
- package/dist/test/apps/contentEditableEditor.d.ts +32 -0
- package/dist/test/apps/contentEditableEditor.d.ts.map +1 -0
- package/dist/test/apps/contentEditableEditor.js +39 -0
- package/dist/test/apps/fileUpload.d.ts.map +1 -1
- package/dist/test/apps/fileUpload.js +2 -1
- package/dist/test/apps/formChild.js +1 -1
- package/dist/test/apps/keypressSelf.d.ts +26 -0
- package/dist/test/apps/keypressSelf.d.ts.map +1 -0
- package/dist/test/apps/keypressSelf.js +30 -0
- package/dist/test/apps/pointer.d.ts.map +1 -1
- package/dist/test/apps/pointer.js +10 -11
- package/dist/test/scene.d.ts +28 -6
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +38 -13
- package/dist/vdom.js +5 -5
- package/package.json +4 -4
- package/dist/runtime/hmrModelBridge.d.ts +0 -4
- package/dist/runtime/hmrModelBridge.d.ts.map +0 -1
- package/dist/runtime/hmrProtocol.d.ts.map +0 -1
- package/dist/runtime/hmrProtocolPublic.d.ts +0 -2
- package/dist/runtime/hmrProtocolPublic.d.ts.map +0 -1
- package/dist/runtime/hmrScroll.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ A Foldkit program can own the whole page or run as a widget inside an existing a
|
|
|
29
29
|
|
|
30
30
|
## Get Started
|
|
31
31
|
|
|
32
|
-
`create-foldkit-app` scaffolds a complete setup with Tailwind, TypeScript, [Oxlint](https://foldkit.dev/tooling/oxlint-plugin), Oxfmt, and the Vite plugin for state-preserving
|
|
32
|
+
`create-foldkit-app` scaffolds a complete setup with Tailwind, TypeScript, [Oxlint](https://foldkit.dev/tooling/oxlint-plugin), Oxfmt, and the Vite plugin for state-preserving live reload. Pick a rendering mode (browser-only SPA, static generation, or server rendering) and, for a SPA, the example to start from.
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
npx create-foldkit-app@latest
|
|
@@ -137,7 +137,7 @@ Routing, server rendering, UI components, composition, and browser lifecycles al
|
|
|
137
137
|
- **Story Testing**: Exercise the update function directly, resolving Commands inline. No mocks, no fake timers.
|
|
138
138
|
- **Scene Testing**: Drive your real view the way a user does, with accessible locators. No browser required.
|
|
139
139
|
- **Slow Warnings**: Development warnings when update, view, patch, or Subscription extraction exceeds its budget.
|
|
140
|
-
- **
|
|
140
|
+
- **Live Reload**: Vite plugin with state-preserving reloads. Save a file, the page reloads, and your Model is restored. Change your view, keep your state.
|
|
141
141
|
|
|
142
142
|
## AI-Assisted Development
|
|
143
143
|
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import type { Attribute, Child, ChildAttribute, Html, HtmlBuilder } from '../html/index.js';
|
|
3
3
|
/** Type-level kebab-case to PascalCase, used to convert event names like
|
|
4
4
|
* `'change-rating'` into the corresponding factory name `'OnChangeRating'`. */
|
|
5
5
|
type KebabToPascal<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Capitalize<Head>}${KebabToPascal<Tail>}` : Capitalize<S>;
|
|
6
6
|
type PropertyFactory<Message, ValueType> = (value: ValueType) => Attribute<Message>;
|
|
7
7
|
type EventFactory<Message, DetailType> = (toMessage: (detail: DetailType) => Message) => Attribute<Message>;
|
|
8
|
+
/** Constraint on a declared event's `detail` Schema. The runtime decodes
|
|
9
|
+
* `detail` synchronously inside the DOM event handler, where there is no
|
|
10
|
+
* Effect context to draw from, so a Schema requiring decoding services
|
|
11
|
+
* cannot describe an event payload. */
|
|
12
|
+
export type EventSchema = Schema.Codec<unknown, unknown, never, unknown>;
|
|
8
13
|
/** @internal */
|
|
9
14
|
type PropertyFactories<Message, Properties extends Record<string, Schema.Top>> = {
|
|
10
15
|
readonly [K in keyof Properties as Capitalize<string & K>]: PropertyFactory<Message, Schema.Schema.Type<Properties[K]>>;
|
|
11
16
|
};
|
|
12
17
|
/** @internal */
|
|
13
|
-
type EventFactories<Message, Events extends Record<string,
|
|
18
|
+
type EventFactories<Message, Events extends Record<string, EventSchema>> = {
|
|
14
19
|
readonly [K in keyof Events as `On${KebabToPascal<string & K>}`]: EventFactory<Message, Schema.Schema.Type<Events[K]>>;
|
|
15
20
|
};
|
|
16
21
|
/** Typed call site for a defined custom element. The element constructor
|
|
@@ -19,9 +24,9 @@ type EventFactories<Message, Events extends Record<string, Schema.Top>> = {
|
|
|
19
24
|
* The attribute array accepts {@link ChildAttribute} alongside
|
|
20
25
|
* `Attribute<Message>`, like every html element builder, so a Submodel's
|
|
21
26
|
* published attribute groups can be spread into a custom element. */
|
|
22
|
-
export type ElementBuilder<Message, Properties extends Record<string, Schema.Top>, Events extends Record<string,
|
|
27
|
+
export type ElementBuilder<Message, Properties extends Record<string, Schema.Top>, Events extends Record<string, EventSchema>> = ((attributes?: ReadonlyArray<Attribute<Message> | ChildAttribute>, children?: ReadonlyArray<Child>) => Html) & PropertyFactories<Message, Properties> & EventFactories<Message, Events>;
|
|
23
28
|
/** Configuration accepted by `CustomElement.define`. */
|
|
24
|
-
export interface CustomElementConfig<Tag extends string, Properties extends Record<string, Schema.Top>, Events extends Record<string,
|
|
29
|
+
export interface CustomElementConfig<Tag extends string, Properties extends Record<string, Schema.Top>, Events extends Record<string, EventSchema>> {
|
|
25
30
|
readonly tag: Tag;
|
|
26
31
|
readonly properties: Properties;
|
|
27
32
|
readonly events: Events;
|
|
@@ -32,7 +37,7 @@ export interface CustomElementConfig<Tag extends string, Properties extends Reco
|
|
|
32
37
|
* frame's Message universe. The builder argument is a type witness: it
|
|
33
38
|
* fixes `Message` to the frame the element renders in, so the spec cannot
|
|
34
39
|
* be bound to a Message universe its events will not dispatch into. */
|
|
35
|
-
export interface CustomElementSpec<Tag extends string, Properties extends Record<string, Schema.Top>, Events extends Record<string,
|
|
40
|
+
export interface CustomElementSpec<Tag extends string, Properties extends Record<string, Schema.Top>, Events extends Record<string, EventSchema>> {
|
|
36
41
|
readonly tag: Tag;
|
|
37
42
|
readonly properties: Properties;
|
|
38
43
|
readonly events: Events;
|
|
@@ -51,8 +56,10 @@ export declare const kebabToPascal: (input: string) => string;
|
|
|
51
56
|
* `.withMessage<Message>()` factory that yields a typed `ElementBuilder` for
|
|
52
57
|
* the consumer's Message universe.
|
|
53
58
|
*
|
|
54
|
-
* Property changes diff across renders; declared `CustomEvent`
|
|
55
|
-
*
|
|
59
|
+
* Property changes diff across renders; declared `CustomEvent` details are
|
|
60
|
+
* decoded against their Schema before the runtime converts them to Messages.
|
|
61
|
+
* A detail the Schema rejects is reported to the console and dispatches no
|
|
62
|
+
* Message.
|
|
56
63
|
*
|
|
57
64
|
* @example
|
|
58
65
|
* ```ts
|
|
@@ -82,6 +89,6 @@ export declare const kebabToPascal: (input: string) => string;
|
|
|
82
89
|
* )
|
|
83
90
|
* ```
|
|
84
91
|
*/
|
|
85
|
-
export declare const define: <Tag extends string, Properties extends Record<string, Schema.Top>, Events extends Record<string,
|
|
92
|
+
export declare const define: <Tag extends string, Properties extends Record<string, Schema.Top>, Events extends Record<string, EventSchema>>(config: CustomElementConfig<Tag, Properties, Events>) => CustomElementSpec<Tag, Properties, Events>;
|
|
86
93
|
export {};
|
|
87
94
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/customElement/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/customElement/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,EAAgB,MAAM,QAAQ,CAAA;AAEzE,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,cAAc,EACd,IAAI,EACJ,WAAW,EACZ,MAAM,kBAAkB,CAAA;AAOzB;gFACgF;AAChF,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GAC1E,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,GAC3C,UAAU,CAAC,CAAC,CAAC,CAAA;AAEjB,KAAK,eAAe,CAAC,OAAO,EAAE,SAAS,IAAI,CACzC,KAAK,EAAE,SAAS,KACb,SAAS,CAAC,OAAO,CAAC,CAAA;AAEvB,KAAK,YAAY,CAAC,OAAO,EAAE,UAAU,IAAI,CACvC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,KACvC,SAAS,CAAC,OAAO,CAAC,CAAA;AAEvB;;;uCAGuC;AACvC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAExE,gBAAgB;AAChB,KAAK,iBAAiB,CACpB,OAAO,EACP,UAAU,SAAS,MAAM,CAAC,MA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e } from 'effect';
|
|
1
|
+
import { Array, Cause, Exit, Option, Schema, String, pipe } from 'effect';
|
|
2
2
|
import { OnCustomEvent, Prop, customElement as customElementVNode, } from '../html/index.js';
|
|
3
3
|
/** @internal Shared with the Scene test helpers so their error messages name
|
|
4
4
|
* the same `On*` factory this module generates. */
|
|
@@ -38,8 +38,10 @@ const eventFactoryName = (eventName) => `On${kebabToPascal(eventName)}`;
|
|
|
38
38
|
* `.withMessage<Message>()` factory that yields a typed `ElementBuilder` for
|
|
39
39
|
* the consumer's Message universe.
|
|
40
40
|
*
|
|
41
|
-
* Property changes diff across renders; declared `CustomEvent`
|
|
42
|
-
*
|
|
41
|
+
* Property changes diff across renders; declared `CustomEvent` details are
|
|
42
|
+
* decoded against their Schema before the runtime converts them to Messages.
|
|
43
|
+
* A detail the Schema rejects is reported to the console and dispatches no
|
|
44
|
+
* Message.
|
|
43
45
|
*
|
|
44
46
|
* @example
|
|
45
47
|
* ```ts
|
|
@@ -81,10 +83,31 @@ export const define = (config) => {
|
|
|
81
83
|
for (const propertyName of propertyNames) {
|
|
82
84
|
builder[propertyFactoryName(propertyName)] = (value) => Prop({ key: propertyName, value });
|
|
83
85
|
}
|
|
84
|
-
for (const eventName of
|
|
86
|
+
for (const [eventName, detailSchema] of Object.entries(config.events)) {
|
|
87
|
+
const decodeDetail = Schema.decodeUnknownExit(detailSchema);
|
|
88
|
+
const decodeEventDetail = (detail) => {
|
|
89
|
+
const decodedDetail = decodeDetail(detail);
|
|
90
|
+
// NOTE: `new CustomEvent(name)` leaves `detail` as `null`, while
|
|
91
|
+
// `Schema.Struct({})` is the natural declaration for an event with no
|
|
92
|
+
// payload. Decode the raw detail first so Schemas that accept nullish
|
|
93
|
+
// values keep their declared meaning, then fall back to an empty object.
|
|
94
|
+
if ((detail === null || detail === undefined) &&
|
|
95
|
+
Exit.isFailure(decodedDetail)) {
|
|
96
|
+
return decodeDetail({});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return decodedDetail;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
85
102
|
builder[eventFactoryName(eventName)] = (toMessage) => OnCustomEvent({
|
|
86
103
|
name: eventName,
|
|
87
|
-
f: event =>
|
|
104
|
+
f: event => Exit.match(decodeEventDetail(event.detail), {
|
|
105
|
+
onFailure: cause => {
|
|
106
|
+
console.error(`[foldkit] CustomElement '${config.tag}' rejected the detail of a "${eventName}" event:`, Cause.squash(cause));
|
|
107
|
+
return Option.none();
|
|
108
|
+
},
|
|
109
|
+
onSuccess: detail => Option.some(toMessage(detail)),
|
|
110
|
+
}),
|
|
88
111
|
});
|
|
89
112
|
}
|
|
90
113
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { define } from './index.js';
|
|
2
|
-
export type { Builder, CustomElementConfig, CustomElementSpec, ElementBuilder, } from './index.js';
|
|
2
|
+
export type { Builder, CustomElementConfig, CustomElementSpec, ElementBuilder, EventSchema, } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/customElement/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,YAAY,EACV,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/customElement/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,YAAY,EACV,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,WAAW,GACZ,MAAM,YAAY,CAAA"}
|
package/dist/dom/dom.d.ts
CHANGED
|
@@ -54,10 +54,13 @@ export declare const focus: (selector: string, options?: Readonly<{
|
|
|
54
54
|
}>) => Effect.Effect<void, ElementNotFound>;
|
|
55
55
|
/**
|
|
56
56
|
* Opens a dialog element using `show()` with high z-index, focus trapping,
|
|
57
|
-
* and Escape key handling.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
57
|
+
* and Escape key handling. An unhandled Escape on the topmost dialog dispatches
|
|
58
|
+
* a `CustomEvent` named `cancel`, distinguishing it from native `cancel` events
|
|
59
|
+
* while preserving the dialog event contract. Uses `show()` instead of
|
|
60
|
+
* `showModal()` so that DevTools (and any other high-z-index overlay) remains
|
|
61
|
+
* interactive. The Dialog component provides its own backdrop, scroll locking,
|
|
62
|
+
* and transitions. Fails with `ElementNotFound` if the selector does not match
|
|
63
|
+
* an `HTMLDialogElement`.
|
|
61
64
|
*
|
|
62
65
|
* Pass `focusSelector` to focus an element inside the dialog when it opens.
|
|
63
66
|
* When it does not match a focusable element, or when none is provided, focus
|
package/dist/dom/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/dom/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAA0C,MAAM,QAAQ,CAAA;AAG9E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA4E5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,KAAK,aACN,MAAM,YACN,QAAQ,CAAC;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAQlC,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/dom/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAA0C,MAAM,QAAQ,CAAA;AAG9E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA4E5C;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,0BAA0B,aAC3B,MAAM,YACN,QAAQ,CAAC;IACjB,KAAK,CAAC,EAAE,qBAAqB,CAAA;IAC7B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CAC1B,CAAC,KACD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAuBlC,CAAA;AAEJ,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,CAAA;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aACb,MAAM,aACL,cAAc,KACxB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CA+BlC,CAAA"}
|
package/dist/dom/dom.js
CHANGED
|
@@ -97,10 +97,13 @@ export const focus = (selector, options) => Effect.gen(function* () {
|
|
|
97
97
|
});
|
|
98
98
|
/**
|
|
99
99
|
* Opens a dialog element using `show()` with high z-index, focus trapping,
|
|
100
|
-
* and Escape key handling.
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
100
|
+
* and Escape key handling. An unhandled Escape on the topmost dialog dispatches
|
|
101
|
+
* a `CustomEvent` named `cancel`, distinguishing it from native `cancel` events
|
|
102
|
+
* while preserving the dialog event contract. Uses `show()` instead of
|
|
103
|
+
* `showModal()` so that DevTools (and any other high-z-index overlay) remains
|
|
104
|
+
* interactive. The Dialog component provides its own backdrop, scroll locking,
|
|
105
|
+
* and transitions. Fails with `ElementNotFound` if the selector does not match
|
|
106
|
+
* an `HTMLDialogElement`.
|
|
104
107
|
*
|
|
105
108
|
* Pass `focusSelector` to focus an element inside the dialog when it opens.
|
|
106
109
|
* When it does not match a focusable element, or when none is provided, focus
|
|
@@ -146,7 +149,7 @@ export const showDialog = (selector, options) => Effect.gen(function* () {
|
|
|
146
149
|
return;
|
|
147
150
|
}
|
|
148
151
|
event.preventDefault();
|
|
149
|
-
element.dispatchEvent(new
|
|
152
|
+
element.dispatchEvent(new CustomEvent('cancel', { cancelable: true }));
|
|
150
153
|
}), Match.when('Tab', () => {
|
|
151
154
|
trapFocusWithinDialog(event, element);
|
|
152
155
|
}), Match.orElse(Function.constVoid));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type EntryResult } from './entry.js';
|
|
2
|
+
/** How {@link handleRequest} renders a page request.
|
|
3
|
+
*
|
|
4
|
+
* @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
|
|
5
|
+
*/
|
|
6
|
+
export type HandleRequestOptions = Readonly<{
|
|
7
|
+
/**
|
|
8
|
+
* The application's server entry. One Web `Request` in, one delivery
|
|
9
|
+
* result out.
|
|
10
|
+
*/
|
|
11
|
+
renderPage: (request: Request) => Promise<EntryResult>;
|
|
12
|
+
/**
|
|
13
|
+
* The unfilled HTML shell. Rendered markup is placed into its container.
|
|
14
|
+
*/
|
|
15
|
+
template: string;
|
|
16
|
+
/**
|
|
17
|
+
* The `id` of the empty container in {@link template} the rendered
|
|
18
|
+
* markup replaces. Defaults to `'root'`.
|
|
19
|
+
*/
|
|
20
|
+
containerId?: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Answers one request as a Web `fetch` handler: refuse methods the
|
|
24
|
+
* `Request` constructor cannot represent, classify a static miss so a
|
|
25
|
+
* hashed asset is not answered with the application shell, and otherwise
|
|
26
|
+
* call `renderPage`.
|
|
27
|
+
*
|
|
28
|
+
* Static files are the platform's job. This function is what remains
|
|
29
|
+
* after Vite, a file server, or Worker assets have already missed.
|
|
30
|
+
* Node and workerd both call it, so development predicts production.
|
|
31
|
+
*
|
|
32
|
+
* `Request.url` is trusted as the platform constructed it. On Workers and
|
|
33
|
+
* Deno that is the URL the platform resolved. A Node adapter receives a raw
|
|
34
|
+
* request target instead, which may be an absolute URL or a network-path
|
|
35
|
+
* reference naming another host, so the adapter resolves that target
|
|
36
|
+
* against its configured origin with `resolveRequestUrl` and refuses an
|
|
37
|
+
* off-origin one before constructing the `Request` it passes here.
|
|
38
|
+
*
|
|
39
|
+
* @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
|
|
40
|
+
*/
|
|
41
|
+
export declare const handleRequest: (request: Request, options: HandleRequestOptions) => Promise<Response>;
|
|
42
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/experimental/server/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,YAAY,CAAA;AAYzD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;IACtD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AA8BF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,YACf,OAAO,WACP,oBAAoB,KAC5B,OAAO,CAAC,QAAQ,CA+ClB,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { toResponse } from './entry.js';
|
|
2
|
+
import { HOST_METHOD_ANSWERS, acceptsHtml, classifyRequest, isHostSettledMethod, resolvesToIndexHtml, varyWith, varyWithAccept, } from './host.js';
|
|
3
|
+
const withNegotiatedVary = (response) => {
|
|
4
|
+
const headers = new Headers(response.headers);
|
|
5
|
+
headers.set('vary', varyWith(varyWithAccept(headers.get('vary') ?? undefined), 'Sec-Fetch-Dest'));
|
|
6
|
+
return new Response(response.body, {
|
|
7
|
+
status: response.status,
|
|
8
|
+
statusText: response.statusText,
|
|
9
|
+
headers,
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const emptyResponse = (status, headers) => {
|
|
13
|
+
if (headers === undefined) {
|
|
14
|
+
return new Response(null, { status });
|
|
15
|
+
}
|
|
16
|
+
return new Response(null, { status, headers });
|
|
17
|
+
};
|
|
18
|
+
const injectOptions = (containerId) => containerId === undefined ? undefined : { containerId };
|
|
19
|
+
/**
|
|
20
|
+
* Answers one request as a Web `fetch` handler: refuse methods the
|
|
21
|
+
* `Request` constructor cannot represent, classify a static miss so a
|
|
22
|
+
* hashed asset is not answered with the application shell, and otherwise
|
|
23
|
+
* call `renderPage`.
|
|
24
|
+
*
|
|
25
|
+
* Static files are the platform's job. This function is what remains
|
|
26
|
+
* after Vite, a file server, or Worker assets have already missed.
|
|
27
|
+
* Node and workerd both call it, so development predicts production.
|
|
28
|
+
*
|
|
29
|
+
* `Request.url` is trusted as the platform constructed it. On Workers and
|
|
30
|
+
* Deno that is the URL the platform resolved. A Node adapter receives a raw
|
|
31
|
+
* request target instead, which may be an absolute URL or a network-path
|
|
32
|
+
* reference naming another host, so the adapter resolves that target
|
|
33
|
+
* against its configured origin with `resolveRequestUrl` and refuses an
|
|
34
|
+
* off-origin one before constructing the `Request` it passes here.
|
|
35
|
+
*
|
|
36
|
+
* @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
|
|
37
|
+
*/
|
|
38
|
+
export const handleRequest = async (request, options) => {
|
|
39
|
+
if (isHostSettledMethod(request.method)) {
|
|
40
|
+
return emptyResponse(HOST_METHOD_ANSWERS.refusedStatus, {
|
|
41
|
+
allow: HOST_METHOD_ANSWERS.allow,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const requestUrl = request.url;
|
|
45
|
+
const method = request.method.toUpperCase();
|
|
46
|
+
const isGetOrHead = method === 'GET' || method === 'HEAD';
|
|
47
|
+
let negotiated = false;
|
|
48
|
+
if (isGetOrHead && !resolvesToIndexHtml(requestUrl)) {
|
|
49
|
+
const classification = classifyRequest(requestUrl, request.headers.get('sec-fetch-dest') ?? undefined);
|
|
50
|
+
if (classification === 'PathAsset') {
|
|
51
|
+
return emptyResponse(404);
|
|
52
|
+
}
|
|
53
|
+
if (classification === 'DestinationAsset') {
|
|
54
|
+
return emptyResponse(404, {
|
|
55
|
+
vary: varyWith(undefined, 'Sec-Fetch-Dest'),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
negotiated = true;
|
|
59
|
+
if (!acceptsHtml(request.headers.get('accept') ?? undefined)) {
|
|
60
|
+
return emptyResponse(404, {
|
|
61
|
+
vary: varyWith(varyWithAccept(undefined), 'Sec-Fetch-Dest'),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const result = await options.renderPage(request);
|
|
66
|
+
const rendered = toResponse(options.template, result, injectOptions(options.containerId));
|
|
67
|
+
let response = rendered;
|
|
68
|
+
if (method === 'HEAD') {
|
|
69
|
+
response = emptyResponse(rendered.status, rendered.headers);
|
|
70
|
+
}
|
|
71
|
+
if (negotiated) {
|
|
72
|
+
return withNegotiatedVary(response);
|
|
73
|
+
}
|
|
74
|
+
return response;
|
|
75
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experimental/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experimental/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { FOLDKIT_APP_ATTRIBUTE, FOLDKIT_FLAGS_ATTRIBUTE, FlagsEncodeError, HOST_METHOD_ANSWERS, InvalidHydrationRoot, InvalidRuntimeId, InvalidUrl, MissingBuildId, Rendered, Responded, SerializationError, acceptsHtml, classifyRequest, injectIntoTemplate, isHostSettledMethod, renderToString, resolveRequestUrl, resolvesToIndexHtml, toResponse, varyWith, varyWithAccept, } from './index.js';
|
|
2
|
-
export type { InjectIntoTemplateOptions, RequestClassification, ResponseOptions, RenderedApplication, HydratableRenderOptions, StaticRenderOptions, RenderOptions, RenderUrlOptions, RenderFlagsOptions, RenderUrlFlagsOptions, ApplicationConfig, ApplicationConfigWithFlags, EntryModule, EntryResult, RenderError, RoutingApplicationConfig, RoutingApplicationConfigWithFlags, } from './index.js';
|
|
1
|
+
export { FOLDKIT_APP_ATTRIBUTE, FOLDKIT_FLAGS_ATTRIBUTE, FlagsEncodeError, HOST_METHOD_ANSWERS, InvalidHydrationRoot, InvalidRuntimeId, InvalidUrl, MissingBuildId, Rendered, Responded, SerializationError, acceptsHtml, classifyRequest, handleRequest, injectIntoTemplate, isHostSettledMethod, renderToString, resolveRequestUrl, resolvesToIndexHtml, toResponse, varyWith, varyWithAccept, } from './index.js';
|
|
2
|
+
export type { HandleRequestOptions, InjectIntoTemplateOptions, RequestClassification, ResponseOptions, RenderedApplication, HydratableRenderOptions, StaticRenderOptions, RenderOptions, RenderUrlOptions, RenderFlagsOptions, RenderUrlFlagsOptions, ApplicationConfig, ApplicationConfigWithFlags, EntryModule, EntryResult, RenderError, RoutingApplicationConfig, RoutingApplicationConfigWithFlags, } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/experimental/server/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,cAAc,GACf,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/experimental/server/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,cAAc,GACf,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FOLDKIT_APP_ATTRIBUTE, FOLDKIT_FLAGS_ATTRIBUTE, FlagsEncodeError, HOST_METHOD_ANSWERS, InvalidHydrationRoot, InvalidRuntimeId, InvalidUrl, MissingBuildId, Rendered, Responded, SerializationError, acceptsHtml, classifyRequest, injectIntoTemplate, isHostSettledMethod, renderToString, resolveRequestUrl, resolvesToIndexHtml, toResponse, varyWith, varyWithAccept, } from './index.js';
|
|
1
|
+
export { FOLDKIT_APP_ATTRIBUTE, FOLDKIT_FLAGS_ATTRIBUTE, FlagsEncodeError, HOST_METHOD_ANSWERS, InvalidHydrationRoot, InvalidRuntimeId, InvalidUrl, MissingBuildId, Rendered, Responded, SerializationError, acceptsHtml, classifyRequest, handleRequest, injectIntoTemplate, isHostSettledMethod, renderToString, resolveRequestUrl, resolvesToIndexHtml, toResponse, varyWith, varyWithAccept, } from './index.js';
|
|
@@ -173,8 +173,9 @@ export type StaticRenderOptions = CommonRenderOptions & Readonly<{
|
|
|
173
173
|
}>;
|
|
174
174
|
/** Options for {@link renderToString}. `runtimeId` names the application in the
|
|
175
175
|
* root stamp and Flags payload; it defaults to `'app'` and must be non-empty.
|
|
176
|
-
* A nondefault `runtimeId` changes the root
|
|
177
|
-
* not permit a second hydratable
|
|
176
|
+
* A nondefault `runtimeId` changes the root stamp and the keys used for Flags,
|
|
177
|
+
* Model, and scroll preservation. It does not permit a second hydratable
|
|
178
|
+
* application in one document.
|
|
178
179
|
*
|
|
179
180
|
* A hydratable render (the default) requires `buildId`. Pass
|
|
180
181
|
* `isHydratable: false` for static markup that nothing will hydrate, which
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/experimental/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAGN,MAAM,EAGP,MAAM,QAAQ,CAAA;AAgBf,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAGjB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AAQjC,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,GAAG,EAAc,MAAM,oBAAoB,CAAA;AAmgBpD,eAAO,MAAM,+BAA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AAgI3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAClD,MAAM,EAAE,iCAAiC,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAChE,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,GACpC,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;AAClD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAC3C,MAAM,EAAE,wBAAwB,CAAC,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"}
|
|
@@ -492,8 +492,8 @@ export const injectIntoTemplate = (template, rendered, options) => {
|
|
|
492
492
|
'Keep exactly one placeholder with that id.');
|
|
493
493
|
}
|
|
494
494
|
// The runtime id names an application across the whole page: it pairs a root
|
|
495
|
-
// with its Flags payload, and it keys the Model and scroll
|
|
496
|
-
//
|
|
495
|
+
// with its Flags payload, and it keys the preserved Model and scroll
|
|
496
|
+
// position. Two roots sharing one is not a second application, it is the
|
|
497
497
|
// same application claimed twice, so the second injection is refused rather
|
|
498
498
|
// than producing a page whose parts silently take each other's state. This
|
|
499
499
|
// holds whether or not either application declares Flags.
|
|
@@ -508,8 +508,8 @@ export const injectIntoTemplate = (template, rendered, options) => {
|
|
|
508
508
|
throw new Error(`[foldkit] injectIntoTemplate is placing an application stamped ` +
|
|
509
509
|
`"${renderedRuntimeId}", but the page already holds a root with ` +
|
|
510
510
|
'that id. A runtime id names one application for the whole page: it ' +
|
|
511
|
-
'pairs a root with its Flags payload and keys the Model
|
|
512
|
-
'
|
|
511
|
+
'pairs a root with its Flags payload and keys the preserved Model ' +
|
|
512
|
+
'and scroll position, so two roots sharing one would ' +
|
|
513
513
|
"take each other's state. Remove the duplicate root. Foldkit " +
|
|
514
514
|
'supports one page-owning hydratable application per document.');
|
|
515
515
|
}
|
package/dist/html/index.d.ts
CHANGED
|
@@ -258,6 +258,12 @@ export type Attribute<Message> = Data.TaggedEnum<{
|
|
|
258
258
|
OnKeyDownPreventDefault: {
|
|
259
259
|
readonly f: (key: string, modifiers: KeyboardModifiers) => Option.Option<Message>;
|
|
260
260
|
};
|
|
261
|
+
OnKeyDownSelf: {
|
|
262
|
+
readonly f: (key: string, modifiers: KeyboardModifiers) => Message;
|
|
263
|
+
};
|
|
264
|
+
OnKeyDownSelfPreventDefault: {
|
|
265
|
+
readonly f: (key: string, modifiers: KeyboardModifiers) => Option.Option<Message>;
|
|
266
|
+
};
|
|
261
267
|
OnKeyDownFocus: {
|
|
262
268
|
readonly f: (key: string, modifiers: KeyboardModifiers) => Option.Option<Readonly<{
|
|
263
269
|
focusSelector: string;
|
|
@@ -291,6 +297,12 @@ export type Attribute<Message> = Data.TaggedEnum<{
|
|
|
291
297
|
OnChange: {
|
|
292
298
|
readonly f: (value: string) => Message;
|
|
293
299
|
};
|
|
300
|
+
OnBeforeInput: {
|
|
301
|
+
readonly f: (inputType: string, data: Option.Option<string>) => Message;
|
|
302
|
+
};
|
|
303
|
+
OnBeforeInputPreventDefault: {
|
|
304
|
+
readonly f: (inputType: string, data: Option.Option<string>) => Option.Option<Message>;
|
|
305
|
+
};
|
|
294
306
|
OnFileChange: {
|
|
295
307
|
readonly f: (files: ReadonlyArray<File>) => Message;
|
|
296
308
|
};
|
|
@@ -328,6 +340,9 @@ export type Attribute<Message> = Data.TaggedEnum<{
|
|
|
328
340
|
OnCancel: {
|
|
329
341
|
readonly message: Message;
|
|
330
342
|
};
|
|
343
|
+
OnCancelPreventDefault: {
|
|
344
|
+
readonly maybeCustomEventMessage: Option.Option<Message>;
|
|
345
|
+
};
|
|
331
346
|
OnToggle: {
|
|
332
347
|
readonly f: (isOpen: boolean) => Message;
|
|
333
348
|
};
|
|
@@ -1093,7 +1108,7 @@ export type Attribute<Message> = Data.TaggedEnum<{
|
|
|
1093
1108
|
};
|
|
1094
1109
|
OnCustomEvent: {
|
|
1095
1110
|
readonly name: string;
|
|
1096
|
-
readonly f: (event: CustomEvent<
|
|
1111
|
+
readonly f: (event: CustomEvent<unknown>) => Option.Option<Message>;
|
|
1097
1112
|
};
|
|
1098
1113
|
OnMount: {
|
|
1099
1114
|
readonly action: MountAction<Message, any>;
|
|
@@ -1111,11 +1126,11 @@ declare const Prop: <A>(args: {
|
|
|
1111
1126
|
readonly value: unknown;
|
|
1112
1127
|
}, OnCustomEvent: <A>(args: {
|
|
1113
1128
|
readonly name: string;
|
|
1114
|
-
readonly f: (event: CustomEvent<
|
|
1129
|
+
readonly f: (event: CustomEvent<unknown>) => Option.Option<A>;
|
|
1115
1130
|
}) => {
|
|
1116
1131
|
readonly _tag: "OnCustomEvent";
|
|
1117
1132
|
readonly name: string;
|
|
1118
|
-
readonly f: (event: CustomEvent<
|
|
1133
|
+
readonly f: (event: CustomEvent<unknown>) => Option.Option<A>;
|
|
1119
1134
|
};
|
|
1120
1135
|
export { Prop, OnCustomEvent };
|
|
1121
1136
|
export declare const customElement: <Message>() => (tagName: string) => (attributes?: ReadonlyArray<Attribute<Message> | ChildAttribute>, children?: ReadonlyArray<Child>) => Html;
|
|
@@ -1505,6 +1520,14 @@ type HtmlAttributes<Message> = {
|
|
|
1505
1520
|
readonly _tag: 'OnKeyDownPreventDefault';
|
|
1506
1521
|
readonly f: (key: string, modifiers: KeyboardModifiers) => Option.Option<Message>;
|
|
1507
1522
|
};
|
|
1523
|
+
OnKeyDownSelf: (toMessage: (key: string, modifiers: KeyboardModifiers) => Message) => {
|
|
1524
|
+
readonly _tag: 'OnKeyDownSelf';
|
|
1525
|
+
readonly f: (key: string, modifiers: KeyboardModifiers) => Message;
|
|
1526
|
+
};
|
|
1527
|
+
OnKeyDownSelfPreventDefault: (toMaybeMessage: (key: string, modifiers: KeyboardModifiers) => Option.Option<Message>) => {
|
|
1528
|
+
readonly _tag: 'OnKeyDownSelfPreventDefault';
|
|
1529
|
+
readonly f: (key: string, modifiers: KeyboardModifiers) => Option.Option<Message>;
|
|
1530
|
+
};
|
|
1508
1531
|
OnKeyUp: (toMessage: (key: string, modifiers: KeyboardModifiers) => Message) => {
|
|
1509
1532
|
readonly _tag: 'OnKeyUp';
|
|
1510
1533
|
readonly f: (key: string, modifiers: KeyboardModifiers) => Message;
|
|
@@ -1558,6 +1581,14 @@ type HtmlAttributes<Message> = {
|
|
|
1558
1581
|
readonly _tag: 'OnChange';
|
|
1559
1582
|
readonly f: (value: string) => Message;
|
|
1560
1583
|
};
|
|
1584
|
+
OnBeforeInput: (toMessage: (inputType: string, data: Option.Option<string>) => Message) => {
|
|
1585
|
+
readonly _tag: 'OnBeforeInput';
|
|
1586
|
+
readonly f: (inputType: string, data: Option.Option<string>) => Message;
|
|
1587
|
+
};
|
|
1588
|
+
OnBeforeInputPreventDefault: (toMaybeMessage: (inputType: string, data: Option.Option<string>) => Option.Option<Message>) => {
|
|
1589
|
+
readonly _tag: 'OnBeforeInputPreventDefault';
|
|
1590
|
+
readonly f: (inputType: string, data: Option.Option<string>) => Option.Option<Message>;
|
|
1591
|
+
};
|
|
1561
1592
|
OnFileChange: (toMessage: (files: ReadonlyArray<File>) => Message) => {
|
|
1562
1593
|
readonly _tag: 'OnFileChange';
|
|
1563
1594
|
readonly f: (files: ReadonlyArray<File>) => Message;
|
|
@@ -1607,6 +1638,14 @@ type HtmlAttributes<Message> = {
|
|
|
1607
1638
|
readonly _tag: 'OnCancel';
|
|
1608
1639
|
readonly message: Message;
|
|
1609
1640
|
};
|
|
1641
|
+
/** Prevents the default action of a `cancel` event. When a
|
|
1642
|
+
* `customEventMessage` is provided, dispatches it only for a `CustomEvent`,
|
|
1643
|
+
* allowing a synthetic cancel signal to be distinguished from the native
|
|
1644
|
+
* event. Native `cancel` events never dispatch a Message. */
|
|
1645
|
+
OnCancelPreventDefault: (customEventMessage?: Message) => {
|
|
1646
|
+
readonly _tag: 'OnCancelPreventDefault';
|
|
1647
|
+
readonly maybeCustomEventMessage: Option.Option<Message>;
|
|
1648
|
+
};
|
|
1610
1649
|
OnToggle: (toMessage: (isOpen: boolean) => Message) => {
|
|
1611
1650
|
readonly _tag: 'OnToggle';
|
|
1612
1651
|
readonly f: (isOpen: boolean) => Message;
|