@lowdefy/blocks-basic 0.0.0-experimental-20260324092624 → 0.0.0-experimental-20260324100109

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.
@@ -14,20 +14,19 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { get } from '@lowdefy/helpers';
17
- import { withBlockDefaults } from '@lowdefy/block-utils';
18
- const AnchorBlock = ({ blockId, classNames, events, components: { Icon, Link, ShortcutBadge }, methods, properties, styles })=>{
17
+ import { blockDefaultProps } from '@lowdefy/block-utils';
18
+ const AnchorBlock = ({ blockId, events, components: { Icon, Link }, methods, properties })=>{
19
19
  const disabled = properties.disabled || get(events, 'onClick.loading');
20
20
  const { icon, title, ...linkProperties } = properties;
21
21
  return /*#__PURE__*/ React.createElement(Link, {
22
22
  id: blockId,
23
- className: classNames?.element,
24
- style: {
25
- ...disabled ? {
23
+ className: methods.makeCssClass([
24
+ properties.style,
25
+ disabled && {
26
26
  color: '#BEBEBE',
27
27
  cursor: 'not-allowed'
28
- } : {},
29
- ...styles?.element
30
- },
28
+ }
29
+ ]),
31
30
  disabled: disabled,
32
31
  onClick: ()=>methods.triggerEvent({
33
32
  name: 'onClick'
@@ -35,22 +34,19 @@ const AnchorBlock = ({ blockId, classNames, events, components: { Icon, Link, Sh
35
34
  ...linkProperties
36
35
  }, (defaultTitle)=>/*#__PURE__*/ React.createElement(React.Fragment, null, icon && /*#__PURE__*/ React.createElement(Icon, {
37
36
  blockId: `${blockId}_icon`,
38
- classNames: {
39
- element: classNames?.icon
40
- },
41
37
  events: events,
42
38
  properties: get(events, 'onClick.loading') ? {
43
39
  name: 'AiOutlineLoading3Quarters',
44
40
  spin: true
45
- } : icon,
46
- styles: {
47
- element: {
48
- marginRight: 4,
49
- ...styles?.icon
50
- }
51
- }
52
- }), title || defaultTitle, /*#__PURE__*/ React.createElement(ShortcutBadge, {
53
- shortcut: events.onClick?.shortcut
54
- })));
41
+ } : icon
42
+ }), title || defaultTitle));
43
+ };
44
+ AnchorBlock.defaultProps = blockDefaultProps;
45
+ AnchorBlock.meta = {
46
+ category: 'display',
47
+ icons: [
48
+ 'AiOutlineLoading3Quarters'
49
+ ],
50
+ styles: []
55
51
  };
56
- export default withBlockDefaults(AnchorBlock);
52
+ export default AnchorBlock;
@@ -13,18 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'display',
17
- icons: [
18
- 'AiOutlineLoading3Quarters'
19
- ],
20
- valueType: null,
21
- cssKeys: {
22
- element: 'The anchor element.',
23
- icon: 'The icon in the Anchor.'
24
- },
25
- events: {
26
- onClick: 'Called when Anchor is clicked.'
27
- },
16
+ type: 'object',
28
17
  properties: {
29
18
  type: 'object',
30
19
  additionalProperties: false,
@@ -102,10 +91,27 @@
102
91
  default: false,
103
92
  description: 'Disable scrolling to the top of the page after page transition. Can only be used with pageId link and newTab false.'
104
93
  },
94
+ style: {
95
+ type: 'object',
96
+ description: 'Css style object to applied to anchor.',
97
+ docs: {
98
+ displayType: 'yaml'
99
+ }
100
+ },
105
101
  title: {
106
102
  type: 'string',
107
103
  description: 'Text to display in the anchor.'
108
104
  }
109
105
  }
106
+ },
107
+ events: {
108
+ type: 'object',
109
+ additionalProperties: false,
110
+ properties: {
111
+ onClick: {
112
+ type: 'array',
113
+ description: 'Called when Anchor is clicked.'
114
+ }
115
+ }
110
116
  }
111
117
  };
