@arkcit/engine-react 0.3.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/README.md +51 -0
- package/dist/composition.d.ts +116 -0
- package/dist/composition.js +344 -0
- package/dist/directives.d.ts +49 -0
- package/dist/directives.js +58 -0
- package/dist/engine.d.ts +96 -0
- package/dist/engine.js +508 -0
- package/dist/hooks.d.ts +55 -0
- package/dist/hooks.js +135 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1371 -0
- package/dist/materialization.d.ts +86 -0
- package/dist/materialization.js +334 -0
- package/dist/renderReactNode-DmxD8hot.d.ts +109 -0
- package/dist/rendering.d.ts +118 -0
- package/dist/rendering.js +582 -0
- package/package.json +91 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { UINode } from '@arkcit/engine-schema';
|
|
4
|
+
import { UIRuntimeAdapter } from '@arkcit/engine-runtime';
|
|
5
|
+
import { ResolvedNodeContentDescriptor, CoverContentDescriptor, AccordionItemDescriptor, ExpandablePanelContentDescriptor, TabsContentDescriptor } from '@arkcit/engine-render-layer';
|
|
6
|
+
|
|
7
|
+
declare const buildCoverMedia: ({ mediaSource, mediaSrc, mediaAlt, }: {
|
|
8
|
+
mediaSource: string;
|
|
9
|
+
mediaSrc: string;
|
|
10
|
+
mediaAlt: string;
|
|
11
|
+
}) => React__default.ReactNode | undefined;
|
|
12
|
+
declare const buildCoverContent: ({ rawChildren, renderSafeNode, }: {
|
|
13
|
+
rawChildren: UINode[];
|
|
14
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
15
|
+
}) => {
|
|
16
|
+
actions: react_jsx_runtime.JSX.Element | undefined;
|
|
17
|
+
children: react_jsx_runtime.JSX.Element | null;
|
|
18
|
+
};
|
|
19
|
+
declare const buildScrollRevealChildren: ({ rawChildren, renderSafeNode, normalizeRenderableChild, fallbackChildren, }: {
|
|
20
|
+
rawChildren: UINode[];
|
|
21
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
22
|
+
normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
|
|
23
|
+
fallbackChildren: unknown;
|
|
24
|
+
}) => string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
25
|
+
|
|
26
|
+
type TableComponentShape = {
|
|
27
|
+
Header: React__default.ComponentType<Record<string, unknown>>;
|
|
28
|
+
Body: React__default.ComponentType<Record<string, unknown>>;
|
|
29
|
+
Row: React__default.ComponentType<Record<string, unknown>>;
|
|
30
|
+
Head: React__default.ComponentType<Record<string, unknown>>;
|
|
31
|
+
Cell: React__default.ComponentType<Record<string, unknown>>;
|
|
32
|
+
};
|
|
33
|
+
declare const materializeBoundTable: ({ nodeId, componentProps, runtime, TableComponent, }: {
|
|
34
|
+
nodeId: string;
|
|
35
|
+
componentProps: Record<string, unknown>;
|
|
36
|
+
runtime: UIRuntimeAdapter;
|
|
37
|
+
TableComponent: React__default.ComponentType<Record<string, unknown>> & TableComponentShape;
|
|
38
|
+
}) => React__default.ReactNode | null;
|
|
39
|
+
|
|
40
|
+
declare const materializeChildContent: ({ descriptor, renderSafeNode, }: {
|
|
41
|
+
descriptor: ResolvedNodeContentDescriptor;
|
|
42
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
43
|
+
}) => React__default.ReactNode | null;
|
|
44
|
+
|
|
45
|
+
declare const materializeCoverContent: ({ descriptor, renderSafeNode, }: {
|
|
46
|
+
descriptor: CoverContentDescriptor;
|
|
47
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
48
|
+
}) => {
|
|
49
|
+
actions: react_jsx_runtime.JSX.Element | undefined;
|
|
50
|
+
children: react_jsx_runtime.JSX.Element | null;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
declare const materializeAccordionItems: ({ items, renderSafeNode, }: {
|
|
54
|
+
items: AccordionItemDescriptor[];
|
|
55
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
56
|
+
}) => {
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
disabled: boolean;
|
|
60
|
+
content: string | react_jsx_runtime.JSX.Element;
|
|
61
|
+
}[];
|
|
62
|
+
declare const materializeExpandablePanelContent: ({ descriptor, renderSafeNode, }: {
|
|
63
|
+
descriptor: ExpandablePanelContentDescriptor;
|
|
64
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
65
|
+
}) => react_jsx_runtime.JSX.Element | undefined;
|
|
66
|
+
|
|
67
|
+
declare const materializeTabsContent: ({ tabs, renderSafeNode, normalizeRenderableChild, }: {
|
|
68
|
+
tabs: TabsContentDescriptor[];
|
|
69
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
70
|
+
normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
|
|
71
|
+
}) => {
|
|
72
|
+
id: string;
|
|
73
|
+
title: unknown;
|
|
74
|
+
label: unknown;
|
|
75
|
+
content: string | number | bigint | boolean | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element[] | null | undefined;
|
|
76
|
+
}[];
|
|
77
|
+
|
|
78
|
+
declare const buildAccordionItems: (accordionChildren: UINode[], renderSafeNode: (node: UINode) => React__default.ReactNode) => {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
content: string | react_jsx_runtime.JSX.Element;
|
|
82
|
+
disabled: boolean;
|
|
83
|
+
}[];
|
|
84
|
+
declare const buildExpandablePanelChildren: (panelChildren: UINode[], renderSafeNode: (node: UINode) => React__default.ReactNode) => react_jsx_runtime.JSX.Element | undefined;
|
|
85
|
+
|
|
86
|
+
export { buildAccordionItems, buildCoverContent, buildCoverMedia, buildExpandablePanelChildren, buildScrollRevealChildren, materializeAccordionItems, materializeBoundTable, materializeChildContent, materializeCoverContent, materializeExpandablePanelContent, materializeTabsContent };
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/materialization/contentStudio.tsx
|
|
22
|
+
import React from "react";
|
|
23
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
24
|
+
var buildCoverMedia = ({
|
|
25
|
+
mediaSource,
|
|
26
|
+
mediaSrc,
|
|
27
|
+
mediaAlt
|
|
28
|
+
}) => {
|
|
29
|
+
if (mediaSource === "none") return void 0;
|
|
30
|
+
if (mediaSource === "image" && mediaSrc) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"img",
|
|
33
|
+
{
|
|
34
|
+
src: mediaSrc,
|
|
35
|
+
alt: mediaAlt || "Cover media",
|
|
36
|
+
className: "h-56 w-full rounded-xl object-cover"
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (mediaSource === "video" && mediaSrc) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"video",
|
|
43
|
+
{
|
|
44
|
+
src: mediaSrc,
|
|
45
|
+
className: "h-56 w-full rounded-xl object-cover",
|
|
46
|
+
controls: true,
|
|
47
|
+
preload: "metadata"
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return void 0;
|
|
52
|
+
};
|
|
53
|
+
var buildCoverContent = ({
|
|
54
|
+
rawChildren,
|
|
55
|
+
renderSafeNode
|
|
56
|
+
}) => {
|
|
57
|
+
const actionChildren = rawChildren.filter((child) => child.type === "Button" || child.type === "Link");
|
|
58
|
+
const contentChildren = rawChildren.filter((child) => child.type !== "Button" && child.type !== "Link");
|
|
59
|
+
const resolvedActionChildren = actionChildren.map((child) => /* @__PURE__ */ jsx("span", { className: "inline-flex align-middle", children: renderSafeNode(child) }, child.id));
|
|
60
|
+
const resolvedContentChildren = contentChildren.map((child) => /* @__PURE__ */ jsx(React.Fragment, { children: renderSafeNode(child) }, child.id));
|
|
61
|
+
return {
|
|
62
|
+
actions: resolvedActionChildren.length > 0 ? resolvedActionChildren.length === 1 ? resolvedActionChildren[0] : /* @__PURE__ */ jsx(Fragment, { children: resolvedActionChildren }) : void 0,
|
|
63
|
+
children: resolvedContentChildren.length > 0 ? resolvedContentChildren.length === 1 ? resolvedContentChildren[0] : /* @__PURE__ */ jsx(Fragment, { children: resolvedContentChildren }) : null
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
var buildScrollRevealChildren = ({
|
|
67
|
+
rawChildren,
|
|
68
|
+
renderSafeNode,
|
|
69
|
+
normalizeRenderableChild,
|
|
70
|
+
fallbackChildren
|
|
71
|
+
}) => {
|
|
72
|
+
if (rawChildren.length > 0) {
|
|
73
|
+
return rawChildren.length === 1 ? /* @__PURE__ */ jsx(React.Fragment, { children: renderSafeNode(rawChildren[0]) }, rawChildren[0].id) : /* @__PURE__ */ jsx(Fragment, { children: rawChildren.map((child) => /* @__PURE__ */ jsx(React.Fragment, { children: renderSafeNode(child) }, child.id)) });
|
|
74
|
+
}
|
|
75
|
+
return normalizeRenderableChild(fallbackChildren);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/materialization/materializeBoundTable.tsx
|
|
79
|
+
import React2 from "react";
|
|
80
|
+
|
|
81
|
+
// src/rendering/resolveBoundTableData.ts
|
|
82
|
+
var resolveBoundTableData = ({
|
|
83
|
+
nodeId,
|
|
84
|
+
componentProps,
|
|
85
|
+
runtime
|
|
86
|
+
}) => {
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
const rows = Array.isArray(componentProps.rows) ? componentProps.rows : [];
|
|
89
|
+
const columns = Array.isArray(componentProps.columns) ? componentProps.columns : [];
|
|
90
|
+
const paginationCandidate = componentProps.pagination;
|
|
91
|
+
const pagination = paginationCandidate && typeof paginationCandidate === "object" ? paginationCandidate : null;
|
|
92
|
+
const pageRaw = Number((_a = pagination == null ? void 0 : pagination.page) != null ? _a : 1);
|
|
93
|
+
const pageSizeRaw = Number(((_b = pagination == null ? void 0 : pagination.pageSize) != null ? _b : rows.length) || 1);
|
|
94
|
+
const page = Number.isFinite(pageRaw) && pageRaw > 0 ? pageRaw : 1;
|
|
95
|
+
const pageSize = Number.isFinite(pageSizeRaw) && pageSizeRaw > 0 ? pageSizeRaw : rows.length || 1;
|
|
96
|
+
const tableQueriesRaw = runtime.get("table.queriesByNodeId");
|
|
97
|
+
const tableQueries = tableQueriesRaw && typeof tableQueriesRaw === "object" ? tableQueriesRaw : {};
|
|
98
|
+
const query = String((_d = (_c = tableQueries[nodeId]) != null ? _c : tableQueries.__all__) != null ? _d : "").trim().toLowerCase();
|
|
99
|
+
const filteredRows = query.length === 0 ? rows : rows.filter(
|
|
100
|
+
(row) => columns.some((column) => {
|
|
101
|
+
var _a2;
|
|
102
|
+
const key = String((_a2 = column.key) != null ? _a2 : "").trim();
|
|
103
|
+
if (!key) return false;
|
|
104
|
+
const value = row[key];
|
|
105
|
+
return String(value != null ? value : "").toLowerCase().includes(query);
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
const startIndex = (page - 1) * pageSize;
|
|
109
|
+
const pagedRows = pagination ? filteredRows.slice(startIndex, startIndex + pageSize) : filteredRows;
|
|
110
|
+
return {
|
|
111
|
+
columns,
|
|
112
|
+
rows,
|
|
113
|
+
filteredRows,
|
|
114
|
+
pagedRows,
|
|
115
|
+
pagination,
|
|
116
|
+
page,
|
|
117
|
+
pageSize,
|
|
118
|
+
query
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/materialization/materializeBoundTable.tsx
|
|
123
|
+
var RENDER_INTERNAL_PROP_NAMES = /* @__PURE__ */ new Set([
|
|
124
|
+
"bindingEnabled",
|
|
125
|
+
"valueBindingKey",
|
|
126
|
+
"optionsBindingKey",
|
|
127
|
+
"useBindingData",
|
|
128
|
+
"entitiesBindingKey",
|
|
129
|
+
"videoBindingKey",
|
|
130
|
+
"mapBindingKey",
|
|
131
|
+
"productBindingKey",
|
|
132
|
+
"useTranslationKeys",
|
|
133
|
+
"tagContentTranslationKey",
|
|
134
|
+
"tagContentTranslationValue",
|
|
135
|
+
"hrefTranslationKey",
|
|
136
|
+
"hrefTranslationValue",
|
|
137
|
+
"mediaSource",
|
|
138
|
+
"mediaSrc",
|
|
139
|
+
"mediaAlt",
|
|
140
|
+
"rowsBindingKey",
|
|
141
|
+
"columnsBindingKey"
|
|
142
|
+
]);
|
|
143
|
+
var omitInternalProps = (props) => {
|
|
144
|
+
const next = __spreadValues({}, props);
|
|
145
|
+
delete next.__studio;
|
|
146
|
+
for (const propName of RENDER_INTERNAL_PROP_NAMES) {
|
|
147
|
+
delete next[propName];
|
|
148
|
+
}
|
|
149
|
+
return next;
|
|
150
|
+
};
|
|
151
|
+
var materializeBoundTable = ({
|
|
152
|
+
nodeId,
|
|
153
|
+
componentProps,
|
|
154
|
+
runtime,
|
|
155
|
+
TableComponent
|
|
156
|
+
}) => {
|
|
157
|
+
const { columns, pagedRows } = resolveBoundTableData({
|
|
158
|
+
nodeId,
|
|
159
|
+
componentProps,
|
|
160
|
+
runtime
|
|
161
|
+
});
|
|
162
|
+
delete componentProps.rows;
|
|
163
|
+
delete componentProps.columns;
|
|
164
|
+
delete componentProps.pagination;
|
|
165
|
+
delete componentProps.rowsBindingKey;
|
|
166
|
+
delete componentProps.columnsBindingKey;
|
|
167
|
+
delete componentProps.useBindingData;
|
|
168
|
+
if (columns.length === 0) return null;
|
|
169
|
+
delete componentProps.children;
|
|
170
|
+
const headerNode = React2.createElement(
|
|
171
|
+
TableComponent.Header,
|
|
172
|
+
null,
|
|
173
|
+
React2.createElement(
|
|
174
|
+
TableComponent.Row,
|
|
175
|
+
null,
|
|
176
|
+
...columns.map(
|
|
177
|
+
(column, columnIndex) => {
|
|
178
|
+
var _a, _b, _c;
|
|
179
|
+
return React2.createElement(
|
|
180
|
+
TableComponent.Head,
|
|
181
|
+
{ key: `table-head-${String((_a = column.key) != null ? _a : columnIndex)}` },
|
|
182
|
+
String((_c = (_b = column.header) != null ? _b : column.key) != null ? _c : `Column ${columnIndex + 1}`)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
)
|
|
187
|
+
);
|
|
188
|
+
const bodyNode = React2.createElement(
|
|
189
|
+
TableComponent.Body,
|
|
190
|
+
null,
|
|
191
|
+
...pagedRows.map(
|
|
192
|
+
(row, rowIndex) => {
|
|
193
|
+
var _a;
|
|
194
|
+
return React2.createElement(
|
|
195
|
+
TableComponent.Row,
|
|
196
|
+
{ key: `table-row-${String((_a = row.id) != null ? _a : rowIndex)}` },
|
|
197
|
+
...columns.map((column, columnIndex) => {
|
|
198
|
+
var _a2, _b;
|
|
199
|
+
const key = String((_a2 = column.key) != null ? _a2 : "").trim();
|
|
200
|
+
const value = key ? row[key] : "";
|
|
201
|
+
return React2.createElement(
|
|
202
|
+
TableComponent.Cell,
|
|
203
|
+
{ key: `table-cell-${String((_b = row.id) != null ? _b : rowIndex)}-${key || columnIndex}` },
|
|
204
|
+
value == null ? "" : String(value)
|
|
205
|
+
);
|
|
206
|
+
})
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
return React2.createElement(
|
|
212
|
+
TableComponent,
|
|
213
|
+
omitInternalProps(componentProps),
|
|
214
|
+
headerNode,
|
|
215
|
+
bodyNode
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/materialization/materializeChildContent.tsx
|
|
220
|
+
import React3 from "react";
|
|
221
|
+
|
|
222
|
+
// src/rendering/gridItemWrapperProps.ts
|
|
223
|
+
var getGridItemWrapperProps = (colSpan) => ({
|
|
224
|
+
className: "w-full min-w-0",
|
|
225
|
+
style: {
|
|
226
|
+
gridColumn: `span ${colSpan} / span ${colSpan}`
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// src/materialization/materializeChildContent.tsx
|
|
231
|
+
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
232
|
+
var materializeChildContent = ({
|
|
233
|
+
descriptor,
|
|
234
|
+
renderSafeNode
|
|
235
|
+
}) => {
|
|
236
|
+
if (descriptor.kind === "empty") {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
const renderDescriptor = (childDescriptor) => {
|
|
240
|
+
if (childDescriptor.kind === "grid-item") {
|
|
241
|
+
return /* @__PURE__ */ jsx2("div", __spreadProps(__spreadValues({}, getGridItemWrapperProps(childDescriptor.colSpan)), { children: renderSafeNode(childDescriptor.child) }), childDescriptor.child.id);
|
|
242
|
+
}
|
|
243
|
+
return /* @__PURE__ */ jsx2(React3.Fragment, { children: renderSafeNode(childDescriptor.child) }, childDescriptor.child.id);
|
|
244
|
+
};
|
|
245
|
+
if (descriptor.kind === "single") {
|
|
246
|
+
return renderDescriptor(descriptor.child);
|
|
247
|
+
}
|
|
248
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: descriptor.children.map(renderDescriptor) });
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// src/materialization/materializeCoverContent.tsx
|
|
252
|
+
import React4 from "react";
|
|
253
|
+
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
254
|
+
var materializeCoverContent = ({
|
|
255
|
+
descriptor,
|
|
256
|
+
renderSafeNode
|
|
257
|
+
}) => {
|
|
258
|
+
const resolvedActionChildren = descriptor.actionNodes.map((child) => /* @__PURE__ */ jsx3("span", { className: "inline-flex align-middle", children: renderSafeNode(child) }, child.id));
|
|
259
|
+
const resolvedContentChildren = descriptor.contentNodes.map((child) => /* @__PURE__ */ jsx3(React4.Fragment, { children: renderSafeNode(child) }, child.id));
|
|
260
|
+
return {
|
|
261
|
+
actions: resolvedActionChildren.length > 0 ? resolvedActionChildren.length === 1 ? resolvedActionChildren[0] : /* @__PURE__ */ jsx3(Fragment3, { children: resolvedActionChildren }) : void 0,
|
|
262
|
+
children: resolvedContentChildren.length > 0 ? resolvedContentChildren.length === 1 ? resolvedContentChildren[0] : /* @__PURE__ */ jsx3(Fragment3, { children: resolvedContentChildren }) : null
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/materialization/materializeNavigationContent.tsx
|
|
267
|
+
import React5 from "react";
|
|
268
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
269
|
+
var materializeAccordionItems = ({
|
|
270
|
+
items,
|
|
271
|
+
renderSafeNode
|
|
272
|
+
}) => items.map((item) => {
|
|
273
|
+
var _a;
|
|
274
|
+
return {
|
|
275
|
+
id: item.id,
|
|
276
|
+
title: item.title,
|
|
277
|
+
disabled: item.disabled,
|
|
278
|
+
content: item.contentKind === "nodes" ? /* @__PURE__ */ jsx4("div", { className: "space-y-2", children: item.contentNodes.map((nested) => /* @__PURE__ */ jsx4(React5.Fragment, { children: renderSafeNode(nested) }, nested.id)) }) : (_a = item.contentText) != null ? _a : ""
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
var materializeExpandablePanelContent = ({
|
|
282
|
+
descriptor,
|
|
283
|
+
renderSafeNode
|
|
284
|
+
}) => {
|
|
285
|
+
if (descriptor.kind === "empty") {
|
|
286
|
+
return void 0;
|
|
287
|
+
}
|
|
288
|
+
return /* @__PURE__ */ jsx4("div", { className: "space-y-2", children: descriptor.nodes.map((child) => /* @__PURE__ */ jsx4(React5.Fragment, { children: renderSafeNode(child) }, child.id)) });
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/materialization/materializeTabsContent.tsx
|
|
292
|
+
import React6 from "react";
|
|
293
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
294
|
+
var materializeTabsContent = ({
|
|
295
|
+
tabs,
|
|
296
|
+
renderSafeNode,
|
|
297
|
+
normalizeRenderableChild
|
|
298
|
+
}) => tabs.map((tab) => ({
|
|
299
|
+
id: tab.id,
|
|
300
|
+
title: tab.title,
|
|
301
|
+
label: tab.label,
|
|
302
|
+
content: tab.contentKind === "nodes" ? tab.contentNodes.length === 1 ? renderSafeNode(tab.contentNodes[0]) : tab.contentNodes.map((child) => /* @__PURE__ */ jsx5(React6.Fragment, { children: renderSafeNode(child) }, child.id)) : normalizeRenderableChild(tab.fallbackContent)
|
|
303
|
+
}));
|
|
304
|
+
|
|
305
|
+
// src/materialization/navigationStudio.tsx
|
|
306
|
+
import React7 from "react";
|
|
307
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
308
|
+
var buildAccordionItems = (accordionChildren, renderSafeNode) => accordionChildren.map((child, index) => {
|
|
309
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
310
|
+
const childProps = (_a = child.props) != null ? _a : {};
|
|
311
|
+
return {
|
|
312
|
+
id: String((_c = (_b = childProps.id) != null ? _b : child.id) != null ? _c : `item-${index + 1}`),
|
|
313
|
+
title: String((_d = childProps.title) != null ? _d : `Section ${index + 1}`),
|
|
314
|
+
content: ((_e = child.children) != null ? _e : []).length > 0 ? /* @__PURE__ */ jsx6("div", { className: "space-y-2", children: ((_f = child.children) != null ? _f : []).map((nested) => /* @__PURE__ */ jsx6(React7.Fragment, { children: renderSafeNode(nested) }, nested.id)) }) : String((_g = childProps.content) != null ? _g : ""),
|
|
315
|
+
disabled: Boolean(childProps.disabled)
|
|
316
|
+
};
|
|
317
|
+
});
|
|
318
|
+
var buildExpandablePanelChildren = (panelChildren, renderSafeNode) => {
|
|
319
|
+
if (panelChildren.length === 0) return void 0;
|
|
320
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-2", children: panelChildren.map((child) => /* @__PURE__ */ jsx6(React7.Fragment, { children: renderSafeNode(child) }, child.id)) });
|
|
321
|
+
};
|
|
322
|
+
export {
|
|
323
|
+
buildAccordionItems,
|
|
324
|
+
buildCoverContent,
|
|
325
|
+
buildCoverMedia,
|
|
326
|
+
buildExpandablePanelChildren,
|
|
327
|
+
buildScrollRevealChildren,
|
|
328
|
+
materializeAccordionItems,
|
|
329
|
+
materializeBoundTable,
|
|
330
|
+
materializeChildContent,
|
|
331
|
+
materializeCoverContent,
|
|
332
|
+
materializeExpandablePanelContent,
|
|
333
|
+
materializeTabsContent
|
|
334
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ComponentRegistry } from '@arkcit/engine-core';
|
|
3
|
+
import { UINode } from '@arkcit/engine-schema';
|
|
4
|
+
import { UIRuntimeAdapter } from '@arkcit/engine-runtime';
|
|
5
|
+
import { ContentCompositionPlan, RenderDirectivePlan, NavigationCompositionPlan, FinalRenderPlan } from '@arkcit/engine-render-layer';
|
|
6
|
+
|
|
7
|
+
type RenderReactNodeArgs<TInlineEditing = unknown> = {
|
|
8
|
+
node: UINode;
|
|
9
|
+
runtime: UIRuntimeAdapter;
|
|
10
|
+
registry: ComponentRegistry;
|
|
11
|
+
schemaNodes: UINode[];
|
|
12
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
13
|
+
internalStudioNodeTypes: Set<string>;
|
|
14
|
+
overlaysByNodeId: Record<string, unknown>;
|
|
15
|
+
onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
|
|
16
|
+
isStudioRendererContext: boolean;
|
|
17
|
+
dropdownOpenByNodeId: Record<string, boolean>;
|
|
18
|
+
setDropdownOpenByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, boolean>>>;
|
|
19
|
+
captureFieldFocus: (target: EventTarget | null) => void;
|
|
20
|
+
selectedNodeId: string | null | undefined;
|
|
21
|
+
wizardActiveStepByNodeId: Record<string, string>;
|
|
22
|
+
accordionOpenIdsByNodeId: Record<string, string[]>;
|
|
23
|
+
expandablePanelOpenByNodeId: Record<string, boolean>;
|
|
24
|
+
setWizardActiveStepByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, string>>>;
|
|
25
|
+
setAccordionOpenIdsByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, string[]>>>;
|
|
26
|
+
setExpandablePanelOpenByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, boolean>>>;
|
|
27
|
+
onNodeClick?: (nodeId: string) => void;
|
|
28
|
+
setInlineEditing: React__default.Dispatch<React__default.SetStateAction<TInlineEditing | null>>;
|
|
29
|
+
studioSizing?: {
|
|
30
|
+
widthPct: number | null;
|
|
31
|
+
heightPct: number | null;
|
|
32
|
+
heightPx: number | null;
|
|
33
|
+
};
|
|
34
|
+
dependencies: {
|
|
35
|
+
applyStudioOverlayComponentProps: (args: {
|
|
36
|
+
node: UINode;
|
|
37
|
+
componentProps: Record<string, unknown>;
|
|
38
|
+
runtime: UIRuntimeAdapter;
|
|
39
|
+
overlaysByNodeId: Record<string, unknown>;
|
|
40
|
+
renderBindingProps: Record<string, unknown>;
|
|
41
|
+
resolvedChildContent: React__default.ReactNode | null;
|
|
42
|
+
onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
|
|
43
|
+
isStudioRendererContext: boolean;
|
|
44
|
+
dropdownOpenByNodeId: Record<string, boolean>;
|
|
45
|
+
setDropdownOpenByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, boolean>>>;
|
|
46
|
+
}) => void;
|
|
47
|
+
applyContentComposition: (args: {
|
|
48
|
+
node: UINode;
|
|
49
|
+
componentProps: Record<string, unknown>;
|
|
50
|
+
isStudioRendererContext: boolean;
|
|
51
|
+
internalStudioNodeTypes: Set<string>;
|
|
52
|
+
schemaNodes: UINode[];
|
|
53
|
+
onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
|
|
54
|
+
captureFieldFocus: (target: EventTarget | null) => void;
|
|
55
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
56
|
+
normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
|
|
57
|
+
findNodeById: (nodeId: string, nodes: UINode[]) => UINode | null;
|
|
58
|
+
runtime: UIRuntimeAdapter;
|
|
59
|
+
plans?: ContentCompositionPlan[];
|
|
60
|
+
}) => React__default.ReactNode | null;
|
|
61
|
+
applyRenderDirectives: (args: {
|
|
62
|
+
node: UINode;
|
|
63
|
+
componentProps: Record<string, unknown>;
|
|
64
|
+
renderBindingProps: Record<string, unknown>;
|
|
65
|
+
runtime: UIRuntimeAdapter;
|
|
66
|
+
plans?: RenderDirectivePlan[];
|
|
67
|
+
}) => void;
|
|
68
|
+
applyNavigationComposition: (args: {
|
|
69
|
+
node: UINode;
|
|
70
|
+
componentProps: Record<string, unknown>;
|
|
71
|
+
isStudioRendererContext: boolean;
|
|
72
|
+
selectedNodeId: string | null;
|
|
73
|
+
wizardActiveStepByNodeId: Record<string, string>;
|
|
74
|
+
accordionOpenIdsByNodeId: Record<string, string[]>;
|
|
75
|
+
expandablePanelOpenByNodeId: Record<string, boolean>;
|
|
76
|
+
runtime: UIRuntimeAdapter;
|
|
77
|
+
setWizardActiveStepByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, string>>>;
|
|
78
|
+
setAccordionOpenIdsByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, string[]>>>;
|
|
79
|
+
setExpandablePanelOpenByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, boolean>>>;
|
|
80
|
+
onNodeClick?: (nodeId: string) => void;
|
|
81
|
+
onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
|
|
82
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
83
|
+
normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
|
|
84
|
+
captureFieldFocus: (target: EventTarget | null) => void;
|
|
85
|
+
setInlineEditing: React__default.Dispatch<React__default.SetStateAction<TInlineEditing | null>>;
|
|
86
|
+
internalStudioNodeTypes: Set<string>;
|
|
87
|
+
plans?: NavigationCompositionPlan[];
|
|
88
|
+
}) => void;
|
|
89
|
+
finalizeRenderedNode: (args: {
|
|
90
|
+
node: UINode;
|
|
91
|
+
children: React__default.ReactNode[] | undefined;
|
|
92
|
+
componentProps: Record<string, unknown>;
|
|
93
|
+
registryComponent: React__default.ComponentType<Record<string, unknown>>;
|
|
94
|
+
runtime: UIRuntimeAdapter;
|
|
95
|
+
isStudioRendererContext: boolean;
|
|
96
|
+
studioSizing?: {
|
|
97
|
+
widthPct: number | null;
|
|
98
|
+
heightPct: number | null;
|
|
99
|
+
heightPx: number | null;
|
|
100
|
+
};
|
|
101
|
+
plans?: FinalRenderPlan[];
|
|
102
|
+
}) => React__default.ReactNode | null;
|
|
103
|
+
normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
|
|
104
|
+
findNodeById: (nodeId: string, nodes: UINode[]) => UINode | null;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
declare const renderReactNode: <TInlineEditing = unknown>({ node, runtime, registry, schemaNodes, renderSafeNode, internalStudioNodeTypes, overlaysByNodeId, onInlineTextEdit, isStudioRendererContext, dropdownOpenByNodeId, setDropdownOpenByNodeId, captureFieldFocus, selectedNodeId, wizardActiveStepByNodeId, accordionOpenIdsByNodeId, expandablePanelOpenByNodeId, setWizardActiveStepByNodeId, setAccordionOpenIdsByNodeId, setExpandablePanelOpenByNodeId, onNodeClick, setInlineEditing, studioSizing, dependencies, }: RenderReactNodeArgs<TInlineEditing>) => React__default.ReactNode;
|
|
108
|
+
|
|
109
|
+
export { renderReactNode as r };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { FinalRenderPlan, ResolvedNodeChildDescriptor, ResolvedNodeContentDescriptor, ResolvedNodeBase, ResolvedEngineNode } from '@arkcit/engine-render-layer';
|
|
3
|
+
import { UINode } from '@arkcit/engine-schema';
|
|
4
|
+
import { UIRuntimeAdapter } from '@arkcit/engine-runtime';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
export { r as renderReactNode } from './renderReactNode-DmxD8hot.js';
|
|
7
|
+
import { ComponentRegistry } from '@arkcit/engine-core';
|
|
8
|
+
|
|
9
|
+
type FinalizeRenderedNodeParams = {
|
|
10
|
+
node: UINode;
|
|
11
|
+
children: React__default.ReactNode[] | undefined;
|
|
12
|
+
componentProps: Record<string, unknown>;
|
|
13
|
+
registryComponent: React__default.ComponentType<Record<string, unknown>>;
|
|
14
|
+
runtime: UIRuntimeAdapter;
|
|
15
|
+
isStudioRendererContext: boolean;
|
|
16
|
+
studioSizing?: {
|
|
17
|
+
widthPct: number | null;
|
|
18
|
+
heightPct: number | null;
|
|
19
|
+
heightPx: number | null;
|
|
20
|
+
};
|
|
21
|
+
plans?: FinalRenderPlan[];
|
|
22
|
+
dependencies: {
|
|
23
|
+
resolveFinalRenderPlan: (args: {
|
|
24
|
+
node: UINode;
|
|
25
|
+
componentProps: Record<string, unknown>;
|
|
26
|
+
isStudioRendererContext: boolean;
|
|
27
|
+
studioSizing?: {
|
|
28
|
+
widthPct: number | null;
|
|
29
|
+
heightPct: number | null;
|
|
30
|
+
heightPx: number | null;
|
|
31
|
+
};
|
|
32
|
+
}) => FinalRenderPlan[];
|
|
33
|
+
omitStudioProps: (props: Record<string, unknown>) => Record<string, unknown>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
declare const finalizeRenderedNode: ({ node, children, componentProps, registryComponent, runtime, isStudioRendererContext, studioSizing, plans: providedPlans, dependencies, }: FinalizeRenderedNodeParams) => React__default.ReactNode | null;
|
|
37
|
+
|
|
38
|
+
declare const getGridItemWrapperProps: (colSpan: number) => {
|
|
39
|
+
className: string;
|
|
40
|
+
style: {
|
|
41
|
+
gridColumn: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
declare const buildNodeResetToken: (node: UINode) => string;
|
|
46
|
+
|
|
47
|
+
type PrepareRenderableChildrenArgs = {
|
|
48
|
+
node: UINode;
|
|
49
|
+
internalStudioNodeTypes: Set<string>;
|
|
50
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
51
|
+
childDescriptors?: ResolvedNodeChildDescriptor[];
|
|
52
|
+
childContentDescriptor?: ResolvedNodeContentDescriptor;
|
|
53
|
+
};
|
|
54
|
+
declare const prepareRenderableChildren: ({ node, internalStudioNodeTypes, renderSafeNode, childDescriptors, childContentDescriptor, }: PrepareRenderableChildrenArgs) => {
|
|
55
|
+
children: react_jsx_runtime.JSX.Element[];
|
|
56
|
+
resolvedChildContent: React__default.ReactNode;
|
|
57
|
+
childDescriptors: ResolvedNodeChildDescriptor[];
|
|
58
|
+
childContentDescriptor: ResolvedNodeContentDescriptor;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
declare const configurePreviewLinkBehavior: (componentProps: Record<string, unknown>) => void;
|
|
62
|
+
|
|
63
|
+
declare const toBoolean: (value: unknown) => boolean;
|
|
64
|
+
declare const normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
|
|
65
|
+
|
|
66
|
+
type BoundTableRow = Record<string, unknown>;
|
|
67
|
+
type BoundTableColumn = Record<string, unknown>;
|
|
68
|
+
type ResolvedBoundTableData = {
|
|
69
|
+
columns: BoundTableColumn[];
|
|
70
|
+
rows: BoundTableRow[];
|
|
71
|
+
filteredRows: BoundTableRow[];
|
|
72
|
+
pagedRows: BoundTableRow[];
|
|
73
|
+
pagination: Record<string, unknown> | null;
|
|
74
|
+
page: number;
|
|
75
|
+
pageSize: number;
|
|
76
|
+
query: string;
|
|
77
|
+
};
|
|
78
|
+
declare const resolveBoundTableData: ({ nodeId, componentProps, runtime, }: {
|
|
79
|
+
nodeId: string;
|
|
80
|
+
componentProps: Record<string, unknown>;
|
|
81
|
+
runtime: UIRuntimeAdapter;
|
|
82
|
+
}) => ResolvedBoundTableData;
|
|
83
|
+
|
|
84
|
+
type ResolveReactNodePlanArgs = {
|
|
85
|
+
node: UINode;
|
|
86
|
+
runtime: UIRuntimeAdapter;
|
|
87
|
+
registry: ComponentRegistry;
|
|
88
|
+
internalStudioNodeTypes: Set<string>;
|
|
89
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
90
|
+
};
|
|
91
|
+
type ReactNodeRenderPlan = ResolvedNodeBase & {
|
|
92
|
+
registryEntry: ComponentRegistry[string];
|
|
93
|
+
children: React__default.ReactNode[] | undefined;
|
|
94
|
+
resolvedChildContent: React__default.ReactNode | null;
|
|
95
|
+
};
|
|
96
|
+
declare const resolveReactNodePlan: ({ node, runtime, registry, internalStudioNodeTypes, renderSafeNode, }: ResolveReactNodePlanArgs) => ReactNodeRenderPlan | null;
|
|
97
|
+
|
|
98
|
+
type ResolveResolvedReactNodeArgs = {
|
|
99
|
+
node: UINode;
|
|
100
|
+
runtime: UIRuntimeAdapter;
|
|
101
|
+
registry: ComponentRegistry;
|
|
102
|
+
internalStudioNodeTypes: Set<string>;
|
|
103
|
+
renderSafeNode: (node: UINode) => React__default.ReactNode;
|
|
104
|
+
isStudioRendererContext: boolean;
|
|
105
|
+
studioSizing?: {
|
|
106
|
+
widthPct: number | null;
|
|
107
|
+
heightPct: number | null;
|
|
108
|
+
heightPx: number | null;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
type ResolvedReactNode = ResolvedEngineNode & {
|
|
112
|
+
registryEntry: ComponentRegistry[string];
|
|
113
|
+
children: React__default.ReactNode[] | undefined;
|
|
114
|
+
resolvedChildContent: React__default.ReactNode | null;
|
|
115
|
+
};
|
|
116
|
+
declare const resolveResolvedReactNode: ({ node, runtime, registry, internalStudioNodeTypes, renderSafeNode, isStudioRendererContext, studioSizing, }: ResolveResolvedReactNodeArgs) => ResolvedReactNode | null;
|
|
117
|
+
|
|
118
|
+
export { type BoundTableColumn, type BoundTableRow, type ReactNodeRenderPlan, type ResolvedBoundTableData, type ResolvedReactNode, buildNodeResetToken, configurePreviewLinkBehavior, finalizeRenderedNode, getGridItemWrapperProps, normalizeRenderableChild, prepareRenderableChildren, resolveBoundTableData, resolveReactNodePlan, resolveResolvedReactNode, toBoolean };
|