Skip to content

Commit 4acc96b

Browse files
committed
chore(core): rework json generation
wip json generation wip wip wip wip wip
1 parent 18abf86 commit 4acc96b

File tree

8 files changed

+1002
-421
lines changed

8 files changed

+1002
-421
lines changed

libs/core/src/lib/three-types.ts

Lines changed: 102 additions & 421 deletions
Large diffs are not rendered by default.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
export const COMMON_ATTRIBUTES = [
2+
{
3+
name: 'attach',
4+
description: 'Property to attach to parent. Can be dotted path',
5+
},
6+
{
7+
name: '[attach]',
8+
description: 'An array of paths to attach to parent. Can also be an NgtAttachFunction',
9+
},
10+
{
11+
name: '[dispose]',
12+
description: 'Cleanup function',
13+
},
14+
{
15+
name: '[parameters]',
16+
description: 'Additional parameters for the instance',
17+
},
18+
{
19+
name: '[userData]',
20+
description: 'User data to pass to the instance',
21+
},
22+
];
23+
24+
export const COMMON_EVENTS = [
25+
{
26+
name: '(change)',
27+
properties: { type: 'string', target: 'any' },
28+
},
29+
{
30+
name: '(disposed)',
31+
properties: { type: 'string', target: 'any' },
32+
},
33+
{
34+
name: '(attached)',
35+
type: 'NgtAfterAttach',
36+
description: 'Fires after the element is attached to its parent',
37+
properties: [
38+
{
39+
name: 'parent',
40+
description: 'The parent instance this element was attached to',
41+
},
42+
{
43+
name: 'node',
44+
description: 'The element instance that was attached',
45+
},
46+
],
47+
},
48+
{
49+
name: '(updated)',
50+
type: 'any',
51+
description: 'Fires when the element is updated with the updated instance',
52+
},
53+
];
54+
55+
export const OBJECT3D_EVENTS = [
56+
{
57+
name: 'added',
58+
properties: { type: 'string', target: 'THREE.Object3D' },
59+
},
60+
{
61+
name: 'removed',
62+
properties: { type: 'string', target: 'THREE.Object3D' },
63+
},
64+
{
65+
name: 'childadded',
66+
properties: { type: 'string', target: 'THREE.Object3D', child: 'THREE.Object3D' },
67+
},
68+
{
69+
name: 'childremoved',
70+
properties: { type: 'string', target: 'THREE.Object3D', child: 'THREE.Object3D' },
71+
},
72+
];