@@ -0,0 +1,100 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "ariaLabel": {
8
+ "type": "string",
9
+ "description": "Arial-label to apply to link tag."
10
+ },
11
+ "back": {
12
+ "type": "boolean",
13
+ "description": "When the link is clicked, trigger the browser back."
14
+ },
15
+ "home": {
16
+ "type": "boolean",
17
+ "description": "When the link is clicked, route to the home page."
18
+ },
19
+ "input": {
20
+ "type": "object",
21
+ "description": "When the link is clicked, pass data as the input object to the next Lowdefy page. Can only be used with pageId link and newTab false.",
22
+ "docs": {
23
+ "displayType": "yaml"
24
+ }
25
+ },
26
+ "urlQuery": {
27
+ "type": "object",
28
+ "description": "When the link is clicked, pass data as a url query to the next page.",
29
+ "docs": {
30
+ "displayType": "yaml"
31
+ }
32
+ },
33
+ "disabled": {
34
+ "type": "boolean",
35
+ "default": false,
36
+ "description": "Disable the anchor if true."
37
+ },
38
+ "icon": {
39
+ "type": ["string", "object"],
40
+ "description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block for anchor icon.",
41
+ "docs": {
42
+ "displayType": "icon"
43
+ }
44
+ },
45
+ "pageId": {
46
+ "type": "string",
47
+ "description": "When the link is clicked, route to the provided Lowdefy page."
48
+ },
49
+ "href": {
50
+ "type": "string",
51
+ "description": "The href to link to when the anchor link is clicked."
52
+ },
53
+ "url": {
54
+ "type": "string",
55
+ "description": "External url to link to when the anchor link is clicked."
56
+ },
57
+ "rel": {
58
+ "type": "string",
59
+ "default": "noopener noreferrer",
60
+ "description": "The relationship of the linked URL as space-separated link types."
61
+ },
62
+ "newTab": {
63
+ "type": "boolean",
64
+ "default": false,
65
+ "description": "Open link in a new tab when the anchor link is clicked."
66
+ },
67
+ "replace": {
68
+ "type": "boolean",
69
+ "default": false,
70
+ "description": "Prevent adding a new entry into browser history by replacing the url instead of pushing into history. Can only be used with pageId link and newTab false."
71
+ },
72
+ "scroll": {
73
+ "type": "boolean",
74
+ "default": false,
75
+ "description": "Disable scrolling to the top of the page after page transition. Can only be used with pageId link and newTab false."
76
+ },
77
+ "style": {
78
+ "type": "object",
79
+ "description": "Css style object to applied to anchor.",
80
+ "docs": {
81
+ "displayType": "yaml"
82
+ }
83
+ },
84
+ "title": {
85
+ "type": "string",
86
+ "description": "Text to display in the anchor."
87
+ }
88
+ }
89
+ },
90
+ "events": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "properties": {
94
+ "onClick": {
95
+ "type": "array",
96
+ "description": "Called when Anchor is clicked."
97
+ }
98
+ }
99
+ }
100
+ }
@@ -13,8 +13,8 @@
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 { withBlockDefaults } from '@lowdefy/block-utils';
17
- const Box = ({ blockId, classNames, content, events, methods, properties, styles })=>{
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ const Box = ({ blockId, content, events, methods, properties })=>{
18
18
  return /*#__PURE__*/ React.createElement("div", {
19
19
  id: blockId,
20
20
  "data-testid": blockId,
@@ -24,12 +24,19 @@ const Box = ({ blockId, classNames, content, events, methods, properties, styles
24
24
  onPaste: ()=>methods.triggerEvent({
25
25
  name: 'onPaste'
26
26
  }),
27
- className: classNames?.element,
28
- style: {
29
- outline: 'none',
30
- cursor: events.onClick && 'pointer',
31
- ...styles?.element
32
- }
27
+ className: methods.makeCssClass([
28
+ {
29
+ outline: 'none',
30
+ cursor: events.onClick && 'pointer'
31
+ },
32
+ properties.style
33
+ ])
33
34
  }, properties.content || content.content && content.content());
34
35
  };
35
- export default withBlockDefaults(Box);
36
+ Box.defaultProps = blockDefaultProps;
37
+ Box.meta = {
38
+ category: 'container',
39
+ icons: [],
40
+ styles: []
41
+ };
42
+ export default Box;
@@ -13,16 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'container',
17
- icons: [],
18
- valueType: null,
19
- cssKeys: {
20
- element: 'The Box element.'
21
- },
22
- events: {
23
- onClick: 'Trigger actions when the Box is clicked.',
24
- onPaste: 'Trigger actions when the element is focused and a paste event is triggered.'
25
- },
16
+ type: 'object',
26
17
  properties: {
27
18
  type: 'object',
28
19
  additionalProperties: false,
@@ -30,6 +21,27 @@
30
21
  content: {
31
22
  type: 'string',
32
23
  description: 'Box content string. Overrides the "content" content area.'
24
+ },
25
+ style: {
26
+ type: 'object',
27
+ description: 'Css style object to apply to Box div.',
28
+ docs: {
29
+ displayType: 'yaml'
30
+ }
31
+ }
32
+ }
33
+ },
34
+ events: {
35
+ type: 'object',
36
+ additionalProperties: false,
37
+ properties: {
38
+ onClick: {
39
+ type: 'array',
40
+ description: 'Trigger actions when the Box is clicked.'
41
+ },
42
+ onPaste: {
43
+ type: 'array',
44
+ description: 'Trigger actions when the element is focused and a paste event is triggered.'
33
45
  }
34
46
  }
35
47
  }
@@ -0,0 +1,34 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "content": {
8
+ "type": "string",
9
+ "description": "Box content string. Overrides the \"content\" content area."
10
+ },
11
+ "style": {
12
+ "type": "object",
13
+ "description": "Css style object to apply to Box div.",
14
+ "docs": {
15
+ "displayType": "yaml"
16
+ }
17
+ }
18
+ }
19
+ },
20
+ "events": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "onClick": {
25
+ "type": "array",
26
+ "description": "Trigger actions when the Box is clicked."
27
+ },
28
+ "onPaste": {
29
+ "type": "array",
30
+ "description": "Trigger actions when the element is focused and a paste event is triggered."
31
+ }
32
+ }
33
+ }
34
+ }
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import DOMPurify from 'dompurify';
17
- import { withBlockDefaults } from '@lowdefy/block-utils';
17
+ import { blockDefaultProps } from '@lowdefy/block-utils';
18
18
  import { type } from '@lowdefy/helpers';
