@arkcit/engine 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.
Files changed (42) hide show
  1. package/README.md +68 -0
  2. package/dist/UIEngine.d.ts +6 -0
  3. package/dist/UIEngine.js +3235 -0
  4. package/dist/bindings.d.ts +8 -0
  5. package/dist/bindings.js +146 -0
  6. package/dist/components/index.d.ts +17 -0
  7. package/dist/components/index.js +143 -0
  8. package/dist/core/index.d.ts +4 -0
  9. package/dist/core/index.js +9 -0
  10. package/dist/form/engineFormValidation.d.ts +2 -0
  11. package/dist/form/engineFormValidation.js +241 -0
  12. package/dist/form.d.ts +67 -0
  13. package/dist/form.js +241 -0
  14. package/dist/index.d.ts +15 -0
  15. package/dist/index.js +3336 -0
  16. package/dist/layout.d.ts +6 -0
  17. package/dist/layout.js +82 -0
  18. package/dist/preview/index.d.ts +63 -0
  19. package/dist/preview/index.js +1514 -0
  20. package/dist/react-web/index.d.ts +8 -0
  21. package/dist/react-web/index.js +3246 -0
  22. package/dist/registry.d.ts +2 -0
  23. package/dist/registry.js +0 -0
  24. package/dist/render-layer/index.d.ts +1 -0
  25. package/dist/render-layer/index.js +13 -0
  26. package/dist/renderStudioForm-CPQEzvT7.d.ts +75 -0
  27. package/dist/renderers/index.d.ts +8 -0
  28. package/dist/renderers/index.js +1570 -0
  29. package/dist/runtime/index.d.ts +1 -0
  30. package/dist/runtime/index.js +0 -0
  31. package/dist/schema/index.d.ts +1 -0
  32. package/dist/schema/index.js +0 -0
  33. package/dist/studio-bridge/index.d.ts +501 -0
  34. package/dist/studio-bridge/index.js +2840 -0
  35. package/dist/studioProps.d.ts +8 -0
  36. package/dist/studioProps.js +97 -0
  37. package/dist/types-9TZ2lQDP.d.ts +60 -0
  38. package/dist/types-CyAE6ZLH.d.ts +19 -0
  39. package/dist/types.d.ts +16 -0
  40. package/dist/types.js +0 -0
  41. package/dist/wizardEditingHandlers-D50tR-6n.d.ts +163 -0
  42. package/package.json +160 -0
