@arkcit/engine-core 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 +53 -0
- package/dist/contracts.d.ts +4 -0
- package/dist/contracts.js +32 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.js +32 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @arkcit/engine-core
|
|
2
|
+
|
|
3
|
+
Shared engine primitives and cross-adapter contracts.
|
|
4
|
+
|
|
5
|
+
## Position In The Flow
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
@arkcit/engine-schema
|
|
9
|
+
+
|
|
10
|
+
@arkcit/engine-runtime
|
|
11
|
+
↓
|
|
12
|
+
@arkcit/engine-core
|
|
13
|
+
↓
|
|
14
|
+
@arkcit/engine-render-layer
|
|
15
|
+
↓
|
|
16
|
+
@arkcit/engine*
|
|
17
|
+
↓
|
|
18
|
+
framework adapters and UI libraries
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## What Goes In
|
|
22
|
+
|
|
23
|
+
- schema contracts
|
|
24
|
+
- runtime contracts
|
|
25
|
+
- shared engine semantics
|
|
26
|
+
|
|
27
|
+
## What Comes Out
|
|
28
|
+
|
|
29
|
+
- engine-neutral primitives
|
|
30
|
+
- resolved-node related contracts
|
|
31
|
+
- adapter-facing core types
|
|
32
|
+
|
|
33
|
+
## Responsibilities
|
|
34
|
+
|
|
35
|
+
- hold framework-neutral engine primitives
|
|
36
|
+
- define shared cross-adapter contracts
|
|
37
|
+
- keep the center of the engine stack portable
|
|
38
|
+
|
|
39
|
+
## Do Not Put Here
|
|
40
|
+
|
|
41
|
+
- direct React rendering
|
|
42
|
+
- Angular templates
|
|
43
|
+
- native widget instances
|
|
44
|
+
- studio-only canvas behavior
|
|
45
|
+
|
|
46
|
+
## Used By
|
|
47
|
+
|
|
48
|
+
- `@arkcit/engine-render-layer`
|
|
49
|
+
- `@arkcit/engine`
|
|
50
|
+
- `@arkcit/engine-react`
|
|
51
|
+
- `@arkcit/engine-angular`
|
|
52
|
+
- `@arkcit/engine-react-native`
|
|
53
|
+
- `@arkcit/*-ui`
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ComponentRegistry, ComponentRegistryEntry, ReactWebRendererProps, ResolvedNode, ResolvedNodeBase, ResolvedNodeChildDescriptor, ResolvedNodeContentDescriptor, RuntimeRenderInput, SchemaRenderInput, StudioAuthoringProps, UIEngineProps, UINodeDropPreview, UINodeDropState, UINodeDropTarget, UINodeSize, UINodeWrapperProps, createResolvedNode, createResolvedNodeBase } from './index.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@arkcit/engine-runtime';
|
|
4
|
+
import '@arkcit/engine-schema';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/contracts/core.types.ts
|
|
2
|
+
var createResolvedNodeBase = ({
|
|
3
|
+
node,
|
|
4
|
+
componentProps,
|
|
5
|
+
renderBindingProps,
|
|
6
|
+
childDescriptors,
|
|
7
|
+
childContentDescriptor
|
|
8
|
+
}) => ({
|
|
9
|
+
node,
|
|
10
|
+
componentType: node.type,
|
|
11
|
+
componentProps,
|
|
12
|
+
renderBindingProps,
|
|
13
|
+
childDescriptors,
|
|
14
|
+
childContentDescriptor
|
|
15
|
+
});
|
|
16
|
+
var createResolvedNode = ({
|
|
17
|
+
contentPlans,
|
|
18
|
+
navigationPlans,
|
|
19
|
+
renderDirectivePlans,
|
|
20
|
+
finalRenderPlans,
|
|
21
|
+
...base
|
|
22
|
+
}) => ({
|
|
23
|
+
...base,
|
|
24
|
+
contentPlans,
|
|
25
|
+
navigationPlans,
|
|
26
|
+
renderDirectivePlans,
|
|
27
|
+
finalRenderPlans
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
createResolvedNode,
|
|
31
|
+
createResolvedNodeBase
|
|
32
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UIRuntime } from '@arkcit/engine-runtime';
|
|
3
|
+
import { UINode, UISchema } from '@arkcit/engine-schema';
|
|
4
|
+
|
|
5
|
+
type ComponentRegistryEntry = {
|
|
6
|
+
Component: React.ComponentType<Record<string, unknown>>;
|
|
7
|
+
meta?: {
|
|
8
|
+
editableProps?: string[];
|
|
9
|
+
editableTextProps?: string[];
|
|
10
|
+
editableEnumProps?: Record<string, string[]>;
|
|
11
|
+
editableBooleanProps?: string[];
|
|
12
|
+
editableNumberProps?: string[];
|
|
13
|
+
container?: boolean;
|
|
14
|
+
folder?: "primitives" | "patterns" | "overlays" | "media" | "domain" | "docs";
|
|
15
|
+
family?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type ComponentRegistry = Record<string, ComponentRegistryEntry>;
|
|
19
|
+
type UINodeWrapperProps = {
|
|
20
|
+
nodeId: string;
|
|
21
|
+
wrapperClassName?: string;
|
|
22
|
+
cursorClassName?: string;
|
|
23
|
+
isSelected: boolean;
|
|
24
|
+
allowDragHandle?: boolean;
|
|
25
|
+
allowResizeHandle?: boolean;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
28
|
+
onDoubleClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
29
|
+
onTouchStart?: (event: React.TouchEvent<HTMLDivElement>) => void;
|
|
30
|
+
onTouchMove?: (event: React.TouchEvent<HTMLDivElement>) => void;
|
|
31
|
+
onTouchEnd?: (event: React.TouchEvent<HTMLDivElement>) => void;
|
|
32
|
+
showResizeHandle: boolean;
|
|
33
|
+
onResizeMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
34
|
+
isInlineEditing: boolean;
|
|
35
|
+
preserveContentWhileInlineEditing?: boolean;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
inlineEditor?: React.ReactNode;
|
|
38
|
+
};
|
|
39
|
+
type UINodeSize = {
|
|
40
|
+
widthPct: number;
|
|
41
|
+
heightPct: number;
|
|
42
|
+
heightPx?: number;
|
|
43
|
+
};
|
|
44
|
+
type UINodeDropTarget = {
|
|
45
|
+
nodeId: string;
|
|
46
|
+
position: "before" | "inside" | "after";
|
|
47
|
+
source: "canvas";
|
|
48
|
+
};
|
|
49
|
+
type UINodeDropPreview = {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
label: string;
|
|
53
|
+
};
|
|
54
|
+
type UINodeDropState = {
|
|
55
|
+
visible: boolean;
|
|
56
|
+
active: boolean;
|
|
57
|
+
status: "valid" | "warning" | "invalid" | null;
|
|
58
|
+
preview: UINodeDropPreview | null;
|
|
59
|
+
};
|
|
60
|
+
type SchemaRenderInput = {
|
|
61
|
+
schema: UISchema;
|
|
62
|
+
};
|
|
63
|
+
type RuntimeRenderInput = {
|
|
64
|
+
store?: UIRuntime;
|
|
65
|
+
};
|
|
66
|
+
type ReactWebRendererProps = {
|
|
67
|
+
registry?: ComponentRegistry;
|
|
68
|
+
};
|
|
69
|
+
type StudioAuthoringProps = {
|
|
70
|
+
onNodeClick?: (nodeId: string) => void;
|
|
71
|
+
onInlineTextEdit?: (nodeId: string, propName: string, value: unknown) => void;
|
|
72
|
+
onNodeResize?: (nodeId: string, size: UINodeSize) => void;
|
|
73
|
+
onNodeResizeStart?: (nodeId: string) => void;
|
|
74
|
+
onNodeResizeEnd?: (nodeId: string, size: UINodeSize) => void;
|
|
75
|
+
onNodeDragStart?: (nodeId: string, event: React.DragEvent<HTMLElement>) => void;
|
|
76
|
+
onNodeDragEnd?: (event: React.DragEvent<HTMLElement>) => void;
|
|
77
|
+
onNodeDragSuspend?: () => void;
|
|
78
|
+
onNodeDragResume?: () => void;
|
|
79
|
+
onNodeDragOverTarget?: (target: UINodeDropTarget, event: React.DragEvent<HTMLElement>) => void;
|
|
80
|
+
onNodeDropTarget?: (target: UINodeDropTarget, event: React.DragEvent<HTMLElement>) => void;
|
|
81
|
+
getNodeDropState?: (target: UINodeDropTarget) => UINodeDropState;
|
|
82
|
+
selectedNodeId?: string | null;
|
|
83
|
+
nodeWrapper?: React.ComponentType<UINodeWrapperProps>;
|
|
84
|
+
};
|
|
85
|
+
type UIEngineProps = SchemaRenderInput & RuntimeRenderInput & ReactWebRendererProps & StudioAuthoringProps;
|
|
86
|
+
type ResolvedNodeChildDescriptor = {
|
|
87
|
+
kind: "node";
|
|
88
|
+
child: UINode;
|
|
89
|
+
} | {
|
|
90
|
+
kind: "grid-item";
|
|
91
|
+
child: UINode;
|
|
92
|
+
colSpan: number;
|
|
93
|
+
};
|
|
94
|
+
type ResolvedNodeContentDescriptor = {
|
|
95
|
+
kind: "empty";
|
|
96
|
+
} | {
|
|
97
|
+
kind: "single";
|
|
98
|
+
child: ResolvedNodeChildDescriptor;
|
|
99
|
+
} | {
|
|
100
|
+
kind: "list";
|
|
101
|
+
children: ResolvedNodeChildDescriptor[];
|
|
102
|
+
};
|
|
103
|
+
type ResolvedNodeBase = {
|
|
104
|
+
node: UINode;
|
|
105
|
+
componentType: string;
|
|
106
|
+
componentProps: Record<string, unknown>;
|
|
107
|
+
renderBindingProps: Record<string, unknown>;
|
|
108
|
+
childDescriptors: ResolvedNodeChildDescriptor[];
|
|
109
|
+
childContentDescriptor: ResolvedNodeContentDescriptor;
|
|
110
|
+
};
|
|
111
|
+
type ResolvedNode<TContentPlan = unknown, TNavigationPlan = unknown, TDirectivePlan = unknown, TFinalPlan = unknown> = ResolvedNodeBase & {
|
|
112
|
+
contentPlans: TContentPlan[];
|
|
113
|
+
navigationPlans: TNavigationPlan[];
|
|
114
|
+
renderDirectivePlans: TDirectivePlan[];
|
|
115
|
+
finalRenderPlans: TFinalPlan[];
|
|
116
|
+
};
|
|
117
|
+
declare const createResolvedNodeBase: ({ node, componentProps, renderBindingProps, childDescriptors, childContentDescriptor, }: Omit<ResolvedNodeBase, "componentType"> & {
|
|
118
|
+
componentType?: string;
|
|
119
|
+
}) => {
|
|
120
|
+
node: UINode;
|
|
121
|
+
componentType: string;
|
|
122
|
+
componentProps: Record<string, unknown>;
|
|
123
|
+
renderBindingProps: Record<string, unknown>;
|
|
124
|
+
childDescriptors: ResolvedNodeChildDescriptor[];
|
|
125
|
+
childContentDescriptor: ResolvedNodeContentDescriptor;
|
|
126
|
+
};
|
|
127
|
+
declare const createResolvedNode: <TContentPlan = unknown, TNavigationPlan = unknown, TDirectivePlan = unknown, TFinalPlan = unknown>({ contentPlans, navigationPlans, renderDirectivePlans, finalRenderPlans, ...base }: ResolvedNodeBase & {
|
|
128
|
+
contentPlans: TContentPlan[];
|
|
129
|
+
navigationPlans: TNavigationPlan[];
|
|
130
|
+
renderDirectivePlans: TDirectivePlan[];
|
|
131
|
+
finalRenderPlans: TFinalPlan[];
|
|
132
|
+
}) => ResolvedNode<TContentPlan, TNavigationPlan, TDirectivePlan, TFinalPlan>;
|
|
133
|
+
|
|
134
|
+
export { type ComponentRegistry, type ComponentRegistryEntry, type ReactWebRendererProps, type ResolvedNode, type ResolvedNodeBase, type ResolvedNodeChildDescriptor, type ResolvedNodeContentDescriptor, type RuntimeRenderInput, type SchemaRenderInput, type StudioAuthoringProps, type UIEngineProps, type UINodeDropPreview, type UINodeDropState, type UINodeDropTarget, type UINodeSize, type UINodeWrapperProps, createResolvedNode, createResolvedNodeBase };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/contracts/core.types.ts
|
|
2
|
+
var createResolvedNodeBase = ({
|
|
3
|
+
node,
|
|
4
|
+
componentProps,
|
|
5
|
+
renderBindingProps,
|
|
6
|
+
childDescriptors,
|
|
7
|
+
childContentDescriptor
|
|
8
|
+
}) => ({
|
|
9
|
+
node,
|
|
10
|
+
componentType: node.type,
|
|
11
|
+
componentProps,
|
|
12
|
+
renderBindingProps,
|
|
13
|
+
childDescriptors,
|
|
14
|
+
childContentDescriptor
|
|
15
|
+
});
|
|
16
|
+
var createResolvedNode = ({
|
|
17
|
+
contentPlans,
|
|
18
|
+
navigationPlans,
|
|
19
|
+
renderDirectivePlans,
|
|
20
|
+
finalRenderPlans,
|
|
21
|
+
...base
|
|
22
|
+
}) => ({
|
|
23
|
+
...base,
|
|
24
|
+
contentPlans,
|
|
25
|
+
navigationPlans,
|
|
26
|
+
renderDirectivePlans,
|
|
27
|
+
finalRenderPlans
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
createResolvedNode,
|
|
31
|
+
createResolvedNodeBase
|
|
32
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arkcit/engine-core",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"description": "Workspace extraction candidate for Arkcit core contracts.",
|
|
8
|
+
"license": "UNLICENSED",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"arkcit",
|
|
11
|
+
"engine",
|
|
12
|
+
"core",
|
|
13
|
+
"contracts"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/Arkcit/ui-orchestrator.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/Arkcit/ui-orchestrator",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/Arkcit/ui-orchestrator/issues"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./contracts": {
|
|
39
|
+
"types": "./dist/contracts.d.ts",
|
|
40
|
+
"import": "./dist/contracts.js",
|
|
41
|
+
"default": "./dist/contracts.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup --config tsup.config.ts",
|
|
49
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
50
|
+
"test:smoke": "node tests/run-all.mjs",
|
|
51
|
+
"test": "npm run test:smoke"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@arkcit/engine-schema": "^0.3.0",
|
|
55
|
+
"@arkcit/engine-runtime": "^0.3.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/react": "^19.2.5",
|
|
62
|
+
"tsup": "^8.5.1",
|
|
63
|
+
"typescript": "~5.9.3"
|
|
64
|
+
}
|
|
65
|
+
}
|