19
19
  let DangerousHtml = class DangerousHtml extends React.Component {
20
20
  componentDidMount() {
@@ -26,7 +26,7 @@ let DangerousHtml = class DangerousHtml extends React.Component {
26
26
  this.div.innerHTML = DOMPurify.sanitize(htmlString, this.DOMPurifyOptions);
27
27
  }
28
28
  render() {
29
- const { blockId, classNames, styles } = this.props;
29
+ const { blockId, properties, methods } = this.props;
30
30
  return /*#__PURE__*/ React.createElement("div", {
31
31
  id: blockId,
32
32
  "data-testid": blockId,
@@ -35,8 +35,7 @@ let DangerousHtml = class DangerousHtml extends React.Component {
35
35
  this.div = el;
36
36
  }
37
37
  },
38
- className: classNames?.element,
39
- style: styles?.element
38
+ className: methods.makeCssClass(properties.style)
40
39
  });
41
40
  }
42
41
  constructor(props){
@@ -48,4 +47,10 @@ let DangerousHtml = class DangerousHtml extends React.Component {
48
47
  this.DOMPurifyOptions = props.properties.DOMPurifyOptions;
49
48
  }
50
49
  };
51
- export default withBlockDefaults(DangerousHtml);
50
+ DangerousHtml.defaultProps = blockDefaultProps;
51
+ DangerousHtml.meta = {
52
+ category: 'display',
53
+ icons: [],
54
+ styles: []
55
+ };
56
+ export default DangerousHtml;
@@ -13,12 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'display',
17
- icons: [],
18
- valueType: null,
19
- cssKeys: {
20
- element: 'The DangerousHtml element.'
21
- },
16
+ type: 'object',
22
17
  properties: {
23
18
  type: 'object',
24
19
  additionalProperties: false,
@@ -36,6 +31,13 @@
36
31
  docs: {
37
32
  displayType: 'yaml'
38
33
  }
34
+ },
35
+ style: {
36
+ type: 'object',
37
+ description: 'Css style object to apply to Html div.',
38
+ docs: {
39
+ displayType: 'yaml'
40
+ }
39
41
  }
40
42
  }
