@lowdefy/blocks-basic 5.6.0 → 6.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/blocks/Anchor/gallery.yaml +316 -0
- package/dist/blocks/Anchor/tests/Anchor.e2e.yaml +78 -0
- package/dist/blocks/Anchor/tests.yaml +109 -0
- package/dist/blocks/Box/gallery.yaml +1369 -0
- package/dist/blocks/Box/tests/Box.e2e.yaml +78 -0
- package/dist/blocks/Box/tests.yaml +43 -0
- package/dist/blocks/ClickableHtml/ClickableHtml.js +53 -0
- package/dist/blocks/ClickableHtml/e2e.js +23 -0
- package/dist/blocks/ClickableHtml/gallery.yaml +113 -0
- package/dist/blocks/ClickableHtml/meta.js +40 -0
- package/dist/blocks/ClickableHtml/tests/ClickableHtml.e2e.yaml +69 -0
- package/dist/blocks/ClickableHtml/tests.yaml +35 -0
- package/dist/blocks/DangerousHtml/gallery.yaml +182 -0
- package/dist/blocks/DangerousHtml/tests/DangerousHtml.e2e.yaml +33 -0
- package/dist/blocks/DangerousHtml/tests.yaml +83 -0
- package/dist/blocks/Dynamic/Dynamic.js +35 -0
- package/dist/blocks/Dynamic/e2e.js +16 -0
- package/dist/blocks/Dynamic/meta.js +76 -0
- package/dist/blocks/Html/gallery.yaml +239 -0
- package/dist/blocks/Html/tests/Html.e2e.yaml +56 -0
- package/dist/blocks/Html/tests.yaml +75 -0
- package/dist/blocks/Icon/gallery.yaml +702 -0
- package/dist/blocks/Icon/tests/Icon.e2e.yaml +43 -0
- package/dist/blocks/Icon/tests.yaml +54 -0
- package/dist/blocks/Img/gallery.yaml +446 -0
- package/dist/blocks/Img/tests/Img.e2e.yaml +61 -0
- package/dist/blocks/Img/tests.yaml +74 -0
- package/dist/blocks/List/gallery.yaml +523 -0
- package/dist/blocks/List/tests/List.e2e.yaml +199 -0
- package/dist/blocks/List/tests.yaml +471 -0
- package/dist/blocks/Span/gallery.yaml +664 -0
- package/dist/blocks/Span/tests/Span.e2e.yaml +59 -0
- package/dist/blocks/Span/tests.yaml +43 -0
- package/dist/blocks/Throw/gallery.yaml +40 -0
- package/dist/blocks/Throw/tests.yaml +20 -0
- package/dist/blocks.js +2 -0
- package/dist/e2e.js +2 -0
- package/dist/metas.js +2 -0
- package/package.json +10 -10
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
id: dangeroushtml
|
|
16
|
+
type: Box
|
|
17
|
+
|
|
18
|
+
blocks:
|
|
19
|
+
- id: dangeroushtml_basic
|
|
20
|
+
type: DangerousHtml
|
|
21
|
+
properties:
|
|
22
|
+
html: <p>Basic dangerous HTML content</p>
|
|
23
|
+
|
|
24
|
+
- id: dangeroushtml_iframe
|
|
25
|
+
type: DangerousHtml
|
|
26
|
+
properties:
|
|
27
|
+
html: <iframe src="about:blank" title="Test iframe"></iframe>
|
|
28
|
+
DOMPurifyOptions:
|
|
29
|
+
ADD_TAGS:
|
|
30
|
+
- iframe
|
|
31
|
+
ADD_ATTR:
|
|
32
|
+
- src
|
|
33
|
+
- title
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
- id: default
|
|
16
|
+
type: DangerousHtml
|
|
17
|
+
- id: properties.html
|
|
18
|
+
type: Html
|
|
19
|
+
properties:
|
|
20
|
+
html: |
|
|
21
|
+
<div style="background: green; padding: 10px;">Content green background</div>
|
|
22
|
+
- id: properties.style
|
|
23
|
+
type: DangerousHtml
|
|
24
|
+
properties:
|
|
25
|
+
style:
|
|
26
|
+
background: yellow
|
|
27
|
+
padding: 10
|
|
28
|
+
html: |
|
|
29
|
+
<div>properties.style yellow background</div>
|
|
30
|
+
- id: properties.html-styled
|
|
31
|
+
type: DangerousHtml
|
|
32
|
+
properties:
|
|
33
|
+
style:
|
|
34
|
+
background: yellow
|
|
35
|
+
padding: 10
|
|
36
|
+
html: |
|
|
37
|
+
<div style="background: green; padding: 10px;">Content green background and properties.style yellow background</div>
|
|
38
|
+
- id: properties.html-iframe
|
|
39
|
+
type: DangerousHtml
|
|
40
|
+
properties:
|
|
41
|
+
html: |
|
|
42
|
+
No additional ADD_TAGS:
|
|
43
|
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/7N7GWdlQJlU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
|
44
|
+
- id: properties.html-DOMPurifyOptions.ADD_TAGS-iframe
|
|
45
|
+
type: DangerousHtml
|
|
46
|
+
properties:
|
|
47
|
+
DOMPurifyOptions:
|
|
48
|
+
ADD_TAGS:
|
|
49
|
+
- iframe
|
|
50
|
+
html: |
|
|
51
|
+
With iframe ADD_TAGS:
|
|
52
|
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/7N7GWdlQJlU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
|
53
|
+
- id: properties.html-bad-code
|
|
54
|
+
type: DangerousHtml
|
|
55
|
+
properties:
|
|
56
|
+
html: |
|
|
57
|
+
<h1>Link<h1>
|
|
58
|
+
|
|
59
|
+
<a href="https://lowdefy.com">Lowdefy link</a>
|
|
60
|
+
|
|
61
|
+
<font size="+10">Description</font>
|
|
62
|
+
|
|
63
|
+
<h1>Bad HTML</h1>
|
|
64
|
+
|
|
65
|
+
<div onmouseover="alert('alpha')">
|
|
66
|
+
<a href="javascript:alert('bravo')">delta</a>
|
|
67
|
+
<img src="x" onerror="alert('charlie')">
|
|
68
|
+
<iframe src="javascript:alert('delta')"></iframe>
|
|
69
|
+
<math>
|
|
70
|
+
<mi xlink:href="data:x,<script>alert('echo')</script>"></mi>
|
|
71
|
+
</math>
|
|
72
|
+
</div>
|
|
73
|
+
<script>
|
|
74
|
+
alert('script tag');
|
|
75
|
+
</script>
|
|
76
|
+
- id: properties.html is number 0
|
|
77
|
+
type: DangerousHtml
|
|
78
|
+
properties:
|
|
79
|
+
html: 0
|
|
80
|
+
- id: properties.html is boolean false
|
|
81
|
+
type: DangerousHtml
|
|
82
|
+
properties:
|
|
83
|
+
html: false
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React from 'react';
|
|
16
|
+
import { withBlockDefaults } from '@lowdefy/block-utils';
|
|
17
|
+
// Server-resolved container. The server fills the content slot at page get by
|
|
18
|
+
// calling the configured api endpoint — by the time config reaches the client,
|
|
19
|
+
// content holds the resolved blocks (or the fallback blocks on failure).
|
|
20
|
+
const Dynamic = ({ blockId, classNames, content, events, methods, styles })=>{
|
|
21
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
22
|
+
id: blockId,
|
|
23
|
+
"data-testid": blockId,
|
|
24
|
+
onClick: ()=>methods.triggerEvent({
|
|
25
|
+
name: 'onClick'
|
|
26
|
+
}),
|
|
27
|
+
className: classNames?.element,
|
|
28
|
+
style: {
|
|
29
|
+
outline: 'none',
|
|
30
|
+
cursor: events.onClick && 'pointer',
|
|
31
|
+
...styles?.element
|
|
32
|
+
}
|
|
33
|
+
}, content.content && content.content());
|
|
34
|
+
};
|
|
35
|
+
export default withBlockDefaults(Dynamic);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ // Dynamic renders a plain container div like Box — same e2e surface.
|
|
16
|
+
export { default } from '../Box/e2e.js';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
category: 'container',
|
|
17
|
+
icons: [],
|
|
18
|
+
valueType: null,
|
|
19
|
+
slots: {
|
|
20
|
+
content: 'Server-resolved blocks — filled at page get, do not define in config.',
|
|
21
|
+
fallback: 'Blocks rendered when resolution fails and required is false.'
|
|
22
|
+
},
|
|
23
|
+
cssKeys: {
|
|
24
|
+
element: 'The Dynamic element.'
|
|
25
|
+
},
|
|
26
|
+
events: {
|
|
27
|
+
onClick: 'Trigger actions when the Dynamic container is clicked.'
|
|
28
|
+
},
|
|
29
|
+
properties: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
properties: {
|
|
33
|
+
endpointId: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Required. The api endpoint that resolves this block content at page get. InternalApi endpoints are recommended.'
|
|
36
|
+
},
|
|
37
|
+
params: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
description: 'Static values passed to the endpoint payload as params. Operators are not allowed — read runtime values in the endpoint routine with _payload, _user or _secret.'
|
|
40
|
+
},
|
|
41
|
+
required: {
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
default: false,
|
|
44
|
+
description: 'When true, a resolution failure fails the whole page request instead of rendering the fallback slot.'
|
|
45
|
+
},
|
|
46
|
+
types: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
description: 'Extra block, action and operator types the endpoint may return, so build includes them in the client bundle.',
|
|
49
|
+
additionalProperties: false,
|
|
50
|
+
properties: {
|
|
51
|
+
blocks: {
|
|
52
|
+
type: 'array',
|
|
53
|
+
items: {
|
|
54
|
+
type: 'string'
|
|
55
|
+
},
|
|
56
|
+
description: 'Block types the endpoint may return.'
|
|
57
|
+
},
|
|
58
|
+
actions: {
|
|
59
|
+
type: 'array',
|
|
60
|
+
items: {
|
|
61
|
+
type: 'string'
|
|
62
|
+
},
|
|
63
|
+
description: 'Action types the endpoint may return.'
|
|
64
|
+
},
|
|
65
|
+
operators: {
|
|
66
|
+
type: 'array',
|
|
67
|
+
items: {
|
|
68
|
+
type: 'string'
|
|
69
|
+
},
|
|
70
|
+
description: 'Client operator types the endpoint may return.'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
- title: Basic HTML
|
|
16
|
+
blocks:
|
|
17
|
+
- id: basic_paragraph
|
|
18
|
+
type: Html
|
|
19
|
+
properties:
|
|
20
|
+
html: '<p>This is a paragraph rendered safely with the Html block.</p>'
|
|
21
|
+
- id: basic_heading
|
|
22
|
+
type: Html
|
|
23
|
+
properties:
|
|
24
|
+
html: '<h3>Safe Heading</h3><p>The Html block sanitizes content to prevent XSS attacks.</p>'
|
|
25
|
+
- id: basic_headings_all
|
|
26
|
+
type: Html
|
|
27
|
+
properties:
|
|
28
|
+
html: '<h4>Heading 4</h4><h5>Heading 5</h5><h6>Heading 6</h6>'
|
|
29
|
+
- id: basic_line_break
|
|
30
|
+
type: Html
|
|
31
|
+
properties:
|
|
32
|
+
html: '<p>First line<br />Second line<br />Third line</p>'
|
|
33
|
+
- id: basic_hr
|
|
34
|
+
type: Html
|
|
35
|
+
properties:
|
|
36
|
+
html: '<p>Content above</p><hr /><p>Content below the horizontal rule</p>'
|
|
37
|
+
|
|
38
|
+
- title: Text Formatting
|
|
39
|
+
blocks:
|
|
40
|
+
- id: text_bold
|
|
41
|
+
type: Html
|
|
42
|
+
properties:
|
|
43
|
+
html: '<p>Text with <strong>bold</strong> and <b>also bold</b> formatting.</p>'
|
|
44
|
+
- id: text_italic
|
|
45
|
+
type: Html
|
|
46
|
+
properties:
|
|
47
|
+
html: '<p>Text with <em>italic</em> and <i>also italic</i> formatting.</p>'
|
|
48
|
+
- id: text_underline
|
|
49
|
+
type: Html
|
|
50
|
+
properties:
|
|
51
|
+
html: '<p>Text with <u>underline</u> formatting.</p>'
|
|
52
|
+
- id: text_strikethrough
|
|
53
|
+
type: Html
|
|
54
|
+
properties:
|
|
55
|
+
html: '<p>Text with <s>strikethrough</s> and <del>deleted</del> formatting.</p>'
|
|
56
|
+
- id: text_combined
|
|
57
|
+
type: Html
|
|
58
|
+
properties:
|
|
59
|
+
html: '<p>Text with <strong><em>bold italic</em></strong>, <strong><u>bold underline</u></strong>, and <em><u>italic underline</u></em>.</p>'
|
|
60
|
+
- id: text_small
|
|
61
|
+
type: Html
|
|
62
|
+
properties:
|
|
63
|
+
html: '<p>Normal text and <small>small text</small> together.</p>'
|
|
64
|
+
- id: text_sub_sup
|
|
65
|
+
type: Html
|
|
66
|
+
properties:
|
|
67
|
+
html: '<p>H<sub>2</sub>O is water. E=mc<sup>2</sup> is relativity.</p>'
|
|
68
|
+
- id: text_mark
|
|
69
|
+
type: Html
|
|
70
|
+
properties:
|
|
71
|
+
html: '<p>This sentence has <mark>highlighted text</mark> using the mark tag.</p>'
|
|
72
|
+
|
|
73
|
+
- title: Lists
|
|
74
|
+
blocks:
|
|
75
|
+
- id: list_unordered
|
|
76
|
+
type: Html
|
|
77
|
+
properties:
|
|
78
|
+
html: '<ul><li>First item</li><li>Second item</li><li>Third item</li></ul>'
|
|
79
|
+
- id: list_ordered
|
|
80
|
+
type: Html
|
|
81
|
+
properties:
|
|
82
|
+
html: '<ol><li>Step one</li><li>Step two</li><li>Step three</li></ol>'
|
|
83
|
+
- id: list_nested
|
|
84
|
+
type: Html
|
|
85
|
+
properties:
|
|
86
|
+
html: '<ul><li>Parent item<ul><li>Child item 1</li><li>Child item 2</li></ul></li><li>Another parent item<ul><li>Another child</li></ul></li></ul>'
|
|
87
|
+
- id: list_ordered_nested
|
|
88
|
+
type: Html
|
|
89
|
+
properties:
|
|
90
|
+
html: '<ol><li>First item<ol><li>Sub-item A</li><li>Sub-item B</li></ol></li><li>Second item</li><li>Third item</li></ol>'
|
|
91
|
+
|
|
92
|
+
- title: Styled Inline Elements
|
|
93
|
+
blocks:
|
|
94
|
+
- id: styled_colored_text
|
|
95
|
+
type: Html
|
|
96
|
+
properties:
|
|
97
|
+
html: '<p><span style="color: var(--ant-color-primary);">Primary text</span>, <span style="color: var(--ant-color-success);">success text</span>, <span style="color: var(--ant-color-error);">error text</span>, and <span style="color: var(--ant-color-warning);">warning text</span>.</p>'
|
|
98
|
+
- id: styled_background
|
|
99
|
+
type: Html
|
|
100
|
+
properties:
|
|
101
|
+
html: '<p><span style="background: var(--ant-color-primary-bg); padding: 2px 6px; border-radius: 3px;">Primary highlight</span> and <span style="background: var(--ant-color-success-bg); padding: 2px 6px; border-radius: 3px;">Success highlight</span>.</p>'
|
|
102
|
+
- id: styled_sizes
|
|
103
|
+
type: Html
|
|
104
|
+
properties:
|
|
105
|
+
html: '<p><span style="font-size: 12px;">Small text</span>, <span style="font-size: 16px;">Normal text</span>, <span style="font-size: 20px;">Large text</span>, <span style="font-size: 24px;">Extra large</span>.</p>'
|
|
106
|
+
|
|
107
|
+
- title: Blockquotes
|
|
108
|
+
blocks:
|
|
109
|
+
- id: blockquote_simple
|
|
110
|
+
type: Html
|
|
111
|
+
properties:
|
|
112
|
+
html: '<blockquote>A simple blockquote with default styling.</blockquote>'
|
|
113
|
+
- id: blockquote_styled
|
|
114
|
+
type: Html
|
|
115
|
+
properties:
|
|
116
|
+
html: '<blockquote style="border-left: 4px solid var(--ant-color-primary); padding-left: 16px; margin: 0; color: var(--ant-color-text-secondary);">This is a styled blockquote with a primary color left border accent and subdued text color.</blockquote>'
|
|
117
|
+
- id: blockquote_attribution
|
|
118
|
+
type: Html
|
|
119
|
+
properties:
|
|
120
|
+
html: '<blockquote style="border-left: 4px solid var(--ant-color-border); padding-left: 16px; margin: 0;"><p style="margin: 0 0 4px 0; font-style: italic; color: var(--ant-color-text-secondary);">"The best way to predict the future is to invent it."</p><footer style="color: var(--ant-color-text-tertiary); font-size: 13px;">-- Alan Kay</footer></blockquote>'
|
|
121
|
+
|
|
122
|
+
- title: Code Blocks
|
|
123
|
+
blocks:
|
|
124
|
+
- id: code_inline
|
|
125
|
+
type: Html
|
|
126
|
+
properties:
|
|
127
|
+
html: '<p>Use the <code style="background: var(--ant-color-fill-tertiary); padding: 2px 6px; border-radius: 4px; font-family: monospace;">Html</code> block for safe HTML rendering.</p>'
|
|
128
|
+
- id: code_block
|
|
129
|
+
type: Html
|
|
130
|
+
properties:
|
|
131
|
+
html: |
|
|
132
|
+
<pre style="background: var(--ant-color-bg-elevated); color: var(--ant-color-text); padding: 16px; border-radius: 6px; overflow-x: auto; font-family: monospace; font-size: 14px; border: 1px solid var(--ant-color-border);"><code>function greet(name) {
|
|
133
|
+
return "Hello, " + name + "!";
|
|
134
|
+
}</code></pre>
|
|
135
|
+
- id: code_multi_inline
|
|
136
|
+
type: Html
|
|
137
|
+
properties:
|
|
138
|
+
html: '<p>Set <code style="background: var(--ant-color-fill-tertiary); padding: 2px 6px; border-radius: 4px; font-family: monospace;">type</code> to <code style="background: var(--ant-color-fill-tertiary); padding: 2px 6px; border-radius: 4px; font-family: monospace;">Html</code> and provide the <code style="background: var(--ant-color-fill-tertiary); padding: 2px 6px; border-radius: 4px; font-family: monospace;">html</code> property.</p>'
|
|
139
|
+
|
|
140
|
+
- title: Links
|
|
141
|
+
blocks:
|
|
142
|
+
- id: link_basic
|
|
143
|
+
type: Html
|
|
144
|
+
properties:
|
|
145
|
+
html: '<p>Visit <a href="https://lowdefy.com">Lowdefy</a> for more information.</p>'
|
|
146
|
+
- id: link_styled
|
|
147
|
+
type: Html
|
|
148
|
+
properties:
|
|
149
|
+
html: '<p><a href="https://lowdefy.com" style="color: var(--ant-color-primary); text-decoration: none; font-weight: bold;">Primary styled link</a> within a paragraph.</p>'
|
|
150
|
+
- id: link_multiple
|
|
151
|
+
type: Html
|
|
152
|
+
properties:
|
|
153
|
+
html: '<p>Resources: <a href="https://lowdefy.com">Home</a> | <a href="https://docs.lowdefy.com">Docs</a> | <a href="https://github.com/lowdefy/lowdefy">GitHub</a></p>'
|
|
154
|
+
|
|
155
|
+
- title: Nested Elements
|
|
156
|
+
blocks:
|
|
157
|
+
- id: nested_section
|
|
158
|
+
type: Html
|
|
159
|
+
properties:
|
|
160
|
+
html: '<div><h4>Section Title</h4><p>A paragraph with a <a href="https://lowdefy.com">safe link</a> inside it.</p><hr /><p>Content below the horizontal rule.</p></div>'
|
|
161
|
+
- id: nested_formatted_list
|
|
162
|
+
type: Html
|
|
163
|
+
properties:
|
|
164
|
+
html: '<div><h4>Features</h4><ul><li><strong>Fast:</strong> Optimized rendering</li><li><strong>Safe:</strong> XSS protection built-in</li><li><strong>Flexible:</strong> Supports many HTML tags</li></ul></div>'
|
|
165
|
+
- id: nested_mixed
|
|
166
|
+
type: Html
|
|
167
|
+
properties:
|
|
168
|
+
html: '<div><p>This block mixes <strong>bold</strong>, <em>italic</em>, and <code style="background: var(--ant-color-fill-tertiary); padding: 2px 4px; border-radius: 3px;">code</code> formatting.</p><blockquote style="border-left: 3px solid var(--ant-color-border); padding-left: 12px; margin: 12px 0; color: var(--ant-color-text-secondary);">It also includes a blockquote with <strong>bold text</strong>.</blockquote><ol><li>And a numbered list</li><li>With multiple items</li></ol></div>'
|
|
169
|
+
|
|
170
|
+
- title: Tables
|
|
171
|
+
blocks:
|
|
172
|
+
- id: table_simple
|
|
173
|
+
type: Html
|
|
174
|
+
properties:
|
|
175
|
+
html: '<table style="width: 100%; border-collapse: collapse;"><thead><tr><th style="border: 1px solid var(--ant-color-border); padding: 8px; background: var(--ant-color-fill-quaternary); text-align: left;">Feature</th><th style="border: 1px solid var(--ant-color-border); padding: 8px; background: var(--ant-color-fill-quaternary); text-align: left;">Status</th></tr></thead><tbody><tr><td style="border: 1px solid var(--ant-color-border); padding: 8px;">Html block</td><td style="border: 1px solid var(--ant-color-border); padding: 8px;">Safe</td></tr><tr><td style="border: 1px solid var(--ant-color-border); padding: 8px;">DangerousHtml</td><td style="border: 1px solid var(--ant-color-border); padding: 8px;">Powerful</td></tr></tbody></table>'
|
|
176
|
+
|
|
177
|
+
- title: Style Overrides
|
|
178
|
+
blocks:
|
|
179
|
+
- id: style_padded
|
|
180
|
+
type: Html
|
|
181
|
+
style:
|
|
182
|
+
.element:
|
|
183
|
+
padding: 20
|
|
184
|
+
background: var(--ant-color-primary-bg)
|
|
185
|
+
borderRadius: 8
|
|
186
|
+
properties:
|
|
187
|
+
html: '<p style="margin: 0;">Content inside a styled Html container with primary background.</p>'
|
|
188
|
+
- id: style_bordered
|
|
189
|
+
type: Html
|
|
190
|
+
style:
|
|
191
|
+
.element:
|
|
192
|
+
border: 2px solid var(--ant-color-primary)
|
|
193
|
+
padding: 16
|
|
194
|
+
borderRadius: 8
|
|
195
|
+
properties:
|
|
196
|
+
html: '<p style="margin: 0;">Content with a primary color border applied via style override.</p>'
|
|
197
|
+
- id: style_shadow
|
|
198
|
+
type: Html
|
|
199
|
+
style:
|
|
200
|
+
.element:
|
|
201
|
+
padding: 20
|
|
202
|
+
borderRadius: 12
|
|
203
|
+
boxShadow: var(--ant-box-shadow)
|
|
204
|
+
background: var(--ant-color-bg-container)
|
|
205
|
+
properties:
|
|
206
|
+
html: '<h4 style="margin: 0 0 8px 0;">Elevated Html Block</h4><p style="margin: 0; color: var(--ant-color-text-secondary);">An Html block styled with box-shadow for an elevated card look.</p>'
|
|
207
|
+
- id: style_max_width
|
|
208
|
+
type: Html
|
|
209
|
+
style:
|
|
210
|
+
.element:
|
|
211
|
+
maxWidth: 350
|
|
212
|
+
margin: 0 auto
|
|
213
|
+
textAlign: center
|
|
214
|
+
padding: 16
|
|
215
|
+
background: var(--ant-color-success-bg)
|
|
216
|
+
borderRadius: 8
|
|
217
|
+
properties:
|
|
218
|
+
html: '<p style="margin: 0; color: var(--ant-color-success); font-weight: bold;">Centered and constrained width.</p>'
|
|
219
|
+
- id: style_left_accent
|
|
220
|
+
type: Html
|
|
221
|
+
style:
|
|
222
|
+
.element:
|
|
223
|
+
borderLeft: 4px solid var(--ant-color-warning)
|
|
224
|
+
paddingLeft: 16
|
|
225
|
+
paddingTop: 8
|
|
226
|
+
paddingBottom: 8
|
|
227
|
+
properties:
|
|
228
|
+
html: '<p style="margin: 0; color: var(--ant-color-warning); font-weight: 500;">Warning accent border on the left side.</p>'
|
|
229
|
+
- id: style_elevated
|
|
230
|
+
type: Html
|
|
231
|
+
style:
|
|
232
|
+
.element:
|
|
233
|
+
background: var(--ant-color-bg-elevated)
|
|
234
|
+
color: var(--ant-color-text)
|
|
235
|
+
padding: 20
|
|
236
|
+
borderRadius: 8
|
|
237
|
+
border: 1px solid var(--ant-color-border)
|
|
238
|
+
properties:
|
|
239
|
+
html: '<h4 style="margin: 0 0 8px 0;">Elevated Block</h4><p style="margin: 0;">Uses bg-elevated token for a surface that adapts to light and dark mode.</p>'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
id: html
|
|
16
|
+
type: Box
|
|
17
|
+
|
|
18
|
+
blocks:
|
|
19
|
+
- id: html_basic
|
|
20
|
+
type: Html
|
|
21
|
+
properties:
|
|
22
|
+
html: <p>Hello World</p>
|
|
23
|
+
|
|
24
|
+
- id: html_styled
|
|
25
|
+
type: Html
|
|
26
|
+
properties:
|
|
27
|
+
html: <p>Styled content</p>
|
|
28
|
+
style:
|
|
29
|
+
backgroundColor: rgb(240, 240, 240)
|
|
30
|
+
padding: 10px
|
|
31
|
+
|
|
32
|
+
- id: html_complex
|
|
33
|
+
type: Html
|
|
34
|
+
properties:
|
|
35
|
+
html: |
|
|
36
|
+
<div>
|
|
37
|
+
<h1>Title</h1>
|
|
38
|
+
<p>Paragraph with <strong>bold</strong> text</p>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
- id: html_sanitized
|
|
42
|
+
type: Html
|
|
43
|
+
properties:
|
|
44
|
+
html: <p>Safe content</p><script>alert('xss')</script>
|
|
45
|
+
|
|
46
|
+
- id: html_selection
|
|
47
|
+
type: Html
|
|
48
|
+
properties:
|
|
49
|
+
html: <p>Select this text to trigger event</p>
|
|
50
|
+
events:
|
|
51
|
+
onTextSelection:
|
|
52
|
+
- id: set_selection
|
|
53
|
+
type: SetState
|
|
54
|
+
params:
|
|
55
|
+
selected_text:
|
|
56
|
+
_event: selectedText
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
- id: default
|
|
16
|
+
type: Html
|
|
17
|
+
- id: properties.html
|
|
18
|
+
type: Html
|
|
19
|
+
properties:
|
|
20
|
+
html: |
|
|
21
|
+
<div style="background: green; padding: 10px;">Content green background</div>
|
|
22
|
+
- id: properties.style
|
|
23
|
+
type: Html
|
|
24
|
+
properties:
|
|
25
|
+
style:
|
|
26
|
+
background: yellow
|
|
27
|
+
padding: 10
|
|
28
|
+
html: |
|
|
29
|
+
<div>properties.style yellow background</div>
|
|
30
|
+
- id: properties.html-styled
|
|
31
|
+
type: Html
|
|
32
|
+
properties:
|
|
33
|
+
style:
|
|
34
|
+
background: yellow
|
|
35
|
+
padding: 10
|
|
36
|
+
html: |
|
|
37
|
+
<div style="background: green; padding: 10px;">Content green background and properties.style yellow background</div>
|
|
38
|
+
- id: properties.html-iframe
|
|
39
|
+
type: Html
|
|
40
|
+
properties:
|
|
41
|
+
html: |
|
|
42
|
+
An iframe:
|
|
43
|
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/7N7GWdlQJlU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
|
44
|
+
- id: properties.html-bad-code
|
|
45
|
+
type: Html
|
|
46
|
+
properties:
|
|
47
|
+
html: |
|
|
48
|
+
<h1>Link<h1>
|
|
49
|
+
|
|
50
|
+
<a href="https://lowdefy.com">Lowdefy link</a>
|
|
51
|
+
|
|
52
|
+
<font size="+10">Description</font>
|
|
53
|
+
|
|
54
|
+
<h1>Bad HTML</h1>
|
|
55
|
+
|
|
56
|
+
<div onmouseover="alert('alpha')">
|
|
57
|
+
<a href="javascript:alert('bravo')">delta</a>
|
|
58
|
+
<img src="x" onerror="alert('charlie')">
|
|
59
|
+
<iframe src="javascript:alert('delta')"></iframe>
|
|
60
|
+
<math>
|
|
61
|
+
<mi xlink:href="data:x,<script>alert('echo')</script>"></mi>
|
|
62
|
+
</math>
|
|
63
|
+
</div>
|
|
64
|
+
<script>
|
|
65
|
+
alert('script tag');
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
- id: properties.html is number 0
|
|
69
|
+
type: Html
|
|
70
|
+
properties:
|
|
71
|
+
html: 0
|
|
72
|
+
- id: properties.html is boolean false
|
|
73
|
+
type: Html
|
|
74
|
+
properties:
|
|
75
|
+
html: false
|