@lowdefy/block-dev 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/mockBlock.js CHANGED
@@ -12,8 +12,7 @@
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 { makeCssClass } from '@lowdefy/block-utils';
16
- import stubBlockProps from './stubBlockProps.js';
15
+ */ import stubBlockProps from './stubBlockProps.js';
17
16
  const mockBlock = ({ meta, schema })=>{
18
17
  const mockMath = Object.create(global.Math);
19
18
  mockMath.random = ()=>0.5;
@@ -28,7 +27,6 @@ const mockBlock = ({ meta, schema })=>{
28
27
  const triggerEvent = jest.fn();
29
28
  const unshiftItem = jest.fn();
30
29
  const methods = {
31
- makeCssClass,
32
30
  moveItemDown,
33
31
  moveItemUp,
34
32
  pushItem,
@@ -22,16 +22,9 @@ const runMockRenderTests = ({ Block, examples, logger, mocks, reset = ()=>null,
22
22
  logger,
23
23
  schema
24
24
  });
25
- const makeCssClass = jest.fn();
26
- const makeCssImp = (style, op)=>JSON.stringify({
27
- style,
28
- options: op
29
- });
30
25
  beforeEach(async ()=>{
31
26
  await reset();
32
27
  before();
33
- makeCssClass.mockReset();
34
- makeCssClass.mockImplementation(makeCssImp);
35
28
  });
36
29
  examples.forEach((ex)=>{
37
30
  const values = [
@@ -52,10 +45,6 @@ const runMockRenderTests = ({ Block, examples, logger, mocks, reset = ()=>null,
52
45
  const props = getProps(ex);
53
46
  return /*#__PURE__*/ React.createElement(Block, {
54
47
  ...props,
55
- methods: {
56
- ...props.methods,
57
- makeCssClass
58
- },
59
48
  value: value
60
49
  });
61
50
  };
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import React, { useState } from 'react';
16
16
  import { type } from '@lowdefy/helpers';
17
- import { makeCssClass, createIcon } from '@lowdefy/block-utils';
17
+ import { createIcon } from '@lowdefy/block-utils';
18
18
  import schemaTest from './schemaTest.js';
19
19
  const validate = {};
20
20
  const Icons = {
@@ -57,9 +57,9 @@ const stubBlockProps = ({ block, meta, logger = ()=>null, initialValue, schema }
57
57
  // block defaults
58
58
  block.blockId = block.id;
59
59
  if (meta.category === 'list' || meta.category === 'container' || meta.category === 'context') {
60
- if (!block.areas) block.areas = {};
61
- if (!block.areas.content) block.areas.content = {};
62
- if (block.blocks) block.areas.content.blocks = block.blocks;
60
+ if (!block.slots) block.slots = {};
61
+ if (!block.slots.content) block.slots.content = {};
62
+ if (block.blocks) block.slots.content.blocks = block.blocks;
63
63
  }
64
64
  block.events = block.events || {};
65
65
  block.eventLog = [];
@@ -72,7 +72,6 @@ const stubBlockProps = ({ block, meta, logger = ()=>null, initialValue, schema }
72
72
  };
73
73
  // mock default block methods
74
74
  block.methods = {
75
- makeCssClass,
76
75
  registerEvent: ({ name, actions })=>{
77
76
  block.events[name] = actions;
78
77
  return;
@@ -86,7 +85,7 @@ const stubBlockProps = ({ block, meta, logger = ()=>null, initialValue, schema }
86
85
  // block category defaults
87
86
  if (meta.category === 'list') {
88
87
  block.list = [];
89
- (block.areas.content.blocks || []).forEach((bl, i)=>{
88
+ (block.slots.content.blocks || []).forEach((bl, i)=>{
90
89
  block.list.push({
91
90
  content: ()=>/*#__PURE__*/ React.createElement("div", {
92
91
  "data-testid": `list-${i}-${bl.id}`,
@@ -109,9 +108,9 @@ const stubBlockProps = ({ block, meta, logger = ()=>null, initialValue, schema }
109
108
  }
110
109
  if (meta.category === 'container') {
111
110
  block.content = {};
112
- Object.keys(block.areas).forEach((key)=>{
111
+ Object.keys(block.slots).forEach((key)=>{
113
112
  block.content[key] = ()=>/*#__PURE__*/ React.createElement("div", {
114
- "data-testid": `area-${key}`,
113
+ "data-testid": `slot-${key}`,
115
114
  key: key,
116
115
  style: {
117
116
  border: '1px solid red',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/block-dev",
3
- "version": "4.7.3",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Block Development Tools",
6
6
  "homepage": "https://lowdefy.com",
@@ -31,9 +31,8 @@
31
31
  "dist/*"
32
32
  ],
33
33
  "dependencies": {
34
- "@emotion/jest": "11.10.5",
35
- "@lowdefy/block-utils": "4.7.3",
36
- "@lowdefy/helpers": "4.7.3",
34
+ "@lowdefy/block-utils": "5.1.0",
35
+ "@lowdefy/helpers": "5.1.0",
37
36
  "@testing-library/dom": "8.19.1",
38
37
  "@testing-library/react": "13.4.0",
39
38
  "@testing-library/user-event": "14.4.3",
@@ -46,14 +45,14 @@
46
45
  "yaml-loader": "0.8.0"
47
46
  },
48
47
  "devDependencies": {
49
- "@swc/cli": "0.1.63",
50
- "@swc/core": "1.3.99"
48
+ "@swc/cli": "0.8.0",
49
+ "@swc/core": "1.15.18"
51
50
  },
52
51
  "publishConfig": {
53
52
  "access": "public"
54
53
  },
55
54
  "scripts": {
56
- "build": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start",
55
+ "build": "swc src --out-dir dist --config-file ../../../.swcrc --cli-config-file ../../../.swc-cli.json",
57
56
  "clean": "rm -rf dist"
58
57
  }
59
58
  }