@lowdefy/client 4.7.3 → 5.1.0

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/Client.js CHANGED
@@ -44,6 +44,7 @@ const Client = ({ auth, Components, config: rawConfig, jsMap, lowdefy, resetCont
44
44
  id: "lowdefy-display-message",
45
45
  key: `${config.pageConfig.id}-display-message`,
46
46
  Component: lowdefy._internal.blockComponents.Message,
47
+ components: lowdefy._internal.components,
47
48
  methods: {
48
49
  registerMethod: (_, method)=>{
49
50
  lowdefy._internal.displayMessage = method;
@@ -59,10 +60,10 @@ const Client = ({ auth, Components, config: rawConfig, jsMap, lowdefy, resetCont
59
60
  if (!context._internal.onInitDone) return '';
60
61
  return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Head, {
61
62
  Component: Components.Head,
62
- properties: context._internal.RootAreas.map[config.pageConfig.blockId].eval.properties
63
+ properties: context._internal.RootSlots.map[config.pageConfig.blockId].eval.properties
63
64
  }), /*#__PURE__*/ React.createElement(Block, {
64
- block: context._internal.RootAreas.map[config.pageConfig.blockId],
65
- Blocks: context._internal.RootAreas,
65
+ block: context._internal.RootSlots.map[config.pageConfig.blockId],
66
+ Blocks: context._internal.RootSlots,
66
67
  context: context,
67
68
  lowdefy: lowdefy,
68
69
  parentLoading: false
package/dist/Context.js CHANGED
@@ -12,9 +12,20 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useEffect } from 'react';
16
16
  import getContext from '@lowdefy/engine';
17
+ import createShortcutManager from './createShortcutManager.js';
17
18
  import MountEvents from './MountEvents.js';
19
+ const ShortcutEffect = ({ context })=>{
20
+ useEffect(()=>{
21
+ const manager = createShortcutManager();
22
+ manager.init(context);
23
+ return ()=>manager.destroy();
24
+ }, [
25
+ context
26
+ ]);
27
+ return null;
28
+ };
18
29
  const Context = ({ children, config, jsMap, lowdefy, resetContext })=>{
19
30
  const context = getContext({
20
31
  config,
@@ -40,7 +51,9 @@ const Context = ({ children, config, jsMap, lowdefy, resetContext })=>{
40
51
  }
41
52
  }, (loadingOnInit)=>{
42
53
  if (loadingOnInit) return '';
43
- return children(context);
54
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ShortcutEffect, {
55
+ context: context
56
+ }), children(context));
44
57
  });
45
58
  };
46
59
  export default Context;
@@ -13,13 +13,12 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
- import { makeCssClass } from '@lowdefy/block-utils';
17
- const DisplayMessage = ({ Component, id, methods })=>{
16
+ const DisplayMessage = ({ Component, components, id, methods })=>{
18
17
  return /*#__PURE__*/ React.createElement(Component, {
19
18
  blockId: id,
19
+ components: components,
20
20
  key: id,
21
21
  methods: {
22
- makeCssClass,
23
22
  registerMethod: methods.registerMethod,
24
23
  triggerEvent: ()=>undefined
25
24
  },
@@ -13,7 +13,6 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import React, { useReducer, useEffect } from 'react';
16
- import { makeCssClass } from '@lowdefy/block-utils';
17
16
  const initialState = {
18
17
  progress: 0,
19
18
  onMounts: 0
@@ -72,9 +71,7 @@ const ProgressBarController = ({ id, lowdefy, resetContext })=>{
72
71
  blockId: id,
73
72
  components: lowdefy._internal.components,
74
73
  menus: lowdefy.menus,
75
- methods: {
76
- makeCssClass
77
- },
74
+ methods: {},
78
75
  pageId: lowdefy.pageId,
79
76
  properties: state
80
77
  });
@@ -14,12 +14,12 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
18
17
  import { type } from '@lowdefy/helpers';
19
18
  import InputContainer from './InputContainer.js';
20
19
  import Container from './Container.js';
21
20
  import List from './List.js';
22
21
  import LoadingBlock from './LoadingBlock.js';
22
+ import resolveClassNames from './resolveClassNames.js';
23
23
  const CategorySwitch = ({ block, Blocks, context, loading, lowdefy })=>{
24
24
  if (!block.eval) return null; // TODO: check Renderer updates before eval is executed for the first time on lists. See #520
25
25
  if (block.eval.visible === false) return /*#__PURE__*/ React.createElement("div", {
@@ -29,17 +29,20 @@ const CategorySwitch = ({ block, Blocks, context, loading, lowdefy })=>{
29
29
  }
30
30
  });
31
31
  const Component = lowdefy._internal.blockComponents[block.type];
32
+ const classNames = resolveClassNames(block.eval.class);
32
33
  if (loading && type.isObject(block.eval.skeleton)) {
33
34
  return /*#__PURE__*/ React.createElement(LoadingBlock, {
34
35
  blockLayout: block.eval.layout,
35
36
  blockProperties: block.eval.properties,
36
- blockStyle: block.eval.style,
37
+ blockStyle: block.eval.style?.block,
38
+ blockClass: classNames,
37
39
  context: context,
38
40
  lowdefy: lowdefy,
39
41
  skeleton: block.eval.skeleton
40
42
  });
41
43
  }
42
- switch(Component.meta.category){
44
+ const category = lowdefy._internal.blockMetas[block.type]?.category;
45
+ switch(category){
43
46
  case 'list':
44
47
  return /*#__PURE__*/ React.createElement(List, {
45
48
  block: block,
@@ -61,12 +64,11 @@ const CategorySwitch = ({ block, Blocks, context, loading, lowdefy })=>{
61
64
  case 'input':
62
65
  return /*#__PURE__*/ React.createElement(BlockLayout, {
63
66
  id: `bl-${block.blockId}`,
64
- blockStyle: block.eval.style,
65
- layout: block.eval.layout,
66
- makeCssClass: makeCssClass
67
+ style: block.eval.style?.block,
68
+ className: classNames.block,
69
+ layout: block.eval.layout
67
70
  }, /*#__PURE__*/ React.createElement(Component, {
68
71
  methods: Object.assign(block.methods, {
69
- makeCssClass,
70
72
  registerEvent: block.registerEvent,
71
73
  registerMethod: block.registerMethod,
72
74
  setValue: block.setValue,
@@ -74,14 +76,16 @@ const CategorySwitch = ({ block, Blocks, context, loading, lowdefy })=>{
74
76
  }),
75
77
  basePath: lowdefy.basePath,
76
78
  blockId: block.blockId,
79
+ classNames: classNames,
77
80
  components: lowdefy._internal.components,
78
- events: block.eval.events,
81
+ events: block.eval.events ?? {},
79
82
  key: block.blockId,
80
83
  loading: loading,
81
84
  menus: lowdefy.menus,
82
85
  pageId: lowdefy.pageId,
83
86
  properties: block.eval.properties,
84
87
  required: block.eval.required,
88
+ styles: block.eval.style ?? {},
85
89
  validation: block.eval.validation,
86
90
  value: block.value
87
91
  }));
@@ -97,26 +101,27 @@ const CategorySwitch = ({ block, Blocks, context, loading, lowdefy })=>{
97
101
  default:
98
102
  return /*#__PURE__*/ React.createElement(BlockLayout, {
99
103
  id: `bl-${block.blockId}`,
100
- blockStyle: block.eval.style,
101
- layout: block.eval.layout,
102
- makeCssClass: makeCssClass
104
+ style: block.eval.style?.block,
105
+ className: classNames.block,
106
+ layout: block.eval.layout
103
107
  }, /*#__PURE__*/ React.createElement(Component, {
104
108
  methods: Object.assign(block.methods, {
105
- makeCssClass,
106
109
  registerEvent: block.registerEvent,
107
110
  registerMethod: block.registerMethod,
108
111
  triggerEvent: block.triggerEvent
109
112
  }),
110
113
  basePath: lowdefy.basePath,
111
114
  blockId: block.blockId,
115
+ classNames: classNames,
112
116
  components: lowdefy._internal.components,
113
- events: block.eval.events,
117
+ events: block.eval.events ?? {},
114
118
  key: block.blockId,
115
119
  loading: loading,
116
120
  menus: lowdefy.menus,
117
121
  pageId: lowdefy.pageId,
118
122
  properties: block.eval.properties,
119
123
  required: block.eval.required,
124
+ styles: block.eval.style ?? {},
120
125
  validation: block.eval.validation
121
126
  }));
122
127
  }
@@ -14,27 +14,29 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { Area, BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
17
+ import { cn } from '@lowdefy/block-utils';
18
18
  import Block from './Block.js';
19
+ import resolveClassNames from './resolveClassNames.js';
19
20
  const Container = ({ block, Blocks, Component, context, loading, lowdefy })=>{
21
+ const classNames = resolveClassNames(block.eval.class);
20
22
  const content = {};
21
23
  // eslint-disable-next-line prefer-destructuring
22
- const areas = Blocks.subAreas[block.id][0].areas;
23
- Object.keys(areas).forEach((areaKey, i)=>{
24
- content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
25
- area: block.eval.areas[areaKey],
26
- areaKey: areaKey,
27
- areaStyle: [
28
- areaStyle,
29
- block.eval.areas[areaKey]?.style
30
- ],
31
- id: `ar-${block.blockId}-${areaKey}`,
32
- key: `ar-${block.blockId}-${areaKey}-${i}`,
33
- layout: block.eval.layout,
34
- makeCssClass: makeCssClass
35
- }, areas[areaKey].blocks.map((bl, k)=>/*#__PURE__*/ React.createElement(Block, {
24
+ const slots = Blocks.subSlots[block.id][0].slots;
25
+ Object.keys(slots).forEach((slotKey, i)=>{
26
+ content[slotKey] = (contentStyle)=>/*#__PURE__*/ React.createElement(Area, {
27
+ area: block.eval.slots[slotKey],
28
+ areaKey: slotKey,
29
+ style: {
30
+ ...block.eval.slots[slotKey]?.style,
31
+ ...contentStyle
32
+ },
33
+ className: cn(block.eval.class?.[slotKey]),
34
+ id: `ar-${block.blockId}-${slotKey}`,
35
+ key: `ar-${block.blockId}-${slotKey}-${i}`,
36
+ layout: block.eval.layout
37
+ }, slots[slotKey].blocks.map((bl, k)=>/*#__PURE__*/ React.createElement(Block, {
36
38
  block: bl,
37
- Blocks: Blocks.subAreas[block.id][0],
39
+ Blocks: Blocks.subSlots[block.id][0],
38
40
  context: context,
39
41
  key: `co-${bl.blockId}-${k}`,
40
42
  lowdefy: lowdefy,
@@ -42,28 +44,29 @@ const Container = ({ block, Blocks, Component, context, loading, lowdefy })=>{
42
44
  })));
43
45
  });
44
46
  return /*#__PURE__*/ React.createElement(BlockLayout, {
45
- blockStyle: block.eval.style,
47
+ style: block.eval.style?.block,
48
+ className: classNames.block,
46
49
  id: `bl-${block.blockId}`,
47
- layout: block.eval.layout,
48
- makeCssClass: makeCssClass
50
+ layout: block.eval.layout
49
51
  }, /*#__PURE__*/ React.createElement(Component, {
50
52
  methods: Object.assign(block.methods, {
51
- makeCssClass,
52
53
  registerEvent: block.registerEvent,
53
54
  registerMethod: block.registerMethod,
54
55
  triggerEvent: block.triggerEvent
55
56
  }),
56
57
  basePath: lowdefy.basePath,
57
58
  blockId: block.blockId,
59
+ classNames: classNames,
58
60
  components: lowdefy._internal.components,
59
61
  content: content,
60
- events: block.eval.events,
62
+ events: block.eval.events ?? {},
61
63
  key: block.blockId,
62
64
  loading: loading,
63
65
  menus: lowdefy.menus,
64
66
  pageId: lowdefy.pageId,
65
67
  properties: block.eval.properties,
66
68
  required: block.eval.required,
69
+ styles: block.eval.style ?? {},
67
70
  validation: block.eval.validation
68
71
  }));
69
72
  };
@@ -14,27 +14,29 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { Area, BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
17
+ import { cn } from '@lowdefy/block-utils';
18
18
  import Block from './Block.js';
19
+ import resolveClassNames from './resolveClassNames.js';
19
20
  const InputContainer = ({ block, Blocks, Component, context, loading, lowdefy })=>{
21
+ const classNames = resolveClassNames(block.eval.class);
20
22
  const content = {};
21
23
  // eslint-disable-next-line prefer-destructuring
22
- const areas = Blocks.subAreas[block.id][0].areas;
23
- Object.keys(areas).forEach((areaKey, i)=>{
24
- content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
25
- area: block.eval.areas[areaKey],
26
- areaKey: areaKey,
27
- areaStyle: [
28
- areaStyle,
29
- block.eval.areas[areaKey]?.style
30
- ],
31
- id: `ar-${block.blockId}-${areaKey}`,
32
- key: `ar-${block.blockId}-${areaKey}-${i}`,
33
- layout: block.eval.layout,
34
- makeCssClass: makeCssClass
35
- }, areas[areaKey].blocks.map((bl, k)=>/*#__PURE__*/ React.createElement(Block, {
24
+ const slots = Blocks.subSlots[block.id][0].slots;
25
+ Object.keys(slots).forEach((slotKey, i)=>{
26
+ content[slotKey] = (contentStyle)=>/*#__PURE__*/ React.createElement(Area, {
27
+ area: block.eval.slots[slotKey],
28
+ areaKey: slotKey,
29
+ style: {
30
+ ...block.eval.slots[slotKey]?.style,
31
+ ...contentStyle
32
+ },
33
+ className: cn(block.eval.class?.[slotKey]),
34
+ id: `ar-${block.blockId}-${slotKey}`,
35
+ key: `ar-${block.blockId}-${slotKey}-${i}`,
36
+ layout: block.eval.layout
37
+ }, slots[slotKey].blocks.map((bl, k)=>/*#__PURE__*/ React.createElement(Block, {
36
38
  block: bl,
37
- Blocks: Blocks.subAreas[block.id][0],
39
+ Blocks: Blocks.subSlots[block.id][0],
38
40
  context: context,
39
41
  key: `co-${bl.blockId}-${k}`,
40
42
  lowdefy: lowdefy,
@@ -42,13 +44,12 @@ const InputContainer = ({ block, Blocks, Component, context, loading, lowdefy })
42
44
  })));
43
45
  });
44
46
  return /*#__PURE__*/ React.createElement(BlockLayout, {
45
- blockStyle: block.eval.style,
47
+ style: block.eval.style?.block,
48
+ className: classNames.block,
46
49
  id: `bl-${block.blockId}`,
47
- layout: block.eval.layout,
48
- makeCssClass: makeCssClass
50
+ layout: block.eval.layout
49
51
  }, /*#__PURE__*/ React.createElement(Component, {
50
52
  methods: Object.assign(block.methods, {
51
- makeCssClass,
52
53
  registerEvent: block.registerEvent,
53
54
  registerMethod: block.registerMethod,
54
55
  triggerEvent: block.triggerEvent,
@@ -61,15 +62,17 @@ const InputContainer = ({ block, Blocks, Component, context, loading, lowdefy })
61
62
  }),
62
63
  basePath: lowdefy.basePath,
63
64
  blockId: block.blockId,
65
+ classNames: classNames,
64
66
  components: lowdefy._internal.components,
65
67
  content: content,
66
- events: block.eval.events,
68
+ events: block.eval.events ?? {},
67
69
  key: block.blockId,
68
70
  loading: loading,
69
71
  menus: lowdefy.menus,
70
72
  pageId: lowdefy.pageId,
71
73
  properties: block.eval.properties,
72
74
  required: block.eval.required,
75
+ styles: block.eval.style ?? {},
73
76
  validation: block.eval.validation,
74
77
  value: block.value
75
78
  }));
@@ -14,25 +14,27 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { Area, BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
17
+ import { cn } from '@lowdefy/block-utils';
18
18
  import Block from './Block.js';
19
+ import resolveClassNames from './resolveClassNames.js';
19
20
  const List = ({ block, Blocks, Component, context, loading, lowdefy })=>{
21
+ const classNames = resolveClassNames(block.eval.class);
20
22
  const content = {};
21
23
  const contentList = [];
22
- Blocks.subAreas[block.id].forEach((SBlock)=>{
23
- Object.keys(SBlock.areas).forEach((areaKey)=>{
24
- content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
25
- area: block.eval.areas[areaKey],
26
- areaKey: areaKey,
27
- areaStyle: [
28
- areaStyle,
29
- block.eval.areas[areaKey]?.style
30
- ],
31
- id: `ar-${block.blockId}-${SBlock.id}-${areaKey}`,
32
- key: `ar-${block.blockId}-${SBlock.id}-${areaKey}`,
33
- layout: block.eval.layout,
34
- makeCssClass: makeCssClass
35
- }, SBlock.areas[areaKey].blocks.map((bl)=>/*#__PURE__*/ React.createElement(Block, {
24
+ Blocks.subSlots[block.id].forEach((SBlock)=>{
25
+ Object.keys(SBlock.slots).forEach((slotKey)=>{
26
+ content[slotKey] = (contentStyle)=>/*#__PURE__*/ React.createElement(Area, {
27
+ area: block.eval.slots[slotKey],
28
+ areaKey: slotKey,
29
+ style: {
30
+ ...block.eval.slots[slotKey]?.style,
31
+ ...contentStyle
32
+ },
33
+ className: cn(block.eval.class?.[slotKey]),
34
+ id: `ar-${block.blockId}-${SBlock.id}-${slotKey}`,
35
+ key: `ar-${block.blockId}-${SBlock.id}-${slotKey}`,
36
+ layout: block.eval.layout
37
+ }, SBlock.slots[slotKey].blocks.map((bl)=>/*#__PURE__*/ React.createElement(Block, {
36
38
  block: bl,
37
39
  Blocks: SBlock,
38
40
  context: context,
@@ -46,13 +48,12 @@ const List = ({ block, Blocks, Component, context, loading, lowdefy })=>{
46
48
  });
47
49
  });
48
50
  return /*#__PURE__*/ React.createElement(BlockLayout, {
49
- blockStyle: block.eval.style,
51
+ style: block.eval.style?.block,
52
+ className: classNames.block,
50
53
  id: `bl-${block.blockId}`,
51
- layout: block.eval.layout,
52
- makeCssClass: makeCssClass
54
+ layout: block.eval.layout
53
55
  }, /*#__PURE__*/ React.createElement(Component, {
54
56
  methods: Object.assign(block.methods, {
55
- makeCssClass,
56
57
  moveItemDown: block.moveItemDown,
57
58
  moveItemUp: block.moveItemUp,
58
59
  pushItem: block.pushItem,
@@ -64,8 +65,9 @@ const List = ({ block, Blocks, Component, context, loading, lowdefy })=>{
64
65
  }),
65
66
  basePath: lowdefy.basePath,
66
67
  blockId: block.blockId,
68
+ classNames: classNames,
67
69
  components: lowdefy._internal.components,
68
- events: block.eval.events,
70
+ events: block.eval.events ?? {},
69
71
  key: block.blockId,
70
72
  list: contentList,
71
73
  loading: loading,
@@ -73,6 +75,7 @@ const List = ({ block, Blocks, Component, context, loading, lowdefy })=>{
73
75
  pageId: lowdefy.pageId,
74
76
  properties: block.eval.properties,
75
77
  required: block.eval.required,
78
+ styles: block.eval.style ?? {},
76
79
  validation: block.eval.validation
77
80
  }));
78
81
  };
@@ -14,11 +14,9 @@
14
14
  limitations under the License.
15
15
  */ import React, { useEffect } from 'react';
16
16
  import { BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
18
17
  import LoadingContainer from './LoadingContainer.js';
19
18
  import LoadingList from './LoadingList.js';
20
19
  const blockMethods = {
21
- makeCssClass,
22
20
  moveItemDown: ()=>{},
23
21
  moveItemUp: ()=>{},
24
22
  pushItem: ()=>{},
@@ -29,7 +27,7 @@ const blockMethods = {
29
27
  triggerEvent: ()=>{},
30
28
  unshiftItem: ()=>{}
31
29
  };
32
- const LoadingBlock = ({ blockId, blockLayout, blockProperties, blockStyle, context, lowdefy, skeleton })=>{
30
+ const LoadingBlock = ({ blockClass, blockId, blockLayout, blockProperties, blockStyle, context, lowdefy, skeleton })=>{
33
31
  let Component = lowdefy._internal.blockComponents[skeleton.type];
34
32
  useEffect(()=>{
35
33
  if (!lowdefy._internal.blockComponents[skeleton.type]) {
@@ -41,7 +39,9 @@ const LoadingBlock = ({ blockId, blockLayout, blockProperties, blockStyle, conte
41
39
  // default to box when a skeleton block is not found - should be a basic or loader block.
42
40
  Component = lowdefy._internal.blockComponents.Box;
43
41
  }
44
- switch(Component.meta.category){
42
+ const resolvedType = Component === lowdefy._internal.blockComponents.Box ? 'Box' : skeleton.type;
43
+ const category = lowdefy._internal.blockMetas[resolvedType]?.category;
44
+ switch(category){
45
45
  case 'list':
46
46
  return /*#__PURE__*/ React.createElement(LoadingList, {
47
47
  blockId: blockId,
@@ -52,6 +52,7 @@ const LoadingBlock = ({ blockId, blockLayout, blockProperties, blockStyle, conte
52
52
  });
53
53
  case 'container':
54
54
  return /*#__PURE__*/ React.createElement(LoadingContainer, {
55
+ blockClass: blockClass,
55
56
  blockId: blockId,
56
57
  blockLayout: blockLayout,
57
58
  blockProperties: blockProperties,
@@ -63,10 +64,10 @@ const LoadingBlock = ({ blockId, blockLayout, blockProperties, blockStyle, conte
63
64
  });
64
65
  default:
65
66
  return /*#__PURE__*/ React.createElement(BlockLayout, {
66
- blockStyle: skeleton.style ?? blockStyle,
67
+ style: skeleton.style ?? blockStyle,
67
68
  id: `s-bl-${blockId}-${skeleton.id}`,
68
69
  layout: skeleton.layout ?? blockLayout,
69
- makeCssClass: makeCssClass
70
+ className: skeleton.class ?? blockClass
70
71
  }, /*#__PURE__*/ React.createElement(Component, {
71
72
  basePath: lowdefy.basePath,
72
73
  blockId: blockId,
@@ -14,24 +14,19 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { Area, BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
18
17
  import LoadingBlock from './LoadingBlock.js';
19
- const LoadingContainer = ({ blockId, blockLayout, blockProperties, blockStyle, Component, context, lowdefy, skeleton })=>{
18
+ const LoadingContainer = ({ blockClass, blockId, blockLayout, blockProperties, blockStyle, Component, context, lowdefy, skeleton })=>{
20
19
  const content = {};
21
20
  // eslint-disable-next-line prefer-destructuring
22
- Object.keys(skeleton.areas).forEach((areaKey, i)=>{
23
- content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
24
- area: skeleton.areas[areaKey],
25
- areaKey: areaKey,
26
- areaStyle: [
27
- areaStyle,
28
- skeleton.areas[areaKey]?.style
29
- ],
30
- id: `s-ar-${blockId}-${skeleton.id}-${areaKey}`,
31
- key: `s-ar-${blockId}-${skeleton.id}-${areaKey}-${i}`,
32
- layout: skeleton.layout ?? blockLayout,
33
- makeCssClass: makeCssClass
34
- }, skeleton.areas[areaKey].blocks.map((skl, k)=>/*#__PURE__*/ React.createElement(LoadingBlock, {
21
+ Object.keys(skeleton.slots).forEach((slotKey, i)=>{
22
+ content[slotKey] = ()=>/*#__PURE__*/ React.createElement(Area, {
23
+ area: skeleton.slots[slotKey],
24
+ areaKey: slotKey,
25
+ style: skeleton.slots[slotKey]?.style,
26
+ id: `s-ar-${blockId}-${skeleton.id}-${slotKey}`,
27
+ key: `s-ar-${blockId}-${skeleton.id}-${slotKey}-${i}`,
28
+ layout: skeleton.layout ?? blockLayout
29
+ }, skeleton.slots[slotKey].blocks.map((skl, k)=>/*#__PURE__*/ React.createElement(LoadingBlock, {
35
30
  blockId: blockId,
36
31
  context: context,
37
32
  key: `s-co-${skl.id}-${k}`,
@@ -40,10 +35,10 @@ const LoadingContainer = ({ blockId, blockLayout, blockProperties, blockStyle, C
40
35
  })));
41
36
  });
42
37
  return /*#__PURE__*/ React.createElement(BlockLayout, {
43
- blockStyle: skeleton.style ?? blockStyle,
38
+ style: skeleton.style ?? blockStyle,
44
39
  id: `s-bl-${blockId}-${skeleton.id}`,
45
40
  layout: skeleton.layout ?? blockLayout,
46
- makeCssClass: makeCssClass
41
+ className: skeleton.class ?? blockClass
47
42
  }, /*#__PURE__*/ React.createElement(Component, {
48
43
  basePath: lowdefy.basePath,
49
44
  blockId: blockId,
@@ -51,9 +46,7 @@ const LoadingContainer = ({ blockId, blockLayout, blockProperties, blockStyle, C
51
46
  content: content,
52
47
  key: skeleton.id,
53
48
  menus: lowdefy.menus,
54
- methods: {
55
- makeCssClass
56
- },
49
+ methods: {},
57
50
  pageId: lowdefy.pageId,
58
51
  properties: skeleton.properties ?? blockProperties
59
52
  }));
@@ -14,25 +14,20 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { Area, BlockLayout } from '@lowdefy/layout';
17
- import { makeCssClass } from '@lowdefy/block-utils';
18
17
  import LoadingBlock from './LoadingBlock.js';
19
- const LoadingList = ({ blockId, blockLayout, blockProperties, blockStyle, Component, context, lowdefy, skeleton })=>{
18
+ const LoadingList = ({ blockClass, blockId, blockLayout, blockProperties, blockStyle, Component, context, lowdefy, skeleton })=>{
20
19
  const content = {};
21
20
  const contentList = [];
22
21
  new Array(3).forEach(()=>{
23
- Object.keys(skeleton.areas).forEach((areaKey, i)=>{
24
- content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
25
- area: skeleton.areas[areaKey],
26
- areaKey: areaKey,
27
- areaStyle: [
28
- areaStyle,
29
- skeleton.areas[areaKey]?.style
30
- ],
31
- id: `s-ar-${blockId}-${skeleton.id}-${areaKey}`,
32
- key: `s-ar-${blockId}-${skeleton.id}-${areaKey}-${i}`,
33
- layout: skeleton.layout ?? blockLayout,
34
- makeCssClass: makeCssClass
35
- }, skeleton.areas[areaKey].blocks.map((skl, k)=>/*#__PURE__*/ React.createElement(LoadingBlock, {
22
+ Object.keys(skeleton.slots).forEach((slotKey, i)=>{
23
+ content[slotKey] = ()=>/*#__PURE__*/ React.createElement(Area, {
24
+ area: skeleton.slots[slotKey],
25
+ areaKey: slotKey,
26
+ style: skeleton.slots[slotKey]?.style,
27
+ id: `s-ar-${blockId}-${skeleton.id}-${slotKey}`,
28
+ key: `s-ar-${blockId}-${skeleton.id}-${slotKey}-${i}`,
29
+ layout: skeleton.layout ?? blockLayout
30
+ }, skeleton.slots[slotKey].blocks.map((skl, k)=>/*#__PURE__*/ React.createElement(LoadingBlock, {
36
31
  blockId: blockId,
37
32
  context: context,
38
33
  key: `s-co-${skl.id}-${k}`,
@@ -45,19 +40,17 @@ const LoadingList = ({ blockId, blockLayout, blockProperties, blockStyle, Compon
45
40
  });
46
41
  });
47
42
  return /*#__PURE__*/ React.createElement(BlockLayout, {
48
- blockStyle: skeleton.style ?? blockStyle,
43
+ style: skeleton.style ?? blockStyle,
49
44
  id: `s-bl-${blockId}-${skeleton.id}`,
50
45
  layout: skeleton.layout ?? blockLayout,
51
- makeCssClass: makeCssClass
46
+ className: skeleton.class ?? blockClass
52
47
  }, /*#__PURE__*/ React.createElement(Component, {
53
48
  basePath: lowdefy.basePath,
54
49
  blockId: blockId,
55
50
  components: lowdefy._internal.components,
56
51
  list: contentList,
57
52
  menus: lowdefy.menus,
58
- methods: {
59
- makeCssClass
60
- },
53
+ methods: {},
61
54
  pageId: lowdefy.pageId,
62
55
  properties: skeleton.properties ?? blockProperties
63
56
  }));
@@ -12,18 +12,13 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */
16
-
17
- .icon-spin {
18
- animation: spin 1s infinite linear;
19
- }
20
-
21
- @keyframes spin {
22
- 0% {
23
- transform: rotate(0deg);
24
- }
25
-
26
- 100% {
27
- transform: rotate(360deg);
28
- }
15
+ */ import { cn } from '@lowdefy/block-utils';
16
+ function resolveClassNames(evalClass) {
17
+ if (!evalClass) return {};
18
+ const resolved = {};
19
+ for (const [key, value] of Object.entries(evalClass)){
20
+ resolved[key] = cn(value);
21
+ }
22
+ return resolved;
29
23
  }
24
+ export default resolveClassNames;