@onetype/framework 2.0.26 → 2.0.28

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 (66) 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/classes/addon/classes/render/mixins/process.js +16 -0
  40. package/lib/src/mixins/addons.js +10 -10
  41. package/lib/styles/variables.css +1 -1
  42. package/package.json +1 -1
  43. package/addons/render/transforms/functions/load/assets.js +0 -49
  44. /package/{addons/render/directives/front/js/items → lib/items/directives}/100-if.js +0 -0
  45. /package/{addons/render/directives/front/js/items → lib/items/directives}/1000-render.js +0 -0
  46. /package/{addons/render/directives/front/js/items → lib/items/directives}/110-show.js +0 -0
  47. /package/{addons/render/directives/front/js/items → lib/items/directives}/160-slot.js +0 -0
  48. /package/{addons/render/directives/front/js/items → lib/items/directives}/200-for.js +0 -0
  49. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-blur.js +0 -0
  50. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-change.js +0 -0
  51. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-click-outside.js +0 -0
  52. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-click.js +0 -0
  53. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-double-click.js +0 -0
  54. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-focus.js +0 -0
  55. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-input.js +0 -0
  56. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-keydown.js +0 -0
  57. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-keyup.js +0 -0
  58. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-mouse-enter.js +0 -0
  59. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-mouse-leave.js +0 -0
  60. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-mouse-move.js +0 -0
  61. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-scroll.js +0 -0
  62. /package/{addons/render/directives/front/js/items → lib/items/directives}/500-submit.js +0 -0
  63. /package/{addons/render/directives/front/js/items → lib/items/directives}/650-fetch.js +0 -0
  64. /package/{addons/render/directives/front/js/items → lib/items/directives}/660-form.js +0 -0
  65. /package/{addons/render/directives/front/js/items → lib/items/directives}/700-text.js +0 -0
  66. /package/{addons/render/directives/front/js/items → lib/items/directives}/750-html.js +0 -0