tools/scripts/json/event-types.mjs

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
export const EVENT_TYPE_MAP = {
2+
click: {
3+
type: 'MouseEvent',
4+
properties: {
5+
eventObject: 'THREE.Object3D',
6+
intersections: 'THREE.Intersection[]',
7+
unprojectedPoint: 'THREE.Vector3',
8+
pointer: 'THREE.Vector2',
9+
delta: 'number',
10+
ray: 'THREE.Ray',
11+
camera: 'THREE.Camera',
12+
stopPropagation: '() => void',
13+
nativeEvent: 'MouseEvent',
14+
},
15+
},
16+
contextmenu: {
17+
type: 'MouseEvent',
18+
properties: {
19+
eventObject: 'THREE.Object3D',
20+
intersections: 'THREE.Intersection[]',
21+
unprojectedPoint: 'THREE.Vector3',
22+
pointer: 'THREE.Vector2',
23+
delta: 'number',
24+
ray: 'THREE.Ray',
25+
camera: 'THREE.Camera',
26+
stopPropagation: '() => void',
27+
nativeEvent: 'MouseEvent',
28+
},
29+
},
30+
dblclick: {
31+
type: 'MouseEvent',
32+
properties: {
33+
eventObject: 'THREE.Object3D',
34+
intersections: 'THREE.Intersection[]',
35+
unprojectedPoint: 'THREE.Vector3',
36+
pointer: 'THREE.Vector2',
37+
delta: 'number',
38+
ray: 'THREE.Ray',
39+
camera: 'THREE.Camera',
40+
stopPropagation: '() => void',
41+
nativeEvent: 'MouseEvent',
42+
},
43+
},
44+
pointerup: {
45+
type: 'PointerEvent',
46+
properties: {
47+
eventObject: 'THREE.Object3D',
48+
intersections: 'THREE.Intersection[]',
49+
unprojectedPoint: 'THREE.Vector3',
50+
pointer: 'THREE.Vector2',
51+
delta: 'number',
52+
ray: 'THREE.Ray',
53+
camera: 'THREE.Camera',
54+
stopPropagation: '() => void',
55+
nativeEvent: 'PointerEvent',
56+
},
57+
},
58+
pointerdown: {
59+
type: 'PointerEvent',
60+
properties: {
61+
eventObject: 'THREE.Object3D',
62+
intersections: 'THREE.Intersection[]',
63+
unprojectedPoint: 'THREE.Vector3',
64+
pointer: 'THREE.Vector2',
65+
delta: 'number',
66+
ray: 'THREE.Ray',
67+
camera: 'THREE.Camera',
68+
stopPropagation: '() => void',
69+
nativeEvent: 'PointerEvent',
70+
},
71+
},
72+
pointerover: {
73+
type: 'PointerEvent',
74+
properties: {
75+
eventObject: 'THREE.Object3D',
76+
intersections: 'THREE.Intersection[]',
77+
unprojectedPoint: 'THREE.Vector3',
78+
pointer: 'THREE.Vector2',
79+
delta: 'number',
80+
ray: 'THREE.Ray',
81+
camera: 'THREE.Camera',
82+
stopPropagation: '() => void',
83+
nativeEvent: 'PointerEvent',
84+
},
85+
},
86+
pointerout: {
87+
type: 'PointerEvent',
88+
properties: {
89+
eventObject: 'THREE.Object3D',
90+
intersections: 'THREE.Intersection[]',
91+
unprojectedPoint: 'THREE.Vector3',
92+
pointer: 'THREE.Vector2',
93+
delta: 'number',
94+
ray: 'THREE.Ray',
95+
camera: 'THREE.Camera',
96+
stopPropagation: '() => void',
97+
nativeEvent: 'PointerEvent',
98+
},
99+
},
100+
pointerenter: {
101+
type: 'PointerEvent',
102+
properties: {
103+
eventObject: 'THREE.Object3D',
104+
intersections: 'THREE.Intersection[]',
105+
unprojectedPoint: 'THREE.Vector3',
106+
pointer: 'THREE.Vector2',
107+
delta: 'number',
108+
ray: 'THREE.Ray',
109+
camera: 'THREE.Camera',
110+
stopPropagation: '() => void',
111+
nativeEvent: 'PointerEvent',
112+
},
113+
},
114+
pointerleave: {
115+
type: 'PointerEvent',
116+
properties: {
117+
eventObject: 'THREE.Object3D',
118+
intersections: 'THREE.Intersection[]',
119+
unprojectedPoint: 'THREE.Vector3',
120+
pointer: 'THREE.Vector2',
121+
delta: 'number',
122+
ray: 'THREE.Ray',
123+
camera: 'THREE.Camera',
124+
stopPropagation: '() => void',
125+
nativeEvent: 'PointerEvent',
126+
},
127+
},
128+
pointermove: {
129+
type: 'PointerEvent',
130+
properties: {
131+
eventObject: 'THREE.Object3D',
132+
intersections: 'THREE.Intersection[]',
133+
unprojectedPoint: 'THREE.Vector3',
134+
pointer: 'THREE.Vector2',
135+
delta: 'number',
136+
ray: 'THREE.Ray',
137+
camera: 'THREE.Camera',
138+
stopPropagation: '() => void',
139+
nativeEvent: 'PointerEvent',
140+
},
141+
},
142+
pointercancel: {
143+
type: 'PointerEvent',
144+
properties: {
145+
eventObject: 'THREE.Object3D',
146+
intersections: 'THREE.Intersection[]',
147+
unprojectedPoint: 'THREE.Vector3',
148+
pointer: 'THREE.Vector2',
149+
delta: 'number',
150+
ray: 'THREE.Ray',
151+
camera: 'THREE.Camera',
152+
stopPropagation: '() => void',
153+
nativeEvent: 'PointerEvent',
154+
},
155+
},
156+
wheel: {
157+
type: 'WheelEvent',
158+
properties: {
159+
eventObject: 'THREE.Object3D',
160+
intersections: 'THREE.Intersection[]',
161+
unprojectedPoint: 'THREE.Vector3',
162+
pointer: 'THREE.Vector2',
163+
delta: 'number',
164+
ray: 'THREE.Ray',
165+
camera: 'THREE.Camera',
166+
stopPropagation: '() => void',
167+
nativeEvent: 'WheelEvent',
168+
},
169+
},
170+
};

0 commit comments

Comments
 (0)