@fugood/bricks-project 2.21.0-beta.14.test0 → 2.21.0-beta.14.test2

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 CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  DataCommand,
20
20
  Brick,
21
21
  Generator,
22
+ Canvas,
22
23
  } from '../types'
23
24
  import { generateCalulationMap } from './util'
24
25
 
@@ -26,7 +27,8 @@ const compileProperty = (property, result = {}) => {
26
27
  if (Array.isArray(property)) {
27
28
  return property.map((p) => compileProperty(p, result))
28
29
  }
29
- if (property?.__typename === 'DataLink' && property.data?.()) return `PROPERTY_BANK#${property.data().id}`
30
+ if (property?.__typename === 'DataLink' && property.data?.())
31
+ return `PROPERTY_BANK#${property.data().id}`
30
32
  if (typeof property === 'function') return property()?.id // defined type instance getter
31
33
  if (typeof property === 'object') {
32
34
  return Object.entries(property).reduce((acc, [key, value]) => {
@@ -167,6 +169,21 @@ const animationTypeMap = {
167
169
  AnimationDecayConfig: 'decay',
168
170
  }
169
171
 
172
+ const compileFrame = (frame: Canvas['items'][number]['frame']) => ({
173
+ x: frame.x,
174
+ y: frame.y,
175
+ width: frame.width,
176
+ height: frame.height,
177
+ standby_mode: frame.standbyMode,
178
+ standby_frame: frame.standbyFrame,
179
+ standby_opacity: frame.standbyOpacity,
180
+ standby_delay: frame.standbyDelay,
181
+ standby_delay_random: frame.standbyDelayRandom,
182
+ standby_easing: frame.standbyEasing,
183
+ showing_delay: frame.showingDelay,
184
+ render_out_of_viewport: frame.renderOutOfViewport,
185
+ })
186
+
170
187
  export const compile = (app: Application) => {
171
188
  const config = {
172
189
  title: app.name,
@@ -212,6 +229,7 @@ export const compile = (app: Application) => {
212
229
  brickIdPrefix: itemBrick.brickIdPrefix,
213
230
  templateKey: itemBrick.templateKey,
214
231
  property: compileProperty(itemBrick.property),
232
+ propertyMapping: itemBrick.propertyMapping,
215
233
  animation: compileAnimations(itemBrick.templateKey, itemBrick.animation || {}),
216
234
  outlet: compileOutlets(itemBrick.templateKey, itemBrick.outlets || {}),
217
235
  eventMap: compileEvents(itemBrick.templateKey, itemBrick.eventMap || {}, {
@@ -291,7 +309,13 @@ export const compile = (app: Application) => {
291
309
  }
292
310
  return acc
293
311
  }, {}),
294
- item_list: [], // TODO
312
+ item_list: canvas.items.map((item) => ({
313
+ type: typeof item.item === 'function' ? 'brick' : 'subspace',
314
+ ...(typeof item.item === 'function'
315
+ ? { brick_id: (item.item as () => Brick)()?.id }
316
+ : { subspace_id: item.item }),
317
+ frame: compileFrame(item.frame),
318
+ })),
295
319
  }
296
320
  return map
297
321
  }, {}),
@@ -396,8 +420,8 @@ export const compile = (app: Application) => {
396
420
  const args = commandNode.inputs.filter(
397
421
  (input) =>
398
422
  typeof input.source !== 'function' ||
399
- input.source()?.__typename !== 'DataCalculationData' &&
400
- input.source()?.__typename !== 'DataCommand',
423
+ (input.source()?.__typename !== 'DataCalculationData' &&
424
+ input.source()?.__typename !== 'DataCommand'),
401
425
  )
402
426
  const inputs = commandNode.inputs.filter(
403
427
  (input) =>
@@ -446,6 +470,7 @@ export const compile = (app: Application) => {
446
470
  )?.body
447
471
 
448
472
  calc.script_config = {
473
+ note: scriptCalc.note,
449
474
  code: escodegen.generate(declarationBody),
450
475
  enable_async: scriptCalc.enableAsync,
451
476
  inputs: scriptCalc.inputs.reduce((acc, input) => {
@@ -465,9 +490,12 @@ export const compile = (app: Application) => {
465
490
  error: scriptCalc.error?.().id,
466
491
  }
467
492
 
468
- Object.assign(calc, generateCalulationMap(calc.script_config, {
469
- snapshotMode: process.env.BRICKS_SNAPSHOT_MODE === '1',
470
- }))
493
+ Object.assign(
494
+ calc,
495
+ generateCalulationMap(calc.script_config, {
496
+ snapshotMode: process.env.BRICKS_SNAPSHOT_MODE === '1',
497
+ }),
498
+ )
471
499
  }
472
500
  map[dataCalc.id] = calc
473
501
  return map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.21.0-beta.14.test0",
3
+ "version": "2.21.0-beta.14.test2",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.js"
@@ -68,6 +68,7 @@ export type DataCalculationMap = DataCalculation & {
68
68
 
69
69
  export type DataCalculationScript = DataCalculation & {
70
70
  __typename: 'DataCalculationScript'
71
+ note?: string
71
72
  enableAsync: boolean
72
73
  code: string
73
74
  inputs: Array<{