@onetype/framework 2.0.26 → 2.0.27

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.
Files changed (65) hide show
  1. package/addons/core/assets/back/functions/utils/transform.js +1 -1
  2. package/addons/render/directives/front/js/functions/process/data.js +0 -1
  3. package/addons/render/transforms/addon.js +2 -0
  4. package/addons/render/transforms/functions/data.js +21 -0
  5. package/addons/render/transforms/functions/run.js +11 -0
  6. package/addons/render/transforms/item/functions/load.js +55 -0
  7. package/addons/render/transforms/item/functions/run.js +12 -0
  8. package/addons/render/transforms/items/directives/transform.js +15 -18
  9. package/lib/items/elements/global/heading/heading.css +1 -1
  10. package/lib/items/elements/global/markdown/markdown.js +207 -3
  11. package/lib/items/elements/{sections → navigation}/navbar/navbar.css +9 -9
  12. package/lib/items/elements/{sections → navigation}/navbar/navbar.js +2 -2
  13. package/lib/items/elements/navigation/sidebar/sidebar.css +101 -0
  14. package/lib/items/elements/navigation/sidebar/sidebar.js +56 -0
  15. package/lib/items/elements/{global → navigation}/tabs/tabs.css +6 -6
  16. package/lib/items/elements/{global → navigation}/tabs/tabs.js +2 -2
  17. package/lib/items/elements/sections/pricing/pricing.css +148 -0
  18. package/lib/items/elements/sections/pricing/pricing.js +76 -0
  19. package/lib/items/transforms/accordion/accordion.js +139 -141
  20. package/lib/items/transforms/chart/area.js +130 -133
  21. package/lib/items/transforms/chart/bar.js +116 -119
  22. package/lib/items/transforms/chart/bubble.js +142 -145
  23. package/lib/items/transforms/chart/doughnut.js +104 -107
  24. package/lib/items/transforms/chart/line.js +127 -130
  25. package/lib/items/transforms/chart/pie.js +102 -105
  26. package/lib/items/transforms/chart/radar.js +134 -137
  27. package/lib/items/transforms/chart/scatter.js +127 -130
  28. package/lib/items/transforms/codeflask/codeflask.js +10 -12
  29. package/lib/items/transforms/codemirror/codemirror.js +186 -189
  30. package/lib/items/transforms/comparison/comparison.js +130 -133
  31. package/lib/items/transforms/heatmap/heatmap.js +406 -407
  32. package/lib/items/transforms/interact/interact.js +240 -241
  33. package/lib/items/transforms/particles/particles.js +282 -283
  34. package/lib/items/transforms/sparkline/sparkline.js +207 -208
  35. package/lib/items/transforms/swiper/swiper.js +115 -118
  36. package/lib/items/transforms/tabs/tabs.js +383 -384
  37. package/lib/items/transforms/typed/typed.js +146 -147
  38. package/lib/load.js +8 -16
  39. package/lib/src/mixins/addons.js +10 -10
  40. package/lib/styles/variables.css +1 -1
  41. package/package.json +1 -1
  42. package/addons/render/transforms/functions/load/assets.js +0 -49
  43. /package/{addons/render/directives/front/js/items → lib/items/directives}/100-if.js +0 -0
  44. /package/{addons/render/directives/front/js/items → lib/items/directives}/1000-render.js +0 -0
  45. /package/{addons/render/directives/front/js/items → lib/items/directives}/110-show.js +0 -0
  46. /package/{addons/render/directives/front/js/items → lib/items/directives}/160-slot.js +0 -0
  47. /package/{addons/render/directives/front/js/items → lib/items/directives}/200-for.js +0 -0
  48. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-blur.js +0 -0
  49. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-change.js +0 -0
  50. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-click-outside.js +0 -0
  51. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-click.js +0 -0
  52. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-double-click.js +0 -0
  53. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-focus.js +0 -0
  54. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-input.js +0 -0
  55. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-keydown.js +0 -0
  56. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-keyup.js +0 -0
  57. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-mouse-enter.js +0 -0
  58. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-mouse-leave.js +0 -0
  59. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-mouse-move.js +0 -0
  60. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-scroll.js +0 -0
  61. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-submit.js +0 -0
  62. /package/{addons/render/directives/front/js/items → lib/items/directives}/650-fetch.js +0 -0
  63. /package/{addons/render/directives/front/js/items → lib/items/directives}/660-form.js +0 -0
  64. /package/{addons/render/directives/front/js/items → lib/items/directives}/700-text.js +0 -0
  65. /package/{addons/render/directives/front/js/items → lib/items/directives}/750-html.js +0 -0
