@fugood/bricks-project 2.21.0-beta.14.test7 → 2.21.0-beta.14.test8
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/compile/index.ts +23 -16
- package/package.json +1 -1
- package/types/bricks.ts +4 -4
- package/types/common.ts +3 -3
- package/types/subspace.ts +5 -5
- package/types/switch.ts +2 -2
package/compile/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _ from 'lodash'
|
|
2
|
-
import { parse as parseAST
|
|
2
|
+
import { parse as parseAST } from 'acorn'
|
|
3
|
+
import type { ExportNamedDeclaration, FunctionDeclaration } from 'acorn'
|
|
3
4
|
import escodegen from 'escodegen'
|
|
4
|
-
import {
|
|
5
|
+
import { generateCalulationMap } from './util'
|
|
6
|
+
import { templateActionNameMap } from './action-name-map'
|
|
7
|
+
import type {
|
|
5
8
|
Application,
|
|
6
9
|
Data,
|
|
7
10
|
Animation,
|
|
@@ -23,8 +26,6 @@ import {
|
|
|
23
26
|
Canvas,
|
|
24
27
|
Subspace,
|
|
25
28
|
} from '../types'
|
|
26
|
-
import { generateCalulationMap } from './util'
|
|
27
|
-
import { templateActionNameMap } from './action-name-map'
|
|
28
29
|
|
|
29
30
|
const compileProperty = (property, result = {}) => {
|
|
30
31
|
if (Array.isArray(property)) {
|
|
@@ -295,17 +296,23 @@ export const compile = (app: Application) => {
|
|
|
295
296
|
eventMap: compileEvents(itemBrick.templateKey, itemBrick.eventMap || {}, {
|
|
296
297
|
camelCase: true,
|
|
297
298
|
}),
|
|
298
|
-
stateGroup: itemBrick.stateGroup.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
299
|
+
stateGroup: itemBrick.stateGroup.reduce((acc, stateGroup) => {
|
|
300
|
+
acc[stateGroup.id] = {
|
|
301
|
+
title: stateGroup.title,
|
|
302
|
+
description: stateGroup.description,
|
|
303
|
+
override: stateGroup.override,
|
|
304
|
+
break: stateGroup.break,
|
|
305
|
+
commented: stateGroup.disabled,
|
|
306
|
+
conds: compileSwitchConds(itemBrick.templateKey, stateGroup.conds || []),
|
|
307
|
+
property: compileProperty(stateGroup.property),
|
|
308
|
+
animation: compileAnimations(itemBrick.templateKey, stateGroup.animation || {}),
|
|
309
|
+
outlet: compileOutlets(itemBrick.templateKey, stateGroup.outlets || {}),
|
|
310
|
+
eventMap: compileEvents(itemBrick.templateKey, stateGroup.eventMap || {}, {
|
|
311
|
+
camelCase: true,
|
|
312
|
+
}),
|
|
313
|
+
}
|
|
314
|
+
return acc
|
|
315
|
+
}, {}),
|
|
309
316
|
})
|
|
310
317
|
if (Array.isArray(brickItems.brickList)) {
|
|
311
318
|
const brickList = (brickItems.brickList || []).map(buildList)
|
|
@@ -592,7 +599,7 @@ export const compile = (app: Application) => {
|
|
|
592
599
|
map[dataCalc.id] = calc
|
|
593
600
|
return map
|
|
594
601
|
}, {}),
|
|
595
|
-
action_map: subspace.actions ||
|
|
602
|
+
action_map: subspace.actions || undefined,
|
|
596
603
|
event_map: compileEvents('', subspace.events || {}),
|
|
597
604
|
routing: subspace.dataRouting.reduce((acc, data) => {
|
|
598
605
|
acc[data.id] = { enabled_routing: true }
|
package/package.json
CHANGED
package/types/bricks.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from './switch'
|
|
2
|
-
import { Data, DataLink } from './data'
|
|
3
|
-
import { Animation, AnimationBasicEvents } from './animation'
|
|
4
|
-
import { Brick, EventAction, ActionWithDataParams, ActionWithParams, Action } from './common'
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from './switch'
|
|
2
|
+
import type { Data, DataLink } from './data'
|
|
3
|
+
import type { Animation, AnimationBasicEvents } from './animation'
|
|
4
|
+
import type { Brick, EventAction, ActionWithDataParams, ActionWithParams, Action } from './common'
|
|
5
5
|
|
|
6
6
|
interface BrickBasicProperty {
|
|
7
7
|
/* The brick opacity (0 ~ 1) */
|
package/types/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SwitchDef } from './switch'
|
|
2
|
-
import { Data } from './data'
|
|
3
|
-
import { Subspace } from './subspace'
|
|
1
|
+
import type { SwitchDef } from './switch'
|
|
2
|
+
import type { Data } from './data'
|
|
3
|
+
import type { Subspace } from './subspace'
|
|
4
4
|
|
|
5
5
|
export interface Brick {
|
|
6
6
|
__typename: 'Brick'
|
package/types/subspace.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Brick, Generator, LocalSyncStrategy, EventAction, SubspaceID } from './common'
|
|
2
|
-
import { Animation } from './animation'
|
|
3
|
-
import { Canvas } from './canvas'
|
|
4
|
-
import { Data } from './data'
|
|
5
|
-
import { DataCalculation } from './data-calc'
|
|
1
|
+
import type { Brick, Generator, LocalSyncStrategy, EventAction, SubspaceID } from './common'
|
|
2
|
+
import type { Animation } from './animation'
|
|
3
|
+
import type { Canvas } from './canvas'
|
|
4
|
+
import type { Data } from './data'
|
|
5
|
+
import type { DataCalculation } from './data-calc'
|
|
6
6
|
|
|
7
7
|
export type Subspace = {
|
|
8
8
|
__typename: 'Subspace'
|
package/types/switch.ts
CHANGED