@bitbitpress/client 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -19
- package/dist/data/assets.d.ts +11 -3
- package/dist/data/assets.d.ts.map +1 -1
- package/dist/data/assets.js +2 -2
- package/dist/data/assets.js.map +1 -1
- package/dist/data/index.d.ts +2 -2
- package/dist/generated/openapi.d.ts +503 -24
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/react/index.d.ts +29 -54
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +69 -81
- package/dist/react/index.js.map +1 -1
- package/dist/react-native-expo/index.d.ts +1 -52
- package/dist/react-native-expo/index.d.ts.map +1 -1
- package/dist/react-native-expo/index.js +1 -91
- package/dist/react-native-expo/index.js.map +1 -1
- package/dist/runtime/index.d.ts +60 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +84 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/synthesisUi/context.d.ts +18 -0
- package/dist/synthesisUi/context.d.ts.map +1 -0
- package/dist/synthesisUi/context.js +15 -0
- package/dist/synthesisUi/context.js.map +1 -0
- package/dist/synthesisUi/types.d.ts +30 -0
- package/dist/synthesisUi/types.d.ts.map +1 -0
- package/dist/{synthesisView → synthesisUi}/types.js.map +1 -1
- package/dist/user/index.d.ts +61 -13
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +12 -6
- package/dist/user/index.js.map +1 -1
- package/dist/user/interaction.d.ts +5 -0
- package/dist/user/interaction.d.ts.map +1 -1
- package/dist/user/interaction.js +5 -0
- package/dist/user/interaction.js.map +1 -1
- package/dist/user/submissions.d.ts +65 -0
- package/dist/user/submissions.d.ts.map +1 -1
- package/dist/user/submissions.js +57 -0
- package/dist/user/submissions.js.map +1 -1
- package/dist/user/synthesize-batch-manager.js +2 -0
- package/dist/user/synthesize-batch-manager.js.map +1 -1
- package/dist/user/synthesize.d.ts +29 -6
- package/dist/user/synthesize.d.ts.map +1 -1
- package/dist/user/synthesize.js +12 -3
- package/dist/user/synthesize.js.map +1 -1
- package/dist/user/synthesizeUi.d.ts +67 -0
- package/dist/user/synthesizeUi.d.ts.map +1 -0
- package/dist/user/synthesizeUi.js +51 -0
- package/dist/user/synthesizeUi.js.map +1 -0
- package/dist/user/track-batch-manager.d.ts +17 -0
- package/dist/user/track-batch-manager.d.ts.map +1 -0
- package/dist/user/track-batch-manager.js +52 -0
- package/dist/user/track-batch-manager.js.map +1 -0
- package/dist/user/track.d.ts +17 -0
- package/dist/user/track.d.ts.map +1 -0
- package/dist/user/track.js +24 -0
- package/dist/user/track.js.map +1 -0
- package/dist/user/typeDefs.d.ts +9 -3
- package/dist/user/typeDefs.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/react/primitives.d.ts +0 -54
- package/dist/react/primitives.d.ts.map +0 -1
- package/dist/react/primitives.js +0 -223
- package/dist/react/primitives.js.map +0 -1
- package/dist/react-native-expo/primitives.d.ts +0 -58
- package/dist/react-native-expo/primitives.d.ts.map +0 -1
- package/dist/react-native-expo/primitives.js +0 -218
- package/dist/react-native-expo/primitives.js.map +0 -1
- package/dist/synthesisView/context.d.ts +0 -18
- package/dist/synthesisView/context.d.ts.map +0 -1
- package/dist/synthesisView/context.js +0 -15
- package/dist/synthesisView/context.js.map +0 -1
- package/dist/synthesisView/createComponentMap.d.ts +0 -18
- package/dist/synthesisView/createComponentMap.d.ts.map +0 -1
- package/dist/synthesisView/createComponentMap.js +0 -40
- package/dist/synthesisView/createComponentMap.js.map +0 -1
- package/dist/synthesisView/devLog.d.ts +0 -10
- package/dist/synthesisView/devLog.d.ts.map +0 -1
- package/dist/synthesisView/devLog.js +0 -23
- package/dist/synthesisView/devLog.js.map +0 -1
- package/dist/synthesisView/engine.d.ts +0 -35
- package/dist/synthesisView/engine.d.ts.map +0 -1
- package/dist/synthesisView/engine.js +0 -139
- package/dist/synthesisView/engine.js.map +0 -1
- package/dist/synthesisView/primitives.d.ts +0 -180
- package/dist/synthesisView/primitives.d.ts.map +0 -1
- package/dist/synthesisView/primitives.js +0 -29
- package/dist/synthesisView/primitives.js.map +0 -1
- package/dist/synthesisView/resolve.d.ts +0 -17
- package/dist/synthesisView/resolve.d.ts.map +0 -1
- package/dist/synthesisView/resolve.js +0 -42
- package/dist/synthesisView/resolve.js.map +0 -1
- package/dist/synthesisView/types.d.ts +0 -121
- package/dist/synthesisView/types.d.ts.map +0 -1
- package/dist/synthesisView/useEventDrivenView.d.ts +0 -32
- package/dist/synthesisView/useEventDrivenView.d.ts.map +0 -1
- package/dist/synthesisView/useEventDrivenView.js +0 -157
- package/dist/synthesisView/useEventDrivenView.js.map +0 -1
- package/dist/synthesisView/useSynthesisView.d.ts +0 -13
- package/dist/synthesisView/useSynthesisView.d.ts.map +0 -1
- package/dist/synthesisView/useSynthesisView.js +0 -49
- package/dist/synthesisView/useSynthesisView.js.map +0 -1
- package/dist/user/synthesize-view-batch-manager.d.ts +0 -17
- package/dist/user/synthesize-view-batch-manager.d.ts.map +0 -1
- package/dist/user/synthesize-view-batch-manager.js +0 -52
- package/dist/user/synthesize-view-batch-manager.js.map +0 -1
- package/dist/user/synthesizeView.d.ts +0 -41
- package/dist/user/synthesizeView.d.ts.map +0 -1
- package/dist/user/synthesizeView.js +0 -26
- package/dist/user/synthesizeView.js.map +0 -1
- /package/dist/{synthesisView → synthesisUi}/types.js +0 -0
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from 'react';
|
|
2
|
-
import { useBitBitContext } from './context.js';
|
|
3
|
-
function buildNodeMap(nodes) {
|
|
4
|
-
const map = new Map();
|
|
5
|
-
if (!nodes)
|
|
6
|
-
return map;
|
|
7
|
-
for (const n of nodes)
|
|
8
|
-
if (n && typeof n.id === 'string')
|
|
9
|
-
map.set(n.id, n);
|
|
10
|
-
return map;
|
|
11
|
-
}
|
|
12
|
-
function nodeChildIds(node) {
|
|
13
|
-
if (Array.isArray(node.children))
|
|
14
|
-
return node.children;
|
|
15
|
-
if (typeof node.child === 'string')
|
|
16
|
-
return [node.child];
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
const PRIMITIVE_NODE_RESERVED = new Set([
|
|
20
|
-
'id',
|
|
21
|
-
'kind',
|
|
22
|
-
'component',
|
|
23
|
-
'children',
|
|
24
|
-
'child',
|
|
25
|
-
'events',
|
|
26
|
-
]);
|
|
27
|
-
function collectPrimitiveProps(node) {
|
|
28
|
-
const out = {};
|
|
29
|
-
for (const [k, v] of Object.entries(node)) {
|
|
30
|
-
if (PRIMITIVE_NODE_RESERVED.has(k))
|
|
31
|
-
continue;
|
|
32
|
-
out[k] = v;
|
|
33
|
-
}
|
|
34
|
-
return out;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Walks the flat `uiData` array and renders. Resolution order for each
|
|
38
|
-
* node's `component` name:
|
|
39
|
-
* 1. Customer-passed `components` map (overrides).
|
|
40
|
-
* 2. SDK `defaultComponents` (BB primitives).
|
|
41
|
-
* 3. `renderUnknown` fallback.
|
|
42
|
-
*
|
|
43
|
-
* `KEY_NAME` nodes pass their `props` straight through to the resolved
|
|
44
|
-
* component plus a rendered `children` slot. `PRIMITIVE` nodes spread their
|
|
45
|
-
* flat-prop fields (`text`, `src`, `style`, …) onto the rendered component
|
|
46
|
-
* directly.
|
|
47
|
-
*/
|
|
48
|
-
export function SynthesisViewTree({ uiData, components, defaultComponents, normalizeStyle, onEvent, renderUnknown, }) {
|
|
49
|
-
const provided = useBitBitContext();
|
|
50
|
-
if (!uiData || uiData.length === 0)
|
|
51
|
-
return null;
|
|
52
|
-
const nodes = buildNodeMap(uiData);
|
|
53
|
-
const rootId = uiData[0]?.id;
|
|
54
|
-
if (!rootId)
|
|
55
|
-
return null;
|
|
56
|
-
const context = {
|
|
57
|
-
nodes,
|
|
58
|
-
components: { ...defaultComponents, ...provided?.components, ...components },
|
|
59
|
-
normalizeStyle,
|
|
60
|
-
onEvent: onEvent ?? provided?.onEvent,
|
|
61
|
-
renderUnknown,
|
|
62
|
-
};
|
|
63
|
-
return createElement(Fragment, null, renderNode(rootId, context));
|
|
64
|
-
}
|
|
65
|
-
function renderNode(id, context) {
|
|
66
|
-
const node = context.nodes.get(id);
|
|
67
|
-
if (!node)
|
|
68
|
-
return null;
|
|
69
|
-
if (node.kind === 'KEY_NAME') {
|
|
70
|
-
return renderKeyNameNode(node, context);
|
|
71
|
-
}
|
|
72
|
-
return renderPrimitiveNode(node, context);
|
|
73
|
-
}
|
|
74
|
-
function renderPrimitiveNode(node, context) {
|
|
75
|
-
const props = collectPrimitiveProps(node);
|
|
76
|
-
if (node.events && context.onEvent) {
|
|
77
|
-
const emit = context.onEvent;
|
|
78
|
-
for (const [slot, event] of Object.entries(node.events)) {
|
|
79
|
-
props[slot] = (componentPayload) => {
|
|
80
|
-
const payload = { ...(event.payload ?? {}) };
|
|
81
|
-
if (componentPayload && typeof componentPayload === 'object') {
|
|
82
|
-
Object.assign(payload, componentPayload);
|
|
83
|
-
}
|
|
84
|
-
emit({
|
|
85
|
-
name: event.name,
|
|
86
|
-
payload,
|
|
87
|
-
slot,
|
|
88
|
-
nodeId: node.id,
|
|
89
|
-
componentName: node.component,
|
|
90
|
-
handleWith: event.handleWith ?? 'AGENT',
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (props.style !== undefined && context.normalizeStyle) {
|
|
96
|
-
props.style = context.normalizeStyle(props.style);
|
|
97
|
-
}
|
|
98
|
-
const childIds = nodeChildIds(node);
|
|
99
|
-
if (childIds) {
|
|
100
|
-
props.children = childIds.map((childId) => renderNode(childId, context));
|
|
101
|
-
}
|
|
102
|
-
const Component = context.components[node.component];
|
|
103
|
-
if (Component) {
|
|
104
|
-
return createElement(Component, { key: node.id, ...props });
|
|
105
|
-
}
|
|
106
|
-
return createElement(Fragment, { key: node.id }, context.renderUnknown(node.component));
|
|
107
|
-
}
|
|
108
|
-
function renderKeyNameNode(node, context) {
|
|
109
|
-
const Component = context.components[node.component];
|
|
110
|
-
const props = { ...(node.props ?? {}) };
|
|
111
|
-
if (node.events && context.onEvent) {
|
|
112
|
-
const emit = context.onEvent;
|
|
113
|
-
for (const [slot, event] of Object.entries(node.events)) {
|
|
114
|
-
props[slot] = (componentPayload) => {
|
|
115
|
-
const payload = { ...(event.payload ?? {}) };
|
|
116
|
-
if (componentPayload && typeof componentPayload === 'object') {
|
|
117
|
-
Object.assign(payload, componentPayload);
|
|
118
|
-
}
|
|
119
|
-
emit({
|
|
120
|
-
name: event.name,
|
|
121
|
-
payload,
|
|
122
|
-
slot,
|
|
123
|
-
nodeId: node.id,
|
|
124
|
-
componentName: node.component,
|
|
125
|
-
handleWith: event.handleWith ?? 'AGENT',
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
const childIds = nodeChildIds(node);
|
|
131
|
-
if (childIds) {
|
|
132
|
-
props.children = childIds.map((childId) => renderNode(childId, context));
|
|
133
|
-
}
|
|
134
|
-
if (Component) {
|
|
135
|
-
return createElement(Component, { key: node.id, ...props });
|
|
136
|
-
}
|
|
137
|
-
return createElement(Fragment, { key: node.id }, context.renderUnknown(node.component));
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/synthesisView/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAyBhD,SAAS,YAAY,CAAC,KAA+B;IACnD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC;IACvB,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,IA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AAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,aAAa,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Cross-platform prop contracts for the BB built-in primitives. Each primitive
|
|
4
|
-
* names a small set of *semantic* fields (what the engine reads or wires), and
|
|
5
|
-
* accepts arbitrary extra props that pass through to the underlying platform
|
|
6
|
-
* element — no variants, no enum unions. Styling and platform-specific knobs
|
|
7
|
-
* (`style`, `className`, etc.) flow straight to the host element so the UI
|
|
8
|
-
* tree author owns the look without our primitives prescribing one.
|
|
9
|
-
*
|
|
10
|
-
* Future registry contracts are generated from this file.
|
|
11
|
-
*/
|
|
12
|
-
/** Extra props that aren't part of the semantic contract — passed through to
|
|
13
|
-
* the platform host element (e.g. `style`, `className`, ARIA attributes). */
|
|
14
|
-
export type PassThroughProps = Record<string, unknown>;
|
|
15
|
-
export type TextProps = PassThroughProps & {
|
|
16
|
-
text?: string;
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
};
|
|
19
|
-
export type ImageProps = PassThroughProps & {
|
|
20
|
-
src: string;
|
|
21
|
-
alt?: string;
|
|
22
|
-
};
|
|
23
|
-
export type ButtonProps = PassThroughProps & {
|
|
24
|
-
title?: string;
|
|
25
|
-
children?: ReactNode;
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/** Emitted with the authored event payload + bindings; no component payload. */
|
|
28
|
-
onPress?: () => void;
|
|
29
|
-
};
|
|
30
|
-
/** Transparent press target around arbitrary content. Unlike `Button` it
|
|
31
|
-
* imposes no visual chrome, so wrapping `Text`/`Image`/`Card` doesn't alter
|
|
32
|
-
* their look. Web renders as a `role="button"` element so keyboard and
|
|
33
|
-
* screen-reader semantics survive. */
|
|
34
|
-
export type PressableProps = PassThroughProps & {
|
|
35
|
-
children?: ReactNode;
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
onPress?: () => void;
|
|
38
|
-
};
|
|
39
|
-
export type IconProps = PassThroughProps & {
|
|
40
|
-
name: string;
|
|
41
|
-
};
|
|
42
|
-
export type VideoProps = PassThroughProps & {
|
|
43
|
-
src: string;
|
|
44
|
-
poster?: string;
|
|
45
|
-
};
|
|
46
|
-
export type AudioProps = PassThroughProps & {
|
|
47
|
-
src: string;
|
|
48
|
-
};
|
|
49
|
-
/** A point in the gradient's local box, with each axis in [0, 1]. */
|
|
50
|
-
export type GradientPoint = {
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
};
|
|
54
|
-
/** Linear-gradient backdrop primitive. Matches `expo-linear-gradient`'s shape
|
|
55
|
-
* on RN; the web impl converts `start`/`end` to a CSS `linear-gradient(...)`.
|
|
56
|
-
* Defaults paint top→bottom so a no-arg `Gradient` matches the common case. */
|
|
57
|
-
export type GradientProps = PassThroughProps & {
|
|
58
|
-
colors: string[];
|
|
59
|
-
/** Defaults to `{ x: 0, y: 0 }` (top). */
|
|
60
|
-
start?: GradientPoint;
|
|
61
|
-
/** Defaults to `{ x: 0, y: 1 }` (bottom). */
|
|
62
|
-
end?: GradientPoint;
|
|
63
|
-
/** Optional color stops in [0, 1], one per color. */
|
|
64
|
-
locations?: number[];
|
|
65
|
-
children?: ReactNode;
|
|
66
|
-
};
|
|
67
|
-
export type ColumnProps = PassThroughProps & {
|
|
68
|
-
children?: ReactNode;
|
|
69
|
-
};
|
|
70
|
-
/** Horizontal flex container. Same surface as `Column` but the baseline is
|
|
71
|
-
* `flexDirection: 'row'`. Authors override via `style` when needed. */
|
|
72
|
-
export type RowProps = PassThroughProps & {
|
|
73
|
-
children?: ReactNode;
|
|
74
|
-
};
|
|
75
|
-
export type ListProps = PassThroughProps & {
|
|
76
|
-
children?: ReactNode;
|
|
77
|
-
};
|
|
78
|
-
export type CardProps = PassThroughProps & {
|
|
79
|
-
children?: ReactNode;
|
|
80
|
-
};
|
|
81
|
-
export type DividerProps = PassThroughProps;
|
|
82
|
-
/** Vertical scrollable container. Overflowing children scroll on the y-axis.
|
|
83
|
-
* Authors style the viewport (height, padding) via `style`; the inner
|
|
84
|
-
* content sizes naturally to its children. */
|
|
85
|
-
export type VerticalScrollProps = PassThroughProps & {
|
|
86
|
-
children?: ReactNode;
|
|
87
|
-
};
|
|
88
|
-
/** Horizontal scrollable container. Overflowing children scroll on the
|
|
89
|
-
* x-axis. Authors style the viewport (height, padding) via `style`; the
|
|
90
|
-
* inner content sizes naturally to its children. */
|
|
91
|
-
export type HorizontalScrollProps = PassThroughProps & {
|
|
92
|
-
children?: ReactNode;
|
|
93
|
-
};
|
|
94
|
-
export type TabsProps = PassThroughProps & {
|
|
95
|
-
defaultValue?: string;
|
|
96
|
-
children?: ReactNode;
|
|
97
|
-
};
|
|
98
|
-
export type TabsItemProps = PassThroughProps & {
|
|
99
|
-
value: string;
|
|
100
|
-
label: string;
|
|
101
|
-
children?: ReactNode;
|
|
102
|
-
};
|
|
103
|
-
export type ModalProps = PassThroughProps & {
|
|
104
|
-
/** Whether the modal is shown. Default true so a node-mounted modal is visible. */
|
|
105
|
-
open?: boolean;
|
|
106
|
-
children?: ReactNode;
|
|
107
|
-
/** Emitted when the user dismisses via backdrop or close affordance. */
|
|
108
|
-
onClose?: () => void;
|
|
109
|
-
};
|
|
110
|
-
/** All form primitives emit `{ value }` via their event slot; the engine
|
|
111
|
-
* merges that into the authored payload before calling the host's onEvent. */
|
|
112
|
-
export type FormChangePayload<T> = {
|
|
113
|
-
value: T;
|
|
114
|
-
};
|
|
115
|
-
export type TextFieldProps = PassThroughProps & {
|
|
116
|
-
defaultValue?: string;
|
|
117
|
-
placeholder?: string;
|
|
118
|
-
multiline?: boolean;
|
|
119
|
-
disabled?: boolean;
|
|
120
|
-
onChange?: (payload: FormChangePayload<string>) => void;
|
|
121
|
-
};
|
|
122
|
-
export type CheckboxProps = PassThroughProps & {
|
|
123
|
-
label?: string;
|
|
124
|
-
defaultChecked?: boolean;
|
|
125
|
-
disabled?: boolean;
|
|
126
|
-
onChange?: (payload: FormChangePayload<boolean>) => void;
|
|
127
|
-
};
|
|
128
|
-
export type ChoicePickerOption = {
|
|
129
|
-
label: string;
|
|
130
|
-
value: string;
|
|
131
|
-
};
|
|
132
|
-
export type ChoicePickerProps = PassThroughProps & {
|
|
133
|
-
defaultValue?: string;
|
|
134
|
-
options: ChoicePickerOption[];
|
|
135
|
-
disabled?: boolean;
|
|
136
|
-
onChange?: (payload: FormChangePayload<string>) => void;
|
|
137
|
-
};
|
|
138
|
-
export type SliderProps = PassThroughProps & {
|
|
139
|
-
defaultValue?: number;
|
|
140
|
-
min?: number;
|
|
141
|
-
max?: number;
|
|
142
|
-
step?: number;
|
|
143
|
-
disabled?: boolean;
|
|
144
|
-
onChange?: (payload: FormChangePayload<number>) => void;
|
|
145
|
-
};
|
|
146
|
-
export type DateTimeMode = 'date' | 'time' | 'datetime';
|
|
147
|
-
export type DateTimeInputProps = PassThroughProps & {
|
|
148
|
-
defaultValue?: string;
|
|
149
|
-
mode?: DateTimeMode;
|
|
150
|
-
disabled?: boolean;
|
|
151
|
-
onChange?: (payload: FormChangePayload<string>) => void;
|
|
152
|
-
};
|
|
153
|
-
/** The string names a UI tree uses in `UiNode.component` to reference each
|
|
154
|
-
* primitive. The host's `ComponentMap` keys must match. */
|
|
155
|
-
export declare const PRIMITIVE_NAMES: {
|
|
156
|
-
readonly Text: "Text";
|
|
157
|
-
readonly Image: "Image";
|
|
158
|
-
readonly Button: "Button";
|
|
159
|
-
readonly Pressable: "Pressable";
|
|
160
|
-
readonly Icon: "Icon";
|
|
161
|
-
readonly Video: "Video";
|
|
162
|
-
readonly Audio: "Audio";
|
|
163
|
-
readonly Column: "Column";
|
|
164
|
-
readonly Row: "Row";
|
|
165
|
-
readonly List: "List";
|
|
166
|
-
readonly Card: "Card";
|
|
167
|
-
readonly VerticalScroll: "VerticalScroll";
|
|
168
|
-
readonly HorizontalScroll: "HorizontalScroll";
|
|
169
|
-
readonly Tabs: "Tabs";
|
|
170
|
-
readonly TabsItem: "TabsItem";
|
|
171
|
-
readonly Modal: "Modal";
|
|
172
|
-
readonly Divider: "Divider";
|
|
173
|
-
readonly Gradient: "Gradient";
|
|
174
|
-
readonly TextField: "TextField";
|
|
175
|
-
readonly Checkbox: "Checkbox";
|
|
176
|
-
readonly ChoicePicker: "ChoicePicker";
|
|
177
|
-
readonly Slider: "Slider";
|
|
178
|
-
readonly DateTimeInput: "DateTimeInput";
|
|
179
|
-
};
|
|
180
|
-
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/synthesisView/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;;;GASG;AAEH;8EAC8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIvD,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAIF,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAIF,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,OAA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nB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CACzD,CAAC;AAIF;4DAC4D;AAC5D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CAwBlB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// --- Catalog name constants -------------------------------------------------
|
|
2
|
-
/** The string names a UI tree uses in `UiNode.component` to reference each
|
|
3
|
-
* primitive. The host's `ComponentMap` keys must match. */
|
|
4
|
-
export const PRIMITIVE_NAMES = {
|
|
5
|
-
Text: 'Text',
|
|
6
|
-
Image: 'Image',
|
|
7
|
-
Button: 'Button',
|
|
8
|
-
Pressable: 'Pressable',
|
|
9
|
-
Icon: 'Icon',
|
|
10
|
-
Video: 'Video',
|
|
11
|
-
Audio: 'Audio',
|
|
12
|
-
Column: 'Column',
|
|
13
|
-
Row: 'Row',
|
|
14
|
-
List: 'List',
|
|
15
|
-
Card: 'Card',
|
|
16
|
-
VerticalScroll: 'VerticalScroll',
|
|
17
|
-
HorizontalScroll: 'HorizontalScroll',
|
|
18
|
-
Tabs: 'Tabs',
|
|
19
|
-
TabsItem: 'TabsItem',
|
|
20
|
-
Modal: 'Modal',
|
|
21
|
-
Divider: 'Divider',
|
|
22
|
-
Gradient: 'Gradient',
|
|
23
|
-
TextField: 'TextField',
|
|
24
|
-
Checkbox: 'Checkbox',
|
|
25
|
-
ChoicePicker: 'ChoicePicker',
|
|
26
|
-
Slider: 'Slider',
|
|
27
|
-
DateTimeInput: 'DateTimeInput',
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=primitives.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/synthesisView/primitives.ts"],"names":[],"mappings":"AAsMA,+EAA+E;AAE/E;4DAC4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,eAAe;CACtB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type Scope = {
|
|
2
|
-
/** The synthesis data the view binds against. */
|
|
3
|
-
data: unknown;
|
|
4
|
-
/** The current element when inside a Repeat subtree. */
|
|
5
|
-
item?: unknown;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Resolve a dot-path against the data scope. `$item` (and `$item.x`) reads the
|
|
9
|
-
* current Repeat element; any other path reads from the synthesis data.
|
|
10
|
-
*
|
|
11
|
-
* Bracket notation (`variants[variant]`, `themes[mode].text.primary`) is
|
|
12
|
-
* supported: the inner path resolves first, then the result is interpolated
|
|
13
|
-
* into the outer path before walking. This lets bindings pick a style or
|
|
14
|
-
* theme bucket at runtime — the consumer just sets the discriminator prop.
|
|
15
|
-
*/
|
|
16
|
-
export declare function resolvePath(path: string, scope: Scope): unknown;
|
|
17
|
-
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/synthesisView/resolve.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,KAAK,GAAG;IAClB,iDAAiD;IACjD,IAAI,EAAE,OAAO,CAAC;IACd,wDAAwD;IACxD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CA8B/D"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const ITEM = '$item';
|
|
2
|
-
const BRACKET_RE = /\[([^\]]+)\]/;
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a dot-path against the data scope. `$item` (and `$item.x`) reads the
|
|
5
|
-
* current Repeat element; any other path reads from the synthesis data.
|
|
6
|
-
*
|
|
7
|
-
* Bracket notation (`variants[variant]`, `themes[mode].text.primary`) is
|
|
8
|
-
* supported: the inner path resolves first, then the result is interpolated
|
|
9
|
-
* into the outer path before walking. This lets bindings pick a style or
|
|
10
|
-
* theme bucket at runtime — the consumer just sets the discriminator prop.
|
|
11
|
-
*/
|
|
12
|
-
export function resolvePath(path, scope) {
|
|
13
|
-
// Expand any `[inner]` segments first so prefix handling sees a normalized
|
|
14
|
-
// dot-path. Each inner segment recursively resolves against the same scope.
|
|
15
|
-
while (path.includes('[')) {
|
|
16
|
-
const m = BRACKET_RE.exec(path);
|
|
17
|
-
if (!m || m.index === undefined)
|
|
18
|
-
break;
|
|
19
|
-
const key = resolvePath(m[1], scope);
|
|
20
|
-
if (typeof key !== 'string' && typeof key !== 'number')
|
|
21
|
-
return undefined;
|
|
22
|
-
const before = path.slice(0, m.index);
|
|
23
|
-
const after = path.slice(m.index + m[0].length);
|
|
24
|
-
path = `${before}${before && !before.endsWith('.') ? '.' : ''}${key}${after}`;
|
|
25
|
-
}
|
|
26
|
-
if (path.startsWith('.'))
|
|
27
|
-
path = path.slice(1);
|
|
28
|
-
if (path === ITEM)
|
|
29
|
-
return scope.item;
|
|
30
|
-
let base;
|
|
31
|
-
let keys;
|
|
32
|
-
if (path.startsWith(`${ITEM}.`)) {
|
|
33
|
-
base = scope.item;
|
|
34
|
-
keys = path.slice(ITEM.length + 1).split('.');
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
base = scope.data;
|
|
38
|
-
keys = path.split('.');
|
|
39
|
-
}
|
|
40
|
-
return keys.reduce((acc, key) => (acc == null ? undefined : acc[key]), base);
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=resolve.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/synthesisView/resolve.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,OAAO,CAAC;AACrB,MAAM,UAAU,GAAG,cAAc,CAAC;AASlC;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAY;IACpD,2EAA2E;IAC3E,4EAA4E;IAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS;YAAE,MAAM;QACvC,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACrC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACzE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,GAAG,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IAChF,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE/C,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAErC,IAAI,IAAa,CAAC;IAClB,IAAI,IAAc,CAAC;IACnB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC;QAChC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAClB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAClB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAChB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC,EAC/E,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Render-ready node delivered by the API. The SDK walks the array and
|
|
4
|
-
* renders each node — there is no further resolution to do.
|
|
5
|
-
*
|
|
6
|
-
* - `PRIMITIVE` — a BB built-in (`Row`, `Column`, `Text`, `Image`, …) with
|
|
7
|
-
* inline props.
|
|
8
|
-
* - `KEY_NAME` — a component the host app registered via
|
|
9
|
-
* `<BitBitView components={{ X: ... }} />`.
|
|
10
|
-
*/
|
|
11
|
-
export type FlatUiPrimitiveNode = {
|
|
12
|
-
id: string;
|
|
13
|
-
kind: 'PRIMITIVE';
|
|
14
|
-
/** BB primitive identifier (e.g. `'Row'`, `'Text'`, `'Image'`). */
|
|
15
|
-
component: string;
|
|
16
|
-
style?: Record<string, unknown>;
|
|
17
|
-
/** Ordered nested-node ids. */
|
|
18
|
-
children?: string[];
|
|
19
|
-
/** Single nested-node id shorthand. */
|
|
20
|
-
child?: string;
|
|
21
|
-
/** Host-facing event bindings. Component-emitted payloads (e.g.
|
|
22
|
-
* `TextField` `{value}`) merge over the static payload at fire time.
|
|
23
|
-
* `handleWith` is lifted from the component contract by the flattener so
|
|
24
|
-
* the SDK can route the event without re-fetching the catalog:
|
|
25
|
-
* - `HOST` — fires `onEvent` to the customer.
|
|
26
|
-
* - `AGENT` (default) — `<BitBitView>` round-trips to the synthesis
|
|
27
|
-
* endpoint with the event as continuation context; the agent emits
|
|
28
|
-
* the next UI. The customer's `onEvent` still fires for observability.
|
|
29
|
-
* - `payloadSchema` (when present) opts the event out of speculative
|
|
30
|
-
* preload — the payload requires runtime input. */
|
|
31
|
-
events?: Record<string, {
|
|
32
|
-
name: string;
|
|
33
|
-
payload?: Record<string, unknown>;
|
|
34
|
-
handleWith?: ViewEventHandleWith;
|
|
35
|
-
payloadSchema?: unknown;
|
|
36
|
-
}>;
|
|
37
|
-
/** Other fields (`text`, `src`, `title`, …) are static props on the node. */
|
|
38
|
-
[prop: string]: unknown;
|
|
39
|
-
};
|
|
40
|
-
export type FlatUiKeyNameNode = {
|
|
41
|
-
id: string;
|
|
42
|
-
kind: 'KEY_NAME';
|
|
43
|
-
/** Name the host registered with `<BitBitView components={{ X: ... }} />`. */
|
|
44
|
-
component: string;
|
|
45
|
-
props?: Record<string, unknown>;
|
|
46
|
-
/** Projected children (ids in the same array). */
|
|
47
|
-
children?: string[];
|
|
48
|
-
child?: string;
|
|
49
|
-
/** Host-facing event bindings — same shape and semantics as on
|
|
50
|
-
* {@link FlatUiPrimitiveNode}. The SDK wires each slot into a prop
|
|
51
|
-
* callback on the host component so customer code can fire BB events
|
|
52
|
-
* (`AGENT` continuations, `HOST` dispatches) without grabbing the
|
|
53
|
-
* provider context manually. */
|
|
54
|
-
events?: Record<string, {
|
|
55
|
-
name: string;
|
|
56
|
-
payload?: Record<string, unknown>;
|
|
57
|
-
handleWith?: ViewEventHandleWith;
|
|
58
|
-
payloadSchema?: unknown;
|
|
59
|
-
}>;
|
|
60
|
-
};
|
|
61
|
-
export type FlatUiNode = FlatUiPrimitiveNode | FlatUiKeyNameNode;
|
|
62
|
-
export type ViewEventHandleWith = 'AGENT' | 'HOST';
|
|
63
|
-
export type SynthesisViewEvent = {
|
|
64
|
-
/** Host-facing event name — what the view-author bound the slot to. */
|
|
65
|
-
name: string;
|
|
66
|
-
/** Resolved payload — static `payload` from the binding merged with any
|
|
67
|
-
* runtime payload the primitive emitted (e.g. `TextField` `{value}`). */
|
|
68
|
-
payload: Record<string, unknown>;
|
|
69
|
-
/** Slot that fired (e.g. `onPress`). Useful when several slots are bound
|
|
70
|
-
* to the same host event name. */
|
|
71
|
-
slot: string;
|
|
72
|
-
/** The flat-uid of the node that fired. SDK-internal mostly; useful for
|
|
73
|
-
* the CMS preview to disambiguate multiple instances. */
|
|
74
|
-
nodeId: string;
|
|
75
|
-
/** Catalog name of the component the event was fired from. */
|
|
76
|
-
componentName: string;
|
|
77
|
-
/** Routing the component contract declared. `null` defaults to `AGENT`. */
|
|
78
|
-
handleWith: ViewEventHandleWith;
|
|
79
|
-
};
|
|
80
|
-
/** Sent to the synthesis endpoint as `viewInputs.event` when an `AGENT` event
|
|
81
|
-
* fires. The agent gets the prior UI + event as continuation context and
|
|
82
|
-
* emits the next UI in response. */
|
|
83
|
-
export type SynthesisViewEventInput = {
|
|
84
|
-
name: string;
|
|
85
|
-
componentName: string;
|
|
86
|
-
payload?: Record<string, unknown>;
|
|
87
|
-
sourceNodeId?: string;
|
|
88
|
-
priorUiData: FlatUiNode[];
|
|
89
|
-
};
|
|
90
|
-
/** Maps component names → React implementations. Used both for BB
|
|
91
|
-
* primitives and for the host-registered `KEY_NAME` components. */
|
|
92
|
-
export type ComponentMap = Record<string, ComponentType<Record<string, unknown>>>;
|
|
93
|
-
export type ContentInput = {
|
|
94
|
-
type: string;
|
|
95
|
-
value: string;
|
|
96
|
-
};
|
|
97
|
-
export type ViewInputs = {
|
|
98
|
-
/** Provide the dark mode setting of the current UI to the agent. */
|
|
99
|
-
darkMode?: boolean;
|
|
100
|
-
/** Event continuation. Set by the SDK on AGENT-handled events (and on
|
|
101
|
-
* speculative preload calls); the agent re-renders given the prior UI
|
|
102
|
-
* plus this event. Customers don't pass this — `<BitBitView>` manages it
|
|
103
|
-
* internally. */
|
|
104
|
-
event?: SynthesisViewEventInput;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Minimal structural shape `<BitBitView>` needs to fetch a view. A
|
|
108
|
-
* `BitBitPressClient` satisfies it via `client.user.synthesizeViewItem(...)`.
|
|
109
|
-
*/
|
|
110
|
-
export interface SynthesizeViewFetcher {
|
|
111
|
-
user: {
|
|
112
|
-
synthesizeViewItem(item: {
|
|
113
|
-
keyName: string;
|
|
114
|
-
contentInputs?: ContentInput[];
|
|
115
|
-
viewInputs?: ViewInputs;
|
|
116
|
-
}): Promise<{
|
|
117
|
-
uiData: unknown[];
|
|
118
|
-
}>;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/synthesisView/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,mEAAmE;IACnE,SAAS,EA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,CAAC;CACH"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ContentInput, FlatUiNode, SynthesisViewEvent, SynthesizeViewFetcher, ViewInputs } from './types.js';
|
|
2
|
-
export type UseEventDrivenViewOptions = {
|
|
3
|
-
/** When true (default), speculatively prefetches the agent's next-UI for
|
|
4
|
-
* every AGENT event whose payload is fully derivable from the rendered
|
|
5
|
-
* tree (i.e. the contract declared no `payloadSchema`). On the real
|
|
6
|
-
* click, the SDK swaps in the prefetched response without a server hop. */
|
|
7
|
-
preloadNextUi?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type UseEventDrivenViewResult = {
|
|
10
|
-
uiData: FlatUiNode[];
|
|
11
|
-
loading: boolean;
|
|
12
|
-
error: string | null;
|
|
13
|
-
/** Wire this to `<BitBitViewRenderer onEvent={...}>`. Routes the event
|
|
14
|
-
* based on its `handleWith`:
|
|
15
|
-
* - `HOST` — fires the supplied `onHostEvent` callback.
|
|
16
|
-
* - `AGENT` — re-fetches with the event as continuation context (cache
|
|
17
|
-
* hit if a speculative preload landed first), swaps `uiData` in
|
|
18
|
-
* place. The customer's `onHostEvent` is NOT fired for AGENT events. */
|
|
19
|
-
handleEvent: (event: SynthesisViewEvent) => void;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Live-view hook on top of `useSynthesisView`. Owns:
|
|
23
|
-
* - the live `uiData` (swaps in place on AGENT events),
|
|
24
|
-
* - a per-tree preload cache so deterministic event sequences are 0ms,
|
|
25
|
-
* - an event dispatcher the renderer calls back into.
|
|
26
|
-
*
|
|
27
|
-
* Resets state whenever the underlying view (keyName / contentInputs)
|
|
28
|
-
* changes — speculative entries from a stale tree aren't relevant to a
|
|
29
|
-
* different view.
|
|
30
|
-
*/
|
|
31
|
-
export declare function useEventDrivenView(client: SynthesizeViewFetcher, keyName: string, onHostEvent: ((event: SynthesisViewEvent) => void) | undefined, contentInputs?: ContentInput[], baseViewInputs?: ViewInputs, options?: UseEventDrivenViewOptions): UseEventDrivenViewResult;
|
|
32
|
-
//# sourceMappingURL=useEventDrivenView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useEventDrivenView.d.ts","sourceRoot":"","sources":["../../src/synthesisView/useEventDrivenView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EAEV,kBAAkB,EAElB,qBAAqB,EACrB,UAAU,EACX,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;gFAG4E;IAC5E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;gFAK4E;IAC5E,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAClD,CAAC;AA4DF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,CAAC,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,SAAS,EAC9D,aAAa,CAAC,EAAE,YAAY,EAAE,EAC9B,cAAc,CAAC,EAAE,UAAU,EAC3B,OAAO,CAAC,EAAE,yBAAyB,GAClC,wBAAwB,CAuG1B"}
|