foldkit 0.162.0 → 0.163.0-canary.1a3dd68616dc

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.
Files changed (96) hide show
  1. package/README.md +4 -4
  2. package/dist/asyncData/asyncData.d.ts +1 -1
  3. package/dist/asyncData/asyncData.js +1 -1
  4. package/dist/buildToken.d.ts +6 -0
  5. package/dist/buildToken.d.ts.map +1 -1
  6. package/dist/buildToken.js +11 -6
  7. package/dist/devTools/protocol.d.ts +20 -0
  8. package/dist/devTools/protocol.d.ts.map +1 -1
  9. package/dist/devTools/protocol.js +19 -0
  10. package/dist/devTools/public.d.ts +1 -1
  11. package/dist/devTools/public.d.ts.map +1 -1
  12. package/dist/devTools/public.js +1 -1
  13. package/dist/devTools/store.d.ts.map +1 -1
  14. package/dist/devTools/store.js +16 -16
  15. package/dist/experimental/machine/machine.d.ts +4 -4
  16. package/dist/experimental/machine/machine.js +3 -3
  17. package/dist/experimental/server/server.d.ts +29 -25
  18. package/dist/experimental/server/server.d.ts.map +1 -1
  19. package/dist/experimental/server/server.js +15 -42
  20. package/dist/html/index.d.ts +31 -20
  21. package/dist/html/index.d.ts.map +1 -1
  22. package/dist/html/index.js +1 -1
  23. package/dist/runtime/deepFreeze.d.ts +1 -1
  24. package/dist/runtime/deepFreeze.js +1 -1
  25. package/dist/runtime/documentMetadata.d.ts.map +1 -1
  26. package/dist/runtime/documentMetadata.js +69 -47
  27. package/dist/runtime/hydrationHandoff.js +4 -4
  28. package/dist/runtime/managedResourceFibers.d.ts +1 -1
  29. package/dist/runtime/managedResourceFibers.d.ts.map +1 -1
  30. package/dist/runtime/managedResourceFibers.js +3 -2
  31. package/dist/runtime/start.d.ts +9 -7
  32. package/dist/runtime/start.d.ts.map +1 -1
  33. package/dist/runtime/start.js +2 -1
  34. package/dist/runtime/subscriptionFibers.d.ts +1 -1
  35. package/dist/runtime/subscriptionFibers.d.ts.map +1 -1
  36. package/dist/runtime/subscriptionFibers.js +3 -2
  37. package/dist/snabbdom/eventlisteners.d.ts.map +1 -1
  38. package/dist/snabbdom/eventlisteners.js +5 -0
  39. package/dist/struct/index.d.ts +4 -4
  40. package/dist/struct/index.d.ts.map +1 -1
  41. package/dist/struct/index.js +4 -4
  42. package/dist/struct/public.d.ts +1 -1
  43. package/dist/struct/public.d.ts.map +1 -1
  44. package/dist/struct/public.js +1 -1
  45. package/dist/submodel/submodel.d.ts +3 -3
  46. package/dist/subscription/fromEvent.d.ts +47 -33
  47. package/dist/subscription/fromEvent.d.ts.map +1 -1
  48. package/dist/subscription/fromEvent.js +30 -25
  49. package/dist/subscription/fromMediaQuery.d.ts +57 -0
  50. package/dist/subscription/fromMediaQuery.d.ts.map +1 -0
  51. package/dist/subscription/fromMediaQuery.js +46 -0
  52. package/dist/subscription/keyBindings.d.ts +13 -11
  53. package/dist/subscription/keyBindings.d.ts.map +1 -1
  54. package/dist/subscription/keyBindings.js +9 -7
  55. package/dist/subscription/public.d.ts +3 -1
  56. package/dist/subscription/public.d.ts.map +1 -1
  57. package/dist/subscription/public.js +1 -0
  58. package/dist/test/apps/bubbling.js +5 -5
  59. package/dist/test/apps/colorPicker.js +2 -2
  60. package/dist/test/apps/contentEditableEditor.js +3 -3
  61. package/dist/test/apps/contextMenu.js +2 -2
  62. package/dist/test/apps/counter.d.ts.map +1 -1
  63. package/dist/test/apps/counter.js +8 -5
  64. package/dist/test/apps/crashOnRender.js +3 -3
  65. package/dist/test/apps/drafts.js +3 -3
  66. package/dist/test/apps/feedSocket.js +5 -5
  67. package/dist/test/apps/fileUpload.js +2 -2
  68. package/dist/test/apps/focusBoundary.js +3 -3
  69. package/dist/test/apps/formChild.js +4 -4
  70. package/dist/test/apps/interactions.js +7 -7
  71. package/dist/test/apps/keypress.js +3 -3
  72. package/dist/test/apps/keypressSelf.js +2 -2
  73. package/dist/test/apps/login.js +7 -7
  74. package/dist/test/apps/mountPanel.js +4 -4
  75. package/dist/test/apps/multiRole.js +2 -2
  76. package/dist/test/apps/pointer.d.ts +5 -1
  77. package/dist/test/apps/pointer.d.ts.map +1 -1
  78. package/dist/test/apps/pointer.js +16 -7
  79. package/dist/test/apps/resumeUpload.js +5 -5
  80. package/dist/test/apps/scorePanel.js +2 -2
  81. package/dist/test/apps/selectiveKeys.d.ts.map +1 -1
  82. package/dist/test/apps/selectiveKeys.js +5 -3
  83. package/dist/test/apps/uploads.d.ts.map +1 -1
  84. package/dist/test/apps/uploads.js +13 -7
  85. package/dist/test/query.d.ts +21 -12
  86. package/dist/test/query.d.ts.map +1 -1
  87. package/dist/test/query.js +83 -31
  88. package/dist/test/scene.d.ts +6 -2
  89. package/dist/test/scene.d.ts.map +1 -1
  90. package/dist/test/scene.js +27 -3
  91. package/dist/update/update.d.ts +4 -4
  92. package/dist/update/update.js +3 -3
  93. package/dist/vdom.d.ts +3 -3
  94. package/dist/vdom.d.ts.map +1 -1
  95. package/dist/vdom.js +17 -7
  96. package/package.json +9 -9
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 { evo } from 'foldkit/struct'
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: evo(model, { count: count => count - 1 }),
69
+ model: modifyFields(model, { count: count => count - 1 }),
70
70
  }),