41
43
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "html": {
8
+ "type": "string",
9
+ "description": "Content to be rendered as Html.",
10
+ "docs": {
11
+ "displayType": "text-area"
12
+ }
13
+ },
14
+ "DOMPurifyOptions": {
15
+ "type": "object",
16
+ "description": "Customize DOMPurify options. Options are only applied when the block is mounted, thus any parsed settings is only applied at first render.",
17
+ "docs": {
18
+ "displayType": "yaml"
19
+ }
20
+ },
21
+ "style": {
22
+ "type": "object",
23
+ "description": "Css style object to apply to Html div.",
24
+ "docs": {
25
+ "displayType": "yaml"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
@@ -13,14 +13,19 @@
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 { withBlockDefaults, HtmlComponent } from '@lowdefy/block-utils';
17
- const HtmlBlock = ({ blockId, classNames, events, properties, methods, styles })=>/*#__PURE__*/ React.createElement(HtmlComponent, {
16
+ import { blockDefaultProps, HtmlComponent } from '@lowdefy/block-utils';
17
+ const HtmlBlock = ({ blockId, events, properties, methods })=>/*#__PURE__*/ React.createElement(HtmlComponent, {
18
18
  div: true,
19
19
  events: events,
20
20
  html: properties.html,
21
21
  id: blockId,
22
22
  methods: methods,
23
- className: classNames?.element,
24
- style: styles?.element
23
+ style: properties.style
25
24
  });
26
- export default withBlockDefaults(HtmlBlock);
25
+ HtmlBlock.defaultProps = blockDefaultProps;
26
+ HtmlBlock.meta = {
27
+ category: 'display',
28
+ icons: [],
29
+ styles: []
30
+ };
31
+ export default HtmlBlock;
@@ -13,15 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'display',
17
- icons: [],
18
- valueType: null,
19
- cssKeys: {
20
- element: 'The Html element.'
21
- },
22
- events: {
23
- onTextSelection: 'Trigger action when text is selected and pass selected text to the event object.'
24
- },
16
+ type: 'object',
25
17
  properties: {
26
18
  type: 'object',
27
19
  additionalProperties: false,
@@ -32,6 +24,23 @@
32
24
  docs: {
33
25
  displayType: 'text-area'
34
26
  }
27
+ },
28
+ style: {
29
+ type: 'object',
30
+ description: 'Css style object to apply to Html div.',
31
+ docs: {
32
+ displayType: 'yaml'
33
+ }
34
+ }
35
+ }
36
+ },
37
+ events: {
38
+ type: 'object',
39
+ additionalProperties: false,
40
+ properties: {
41
+ onTextSelection: {
42
+ type: 'array',
43
+ description: 'Trigger action when text is selected and pass selected text to the event object.'
35
44
  }
36
45
  }
37
46
  }
@@ -0,0 +1,33 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "html": {
8
+ "type": "string",
9
+ "description": "Content to be rendered as Html.",
10
+ "docs": {
11
+ "displayType": "text-area"
12
+ }
13
+ },
14
+ "style": {
15
+ "type": "object",
16
+ "description": "Css style object to apply to Html div.",
17
+ "docs": {
18
+ "displayType": "yaml"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ "events": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "properties": {
27
+ "onTextSelection": {
28
+ "type": "array",
29
+ "description": "Trigger action when text is selected and pass selected text to the event object."
30
+ }
31
+ }
32
+ }
33
+ }
@@ -13,6 +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 { withBlockDefaults } from '@lowdefy/block-utils';
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  const IconBlock = ({ components: { Icon }, ...props })=>/*#__PURE__*/ React.createElement(Icon, props);
18
- export default withBlockDefaults(IconBlock);
18
+ IconBlock.defaultProps = blockDefaultProps;
19
+ IconBlock.meta = {
20
+ category: 'display',
21
+ icons: [],
22
+ styles: []
23
+ };
24
+ export default IconBlock;
@@ -13,15 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'display',
17
- icons: [],
18
- valueType: null,
19
- cssKeys: {
20
- element: 'The Icon element.'
21
- },
22
- events: {
23
- onClick: 'Trigger actions when icon is clicked.'
24
- },
16
+ type: 'object',
25
17
  properties: {
26
18
  type: 'object',
27
19
  additionalProperties: false,
@@ -61,11 +53,28 @@
61
53
  type: 'string',
62
54
  description: 'Icon hover title for accessibility.'
63
55
  },
56
+ style: {
57
+ type: 'object',
58
+ description: 'CSS style object.',
59
+ docs: {
60
+ displayType: 'yaml'
61
+ }
62
+ },
64
63
  disableLoadingIcon: {
65
64
  type: 'boolean',
66
65
  default: false,
67
66
  description: "While loading after the icon has been clicked, don't render the loading icon."
68
67
  }
69
68
  }
69
+ },
70
+ events: {
71
+ type: 'object',
72
+ additionalProperties: false,
73
+ properties: {
74
+ onClick: {
75
+ type: 'array',
76
+ description: 'Trigger actions when icon is clicked.'
77
+ }
78
+ }
70
79
  }
71
80
  };