@@ -1,152 +1,149 @@
1
- onetype.AddonReady('transforms', (transforms) =>
2
- {
3
- transforms.ItemAdd({
4
- id: 'ot-chart-line',
5
- icon: 'show_chart',
6
- name: 'Line Chart',
7
- description: 'Line chart for trends over time. Connect data points to show patterns and changes.',
8
- js: [
9
- 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
10
- ],
11
- config: {
12
- 'labels': ['array', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']],
13
- 'datasets': ['array', []],
14
- 'smooth': ['boolean', true],
15
- 'fill': ['boolean', false],
16
- 'options': ['object', {}]
17
- },
18
- code: function(data, item, compile, node, identifier)
1
+ transforms.ItemAdd({
2
+ id: 'ot-chart-line',
3
+ icon: 'show_chart',
4
+ name: 'Line Chart',
5
+ description: 'Line chart for trends over time. Connect data points to show patterns and changes.',
6
+ js: [
7
+ 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
8
+ ],
9
+ config: {
10
+ 'labels': ['array', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']],
11
+ 'datasets': ['array', []],
12
+ 'smooth': ['boolean', true],
13
+ 'fill': ['boolean', false],
14
+ 'options': ['object', {}]
15
+ },
16
+ code: function(data, node, transformer)
17
+ {
18
+ this.setup = () =>
19
19
  {
20
- this.setup = () =>
21
- {
22
- node.innerHTML = '';
23
- node.classList.add('ot-chart-line');
20
+ node.innerHTML = '';
21
+ node.classList.add('ot-chart-line');
24
22
 
25
- const canvas = document.createElement('canvas');
26
- this.canvas = canvas;
27
- node.appendChild(canvas);
28
- };
23
+ const canvas = document.createElement('canvas');
24
+ this.canvas = canvas;
25
+ node.appendChild(canvas);
26
+ };
29
27
 
30
- this.colors = () =>
31
- {
32
- const style = getComputedStyle(document.body);
28
+ this.colors = () =>
29
+ {
30
+ const style = getComputedStyle(document.body);
33
31
 
34
- return {
35
- brand: style.getPropertyValue('--ot-brand').trim(),
36
- blue: style.getPropertyValue('--ot-blue').trim(),
37
- green: style.getPropertyValue('--ot-green').trim(),
38
- orange: style.getPropertyValue('--ot-orange').trim(),
39
- red: style.getPropertyValue('--ot-red').trim(),
40
- brandOpacity: style.getPropertyValue('--ot-brand-opacity').trim(),
41
- blueOpacity: style.getPropertyValue('--ot-blue-opacity').trim(),
42
- greenOpacity: style.getPropertyValue('--ot-green-opacity').trim(),
43
- orangeOpacity: style.getPropertyValue('--ot-orange-opacity').trim(),
44
- redOpacity: style.getPropertyValue('--ot-red-opacity').trim()
45
- };
32
+ return {
33
+ brand: style.getPropertyValue('--ot-brand').trim(),
34
+ blue: style.getPropertyValue('--ot-blue').trim(),
35
+ green: style.getPropertyValue('--ot-green').trim(),
36
+ orange: style.getPropertyValue('--ot-orange').trim(),
37
+ red: style.getPropertyValue('--ot-red').trim(),
38
+ brandOpacity: style.getPropertyValue('--ot-brand-opacity').trim(),
39
+ blueOpacity: style.getPropertyValue('--ot-blue-opacity').trim(),
40
+ greenOpacity: style.getPropertyValue('--ot-green-opacity').trim(),
41
+ orangeOpacity: style.getPropertyValue('--ot-orange-opacity').trim(),
42
+ redOpacity: style.getPropertyValue('--ot-red-opacity').trim()
46
43
  };
44
+ };
47
45
 
48
- this.datasets = () =>
49
- {
50
- const datasets = data['datasets'].value;
51
- const colors = this.colors();
52
- const palette = [colors.brand, colors.blue, colors.green, colors.orange, colors.red];
53
- const paletteOpacity = [colors.brandOpacity, colors.blueOpacity, colors.greenOpacity, colors.orangeOpacity, colors.redOpacity];
54
- const smooth = data['smooth'].value;
55
- const fill = data['fill'].value;
56
-
57
- if(datasets.length === 0)
58
- {
59
- return [{
60
- label: 'Sample Data',
61
- data: [30, 45, 28, 56, 42, 65],
62
- backgroundColor: fill ? paletteOpacity[0] : 'transparent',
63
- borderColor: palette[0],
64
- borderWidth: 2,
65
- tension: smooth ? 0.4 : 0,
66
- fill: fill
67
- }];
68
- }
69
-
70
- return datasets.map((dataset, index) =>
71
- {
72
- const color = palette[index % palette.length];
73
- const colorOpacity = paletteOpacity[index % paletteOpacity.length];
46
+ this.datasets = () =>
47
+ {
48
+ const datasets = data['datasets'];
49
+ const colors = this.colors();
50
+ const palette = [colors.brand, colors.blue, colors.green, colors.orange, colors.red];
51
+ const paletteOpacity = [colors.brandOpacity, colors.blueOpacity, colors.greenOpacity, colors.orangeOpacity, colors.redOpacity];
52
+ const smooth = data['smooth'];
53
+ const fill = data['fill'];
74
54
 
75
- return {
76
- ...dataset,
77
- backgroundColor: dataset.backgroundColor || (fill ? colorOpacity : 'transparent'),
78
- borderColor: dataset.borderColor || color,
79
- borderWidth: dataset.borderWidth || 2,
80
- tension: dataset.tension !== undefined ? dataset.tension : (smooth ? 0.4 : 0),
81
- fill: dataset.fill !== undefined ? dataset.fill : fill
82
- };
83
- });
84
- };
55
+ if(datasets.length === 0)
56
+ {
57
+ return [{
58
+ label: 'Sample Data',
59
+ data: [30, 45, 28, 56, 42, 65],
60
+ backgroundColor: fill ? paletteOpacity[0] : 'transparent',
61
+ borderColor: palette[0],
62
+ borderWidth: 2,
63
+ tension: smooth ? 0.4 : 0,
64
+ fill: fill
65
+ }];
66
+ }
85
67
 
86
- this.config = () =>
68
+ return datasets.map((dataset, index) =>
87
69
  {
88
- const style = getComputedStyle(document.body);
89
- const textColor = style.getPropertyValue('--ot-text-1').trim();
90
- const gridColor = style.getPropertyValue('--ot-bg-3-border').trim();
70
+ const color = palette[index % palette.length];
71
+ const colorOpacity = paletteOpacity[index % paletteOpacity.length];
91
72
 
92
73
  return {
93
- type: 'line',
94
- data: {
95
- labels: data['labels'].value,
96
- datasets: this.datasets()
74
+ ...dataset,
75
+ backgroundColor: dataset.backgroundColor || (fill ? colorOpacity : 'transparent'),
76
+ borderColor: dataset.borderColor || color,
77
+ borderWidth: dataset.borderWidth || 2,
78
+ tension: dataset.tension !== undefined ? dataset.tension : (smooth ? 0.4 : 0),
79
+ fill: dataset.fill !== undefined ? dataset.fill : fill
80
+ };
81
+ });
82
+ };
83
+
84
+ this.config = () =>
85
+ {
86
+ const style = getComputedStyle(document.body);
87
+ const textColor = style.getPropertyValue('--ot-text-1').trim();
88
+ const gridColor = style.getPropertyValue('--ot-bg-3-border').trim();
89
+
90
+ return {
91
+ type: 'line',
92
+ data: {
93
+ labels: data['labels'],
94
+ datasets: this.datasets()
95
+ },
96
+ options: {
97
+ responsive: true,
98
+ maintainAspectRatio: false,
99
+ interaction: {
100
+ intersect: false,
101
+ mode: 'index'
97
102
  },
98
- options: {
99
- responsive: true,
100
- maintainAspectRatio: false,
101
- interaction: {
102
- intersect: false,
103
- mode: 'index'
104
- },
105
- plugins: {
106
- legend: {
107
- labels: {
108
- color: textColor,
109
- font: {
110
- family: style.getPropertyValue('--ot-font-primary').trim()
111
- }
103
+ plugins: {
104
+ legend: {
105
+ labels: {
106
+ color: textColor,
107
+ font: {
108
+ family: style.getPropertyValue('--ot-font-primary').trim()
112
109
  }
113
110
  }
111
+ }
112
+ },
113
+ scales: {
114
+ x: {
115
+ ticks: { color: textColor },
116
+ grid: { color: gridColor }
114
117
  },
115
- scales: {
116
- x: {
117
- ticks: { color: textColor },
118
- grid: { color: gridColor }
119
- },
120
- y: {
121
- ticks: { color: textColor },
122
- grid: { color: gridColor },
123
- beginAtZero: true
124
- }
125
- },
126
- ...data['options'].value
127
- }
128
- };
118
+ y: {
119
+ ticks: { color: textColor },
120
+ grid: { color: gridColor },
121
+ beginAtZero: true
122
+ }
123
+ },
124
+ ...data['options']
125
+ }
129
126
  };
127
+ };
130
128
 
131
- this.initialize = () =>
129
+ this.initialize = () =>
130
+ {
131
+ setTimeout(() =>
132
132
  {
133
- setTimeout(() =>
133
+ if(typeof Chart === 'undefined')
134
134
  {
135
- if(typeof Chart === 'undefined')
136
- {
137
- console.error('Chart.js library not loaded');
138
- return;
139
- }
135
+ console.error('Chart.js library not loaded');
136
+ return;
137
+ }
140
138
 
141
- const context = this.canvas.getContext('2d');
142
- this.instance = new Chart(context, this.config());
139
+ const context = this.canvas.getContext('2d');
140
+ this.instance = new Chart(context, this.config());
143
141
 
144
- node.chart = this.instance;
145
- }, 100);
146
- };
142
+ node.chart = this.instance;
143
+ }, 100);
144
+ };
147
145
 
148
- this.setup();
149
- this.initialize();
150
- }
151
- });
152
- });
146
+ this.setup();
147
+ this.initialize();
148
+ }
149
+ });
@@ -1,125 +1,122 @@
1
- onetype.AddonReady('transforms', (transforms) =>
2
- {
3
- transforms.ItemAdd({
4
- id: 'ot-chart-pie',
5
- icon: 'pie_chart',
6
- name: 'Pie Chart',
7
- description: 'Circular pie chart visualization. Show proportions and percentages in a circle.',
8
- js: [
9
- 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
10
- ],
11
- config: {
12
- 'labels': ['array', ['Category A', 'Category B', 'Category C', 'Category D']],
13
- 'values': ['array', [30, 25, 20, 25]],
14
- 'options': ['object', {}]
15
- },
16
- code: function(data, item, compile, node, identifier)
1
+ transforms.ItemAdd({
2
+ id: 'ot-chart-pie',
3
+ icon: 'pie_chart',
4
+ name: 'Pie Chart',
5
+ description: 'Circular pie chart visualization. Show proportions and percentages in a circle.',
6
+ js: [
7
+ 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
8
+ ],
9
+ config: {
10
+ 'labels': ['array', ['Category A', 'Category B', 'Category C', 'Category D']],
11
+ 'values': ['array', [30, 25, 20, 25]],
12
+ 'options': ['object', {}]
13
+ },
14
+ code: function(data, node, transformer)
15
+ {
16
+ this.setup = () =>
17
17
  {
18
- this.setup = () =>
19
- {
20
- node.innerHTML = '';
21
- node.classList.add('ot-chart-pie');
18
+ node.innerHTML = '';
19
+ node.classList.add('ot-chart-pie');
22
20
 
23
- const canvas = document.createElement('canvas');
24
- this.canvas = canvas;
25
- node.appendChild(canvas);
26
- };
21
+ const canvas = document.createElement('canvas');
22
+ this.canvas = canvas;
23
+ node.appendChild(canvas);
24
+ };
27
25
 
28
- this.colors = () =>
29
- {
30
- const style = getComputedStyle(document.body);
26
+ this.colors = () =>
27
+ {
28
+ const style = getComputedStyle(document.body);
31
29
 
32
- return [
33
- style.getPropertyValue('--ot-brand').trim(),
34
- style.getPropertyValue('--ot-blue').trim(),
35
- style.getPropertyValue('--ot-green').trim(),
36
- style.getPropertyValue('--ot-orange').trim(),
37
- style.getPropertyValue('--ot-red').trim()
38
- ];
39
- };
30
+ return [
31
+ style.getPropertyValue('--ot-brand').trim(),
32
+ style.getPropertyValue('--ot-blue').trim(),
33
+ style.getPropertyValue('--ot-green').trim(),
34
+ style.getPropertyValue('--ot-orange').trim(),
35
+ style.getPropertyValue('--ot-red').trim()
36
+ ];
37
+ };
40
38
 
41
- this.dataset = () =>
42
- {
43
- const values = data['values'].value;
44
- const palette = this.colors();
39
+ this.dataset = () =>
40
+ {
41
+ const values = data['values'];
42
+ const palette = this.colors();
45
43
 
46
- const extendedPalette = [];
47
- for(let i = 0; i < values.length; i++)
48
- {
49
- extendedPalette.push(palette[i % palette.length]);
50
- }
44
+ const extendedPalette = [];
45
+ for(let i = 0; i < values.length; i++)
46
+ {
47
+ extendedPalette.push(palette[i % palette.length]);
48
+ }
51
49
 
52
- return {
53
- data: values,
54
- backgroundColor: extendedPalette,
55
- borderColor: '#ffffff',
56
- borderWidth: 2
57
- };
50
+ return {
51
+ data: values,
52
+ backgroundColor: extendedPalette,
53
+ borderColor: '#ffffff',
54
+ borderWidth: 2
58
55
  };
56
+ };
59
57
 
60
- this.config = () =>
61
- {
62
- const style = getComputedStyle(document.body);
63
- const textColor = style.getPropertyValue('--ot-text-1').trim();
58
+ this.config = () =>
59
+ {
60
+ const style = getComputedStyle(document.body);
61
+ const textColor = style.getPropertyValue('--ot-text-1').trim();
64
62
 
65
- return {
66
- type: 'pie',
67
- data: {
68
- labels: data['labels'].value,
69
- datasets: [this.dataset()]
70
- },
71
- options: {
72
- responsive: true,
73
- maintainAspectRatio: false,
74
- plugins: {
75
- legend: {
76
- position: 'bottom',
77
- labels: {
78
- color: textColor,
79
- padding: 20,
80
- font: {
81
- family: style.getPropertyValue('--ot-font-primary').trim(),
82
- size: 13
83
- }
84
- }
85
- },
86
- tooltip: {
87
- callbacks: {
88
- label: function(context)
89
- {
90
- const label = context.label || '';
91
- const value = context.parsed;
92
- const total = context.dataset.data.reduce((a, b) => a + b, 0);
93
- const percentage = ((value / total) * 100).toFixed(1);
94
- return label + ': ' + percentage + '%';
95
- }
63
+ return {
64
+ type: 'pie',
65
+ data: {
66
+ labels: data['labels'],
67
+ datasets: [this.dataset()]
68
+ },
69
+ options: {
70
+ responsive: true,
71
+ maintainAspectRatio: false,
72
+ plugins: {
73
+ legend: {
74
+ position: 'bottom',
75
+ labels: {
76
+ color: textColor,
77
+ padding: 20,
78
+ font: {
79
+ family: style.getPropertyValue('--ot-font-primary').trim(),
80
+ size: 13
96
81
  }
97
82
  }
98
83
  },
99
- ...data['options'].value
100
- }
101
- };
84
+ tooltip: {
85
+ callbacks: {
86
+ label: function(context)
87
+ {
88
+ const label = context.label || '';
89
+ const value = context.parsed;
90
+ const total = context.dataset.data.reduce((a, b) => a + b, 0);
91
+ const percentage = ((value / total) * 100).toFixed(1);
92
+ return label + ': ' + percentage + '%';
93
+ }
94
+ }
95
+ }
96
+ },
97
+ ...data['options']
98
+ }
102
99
  };
100
+ };
103
101
 
104
- this.initialize = () =>
102
+ this.initialize = () =>
103
+ {
104
+ setTimeout(() =>
105
105
  {
106
- setTimeout(() =>
106
+ if(typeof Chart === 'undefined')
107
107
  {
108
- if(typeof Chart === 'undefined')
109
- {
110
- console.error('Chart.js library not loaded');
111
- return;
112
- }
108
+ console.error('Chart.js library not loaded');
109
+ return;
110
+ }
113
111
 
114
- const context = this.canvas.getContext('2d');
115
- this.instance = new Chart(context, this.config());
112
+ const context = this.canvas.getContext('2d');
113
+ this.instance = new Chart(context, this.config());
116
114
 
117
- node.chart = this.instance;
118
- }, 100);
119
- };
115
+ node.chart = this.instance;
116
+ }, 100);
117
+ };
120
118
 
121
- this.setup();
122
- this.initialize();
123
- }
124
- });
125
- });
119
+ this.setup();
120
+ this.initialize();
121
+ }
122
+ });