@@ -1,240 +1,239 @@
1
- onetype.AddonReady('transforms', (transforms) =>
2
- {
3
- transforms.ItemAdd({
4
- id: 'sparkline',
5
- icon: 'show_chart',
6
- name: 'Sparkline',
7
- description: 'Inline mini charts for data trends. Compact line charts perfect for dashboards.',
8
- js: [
9
- 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
10
- ],
11
- config: {
12
- 'values': ['array', [5, 10, 5, 20, 8, 15, 12, 8, 10, 15, 20, 25]],
13
- 'type': ['string', 'line'], // line, bar, area
14
- 'width': ['number', 100],
15
- 'height': ['number', 30],
16
- 'color': ['string', ''], // empty means use theme brand color
17
- 'fill': ['boolean', false],
18
- 'show-dots': ['boolean', false],
19
- 'show-tooltip': ['boolean', true],
20
- 'smooth': ['boolean', true],
21
- 'animate': ['boolean', true],
22
- 'min': ['number', null],
23
- 'max': ['number', null]
24
- },
25
- code: function(data, item, compile, node, identifier)
1
+ transforms.ItemAdd({
2
+ id: 'sparkline',
3
+ icon: 'show_chart',
4
+ name: 'Sparkline',
5
+ description: 'Inline mini charts for data trends. Compact line charts perfect for dashboards.',
6
+ js: [
7
+ 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
8
+ ],
9
+ config: {
10
+ 'values': ['array', [5, 10, 5, 20, 8, 15, 12, 8, 10, 15, 20, 25]],
11
+ 'type': ['string', 'line'], // line, bar, area
12
+ 'width': ['number', 100],
13
+ 'height': ['number', 30],
14
+ 'color': ['string', ''], // empty means use theme brand color
15
+ 'fill': ['boolean', false],
16
+ 'show-dots': ['boolean', false],
17
+ 'show-tooltip': ['boolean', true],
18
+ 'smooth': ['boolean', true],
19
+ 'animate': ['boolean', true],
20
+ 'min': ['number', null],
21
+ 'max': ['number', null]
22
+ },
23
+ code: function(data, node, transformer)
24
+ {
25
+ const id = 'sparkline-' + onetype.Generate(8);
26
+
27
+ this.setup = () =>
26
28
  {
27
- this.setup = () =>
28
- {
29
- node.innerHTML = '';
30
- node.classList.add('sparkline');
31
- node.classList.add('sparkline-' + identifier);
32
-
33
- // Set inline-block display for sparklines
34
- node.style.display = 'inline-block';
35
- node.style.verticalAlign = 'middle';
36
- node.style.width = data['width'].value + 'px';
37
- node.style.height = data['height'].value + 'px';
38
-
39
- const canvas = document.createElement('canvas');
40
- canvas.width = data['width'].value;
41
- canvas.height = data['height'].value;
42
- this.canvas = canvas;
43
- node.appendChild(canvas);
44
- };
29
+ node.innerHTML = '';
30
+ node.classList.add('sparkline');
31
+ node.classList.add(id);
32
+
33
+ // Set inline-block display for sparklines
34
+ node.style.display = 'inline-block';
35
+ node.style.verticalAlign = 'middle';
36
+ node.style.width = data['width'] + 'px';
37
+ node.style.height = data['height'] + 'px';
38
+
39
+ const canvas = document.createElement('canvas');
40
+ canvas.width = data['width'];
41
+ canvas.height = data['height'];
42
+ this.canvas = canvas;
43
+ node.appendChild(canvas);
44
+ };
45
+
46
+ this.colors = () =>
47
+ {
48
+ const style = getComputedStyle(document.body);
45
49
 
46
- this.colors = () =>
50
+ // Get custom color or default to brand
51
+ let lineColor = data['color'];
52
+ if (!lineColor)
47
53
  {
48
- const style = getComputedStyle(document.body);
54
+ lineColor = style.getPropertyValue('--ot-brand').trim() || '#3b82f6';
55
+ }
49
56
 
50
- // Get custom color or default to brand
51
- let lineColor = data['color'].value;
52
- if (!lineColor)
53
- {
54
- lineColor = style.getPropertyValue('--ot-brand').trim() || '#3b82f6';
55
- }
57
+ // Extract RGB values for opacity
58
+ let fillColor = lineColor;
59
+ if (lineColor.startsWith('#'))
60
+ {
61
+ const r = parseInt(lineColor.slice(1, 3), 16);
62
+ const g = parseInt(lineColor.slice(3, 5), 16);
63
+ const b = parseInt(lineColor.slice(5, 7), 16);
64
+ fillColor = `rgba(${r}, ${g}, ${b}, 0.1)`;
65
+ }
66
+ else if (lineColor.startsWith('rgb'))
67
+ {
68
+ fillColor = lineColor.replace('rgb', 'rgba').replace(')', ', 0.1)');
69
+ }
56
70
 
57
- // Extract RGB values for opacity
58
- let fillColor = lineColor;
59
- if (lineColor.startsWith('#'))
60
- {
61
- const r = parseInt(lineColor.slice(1, 3), 16);
62
- const g = parseInt(lineColor.slice(3, 5), 16);
63
- const b = parseInt(lineColor.slice(5, 7), 16);
64
- fillColor = `rgba(${r}, ${g}, ${b}, 0.1)`;
65
- }
66
- else if (lineColor.startsWith('rgb'))
67
- {
68
- fillColor = lineColor.replace('rgb', 'rgba').replace(')', ', 0.1)');
69
- }
71
+ return {
72
+ line: lineColor,
73
+ fill: fillColor
74
+ };
75
+ };
70
76
 
71
- return {
72
- line: lineColor,
73
- fill: fillColor
74
- };
77
+ this.dataset = () =>
78
+ {
79
+ const values = data['values'];
80
+ const colors = this.colors();
81
+ const type = data['type'];
82
+ const smooth = data['smooth'];
83
+ const fill = data['fill'] || type === 'area';
84
+ const showDots = data['show-dots'];
85
+
86
+ const dataset = {
87
+ data: values,
88
+ borderColor: colors.line,
89
+ backgroundColor: fill ? colors.fill : 'transparent',
90
+ borderWidth: 1.5,
91
+ pointRadius: showDots ? 2 : 0,
92
+ pointHoverRadius: showDots ? 3 : 0,
93
+ pointBackgroundColor: colors.line,
94
+ pointBorderColor: colors.line,
95
+ tension: smooth ? 0.4 : 0,
96
+ fill: fill
75
97
  };
76
98
 
77
- this.dataset = () =>
99
+ // Adjust for bar type
100
+ if (type === 'bar')
78
101
  {
79
- const values = data['values'].value;
80
- const colors = this.colors();
81
- const type = data['type'].value;
82
- const smooth = data['smooth'].value;
83
- const fill = data['fill'].value || type === 'area';
84
- const showDots = data['show-dots'].value;
85
-
86
- const dataset = {
87
- data: values,
88
- borderColor: colors.line,
89
- backgroundColor: fill ? colors.fill : 'transparent',
90
- borderWidth: 1.5,
91
- pointRadius: showDots ? 2 : 0,
92
- pointHoverRadius: showDots ? 3 : 0,
93
- pointBackgroundColor: colors.line,
94
- pointBorderColor: colors.line,
95
- tension: smooth ? 0.4 : 0,
96
- fill: fill
97
- };
102
+ dataset.backgroundColor = colors.line;
103
+ dataset.borderWidth = 0;
104
+ }
98
105
 
99
- // Adjust for bar type
100
- if (type === 'bar')
101
- {
102
- dataset.backgroundColor = colors.line;
103
- dataset.borderWidth = 0;
104
- }
106
+ return dataset;
107
+ };
105
108
 
106
- return dataset;
107
- };
108
-
109
- this.config = () =>
110
- {
111
- const type = data['type'].value === 'area' ? 'line' : data['type'].value;
112
- const showTooltip = data['show-tooltip'].value;
113
- const animate = data['animate'].value;
114
- const minValue = data['min'].value;
115
- const maxValue = data['max'].value;
116
-
117
- // Generate labels based on data length
118
- const labels = Array.from({length: data['values'].value.length}, (_, i) => '');
119
-
120
- return {
121
- type: type === 'bar' ? 'bar' : 'line',
122
- data: {
123
- labels: labels,
124
- datasets: [this.dataset()]
109
+ this.config = () =>
110
+ {
111
+ const type = data['type'] === 'area' ? 'line' : data['type'];
112
+ const showTooltip = data['show-tooltip'];
113
+ const animate = data['animate'];
114
+ const minValue = data['min'];
115
+ const maxValue = data['max'];
116
+
117
+ // Generate labels based on data length
118
+ const labels = Array.from({length: data['values'].length}, (_, i) => '');
119
+
120
+ return {
121
+ type: type === 'bar' ? 'bar' : 'line',
122
+ data: {
123
+ labels: labels,
124
+ datasets: [this.dataset()]
125
+ },
126
+ options: {
127
+ responsive: false,
128
+ maintainAspectRatio: false,
129
+ animation: {
130
+ duration: animate ? 750 : 0
125
131
  },
126
- options: {
127
- responsive: false,
128
- maintainAspectRatio: false,
129
- animation: {
130
- duration: animate ? 750 : 0
131
- },
132
- interaction: {
133
- intersect: false,
134
- mode: showTooltip ? 'index' : null
132
+ interaction: {
133
+ intersect: false,
134
+ mode: showTooltip ? 'index' : null
135
+ },
136
+ plugins: {
137
+ legend: {
138
+ display: false
135
139
  },
136
- plugins: {
137
- legend: {
138
- display: false
140
+ tooltip: {
141
+ enabled: showTooltip,
142
+ backgroundColor: 'rgba(0, 0, 0, 0.8)',
143
+ titleFont: {
144
+ size: 11
139
145
  },
140
- tooltip: {
141
- enabled: showTooltip,
142
- backgroundColor: 'rgba(0, 0, 0, 0.8)',
143
- titleFont: {
144
- size: 11
145
- },
146
- bodyFont: {
147
- size: 11
148
- },
149
- padding: 4,
150
- displayColors: false,
151
- callbacks: {
152
- title: () => '',
153
- label: (context) => {
154
- return context.parsed.y.toLocaleString();
155
- }
156
- }
157
- }
158
- },
159
- scales: {
160
- x: {
161
- display: false,
162
- grid: {
163
- display: false
164
- }
146
+ bodyFont: {
147
+ size: 11
165
148
  },
166
- y: {
167
- display: false,
168
- beginAtZero: minValue === null,
169
- min: minValue,
170
- max: maxValue,
171
- grid: {
172
- display: false
149
+ padding: 4,
150
+ displayColors: false,
151
+ callbacks: {
152
+ title: () => '',
153
+ label: (context) => {
154
+ return context.parsed.y.toLocaleString();
173
155
  }
174
156
  }
175
- },
176
- elements: {
177
- line: {
178
- borderJoinStyle: 'round'
157
+ }
158
+ },
159
+ scales: {
160
+ x: {
161
+ display: false,
162
+ grid: {
163
+ display: false
179
164
  }
180
165
  },
181
- layout: {
182
- padding: 0
166
+ y: {
167
+ display: false,
168
+ beginAtZero: minValue === null,
169
+ min: minValue,
170
+ max: maxValue,
171
+ grid: {
172
+ display: false
173
+ }
174
+ }
175
+ },
176
+ elements: {
177
+ line: {
178
+ borderJoinStyle: 'round'
183
179
  }
180
+ },
181
+ layout: {
182
+ padding: 0
184
183
  }
185
- };
184
+ }
186
185
  };
186
+ };
187
187
 
188
- this.styles = () =>
189
- {
190
- const style = document.createElement('style');
188
+ this.styles = () =>
189
+ {
190
+ const style = document.createElement('style');
191
191
 
192
- style.textContent = `
193
- .sparkline-${identifier} {
194
- position: relative;
195
- line-height: 1;
196
- }
197
- .sparkline-${identifier} canvas {
198
- display: block;
199
- max-width: 100%;
200
- }
201
- `;
192
+ style.textContent = `
193
+ .sparkline-${id} {
194
+ position: relative;
195
+ line-height: 1;
196
+ }
197
+ .sparkline-${id} canvas {
198
+ display: block;
199
+ max-width: 100%;
200
+ }
201
+ `;
202
202
 
203
- document.head.appendChild(style);
204
- };
203
+ document.head.appendChild(style);
204
+ };
205
205
 
206
- this.initialize = () =>
206
+ this.initialize = () =>
207
+ {
208
+ setTimeout(() =>
207
209
  {
208
- setTimeout(() =>
210
+ if(typeof Chart === 'undefined')
209
211
  {
210
- if(typeof Chart === 'undefined')
211
- {
212
- console.error('Chart.js library not loaded for sparkline');
213
- return;
214
- }
212
+ console.error('Chart.js library not loaded for sparkline');
213
+ return;
214
+ }
215
215
 
216
- const context = this.canvas.getContext('2d');
217
- this.instance = new Chart(context, this.config());
216
+ const context = this.canvas.getContext('2d');
217
+ this.instance = new Chart(context, this.config());
218
218
 
219
- // Expose instance for external access
220
- node.sparkline = this.instance;
219
+ // Expose instance for external access
220
+ node.sparkline = this.instance;
221
221
 
222
- // Add update method for dynamic updates
223
- node.updateSparkline = (newValues) =>
222
+ // Add update method for dynamic updates
223
+ node.updateSparkline = (newValues) =>
224
+ {
225
+ if (this.instance)
224
226
  {
225
- if (this.instance)
226
- {
227
- this.instance.data.datasets[0].data = newValues;
228
- this.instance.data.labels = Array.from({length: newValues.length}, () => '');
229
- this.instance.update('none'); // Update without animation
230
- }
231
- };
232
- }, 100);
233
- };
234
-
235
- this.setup();
236
- this.styles();
237
- this.initialize();
238
- }
239
- });
240
- });
227
+ this.instance.data.datasets[0].data = newValues;
228
+ this.instance.data.labels = Array.from({length: newValues.length}, () => '');
229
+ this.instance.update('none'); // Update without animation
230
+ }
231
+ };
232
+ }, 100);
233
+ };
234
+
235
+ this.setup();
236
+ this.styles();
237
+ this.initialize();
238
+ }
239
+ });