@@ -0,0 +1,63 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "color": {
8
+ "type": "string",
9
+ "description": "Primary icon color.",
10
+ "docs": {
11
+ "displayType": "color"
12
+ }
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "default": "AiOutlineCloseCircle",
17
+ "description": "Name of icon to be displayed."
18
+ },
19
+ "rotate": {
20
+ "type": "number",
21
+ "description": "Number of degrees to rotate the icon."
22
+ },
23
+ "size": {
24
+ "type": ["string", "number"],
25
+ "description": "Size of the icon.",
26
+ "docs": {
27
+ "displayType": "number"
28
+ }
29
+ },
30
+ "spin": {
31
+ "type": "boolean",
32
+ "default": false,
33
+ "description": "Continuously spin icon with animation."
34
+ },
35
+ "title": {
36
+ "type": "string",
37
+ "description": "Icon hover title for accessibility."
38
+ },
39
+ "style": {
40
+ "type": "object",
41
+ "description": "CSS style object.",
42
+ "docs": {
43
+ "displayType": "yaml"
44
+ }
45
+ },
46
+ "disableLoadingIcon": {
47
+ "type": "boolean",
48
+ "default": false,
49
+ "description": "While loading after the icon has been clicked, don't render the loading icon."
50
+ }
51
+ }
52
+ },
53
+ "events": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "properties": {
57
+ "onClick": {
58
+ "type": "array",
59
+ "description": "Trigger actions when icon is clicked."
60
+ }
61
+ }
62
+ }
63
+ }
@@ -13,21 +13,29 @@
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 { withBlockDefaults } from '@lowdefy/block-utils';
17
- const ImgBlock = ({ blockId, classNames, events, properties, methods, styles })=>{
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ const ImgBlock = ({ blockId, events, properties, methods })=>{
18
+ const { style, ...allProps } = properties;
18
19
  return /*#__PURE__*/ React.createElement("img", {
19
- ...properties,
20
+ ...allProps,
20
21
  id: blockId,
21
22
  "data-testid": blockId,
22
23
  onClick: ()=>methods.triggerEvent({
23
24
  name: 'onClick'
24
25
  }),
25
- className: classNames?.element,
26
- style: {
27
- outline: 'none',
28
- cursor: events.onClick && 'pointer',
29
- ...styles?.element
30
- }
26
+ className: methods.makeCssClass([
27
+ {
28
+ outline: 'none',
29
+ cursor: events.onClick && 'pointer'
30
+ },
31
+ style
32
+ ])
31
33
  });
32
34
  };
33
- export default withBlockDefaults(ImgBlock);
35
+ ImgBlock.defaultProps = blockDefaultProps;
36
+ ImgBlock.meta = {
37
+ category: 'display',
38
+ icons: [],
39
+ styles: []
40
+ };
41
+ export default ImgBlock;
@@ -13,12 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'display',
17
- icons: [],
18
- valueType: null,
19
- cssKeys: {
20
- element: 'The Img element.'
21
- },
16
+ type: 'object',
22
17
  properties: {
23
18
  type: 'object',
24
19
  additionalProperties: false,
@@ -74,6 +69,13 @@
74
69
  displayType: 'text-area'
75
70
  }
76
71
  },