71
71
  ClickedIncrement: () => ({
72
- model: evo(model, { count: count => count + 1 }),
72
+ model: modifyFields(model, { count: count => count + 1 }),
73
73
  }),
74
- ClickedReset: () => ({ model: evo(model, { count: () => 0 }) }),
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: evo(model, { notes: AsyncData.settle(result) }),
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: evo(model, { notes: AsyncData.settle(result) }),
421
+ * model: modifyFields(model, { notes: AsyncData.settle(result) }),
422
422
  * })
423
423
  * ```
424
424
  */
@@ -1,3 +1,9 @@
1
+ /** The build id compiled into this Foldkit artifact, when one was supplied.
2
+ * @internal */
3
+ export declare const injectedBuildId: string | undefined;
4
+ /** Uses an explicit build id when present and the compiled artifact id otherwise.
5
+ * @internal */
6
+ export declare const buildIdOrInjected: (buildId: string | undefined) => string | undefined;
1
7
  /** The attribute a hydratable render stamps the build id onto. */
2
8
  export declare const HYDRATION_BUILD_ATTRIBUTE = "data-foldkit-build";
3
9
  //# sourceMappingURL=buildToken.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildToken.d.ts","sourceRoot":"","sources":["../src/buildToken.ts"],"names":[],"mappings":"AAoBA,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,uBAAuB,CAAA"}
1
+ {"version":3,"file":"buildToken.d.ts","sourceRoot":"","sources":["../src/buildToken.ts"],"names":[],"mappings":"AAoBA;eACe;AACf,eAAO,MAAM,eAAe,oBAA8B,CAAA;AAE1D;eACe;AACf,eAAO,MAAM,iBAAiB,YACnB,MAAM,GAAG,SAAS,KAC1B,MAAM,GAAG,SAAgE,CAAA;AAE5E,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,uBAAuB,CAAA"}
@@ -11,11 +11,16 @@
11
11
  // DOM state on a stale page could otherwise be carried into a view that now
12
12
  // means something else.
13
13
  //
14
- // Both sides are given the id explicitly rather than reading it from a
15
- // compile-time constant inside this package. Vite externalizes an installed
16
- // dependency from a server build, where a define never reaches it, so a
17
- // framework-internal read is silently absent in exactly the production shape
18
- // that matters. Application code is always transformed, so the entries read
19
- // `import.meta.env.FOLDKIT_BUILD_ID` and pass what they find.
14
+ // The Vite plugin replaces this call while compiling the client and server
15
+ // artifacts. Leaving it as a function keeps direct Node use and builds without
16
+ // the plugin fail-closed: the framework sees no identity and refuses hydratable
17
+ // rendering or hydration instead of sharing a fallback across deployments.
18
+ const foldkitBuildIdPlaceholder = () => undefined;
19
+ /** The build id compiled into this Foldkit artifact, when one was supplied.
20
+ * @internal */
21
+ export const injectedBuildId = foldkitBuildIdPlaceholder();
22
+ /** Uses an explicit build id when present and the compiled artifact id otherwise.
23
+ * @internal */
24
+ export const buildIdOrInjected = (buildId) => (buildId === undefined ? injectedBuildId : buildId);
20
25
  /** The attribute a hydratable render stamps the build id onto. */
21
26
  export const HYDRATION_BUILD_ATTRIBUTE = 'data-foldkit-build';
@@ -573,4 +573,24 @@ export declare const EventFrame: Schema.Struct<{
573
573
  }>;
574
574
  /** A wire frame carrying a runtime lifecycle event. */
575
575
  export type EventFrame = typeof EventFrame.Type;
576
+ /** Increment when the relay record's wire format changes. */
577
+ export declare const RELAY_RECORD_VERSION = 1;
578
+ /** Directory name under `XDG_RUNTIME_DIR` or the system temporary directory. */
579
+ export declare const RELAY_REGISTRY_DIRECTORY_NAME = "foldkit-devtools-relays";
580
+ /** Environment variable that sets the relay registry directory. */
581
+ export declare const RELAY_REGISTRY_DIRECTORY_VARIABLE = "FOLDKIT_DEVTOOLS_RELAY_DIRECTORY";
582
+ /**
583
+ * Record published while a Vite relay listens. `root` selects the project;
584
+ * `id` distinguishes a restarted relay from the one it replaced.
585
+ */
586
+ export declare const RelayRecord: Schema.Struct<{
587
+ readonly version: Schema.Literal<1>;
588
+ readonly id: Schema.String;
589
+ readonly root: Schema.String;
590
+ readonly url: Schema.String;
591
+ readonly pid: Schema.Number;
592
+ readonly startedAt: Schema.Number;
593
+ }>;
594
+ /** Decoded record for a running DevTools MCP relay. */
595
+ export type RelayRecord = typeof RelayRecord.Type;
576
596
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/devTools/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAA;AAMvC,yRAAyR;AACzR,eAAO,MAAM,iBAAiB;;;;EAI5B,CAAA;AACF,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,0MAA0M;AAC1M,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AACF,yFAAyF;AACzF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD,wfAAwf;AACxf,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;EAa1B,CAAA;AACF,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD,wHAAwH;AACxH,eAAO,MAAM,YAAY;;EAEvB,CAAA;AACF,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,kDAAkD;AAClD,eAAO,MAAM,WAAW;;;;EAItB,CAAA;AACF,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAIjD,iUAAiU;AACjU,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAE1C;;cAEc;AACd,eAAO,MAAM,OAAO;;QAEhB,SAAS;QACT,MAAM;;;QAGN,KAAK;QACL,SAAS;QACT,MAAM;;;QAGN,KAAK;QACL,eAAe;QACf,sBAAsB;QAGtB,OAAO;;;QAKP,eAAe;QACf,sBAAsB;;;QAKtB,SAAS;QACT,OAAO;QACP,sBAAsB;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,iCAAiC,qCACV,CAAA;AAEpC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;EAOtB,CAAA;AACF,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA"}
@@ -186,3 +186,22 @@ export const EventFrame = Schema.Struct({
186
186
  maybeConnectionId: Schema.OptionFromNullOr(Schema.String),
187
187
  event: Event,
188
188
  });
189
+ // RELAY REGISTRY
190
+ /** Increment when the relay record's wire format changes. */
191
+ export const RELAY_RECORD_VERSION = 1;
192
+ /** Directory name under `XDG_RUNTIME_DIR` or the system temporary directory. */
193
+ export const RELAY_REGISTRY_DIRECTORY_NAME = 'foldkit-devtools-relays';
194
+ /** Environment variable that sets the relay registry directory. */
195
+ export const RELAY_REGISTRY_DIRECTORY_VARIABLE = 'FOLDKIT_DEVTOOLS_RELAY_DIRECTORY';
196
+ /**
197
+ * Record published while a Vite relay listens. `root` selects the project;
198
+ * `id` distinguishes a restarted relay from the one it replaced.
199
+ */
200
+ export const RelayRecord = Schema.Struct({
201
+ version: Schema.Literal(RELAY_RECORD_VERSION),
202
+ id: Schema.String,
203
+ root: Schema.String,
204
+ url: Schema.String,
205
+ pid: Schema.Number,
206
+ startedAt: Schema.Number,
207
+ });
@@ -1,2 +1,2 @@
1
- export { DiffValue, Event, EventFrame, KeyframeInfo, MAX_DISPATCH_BATCH_SIZE, MessageSchemaResult, MessageTagCount, ModelDiffChange, Request, RequestFrame, Response, ResponseFrame, RuntimeInfo, SerializedEntry, } from './protocol.js';
1
+ export { DiffValue, Event, EventFrame, KeyframeInfo, MAX_DISPATCH_BATCH_SIZE, MessageSchemaResult, MessageTagCount, ModelDiffChange, RELAY_RECORD_VERSION, RELAY_REGISTRY_DIRECTORY_NAME, RELAY_REGISTRY_DIRECTORY_VARIABLE, RelayRecord, Request, RequestFrame, Response, ResponseFrame, RuntimeInfo, SerializedEntry, } from './protocol.js';
2
2
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/devTools/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/devTools/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,6BAA6B,EAC7B,iCAAiC,EACjC,WAAW,EACX,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAA"}
@@ -1 +1 @@
1
- export { DiffValue, Event, EventFrame, KeyframeInfo, MAX_DISPATCH_BATCH_SIZE, MessageSchemaResult, MessageTagCount, ModelDiffChange, Request, RequestFrame, Response, ResponseFrame, RuntimeInfo, SerializedEntry, } from './protocol.js';
1
+ export { DiffValue, Event, EventFrame, KeyframeInfo, MAX_DISPATCH_BATCH_SIZE, MessageSchemaResult, MessageTagCount, ModelDiffChange, RELAY_RECORD_VERSION, RELAY_REGISTRY_DIRECTORY_NAME, RELAY_REGISTRY_DIRECTORY_VARIABLE, RelayRecord, Request, RequestFrame, Response, ResponseFrame, RuntimeInfo, SerializedEntry, } from './protocol.js';
@@ -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,MA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,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1B,QAAQ,EAAE,eAAe,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;CACtD,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Array, Effect, HashMap, HashSet, Match, Option, Predicate, Record, String, SubscriptionRef, pipe, } from 'effect';
2
- import { evo } from '../struct/index.js';
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 evo(state, {
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 => evo(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 = evo(state, {
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 => evo(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 evo(state, {
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 => evo(entry, { commands: () => nextCommands }),
189
+ onSome: nextCommands => modifyFields(entry, { commands: () => nextCommands }),
190
190
  }));
191
191
  return Option.match(maybeEntries, {
192
192
  onNone: () => state,
193
- onSome: nextEntries => evo(state, { entries: () => 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: () => evo(state, {
212
+ onEmpty: () => modifyFields(state, {
213
213
  initMountStarts: Array.appendAll(mountStarts),
214
214
  }),
215
- onNonEmpty: entries => evo(state, {
216
- entries: () => Array.modifyLastNonEmpty(entries, last => evo(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
- evo(currentState, {
246
+ modifyFields(currentState, {
247
247
  isPaused: () => true,
248
248
  pausedAtIndex: () => index,
249
249
  }),
250
250
  ]
251
251
  : [
252
252
  true,
253
- evo(currentState, {
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 => evo(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 evo(state, {
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, evo({ maybeLatestModel: () => Option.some(model) }));
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: {@link Machine.step} reports them as `Ignored` rather than
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
- * {@link Machine.step} reports `ExplicitlyIgnored`. Edges listed after it are
194
- * reported by {@link Machine.deadTransitions} as `ShadowedByIgnore`.
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
- * evo(model, { upload: () => nextUpload }),
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
- * {@link Machine.step} reports `ExplicitlyIgnored`. Edges listed after it are
110
- * reported by {@link Machine.deadTransitions} as `ShadowedByIgnore`.
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
- * evo(model, { upload: () => nextUpload }),
136
+ * modifyFields(model, { upload: () => nextUpload }),
137
137
  * context: model => model.uploadQueues,
138
138
  * })
139
139
  *
@@ -85,14 +85,13 @@ export declare class InvalidHydrationRoot extends InvalidHydrationRoot_base<{
85
85
  declare const MissingBuildId_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
86
86
  readonly _tag: "MissingBuildId";
87
87
  } & Readonly<A>;
88
- /** Failure of a hydratable render that was given no build id. Hydration
88
+ /** Failure of a hydratable render that has no build id. Hydration
89
89
  * compares the id on the served root with the client's own to refuse a page
90
90
  * from another deployment, so a render that carries none has no such
91
- * protection. Supply one from a value the deployment already has, such as a
92
- * commit or a release tag, through `@foldkit/vite-plugin`'s `buildId` option or
93
- * the `FOLDKIT_BUILD_ID` environment variable, and pass
94
- * `import.meta.env.FOLDKIT_BUILD_ID` to `renderToString` and `Runtime.hydrate`.
95
- * A render that nothing will hydrate (`isHydratable: false`) needs none.
91
+ * protection. Build both artifacts together with `@foldkit/vite-plugin`, or
92
+ * supply the same nonempty `buildId` explicitly when client and server builds
93
+ * are orchestrated separately. A render that nothing will hydrate
94
+ * (`isHydratable: false`) needs none.
96
95
  *
97
96
  * @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
98
97
  */
@@ -145,9 +144,9 @@ export type ApplicationConfig<Model, Message> = Readonly<{
145
144
  type CommonRenderOptions = Readonly<{
146
145
  runtimeId?: string;
147
146
  }>;
148
- /** Render options for output a client will hydrate, which is the default. The
149
- * build id is required here: hydration compares it against the client's own
150
- * before adopting any DOM, and a page carrying none has no such protection.
147
+ /** Render options for output a client will hydrate, which is the default.
148
+ * Hydration compares the render's build id against the client's own before
149
+ * adopting any DOM, and a page carrying none has no such protection.
151
150
  *
152
151
  * @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
153
152
  */
@@ -155,12 +154,13 @@ export type HydratableRenderOptions = CommonRenderOptions & Readonly<{
155
154
  isHydratable?: true;
156
155
  /**
157
156
  * The deployment this render belongs to, stamped on the root so hydration
158
- * can refuse a page from a different one before adopting its DOM. Pass
159
- * `import.meta.env.FOLDKIT_BUILD_ID`, which `@foldkit/vite-plugin` fills
160
- * from its `buildId` option or the `FOLDKIT_BUILD_ID` environment variable,
161
- * and give the client entry the same value.
157
+ * can refuse a page from a different one before adopting its DOM. Foldkit
158
+ * normally reads the identity compiled into the server artifact by
159
+ * `@foldkit/vite-plugin`. This explicit option is for integrations that
160
+ * cannot compile the shared identity into the artifact. Give the client
161
+ * the same public value.
162
162
  */
163
- buildId: string;
163
+ buildId?: string;
164
164
  }>;
165
165
  /** Render options for static markup nothing will hydrate. No build id applies,
166
166
  * because no client will compare one.
@@ -177,9 +177,11 @@ export type StaticRenderOptions = CommonRenderOptions & Readonly<{
177
177
  * Model, and scroll preservation. It does not permit a second hydratable
178
178
  * application in one document.
179
179
  *
180
- * A hydratable render (the default) requires `buildId`. Pass
181
- * `isHydratable: false` for static markup that nothing will hydrate, which
182
- * takes no build id.
180
+ * A hydratable render (the default) uses the build identity compiled by
181
+ * `@foldkit/vite-plugin`. Pass `isHydratable: false` for static markup that
182
+ * nothing will hydrate, which takes no build id. The explicit `buildId`
183
+ * option supports integrations that cannot compile the shared identity into
184
+ * their artifacts.
183
185
  *
184
186
  * @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
185
187
  */
@@ -222,19 +224,21 @@ export type RenderUrlFlagsOptions<Flags> = RenderUrlOptions & RenderFlagsOptions
222
224
  * reconstruct, so the served DOM and the client's first render agree by
223
225
  * construction even for codecs whose round trip is not the identity.
224
226
  *
225
- * When a routing view omits `Document.canonical`, the render defaults it (and
226
- * `ogUrl`) to the request URL, normalized the way the client computes the
227
- * current location but with the query string kept. Set `Document.canonical`
228
- * explicitly when the query string is not part of the page's identity, such as
229
- * tracking parameters or a session token, so a crawler does not index every
230
- * variant as its own canonical page.
227
+ * Canonical metadata has no request URL default. The result includes
228
+ * `canonical` only when the view supplies it. It includes `ogUrl` when the view
229
+ * supplies it, or uses an explicit canonical when `ogUrl` is omitted. When a
230
+ * field is absent from the result, `injectIntoTemplate` leaves the
231
+ * corresponding tag in the template unchanged.
232
+ *
233
+ * Derive the canonical URL from the typed route in the Model. `Request.url`
234
+ * gives routing applications the request to parse, but only the application
235
+ * knows which route and query values identify the page.
231
236
  *
232
237
  * @example
233
238
  * ```typescript
