@digo-labs/common 0.1.18 → 0.1.19
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/dist/aws/aws-helpers.d.ts +14 -0
- package/dist/aws/consts.d.ts +26 -0
- package/dist/aws/glyphs.d.ts +15 -0
- package/dist/aws/groups.d.ts +314 -0
- package/dist/aws/index.d.ts +5 -0
- package/dist/aws/types.d.ts +53 -0
- package/dist/brick.d.ts +31 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +762 -108
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/glyphs.d.ts +0 -29
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AwsBlockContact, AwsBlockGroupFit, AwsBlockPlacement, AwsBlockPose, AwsGlyphFamily, AwsGlyphStage, AwsPaletteColor, AwsPoseLayout, AwsShapeAnimation } from './types';
|
|
2
|
+
import { Bounds, Position, Size } from '../types/common-types';
|
|
3
|
+
export declare class AwsHelpers {
|
|
4
|
+
static getGlyphPath(family: AwsGlyphFamily, stage: AwsGlyphStage): string;
|
|
5
|
+
static getPaletteColor(hex: string): AwsPaletteColor;
|
|
6
|
+
static getShapeColor(color: AwsPaletteColor): AwsPaletteColor;
|
|
7
|
+
static getStageFrame(animation: AwsShapeAnimation, stage: AwsGlyphStage): number;
|
|
8
|
+
static isCrossed(frame: number, previous: number, current: number): boolean;
|
|
9
|
+
static getBounds(blocks: AwsBlockPlacement[]): Bounds;
|
|
10
|
+
static getLayout(poses: AwsBlockPose[], pose: AwsBlockPose, stage: Size, fit: AwsBlockGroupFit): AwsPoseLayout;
|
|
11
|
+
static getContact(block: AwsBlockPlacement, pose: AwsBlockPose): AwsBlockContact | null;
|
|
12
|
+
static getBlockOrigin(block: AwsBlockPlacement, pose: AwsBlockPose): string;
|
|
13
|
+
static projectContact(contact: AwsBlockContact, from: AwsBlockPose, to: AwsBlockPose): Position | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AwsBlockSize, AwsGlyph, AwsGlyphFamily, AwsGlyphStage } from './types';
|
|
2
|
+
export declare const AWS_PALETTE: {
|
|
3
|
+
white: string;
|
|
4
|
+
black: string;
|
|
5
|
+
orange: string;
|
|
6
|
+
yellow: string;
|
|
7
|
+
yellowLight: string;
|
|
8
|
+
yellowMuted: string;
|
|
9
|
+
pink: string;
|
|
10
|
+
purple: string;
|
|
11
|
+
blue: string;
|
|
12
|
+
green: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const AWS_GLYPH_FAMILIES: Record<AwsGlyphFamily, Record<AwsGlyphStage, AwsGlyph>>;
|
|
15
|
+
export declare const AWS_EASINGS: {
|
|
16
|
+
expo: [number, number, number, number];
|
|
17
|
+
circle: [number, number, number, number];
|
|
18
|
+
};
|
|
19
|
+
export declare const AWS_DURATIONS: {
|
|
20
|
+
enter: number;
|
|
21
|
+
move: number;
|
|
22
|
+
resize: number;
|
|
23
|
+
hold: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const AWS_UNIT = 48;
|
|
26
|
+
export declare const AWS_BLOCK_SIZES: AwsBlockSize[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const AWS_GLYPH_VIEWBOX = "0 0 72 72";
|
|
2
|
+
export declare const AWS_GLYPHS: {
|
|
3
|
+
scaleOne: string;
|
|
4
|
+
scaleTwo: string;
|
|
5
|
+
scaleThree: string;
|
|
6
|
+
connectOne: string;
|
|
7
|
+
connectTwo: string;
|
|
8
|
+
connectThree: string;
|
|
9
|
+
sparkOne: string;
|
|
10
|
+
sparkTwo: string;
|
|
11
|
+
sparkThree: string;
|
|
12
|
+
pivotOne: string;
|
|
13
|
+
pivotTwo: string;
|
|
14
|
+
pivotThree: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
export declare const AWS_BLOCK_GROUPS: {
|
|
2
|
+
stair: {
|
|
3
|
+
blocks: {
|
|
4
|
+
a: {
|
|
5
|
+
color: "black";
|
|
6
|
+
family: "connect";
|
|
7
|
+
};
|
|
8
|
+
b: {
|
|
9
|
+
color: "orange";
|
|
10
|
+
family: "connect";
|
|
11
|
+
};
|
|
12
|
+
c: {
|
|
13
|
+
color: "yellow";
|
|
14
|
+
family: "connect";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
poses: ({
|
|
18
|
+
blocks: ({
|
|
19
|
+
id: string;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
size: 1;
|
|
23
|
+
stage: 1;
|
|
24
|
+
} | {
|
|
25
|
+
id: string;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
size: 2;
|
|
29
|
+
stage: 2;
|
|
30
|
+
})[];
|
|
31
|
+
hold?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
blocks: ({
|
|
34
|
+
id: string;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
size: 1;
|
|
38
|
+
stage: 1;
|
|
39
|
+
} | {
|
|
40
|
+
id: string;
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
size: 2;
|
|
44
|
+
stage: 2;
|
|
45
|
+
} | {
|
|
46
|
+
id: string;
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
size: 4;
|
|
50
|
+
stage: 3;
|
|
51
|
+
})[];
|
|
52
|
+
hold: number;
|
|
53
|
+
})[];
|
|
54
|
+
};
|
|
55
|
+
trade: {
|
|
56
|
+
blocks: {
|
|
57
|
+
a: {
|
|
58
|
+
color: "orange";
|
|
59
|
+
};
|
|
60
|
+
b: {
|
|
61
|
+
color: "blue";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
poses: {
|
|
65
|
+
blocks: ({
|
|
66
|
+
id: string;
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
size: 1;
|
|
70
|
+
} | {
|
|
71
|
+
id: string;
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
size: 2;
|
|
75
|
+
})[];
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
column: {
|
|
79
|
+
fit: "pose";
|
|
80
|
+
blocks: {
|
|
81
|
+
a: {
|
|
82
|
+
color: "orange";
|
|
83
|
+
};
|
|
84
|
+
b: {
|
|
85
|
+
color: "blue";
|
|
86
|
+
};
|
|
87
|
+
c: {
|
|
88
|
+
color: "yellow";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
poses: ({
|
|
92
|
+
blocks: ({
|
|
93
|
+
id: string;
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
size: 4;
|
|
97
|
+
} | {
|
|
98
|
+
id: string;
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
size: 2;
|
|
102
|
+
})[];
|
|
103
|
+
hold?: undefined;
|
|
104
|
+
} | {
|
|
105
|
+
blocks: ({
|
|
106
|
+
id: string;
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
size: 4;
|
|
110
|
+
} | {
|
|
111
|
+
id: string;
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
size: 2;
|
|
115
|
+
} | {
|
|
116
|
+
id: string;
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
size: 1;
|
|
120
|
+
})[];
|
|
121
|
+
hold: number;
|
|
122
|
+
})[];
|
|
123
|
+
};
|
|
124
|
+
satellites: {
|
|
125
|
+
blocks: {
|
|
126
|
+
core: {
|
|
127
|
+
color: "orange";
|
|
128
|
+
};
|
|
129
|
+
light: {
|
|
130
|
+
color: "yellow";
|
|
131
|
+
};
|
|
132
|
+
dark: {
|
|
133
|
+
color: "blue";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
poses: ({
|
|
137
|
+
blocks: ({
|
|
138
|
+
id: string;
|
|
139
|
+
x: number;
|
|
140
|
+
y: number;
|
|
141
|
+
size: 2;
|
|
142
|
+
} | {
|
|
143
|
+
id: string;
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
size: 1;
|
|
147
|
+
})[];
|
|
148
|
+
hold: number;
|
|
149
|
+
} | {
|
|
150
|
+
blocks: ({
|
|
151
|
+
id: string;
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
size: 2;
|
|
155
|
+
} | {
|
|
156
|
+
id: string;
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
size: 1;
|
|
160
|
+
})[];
|
|
161
|
+
hold?: undefined;
|
|
162
|
+
})[];
|
|
163
|
+
};
|
|
164
|
+
swap: {
|
|
165
|
+
blocks: {
|
|
166
|
+
core: {
|
|
167
|
+
color: "orange";
|
|
168
|
+
};
|
|
169
|
+
medium: {
|
|
170
|
+
color: "blue";
|
|
171
|
+
};
|
|
172
|
+
light: {
|
|
173
|
+
color: "yellow";
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
poses: {
|
|
177
|
+
blocks: ({
|
|
178
|
+
id: string;
|
|
179
|
+
x: number;
|
|
180
|
+
y: number;
|
|
181
|
+
size: 4;
|
|
182
|
+
} | {
|
|
183
|
+
id: string;
|
|
184
|
+
x: number;
|
|
185
|
+
y: number;
|
|
186
|
+
size: 2;
|
|
187
|
+
} | {
|
|
188
|
+
id: string;
|
|
189
|
+
x: number;
|
|
190
|
+
y: number;
|
|
191
|
+
size: 1;
|
|
192
|
+
})[];
|
|
193
|
+
}[];
|
|
194
|
+
};
|
|
195
|
+
orbit: {
|
|
196
|
+
blocks: {
|
|
197
|
+
a: {
|
|
198
|
+
color: "orange";
|
|
199
|
+
};
|
|
200
|
+
b: {
|
|
201
|
+
color: "blue";
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
poses: {
|
|
205
|
+
blocks: {
|
|
206
|
+
id: string;
|
|
207
|
+
x: number;
|
|
208
|
+
y: number;
|
|
209
|
+
size: 1;
|
|
210
|
+
}[];
|
|
211
|
+
hold: number;
|
|
212
|
+
}[];
|
|
213
|
+
};
|
|
214
|
+
cluster: {
|
|
215
|
+
blocks: {
|
|
216
|
+
orange: {
|
|
217
|
+
color: "orange";
|
|
218
|
+
family: "pivot";
|
|
219
|
+
};
|
|
220
|
+
blue: {
|
|
221
|
+
color: "blue";
|
|
222
|
+
family: "spark";
|
|
223
|
+
};
|
|
224
|
+
pink: {
|
|
225
|
+
color: "pink";
|
|
226
|
+
family: "connect";
|
|
227
|
+
};
|
|
228
|
+
yellow: {
|
|
229
|
+
color: "yellowLight";
|
|
230
|
+
family: "scale";
|
|
231
|
+
};
|
|
232
|
+
olive: {
|
|
233
|
+
color: "yellowMuted";
|
|
234
|
+
family: "spark";
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
poses: ({
|
|
238
|
+
blocks: {
|
|
239
|
+
id: string;
|
|
240
|
+
x: number;
|
|
241
|
+
y: number;
|
|
242
|
+
size: 2;
|
|
243
|
+
stage: 1;
|
|
244
|
+
}[];
|
|
245
|
+
hold: number;
|
|
246
|
+
} | {
|
|
247
|
+
blocks: ({
|
|
248
|
+
id: string;
|
|
249
|
+
x: number;
|
|
250
|
+
y: number;
|
|
251
|
+
size: 2;
|
|
252
|
+
stage: 1;
|
|
253
|
+
} | {
|
|
254
|
+
id: string;
|
|
255
|
+
x: number;
|
|
256
|
+
y: number;
|
|
257
|
+
size: 1;
|
|
258
|
+
stage: 1;
|
|
259
|
+
})[];
|
|
260
|
+
hold?: undefined;
|
|
261
|
+
} | {
|
|
262
|
+
blocks: ({
|
|
263
|
+
id: string;
|
|
264
|
+
x: number;
|
|
265
|
+
y: number;
|
|
266
|
+
size: 2;
|
|
267
|
+
stage: 2;
|
|
268
|
+
} | {
|
|
269
|
+
id: string;
|
|
270
|
+
x: number;
|
|
271
|
+
y: number;
|
|
272
|
+
size: 1;
|
|
273
|
+
stage: 1;
|
|
274
|
+
})[];
|
|
275
|
+
hold: number;
|
|
276
|
+
} | {
|
|
277
|
+
blocks: ({
|
|
278
|
+
id: string;
|
|
279
|
+
x: number;
|
|
280
|
+
y: number;
|
|
281
|
+
size: 2;
|
|
282
|
+
stage: 2;
|
|
283
|
+
} | {
|
|
284
|
+
id: string;
|
|
285
|
+
x: number;
|
|
286
|
+
y: number;
|
|
287
|
+
size: 1;
|
|
288
|
+
stage: 2;
|
|
289
|
+
})[];
|
|
290
|
+
hold?: undefined;
|
|
291
|
+
} | {
|
|
292
|
+
blocks: ({
|
|
293
|
+
id: string;
|
|
294
|
+
x: number;
|
|
295
|
+
y: number;
|
|
296
|
+
size: 2;
|
|
297
|
+
stage: 3;
|
|
298
|
+
} | {
|
|
299
|
+
id: string;
|
|
300
|
+
x: number;
|
|
301
|
+
y: number;
|
|
302
|
+
size: 1;
|
|
303
|
+
stage: 3;
|
|
304
|
+
} | {
|
|
305
|
+
id: string;
|
|
306
|
+
x: number;
|
|
307
|
+
y: number;
|
|
308
|
+
size: 1;
|
|
309
|
+
stage: 2;
|
|
310
|
+
})[];
|
|
311
|
+
hold: number;
|
|
312
|
+
})[];
|
|
313
|
+
};
|
|
314
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AWS_DURATIONS, AWS_EASINGS, AWS_PALETTE } from './consts';
|
|
2
|
+
import { AWS_GLYPHS } from './glyphs';
|
|
3
|
+
import { AWS_BLOCK_GROUPS } from './groups';
|
|
4
|
+
import { Position } from '../types/common-types';
|
|
5
|
+
export type AwsGlyphFamily = 'scale' | 'connect' | 'spark' | 'pivot';
|
|
6
|
+
export type AwsGlyphStage = 1 | 2 | 3;
|
|
7
|
+
export type AwsGlyph = keyof typeof AWS_GLYPHS;
|
|
8
|
+
export type AwsPaletteColor = keyof typeof AWS_PALETTE;
|
|
9
|
+
export type AwsEasing = keyof typeof AWS_EASINGS;
|
|
10
|
+
export type AwsDuration = keyof typeof AWS_DURATIONS;
|
|
11
|
+
export type AwsBlockSize = 0.25 | 0.5 | 1 | 2 | 4;
|
|
12
|
+
export interface AwsShapeMarker {
|
|
13
|
+
payload: {
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
time: number;
|
|
17
|
+
}
|
|
18
|
+
export interface AwsShapeAnimation {
|
|
19
|
+
markers?: AwsShapeMarker[];
|
|
20
|
+
totalFrames: number;
|
|
21
|
+
}
|
|
22
|
+
export interface AwsBlockIdentity {
|
|
23
|
+
color: AwsPaletteColor;
|
|
24
|
+
family?: AwsGlyphFamily;
|
|
25
|
+
}
|
|
26
|
+
export interface AwsBlockPlacement {
|
|
27
|
+
id: string;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
size: AwsBlockSize;
|
|
31
|
+
stage?: AwsGlyphStage;
|
|
32
|
+
}
|
|
33
|
+
export interface AwsBlockPose {
|
|
34
|
+
blocks: AwsBlockPlacement[];
|
|
35
|
+
hold?: number;
|
|
36
|
+
}
|
|
37
|
+
export type AwsBlockGroupFit = 'all' | 'pose' | false;
|
|
38
|
+
export interface AwsBlockGroupData {
|
|
39
|
+
blocks: Record<string, AwsBlockIdentity>;
|
|
40
|
+
poses: AwsBlockPose[];
|
|
41
|
+
fit?: AwsBlockGroupFit;
|
|
42
|
+
}
|
|
43
|
+
export interface AwsBlockContact {
|
|
44
|
+
id: string;
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}
|
|
48
|
+
export interface AwsPoseLayout {
|
|
49
|
+
unit: number;
|
|
50
|
+
offset: Position;
|
|
51
|
+
}
|
|
52
|
+
export type AwsBlockGroupBehavior = 'build' | 'iterate';
|
|
53
|
+
export type AwsBlockGroupName = keyof typeof AWS_BLOCK_GROUPS;
|
package/dist/brick.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const BRICK_GLYPH_VIEWBOX = "0 0 72 72";
|
|
2
|
+
export declare const BRICK_GLYPHS: {
|
|
3
|
+
scaleOne: string;
|
|
4
|
+
scaleTwo: string;
|
|
5
|
+
scaleThree: string;
|
|
6
|
+
connectOne: string;
|
|
7
|
+
connectTwo: string;
|
|
8
|
+
connectThree: string;
|
|
9
|
+
sparkOne: string;
|
|
10
|
+
sparkTwo: string;
|
|
11
|
+
sparkThree: string;
|
|
12
|
+
pivotOne: string;
|
|
13
|
+
pivotTwo: string;
|
|
14
|
+
pivotThree: string;
|
|
15
|
+
};
|
|
16
|
+
export type BrickGlyph = keyof typeof BRICK_GLYPHS;
|
|
17
|
+
export declare const BRICK_ARROW_PATH = "M273.5,143.7c-32.9,24.3-80.7,37.2-121.8,37.2c-57.6,0-109.5-21.3-148.7-56.7c-3.1-2.8-0.3-6.6,3.4-4.4c42.4,24.6,94.7,39.5,148.8,39.5c36.5,0,76.6-7.6,113.5-23.2C274.2,133.6,278.9,139.7,273.5,143.7z M287.2,128.1c-4.2-5.4-27.8-2.6-38.5-1.3c-3.2,0.4-3.7-2.4-0.8-4.5c18.8-13.2,49.7-9.4,53.3-5c3.6,4.5-1,35.4-18.6,50.2c-2.7,2.3-5.3,1.1-4.1-1.9C282.5,155.7,291.4,133.4,287.2,128.1z";
|
|
18
|
+
export declare const BRICK_COLORS: {
|
|
19
|
+
white: string;
|
|
20
|
+
black: string;
|
|
21
|
+
orange: string;
|
|
22
|
+
yellow: string;
|
|
23
|
+
pink: string;
|
|
24
|
+
purple: string;
|
|
25
|
+
blue: string;
|
|
26
|
+
green: string;
|
|
27
|
+
};
|
|
28
|
+
export type BrickColor = keyof typeof BRICK_COLORS;
|
|
29
|
+
export declare class BrickHelpers {
|
|
30
|
+
static getColor(hex: string): BrickColor;
|
|
31
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from './app-config-helpers';
|
|
2
|
+
export * from './aws';
|
|
3
|
+
export * from './brick';
|
|
2
4
|
export * from './common-helpers';
|
|
3
5
|
export * from './constants';
|
|
4
6
|
export * from './icons';
|
|
5
7
|
export * from './fonts';
|
|
6
|
-
export * from './glyphs';
|
|
7
8
|
export * from './images';
|
|
8
9
|
export * from './models';
|
|
9
10
|
export * from './local-storage';
|