72
+ style: {
73
+ type: 'object',
74
+ description: 'Css style object to applied to the image.',
75
+ docs: {
76
+ displayType: 'yaml'
77
+ }
78
+ },
77
79
  width: {
78
80
  type: 'number',
79
81
  description: 'Width of the image.'
@@ -0,0 +1,59 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["src"],
7
+ "properties": {
8
+ "src": {
9
+ "type": "string",
10
+ "description": "The image URL."
11
+ },
12
+ "alt": {
13
+ "type": "string",
14
+ "description": "Alternative text description of the image."
15
+ },
16
+ "crossOrigin": {
17
+ "type": "string",
18
+ "enum": ["anonymous", "use-credentials"],
19
+ "description": "Indicates if the fetching of the image must be done using a CORS request."
20
+ },
21
+ "decoding": {
22
+ "type": "string",
23
+ "enum": ["sync", "async", "auto"],
24
+ "description": "An image decoding hint to the browser. Sync for atomic presentation with other content, async, to reduce delay in presenting other content and auto leave to browser to decide."
25
+ },
26
+ "height": {
27
+ "type": "number",
28
+ "description": "Height of the image."
29
+ },
30
+ "loading": {
31
+ "type": "string",
32
+ "enum": ["eager", "lazy"],
33
+ "description": "How the browser should load the image. Eager loads the image immediately, lazy, defers loading until the image it reaches a calculated distance from the viewport, as defined by the browser."
34
+ },
35
+ "sizes": {
36
+ "type": "string",
37
+ "description": "Indicating a set of source sizes of strings separated by commas."
38
+ },
39
+ "srcSet": {
40
+ "type": "string",
41
+ "description": "Possible image sources for the user agent to use, strings separated by commas.",
42
+ "docs": {
43
+ "displayType": "text-area"
44
+ }
45
+ },
46
+ "style": {
47
+ "type": "object",
48
+ "description": "Css style object to applied to the image.",
49
+ "docs": {
50
+ "displayType": "yaml"
51
+ }
52
+ },
53
+ "width": {
54
+ "type": "number",
55
+ "description": "Width of the image."
56
+ }
57
+ }
58
+ }
59
+ }
@@ -13,9 +13,9 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import React, { useEffect } from 'react';
16
- import { withBlockDefaults } from '@lowdefy/block-utils';
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  import Box from '../Box/Box.js';
18
- const List = ({ blockId, classNames, events, list, methods, properties, styles })=>{
18
+ const List = ({ blockId, events, list, methods, properties })=>{
19
19
  useEffect(()=>{
20
20
  methods.registerMethod('pushItem', methods.pushItem);
21
21
  methods.registerMethod('unshiftItem', methods.unshiftItem);
@@ -26,17 +26,15 @@ const List = ({ blockId, classNames, events, list, methods, properties, styles }
26
26
  return /*#__PURE__*/ React.createElement(Box, {
27
27
  blockId: blockId,
28
28
  events: events,
29
- properties: {},
30
- classNames: classNames,
31
- styles: {
32
- element: {
29
+ properties: {
30
+ style: {
33
31
  ...properties.direction ? {
34
32
  display: 'flex',
35
33
  flexDirection: properties.direction,
36
34
  flexWrap: properties.wrap ? properties.wrap : 'wrap',
37
35
  overflow: properties.scroll ? 'auto' : 'visible'
38
36
  } : {},
39
- ...styles?.element
37
+ ...properties.style
40
38
  }
41
39
  },
42
40
  methods: methods,
@@ -45,4 +43,11 @@ const List = ({ blockId, classNames, events, list, methods, properties, styles }
45
43
  }
46
44
  });
47
45
  };
48
- export default withBlockDefaults(List);
46
+ List.defaultProps = blockDefaultProps;
47
+ List.meta = {
48
+ category: 'list',
49
+ valueType: 'array',
50
+ icons: [],
51
+ styles: []
52
+ };
53
+ export default List;
@@ -13,15 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'list',
17
- icons: [],
18
- valueType: 'array',
19
- cssKeys: {
20
- element: 'The List element.'
21
- },
22
- events: {
23
- onClick: 'Trigger actions when the List is clicked.'
24
- },
16
+ type: 'object',
25
17
  properties: {
26
18
  type: 'object',
27
19
  additionalProperties: false,
@@ -48,6 +40,23 @@
48
40
  scroll: {
49
41
  type: 'boolean',
50
42
  description: "Specifies whether scrolling should be applied to the List, can be true or false. Applies the 'overflow' css property to the List block - defaults to 'visible', requires List direction to be set."
43
+ },
44
+ style: {
45
+ type: 'object',
46
+ description: 'Css style object to apply to List block.',
47
+ docs: {
48
+ displayType: 'yaml'
49
+ }
50
+ }
51
+ }
52
+ },
53
+ events: {
54
+ type: 'object',
55
+ additionalProperties: false,
56
+ properties: {
57
+ onClick: {
58
+ type: 'array',
59
+ description: 'Trigger actions when the List is clicked.'
51
60
  }
52
61
  }
53
62
  }
@@ -0,0 +1,40 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "direction": {
8
+ "type": "string",
9
+ "enum": ["row", "column", "row-reverse", "column-reverse"],
10
+ "description": "List content along a 'row' or down a 'column'. Applies the 'flex-direction' css property to the List block."
11
+ },
12
+ "wrap": {
13
+ "type": "string",
14
+ "enum": ["wrap", "nowrap", "wrap-reverse"],
15
+ "description": "Specifies wrapping style to be applied to List block as 'wrap', 'nowrap' or 'wrap-reverse'. Applies the 'flex-wrap' css property to the List block - defaults to 'wrap', requires List direction to be set."
16
+ },
17
+ "scroll": {
18
+ "type": "boolean",
19
+ "description": "Specifies whether scrolling should be applied to the List, can be true or false. Applies the 'overflow' css property to the List block - defaults to 'visible', requires List direction to be set."
20
+ },
21
+ "style": {
22
+ "type": "object",
23
+ "description": "Css style object to apply to List block.",
24
+ "docs": {
25
+ "displayType": "yaml"
26
+ }
27
+ }
28
+ }
29
+ },
30
+ "events": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "onClick": {
35
+ "type": "array",
36
+ "description": "Trigger actions when the List is clicked."
37
+ }
38
+ }
39
+ }
40
+ }
@@ -13,18 +13,25 @@
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 { withBlockDefaults } from '@lowdefy/block-utils';
17
- const Span = ({ blockId, classNames, content, events, methods, properties, styles })=>/*#__PURE__*/ React.createElement("span", {
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ const Span = ({ blockId, content, events, methods, properties })=>/*#__PURE__*/ React.createElement("span", {
18
18
  id: blockId,
19
19
  "data-testid": blockId,
20
20
  onClick: ()=>methods.triggerEvent({
21
21
  name: 'onClick'
22
22
  }),
23
- className: classNames?.element,
24
- style: {
25
- outline: 'none',
26
- cursor: events.onClick && 'pointer',
27
- ...styles?.element
28
- }
23
+ className: methods.makeCssClass([
24
+ {
25
+ outline: 'none',
26
+ cursor: events.onClick && 'pointer'
27
+ },
28
+ properties.style
29
+ ])
29
30
  }, properties.content || content.content && content.content());
30
- export default withBlockDefaults(Span);
31
+ Span.defaultProps = blockDefaultProps;
32
+ Span.meta = {
33
+ category: 'container',
34
+ icons: [],
35
+ styles: []
36
+ };
37
+ export default Span;
@@ -13,15 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'container',
17
- icons: [],
18
- valueType: null,
19
- cssKeys: {
20
- element: 'The Span element.'
21
- },
22
- events: {
23
- onClick: 'Trigger actions when the Span is clicked.'
24
- },
16
+ type: 'object',
25
17
  properties: {
26
18
  type: 'object',
27
19
  additionalProperties: false,
@@ -29,6 +21,23 @@
29
21
  content: {
30
22
  type: 'string',
31
23
  description: 'Span content string. Overrides the "content" content area.'
24
+ },
25
+ style: {
26
+ type: 'object',
27
+ description: 'Css style object to apply to Span div.',
28
+ docs: {
29
+ displayType: 'yaml'
30
+ }
31
+ }
32
+ }
33
+ },
34
+ events: {
35
+ type: 'object',
36
+ additionalProperties: false,
37
+ properties: {
38
+ onClick: {
39
+ type: 'array',
40
+ description: 'Trigger actions when the Span is clicked.'
32
41
  }
33
42
  }
34
43
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "content": {
8
+ "type": "string",
9
+ "description": "Span content string. Overrides the \"content\" content area."
10
+ },
11
+ "style": {
12
+ "type": "object",
13
+ "description": "Css style object to apply to Span div.",
14
+ "docs": {
15
+ "displayType": "yaml"
16
+ }
17
+ }
18
+ }
19
+ },
20
+ "events": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "onClick": {
25
+ "type": "array",
26
+ "description": "Trigger actions when the Span is clicked."
27
+ }
28
+ }
29
+ }
30
+ }
@@ -13,9 +13,15 @@
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 { withBlockDefaults } from '@lowdefy/block-utils';
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  const Throw = ({ properties })=>{
18
18
  const message = properties.message || 'Intentional error thrown by Throw block';
19
19
  throw new Error(message);
20
20
  };
