@onetype/framework 2.0.39 → 2.0.41
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/addons/render/transforms/item/functions/run.js +6 -2
- package/lib/load.js +0 -1
- package/package.json +1 -1
- package/lib/items/transforms/accordion/accordion.js +0 -172
- package/lib/items/transforms/chart/area.js +0 -153
- package/lib/items/transforms/chart/bar.js +0 -137
- package/lib/items/transforms/chart/bubble.js +0 -166
- package/lib/items/transforms/chart/doughnut.js +0 -124
- package/lib/items/transforms/chart/line.js +0 -149
- package/lib/items/transforms/chart/pie.js +0 -122
- package/lib/items/transforms/chart/radar.js +0 -154
- package/lib/items/transforms/chart/scatter.js +0 -149
- package/lib/items/transforms/codeflask/codeflask.js +0 -97
- package/lib/items/transforms/codemirror/codemirror.js +0 -228
- package/lib/items/transforms/comparison/comparison.js +0 -139
- package/lib/items/transforms/heatmap/heatmap.js +0 -493
- package/lib/items/transforms/interact/interact.js +0 -276
- package/lib/items/transforms/particles/particles.js +0 -328
- package/lib/items/transforms/sparkline/sparkline.js +0 -239
- package/lib/items/transforms/swiper/swiper.js +0 -140
- package/lib/items/transforms/tabs/tabs.js +0 -459
- package/lib/items/transforms/typed/typed.js +0 -172
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
transforms.ItemAdd({
|
|
2
|
-
id: 'codeflask',
|
|
3
|
-
icon: 'code',
|
|
4
|
-
name: 'CodeFlask',
|
|
5
|
-
description: 'Micro code editor with syntax highlighting. Supports live editing with onUpdate handler.',
|
|
6
|
-
js: [
|
|
7
|
-
'https://cdn.jsdelivr.net/npm/codeflask/build/codeflask.min.js'
|
|
8
|
-
],
|
|
9
|
-
config: {
|
|
10
|
-
'value': ['string', ''],
|
|
11
|
-
'language': ['string', 'markup'],
|
|
12
|
-
'line-numbers': ['boolean', true],
|
|
13
|
-
'readonly': ['boolean', false],
|
|
14
|
-
'onUpdate': ['function']
|
|
15
|
-
},
|
|
16
|
-
code: function(data, node, transformer)
|
|
17
|
-
{
|
|
18
|
-
this.setup = () =>
|
|
19
|
-
{
|
|
20
|
-
node.classList.add('codeflask-editor');
|
|
21
|
-
node.classList.add('codeflask-editor-' + identifier);
|
|
22
|
-
|
|
23
|
-
const initialValue = data['value'] || node.textContent || '';
|
|
24
|
-
node.innerHTML = '';
|
|
25
|
-
|
|
26
|
-
this.container = document.createElement('div');
|
|
27
|
-
this.container.className = 'codeflask-container';
|
|
28
|
-
node.appendChild(this.container);
|
|
29
|
-
|
|
30
|
-
this.initialValue = initialValue;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
this.styles = () =>
|
|
34
|
-
{
|
|
35
|
-
const style = document.createElement('style');
|
|
36
|
-
style.textContent = `
|
|
37
|
-
.codeflask-editor-${id}
|
|
38
|
-
{
|
|
39
|
-
height: 100%;
|
|
40
|
-
width: 100%;
|
|
41
|
-
}
|
|
42
|
-
.codeflask-editor-${id} .codeflask-container
|
|
43
|
-
{
|
|
44
|
-
height: 100%;
|
|
45
|
-
width: 100%;
|
|
46
|
-
}
|
|
47
|
-
.codeflask-editor-${id} .codeflask
|
|
48
|
-
{
|
|
49
|
-
height: 100%;
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
document.head.appendChild(style);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
this.initialize = () =>
|
|
56
|
-
{
|
|
57
|
-
setTimeout(() =>
|
|
58
|
-
{
|
|
59
|
-
if(typeof CodeFlask === 'undefined')
|
|
60
|
-
{
|
|
61
|
-
console.error('CodeFlask library not loaded');
|
|
62
|
-
node.innerHTML = '<div style="padding: 20px;">CodeFlask not loaded</div>';
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const flask = new CodeFlask(this.container, {
|
|
67
|
-
language: data['language'] || 'markup',
|
|
68
|
-
lineNumbers: data['line-numbers'] !== false,
|
|
69
|
-
readonly: data['readonly'] === true
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
flask.updateCode(this.initialValue);
|
|
73
|
-
|
|
74
|
-
this.flask = flask;
|
|
75
|
-
|
|
76
|
-
flask.onUpdate((code) =>
|
|
77
|
-
{
|
|
78
|
-
// const onUpdate = data['onUpdate'];
|
|
79
|
-
// if(typeof onUpdate === 'function')
|
|
80
|
-
// {
|
|
81
|
-
// onUpdate({value: code, node});
|
|
82
|
-
// }
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
node.getValue = () => flask.getCode();
|
|
86
|
-
node.setValue = (value) => flask.updateCode(value);
|
|
87
|
-
node.setLanguage = (language) => flask.updateLanguage(language);
|
|
88
|
-
|
|
89
|
-
}, 200);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
this.setup();
|
|
93
|
-
this.styles();
|
|
94
|
-
this.initialize();
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
transforms.ItemAdd({
|
|
2
|
-
id: 'codemirror',
|
|
3
|
-
icon: 'code',
|
|
4
|
-
name: 'Code Mirror',
|
|
5
|
-
description: 'Advanced code editor with syntax highlighting. Supports multiple languages and themes.',
|
|
6
|
-
js: [
|
|
7
|
-
'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.16/codemirror.min.js',
|
|
8
|
-
|
|
9
|
-
],
|
|
10
|
-
css: [
|
|
11
|
-
'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.16/codemirror.min.css',
|
|
12
|
-
'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.16/theme/monokai.min.css',
|
|
13
|
-
'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.16/theme/dracula.min.css',
|
|
14
|
-
'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.16/theme/material.min.css'
|
|
15
|
-
],
|
|
16
|
-
config: {
|
|
17
|
-
'value': ['string', '// Welcome to CodeMirror\nfunction hello() {\n console.log("Hello, World!");\n}\n\nhello();'],
|
|
18
|
-
'mode': ['string', 'javascript'],
|
|
19
|
-
'theme': ['string', 'monokai'],
|
|
20
|
-
'height': ['number', 400],
|
|
21
|
-
'line-numbers': ['boolean', true],
|
|
22
|
-
'line-wrapping': ['boolean', false],
|
|
23
|
-
'tab-size': ['number', 4],
|
|
24
|
-
'indent-unit': ['number', 4],
|
|
25
|
-
'font-size': ['number', 14],
|
|
26
|
-
'readonly': ['boolean', false],
|
|
27
|
-
'auto-close-brackets': ['boolean', true],
|
|
28
|
-
'match-brackets': ['boolean', true],
|
|
29
|
-
'highlight-active-line': ['boolean', true],
|
|
30
|
-
'smart-indent': ['boolean', true],
|
|
31
|
-
'electric-chars': ['boolean', true],
|
|
32
|
-
'show-cursor-when-selecting': ['boolean', false]
|
|
33
|
-
},
|
|
34
|
-
code: function(data, node, transformer)
|
|
35
|
-
{
|
|
36
|
-
this.setup = () =>
|
|
37
|
-
{
|
|
38
|
-
// Clear existing content
|
|
39
|
-
node.innerHTML = '';
|
|
40
|
-
|
|
41
|
-
// Add codemirror wrapper class
|
|
42
|
-
node.classList.add('codemirror-wrapper');
|
|
43
|
-
|
|
44
|
-
// Create textarea element
|
|
45
|
-
const textarea = document.createElement('textarea');
|
|
46
|
-
textarea.id = 'codemirror-' + Math.random().toString(36).substring(2, 11);
|
|
47
|
-
textarea.value = data['value'] || '';
|
|
48
|
-
|
|
49
|
-
// Store textarea reference
|
|
50
|
-
this.textarea = textarea;
|
|
51
|
-
|
|
52
|
-
// Apply wrapper styles
|
|
53
|
-
const height = data['height'];
|
|
54
|
-
node.style.height = height + 'px';
|
|
55
|
-
node.style.border = '1px solid #e0e0e0';
|
|
56
|
-
node.style.borderRadius = '4px';
|
|
57
|
-
node.style.overflow = 'hidden';
|
|
58
|
-
|
|
59
|
-
// Append textarea to node
|
|
60
|
-
node.appendChild(textarea);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
this.config = () =>
|
|
64
|
-
{
|
|
65
|
-
const fontSize = data['font-size'];
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
value: data['value'] || '',
|
|
69
|
-
mode: data['mode'] || 'javascript',
|
|
70
|
-
theme: data['theme'] || 'monokai',
|
|
71
|
-
lineNumbers: data['line-numbers'] !== false,
|
|
72
|
-
lineWrapping: data['line-wrapping'] === true,
|
|
73
|
-
tabSize: data['tab-size'] || 4,
|
|
74
|
-
indentUnit: data['indent-unit'] || 4,
|
|
75
|
-
readOnly: data['readonly'] === true,
|
|
76
|
-
autoCloseBrackets: data['auto-close-brackets'] !== false,
|
|
77
|
-
matchBrackets: data['match-brackets'] !== false,
|
|
78
|
-
styleActiveLine: data['highlight-active-line'] !== false,
|
|
79
|
-
smartIndent: data['smart-indent'] !== false,
|
|
80
|
-
electricChars: data['electric-chars'] !== false,
|
|
81
|
-
showCursorWhenSelecting: data['show-cursor-when-selecting'] === true,
|
|
82
|
-
extraKeys: {
|
|
83
|
-
'Ctrl-Space': 'autocomplete'
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
this.applyStyles = () =>
|
|
89
|
-
{
|
|
90
|
-
const fontSize = data['font-size'];
|
|
91
|
-
|
|
92
|
-
// Apply custom font size
|
|
93
|
-
setTimeout(() =>
|
|
94
|
-
{
|
|
95
|
-
if(this.editor)
|
|
96
|
-
{
|
|
97
|
-
const wrapper = this.editor.getWrapperElement();
|
|
98
|
-
wrapper.style.fontSize = fontSize + 'px';
|
|
99
|
-
wrapper.style.fontFamily = 'Monaco, Menlo, "Ubuntu Mono", monospace';
|
|
100
|
-
}
|
|
101
|
-
}, 100);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
this.initialize = () =>
|
|
105
|
-
{
|
|
106
|
-
setTimeout(() =>
|
|
107
|
-
{
|
|
108
|
-
// Check if CodeMirror is available
|
|
109
|
-
if(typeof CodeMirror === 'undefined')
|
|
110
|
-
{
|
|
111
|
-
console.error('CodeMirror library not loaded');
|
|
112
|
-
node.innerHTML = '<div style="padding: 20px; color: #666;">CodeMirror library not available</div>';
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
try
|
|
117
|
-
{
|
|
118
|
-
// Create CodeMirror instance
|
|
119
|
-
this.editor = CodeMirror.fromTextArea(this.textarea, this.config());
|
|
120
|
-
|
|
121
|
-
// Store instance on node for external access
|
|
122
|
-
node._codeMirrorEditor = this.editor;
|
|
123
|
-
|
|
124
|
-
// Apply custom styles
|
|
125
|
-
this.applyStyles();
|
|
126
|
-
|
|
127
|
-
// Set height
|
|
128
|
-
const height = data['height'];
|
|
129
|
-
this.editor.setSize('100%', height + 'px');
|
|
130
|
-
|
|
131
|
-
// Add helper methods to node
|
|
132
|
-
node.getValue = () =>
|
|
133
|
-
{
|
|
134
|
-
return this.editor ? this.editor.getValue() : '';
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
node.setValue = (value) =>
|
|
138
|
-
{
|
|
139
|
-
if(this.editor && value !== undefined)
|
|
140
|
-
{
|
|
141
|
-
this.editor.setValue(String(value));
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
node.getMode = () =>
|
|
146
|
-
{
|
|
147
|
-
return this.editor ? this.editor.getOption('mode') : '';
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
node.setMode = (mode) =>
|
|
151
|
-
{
|
|
152
|
-
if(this.editor && mode)
|
|
153
|
-
{
|
|
154
|
-
this.editor.setOption('mode', String(mode));
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
node.setTheme = (theme) =>
|
|
159
|
-
{
|
|
160
|
-
if(this.editor && theme)
|
|
161
|
-
{
|
|
162
|
-
this.editor.setOption('theme', String(theme));
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
node.setReadOnly = (readonly) =>
|
|
167
|
-
{
|
|
168
|
-
if(this.editor)
|
|
169
|
-
{
|
|
170
|
-
this.editor.setOption('readOnly', Boolean(readonly));
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
node.refresh = () =>
|
|
175
|
-
{
|
|
176
|
-
if(this.editor)
|
|
177
|
-
{
|
|
178
|
-
setTimeout(() =>
|
|
179
|
-
{
|
|
180
|
-
this.editor.refresh();
|
|
181
|
-
}, 10);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
node.focus = () =>
|
|
186
|
-
{
|
|
187
|
-
if(this.editor)
|
|
188
|
-
{
|
|
189
|
-
this.editor.focus();
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
node.dispose = () =>
|
|
194
|
-
{
|
|
195
|
-
if(this.editor)
|
|
196
|
-
{
|
|
197
|
-
this.editor.toTextArea();
|
|
198
|
-
this.editor = null;
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
// Auto-refresh when container becomes visible
|
|
203
|
-
const observer = new IntersectionObserver((entries) =>
|
|
204
|
-
{
|
|
205
|
-
entries.forEach(entry =>
|
|
206
|
-
{
|
|
207
|
-
if(entry.isIntersecting && this.editor)
|
|
208
|
-
{
|
|
209
|
-
this.editor.refresh();
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
observer.observe(node);
|
|
215
|
-
|
|
216
|
-
console.log('CodeMirror editor initialized successfully');
|
|
217
|
-
|
|
218
|
-
} catch (error) {
|
|
219
|
-
console.error('CodeMirror initialization failed:', error);
|
|
220
|
-
node.innerHTML = '<div style="padding: 20px; color: #666;">CodeMirror initialization failed</div>';
|
|
221
|
-
}
|
|
222
|
-
}, 200);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
this.setup();
|
|
226
|
-
this.initialize();
|
|
227
|
-
}
|
|
228
|
-
});
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
transforms.ItemAdd({
|
|
2
|
-
id: 'comparison',
|
|
3
|
-
icon: 'compare_arrows',
|
|
4
|
-
name: 'Comparison',
|
|
5
|
-
description: 'Side-by-side comparison widget. Compare features, prices, or data in an interactive layout.',
|
|
6
|
-
js: [
|
|
7
|
-
'https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/index.js'
|
|
8
|
-
],
|
|
9
|
-
css: [
|
|
10
|
-
'https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/styles.css'
|
|
11
|
-
],
|
|
12
|
-
config: {
|
|
13
|
-
'before-image': ['string', 'https://images.pexels.com/photos/3225517/pexels-photo-3225517.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'],
|
|
14
|
-
'after-image': ['string', 'https://images.pexels.com/photos/3408744/pexels-photo-3408744.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'],
|
|
15
|
-
'before-label': ['string', 'Before'],
|
|
16
|
-
'after-label': ['string', 'After'],
|
|
17
|
-
'start-position': ['number', 50],
|
|
18
|
-
'hover-enabled': ['boolean', true],
|
|
19
|
-
'handle-color': ['string', '#ffffff'],
|
|
20
|
-
'divider-color': ['string', '#ffffff'],
|
|
21
|
-
'divider-width': ['number', 2],
|
|
22
|
-
'keyboard-enabled': ['boolean', true]
|
|
23
|
-
},
|
|
24
|
-
code: function(data, node, transformer)
|
|
25
|
-
{
|
|
26
|
-
this.setup = () =>
|
|
27
|
-
{
|
|
28
|
-
// Create the custom element wrapper
|
|
29
|
-
const slider = document.createElement('img-comparison-slider');
|
|
30
|
-
|
|
31
|
-
// Create before image
|
|
32
|
-
const beforeImage = document.createElement('img');
|
|
33
|
-
beforeImage.setAttribute('slot', 'first');
|
|
34
|
-
beforeImage.src = data['before-image'];
|
|
35
|
-
beforeImage.alt = data['before-label'];
|
|
36
|
-
|
|
37
|
-
// Create after image
|
|
38
|
-
const afterImage = document.createElement('img');
|
|
39
|
-
afterImage.setAttribute('slot', 'second');
|
|
40
|
-
afterImage.src = data['after-image'];
|
|
41
|
-
afterImage.alt = data['after-label'];
|
|
42
|
-
|
|
43
|
-
// Append images to slider
|
|
44
|
-
slider.appendChild(beforeImage);
|
|
45
|
-
slider.appendChild(afterImage);
|
|
46
|
-
|
|
47
|
-
// Clear node and append slider
|
|
48
|
-
node.innerHTML = '';
|
|
49
|
-
node.appendChild(slider);
|
|
50
|
-
|
|
51
|
-
// Store reference for later configuration
|
|
52
|
-
this.slider = slider;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
this.labels = () =>
|
|
56
|
-
{
|
|
57
|
-
const beforeLabel = data['before-label'];
|
|
58
|
-
const afterLabel = data['after-label'];
|
|
59
|
-
|
|
60
|
-
if(beforeLabel && beforeLabel !== 'Before')
|
|
61
|
-
{
|
|
62
|
-
this.slider.setAttribute('data-first-label', beforeLabel);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if(afterLabel && afterLabel !== 'After')
|
|
66
|
-
{
|
|
67
|
-
this.slider.setAttribute('data-second-label', afterLabel);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
this.styles = () =>
|
|
72
|
-
{
|
|
73
|
-
const handleColor = data['handle-color'];
|
|
74
|
-
const dividerColor = data['divider-color'];
|
|
75
|
-
const dividerWidth = data['divider-width'];
|
|
76
|
-
|
|
77
|
-
const styles = [];
|
|
78
|
-
|
|
79
|
-
if(handleColor !== '#ffffff')
|
|
80
|
-
{
|
|
81
|
-
styles.push(`--handle-color: ${handleColor}`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if(dividerColor !== '#ffffff')
|
|
85
|
-
{
|
|
86
|
-
styles.push(`--divider-color: ${dividerColor}`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if(dividerWidth !== 2)
|
|
90
|
-
{
|
|
91
|
-
styles.push(`--divider-width: ${dividerWidth}px`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if(styles.length > 0)
|
|
95
|
-
{
|
|
96
|
-
this.slider.style.cssText = styles.join('; ');
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
this.attributes = () =>
|
|
101
|
-
{
|
|
102
|
-
const startPosition = data['start-position'];
|
|
103
|
-
const hoverEnabled = data['hover-enabled'];
|
|
104
|
-
const keyboardEnabled = data['keyboard-enabled'];
|
|
105
|
-
|
|
106
|
-
if(startPosition !== 50)
|
|
107
|
-
{
|
|
108
|
-
this.slider.setAttribute('value', startPosition);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if(!hoverEnabled)
|
|
112
|
-
{
|
|
113
|
-
this.slider.setAttribute('hover', 'false');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if(!keyboardEnabled)
|
|
117
|
-
{
|
|
118
|
-
this.slider.setAttribute('keyboard', 'false');
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
this.initialize = () =>
|
|
123
|
-
{
|
|
124
|
-
// Add wrapper class to node for styling if needed
|
|
125
|
-
node.classList.add('comparison-wrapper');
|
|
126
|
-
|
|
127
|
-
// Set width/height on wrapper if needed
|
|
128
|
-
node.style.display = 'block';
|
|
129
|
-
node.style.width = '100%';
|
|
130
|
-
node.style.maxWidth = '100%';
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
this.setup();
|
|
134
|
-
this.labels();
|
|
135
|
-
this.styles();
|
|
136
|
-
this.attributes();
|
|
137
|
-
this.initialize();
|
|
138
|
-
}
|
|
139
|
-
});
|