@lowdefy/blocks-basic 4.0.0-rc.8 → 4.0.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,27 +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
- */ function _extends() {
16
- _extends = Object.assign || function(target) {
17
- for(var i = 1; i < arguments.length; i++){
18
- var source = arguments[i];
19
- for(var key in source){
20
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21
- target[key] = source[key];
22
- }
23
- }
24
- }
25
- return target;
26
- };
27
- return _extends.apply(this, arguments);
28
- }
29
- import React from 'react';
15
+ */ import React from 'react';
30
16
  import { get } from '@lowdefy/helpers';
31
17
  import { blockDefaultProps } from '@lowdefy/block-utils';
32
- const AnchorBlock = ({ blockId , events , components: { Icon , Link } , methods , properties })=>{
18
+ const AnchorBlock = ({ blockId, events, components: { Icon, Link }, methods, properties })=>{
33
19
  const disabled = properties.disabled || get(events, 'onClick.loading');
34
- const { icon , title , ...linkProperties } = properties;
35
- return /*#__PURE__*/ React.createElement(Link, _extends({
20
+ const { icon, title, ...linkProperties } = properties;
21
+ return /*#__PURE__*/ React.createElement(Link, {
36
22
  id: blockId,
37
23
  className: methods.makeCssClass([
38
24
  properties.style,
@@ -44,8 +30,9 @@ const AnchorBlock = ({ blockId , events , components: { Icon , Link } , methods
44
30
  disabled: disabled,
45
31
  onClick: ()=>methods.triggerEvent({
46
32
  name: 'onClick'
47
- })
48
- }, linkProperties), (defaultTitle)=>/*#__PURE__*/ React.createElement(React.Fragment, null, icon && /*#__PURE__*/ React.createElement(Icon, {
33
+ }),
34
+ ...linkProperties
35
+ }, (defaultTitle)=>/*#__PURE__*/ React.createElement(React.Fragment, null, icon && /*#__PURE__*/ React.createElement(Icon, {
49
36
  blockId: `${blockId}_icon`,
50
37
  events: events,
51
38
  properties: get(events, 'onClick.loading') ? {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
- const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ React.createElement("div", {
17
+ const Box = ({ blockId, content, events, methods, properties })=>/*#__PURE__*/ React.createElement("div", {
18
18
  id: blockId,
19
19
  "data-testid": blockId,
20
20
  onClick: ()=>methods.triggerEvent({
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -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 , properties , methods } = 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,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -14,8 +14,9 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { blockDefaultProps, HtmlComponent } from '@lowdefy/block-utils';
17
- const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ React.createElement(HtmlComponent, {
17
+ const HtmlBlock = ({ blockId, events, properties, methods })=>/*#__PURE__*/ React.createElement(HtmlComponent, {
18
18
  div: true,
19
+ events: events,
19
20
  html: properties.html,
20
21
  id: blockId,
21
22
  methods: methods,
@@ -19,5 +19,15 @@
19
19
  }
20
20
  }
21
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
+ }
22
32
  }
23
33
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,23 +12,9 @@
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
- */ function _extends() {
16
- _extends = Object.assign || function(target) {
17
- for(var i = 1; i < arguments.length; i++){
18
- var source = arguments[i];
19
- for(var key in source){
20
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21
- target[key] = source[key];
22
- }
23
- }
24
- }
25
- return target;
26
- };
27
- return _extends.apply(this, arguments);
28
- }
29
- import React from 'react';
15
+ */ import React from 'react';
30
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
31
- const IconBlock = ({ components: { Icon } , ...props })=>/*#__PURE__*/ React.createElement(Icon, _extends({}, props));
17
+ const IconBlock = ({ components: { Icon }, ...props })=>/*#__PURE__*/ React.createElement(Icon, props);
32
18
  IconBlock.defaultProps = blockDefaultProps;
33
19
  IconBlock.meta = {
34
20
  category: 'display',
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,25 +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
- */ function _extends() {
16
- _extends = Object.assign || function(target) {
17
- for(var i = 1; i < arguments.length; i++){
18
- var source = arguments[i];
19
- for(var key in source){
20
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21
- target[key] = source[key];
22
- }
23
- }
24
- }
25
- return target;
26
- };
27
- return _extends.apply(this, arguments);
28
- }
29
- import React from 'react';
15
+ */ import React from 'react';
30
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
31
- const ImgBlock = ({ blockId , events , properties , methods })=>{
32
- const { style , ...allProps } = properties;
33
- return /*#__PURE__*/ React.createElement("img", _extends({}, allProps, {
17
+ const ImgBlock = ({ blockId, events, properties, methods })=>{
18
+ const { style, ...allProps } = properties;
19
+ return /*#__PURE__*/ React.createElement("img", {
20
+ ...allProps,
34
21
  id: blockId,
35
22
  "data-testid": blockId,
36
23
  onClick: ()=>methods.triggerEvent({
@@ -43,7 +30,7 @@ const ImgBlock = ({ blockId , events , properties , methods })=>{
43
30
  },
44
31
  style
45
32
  ])
46
- }));
33
+ });
47
34
  };
48
35
  ImgBlock.defaultProps = blockDefaultProps;
49
36
  ImgBlock.meta = {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
15
15
  */ import React, { useEffect } from 'react';
16
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  import Box from '../Box/Box.js';
18
- const List = ({ blockId , events , list , methods , properties })=>{
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);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
- const Span = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ React.createElement("span", {
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({
package/dist/blocks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable import/namespace */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
16
16
  const icons = {};
17
17
  const styles = {};
18
18
  Object.keys(blocks).forEach((block)=>{
19
- icons[block] = blocks[block].meta.icons || [];
20
- styles[block] = blocks[block].meta.styles || [];
19
+ icons[block] = blocks[block].meta.icons ?? [];
20
+ styles[block] = blocks[block].meta.styles ?? [];
21
21
  });
22
22
  export default {
23
23
  blocks: Object.keys(blocks),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-basic",
3
- "version": "4.0.0-rc.8",
3
+ "version": "4.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Basic html Lowdefy blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -39,37 +39,35 @@
39
39
  "files": [
40
40
  "dist/*"
41
41
  ],
42
- "scripts": {
43
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
44
- "clean": "rm -rf dist",
45
- "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
46
- "prepublishOnly": "pnpm build",
47
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
48
- },
49
42
  "dependencies": {
50
- "@lowdefy/block-utils": "4.0.0-rc.8",
51
- "@lowdefy/helpers": "4.0.0-rc.8",
52
- "dompurify": "2.4.1",
43
+ "@lowdefy/block-utils": "4.0.0",
44
+ "@lowdefy/helpers": "4.0.0",
45
+ "dompurify": "3.0.6",
53
46
  "react": "18.2.0",
54
47
  "react-dom": "18.2.0"
55
48
  },
56
49
  "devDependencies": {
57
50
  "@emotion/jest": "11.10.5",
58
- "@lowdefy/block-dev": "4.0.0-rc.8",
59
- "@lowdefy/jest-yaml-transform": "4.0.0-rc.8",
60
- "@swc/cli": "0.1.59",
61
- "@swc/core": "1.3.24",
62
- "@swc/jest": "0.2.24",
51
+ "@lowdefy/block-dev": "4.0.0",
52
+ "@lowdefy/jest-yaml-transform": "4.0.0",
53
+ "@swc/cli": "0.1.63",
54
+ "@swc/core": "1.3.99",
55
+ "@swc/jest": "0.2.29",
63
56
  "@testing-library/dom": "8.19.1",
64
57
  "@testing-library/react": "13.4.0",
65
58
  "@testing-library/user-event": "14.4.3",
66
59
  "copyfiles": "2.4.1",
67
- "jest": "28.1.0",
68
- "jest-environment-jsdom": "28.1.0",
60
+ "jest": "28.1.3",
61
+ "jest-environment-jsdom": "28.1.3",
69
62
  "jest-serializer-html": "7.1.0"
70
63
  },
71
64
  "publishConfig": {
72
65
  "access": "public"
73
66
  },
74
- "gitHead": "db883daef0443647439b6fe2db845b846ffb6d4e"
75
- }
67
+ "scripts": {
68
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
69
+ "clean": "rm -rf dist",
70
+ "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
71
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
72
+ }
73
+ }