@@ -0,0 +1,6 @@
1
+ import { UINodeLayout, UINode } from '@arkcit/engine-schema';
2
+
3
+ declare const readNodeLayout: (props?: Record<string, unknown>) => UINodeLayout;
4
+ declare const writeNodeLayout: (node: UINode, nextLayout: UINodeLayout) => UINode;
5
+
6
+ export { readNodeLayout, writeNodeLayout };
package/dist/layout.js ADDED
@@ -0,0 +1,82 @@
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/layout/nodeLayout.ts
22
+ var toPositiveNumber = (value) => {
23
+ const numeric = Number(value);
24
+ if (!Number.isFinite(numeric) || numeric <= 0) return void 0;
25
+ return numeric;
26
+ };
27
+ var toColSpan = (value) => {
28
+ const numeric = Number(value);
29
+ if (!Number.isInteger(numeric) || numeric < 1 || numeric > 12) return void 0;
30
+ return numeric;
31
+ };
32
+ var toCardSection = (value) => {
33
+ if (value === "header" || value === "body" || value === "footer") return value;
34
+ return void 0;
35
+ };
36
+ var readNodeLayout = (props) => {
37
+ var _a, _b, _c, _d, _e, _f, _g;
38
+ if (!props) return {};
39
+ const rawLayout = props.layout && typeof props.layout === "object" && !Array.isArray(props.layout) ? props.layout : {};
40
+ return {
41
+ widthPct: toPositiveNumber((_a = rawLayout.widthPct) != null ? _a : props.__studioWidthPct),
42
+ heightPct: toPositiveNumber((_b = rawLayout.heightPct) != null ? _b : props.__studioHeightPct),
43
+ heightPx: toPositiveNumber((_c = rawLayout.heightPx) != null ? _c : props.__studioHeightPx),
44
+ colSpan: toColSpan((_d = rawLayout.colSpan) != null ? _d : props.__studioColSpan),
45
+ wrapperClassName: String(
46
+ (_f = (_e = rawLayout.wrapperClassName) != null ? _e : props.__studioWrapperClassName) != null ? _f : ""
47
+ ).trim(),
48
+ cardSection: toCardSection((_g = rawLayout.cardSection) != null ? _g : props.__studioCardSection)
49
+ };
50
+ };
51
+ var writeNodeLayout = (node, nextLayout) => {
52
+ var _a;
53
+ const currentProps = (_a = node.props) != null ? _a : {};
54
+ const currentLayout = readNodeLayout(currentProps);
55
+ const mergedLayout = __spreadValues(__spreadValues({}, currentLayout), nextLayout);
56
+ const cleanLayout = {};
57
+ if (mergedLayout.widthPct !== void 0) cleanLayout.widthPct = mergedLayout.widthPct;
58
+ if (mergedLayout.heightPct !== void 0) cleanLayout.heightPct = mergedLayout.heightPct;
59
+ if (mergedLayout.heightPx !== void 0) cleanLayout.heightPx = mergedLayout.heightPx;
60
+ if (mergedLayout.colSpan !== void 0) cleanLayout.colSpan = mergedLayout.colSpan;
61
+ if (mergedLayout.wrapperClassName) cleanLayout.wrapperClassName = mergedLayout.wrapperClassName;
62
+ if (mergedLayout.cardSection) cleanLayout.cardSection = mergedLayout.cardSection;
63
+ const nextProps = __spreadValues({}, currentProps);
64
+ if (Object.keys(cleanLayout).length > 0) {
65
+ nextProps.layout = cleanLayout;
66
+ } else {
67
+ delete nextProps.layout;
68
+ }
69
+ delete nextProps.__studioWidthPct;
70
+ delete nextProps.__studioHeightPct;
71
+ delete nextProps.__studioHeightPx;
72
+ delete nextProps.__studioColSpan;
73
+ delete nextProps.__studioWrapperClassName;
74
+ delete nextProps.__studioCardSection;
75
+ return __spreadProps(__spreadValues({}, node), {
76
+ props: nextProps
77
+ });
78
+ };
79
+ export {
80
+ readNodeLayout,
81
+ writeNodeLayout
82
+ };
@@ -0,0 +1,63 @@
1
+ export { configurePreviewLinkBehavior, materializeBoundTable, resolveBoundTableData } from '@arkcit/engine-react';
2
+ import React__default, { Dispatch, SetStateAction, ReactNode } from 'react';
3
+ import { UINode } from '@arkcit/engine-schema';
4
+ import { UIRuntime } from '@arkcit/engine-runtime';
5
+
6
+ type RenderStudioFormArgs = {
7
+ node: UINode;
8
+ componentProps: Record<string, unknown>;
9
+ visibleChildren: UINode[];
10
+ runtime: UIRuntime;
11
+ onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
12
+ captureFieldFocus: (target: EventTarget | null) => void;
13
+ renderSafeNode: (node: UINode) => React__default.ReactNode;
14
+ };
15
+ declare const materializePreviewForm: ({ node, componentProps, visibleChildren, runtime, onInlineTextEdit, captureFieldFocus, renderSafeNode, }: RenderStudioFormArgs) => React__default.ReactNode | null;
16
+
17
+ type ConfigureStudioAccordionArgs = {
18
+ node: UINode;
19
+ componentProps: Record<string, unknown>;
20
+ accordionChildren: UINode[];
21
+ selectedNodeId: string | null;
22
+ accordionOpenIdsByNodeId: Record<string, string[]>;
23
+ setAccordionOpenIdsByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, string[]>>>;
24
+ renderSafeNode: (node: UINode) => React__default.ReactNode;
25
+ };
26
+ declare const configurePreviewAccordion: ({ node, componentProps, accordionChildren, selectedNodeId, accordionOpenIdsByNodeId, setAccordionOpenIdsByNodeId, renderSafeNode, }: ConfigureStudioAccordionArgs) => void;
27
+ type ConfigureStudioExpandablePanelArgs = {
28
+ node: UINode;
29
+ componentProps: Record<string, unknown>;
30
+ panelChildren: UINode[];
31
+ expandablePanelOpenByNodeId: Record<string, boolean>;
32
+ setExpandablePanelOpenByNodeId: React__default.Dispatch<React__default.SetStateAction<Record<string, boolean>>>;
33
+ renderSafeNode: (node: UINode) => React__default.ReactNode;
34
+ };
35
+ declare const configurePreviewExpandablePanel: ({ node, componentProps, panelChildren, expandablePanelOpenByNodeId, setExpandablePanelOpenByNodeId, renderSafeNode, }: ConfigureStudioExpandablePanelArgs) => void;
36
+ type ConfigureStudioTabsArgs = {
37
+ componentProps: Record<string, unknown>;
38
+ tabItems: Array<Record<string, unknown>>;
39
+ rawChildren: UINode[];
40
+ runtime: UIRuntime;
41
+ renderSafeNode: (node: UINode) => React__default.ReactNode;
42
+ normalizeRenderableChild: (value: unknown) => React__default.ReactNode;
43
+ };
44
+ declare const configurePreviewTabs: ({ componentProps, tabItems, rawChildren, runtime, renderSafeNode, normalizeRenderableChild, }: ConfigureStudioTabsArgs) => void;
45
+
46
+ type ConfigureStudioFormWizardArgs = {
47
+ node: UINode;
48
+ componentProps: Record<string, unknown>;
49
+ isStudioRendererContext: boolean;
50
+ selectedNodeId: string | null;
51
+ wizardActiveStepByNodeId: Record<string, string>;
52
+ runtime: UIRuntime;
53
+ setWizardActiveStepByNodeId: Dispatch<SetStateAction<Record<string, string>>>;
54
+ onNodeClick?: (nodeId: string) => void;
55
+ onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
56
+ renderSafeNode: (node: UINode) => ReactNode;
57
+ captureFieldFocus: (target: EventTarget | null) => void;
58
+ openInlineEditorForNodeProp: (targetNodeId: string, propName: string, rawValue: unknown) => void;
59
+ internalStudioNodeTypes: Set<string>;
60
+ };
61
+ declare const configurePreviewFormWizard: ({ node, componentProps, isStudioRendererContext, selectedNodeId, wizardActiveStepByNodeId, runtime, setWizardActiveStepByNodeId, onNodeClick, onInlineTextEdit, renderSafeNode, captureFieldFocus, openInlineEditorForNodeProp, internalStudioNodeTypes, }: ConfigureStudioFormWizardArgs) => void;
62
+
63
+ export { configurePreviewAccordion, configurePreviewExpandablePanel, configurePreviewFormWizard, configurePreviewTabs, materializePreviewForm };