234
239
  * const renderedApplication = yield* Server.renderToString(config, {
235
240
  * url: request.url,
236
241
  * flags: { theme },
237
- * buildId: import.meta.env.FOLDKIT_BUILD_ID,
238
242
  * })
239
243
  * ```
240
244
  *
@@ -243,5 +247,5 @@ export type RenderUrlFlagsOptions<Flags> = RenderUrlOptions & RenderFlagsOptions
243
247
  export declare function renderToString<Model, Message, Flags>(config: RoutingApplicationConfigWithFlags<Model, Message, Flags>, options: RenderUrlFlagsOptions<Flags>): Effect.Effect<RenderedApplication, RenderError>;
244
248
  export declare function renderToString<Model, Message>(config: RoutingApplicationConfig<Model, Message>, options: RenderUrlOptions): Effect.Effect<RenderedApplication, RenderError>;
245
249
  export declare function renderToString<Model, Message, Flags>(config: ApplicationConfigWithFlags<Model, Message, Flags>, options: RenderFlagsOptions<Flags>): Effect.Effect<RenderedApplication, RenderError>;
246
- export declare function renderToString<Model, Message>(config: ApplicationConfig<Model, Message>, options: RenderOptions): Effect.Effect<RenderedApplication, RenderError>;
250
+ export declare function renderToString<Model, Message>(config: ApplicationConfig<Model, Message>, options?: RenderOptions): Effect.Effect<RenderedApplication, RenderError>;
247
251
  //# sourceMappingURL=server.d.ts.map
@@ -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,CAA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AAE,aAAa,GACtB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Array, Context, Data, Effect, Option, Predicate, Schema, String, pipe, } from 'effect';
2
2
  import { html as Parse5Html, defaultTreeAdapter, parse, parseFragment, } from 'parse5';
3
- import { HYDRATION_BUILD_ATTRIBUTE } from '../../buildToken.js';
3
+ import { HYDRATION_BUILD_ATTRIBUTE, buildIdOrInjected, } from '../../buildToken.js';
4
4
  import { MATHML_NAMESPACE, SVG_NAMESPACE, parsedAttributeName, } from '../../domReflection.js';
5
5
  import { beginRender, createBoundaryRegistry } from '../../html/boundary.js';
6
6
  import { __htmlBuilder as htmlBuilderFor, textDirectionToAttribute, } from '../../html/index.js';
@@ -735,14 +735,13 @@ export class InvalidRuntimeId extends Data.TaggedError('InvalidRuntimeId') {
735
735
  */
736
736
  export class InvalidHydrationRoot extends Data.TaggedError('InvalidHydrationRoot') {
737
737
  }
738
- /** Failure of a hydratable render that was given no build id. Hydration
738
+ /** Failure of a hydratable render that has no build id. Hydration
739
739
  * compares the id on the served root with the client's own to refuse a page
740
740
  * from another deployment, so a render that carries none has no such
741
- * protection. Supply one from a value the deployment already has, such as a
742
- * commit or a release tag, through `@foldkit/vite-plugin`'s `buildId` option or
743
- * the `FOLDKIT_BUILD_ID` environment variable, and pass
744
- * `import.meta.env.FOLDKIT_BUILD_ID` to `renderToString` and `Runtime.hydrate`.
745
- * A render that nothing will hydrate (`isHydratable: false`) needs none.
741
+ * protection. Build both artifacts together with `@foldkit/vite-plugin`, or
742
+ * supply the same nonempty `buildId` explicitly when client and server builds
743
+ * are orchestrated separately. A render that nothing will hydrate
744
+ * (`isHydratable: false`) needs none.
746
745
  *
747
746
  * @experimental Ships from `foldkit/experimental/server`; expect breaking changes while the API settles.
748
747
  */
@@ -810,23 +809,6 @@ const parseUrl = (url) => Option.match(fromString(url), {
810
809
  onNone: () => Effect.fail(new InvalidUrl({ url })),
811
810
  onSome: Effect.succeed,
812
811
  });
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
812
  const validateHydrationRoot = (body) => {
831
813
  if (body === null) {
832
814
  return Effect.fail(new InvalidHydrationRoot({ rootKind: 'Empty' }));
@@ -850,13 +832,12 @@ export function renderToString(config, options) {
850
832
  const hasRouting = config.routing !== undefined;
851
833
  const FlagsCodec = config.Flags;
852
834
  const isHydratable = options?.isHydratable ?? true;
853
- // A hydratable render must say which deployment it came from. Deriving it
854
- // here is not possible: the render cannot see the sources, the
855
- // configuration, or the dependencies that decide what the view produced, so
856
- // an id it invented would either differ between the client and server
857
- // builds of one deployment or be shared by two that render differently.
858
- // Refusing is the only honest answer, and it names what to supply.
859
- const configuredBuildId = options?.buildId;
835
+ // A hydratable render must say which deployment it came from. The Vite
836
+ // plugin compiles that identity into Foldkit when it coordinates the client
837
+ // and server artifacts. Separately built artifacts must receive the same
838
+ // explicit value. With neither source, refusing keeps an unstamped page
839
+ // from being mistaken for this deployment.
840
+ const configuredBuildId = buildIdOrInjected(options?.buildId);
860
841
  const isConfiguredBuildId = Predicate.isString(configuredBuildId) &&
861
842
  !String.isEmpty(configuredBuildId);
862
843
  if (isHydratable && !isConfiguredBuildId) {
@@ -921,15 +902,7 @@ export function renderToString(config, options) {
921
902
  catch: cause => new SerializationError({ cause }),
922
903
  });
923
904
  const flagsPayload = flagsHandoff !== undefined ? flagsHandoff.payloadScript : '';
924
- // Mirror the client's document-metadata defaults so the served HTML a
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;
905
+ const resolvedOgUrl = nextDocument.ogUrl ?? nextDocument.canonical;
933
906
  return {
934
907
  html: `${rootHtml}${flagsPayload}`,
935
908
  title: nextDocument.title,
@@ -937,8 +910,8 @@ export function renderToString(config, options) {
937
910
  ...(nextDocument.dir !== undefined
938
911
  ? { dir: textDirectionToAttribute(nextDocument.dir) }
939
912
  : {}),
940
- ...(resolvedCanonical !== undefined
941
- ? { canonical: resolvedCanonical }
913
+ ...(nextDocument.canonical !== undefined
914
+ ? { canonical: nextDocument.canonical }
942
915
  : {}),
943
916
  ...(resolvedOgUrl !== undefined ? { ogUrl: resolvedOgUrl } : {}),
944
917
  };