@pwfabric/runtime 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/dist/binding/expression.js +4 -1
- package/dist/binding/expression.js.map +1 -1
- package/dist/connectors/types.d.ts +4 -2
- package/dist/connectors/types.js +4 -2
- package/dist/connectors/types.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/render/DataBoundSurfaceRenderer.d.ts +10 -0
- package/dist/render/DataBoundSurfaceRenderer.js +45 -11
- package/dist/render/DataBoundSurfaceRenderer.js.map +1 -1
- package/dist/render/data-binding-types.d.ts +13 -2
- package/dist/render/data-binding-types.js.map +1 -1
- package/dist/render/index.d.ts +3 -1
- package/dist/render/index.js +2 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/links.d.ts +50 -0
- package/dist/render/links.js +78 -0
- package/dist/render/links.js.map +1 -0
- package/dist/render/resolve-expressions.d.ts +22 -1
- package/dist/render/resolve-expressions.js +65 -5
- package/dist/render/resolve-expressions.js.map +1 -1
- package/dist/render/scoped-css.d.ts +8 -1
- package/dist/render/scoped-css.js +16 -0
- package/dist/render/scoped-css.js.map +1 -1
- package/dist/surface/expression.js +0 -1
- package/dist/surface/expression.js.map +1 -1
- package/dist/surface/output.js +1 -1
- package/dist/surface/output.js.map +1 -1
- package/package.json +3 -3
|
@@ -21,7 +21,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
21
21
|
*/
|
|
22
22
|
import * as React from 'react';
|
|
23
23
|
import { SurfaceRenderer } from './renderer.js';
|
|
24
|
-
import { resolveBlockExpressions } from './resolve-expressions.js';
|
|
24
|
+
import { literalPropsOf, resolveBlockExpressions } from './resolve-expressions.js';
|
|
25
|
+
import { useDynamicBlocks } from './dynamic-artifact-context.js';
|
|
26
|
+
import { readableUrl, urlSchemeOf } from './links.js';
|
|
25
27
|
import { endpointMissingPathValue, resolveEndpoint } from './endpoint.js';
|
|
26
28
|
import { resolveQueryState } from './query-state.js';
|
|
27
29
|
import { dataSourceCacheKey } from './data-cache.js';
|
|
@@ -374,8 +376,8 @@ writeOnly) {
|
|
|
374
376
|
// host-provided engine registry when that connection is registered
|
|
375
377
|
// there. Registered-but-failed surfaces the reason as an honest
|
|
376
378
|
// per-source error (`__errors.<id>`), never a crash; an unregistered
|
|
377
|
-
// connection (or no registry at all) falls through to
|
|
378
|
-
//
|
|
379
|
+
// connection (or no registry at all) falls through to the
|
|
380
|
+
// host's entity facade path.
|
|
379
381
|
// `{{state.x}}` inside the query resolves against CURRENT state, so
|
|
380
382
|
// a pagination block writing `state.page` or a segmented-control
|
|
381
383
|
// writing `state.severity` reaches `query.pagination` / `query.filter`.
|
|
@@ -491,7 +493,14 @@ writeOnly) {
|
|
|
491
493
|
meta: result.metadata.envelope ?? null,
|
|
492
494
|
};
|
|
493
495
|
}
|
|
494
|
-
|
|
496
|
+
// A refused read (401/403), a 404, a 500 or no answer at all: the source
|
|
497
|
+
// could not be served, and its `fallback` is bound like an entity
|
|
498
|
+
// source's (data-protocol §2). This branch reported the error and
|
|
499
|
+
// dropped the fallback, so under a host that rewrites entity sources
|
|
500
|
+
// into rest reads of its records (`pwf dev`), a page reading a
|
|
501
|
+
// create-only model showed neither rows nor its sample data.
|
|
502
|
+
const message = result.error.message;
|
|
503
|
+
return failed(source.fallback !== undefined ? new SourceFallback(message, source.fallback) : new Error(message), result.error.status ?? null);
|
|
495
504
|
}, [dataService, registerSource]);
|
|
496
505
|
// ---- Fetch a set of sources for the current state ----
|
|
497
506
|
const fetchSources = React.useCallback(async (sources) => {
|
|
@@ -773,6 +782,25 @@ export function canonicalizeEventType(raw) {
|
|
|
773
782
|
return s;
|
|
774
783
|
}
|
|
775
784
|
// ============================================================
|
|
785
|
+
// behaviorTargets
|
|
786
|
+
// ============================================================
|
|
787
|
+
/**
|
|
788
|
+
* Whether a behavior aimed at `targetBlockId` hears an event from `blockId`.
|
|
789
|
+
*
|
|
790
|
+
* A block inside a `repeat` is drawn once per row, each copy with the id
|
|
791
|
+
* `<id>--<index>` (`<id>--<outer>--<inner>` in a nested repeat) — the id the
|
|
792
|
+
* event carries. The receipt can only name the TEMPLATE id; matching it
|
|
793
|
+
* exactly meant a behavior aimed at a repeated block never fired. The
|
|
794
|
+
* template id names every copy; a copy id still names that one copy.
|
|
795
|
+
*/
|
|
796
|
+
export function behaviorTargets(targetBlockId, blockId) {
|
|
797
|
+
if (blockId === targetBlockId)
|
|
798
|
+
return true;
|
|
799
|
+
if (!blockId.startsWith(`${targetBlockId}--`))
|
|
800
|
+
return false;
|
|
801
|
+
return /^(--\d+)+$/.test(blockId.slice(targetBlockId.length));
|
|
802
|
+
}
|
|
803
|
+
// ============================================================
|
|
776
804
|
// isSurfaceAction
|
|
777
805
|
// ============================================================
|
|
778
806
|
export function isSurfaceAction(value) {
|
|
@@ -796,13 +824,11 @@ export function isSurfaceAction(value) {
|
|
|
796
824
|
export function isSafeNavigateUrl(url) {
|
|
797
825
|
if (typeof url !== 'string')
|
|
798
826
|
return false;
|
|
799
|
-
|
|
800
|
-
if (stripped === '')
|
|
827
|
+
if (readableUrl(url) === '')
|
|
801
828
|
return false;
|
|
802
|
-
const
|
|
803
|
-
if (
|
|
829
|
+
const s = urlSchemeOf(url);
|
|
830
|
+
if (s === null)
|
|
804
831
|
return true; // relative path / query / hash / protocol-relative
|
|
805
|
-
const s = (scheme[1] ?? '').toLowerCase();
|
|
806
832
|
return s === 'http' || s === 'https';
|
|
807
833
|
}
|
|
808
834
|
// ============================================================
|
|
@@ -864,13 +890,21 @@ function DataBoundInner({ surfaceId, blocks, dataSources, initialState, appearan
|
|
|
864
890
|
// SurfaceConnectionsContext provider via the rendererProps spread below).
|
|
865
891
|
const connections = rendererProps.connections;
|
|
866
892
|
const dataCache = rendererProps.dataCache;
|
|
893
|
+
const linkHref = rendererProps.linkHref;
|
|
867
894
|
// Keyed by the ids, so a re-render that changes nothing hands useSurfaceData
|
|
868
895
|
// the same set (its expression context depends on it).
|
|
869
896
|
const writeOnlyKey = React.useMemo(() => [...writeOnlySourceIds({ blocks, dataSources, capabilities, behaviors })].sort().join('\n'), [blocks, dataSources, capabilities, behaviors]);
|
|
870
897
|
const writeOnly = React.useMemo(() => new Set(writeOnlyKey === '' ? [] : writeOnlyKey.split('\n')), [writeOnlyKey]);
|
|
871
898
|
const { expressionData, initialLoaded, setStateValue, refreshSource, fetchAllSources } = useSurfaceData(dataSources, initialState, interactionMode, entityFacade, connections, dataCache, writeOnly);
|
|
899
|
+
// The props each block's manifest declares `bindable: false` stay as
|
|
900
|
+
// written; the descriptors the host handed the renderer carry them.
|
|
901
|
+
const { blocks: descriptors } = useDynamicBlocks();
|
|
902
|
+
const literalProps = React.useMemo(() => literalPropsOf(descriptors.values()), [descriptors]);
|
|
872
903
|
// Resolve expressions in blocks
|
|
873
|
-
const resolvedBlocks = React.useMemo(() => resolveBlockExpressions(blocks, expressionData
|
|
904
|
+
const resolvedBlocks = React.useMemo(() => resolveBlockExpressions(blocks, expressionData, undefined, {
|
|
905
|
+
literalProps,
|
|
906
|
+
...(linkHref ? { linkHref } : {}),
|
|
907
|
+
}), [blocks, expressionData, linkHref, literalProps]);
|
|
874
908
|
// Shared action dispatcher — handles all six action types
|
|
875
909
|
const dispatchAction = React.useCallback((action) => {
|
|
876
910
|
switch (action.type) {
|
|
@@ -938,7 +972,7 @@ function DataBoundInner({ surfaceId, blocks, dataSources, initialState, appearan
|
|
|
938
972
|
for (const b of behaviors) {
|
|
939
973
|
if (canonicalizeEventType(b.event) !== fired)
|
|
940
974
|
continue;
|
|
941
|
-
if (b.targetBlockId && b.targetBlockId
|
|
975
|
+
if (b.targetBlockId && !behaviorTargets(b.targetBlockId, event.blockId))
|
|
942
976
|
continue;
|
|
943
977
|
b.actions.forEach(dispatchAction);
|
|
944
978
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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,EAAE,OAAO,CAAC,CAAA;YACtD,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAA;QACvC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["/**\n * Data-Bound Surface Renderer\n *\n * Wrapper component that resolves dataSources, state, and {{expression}} props\n * before passing concrete values to the existing SurfaceRenderer.\n *\n * Architecture (post-refactor):\n * Surface JSON (dataSources + state + {{expr}} in props)\n * -> DataBoundSurfaceRenderer\n * -> DataCapabilityProvider (creates DataService instance)\n * -> DataBoundInner\n * -> useSurfaceData: maps SurfaceDataSourceDefinition → DataSourceDefinition,\n * registers with DataService, fetches via DataService, manages React state\n * -> SurfaceRenderer (unchanged)\n * -> Block components (unchanged)\n *\n * Backward compatible: if no dataSources, passes through with zero overhead.\n *\n * @module @pwfabric/runtime/render/DataBoundSurfaceRenderer\n */\n\nimport * as React from 'react'\nimport { SurfaceRenderer } from './renderer.js'\nimport { resolveBlockExpressions } from './resolve-expressions.js'\nimport { endpointMissingPathValue, resolveEndpoint } from './endpoint.js'\nimport { resolveQueryState } from './query-state.js'\nimport { dataSourceCacheKey, type SurfaceDataCache } from './data-cache.js'\nimport { DataCapabilityProvider, useDataService } from '../data/DataCapabilityProvider.js'\nimport type {\n DataBoundSurfaceRendererProps,\n SurfaceDataSourceDefinition,\n SurfaceAction,\n RuntimeBehavior,\n} from './data-binding-types.js'\nimport type {\n SurfaceEvent,\n SurfaceRendererProps,\n RenderableSurface,\n BlockInteractionMode,\n} from './types.js'\nimport type { Block } from '@pwfabric/core'\nimport type { DataSourceDefinition } from '../data/types.js'\nimport { createEntityDataSource } from '../entity/entity-datasource.js'\nimport { aggregateThrough } from '../entity/aggregate.js'\nimport { SurfaceDataContext } from './surface-data-context.js'\nimport type { EntityFacade } from '../entity/facade.js'\nimport type { EntityAggregate, EntityQuery, EntityTypeId } from '../entity/types.js'\nimport type { SurfaceConnectionsValue } from '../connectors/types.js'\nimport { PLATFORM_PERSISTENCE_CAPABILITY_ID } from '@pwfabric/contracts'\nimport { isCapability } from '../capability/type-mapping.js'\nimport { writeOnlySourceIds } from './write-only-sources.js'\n\n// ============================================================\n// extract dataSources + initialState from persistence config\n// ============================================================\n\n/**\n * consolidated these two seeds under the platform/persistence\n * capability config. DataBoundSurfaceRenderer is the sole consumer.\n */\nfunction extractPersistenceSeeds(surface: {\n readonly capabilities?: RenderableSurface['capabilities']\n}): {\n dataSources: readonly SurfaceDataSourceDefinition[] | undefined\n initialState: Readonly<Record<string, unknown>> | undefined\n behaviors: readonly RuntimeBehavior[] | undefined\n} {\n const binding = surface.capabilities?.find(\n (c) => isCapability(c, PLATFORM_PERSISTENCE_CAPABILITY_ID)\n )\n const cfg = binding?.config as\n | {\n dataSources?: readonly SurfaceDataSourceDefinition[]\n initialState?: Readonly<Record<string, unknown>>\n behaviors?: readonly RuntimeBehavior[]\n }\n | undefined\n return {\n dataSources: cfg?.dataSources,\n initialState: cfg?.initialState,\n // Declared behaviors (shipped by a pattern / authored in JSON). The\n // renderer merges these with host-provided behaviors (the host's store) so a pack\n // can carry its own controls without the host knowing about them.\n behaviors: cfg?.behaviors,\n }\n}\n\n/**\n * A source that could not be served but declares a `fallback`: the caller\n * binds `data` AND records `message` under `__errors.<id>`, so the surface\n * renders honestly (sample data + error flag) instead of empty or crashed.\n */\nclass SourceFallback extends Error {\n constructor(\n message: string,\n readonly data: unknown\n ) {\n super(message)\n this.name = 'SourceFallback'\n }\n}\n\n/**\n * A surface whose ONLY dynamic behaviour is writing (platform/entities\n * formBindings, no persistence dataSources) still needs the full data-bound\n * path: the form→entity bridge dispatches statusKeys through setState and the\n * success/error UI hangs off `visibleWhen: \"{{state.x}}\"` — both live in\n * DataBoundInner's state machinery. Before this check, such a surface fell\n * into the zero-overhead passthrough where visibleWhen was never evaluated\n * and, worse, submits were silently lost (proven live against a real\n * SharePoint list: two submits on a formBindings-only page never reached the\n * connector; adding any read source made the identical form work).\n */\nfunction hasEntityFormBindings(surface: {\n readonly capabilities?: RenderableSurface['capabilities']\n}): boolean {\n const entityCap = surface.capabilities?.find((c) => isCapability(c, 'platform/entities'))\n const formBindings = (entityCap?.config as { formBindings?: readonly unknown[] } | undefined)\n ?.formBindings\n return Array.isArray(formBindings) && formBindings.length > 0\n}\n\n/**\n * The actions a block's `action` prop names, in order.\n *\n * One action or a list of them (`[setState step, setState stepError '']`) —\n * a wizard's \"Next\" has to move the step AND clear the previous step's error\n * in one click. Anything that is not a surface action (a form's `action` is\n * its submit URL string) names none.\n */\nexport function blockActionsOf(value: unknown): readonly SurfaceAction[] {\n if (Array.isArray(value)) return value.filter(isSurfaceAction)\n return isSurfaceAction(value) ? [value] : []\n}\n\nfunction blockTreeHasAction(blocks: readonly Block[] | undefined): boolean {\n if (!blocks) return false\n for (const block of blocks) {\n if (blockActionsOf(block.props?.action).length > 0) return true\n if (blockTreeHasAction(block.children)) return true\n }\n return false\n}\n\n/**\n * Does any block carry a condition or a repeat the renderer has to evaluate?\n *\n * `visibleWhen`/`if` and `repeat` are resolved ONLY on the data-bound path.\n * A static page — no source, no state, no action — takes this path too: on\n * the passthrough a condition would never be read, so the shell's empty\n * brand logo would draw as \"⊟ <name> logo\", and a thank-you gated on\n * `{{state.submitted}}` would show before anything was submitted.\n * An empty condition string is no condition, as in resolveBlock.\n */\nfunction blockTreeHasCondition(blocks: readonly Block[] | undefined): boolean {\n if (!blocks) return false\n for (const block of blocks) {\n const b = block as { visibleWhen?: unknown; if?: unknown; repeat?: unknown }\n for (const expr of [b.visibleWhen, b.if, b.repeat]) {\n if (typeof expr === 'string' && expr.trim()) return true\n }\n if (blockTreeHasCondition(block.children)) return true\n }\n return false\n}\n\n/**\n * Does this surface need the data-bound path — state, expression resolution,\n * the action dispatcher — or can it go straight to SurfaceRenderer?\n *\n * ONE ANSWER FOR EVERY HOST. The renderer's own passthrough check and embed's\n * `needsDataBoundRenderer` used to disagree: embed counted `initialState`, the\n * renderer did not. So a wizard page carrying nothing but `initialState` and\n * buttons with `action` props reached the renderer, fell into the passthrough,\n * and there `visibleWhen` was never evaluated, `repeat` never expanded and no\n * `action` was ever dispatched — the buttons were dead. A block `action` alone\n * needs the path too: it is dispatched nowhere else. So does a block\n * `visibleWhen`/`if`/`repeat` (see blockTreeHasCondition).\n *\n * Host-provided behaviors are a prop, not part of the surface, and are\n * checked by the renderer on top of this.\n */\nexport function surfaceNeedsDataBinding(surface: {\n readonly blocks?: readonly Block[]\n readonly capabilities?: RenderableSurface['capabilities']\n}): boolean {\n const { dataSources, initialState, behaviors } = extractPersistenceSeeds(surface)\n return (\n Boolean(dataSources && dataSources.length > 0) ||\n initialState !== undefined ||\n Boolean(behaviors && behaviors.length > 0) ||\n hasEntityFormBindings(surface) ||\n blockTreeHasAction(surface.blocks) ||\n blockTreeHasCondition(surface.blocks)\n )\n}\n\n// ============================================================\n// TYPES\n// ============================================================\n\ninterface SourceData {\n readonly data: unknown\n readonly loading: boolean\n readonly error: string | null\n /** HTTP status of the last answer; null for a network failure or a non-HTTP kind. */\n readonly status?: number | null\n /** The envelope `returns` unwrapped the list from (`total`, `skip`, `limit` …). */\n readonly meta?: Readonly<Record<string, unknown>> | null\n /** Not fetched: a required path value of the endpoint is empty. */\n readonly idle?: boolean\n /** The resolved request `data` answered (see requestKeyOf). */\n readonly key?: string\n}\n\n// ============================================================\n// SURFACE → RUNTIME SOURCE MAPPING\n// ============================================================\n\n/**\n * Maps a JSON-safe SurfaceDataSourceDefinition to a runtime DataSourceDefinition.\n * Returns null for 'state' kind (handled locally via React state, not DataService).\n */\nfunction mapSurfaceSourceToDefinition(\n source: SurfaceDataSourceDefinition,\n currentState: Record<string, unknown>\n): DataSourceDefinition | null {\n switch (source.kind) {\n case 'static':\n return {\n id: source.id,\n kind: 'static',\n staticData: source.staticData,\n // A static source's query was dropped here, so its rows were bound\n // unsorted and unfiltered. Resolved like a rest source's.\n ...(source.query\n ? { query: resolveQueryState(source.query, currentState) as EntityQuery }\n : {}),\n }\n case 'state':\n // State sources read from React state, not managed by DataService\n return null\n case 'rest': {\n if (!source.endpoint) return null\n // `{{state.x}}` placeholders resolve against current state, each value\n // URL-encoded in a mixed endpoint — see resolveEndpoint for why.\n const endpoint = resolveEndpoint(source.endpoint, currentState)\n return {\n id: source.id,\n kind: 'rest' as const,\n endpoint,\n method: source.method ?? 'GET',\n ...(source.headers ? { headers: source.headers } : {}),\n // carry the identity the source names. This branch\n // copied endpoint/method/headers and stopped, so a rest source could\n // declare an identity the fetch would never see.\n ...(source.authProviderRef ? { authProviderRef: source.authProviderRef } : {}),\n // Same omission class as the line above: the source says where its\n // list is and the definition has to carry it, or `fetchRest` hands the\n // binding context a whole JSON body.\n ...(source.returns !== undefined ? { returns: source.returns } : {}),\n // The entity branch resolves `{{state.x}}` inside the query and hands\n // it to the facade; a rest source declared the same query and lost it\n // here. Resolved the same way, applied by the data service after the\n // fetch.\n ...(source.query\n ? { query: resolveQueryState(source.query, currentState) as EntityQuery }\n : {}),\n }\n }\n default:\n return null\n }\n}\n\n// ============================================================\n// useSurfaceData HOOK\n// ============================================================\n\n/**\n * Manages data source fetching, state, and auto-refresh for a data-bound surface.\n *\n * Delegates fetch mechanics to DataService via context.\n * Keeps React state management and expression resolution locally.\n */\ninterface SurfaceDataResult {\n expressionData: Record<string, unknown>\n surfaceState: Record<string, unknown>\n initialLoaded: boolean\n setStateValue: (key: string, value: unknown) => void\n refreshSource: (sourceId: string) => Promise<void>\n fetchAllSources: () => Promise<void>\n}\n\n/** What one fetch of one source came to. */\ntype FetchOutcome =\n | { readonly kind: 'ok'; readonly data: unknown; readonly status: number | null; readonly meta: Readonly<Record<string, unknown>> | null }\n | { readonly kind: 'error'; readonly message: string; readonly status: number | null; readonly fallback?: { readonly data: unknown } }\n\n/** JSON of a source DEFINITION, computed once per definition object. */\nconst definitionJsonCache = new WeakMap<object, string>()\nlet unserialisable = 0\n\nfunction safeJson(value: unknown): string {\n try {\n return JSON.stringify(value) ?? 'undefined'\n } catch {\n // A value that cannot be serialised can never be proven unchanged.\n return `#unserialisable-${++unserialisable}`\n }\n}\n\nfunction definitionJson(source: SurfaceDataSourceDefinition): string {\n let json = definitionJsonCache.get(source)\n if (json === undefined) {\n json = safeJson(source)\n definitionJsonCache.set(source, json)\n }\n return json\n}\n\n/** A REST source whose required path value is empty is not fetched. */\nfunction isIdleSource(source: SurfaceDataSourceDefinition, state: Readonly<Record<string, unknown>>): boolean {\n return source.kind === 'rest' && Boolean(source.endpoint) && endpointMissingPathValue(source.endpoint as string, state)\n}\n\n/**\n * EVERYTHING THAT DECIDES WHAT A SOURCE FETCHES, AS ONE STRING.\n *\n * The definition itself plus whatever it reads from state, RESOLVED: the REST\n * address, the query with its `{{state.*}}` placeholders filled in, a state\n * source's value. A source is refetched when — and only when — this changes.\n *\n * Refetching every source on every `setState` would make a search box writing\n * `state.searchDraft` on each keystroke refetch the product list AND the\n * cart, flashing both loading states, and a menu toggle refetch the whole\n * page. Dependency tracking on the resolved request is exact where\n * key-name extraction is not: `{{state.a ? state.b : state.c}}` depends on `c`\n * only while `a` is false, and the resolved value knows that.\n */\nfunction requestKeyOf(source: SurfaceDataSourceDefinition, state: Readonly<Record<string, unknown>>): string {\n const def = definitionJson(source)\n switch (source.kind) {\n case 'rest': {\n if (!source.endpoint) return def\n if (isIdleSource(source, state)) return `${def}|idle`\n const query = source.query ? safeJson(resolveQueryState(source.query, state)) : ''\n return `${def}|${resolveEndpoint(source.endpoint, state)}|${query}`\n }\n case 'entity': {\n const query = source.query ? safeJson(resolveQueryState(source.query, state)) : ''\n // The resolved aggregate too: a counter whose filter reads\n // `{{state.status}}` must ask again when the status changes.\n const aggregate = source.aggregate ? safeJson(resolveQueryState(source.aggregate, state)) : ''\n return `${def}|${query}|${aggregate}`\n }\n case 'state':\n return `${def}|${safeJson(state[source.id])}`\n case 'static':\n // A query reading `{{state.x}}` re-applies when x changes.\n return source.query ? `${def}|${safeJson(resolveQueryState(source.query, state))}` : def\n default:\n return def\n }\n}\n\nfunction useSurfaceData(\n dataSources: readonly SurfaceDataSourceDefinition[] | undefined,\n initialState: Readonly<Record<string, unknown>> | undefined,\n interactionMode: BlockInteractionMode = 'live',\n entityFacade?: EntityFacade,\n connections?: SurfaceConnectionsValue,\n dataCache?: SurfaceDataCache,\n /** Sources only a form writes to (see write-only-sources): settled, never fetched. */\n writeOnly?: ReadonlySet<string>\n): SurfaceDataResult {\n const dataService = useDataService()\n const writeOnlyRef = React.useRef(writeOnly)\n writeOnlyRef.current = writeOnly\n const dataCacheRef = React.useRef(dataCache)\n dataCacheRef.current = dataCache\n\n // State store\n const [surfaceState, setSurfaceState] = React.useState<Record<string, unknown>>(() => ({\n ...initialState,\n }))\n\n // Source data store — seeded from the host's cache when it has yesterday's\n // rows for a source, so the first frame is not an empty table. The seed is\n // marked loading: the fetch that follows is what makes it today's.\n const [sourceData, setSourceData] = React.useState<Record<string, SourceData>>(() => {\n if (!dataCache || !dataSources) return {}\n const seeded: Record<string, SourceData> = {}\n for (const source of dataSources) {\n const key = dataSourceCacheKey(source, initialState ?? {})\n if (!key) continue\n const hit = dataCache.get(key)\n if (hit !== undefined) {\n seeded[source.id] = { data: hit, loading: true, error: null, key: requestKeyOf(source, initialState ?? {}) }\n }\n }\n return seeded\n })\n // Track whether initial fetch is complete. A page whose every fetched\n // source came out of the cache counts as loaded: the gate has nothing to\n // wait for that the visitor has not already seen.\n const [initialLoaded, setInitialLoaded] = React.useState(() => {\n if (!dataCache || !dataSources) return false\n const fetched = dataSources.filter((s) => dataSourceCacheKey(s, initialState ?? {}) !== undefined)\n return fetched.length > 0 && fetched.every((s) => dataCache.get(dataSourceCacheKey(s, initialState ?? {})!) !== undefined)\n })\n\n // Stable ref to current state for use in fetch callbacks\n const stateRef = React.useRef(surfaceState)\n stateRef.current = surfaceState\n\n // Stable ref to sources\n const sourcesRef = React.useRef(dataSources)\n sourcesRef.current = dataSources\n\n // Stable ref to the entity facade (kind:'entity' sources query through it)\n const entityFacadeRef = React.useRef(entityFacade)\n entityFacadeRef.current = entityFacade\n\n // Stable ref to the connections context (kind:'entity'\n // sources with a `connector` route through the engine registry)\n const connectionsRef = React.useRef(connections)\n connectionsRef.current = connections\n\n /** The request each source was last fetched (or marked idle) for. */\n const requestKeysRef = React.useRef<Record<string, string>>({})\n /** The in-flight fetch of each source — a newer one aborts it. */\n const controllersRef = React.useRef(new Map<string, AbortController>())\n\n // ---- setState action ----\n // Writing the value a key already holds changes nothing, so it renders\n // nothing and fetches nothing.\n const setStateValue = React.useCallback((key: string, value: unknown) => {\n setSurfaceState((prev) => {\n if (prev[key] === value) return prev\n return { ...prev, [key]: value }\n })\n }, [])\n\n // ---- (Re-)register a source's definition for the current state ----\n // Registered even when the source is idle, so a form or a behavior writing\n // to it through the data service still finds it.\n const registerSource = React.useCallback(\n (source: SurfaceDataSourceDefinition, state: Record<string, unknown>) => {\n if (dataService.hasSource(source.id)) dataService.unregisterSource(source.id)\n const definition = mapSurfaceSourceToDefinition(source, state)\n if (definition) dataService.registerSource(definition)\n },\n [dataService]\n )\n\n // ---- Fetch a single source ----\n const fetchSource = React.useCallback(\n async (\n source: SurfaceDataSourceDefinition,\n state: Record<string, unknown>,\n signal: AbortSignal\n ): Promise<FetchOutcome> => {\n const failed = (err: unknown, status: number | null = null): FetchOutcome => ({\n kind: 'error',\n message: err instanceof Error ? err.message : String(err),\n status,\n // fallback declared → bind it; the error stays visible next to it\n ...(err instanceof SourceFallback ? { fallback: { data: err.data } } : {}),\n })\n\n // State sources read from React state directly\n if (source.kind === 'state') {\n return { kind: 'ok', data: state[source.id], status: null, meta: null }\n }\n\n // Entity sources list records via the platform/entities facade.\n // Returns the items array so {{<id>}} binds directly to the list (e.g. a\n // table's `data`). Refreshed by refreshAll after a form→entity create.\n if (source.kind === 'entity') {\n if (!source.entityType) return { kind: 'ok', data: [], status: null, meta: null }\n\n // A source that names a `connector` routes through the\n // host-provided engine registry when that connection is registered\n // there. Registered-but-failed surfaces the reason as an honest\n // per-source error (`__errors.<id>`), never a crash; an unregistered\n // connection (or no registry at all) falls through to today's\n // default facade path.\n // `{{state.x}}` inside the query resolves against CURRENT state, so\n // a pagination block writing `state.page` or a segmented-control\n // writing `state.severity` reaches `query.pagination` / `query.filter`.\n // Before this, only REST endpoints saw state; connector queries went raw.\n const query = source.query ? (resolveQueryState(source.query, state) as EntityQuery) : undefined\n // An AGGREGATE source asks for one number, never the rows. Its\n // filter resolves against state like `query` does, and the answer\n // binds `{ fn, field?, value, count }` (`{{<id>.value}}`), exempt\n // from the list wrap below. A counter on an intake collection is\n // allowed what a list of it is not, and a public one no longer hands\n // every row to a stranger so the page can count them.\n const aggregate = source.aggregate\n ? (resolveQueryState(source.aggregate, state) as unknown as EntityAggregate)\n : undefined\n const entityType = source.entityType as EntityTypeId\n // Any failure below binds `fallback` (when declared) and still reports\n // the error — see SourceFallback.\n const fail = (message: string): never => {\n if (source.fallback !== undefined) throw new SourceFallback(message, source.fallback)\n throw new Error(message)\n }\n try {\n const engines = connectionsRef.current?.engines\n if (source.connector && engines) {\n const status = engines.getStatus(source.connector)\n if (status.state !== 'unregistered') {\n const engine = await engines.resolve(source.connector)\n if (engine) {\n if (aggregate) {\n const agg = await aggregateThrough(engine, entityType, aggregate)\n if (agg.success) return { kind: 'ok', data: agg.result, status: null, meta: null }\n return fail(agg.error)\n }\n const res = await engine.query(entityType, (query ?? {}) as EntityQuery)\n if (res.success) return { kind: 'ok', data: res.result.items, status: null, meta: null }\n return fail(res.error)\n }\n const failedStatus = engines.getStatus(source.connector)\n return fail(\n failedStatus.state === 'failed'\n ? failedStatus.reason\n : `Connector engine '${source.connector}' unavailable`\n )\n }\n // Declared connector, nothing registered: a pattern shipped without\n // its connection. With a fallback this is the \"sample data\" path;\n // without one, today's facade route stays.\n if (source.fallback !== undefined) {\n return fail(`Connector '${source.connector}' is not connected`)\n }\n }\n\n const facade = entityFacadeRef.current\n if (!facade) {\n return source.fallback !== undefined\n ? fail('No entity facade available')\n : {\n kind: 'ok',\n data: aggregate\n ? { fn: aggregate.fn, ...(aggregate.field ? { field: aggregate.field } : {}), value: null, count: 0 }\n : [],\n status: null,\n meta: null,\n }\n }\n if (aggregate) {\n if (typeof facade.resolveAggregate === 'function') {\n // A count that cannot be served is an error, not a 0: bind\n // `fallback` and report it, same as a failed list.\n try {\n const agg = await facade.resolveAggregate(entityType, aggregate)\n return { kind: 'ok', data: agg, status: null, meta: null }\n } catch (err) {\n return fail(err instanceof Error ? err.message : String(err))\n }\n }\n // A facade from before `resolveAggregate` lists; the rows it\n // returns are reduced here, same as a list-only engine.\n const viaList = await aggregateThrough(\n { query: async (t, q) => ({ success: true, result: await facade.resolveBinding(t, q) }) },\n entityType,\n aggregate\n )\n if (!viaList.success) return fail(viaList.error)\n return { kind: 'ok', data: viaList.result, status: null, meta: null }\n }\n const eds = createEntityDataSource(facade, {\n id: source.id,\n entityType: source.entityType as EntityTypeId,\n ...(query ? { query } : {}),\n })\n try {\n const result = await eds.fetch()\n return { kind: 'ok', data: result.items, status: null, meta: null }\n } catch (err) {\n return fail(err instanceof Error ? err.message : String(err))\n }\n } catch (err) {\n return failed(err)\n }\n }\n\n // Everything else goes through the DataService, registered for THIS state.\n registerSource(source, state)\n const result = await dataService.fetchData(source.id, {\n signal,\n ...(source.headers ? { headers: source.headers } : {}),\n })\n if (result.success) {\n return {\n kind: 'ok',\n data: result.data,\n status: result.metadata.status ?? null,\n meta: result.metadata.envelope ?? null,\n }\n }\n return failed(new Error(result.error.message), result.error.status ?? null)\n },\n [dataService, registerSource]\n )\n\n // ---- Fetch a set of sources for the current state ----\n const fetchSources = React.useCallback(\n async (sources: readonly SurfaceDataSourceDefinition[]) => {\n const state = stateRef.current\n const idle: SurfaceDataSourceDefinition[] = []\n const writeOnlySettled: SurfaceDataSourceDefinition[] = []\n const jobs: { source: SurfaceDataSourceDefinition; controller: AbortController; key: string }[] = []\n for (const source of sources) {\n controllersRef.current.get(source.id)?.abort()\n controllersRef.current.delete(source.id)\n const key = requestKeyOf(source, state)\n requestKeysRef.current[source.id] = key\n if (isIdleSource(source, state)) {\n idle.push(source)\n registerSource(source, state)\n continue\n }\n // A form's write target nothing reads: no list request — not on\n // mount, not after a submit's refreshAll. Still registered, so the\n // form's write through the data service finds it.\n if (writeOnlyRef.current?.has(source.id) === true) {\n writeOnlySettled.push(source)\n registerSource(source, state)\n continue\n }\n const controller = new AbortController()\n controllersRef.current.set(source.id, controller)\n jobs.push({ source, controller, key })\n }\n\n // Idle sources settle at once: no data, not loading, no error. The data\n // of whatever was shown before belongs to another request, so it goes.\n // Fetched sources show their loading flag and keep their data until the\n // answer arrives (a filter change does not blank the list meanwhile).\n setSourceData((prev) => {\n const next = { ...prev }\n for (const source of idle) {\n next[source.id] = { data: null, loading: false, error: null, status: null, meta: null, idle: true, key: requestKeysRef.current[source.id] as string }\n }\n for (const source of writeOnlySettled) {\n next[source.id] = { data: null, loading: false, error: null, status: null, meta: null, key: requestKeysRef.current[source.id] as string }\n }\n for (const { source } of jobs) {\n const p = prev[source.id]\n next[source.id] = {\n data: p?.data ?? null,\n loading: true,\n error: null,\n status: p?.status ?? null,\n meta: p?.meta ?? null,\n ...(p?.key !== undefined ? { key: p.key } : {}),\n }\n }\n return next\n })\n\n await Promise.all(\n jobs.map(async ({ source, controller, key }) => {\n let outcome: FetchOutcome\n try {\n outcome = await fetchSource(source, state, controller.signal)\n } catch (err) {\n outcome = { kind: 'error', message: err instanceof Error ? err.message : String(err), status: null }\n }\n if (controller.signal.aborted) return\n controllersRef.current.delete(source.id)\n setSourceData((prev) => {\n const next = { ...prev }\n if (outcome.kind === 'ok') {\n next[source.id] = { data: outcome.data, loading: false, error: null, status: outcome.status, meta: outcome.meta, key }\n } else {\n const p = prev[source.id]\n // ON ERROR, DATA FROM ANOTHER REQUEST IS CLEARED: a search\n // for cart 999 must not leave cart 1 on screen under the error.\n // The SAME request failing again (a refresh, a poll) keeps its\n // last good answer — that answer is still the right record.\n const keep = p?.key === key\n next[source.id] = {\n data: outcome.fallback ? outcome.fallback.data : keep ? (p?.data ?? null) : null,\n loading: false,\n error: outcome.message,\n status: outcome.status,\n meta: keep ? (p?.meta ?? null) : null,\n ...(keep ? { key } : {}),\n }\n }\n return next\n })\n if (outcome.kind === 'ok') {\n const cacheKey = dataSourceCacheKey(source, state)\n if (cacheKey) dataCacheRef.current?.set(cacheKey, outcome.data)\n }\n })\n )\n\n // A pass whose every fetch was superseded settles nothing; the pass\n // that superseded it will.\n if (jobs.length > 0 && jobs.every((j) => j.controller.signal.aborted)) return\n setInitialLoaded(true)\n },\n [fetchSource, registerSource]\n )\n\n // ---- Fetch every source (refreshAll) ----\n const fetchAllSources = React.useCallback(async () => {\n const sources = sourcesRef.current\n if (!sources || sources.length === 0) {\n setInitialLoaded(true)\n return\n }\n await fetchSources(sources)\n }, [fetchSources])\n\n // ---- Refresh a single source ----\n const refreshSource = React.useCallback(\n async (sourceId: string) => {\n const source = sourcesRef.current?.find((s) => s.id === sourceId)\n if (!source) return\n await fetchSources([source])\n },\n [fetchSources]\n )\n\n // ---- Initial fetch + refetch of the sources whose request changed ----\n React.useEffect(() => {\n const sources = dataSources ?? []\n const present = new Set(sources.map((s) => s.id))\n for (const id of Object.keys(requestKeysRef.current)) {\n if (present.has(id)) continue\n delete requestKeysRef.current[id]\n controllersRef.current.get(id)?.abort()\n controllersRef.current.delete(id)\n if (dataService.hasSource(id)) dataService.unregisterSource(id)\n }\n if (sources.length === 0) {\n setInitialLoaded(true)\n return\n }\n const changed = sources.filter((s) => requestKeyOf(s, surfaceState) !== requestKeysRef.current[s.id])\n if (changed.length > 0) void fetchSources(changed)\n }, [dataSources, surfaceState, fetchSources, dataService])\n\n // ---- Unmount: abort what is in flight, forget what was fetched ----\n // Forgetting matters under StrictMode's mount → unmount → mount: the second\n // mount must fetch again, not believe the aborted first pass succeeded.\n React.useEffect(() => {\n const controllers = controllersRef.current\n return () => {\n for (const controller of controllers.values()) controller.abort()\n controllers.clear()\n requestKeysRef.current = {}\n for (const source of sourcesRef.current ?? []) {\n if (dataService.hasSource(source.id)) dataService.unregisterSource(source.id)\n }\n }\n }, [dataService])\n\n // ---- Auto-refresh intervals ----\n React.useEffect(() => {\n // Inert (editor/preview): never start auto-refresh timers.\n if (!dataSources || interactionMode === 'inert') return\n\n const intervals: ReturnType<typeof setInterval>[] = []\n\n for (const source of dataSources) {\n if (source.refreshInterval && source.refreshInterval > 0) {\n const interval = setInterval(() => {\n void refreshSource(source.id)\n }, source.refreshInterval)\n intervals.push(interval)\n }\n }\n\n return () => {\n for (const interval of intervals) {\n clearInterval(interval)\n }\n }\n }, [dataSources, refreshSource, interactionMode])\n\n // ---- Build expression context ----\n const expressionData = React.useMemo(() => {\n const ctx: Record<string, unknown> = { state: surfaceState }\n // Per-source loading flags for skeleton UIs: `{{__loading.<sourceId>}}` /\n // `{{__anyLoading}}`. A declared source with no sourceData entry yet has\n // not even started its first fetch (the fetch effect runs after first\n // paint) — report it as loading so a skeleton shows from frame one\n // instead of flashing the block's empty state. `state`-kind sources read\n // synchronously from React state and are never \"loading\".\n const loadingMap: Record<string, boolean> = {}\n let anyLoading = false\n // Per-source error messages — `{{__errors.<sourceId>}}` — so a block can\n // distinguish \"fetch failed\" from \"fetched, genuinely empty\" instead of\n // showing a false empty-state. The value is the error MESSAGE string\n // (truthy check + tooltip content in one binding); null when healthy.\n const errorMap: Record<string, string | null> = {}\n let anyError = false\n // `{{__status.<id>}}` — the HTTP status of the last answer (200, 404, …);\n // null for a network failure, an idle source or a non-HTTP kind.\n // `{{__notFound.<id>}}` — status 404, so \"no such order\" and \"connection\n // error\" can be told apart. `{{__idle.<id>}}` — a REST source\n // not fetched because a required path value is empty.\n // `{{__meta.<id>}}` — the envelope `returns` unwrapped the list from\n // (`total`, `skip`, `limit` …); null when there is none.\n const statusMap: Record<string, number | null> = {}\n const notFoundMap: Record<string, boolean> = {}\n const idleMap: Record<string, boolean> = {}\n const metaMap: Record<string, Readonly<Record<string, unknown>> | null> = {}\n for (const source of dataSources ?? []) {\n const entry = sourceData[source.id]\n const loading =\n source.kind === 'state' || writeOnly?.has(source.id) === true ? false : entry ? entry.loading : true\n loadingMap[source.id] = loading\n if (loading) anyLoading = true\n const error = entry?.error ?? null\n errorMap[source.id] = error\n if (error) anyError = true\n const status = entry?.status ?? null\n statusMap[source.id] = status\n notFoundMap[source.id] = status === 404\n idleMap[source.id] = entry?.idle === true\n metaMap[source.id] = entry?.meta ?? null\n }\n /**\n * A LIST SOURCE ALWAYS BINDS AS A LIST.\n *\n * The entity path returns `result.items` — an array. The rest path\n * returned the whole JSON body, or, since `returns` landed, the plucked\n * value. So the same block bound to `{{data.Product}}` received an array\n * from our store and an object from anyone else's, and swapping a model\n * from platform to a connection quietly changed what every bound block\n * got. One shape.\n *\n * `static` and `state` are the documented exceptions and stay untouched:\n * a state source is routinely a scalar, and wrapping it would break every\n * shipped surface that reads one.\n */\n const LIST_KINDS = new Set(['rest', 'entity', 'graphql'])\n const kindById = new Map((dataSources ?? []).map((s) => [s.id, s.kind]))\n // An AGGREGATE source is one number, not a list of one: wrapping\n // `{ value }` into `[{ value }]` would still read through the single-\n // element fallthrough, but `.length` would lie and `count` would hide.\n // Entity-only: that is the one branch that reads `aggregate`; a rest\n // source carrying the key still fetches a list and binds as one.\n const aggregateIds = new Set(\n (dataSources ?? []).filter((s) => s.kind === 'entity' && s.aggregate !== undefined).map((s) => s.id)\n )\n for (const [key, value] of Object.entries(sourceData)) {\n const listy = LIST_KINDS.has(kindById.get(key) ?? '') && !aggregateIds.has(key)\n ctx[key] =\n listy && value.data != null && !Array.isArray(value.data) ? [value.data] : value.data\n }\n ctx['__loading'] = loadingMap\n ctx['__anyLoading'] = anyLoading\n ctx['__errors'] = errorMap\n ctx['__anyError'] = anyError\n ctx['__status'] = statusMap\n ctx['__notFound'] = notFoundMap\n ctx['__idle'] = idleMap\n ctx['__meta'] = metaMap\n return ctx\n }, [surfaceState, sourceData, dataSources, writeOnly])\n\n return {\n expressionData,\n surfaceState,\n initialLoaded,\n setStateValue,\n refreshSource,\n fetchAllSources,\n }\n}\n\n// ============================================================\n// canonicalizeEventType\n// ============================================================\n\n/**\n * Normalize a stored behavior trigger string to canonical colon form.\n * - Already has `:` → return lowercased/trimmed as-is\n * - Has `.` → replace first `.` with `:`\n * - Otherwise → return trimmed lowercased (best-effort; won't match well-formed events)\n */\nexport function canonicalizeEventType(raw: string): string {\n const s = raw.trim().toLowerCase()\n if (s.includes(':')) return s\n if (s.includes('.')) return s.replace('.', ':')\n return s\n}\n\n// ============================================================\n// isSurfaceAction\n// ============================================================\n\nexport function isSurfaceAction(value: unknown): value is SurfaceAction {\n if (!value || typeof value !== 'object') return false\n const obj = value as Record<string, unknown>\n return (\n obj.type === 'setState' ||\n obj.type === 'refresh' ||\n obj.type === 'refreshAll' ||\n obj.type === 'showBlock' ||\n obj.type === 'hideBlock' ||\n obj.type === 'navigate'\n )\n}\n\n/**\n * Guard the `navigate` action against XSS: only http(s) absolute URLs and\n * relative/anchor URLs may be navigated to. A scheme like `javascript:`,\n * `data:`, or `vbscript:` is rejected so a stored behavior cannot execute\n * script in a published-surface visitor's context. Control characters are\n * stripped first to defeat `java\\tscript:`-style scheme smuggling.\n */\nexport function isSafeNavigateUrl(url: unknown): url is string {\n if (typeof url !== 'string') return false\n const stripped = url.replace(/[^!-~]/g, '')\n if (stripped === '') return false\n const scheme = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(stripped)\n if (!scheme) return true // relative path / query / hash / protocol-relative\n const s = (scheme[1] ?? '').toLowerCase()\n return s === 'http' || s === 'https'\n}\n\n// ============================================================\n// DataBoundSurfaceRenderer COMPONENT\n// ============================================================\n\n/**\n * Data-bound surface renderer.\n *\n * If nothing on the surface is dynamic (see surfaceNeedsDataBinding), renders\n * SurfaceRenderer directly (zero overhead).\n * Otherwise, wraps with DataCapabilityProvider for DataService context, then\n * fetches data, manages state, resolves expressions, and intercepts events.\n */\nexport function DataBoundSurfaceRenderer(props: DataBoundSurfaceRendererProps): React.ReactElement {\n const { surface, onEvent, behaviors: hostBehaviors, onNavigateAction, dataServiceConfig, ...rest } = props\n const { blocks, appearance, capabilities } = surface\n // dataSources + initialState + declared behaviors live under platform/persistence config\n const { dataSources, initialState, behaviors: declaredBehaviors } = extractPersistenceSeeds(surface)\n // Declared (JSON) first, host (its store) after — same id in both: host wins.\n const behaviors = React.useMemo<readonly RuntimeBehavior[] | undefined>(() => {\n if (!declaredBehaviors?.length) return hostBehaviors\n if (!hostBehaviors?.length) return declaredBehaviors\n const hostIds = new Set(hostBehaviors.map((b) => b.id))\n return [...declaredBehaviors.filter((b) => !hostIds.has(b.id)), ...hostBehaviors]\n }, [declaredBehaviors, hostBehaviors])\n const hasBehaviors = Boolean(behaviors && behaviors.length > 0)\n\n // Nothing dynamic — no sources, no state, no behaviors, no form bindings, no\n // block action: pass through directly (zero overhead). Write-only surfaces\n // (formBindings without any read source) and state-only wizards must NOT\n // take it — see surfaceNeedsDataBinding() and hasEntityFormBindings().\n if (!hasBehaviors && !surfaceNeedsDataBinding(surface)) {\n const passthrough: RenderableSurface = {\n // `id` FORWARDED, not dropped. SurfaceRenderer derives its scope from\n // `surface.id`: with an id the per-surface rules key off the attribute\n // VALUE (`[data-pw-surface=\"<id>\"]`), without one they fall back to the\n // value-less `[data-pw-surface]` and every surface in a document shares\n // them. Rebuilding the surface object here silently erased the id, so the\n // scoping degraded on this path while looking correct in the source.\n ...(surface.id !== undefined ? { id: surface.id } : {}),\n blocks,\n ...(appearance !== undefined ? { appearance } : {}),\n ...(capabilities !== undefined ? { capabilities } : {}),\n }\n return onEvent ? (\n <SurfaceRenderer surface={passthrough} onEvent={onEvent} {...rest} />\n ) : (\n <SurfaceRenderer surface={passthrough} {...rest} />\n )\n }\n\n // Wrap with DataCapabilityProvider to provide DataService context\n return (\n <DataCapabilityProvider {...(dataServiceConfig ? { config: dataServiceConfig } : {})}>\n {onEvent ? (\n <DataBoundInner\n {...(surface.id !== undefined ? { surfaceId: surface.id } : {})}\n blocks={blocks}\n dataSources={dataSources ?? []}\n initialState={initialState}\n appearance={appearance}\n capabilities={capabilities}\n {...(behaviors !== undefined ? { behaviors } : {})}\n {...(onNavigateAction !== undefined ? { onNavigateAction } : {})}\n onEvent={onEvent}\n rendererProps={rest}\n />\n ) : (\n <DataBoundInner\n {...(surface.id !== undefined ? { surfaceId: surface.id } : {})}\n blocks={blocks}\n dataSources={dataSources ?? []}\n initialState={initialState}\n appearance={appearance}\n capabilities={capabilities}\n {...(behaviors !== undefined ? { behaviors } : {})}\n {...(onNavigateAction !== undefined ? { onNavigateAction } : {})}\n rendererProps={rest}\n />\n )}\n </DataCapabilityProvider>\n )\n}\n\n// ============================================================\n// DataBoundInner (split to allow hooks — needs DataCapabilityProvider ancestor)\n// ============================================================\n\ninterface DataBoundInnerProps {\n /** The surface's scope id — threaded through because this component receives\n * the surface DECOMPOSED into pieces, and `id` was never one of the pieces.\n * Without it the rebuilt surface below has no id and SurfaceRenderer falls\n * back to the value-less `[data-pw-surface]` scope. */\n surfaceId?: string\n blocks: readonly Block[]\n dataSources: readonly SurfaceDataSourceDefinition[]\n initialState: Readonly<Record<string, unknown>> | undefined\n appearance?: RenderableSurface['appearance']\n capabilities?: RenderableSurface['capabilities']\n onEvent?: (event: SurfaceEvent) => void\n behaviors?: readonly RuntimeBehavior[]\n onNavigateAction?: (url: string) => boolean\n rendererProps: Omit<SurfaceRendererProps, 'surface' | 'onEvent'>\n}\n\nfunction DataBoundInner({\n surfaceId,\n blocks,\n dataSources,\n initialState,\n appearance,\n capabilities,\n onEvent,\n behaviors,\n onNavigateAction,\n rendererProps,\n}: DataBoundInnerProps): React.ReactElement {\n const interactionMode = rendererProps.interactionMode ?? 'live'\n const entityFacade = (rendererProps as { entityFacade?: EntityFacade }).entityFacade\n // Same pass-through route as entityFacade: declared on\n // DataBoundSurfaceRendererProps, travels inside rendererProps.\n const loadingStrategy =\n (rendererProps as { loadingStrategy?: 'gate' | 'immediate' }).loadingStrategy ?? 'gate'\n // Connections context travels the same pass-through route\n // (declared on SurfaceRendererProps, so it also reaches SurfaceRenderer's\n // SurfaceConnectionsContext provider via the rendererProps spread below).\n const connections = (rendererProps as { connections?: SurfaceConnectionsValue }).connections\n const dataCache = (rendererProps as { dataCache?: SurfaceDataCache }).dataCache\n // Keyed by the ids, so a re-render that changes nothing hands useSurfaceData\n // the same set (its expression context depends on it).\n const writeOnlyKey = React.useMemo(\n () => [...writeOnlySourceIds({ blocks, dataSources, capabilities, behaviors })].sort().join('\\n'),\n [blocks, dataSources, capabilities, behaviors]\n )\n const writeOnly = React.useMemo<ReadonlySet<string>>(\n () => new Set(writeOnlyKey === '' ? [] : writeOnlyKey.split('\\n')),\n [writeOnlyKey]\n )\n const { expressionData, initialLoaded, setStateValue, refreshSource, fetchAllSources } =\n useSurfaceData(dataSources, initialState, interactionMode, entityFacade, connections, dataCache, writeOnly)\n\n // Resolve expressions in blocks\n const resolvedBlocks = React.useMemo(\n () => resolveBlockExpressions(blocks as Block[], expressionData),\n [blocks, expressionData]\n )\n\n // Shared action dispatcher — handles all six action types\n const dispatchAction = React.useCallback(\n (action: SurfaceAction) => {\n switch (action.type) {\n case 'setState':\n setStateValue(action.key, action.value)\n break\n case 'refresh':\n refreshSource(action.sourceId)\n break\n case 'refreshAll':\n fetchAllSources()\n break\n case 'showBlock':\n setStateValue('__show:' + action.blockId, true)\n break\n case 'hideBlock':\n setStateValue('__show:' + action.blockId, false)\n break\n case 'navigate':\n // Give the host a chance to handle this in place first (e.g. a\n // connected-preview mode swapping to a sibling page) before falling\n // through to a real hard navigation.\n if (onNavigateAction?.(action.url)) break\n if (isSafeNavigateUrl(action.url)) {\n window.location.assign(action.url)\n } else {\n console.warn('[surface] blocked unsafe navigate URL:', action.url)\n }\n break\n }\n },\n [setStateValue, refreshSource, fetchAllSources, onNavigateAction]\n )\n\n // Event interceptor\n const handleEvent = React.useCallback(\n (event: SurfaceEvent) => {\n // Inert (editor/preview): skip block-dispatched surface actions (state\n // mutations / data refreshes) so the surface doesn't mutate its own state\n // while authoring. `onEvent` is a pure notification and STILL fires below\n // — only the real data side-effects are gated.\n if (interactionMode !== 'inert') {\n // Check if the event payload contains a surface action\n const payload = event.payload as Record<string, unknown> | undefined\n const action = payload?.action\n\n if (isSurfaceAction(action)) {\n dispatchAction(action)\n }\n\n // `canonicalType` is normally stamped by the bus bridge (renderer.tsx's\n // busOnEvent), but some deployed block bundles still call\n // `context.onEvent` directly (the pre-bus legacy path) — for those,\n // `canonicalType` is absent. Block-scoped click events reaching here\n // always mean a real click occurred, so treat a canonicalType-less\n // 'click' as 'block:click' rather than silently dropping it.\n const fired = event.canonicalType ?? (event.type === 'click' && event.blockId ? 'block:click' : '')\n\n // A block's own `action` prop (one action or a list, run in order) is\n // what its CLICK does — and only its click. It used to run on every\n // event the block emitted, so a block that also reported hover, focus\n // or a value change would have fired its click action on each of them.\n // Looked up in the RESOLVED tree, so a repeat clone (`id--N`) carries\n // its own row's values.\n if (fired === 'block:click') {\n blockActionsOf(findBlockAction(resolvedBlocks, event.blockId)).forEach(dispatchAction)\n }\n\n // Execute stored behaviors whose trigger matches this canonical event.\n if (behaviors && behaviors.length > 0) {\n for (const b of behaviors) {\n if (canonicalizeEventType(b.event) !== fired) continue\n if (b.targetBlockId && b.targetBlockId !== event.blockId) continue\n b.actions.forEach(dispatchAction)\n }\n }\n }\n\n // Forward to original handler — a pure notification, always fires (the\n // host decides what side-effects, if any, to run).\n onEvent?.(event)\n },\n [interactionMode, onEvent, dispatchAction, resolvedBlocks, behaviors]\n )\n\n // Loading state — 'gate' strategy only (the historical default): the whole\n // block tree is withheld until the first fetch pass settles. 'immediate'\n // skips this and renders the tree at once; unresolved bindings evaluate to\n // undefined and fill in per source (see loadingStrategy prop docs).\n if (!initialLoaded && loadingStrategy !== 'immediate') {\n return (\n <div\n data-surface-loading\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '48px',\n // Theme-tokened with the old hardcoded values as fallbacks, so the\n // gate no longer paints light-theme blue on a dark-themed surface.\n color: 'var(--pw-color-text-muted, #666)',\n }}\n >\n <div style={{ textAlign: 'center' }}>\n <div\n style={{\n width: '32px',\n height: '32px',\n border: '3px solid var(--pw-color-border, #e5e7eb)',\n borderTopColor: 'var(--pw-color-primary, #3b82f6)',\n borderRadius: '50%',\n animation: 'spin 0.8s linear infinite',\n margin: '0 auto 12px',\n }}\n />\n Loading data...\n </div>\n </div>\n )\n }\n\n const resolvedSurface: RenderableSurface = {\n // See the passthrough branch above — same reason, same one-line omission.\n ...(surfaceId !== undefined ? { id: surfaceId } : {}),\n blocks: resolvedBlocks,\n ...(appearance !== undefined ? { appearance } : {}),\n ...(capabilities !== undefined ? { capabilities } : {}),\n }\n return (\n // What is bound right now, for the providers under SurfaceRenderer that\n // must act on it — the form writer decides create-vs-update from the\n // record a source has loaded, and could not see one before this.\n <SurfaceDataContext.Provider value={expressionData}>\n <SurfaceRenderer surface={resolvedSurface} onEvent={handleEvent} {...rendererProps} />\n </SurfaceDataContext.Provider>\n )\n}\n\n// ============================================================\n// HELPERS\n// ============================================================\n\n/**\n * Find the action prop of a block by ID in the resolved block tree.\n */\nfunction findBlockAction(blocks: readonly Block[], blockId: string): unknown {\n for (const block of blocks) {\n if (block.id === blockId) {\n return block.props?.action\n }\n if (block.children) {\n const found = findBlockAction(block.children, blockId)\n if (found !== undefined) return found\n }\n }\n return undefined\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataBoundSurfaceRenderer.js","sourceRoot":"","sources":["../../src/render/DataBoundSurfaceRenderer.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAiB,MAAM,YAAY,C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CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxD,CAAA;IACD,OAAO;IACL,wEAAwE;IACxE,qEAAqE;IACrE,iEAAiE;IACjE,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YAChD,KAAC,eAAe,IAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,KAAM,aAAa,GAAI,GAC1D,CAC/B,CAAA;AACH,CAAC;AAED,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D;;GAEG;AACH,SAAS,eAAe,CAAC,MAAwB,EAAE,OAAe;IAChE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,KAAK,EAAE,MAAM,CAAA;QAC5B,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACtD,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAA;QACvC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["/**\n * Data-Bound Surface Renderer\n *\n * Wrapper component that resolves dataSources, state, and {{expression}} props\n * before passing concrete values to the existing SurfaceRenderer.\n *\n * Architecture (post-refactor):\n * Surface JSON (dataSources + state + {{expr}} in props)\n * -> DataBoundSurfaceRenderer\n * -> DataCapabilityProvider (creates DataService instance)\n * -> DataBoundInner\n * -> useSurfaceData: maps SurfaceDataSourceDefinition → DataSourceDefinition,\n * registers with DataService, fetches via DataService, manages React state\n * -> SurfaceRenderer (unchanged)\n * -> Block components (unchanged)\n *\n * Backward compatible: if no dataSources, passes through with zero overhead.\n *\n * @module @pwfabric/runtime/render/DataBoundSurfaceRenderer\n */\n\nimport * as React from 'react'\nimport { SurfaceRenderer } from './renderer.js'\nimport { literalPropsOf, resolveBlockExpressions } from './resolve-expressions.js'\nimport { useDynamicBlocks } from './dynamic-artifact-context.js'\nimport { readableUrl, urlSchemeOf, type LinkHref } from './links.js'\nimport { endpointMissingPathValue, resolveEndpoint } from './endpoint.js'\nimport { resolveQueryState } from './query-state.js'\nimport { dataSourceCacheKey, type SurfaceDataCache } from './data-cache.js'\nimport { DataCapabilityProvider, useDataService } from '../data/DataCapabilityProvider.js'\nimport type {\n DataBoundSurfaceRendererProps,\n SurfaceDataSourceDefinition,\n SurfaceAction,\n RuntimeBehavior,\n} from './data-binding-types.js'\nimport type {\n SurfaceEvent,\n SurfaceRendererProps,\n RenderableSurface,\n BlockInteractionMode,\n} from './types.js'\nimport type { Block } from '@pwfabric/core'\nimport type { DataSourceDefinition } from '../data/types.js'\nimport { createEntityDataSource } from '../entity/entity-datasource.js'\nimport { aggregateThrough } from '../entity/aggregate.js'\nimport { SurfaceDataContext } from './surface-data-context.js'\nimport type { EntityFacade } from '../entity/facade.js'\nimport type { EntityAggregate, EntityQuery, EntityTypeId } from '../entity/types.js'\nimport type { SurfaceConnectionsValue } from '../connectors/types.js'\nimport { PLATFORM_PERSISTENCE_CAPABILITY_ID } from '@pwfabric/contracts'\nimport { isCapability } from '../capability/type-mapping.js'\nimport { writeOnlySourceIds } from './write-only-sources.js'\n\n// ============================================================\n// extract dataSources + initialState from persistence config\n// ============================================================\n\n/**\n * consolidated these two seeds under the platform/persistence\n * capability config. DataBoundSurfaceRenderer is the sole consumer.\n */\nfunction extractPersistenceSeeds(surface: {\n readonly capabilities?: RenderableSurface['capabilities']\n}): {\n dataSources: readonly SurfaceDataSourceDefinition[] | undefined\n initialState: Readonly<Record<string, unknown>> | undefined\n behaviors: readonly RuntimeBehavior[] | undefined\n} {\n const binding = surface.capabilities?.find(\n (c) => isCapability(c, PLATFORM_PERSISTENCE_CAPABILITY_ID)\n )\n const cfg = binding?.config as\n | {\n dataSources?: readonly SurfaceDataSourceDefinition[]\n initialState?: Readonly<Record<string, unknown>>\n behaviors?: readonly RuntimeBehavior[]\n }\n | undefined\n return {\n dataSources: cfg?.dataSources,\n initialState: cfg?.initialState,\n // Declared behaviors (shipped by a pattern / authored in JSON). The\n // renderer merges these with host-provided behaviors (the host's store) so a pack\n // can carry its own controls without the host knowing about them.\n behaviors: cfg?.behaviors,\n }\n}\n\n/**\n * A source that could not be served but declares a `fallback`: the caller\n * binds `data` AND records `message` under `__errors.<id>`, so the surface\n * renders honestly (sample data + error flag) instead of empty or crashed.\n */\nclass SourceFallback extends Error {\n constructor(\n message: string,\n readonly data: unknown\n ) {\n super(message)\n this.name = 'SourceFallback'\n }\n}\n\n/**\n * A surface whose ONLY dynamic behaviour is writing (platform/entities\n * formBindings, no persistence dataSources) still needs the full data-bound\n * path: the form→entity bridge dispatches statusKeys through setState and the\n * success/error UI hangs off `visibleWhen: \"{{state.x}}\"` — both live in\n * DataBoundInner's state machinery. Before this check, such a surface fell\n * into the zero-overhead passthrough where visibleWhen was never evaluated\n * and, worse, submits were silently lost (proven live against a real\n * SharePoint list: two submits on a formBindings-only page never reached the\n * connector; adding any read source made the identical form work).\n */\nfunction hasEntityFormBindings(surface: {\n readonly capabilities?: RenderableSurface['capabilities']\n}): boolean {\n const entityCap = surface.capabilities?.find((c) => isCapability(c, 'platform/entities'))\n const formBindings = (entityCap?.config as { formBindings?: readonly unknown[] } | undefined)\n ?.formBindings\n return Array.isArray(formBindings) && formBindings.length > 0\n}\n\n/**\n * The actions a block's `action` prop names, in order.\n *\n * One action or a list of them (`[setState step, setState stepError '']`) —\n * a wizard's \"Next\" has to move the step AND clear the previous step's error\n * in one click. Anything that is not a surface action (a form's `action` is\n * its submit URL string) names none.\n */\nexport function blockActionsOf(value: unknown): readonly SurfaceAction[] {\n if (Array.isArray(value)) return value.filter(isSurfaceAction)\n return isSurfaceAction(value) ? [value] : []\n}\n\nfunction blockTreeHasAction(blocks: readonly Block[] | undefined): boolean {\n if (!blocks) return false\n for (const block of blocks) {\n if (blockActionsOf(block.props?.action).length > 0) return true\n if (blockTreeHasAction(block.children)) return true\n }\n return false\n}\n\n/**\n * Does any block carry a condition or a repeat the renderer has to evaluate?\n *\n * `visibleWhen`/`if` and `repeat` are resolved ONLY on the data-bound path.\n * A static page — no source, no state, no action — takes this path too: on\n * the passthrough a condition would never be read, so the shell's empty\n * brand logo would draw as \"⊟ <name> logo\", and a thank-you gated on\n * `{{state.submitted}}` would show before anything was submitted.\n * An empty condition string is no condition, as in resolveBlock.\n */\nfunction blockTreeHasCondition(blocks: readonly Block[] | undefined): boolean {\n if (!blocks) return false\n for (const block of blocks) {\n const b = block as { visibleWhen?: unknown; if?: unknown; repeat?: unknown }\n for (const expr of [b.visibleWhen, b.if, b.repeat]) {\n if (typeof expr === 'string' && expr.trim()) return true\n }\n if (blockTreeHasCondition(block.children)) return true\n }\n return false\n}\n\n/**\n * Does this surface need the data-bound path — state, expression resolution,\n * the action dispatcher — or can it go straight to SurfaceRenderer?\n *\n * ONE ANSWER FOR EVERY HOST. The renderer's own passthrough check and embed's\n * `needsDataBoundRenderer` used to disagree: embed counted `initialState`, the\n * renderer did not. So a wizard page carrying nothing but `initialState` and\n * buttons with `action` props reached the renderer, fell into the passthrough,\n * and there `visibleWhen` was never evaluated, `repeat` never expanded and no\n * `action` was ever dispatched — the buttons were dead. A block `action` alone\n * needs the path too: it is dispatched nowhere else. So does a block\n * `visibleWhen`/`if`/`repeat` (see blockTreeHasCondition).\n *\n * Host-provided behaviors are a prop, not part of the surface, and are\n * checked by the renderer on top of this.\n */\nexport function surfaceNeedsDataBinding(surface: {\n readonly blocks?: readonly Block[]\n readonly capabilities?: RenderableSurface['capabilities']\n}): boolean {\n const { dataSources, initialState, behaviors } = extractPersistenceSeeds(surface)\n return (\n Boolean(dataSources && dataSources.length > 0) ||\n initialState !== undefined ||\n Boolean(behaviors && behaviors.length > 0) ||\n hasEntityFormBindings(surface) ||\n blockTreeHasAction(surface.blocks) ||\n blockTreeHasCondition(surface.blocks)\n )\n}\n\n// ============================================================\n// TYPES\n// ============================================================\n\ninterface SourceData {\n readonly data: unknown\n readonly loading: boolean\n readonly error: string | null\n /** HTTP status of the last answer; null for a network failure or a non-HTTP kind. */\n readonly status?: number | null\n /** The envelope `returns` unwrapped the list from (`total`, `skip`, `limit` …). */\n readonly meta?: Readonly<Record<string, unknown>> | null\n /** Not fetched: a required path value of the endpoint is empty. */\n readonly idle?: boolean\n /** The resolved request `data` answered (see requestKeyOf). */\n readonly key?: string\n}\n\n// ============================================================\n// SURFACE → RUNTIME SOURCE MAPPING\n// ============================================================\n\n/**\n * Maps a JSON-safe SurfaceDataSourceDefinition to a runtime DataSourceDefinition.\n * Returns null for 'state' kind (handled locally via React state, not DataService).\n */\nfunction mapSurfaceSourceToDefinition(\n source: SurfaceDataSourceDefinition,\n currentState: Record<string, unknown>\n): DataSourceDefinition | null {\n switch (source.kind) {\n case 'static':\n return {\n id: source.id,\n kind: 'static',\n staticData: source.staticData,\n // A static source's query was dropped here, so its rows were bound\n // unsorted and unfiltered. Resolved like a rest source's.\n ...(source.query\n ? { query: resolveQueryState(source.query, currentState) as EntityQuery }\n : {}),\n }\n case 'state':\n // State sources read from React state, not managed by DataService\n return null\n case 'rest': {\n if (!source.endpoint) return null\n // `{{state.x}}` placeholders resolve against current state, each value\n // URL-encoded in a mixed endpoint — see resolveEndpoint for why.\n const endpoint = resolveEndpoint(source.endpoint, currentState)\n return {\n id: source.id,\n kind: 'rest' as const,\n endpoint,\n method: source.method ?? 'GET',\n ...(source.headers ? { headers: source.headers } : {}),\n // carry the identity the source names. This branch\n // copied endpoint/method/headers and stopped, so a rest source could\n // declare an identity the fetch would never see.\n ...(source.authProviderRef ? { authProviderRef: source.authProviderRef } : {}),\n // Same omission class as the line above: the source says where its\n // list is and the definition has to carry it, or `fetchRest` hands the\n // binding context a whole JSON body.\n ...(source.returns !== undefined ? { returns: source.returns } : {}),\n // The entity branch resolves `{{state.x}}` inside the query and hands\n // it to the facade; a rest source declared the same query and lost it\n // here. Resolved the same way, applied by the data service after the\n // fetch.\n ...(source.query\n ? { query: resolveQueryState(source.query, currentState) as EntityQuery }\n : {}),\n }\n }\n default:\n return null\n }\n}\n\n// ============================================================\n// useSurfaceData HOOK\n// ============================================================\n\n/**\n * Manages data source fetching, state, and auto-refresh for a data-bound surface.\n *\n * Delegates fetch mechanics to DataService via context.\n * Keeps React state management and expression resolution locally.\n */\ninterface SurfaceDataResult {\n expressionData: Record<string, unknown>\n surfaceState: Record<string, unknown>\n initialLoaded: boolean\n setStateValue: (key: string, value: unknown) => void\n refreshSource: (sourceId: string) => Promise<void>\n fetchAllSources: () => Promise<void>\n}\n\n/** What one fetch of one source came to. */\ntype FetchOutcome =\n | { readonly kind: 'ok'; readonly data: unknown; readonly status: number | null; readonly meta: Readonly<Record<string, unknown>> | null }\n | { readonly kind: 'error'; readonly message: string; readonly status: number | null; readonly fallback?: { readonly data: unknown } }\n\n/** JSON of a source DEFINITION, computed once per definition object. */\nconst definitionJsonCache = new WeakMap<object, string>()\nlet unserialisable = 0\n\nfunction safeJson(value: unknown): string {\n try {\n return JSON.stringify(value) ?? 'undefined'\n } catch {\n // A value that cannot be serialised can never be proven unchanged.\n return `#unserialisable-${++unserialisable}`\n }\n}\n\nfunction definitionJson(source: SurfaceDataSourceDefinition): string {\n let json = definitionJsonCache.get(source)\n if (json === undefined) {\n json = safeJson(source)\n definitionJsonCache.set(source, json)\n }\n return json\n}\n\n/** A REST source whose required path value is empty is not fetched. */\nfunction isIdleSource(source: SurfaceDataSourceDefinition, state: Readonly<Record<string, unknown>>): boolean {\n return source.kind === 'rest' && Boolean(source.endpoint) && endpointMissingPathValue(source.endpoint as string, state)\n}\n\n/**\n * EVERYTHING THAT DECIDES WHAT A SOURCE FETCHES, AS ONE STRING.\n *\n * The definition itself plus whatever it reads from state, RESOLVED: the REST\n * address, the query with its `{{state.*}}` placeholders filled in, a state\n * source's value. A source is refetched when — and only when — this changes.\n *\n * Refetching every source on every `setState` would make a search box writing\n * `state.searchDraft` on each keystroke refetch the product list AND the\n * cart, flashing both loading states, and a menu toggle refetch the whole\n * page. Dependency tracking on the resolved request is exact where\n * key-name extraction is not: `{{state.a ? state.b : state.c}}` depends on `c`\n * only while `a` is false, and the resolved value knows that.\n */\nfunction requestKeyOf(source: SurfaceDataSourceDefinition, state: Readonly<Record<string, unknown>>): string {\n const def = definitionJson(source)\n switch (source.kind) {\n case 'rest': {\n if (!source.endpoint) return def\n if (isIdleSource(source, state)) return `${def}|idle`\n const query = source.query ? safeJson(resolveQueryState(source.query, state)) : ''\n return `${def}|${resolveEndpoint(source.endpoint, state)}|${query}`\n }\n case 'entity': {\n const query = source.query ? safeJson(resolveQueryState(source.query, state)) : ''\n // The resolved aggregate too: a counter whose filter reads\n // `{{state.status}}` must ask again when the status changes.\n const aggregate = source.aggregate ? safeJson(resolveQueryState(source.aggregate, state)) : ''\n return `${def}|${query}|${aggregate}`\n }\n case 'state':\n return `${def}|${safeJson(state[source.id])}`\n case 'static':\n // A query reading `{{state.x}}` re-applies when x changes.\n return source.query ? `${def}|${safeJson(resolveQueryState(source.query, state))}` : def\n default:\n return def\n }\n}\n\nfunction useSurfaceData(\n dataSources: readonly SurfaceDataSourceDefinition[] | undefined,\n initialState: Readonly<Record<string, unknown>> | undefined,\n interactionMode: BlockInteractionMode = 'live',\n entityFacade?: EntityFacade,\n connections?: SurfaceConnectionsValue,\n dataCache?: SurfaceDataCache,\n /** Sources only a form writes to (see write-only-sources): settled, never fetched. */\n writeOnly?: ReadonlySet<string>\n): SurfaceDataResult {\n const dataService = useDataService()\n const writeOnlyRef = React.useRef(writeOnly)\n writeOnlyRef.current = writeOnly\n const dataCacheRef = React.useRef(dataCache)\n dataCacheRef.current = dataCache\n\n // State store\n const [surfaceState, setSurfaceState] = React.useState<Record<string, unknown>>(() => ({\n ...initialState,\n }))\n\n // Source data store — seeded from the host's cache when it has yesterday's\n // rows for a source, so the first frame is not an empty table. The seed is\n // marked loading: the fetch that follows is what makes it today's.\n const [sourceData, setSourceData] = React.useState<Record<string, SourceData>>(() => {\n if (!dataCache || !dataSources) return {}\n const seeded: Record<string, SourceData> = {}\n for (const source of dataSources) {\n const key = dataSourceCacheKey(source, initialState ?? {})\n if (!key) continue\n const hit = dataCache.get(key)\n if (hit !== undefined) {\n seeded[source.id] = { data: hit, loading: true, error: null, key: requestKeyOf(source, initialState ?? {}) }\n }\n }\n return seeded\n })\n // Track whether initial fetch is complete. A page whose every fetched\n // source came out of the cache counts as loaded: the gate has nothing to\n // wait for that the visitor has not already seen.\n const [initialLoaded, setInitialLoaded] = React.useState(() => {\n if (!dataCache || !dataSources) return false\n const fetched = dataSources.filter((s) => dataSourceCacheKey(s, initialState ?? {}) !== undefined)\n return fetched.length > 0 && fetched.every((s) => dataCache.get(dataSourceCacheKey(s, initialState ?? {})!) !== undefined)\n })\n\n // Stable ref to current state for use in fetch callbacks\n const stateRef = React.useRef(surfaceState)\n stateRef.current = surfaceState\n\n // Stable ref to sources\n const sourcesRef = React.useRef(dataSources)\n sourcesRef.current = dataSources\n\n // Stable ref to the entity facade (kind:'entity' sources query through it)\n const entityFacadeRef = React.useRef(entityFacade)\n entityFacadeRef.current = entityFacade\n\n // Stable ref to the connections context (kind:'entity'\n // sources with a `connector` route through the engine registry)\n const connectionsRef = React.useRef(connections)\n connectionsRef.current = connections\n\n /** The request each source was last fetched (or marked idle) for. */\n const requestKeysRef = React.useRef<Record<string, string>>({})\n /** The in-flight fetch of each source — a newer one aborts it. */\n const controllersRef = React.useRef(new Map<string, AbortController>())\n\n // ---- setState action ----\n // Writing the value a key already holds changes nothing, so it renders\n // nothing and fetches nothing.\n const setStateValue = React.useCallback((key: string, value: unknown) => {\n setSurfaceState((prev) => {\n if (prev[key] === value) return prev\n return { ...prev, [key]: value }\n })\n }, [])\n\n // ---- (Re-)register a source's definition for the current state ----\n // Registered even when the source is idle, so a form or a behavior writing\n // to it through the data service still finds it.\n const registerSource = React.useCallback(\n (source: SurfaceDataSourceDefinition, state: Record<string, unknown>) => {\n if (dataService.hasSource(source.id)) dataService.unregisterSource(source.id)\n const definition = mapSurfaceSourceToDefinition(source, state)\n if (definition) dataService.registerSource(definition)\n },\n [dataService]\n )\n\n // ---- Fetch a single source ----\n const fetchSource = React.useCallback(\n async (\n source: SurfaceDataSourceDefinition,\n state: Record<string, unknown>,\n signal: AbortSignal\n ): Promise<FetchOutcome> => {\n const failed = (err: unknown, status: number | null = null): FetchOutcome => ({\n kind: 'error',\n message: err instanceof Error ? err.message : String(err),\n status,\n // fallback declared → bind it; the error stays visible next to it\n ...(err instanceof SourceFallback ? { fallback: { data: err.data } } : {}),\n })\n\n // State sources read from React state directly\n if (source.kind === 'state') {\n return { kind: 'ok', data: state[source.id], status: null, meta: null }\n }\n\n // Entity sources list records via the platform/entities facade.\n // Returns the items array so {{<id>}} binds directly to the list (e.g. a\n // table's `data`). Refreshed by refreshAll after a form→entity create.\n if (source.kind === 'entity') {\n if (!source.entityType) return { kind: 'ok', data: [], status: null, meta: null }\n\n // A source that names a `connector` routes through the\n // host-provided engine registry when that connection is registered\n // there. Registered-but-failed surfaces the reason as an honest\n // per-source error (`__errors.<id>`), never a crash; an unregistered\n // connection (or no registry at all) falls through to the\n // host's entity facade path.\n // `{{state.x}}` inside the query resolves against CURRENT state, so\n // a pagination block writing `state.page` or a segmented-control\n // writing `state.severity` reaches `query.pagination` / `query.filter`.\n // Before this, only REST endpoints saw state; connector queries went raw.\n const query = source.query ? (resolveQueryState(source.query, state) as EntityQuery) : undefined\n // An AGGREGATE source asks for one number, never the rows. Its\n // filter resolves against state like `query` does, and the answer\n // binds `{ fn, field?, value, count }` (`{{<id>.value}}`), exempt\n // from the list wrap below. A counter on an intake collection is\n // allowed what a list of it is not, and a public one no longer hands\n // every row to a stranger so the page can count them.\n const aggregate = source.aggregate\n ? (resolveQueryState(source.aggregate, state) as unknown as EntityAggregate)\n : undefined\n const entityType = source.entityType as EntityTypeId\n // Any failure below binds `fallback` (when declared) and still reports\n // the error — see SourceFallback.\n const fail = (message: string): never => {\n if (source.fallback !== undefined) throw new SourceFallback(message, source.fallback)\n throw new Error(message)\n }\n try {\n const engines = connectionsRef.current?.engines\n if (source.connector && engines) {\n const status = engines.getStatus(source.connector)\n if (status.state !== 'unregistered') {\n const engine = await engines.resolve(source.connector)\n if (engine) {\n if (aggregate) {\n const agg = await aggregateThrough(engine, entityType, aggregate)\n if (agg.success) return { kind: 'ok', data: agg.result, status: null, meta: null }\n return fail(agg.error)\n }\n const res = await engine.query(entityType, (query ?? {}) as EntityQuery)\n if (res.success) return { kind: 'ok', data: res.result.items, status: null, meta: null }\n return fail(res.error)\n }\n const failedStatus = engines.getStatus(source.connector)\n return fail(\n failedStatus.state === 'failed'\n ? failedStatus.reason\n : `Connector engine '${source.connector}' unavailable`\n )\n }\n // Declared connector, nothing registered: a pattern shipped without\n // its connection. With a fallback this is the \"sample data\" path;\n // without one, today's facade route stays.\n if (source.fallback !== undefined) {\n return fail(`Connector '${source.connector}' is not connected`)\n }\n }\n\n const facade = entityFacadeRef.current\n if (!facade) {\n return source.fallback !== undefined\n ? fail('No entity facade available')\n : {\n kind: 'ok',\n data: aggregate\n ? { fn: aggregate.fn, ...(aggregate.field ? { field: aggregate.field } : {}), value: null, count: 0 }\n : [],\n status: null,\n meta: null,\n }\n }\n if (aggregate) {\n if (typeof facade.resolveAggregate === 'function') {\n // A count that cannot be served is an error, not a 0: bind\n // `fallback` and report it, same as a failed list.\n try {\n const agg = await facade.resolveAggregate(entityType, aggregate)\n return { kind: 'ok', data: agg, status: null, meta: null }\n } catch (err) {\n return fail(err instanceof Error ? err.message : String(err))\n }\n }\n // A facade from before `resolveAggregate` lists; the rows it\n // returns are reduced here, same as a list-only engine.\n const viaList = await aggregateThrough(\n { query: async (t, q) => ({ success: true, result: await facade.resolveBinding(t, q) }) },\n entityType,\n aggregate\n )\n if (!viaList.success) return fail(viaList.error)\n return { kind: 'ok', data: viaList.result, status: null, meta: null }\n }\n const eds = createEntityDataSource(facade, {\n id: source.id,\n entityType: source.entityType as EntityTypeId,\n ...(query ? { query } : {}),\n })\n try {\n const result = await eds.fetch()\n return { kind: 'ok', data: result.items, status: null, meta: null }\n } catch (err) {\n return fail(err instanceof Error ? err.message : String(err))\n }\n } catch (err) {\n return failed(err)\n }\n }\n\n // Everything else goes through the DataService, registered for THIS state.\n registerSource(source, state)\n const result = await dataService.fetchData(source.id, {\n signal,\n ...(source.headers ? { headers: source.headers } : {}),\n })\n if (result.success) {\n return {\n kind: 'ok',\n data: result.data,\n status: result.metadata.status ?? null,\n meta: result.metadata.envelope ?? null,\n }\n }\n // A refused read (401/403), a 404, a 500 or no answer at all: the source\n // could not be served, and its `fallback` is bound like an entity\n // source's (data-protocol §2). This branch reported the error and\n // dropped the fallback, so under a host that rewrites entity sources\n // into rest reads of its records (`pwf dev`), a page reading a\n // create-only model showed neither rows nor its sample data.\n const message = result.error.message\n return failed(\n source.fallback !== undefined ? new SourceFallback(message, source.fallback) : new Error(message),\n result.error.status ?? null\n )\n },\n [dataService, registerSource]\n )\n\n // ---- Fetch a set of sources for the current state ----\n const fetchSources = React.useCallback(\n async (sources: readonly SurfaceDataSourceDefinition[]) => {\n const state = stateRef.current\n const idle: SurfaceDataSourceDefinition[] = []\n const writeOnlySettled: SurfaceDataSourceDefinition[] = []\n const jobs: { source: SurfaceDataSourceDefinition; controller: AbortController; key: string }[] = []\n for (const source of sources) {\n controllersRef.current.get(source.id)?.abort()\n controllersRef.current.delete(source.id)\n const key = requestKeyOf(source, state)\n requestKeysRef.current[source.id] = key\n if (isIdleSource(source, state)) {\n idle.push(source)\n registerSource(source, state)\n continue\n }\n // A form's write target nothing reads: no list request — not on\n // mount, not after a submit's refreshAll. Still registered, so the\n // form's write through the data service finds it.\n if (writeOnlyRef.current?.has(source.id) === true) {\n writeOnlySettled.push(source)\n registerSource(source, state)\n continue\n }\n const controller = new AbortController()\n controllersRef.current.set(source.id, controller)\n jobs.push({ source, controller, key })\n }\n\n // Idle sources settle at once: no data, not loading, no error. The data\n // of whatever was shown before belongs to another request, so it goes.\n // Fetched sources show their loading flag and keep their data until the\n // answer arrives (a filter change does not blank the list meanwhile).\n setSourceData((prev) => {\n const next = { ...prev }\n for (const source of idle) {\n next[source.id] = { data: null, loading: false, error: null, status: null, meta: null, idle: true, key: requestKeysRef.current[source.id] as string }\n }\n for (const source of writeOnlySettled) {\n next[source.id] = { data: null, loading: false, error: null, status: null, meta: null, key: requestKeysRef.current[source.id] as string }\n }\n for (const { source } of jobs) {\n const p = prev[source.id]\n next[source.id] = {\n data: p?.data ?? null,\n loading: true,\n error: null,\n status: p?.status ?? null,\n meta: p?.meta ?? null,\n ...(p?.key !== undefined ? { key: p.key } : {}),\n }\n }\n return next\n })\n\n await Promise.all(\n jobs.map(async ({ source, controller, key }) => {\n let outcome: FetchOutcome\n try {\n outcome = await fetchSource(source, state, controller.signal)\n } catch (err) {\n outcome = { kind: 'error', message: err instanceof Error ? err.message : String(err), status: null }\n }\n if (controller.signal.aborted) return\n controllersRef.current.delete(source.id)\n setSourceData((prev) => {\n const next = { ...prev }\n if (outcome.kind === 'ok') {\n next[source.id] = { data: outcome.data, loading: false, error: null, status: outcome.status, meta: outcome.meta, key }\n } else {\n const p = prev[source.id]\n // ON ERROR, DATA FROM ANOTHER REQUEST IS CLEARED: a search\n // for cart 999 must not leave cart 1 on screen under the error.\n // The SAME request failing again (a refresh, a poll) keeps its\n // last good answer — that answer is still the right record.\n const keep = p?.key === key\n next[source.id] = {\n data: outcome.fallback ? outcome.fallback.data : keep ? (p?.data ?? null) : null,\n loading: false,\n error: outcome.message,\n status: outcome.status,\n meta: keep ? (p?.meta ?? null) : null,\n ...(keep ? { key } : {}),\n }\n }\n return next\n })\n if (outcome.kind === 'ok') {\n const cacheKey = dataSourceCacheKey(source, state)\n if (cacheKey) dataCacheRef.current?.set(cacheKey, outcome.data)\n }\n })\n )\n\n // A pass whose every fetch was superseded settles nothing; the pass\n // that superseded it will.\n if (jobs.length > 0 && jobs.every((j) => j.controller.signal.aborted)) return\n setInitialLoaded(true)\n },\n [fetchSource, registerSource]\n )\n\n // ---- Fetch every source (refreshAll) ----\n const fetchAllSources = React.useCallback(async () => {\n const sources = sourcesRef.current\n if (!sources || sources.length === 0) {\n setInitialLoaded(true)\n return\n }\n await fetchSources(sources)\n }, [fetchSources])\n\n // ---- Refresh a single source ----\n const refreshSource = React.useCallback(\n async (sourceId: string) => {\n const source = sourcesRef.current?.find((s) => s.id === sourceId)\n if (!source) return\n await fetchSources([source])\n },\n [fetchSources]\n )\n\n // ---- Initial fetch + refetch of the sources whose request changed ----\n React.useEffect(() => {\n const sources = dataSources ?? []\n const present = new Set(sources.map((s) => s.id))\n for (const id of Object.keys(requestKeysRef.current)) {\n if (present.has(id)) continue\n delete requestKeysRef.current[id]\n controllersRef.current.get(id)?.abort()\n controllersRef.current.delete(id)\n if (dataService.hasSource(id)) dataService.unregisterSource(id)\n }\n if (sources.length === 0) {\n setInitialLoaded(true)\n return\n }\n const changed = sources.filter((s) => requestKeyOf(s, surfaceState) !== requestKeysRef.current[s.id])\n if (changed.length > 0) void fetchSources(changed)\n }, [dataSources, surfaceState, fetchSources, dataService])\n\n // ---- Unmount: abort what is in flight, forget what was fetched ----\n // Forgetting matters under StrictMode's mount → unmount → mount: the second\n // mount must fetch again, not believe the aborted first pass succeeded.\n React.useEffect(() => {\n const controllers = controllersRef.current\n return () => {\n for (const controller of controllers.values()) controller.abort()\n controllers.clear()\n requestKeysRef.current = {}\n for (const source of sourcesRef.current ?? []) {\n if (dataService.hasSource(source.id)) dataService.unregisterSource(source.id)\n }\n }\n }, [dataService])\n\n // ---- Auto-refresh intervals ----\n React.useEffect(() => {\n // Inert (editor/preview): never start auto-refresh timers.\n if (!dataSources || interactionMode === 'inert') return\n\n const intervals: ReturnType<typeof setInterval>[] = []\n\n for (const source of dataSources) {\n if (source.refreshInterval && source.refreshInterval > 0) {\n const interval = setInterval(() => {\n void refreshSource(source.id)\n }, source.refreshInterval)\n intervals.push(interval)\n }\n }\n\n return () => {\n for (const interval of intervals) {\n clearInterval(interval)\n }\n }\n }, [dataSources, refreshSource, interactionMode])\n\n // ---- Build expression context ----\n const expressionData = React.useMemo(() => {\n const ctx: Record<string, unknown> = { state: surfaceState }\n // Per-source loading flags for skeleton UIs: `{{__loading.<sourceId>}}` /\n // `{{__anyLoading}}`. A declared source with no sourceData entry yet has\n // not even started its first fetch (the fetch effect runs after first\n // paint) — report it as loading so a skeleton shows from frame one\n // instead of flashing the block's empty state. `state`-kind sources read\n // synchronously from React state and are never \"loading\".\n const loadingMap: Record<string, boolean> = {}\n let anyLoading = false\n // Per-source error messages — `{{__errors.<sourceId>}}` — so a block can\n // distinguish \"fetch failed\" from \"fetched, genuinely empty\" instead of\n // showing a false empty-state. The value is the error MESSAGE string\n // (truthy check + tooltip content in one binding); null when healthy.\n const errorMap: Record<string, string | null> = {}\n let anyError = false\n // `{{__status.<id>}}` — the HTTP status of the last answer (200, 404, …);\n // null for a network failure, an idle source or a non-HTTP kind.\n // `{{__notFound.<id>}}` — status 404, so \"no such order\" and \"connection\n // error\" can be told apart. `{{__idle.<id>}}` — a REST source\n // not fetched because a required path value is empty.\n // `{{__meta.<id>}}` — the envelope `returns` unwrapped the list from\n // (`total`, `skip`, `limit` …); null when there is none.\n const statusMap: Record<string, number | null> = {}\n const notFoundMap: Record<string, boolean> = {}\n const idleMap: Record<string, boolean> = {}\n const metaMap: Record<string, Readonly<Record<string, unknown>> | null> = {}\n for (const source of dataSources ?? []) {\n const entry = sourceData[source.id]\n const loading =\n source.kind === 'state' || writeOnly?.has(source.id) === true ? false : entry ? entry.loading : true\n loadingMap[source.id] = loading\n if (loading) anyLoading = true\n const error = entry?.error ?? null\n errorMap[source.id] = error\n if (error) anyError = true\n const status = entry?.status ?? null\n statusMap[source.id] = status\n notFoundMap[source.id] = status === 404\n idleMap[source.id] = entry?.idle === true\n metaMap[source.id] = entry?.meta ?? null\n }\n /**\n * A LIST SOURCE ALWAYS BINDS AS A LIST.\n *\n * The entity path returns `result.items` — an array. The rest path\n * returned the whole JSON body, or, since `returns` landed, the plucked\n * value. So the same block bound to `{{data.Product}}` received an array\n * from our store and an object from anyone else's, and swapping a model\n * from platform to a connection quietly changed what every bound block\n * got. One shape.\n *\n * `static` and `state` are the documented exceptions and stay untouched:\n * a state source is routinely a scalar, and wrapping it would break every\n * shipped surface that reads one.\n */\n const LIST_KINDS = new Set(['rest', 'entity', 'graphql'])\n const kindById = new Map((dataSources ?? []).map((s) => [s.id, s.kind]))\n // An AGGREGATE source is one number, not a list of one: wrapping\n // `{ value }` into `[{ value }]` would still read through the single-\n // element fallthrough, but `.length` would lie and `count` would hide.\n // Entity-only: that is the one branch that reads `aggregate`; a rest\n // source carrying the key still fetches a list and binds as one.\n const aggregateIds = new Set(\n (dataSources ?? []).filter((s) => s.kind === 'entity' && s.aggregate !== undefined).map((s) => s.id)\n )\n for (const [key, value] of Object.entries(sourceData)) {\n const listy = LIST_KINDS.has(kindById.get(key) ?? '') && !aggregateIds.has(key)\n ctx[key] =\n listy && value.data != null && !Array.isArray(value.data) ? [value.data] : value.data\n }\n ctx['__loading'] = loadingMap\n ctx['__anyLoading'] = anyLoading\n ctx['__errors'] = errorMap\n ctx['__anyError'] = anyError\n ctx['__status'] = statusMap\n ctx['__notFound'] = notFoundMap\n ctx['__idle'] = idleMap\n ctx['__meta'] = metaMap\n return ctx\n }, [surfaceState, sourceData, dataSources, writeOnly])\n\n return {\n expressionData,\n surfaceState,\n initialLoaded,\n setStateValue,\n refreshSource,\n fetchAllSources,\n }\n}\n\n// ============================================================\n// canonicalizeEventType\n// ============================================================\n\n/**\n * Normalize a stored behavior trigger string to canonical colon form.\n * - Already has `:` → return lowercased/trimmed as-is\n * - Has `.` → replace first `.` with `:`\n * - Otherwise → return trimmed lowercased (best-effort; won't match well-formed events)\n */\nexport function canonicalizeEventType(raw: string): string {\n const s = raw.trim().toLowerCase()\n if (s.includes(':')) return s\n if (s.includes('.')) return s.replace('.', ':')\n return s\n}\n\n// ============================================================\n// behaviorTargets\n// ============================================================\n\n/**\n * Whether a behavior aimed at `targetBlockId` hears an event from `blockId`.\n *\n * A block inside a `repeat` is drawn once per row, each copy with the id\n * `<id>--<index>` (`<id>--<outer>--<inner>` in a nested repeat) — the id the\n * event carries. The receipt can only name the TEMPLATE id; matching it\n * exactly meant a behavior aimed at a repeated block never fired. The\n * template id names every copy; a copy id still names that one copy.\n */\nexport function behaviorTargets(targetBlockId: string, blockId: string): boolean {\n if (blockId === targetBlockId) return true\n if (!blockId.startsWith(`${targetBlockId}--`)) return false\n return /^(--\\d+)+$/.test(blockId.slice(targetBlockId.length))\n}\n\n// ============================================================\n// isSurfaceAction\n// ============================================================\n\nexport function isSurfaceAction(value: unknown): value is SurfaceAction {\n if (!value || typeof value !== 'object') return false\n const obj = value as Record<string, unknown>\n return (\n obj.type === 'setState' ||\n obj.type === 'refresh' ||\n obj.type === 'refreshAll' ||\n obj.type === 'showBlock' ||\n obj.type === 'hideBlock' ||\n obj.type === 'navigate'\n )\n}\n\n/**\n * Guard the `navigate` action against XSS: only http(s) absolute URLs and\n * relative/anchor URLs may be navigated to. A scheme like `javascript:`,\n * `data:`, or `vbscript:` is rejected so a stored behavior cannot execute\n * script in a published-surface visitor's context. Control characters are\n * stripped first to defeat `java\\tscript:`-style scheme smuggling.\n */\nexport function isSafeNavigateUrl(url: unknown): url is string {\n if (typeof url !== 'string') return false\n if (readableUrl(url) === '') return false\n const s = urlSchemeOf(url)\n if (s === null) return true // relative path / query / hash / protocol-relative\n return s === 'http' || s === 'https'\n}\n\n// ============================================================\n// DataBoundSurfaceRenderer COMPONENT\n// ============================================================\n\n/**\n * Data-bound surface renderer.\n *\n * If nothing on the surface is dynamic (see surfaceNeedsDataBinding), renders\n * SurfaceRenderer directly (zero overhead).\n * Otherwise, wraps with DataCapabilityProvider for DataService context, then\n * fetches data, manages state, resolves expressions, and intercepts events.\n */\nexport function DataBoundSurfaceRenderer(props: DataBoundSurfaceRendererProps): React.ReactElement {\n const { surface, onEvent, behaviors: hostBehaviors, onNavigateAction, dataServiceConfig, ...rest } = props\n const { blocks, appearance, capabilities } = surface\n // dataSources + initialState + declared behaviors live under platform/persistence config\n const { dataSources, initialState, behaviors: declaredBehaviors } = extractPersistenceSeeds(surface)\n // Declared (JSON) first, host (its store) after — same id in both: host wins.\n const behaviors = React.useMemo<readonly RuntimeBehavior[] | undefined>(() => {\n if (!declaredBehaviors?.length) return hostBehaviors\n if (!hostBehaviors?.length) return declaredBehaviors\n const hostIds = new Set(hostBehaviors.map((b) => b.id))\n return [...declaredBehaviors.filter((b) => !hostIds.has(b.id)), ...hostBehaviors]\n }, [declaredBehaviors, hostBehaviors])\n const hasBehaviors = Boolean(behaviors && behaviors.length > 0)\n\n // Nothing dynamic — no sources, no state, no behaviors, no form bindings, no\n // block action: pass through directly (zero overhead). Write-only surfaces\n // (formBindings without any read source) and state-only wizards must NOT\n // take it — see surfaceNeedsDataBinding() and hasEntityFormBindings().\n if (!hasBehaviors && !surfaceNeedsDataBinding(surface)) {\n const passthrough: RenderableSurface = {\n // `id` FORWARDED, not dropped. SurfaceRenderer derives its scope from\n // `surface.id`: with an id the per-surface rules key off the attribute\n // VALUE (`[data-pw-surface=\"<id>\"]`), without one they fall back to the\n // value-less `[data-pw-surface]` and every surface in a document shares\n // them. Rebuilding the surface object here silently erased the id, so the\n // scoping degraded on this path while looking correct in the source.\n ...(surface.id !== undefined ? { id: surface.id } : {}),\n blocks,\n ...(appearance !== undefined ? { appearance } : {}),\n ...(capabilities !== undefined ? { capabilities } : {}),\n }\n return onEvent ? (\n <SurfaceRenderer surface={passthrough} onEvent={onEvent} {...rest} />\n ) : (\n <SurfaceRenderer surface={passthrough} {...rest} />\n )\n }\n\n // Wrap with DataCapabilityProvider to provide DataService context\n return (\n <DataCapabilityProvider {...(dataServiceConfig ? { config: dataServiceConfig } : {})}>\n {onEvent ? (\n <DataBoundInner\n {...(surface.id !== undefined ? { surfaceId: surface.id } : {})}\n blocks={blocks}\n dataSources={dataSources ?? []}\n initialState={initialState}\n appearance={appearance}\n capabilities={capabilities}\n {...(behaviors !== undefined ? { behaviors } : {})}\n {...(onNavigateAction !== undefined ? { onNavigateAction } : {})}\n onEvent={onEvent}\n rendererProps={rest}\n />\n ) : (\n <DataBoundInner\n {...(surface.id !== undefined ? { surfaceId: surface.id } : {})}\n blocks={blocks}\n dataSources={dataSources ?? []}\n initialState={initialState}\n appearance={appearance}\n capabilities={capabilities}\n {...(behaviors !== undefined ? { behaviors } : {})}\n {...(onNavigateAction !== undefined ? { onNavigateAction } : {})}\n rendererProps={rest}\n />\n )}\n </DataCapabilityProvider>\n )\n}\n\n// ============================================================\n// DataBoundInner (split to allow hooks — needs DataCapabilityProvider ancestor)\n// ============================================================\n\ninterface DataBoundInnerProps {\n /** The surface's scope id — threaded through because this component receives\n * the surface DECOMPOSED into pieces, and `id` was never one of the pieces.\n * Without it the rebuilt surface below has no id and SurfaceRenderer falls\n * back to the value-less `[data-pw-surface]` scope. */\n surfaceId?: string\n blocks: readonly Block[]\n dataSources: readonly SurfaceDataSourceDefinition[]\n initialState: Readonly<Record<string, unknown>> | undefined\n appearance?: RenderableSurface['appearance']\n capabilities?: RenderableSurface['capabilities']\n onEvent?: (event: SurfaceEvent) => void\n behaviors?: readonly RuntimeBehavior[]\n onNavigateAction?: (url: string) => boolean\n rendererProps: Omit<SurfaceRendererProps, 'surface' | 'onEvent'>\n}\n\nfunction DataBoundInner({\n surfaceId,\n blocks,\n dataSources,\n initialState,\n appearance,\n capabilities,\n onEvent,\n behaviors,\n onNavigateAction,\n rendererProps,\n}: DataBoundInnerProps): React.ReactElement {\n const interactionMode = rendererProps.interactionMode ?? 'live'\n const entityFacade = (rendererProps as { entityFacade?: EntityFacade }).entityFacade\n // Same pass-through route as entityFacade: declared on\n // DataBoundSurfaceRendererProps, travels inside rendererProps.\n const loadingStrategy =\n (rendererProps as { loadingStrategy?: 'gate' | 'immediate' }).loadingStrategy ?? 'gate'\n // Connections context travels the same pass-through route\n // (declared on SurfaceRendererProps, so it also reaches SurfaceRenderer's\n // SurfaceConnectionsContext provider via the rendererProps spread below).\n const connections = (rendererProps as { connections?: SurfaceConnectionsValue }).connections\n const dataCache = (rendererProps as { dataCache?: SurfaceDataCache }).dataCache\n const linkHref = (rendererProps as { linkHref?: LinkHref }).linkHref\n // Keyed by the ids, so a re-render that changes nothing hands useSurfaceData\n // the same set (its expression context depends on it).\n const writeOnlyKey = React.useMemo(\n () => [...writeOnlySourceIds({ blocks, dataSources, capabilities, behaviors })].sort().join('\\n'),\n [blocks, dataSources, capabilities, behaviors]\n )\n const writeOnly = React.useMemo<ReadonlySet<string>>(\n () => new Set(writeOnlyKey === '' ? [] : writeOnlyKey.split('\\n')),\n [writeOnlyKey]\n )\n const { expressionData, initialLoaded, setStateValue, refreshSource, fetchAllSources } =\n useSurfaceData(dataSources, initialState, interactionMode, entityFacade, connections, dataCache, writeOnly)\n\n // The props each block's manifest declares `bindable: false` stay as\n // written; the descriptors the host handed the renderer carry them.\n const { blocks: descriptors } = useDynamicBlocks()\n const literalProps = React.useMemo(() => literalPropsOf(descriptors.values()), [descriptors])\n\n // Resolve expressions in blocks\n const resolvedBlocks = React.useMemo(\n () =>\n resolveBlockExpressions(blocks as Block[], expressionData, undefined, {\n literalProps,\n ...(linkHref ? { linkHref } : {}),\n }),\n [blocks, expressionData, linkHref, literalProps]\n )\n\n // Shared action dispatcher — handles all six action types\n const dispatchAction = React.useCallback(\n (action: SurfaceAction) => {\n switch (action.type) {\n case 'setState':\n setStateValue(action.key, action.value)\n break\n case 'refresh':\n refreshSource(action.sourceId)\n break\n case 'refreshAll':\n fetchAllSources()\n break\n case 'showBlock':\n setStateValue('__show:' + action.blockId, true)\n break\n case 'hideBlock':\n setStateValue('__show:' + action.blockId, false)\n break\n case 'navigate':\n // Give the host a chance to handle this in place first (e.g. a\n // connected-preview mode swapping to a sibling page) before falling\n // through to a real hard navigation.\n if (onNavigateAction?.(action.url)) break\n if (isSafeNavigateUrl(action.url)) {\n window.location.assign(action.url)\n } else {\n console.warn('[surface] blocked unsafe navigate URL:', action.url)\n }\n break\n }\n },\n [setStateValue, refreshSource, fetchAllSources, onNavigateAction]\n )\n\n // Event interceptor\n const handleEvent = React.useCallback(\n (event: SurfaceEvent) => {\n // Inert (editor/preview): skip block-dispatched surface actions (state\n // mutations / data refreshes) so the surface doesn't mutate its own state\n // while authoring. `onEvent` is a pure notification and STILL fires below\n // — only the real data side-effects are gated.\n if (interactionMode !== 'inert') {\n // Check if the event payload contains a surface action\n const payload = event.payload as Record<string, unknown> | undefined\n const action = payload?.action\n\n if (isSurfaceAction(action)) {\n dispatchAction(action)\n }\n\n // `canonicalType` is normally stamped by the bus bridge (renderer.tsx's\n // busOnEvent), but some deployed block bundles still call\n // `context.onEvent` directly (the pre-bus legacy path) — for those,\n // `canonicalType` is absent. Block-scoped click events reaching here\n // always mean a real click occurred, so treat a canonicalType-less\n // 'click' as 'block:click' rather than silently dropping it.\n const fired = event.canonicalType ?? (event.type === 'click' && event.blockId ? 'block:click' : '')\n\n // A block's own `action` prop (one action or a list, run in order) is\n // what its CLICK does — and only its click. It used to run on every\n // event the block emitted, so a block that also reported hover, focus\n // or a value change would have fired its click action on each of them.\n // Looked up in the RESOLVED tree, so a repeat clone (`id--N`) carries\n // its own row's values.\n if (fired === 'block:click') {\n blockActionsOf(findBlockAction(resolvedBlocks, event.blockId)).forEach(dispatchAction)\n }\n\n // Execute stored behaviors whose trigger matches this canonical event.\n if (behaviors && behaviors.length > 0) {\n for (const b of behaviors) {\n if (canonicalizeEventType(b.event) !== fired) continue\n if (b.targetBlockId && !behaviorTargets(b.targetBlockId, event.blockId)) continue\n b.actions.forEach(dispatchAction)\n }\n }\n }\n\n // Forward to original handler — a pure notification, always fires (the\n // host decides what side-effects, if any, to run).\n onEvent?.(event)\n },\n [interactionMode, onEvent, dispatchAction, resolvedBlocks, behaviors]\n )\n\n // Loading state — 'gate' strategy only (the historical default): the whole\n // block tree is withheld until the first fetch pass settles. 'immediate'\n // skips this and renders the tree at once; unresolved bindings evaluate to\n // undefined and fill in per source (see loadingStrategy prop docs).\n if (!initialLoaded && loadingStrategy !== 'immediate') {\n return (\n <div\n data-surface-loading\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '48px',\n // Theme-tokened with the old hardcoded values as fallbacks, so the\n // gate no longer paints light-theme blue on a dark-themed surface.\n color: 'var(--pw-color-text-muted, #666)',\n }}\n >\n <div style={{ textAlign: 'center' }}>\n <div\n style={{\n width: '32px',\n height: '32px',\n border: '3px solid var(--pw-color-border, #e5e7eb)',\n borderTopColor: 'var(--pw-color-primary, #3b82f6)',\n borderRadius: '50%',\n animation: 'spin 0.8s linear infinite',\n margin: '0 auto 12px',\n }}\n />\n Loading data...\n </div>\n </div>\n )\n }\n\n const resolvedSurface: RenderableSurface = {\n // See the passthrough branch above — same reason, same one-line omission.\n ...(surfaceId !== undefined ? { id: surfaceId } : {}),\n blocks: resolvedBlocks,\n ...(appearance !== undefined ? { appearance } : {}),\n ...(capabilities !== undefined ? { capabilities } : {}),\n }\n return (\n // What is bound right now, for the providers under SurfaceRenderer that\n // must act on it — the form writer decides create-vs-update from the\n // record a source has loaded, and could not see one before this.\n <SurfaceDataContext.Provider value={expressionData}>\n <SurfaceRenderer surface={resolvedSurface} onEvent={handleEvent} {...rendererProps} />\n </SurfaceDataContext.Provider>\n )\n}\n\n// ============================================================\n// HELPERS\n// ============================================================\n\n/**\n * Find the action prop of a block by ID in the resolved block tree.\n */\nfunction findBlockAction(blocks: readonly Block[], blockId: string): unknown {\n for (const block of blocks) {\n if (block.id === blockId) {\n return block.props?.action\n }\n if (block.children) {\n const found = findBlockAction(block.children, blockId)\n if (found !== undefined) return found\n }\n }\n return undefined\n}\n"]}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @module @pwfabric/runtime/render/data-binding-types
|
|
9
9
|
*/
|
|
10
10
|
import type { SurfaceDataCache } from './data-cache.js';
|
|
11
|
+
import type { LinkHref } from './links.js';
|
|
11
12
|
import type { Block } from '@pwfabric/core';
|
|
12
13
|
import type { RenderableSurface, SurfaceRendererProps } from './types.js';
|
|
13
14
|
import type { DataServiceConfig } from '../data/types.js';
|
|
@@ -48,8 +49,10 @@ export interface SurfaceDataSourceDefinition {
|
|
|
48
49
|
* Contract parity with `dataSourceSchema.connector`: which
|
|
49
50
|
* data-plane engine serves this entity source (e.g. 'graph-lists').
|
|
50
51
|
* Routed through the host-provided `ConnectorEngineRegistry` when the
|
|
51
|
-
* connection is registered there; absent/unregistered = the
|
|
52
|
-
* entity facade
|
|
52
|
+
* connection is registered there; absent/unregistered = the host's
|
|
53
|
+
* entity facade, when it provides one. Absent means the app's own records
|
|
54
|
+
* of `entityType` (data-protocol §2.2) — the reference runner serves those
|
|
55
|
+
* from the app's record endpoints, never from a default connection.
|
|
53
56
|
*/
|
|
54
57
|
readonly connector?: string;
|
|
55
58
|
/**
|
|
@@ -110,6 +113,7 @@ export type BlockActionProp = SurfaceAction | readonly SurfaceAction[];
|
|
|
110
113
|
export interface RuntimeBehavior {
|
|
111
114
|
readonly id: string;
|
|
112
115
|
readonly event: string;
|
|
116
|
+
/** The block whose event it hears. A template id inside a `repeat` names every copy (`<id>--<index>`). */
|
|
113
117
|
readonly targetBlockId?: string;
|
|
114
118
|
readonly actions: readonly SurfaceAction[];
|
|
115
119
|
}
|
|
@@ -176,6 +180,13 @@ export interface DataBoundSurfaceRendererProps extends Omit<SurfaceRendererProps
|
|
|
176
180
|
* written back. Pairs naturally with `loadingStrategy: 'immediate'`.
|
|
177
181
|
*/
|
|
178
182
|
readonly dataCache?: SurfaceDataCache;
|
|
183
|
+
/**
|
|
184
|
+
* How the host writes an in-app link (`/session?id=4` → `#/session?id=4`).
|
|
185
|
+
* A host rewrites the links it can read before render; a link whose page is
|
|
186
|
+
* an expression (`href: "{{item.url}}"`) it leaves as written, and the
|
|
187
|
+
* renderer passes its resolved value through this. See render/links.ts.
|
|
188
|
+
*/
|
|
189
|
+
readonly linkHref?: LinkHref;
|
|
179
190
|
/**
|
|
180
191
|
* Configuration for the DataService this renderer creates.
|
|
181
192
|
*
|