@lowdefy/blocks-basic 0.0.0-experimental-20260928120643 → 0.0.0-experimental-20260929110023

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.
@@ -13,17 +13,21 @@
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 { isEventFromDomDescendant, withBlockDefaults } from '@lowdefy/block-utils';
17
17
  const Box = ({ blockId, classNames, content, events, methods, properties, styles })=>{
18
18
  return /*#__PURE__*/ React.createElement("div", {
19
19
  id: blockId,
20
20
  "data-testid": blockId,
21
- onClick: ()=>methods.triggerEvent({
21
+ onClick: (event)=>{
22
+ if (isEventFromDomDescendant(event)) methods.triggerEvent({
22
23
  name: 'onClick'
23
- }),
24
- onPaste: ()=>methods.triggerEvent({
24
+ });
25
+ },
26
+ onPaste: (event)=>{
27
+ if (isEventFromDomDescendant(event)) methods.triggerEvent({
25
28
  name: 'onPaste'
26
- }),
29
+ });
30
+ },
27
31
  className: classNames?.element,
28
32
  style: {
29
33
  outline: 'none',
@@ -76,3 +76,65 @@ blocks:
76
76
  type: SetState
77
77
  params:
78
78
  clicked: true
79
+
80
+ # Test 7: nested clickable Boxes. The inner Box handles the click, so the outer Box does not
81
+ # fire unless the inner event sets bubble: true.
82
+ - id: box_nested_outer
83
+ type: Box
84
+ style:
85
+ padding: 20px
86
+ events:
87
+ onClick:
88
+ - id: set_outer_clicked
89
+ type: SetState
90
+ params:
91
+ outer_clicks:
92
+ _sum:
93
+ - _if_none:
94
+ - _state: outer_clicks
95
+ - 0
96
+ - 1
97
+ blocks:
98
+ - id: box_nested_inner
99
+ type: Box
100
+ properties:
101
+ content: Inner
102
+ events:
103
+ onClick:
104
+ - id: set_inner_clicked
105
+ type: SetState
106
+ params:
107
+ inner_clicked: true
108
+ - id: box_nested_inner_bubble
109
+ type: Box
110
+ properties:
111
+ content: Inner bubble
112
+ events:
113
+ onClick:
114
+ bubble: true
115
+ try:
116
+ - id: set_inner_bubble_clicked
117
+ type: SetState
118
+ params:
119
+ inner_bubble_clicked: true
120
+ - id: box_nested_plain
121
+ type: Box
122
+ properties:
123
+ content: Plain child
124
+ - id: box_nested_display
125
+ type: Box
126
+ properties:
127
+ content:
128
+ _string.concat:
129
+ - 'outer='
130
+ - _if_none:
131
+ - _state: outer_clicks
132
+ - 0
133
+ - ' inner='
134
+ - _if_none:
135
+ - _state: inner_clicked
136
+ - false
137
+ - ' bubble='
138
+ - _if_none:
139
+ - _state: inner_bubble_clicked
140
+ - false
@@ -13,7 +13,7 @@
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 { isEventFromDomDescendant, withBlockDefaults } from '@lowdefy/block-utils';
17
17
  // Server-resolved container. The server fills the content slot at page get by
18
18
  // calling the configured api endpoint — by the time config reaches the client,
19
19
  // content holds the resolved blocks (or the fallback blocks on failure).
@@ -21,9 +21,11 @@ const Dynamic = ({ blockId, classNames, content, events, methods, styles })=>{
21
21
  return /*#__PURE__*/ React.createElement("div", {
22
22
  id: blockId,
23
23
  "data-testid": blockId,
24
- onClick: ()=>methods.triggerEvent({
24
+ onClick: (event)=>{
25
+ if (isEventFromDomDescendant(event)) methods.triggerEvent({
25
26
  name: 'onClick'
26
- }),
27
+ });
28
+ },
27
29
  className: classNames?.element,
28
30
  style: {
29
31
  outline: 'none',
@@ -13,13 +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 { isEventFromDomDescendant, withBlockDefaults } from '@lowdefy/block-utils';
17
17
  const Span = ({ blockId, classNames, content, events, methods, properties, styles })=>/*#__PURE__*/ React.createElement("span", {
18
18
  id: blockId,
19
19
  "data-testid": blockId,
20
- onClick: ()=>methods.triggerEvent({
20
+ onClick: (event)=>{
21
+ if (isEventFromDomDescendant(event)) methods.triggerEvent({
21
22
  name: 'onClick'
22
- }),
23
+ });
24
+ },
23
25
  className: classNames?.element,
24
26
  style: {
25
27
  outline: 'none',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-basic",
3
- "version": "0.0.0-experimental-20260928120643",
3
+ "version": "0.0.0-experimental-20260929110023",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Basic html Lowdefy blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -45,8 +45,8 @@
45
45
  "dist/*"
46
46
  ],
47
47
  "dependencies": {
48
- "@lowdefy/block-utils": "0.0.0-experimental-20260928120643",
49
- "@lowdefy/helpers": "0.0.0-experimental-20260928120643",
48
+ "@lowdefy/block-utils": "0.0.0-experimental-20260929110023",
49
+ "@lowdefy/helpers": "0.0.0-experimental-20260929110023",
50
50
  "dompurify": "3.4.13"
51
51
  },
52
52
  "peerDependencies": {
@@ -54,8 +54,8 @@
54
54
  "react-dom": ">=18"
55
55
  },
56
56
  "devDependencies": {
57
- "@lowdefy/block-dev-e2e": "0.0.0-experimental-20260928120643",
58
- "@lowdefy/e2e-utils": "0.0.0-experimental-20260928120643",
57
+ "@lowdefy/block-dev-e2e": "0.0.0-experimental-20260929110023",
58
+ "@lowdefy/e2e-utils": "0.0.0-experimental-20260929110023",
59
59
  "@playwright/test": "1.59.1",
60
60
  "@swc/cli": "0.8.1",
61
61
  "@swc/core": "1.15.32",