@fugood/bricks-project 2.21.0-beta.14.test0
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/api/application.ts +65 -0
- package/api/index.ts +1 -0
- package/compile/index.ts +485 -0
- package/compile/util.ts +347 -0
- package/index.ts +10 -0
- package/package.json +15 -0
- package/types/animation.ts +95 -0
- package/types/bricks.ts +3052 -0
- package/types/canvas.ts +78 -0
- package/types/common.ts +116 -0
- package/types/data-calc.ts +6950 -0
- package/types/data.ts +33 -0
- package/types/generators.ts +6633 -0
- package/types/index.ts +10 -0
- package/types/subspace.ts +33 -0
- package/types/switch.ts +45 -0
- package/types/system.ts +397 -0
- package/uuid.ts +58 -0
package/types/canvas.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Easing } from './animation'
|
|
2
|
+
import { Data, DataLink } from './data'
|
|
3
|
+
import { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from './switch'
|
|
4
|
+
import { Brick, SubspaceID, EventAction } from './common'
|
|
5
|
+
|
|
6
|
+
type StandbyEasing = {
|
|
7
|
+
method: Easing
|
|
8
|
+
duration: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CanvasDef {
|
|
12
|
+
property?: {
|
|
13
|
+
/* The showing timeout of Canvas, need to set `Next Canvas ID` as well */
|
|
14
|
+
showingTimeout?: number | DataLink
|
|
15
|
+
/* Canvas ID for change next canvas on showing timeout */
|
|
16
|
+
nextCanvasId?: string | DataLink
|
|
17
|
+
/* Canvas's background color */
|
|
18
|
+
backgroundColor?: string | DataLink
|
|
19
|
+
/* Dismiss keyboard on press */
|
|
20
|
+
dismissKeyboardOnPress?: boolean | DataLink
|
|
21
|
+
}
|
|
22
|
+
events?: {
|
|
23
|
+
/* Event on Canvas first enter on Subspace */
|
|
24
|
+
firstEnter?: Array<EventAction>
|
|
25
|
+
/* Event on Canvas enter */
|
|
26
|
+
enter?: Array<EventAction>
|
|
27
|
+
/* Showing timeout event (If `Showing Timeout` is specified) */
|
|
28
|
+
showingTimeout?: Array<EventAction>
|
|
29
|
+
/* Event on Canvas exit */
|
|
30
|
+
exit?: Array<EventAction>
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* View renderer in subspace. */
|
|
35
|
+
export type Canvas = CanvasDef & {
|
|
36
|
+
__typename: 'Canvas'
|
|
37
|
+
id: string
|
|
38
|
+
title: string
|
|
39
|
+
description?: string
|
|
40
|
+
switches: Array<
|
|
41
|
+
SwitchDef &
|
|
42
|
+
CanvasDef & {
|
|
43
|
+
conds?: Array<{
|
|
44
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
45
|
+
cond: SwitchCondInnerStateCurrentCanvas | SwitchCondData
|
|
46
|
+
}>
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
items: Array<{
|
|
50
|
+
item: (() => Brick) | SubspaceID
|
|
51
|
+
frame: {
|
|
52
|
+
x: number
|
|
53
|
+
y: number
|
|
54
|
+
width: number
|
|
55
|
+
height: number
|
|
56
|
+
standbyMode?: 'custom' | 'top' | 'left' | 'right' | 'bottom'
|
|
57
|
+
standbyFrame?: {
|
|
58
|
+
x?: number
|
|
59
|
+
y?: number
|
|
60
|
+
width?: number
|
|
61
|
+
height?: number
|
|
62
|
+
}
|
|
63
|
+
standbyOpacity?: number
|
|
64
|
+
standbyDelay?: number
|
|
65
|
+
standbyDelayRandom?: number
|
|
66
|
+
standbyEasing?: {
|
|
67
|
+
default?: StandbyEasing
|
|
68
|
+
x?: StandbyEasing
|
|
69
|
+
y?: StandbyEasing
|
|
70
|
+
width?: StandbyEasing
|
|
71
|
+
height?: StandbyEasing
|
|
72
|
+
opacity?: StandbyEasing
|
|
73
|
+
}
|
|
74
|
+
showingDelay?: number
|
|
75
|
+
renderOutOfViewport?: boolean
|
|
76
|
+
}
|
|
77
|
+
}>
|
|
78
|
+
}
|
package/types/common.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { SwitchDef } from './switch'
|
|
2
|
+
import { Data } from './data'
|
|
3
|
+
import { Subspace } from './subspace'
|
|
4
|
+
|
|
5
|
+
export interface Brick {
|
|
6
|
+
__typename: 'Brick'
|
|
7
|
+
id: string
|
|
8
|
+
templateKey: string
|
|
9
|
+
title: string
|
|
10
|
+
description: string
|
|
11
|
+
property?: {}
|
|
12
|
+
events: {}
|
|
13
|
+
outlets?: {}
|
|
14
|
+
animation?: {}
|
|
15
|
+
switches: Array<SwitchDef>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum LocalSyncStrategy {
|
|
19
|
+
mainOnly = 'main-only',
|
|
20
|
+
minorOnly = 'minor-only',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Generator {
|
|
24
|
+
__typename: 'Generator'
|
|
25
|
+
id: string
|
|
26
|
+
templateKey: string
|
|
27
|
+
title: string
|
|
28
|
+
description: string
|
|
29
|
+
localSyncRunMode?: LocalSyncStrategy
|
|
30
|
+
property?: {}
|
|
31
|
+
events: {}
|
|
32
|
+
outlets?: {}
|
|
33
|
+
switches: Array<SwitchDef>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type SubspaceID = string
|
|
37
|
+
export type SubpsaceAction = string
|
|
38
|
+
|
|
39
|
+
export type Action = {
|
|
40
|
+
__actionName: string
|
|
41
|
+
parent: 'Brick' | 'Generator' | 'Subspace' | 'System'
|
|
42
|
+
name: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ActionWithParams = Action & {
|
|
46
|
+
params?: Array<{
|
|
47
|
+
input: string
|
|
48
|
+
value?: any
|
|
49
|
+
mapping?: boolean
|
|
50
|
+
}>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ActionWithDataParams = Action & {
|
|
54
|
+
dataParams?: Array<{
|
|
55
|
+
input: () => Data
|
|
56
|
+
value?: any
|
|
57
|
+
mapping?: boolean
|
|
58
|
+
}>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ItemBrickID = string
|
|
62
|
+
|
|
63
|
+
export type EventAction = {
|
|
64
|
+
handler: 'system' | (() => Brick | Generator) | SubspaceID | ItemBrickID
|
|
65
|
+
action: Action
|
|
66
|
+
waitAsync?: boolean
|
|
67
|
+
// Event Property Definition mapping to params (use path to replace)
|
|
68
|
+
eventPropertyMapping?: object
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type ApplicationFont = {
|
|
72
|
+
name: string
|
|
73
|
+
url: string
|
|
74
|
+
md5: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type ApplicationSettings = {
|
|
78
|
+
internetReachabilityUrl?: string
|
|
79
|
+
enableDataLock?: boolean
|
|
80
|
+
showDeprecatedFeatures?: boolean
|
|
81
|
+
enableUnstableFeatures?: boolean // enable_unstable_bricks
|
|
82
|
+
runtimeCacheOptions?: {
|
|
83
|
+
disabled?: boolean
|
|
84
|
+
behavior?: 'initiative' | 'passive'
|
|
85
|
+
retryAttemptForFailure?: number
|
|
86
|
+
}
|
|
87
|
+
tvOptions?: {
|
|
88
|
+
disabledSelectable?: boolean
|
|
89
|
+
selectableColor?: string
|
|
90
|
+
selectableBorder?: {
|
|
91
|
+
borderStyle?: 'solid' | 'dashed' | 'dotted'
|
|
92
|
+
borderTopColor?: string
|
|
93
|
+
borderLeftColor?: string
|
|
94
|
+
borderRightColor?: string
|
|
95
|
+
borderBottomColor?: string
|
|
96
|
+
// BRICK Grid unit
|
|
97
|
+
borderTopSize?: number
|
|
98
|
+
borderLeftSize?: number
|
|
99
|
+
borderRightSize?: number
|
|
100
|
+
borderBottomSize?: number
|
|
101
|
+
borderTopLeftRadius?: number
|
|
102
|
+
borderTopRightRadius?: number
|
|
103
|
+
borderBottomLeftRadius?: number
|
|
104
|
+
borderBottomRightRadius?: number
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type Application = {
|
|
110
|
+
name: string
|
|
111
|
+
description?: string
|
|
112
|
+
subspaces: Subspace[]
|
|
113
|
+
rootSubspace: Subspace
|
|
114
|
+
fonts?: ApplicationFont[]
|
|
115
|
+
settings?: ApplicationSettings
|
|
116
|
+
}
|