21
- export default withBlockDefaults(Throw);
21
+ Throw.defaultProps = blockDefaultProps;
22
+ Throw.meta = {
23
+ category: 'display',
24
+ icons: [],
25
+ styles: []
26
+ };
27
+ export default Throw;
@@ -13,9 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- category: 'display',
17
- icons: [],
18
- valueType: null,
16
+ type: 'object',
19
17
  properties: {
20
18
  type: 'object',
21
19
  additionalProperties: false,
@@ -26,5 +24,10 @@
26
24
  default: 'Intentional error thrown by Throw block'
27
25
  }
28
26
  }
27
+ },
28
+ events: {
29
+ type: 'object',
30
+ additionalProperties: false,
31
+ properties: {}
29
32
  }
30
33
  };
@@ -0,0 +1,19 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "message": {
8
+ "type": "string",
9
+ "description": "Error message to throw.",
10
+ "default": "Intentional error thrown by Throw block"
11
+ }
12
+ }
13
+ },
14
+ "events": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "properties": {}
18
+ }
19
+ }
@@ -12,12 +12,12 @@
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
- */ export { default as Anchor } from './blocks/Anchor/meta.js';
16
- export { default as Box } from './blocks/Box/meta.js';
17
- export { default as DangerousHtml } from './blocks/DangerousHtml/meta.js';
18
- export { default as Html } from './blocks/Html/meta.js';
19
- export { default as Icon } from './blocks/Icon/meta.js';
20
- export { default as Img } from './blocks/Img/meta.js';
21
- export { default as List } from './blocks/List/meta.js';
22
- export { default as Span } from './blocks/Span/meta.js';
23
- export { default as Throw } from './blocks/Throw/meta.js';
15
+ */ export { default as Anchor } from './blocks/Anchor/schema.js';
16
+ export { default as Box } from './blocks/Box/schema.js';
17
+ export { default as DangerousHtml } from './blocks/DangerousHtml/schema.js';
18
+ export { default as Html } from './blocks/Html/schema.js';
19
+ export { default as Icon } from './blocks/Icon/schema.js';
20
+ export { default as Img } from './blocks/Img/schema.js';
21
+ export { default as List } from './blocks/List/schema.js';
22
+ export { default as Span } from './blocks/Span/schema.js';
23
+ export { default as Throw } from './blocks/Throw/schema.js';
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- /*
1
+ /* eslint-disable import/namespace */ /*
2
2
  Copyright 2020-2026 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +12,21 @@
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 { extractBlockTypes } from '@lowdefy/block-utils';
16
- import * as metas from './metas.js';
17
- export default extractBlockTypes(metas);
15
+ */ import * as blocks from './blocks.js';
16
+ const icons = {};
17
+ const styles = {};
18
+ Object.keys(blocks).forEach((block)=>{
19
+ icons[block] = blocks[block].meta.icons ?? [];
20
+ styles[block] = blocks[block].meta.styles ?? [];
21
+ });
22
+ export default {
23
+ blocks: Object.keys(blocks),
24
+ icons,
25
+ styles: {
26
+ default: [],
27
+ ...styles
28
+ }
29
+ }; // export default {
30
+ // blocks: ['Anchor', 'Box', 'DangerousHtml', 'Html', 'Icon', 'Img', 'List', 'Span'],
31
+ // styles: { default: ['style.less'], Anchor: ['blocks/Anchor/style.less'] },
32
+ // };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-basic",
3
- "version": "0.0.0-experimental-20260324092624",
3
+ "version": "0.0.0-experimental-20260324100109",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Basic html Lowdefy blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -35,32 +35,32 @@
35
35
  "./*": "./dist/*",
