foldkit 0.158.2 → 0.159.0-canary.63fa8e97d24a
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/calendar/calendarDate.js +1 -1
- package/dist/command/index.d.ts +10 -8
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +8 -6
- 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 +33 -26
- 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/test/vitest.d.ts +2 -2
- package/dist/test/vitest.d.ts.map +1 -1
- package/dist/test/vitest.js +1 -1
- package/dist/url/index.js +1 -1
- package/dist/vdom.js +5 -5
- package/package.json +9 -9
- 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
|
|
|
@@ -178,7 +178,7 @@ const isoPattern = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
178
178
|
* encode(Calendar.make(2026, 4, 13)) // "2026-04-13"
|
|
179
179
|
* ```
|
|
180
180
|
*/
|
|
181
|
-
export const CalendarDateFromIsoString = Schema.String.pipe(Schema.decodeTo(CalendarDate, SchemaTransformation.
|
|
181
|
+
export const CalendarDateFromIsoString = Schema.String.pipe(Schema.decodeTo(CalendarDate, SchemaTransformation.transformEffect({
|
|
182
182
|
decode: input => {
|
|
183
183
|
const match = input.match(isoPattern);
|
|
184
184
|
if (match === null) {
|
package/dist/command/index.d.ts
CHANGED
|
@@ -172,18 +172,20 @@ export declare function define<const Name extends string, const Messages extends
|
|
|
172
172
|
interrupt?: never;
|
|
173
173
|
execute: Eff;
|
|
174
174
|
}>): CommandDefinitionNoArgs<Name, Eff>;
|
|
175
|
-
/** Transforms the Effect inside a Command while preserving its
|
|
176
|
-
* message-mapping chain. Reach for this to
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
175
|
+
/** Transforms the Effect inside a Command while preserving its result Message,
|
|
176
|
+
* name, args, and message-mapping chain. Reach for this to provide a service,
|
|
177
|
+
* add a delay or retry, or change the error or requirement channel. Its type
|
|
178
|
+
* prevents the transform from changing the result Message. Never use it to
|
|
179
|
+
* lift that Message, even via
|
|
180
|
+
* `Effect.map(message => Message.GotChildMessage({ message }))`. That dispatches
|
|
180
181
|
* correctly in production but is invisible to `Story`/`Scene` `resolve`, which
|
|
181
182
|
* replays only the recorded chain and never runs the Effect, so the test would
|
|
182
183
|
* see the child's raw Message instead of the wrapped one. Lift result Messages
|
|
183
|
-
* with {@link mapMessage} / {@link mapMessages}, which record the lift.
|
|
184
|
+
* with {@link mapMessage} / {@link mapMessages}, which record the lift. The
|
|
185
|
+
* `foldkit/prefer-command-mapmessage` lint rule flags this misuse. */
|
|
184
186
|
export declare const mapEffect: {
|
|
185
|
-
<A, E1, R1,
|
|
186
|
-
<A, E1, R1,
|
|
187
|
+
<A, E1, R1, E2, R2>(f: (effect: Effect.Effect<A, E1, R1>) => Effect.Effect<NoInfer<A>, E2, R2>): (command: Command<A, E1, R1>) => Command<A, E2, R2>;
|
|
188
|
+
<A, E1, R1, E2, R2>(command: Command<A, E1, R1>, f: (effect: Effect.Effect<A, E1, R1>) => Effect.Effect<NoInfer<A>, E2, R2>): Command<A, E2, R2>;
|
|
187
189
|
};
|
|
188
190
|
/** Lifts a single Command's result Message through `f`, transforming
|
|
189
191
|
* `FromMessage` to `ToMessage`. The singular complement to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAA+B,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE3E,OAAO,EAAE,uBAAuB,EAAqB,MAAM,YAAY,CAAA;AACvE,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAA;AAEzD,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAElC;;;mEAGmE;AACnE,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,GACnE,QAAQ,CAAC;IACP,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CACnD,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC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,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,KAC5D,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CAQ7C,CAAA"}
|
package/dist/command/index.js
CHANGED
|
@@ -87,15 +87,17 @@ export function define(name, config) {
|
|
|
87
87
|
});
|
|
88
88
|
return definition;
|
|
89
89
|
}
|
|
90
|
-
/** Transforms the Effect inside a Command while preserving its
|
|
91
|
-
* message-mapping chain. Reach for this to
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
90
|
+
/** Transforms the Effect inside a Command while preserving its result Message,
|
|
91
|
+
* name, args, and message-mapping chain. Reach for this to provide a service,
|
|
92
|
+
* add a delay or retry, or change the error or requirement channel. Its type
|
|
93
|
+
* prevents the transform from changing the result Message. Never use it to
|
|
94
|
+
* lift that Message, even via
|
|
95
|
+
* `Effect.map(message => Message.GotChildMessage({ message }))`. That dispatches
|
|
95
96
|
* correctly in production but is invisible to `Story`/`Scene` `resolve`, which
|
|
96
97
|
* replays only the recorded chain and never runs the Effect, so the test would
|
|
97
98
|
* see the child's raw Message instead of the wrapped one. Lift result Messages
|
|
98
|
-
* with {@link mapMessage} / {@link mapMessages}, which record the lift.
|
|
99
|
+
* with {@link mapMessage} / {@link mapMessages}, which record the lift. The
|
|
100
|
+
* `foldkit/prefer-command-mapmessage` lint rule flags this misuse. */
|
|
99
101
|
export const mapEffect = Function.dual(2, (command, f) => ({ ...command, effect: f(command.effect) }));
|
|
100
102
|
/** Lifts a single Command's result Message through `f`, transforming
|
|
101
103
|
* `FromMessage` to `ToMessage`. The singular complement to
|
|
@@ -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,MAAM,EAAE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';
|
|
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+B,SAAU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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
}
|