36
36
  "./blocks": "./dist/blocks.js",
37
37
  "./e2e": "./dist/e2e.js",
38
- "./metas": "./dist/metas.js",
38
+ "./schemas": "./dist/schemas.js",
39
39
  "./types": "./dist/types.js"
40
40
  },
41
41
  "files": [
42
42
  "dist/*"
43
43
  ],
44
44
  "dependencies": {
45
- "@lowdefy/block-utils": "0.0.0-experimental-20260324092624",
46
- "@lowdefy/helpers": "0.0.0-experimental-20260324092624",
45
+ "@lowdefy/block-utils": "0.0.0-experimental-20260324100109",
46
+ "@lowdefy/helpers": "0.0.0-experimental-20260324100109",
47
47
  "dompurify": "3.2.4",
48
48
  "react": "18.2.0",
49
49
  "react-dom": "18.2.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@lowdefy/block-dev-e2e": "0.0.0-experimental-20260324092624",
53
- "@lowdefy/e2e-utils": "0.0.0-experimental-20260324092624",
52
+ "@lowdefy/block-dev-e2e": "0.0.0-experimental-20260324100109",
53
+ "@lowdefy/e2e-utils": "0.0.0-experimental-20260324100109",
54
54
  "@playwright/test": "1.50.1",
55
- "@swc/cli": "0.8.0",
56
- "@swc/core": "1.15.18",
55
+ "@swc/cli": "0.1.63",
56
+ "@swc/core": "1.3.99",
57
57
  "copyfiles": "2.4.1"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
62
  "scripts": {
63
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --cli-config-file ../../../../.swc-cli.json && pnpm copyfiles",
63
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
64
64
  "clean": "rm -rf dist",
65
65
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
66
66
  "e2e": "playwright test --config e2e/playwright.config.js",