@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,157 +1,154 @@
1
- onetype.AddonReady('transforms', (transforms) =>
2
- {
3
- transforms.ItemAdd({
4
- id: 'ot-chart-radar',
5
- icon: 'radar',
6
- name: 'Radar Chart',
7
- description: 'Spider/radar chart visualization. Display multivariate data in a radial layout.',
8
- js: [
9
- 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
10
- ],
11
- config: {
12
- 'labels': ['array', ['Speed', 'Strength', 'Defense', 'Attack', 'Agility']],
13
- 'datasets': ['array', []],
14
- 'fill': ['boolean', true],
15
- 'options': ['object', {}]
16
- },
17
- code: function(data, item, compile, node, identifier)
1
+ transforms.ItemAdd({
2
+ id: 'ot-chart-radar',
3
+ icon: 'radar',
4
+ name: 'Radar Chart',
5
+ description: 'Spider/radar chart visualization. Display multivariate data in a radial layout.',
6
+ js: [
7
+ 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
8
+ ],
9
+ config: {
10
+ 'labels': ['array', ['Speed', 'Strength', 'Defense', 'Attack', 'Agility']],
11
+ 'datasets': ['array', []],
12
+ 'fill': ['boolean', true],
13
+ 'options': ['object', {}]
14
+ },
15
+ code: function(data, node, transformer)
16
+ {
17
+ this.setup = () =>
18
18
  {
19
- this.setup = () =>
20
- {
21
- node.innerHTML = '';
22
- node.classList.add('ot-chart-radar');
19
+ node.innerHTML = '';
20
+ node.classList.add('ot-chart-radar');
23
21
 
24
- const canvas = document.createElement('canvas');
25
- this.canvas = canvas;
26
- node.appendChild(canvas);
27
- };
22
+ const canvas = document.createElement('canvas');
23
+ this.canvas = canvas;
24
+ node.appendChild(canvas);
25
+ };
28
26
 
29
- this.colors = () =>
30
- {
31
- const style = getComputedStyle(document.body);
27
+ this.colors = () =>
28
+ {
29
+ const style = getComputedStyle(document.body);
32
30
 
33
- return {
34
- brand: style.getPropertyValue('--ot-brand').trim(),
35
- blue: style.getPropertyValue('--ot-blue').trim(),
36
- green: style.getPropertyValue('--ot-green').trim(),
37
- orange: style.getPropertyValue('--ot-orange').trim(),
38
- red: style.getPropertyValue('--ot-red').trim(),
39
- brandOpacity: style.getPropertyValue('--ot-brand-opacity').trim(),
40
- blueOpacity: style.getPropertyValue('--ot-blue-opacity').trim(),
41
- greenOpacity: style.getPropertyValue('--ot-green-opacity').trim(),
42
- orangeOpacity: style.getPropertyValue('--ot-orange-opacity').trim(),
43
- redOpacity: style.getPropertyValue('--ot-red-opacity').trim()
44
- };
31
+ return {
32
+ brand: style.getPropertyValue('--ot-brand').trim(),
33
+ blue: style.getPropertyValue('--ot-blue').trim(),
34
+ green: style.getPropertyValue('--ot-green').trim(),
35
+ orange: style.getPropertyValue('--ot-orange').trim(),
36
+ red: style.getPropertyValue('--ot-red').trim(),
37
+ brandOpacity: style.getPropertyValue('--ot-brand-opacity').trim(),
38
+ blueOpacity: style.getPropertyValue('--ot-blue-opacity').trim(),
39
+ greenOpacity: style.getPropertyValue('--ot-green-opacity').trim(),
40
+ orangeOpacity: style.getPropertyValue('--ot-orange-opacity').trim(),
41
+ redOpacity: style.getPropertyValue('--ot-red-opacity').trim()
45
42
  };
43
+ };
46
44
 
47
- this.datasets = () =>
48
- {
49
- const datasets = data['datasets'].value;
50
- const colors = this.colors();
51
- const palette = [colors.brand, colors.blue, colors.green, colors.orange, colors.red];
52
- const paletteOpacity = [colors.brandOpacity, colors.blueOpacity, colors.greenOpacity, colors.orangeOpacity, colors.redOpacity];
53
- const fill = data['fill'].value;
54
-
55
- if(datasets.length === 0)
56
- {
57
- return [{
58
- label: 'Sample Data',
59
- data: [75, 60, 85, 70, 80],
60
- backgroundColor: fill ? paletteOpacity[0] : 'transparent',
61
- borderColor: palette[0],
62
- borderWidth: 2,
63
- pointBackgroundColor: palette[0],
64
- pointBorderColor: '#fff',
65
- pointHoverBackgroundColor: '#fff',
66
- pointHoverBorderColor: palette[0]
67
- }];
68
- }
69
-
70
- return datasets.map((dataset, index) =>
71
- {
72
- const color = palette[index % palette.length];
73
- const colorOpacity = paletteOpacity[index % paletteOpacity.length];
45
+ this.datasets = () =>
46
+ {
47
+ const datasets = data['datasets'];
48
+ const colors = this.colors();
49
+ const palette = [colors.brand, colors.blue, colors.green, colors.orange, colors.red];
50
+ const paletteOpacity = [colors.brandOpacity, colors.blueOpacity, colors.greenOpacity, colors.orangeOpacity, colors.redOpacity];
51
+ const fill = data['fill'];
74
52
 
75
- return {
76
- ...dataset,
77
- backgroundColor: dataset.backgroundColor || (fill ? colorOpacity : 'transparent'),
78
- borderColor: dataset.borderColor || color,
79
- borderWidth: dataset.borderWidth || 2,
80
- pointBackgroundColor: dataset.pointBackgroundColor || color,
81
- pointBorderColor: dataset.pointBorderColor || '#fff',
82
- pointHoverBackgroundColor: dataset.pointHoverBackgroundColor || '#fff',
83
- pointHoverBorderColor: dataset.pointHoverBorderColor || color
84
- };
85
- });
86
- };
53
+ if(datasets.length === 0)
54
+ {
55
+ return [{
56
+ label: 'Sample Data',
57
+ data: [75, 60, 85, 70, 80],
58
+ backgroundColor: fill ? paletteOpacity[0] : 'transparent',
59
+ borderColor: palette[0],
60
+ borderWidth: 2,
61
+ pointBackgroundColor: palette[0],
62
+ pointBorderColor: '#fff',
63
+ pointHoverBackgroundColor: '#fff',
64
+ pointHoverBorderColor: palette[0]
65
+ }];
66
+ }
87
67
 
88
- this.config = () =>
68
+ return datasets.map((dataset, index) =>
89
69
  {
90
- const style = getComputedStyle(document.body);
91
- const textColor = style.getPropertyValue('--ot-text-1').trim();
92
- const gridColor = style.getPropertyValue('--ot-bg-3-border').trim();
70
+ const color = palette[index % palette.length];
71
+ const colorOpacity = paletteOpacity[index % paletteOpacity.length];
93
72
 
94
73
  return {
95
- type: 'radar',
96
- data: {
97
- labels: data['labels'].value,
98
- datasets: this.datasets()
99
- },
100
- options: {
101
- responsive: true,
102
- maintainAspectRatio: false,
103
- plugins: {
104
- legend: {
105
- labels: {
106
- color: textColor,
107
- font: {
108
- family: style.getPropertyValue('--ot-font-primary').trim()
109
- }
74
+ ...dataset,
75
+ backgroundColor: dataset.backgroundColor || (fill ? colorOpacity : 'transparent'),
76
+ borderColor: dataset.borderColor || color,
77
+ borderWidth: dataset.borderWidth || 2,
78
+ pointBackgroundColor: dataset.pointBackgroundColor || color,
79
+ pointBorderColor: dataset.pointBorderColor || '#fff',
80
+ pointHoverBackgroundColor: dataset.pointHoverBackgroundColor || '#fff',
81
+ pointHoverBorderColor: dataset.pointHoverBorderColor || color
82
+ };
83
+ });
84
+ };
85
+
86
+ this.config = () =>
87
+ {
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();
91
+
92
+ return {
93
+ type: 'radar',
94
+ data: {
95
+ labels: data['labels'],
96
+ datasets: this.datasets()
97
+ },
98
+ options: {
99
+ responsive: true,
100
+ maintainAspectRatio: false,
101
+ plugins: {
102
+ legend: {
103
+ labels: {
104
+ color: textColor,
105
+ font: {
106
+ family: style.getPropertyValue('--ot-font-primary').trim()
110
107
  }
111
108
  }
112
- },
113
- scales: {
114
- r: {
115
- angleLines: {
116
- color: gridColor
117
- },
118
- grid: {
119
- color: gridColor
120
- },
121
- pointLabels: {
122
- color: textColor
123
- },
124
- ticks: {
125
- color: textColor,
126
- backdropColor: 'transparent'
127
- },
128
- beginAtZero: true
129
- }
130
- },
131
- ...data['options'].value
132
- }
133
- };
109
+ }
110
+ },
111
+ scales: {
112
+ r: {
113
+ angleLines: {
114
+ color: gridColor
115
+ },
116
+ grid: {
117
+ color: gridColor
118
+ },
119
+ pointLabels: {
120
+ color: textColor
121
+ },
122
+ ticks: {
123
+ color: textColor,
124
+ backdropColor: 'transparent'
125
+ },
126
+ beginAtZero: true
127
+ }
128
+ },
129
+ ...data['options']
130
+ }
134
131
  };
132
+ };
135
133
 
136
- this.initialize = () =>
134
+ this.initialize = () =>
135
+ {
136
+ setTimeout(() =>
137
137
  {
138
- setTimeout(() =>
138
+ if(typeof Chart === 'undefined')
139
139
  {
140
- if(typeof Chart === 'undefined')
141
- {
142
- console.error('Chart.js library not loaded');
143
- return;
144
- }
140
+ console.error('Chart.js library not loaded');
141
+ return;
142
+ }
145
143
 
146
- const context = this.canvas.getContext('2d');
147
- this.instance = new Chart(context, this.config());
144
+ const context = this.canvas.getContext('2d');
145
+ this.instance = new Chart(context, this.config());
148
146
 
149
- node.chart = this.instance;
150
- }, 100);
151
- };
147
+ node.chart = this.instance;
148
+ }, 100);
149
+ };
152
150
 
153
- this.setup();
154
- this.initialize();
155
- }
156
- });
157
- });
151
+ this.setup();
152
+ this.initialize();
153
+ }
154
+ });
@@ -1,152 +1,149 @@
1
- onetype.AddonReady('transforms', (transforms) =>
2
- {
3
- transforms.ItemAdd({
4
- id: 'ot-chart-scatter',
5
- icon: 'scatter_plot',
6
- name: 'Scatter Plot',
7
- description: 'Scatter plot for correlation data. Show relationship between two variables with points.',
8
- js: [
9
- 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
10
- ],
11
- config: {
12
- 'datasets': ['array', []],
13
- 'options': ['object', {}]
14
- },
15
- code: function(data, item, compile, node, identifier)
1
+ transforms.ItemAdd({
2
+ id: 'ot-chart-scatter',
3
+ icon: 'scatter_plot',
4
+ name: 'Scatter Plot',
5
+ description: 'Scatter plot for correlation data. Show relationship between two variables with points.',
6
+ js: [
7
+ 'https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js'
8
+ ],
9
+ config: {
10
+ 'datasets': ['array', []],
11
+ 'options': ['object', {}]
12
+ },
13
+ code: function(data, node, transformer)
14
+ {
15
+ this.setup = () =>
16
16
  {
17
- this.setup = () =>
18
- {
19
- node.innerHTML = '';
20
- node.classList.add('ot-chart-scatter');
17
+ node.innerHTML = '';
18
+ node.classList.add('ot-chart-scatter');
21
19
 
22
- const canvas = document.createElement('canvas');
23
- this.canvas = canvas;
24
- node.appendChild(canvas);
25
- };
20
+ const canvas = document.createElement('canvas');
21
+ this.canvas = canvas;
22
+ node.appendChild(canvas);
23
+ };
26
24
 
27
- this.colors = () =>
28
- {
29
- const style = getComputedStyle(document.body);
25
+ this.colors = () =>
26
+ {
27
+ const style = getComputedStyle(document.body);
30
28
 
31
- return {
32
- brand: style.getPropertyValue('--ot-brand').trim(),
33
- blue: style.getPropertyValue('--ot-blue').trim(),
34
- green: style.getPropertyValue('--ot-green').trim(),
35
- orange: style.getPropertyValue('--ot-orange').trim(),
36
- red: style.getPropertyValue('--ot-red').trim()
37
- };
29
+ return {
30
+ brand: style.getPropertyValue('--ot-brand').trim(),
31
+ blue: style.getPropertyValue('--ot-blue').trim(),
32
+ green: style.getPropertyValue('--ot-green').trim(),
33
+ orange: style.getPropertyValue('--ot-orange').trim(),
34
+ red: style.getPropertyValue('--ot-red').trim()
38
35
  };
36
+ };
39
37
 
40
- this.datasets = () =>
41
- {
42
- const datasets = data['datasets'].value;
43
- const colors = this.colors();
44
- const palette = [colors.brand, colors.blue, colors.green, colors.orange, colors.red];
45
-
46
- if(datasets.length === 0)
47
- {
48
- return [{
49
- label: 'Sample Data',
50
- data: [
51
- {x: 10, y: 20},
52
- {x: 15, y: 35},
53
- {x: 20, y: 30},
54
- {x: 25, y: 45},
55
- {x: 30, y: 40},
56
- {x: 35, y: 55}
57
- ],
58
- backgroundColor: palette[0],
59
- borderColor: palette[0],
60
- borderWidth: 1,
61
- pointRadius: 5
62
- }];
63
- }
64
-
65
- return datasets.map((dataset, index) =>
66
- {
67
- const color = palette[index % palette.length];
38
+ this.datasets = () =>
39
+ {
40
+ const datasets = data['datasets'];
41
+ const colors = this.colors();
42
+ const palette = [colors.brand, colors.blue, colors.green, colors.orange, colors.red];
68
43
 
69
- return {
70
- ...dataset,
71
- backgroundColor: dataset.backgroundColor || color,
72
- borderColor: dataset.borderColor || color,
73
- borderWidth: dataset.borderWidth || 1,
74
- pointRadius: dataset.pointRadius || 5
75
- };
76
- });
77
- };
44
+ if(datasets.length === 0)
45
+ {
46
+ return [{
47
+ label: 'Sample Data',
48
+ data: [
49
+ {x: 10, y: 20},
50
+ {x: 15, y: 35},
51
+ {x: 20, y: 30},
52
+ {x: 25, y: 45},
53
+ {x: 30, y: 40},
54
+ {x: 35, y: 55}
55
+ ],
56
+ backgroundColor: palette[0],
57
+ borderColor: palette[0],
58
+ borderWidth: 1,
59
+ pointRadius: 5
60
+ }];
61
+ }
78
62
 
79
- this.config = () =>
63
+ return datasets.map((dataset, index) =>
80
64
  {
81
- const style = getComputedStyle(document.body);
82
- const textColor = style.getPropertyValue('--ot-text-1').trim();
83
- const gridColor = style.getPropertyValue('--ot-bg-3-border').trim();
65
+ const color = palette[index % palette.length];
84
66
 
85
67
  return {
86
- type: 'scatter',
87
- data: {
88
- datasets: this.datasets()
89
- },
90
- options: {
91
- responsive: true,
92
- maintainAspectRatio: false,
93
- plugins: {
94
- legend: {
95
- labels: {
96
- color: textColor,
97
- font: {
98
- family: style.getPropertyValue('--ot-font-primary').trim()
99
- }
68
+ ...dataset,
69
+ backgroundColor: dataset.backgroundColor || color,
70
+ borderColor: dataset.borderColor || color,
71
+ borderWidth: dataset.borderWidth || 1,
72
+ pointRadius: dataset.pointRadius || 5
73
+ };
74
+ });
75
+ };
76
+
77
+ this.config = () =>
78
+ {
79
+ const style = getComputedStyle(document.body);
80
+ const textColor = style.getPropertyValue('--ot-text-1').trim();
81
+ const gridColor = style.getPropertyValue('--ot-bg-3-border').trim();
82
+
83
+ return {
84
+ type: 'scatter',
85
+ data: {
86
+ datasets: this.datasets()
87
+ },
88
+ options: {
89
+ responsive: true,
90
+ maintainAspectRatio: false,
91
+ plugins: {
92
+ legend: {
93
+ labels: {
94
+ color: textColor,
95
+ font: {
96
+ family: style.getPropertyValue('--ot-font-primary').trim()
100
97
  }
101
98
  }
102
- },
103
- scales: {
104
- x: {
105
- type: 'linear',
106
- position: 'bottom',
107
- ticks: { color: textColor },
108
- grid: { color: gridColor },
109
- title: {
110
- display: true,
111
- text: 'X Axis',
112
- color: textColor
113
- }
114
- },
115
- y: {
116
- type: 'linear',
117
- ticks: { color: textColor },
118
- grid: { color: gridColor },
119
- title: {
120
- display: true,
121
- text: 'Y Axis',
122
- color: textColor
123
- }
99
+ }
100
+ },
101
+ scales: {
102
+ x: {
103
+ type: 'linear',
104
+ position: 'bottom',
105
+ ticks: { color: textColor },
106
+ grid: { color: gridColor },
107
+ title: {
108
+ display: true,
109
+ text: 'X Axis',
110
+ color: textColor
124
111
  }
125
112
  },
126
- ...data['options'].value
127
- }
128
- };
113
+ y: {
114
+ type: 'linear',
115
+ ticks: { color: textColor },
116
+ grid: { color: gridColor },
117
+ title: {
118
+ display: true,
119
+ text: 'Y Axis',
120
+ color: textColor
121
+ }
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,5 +1,3 @@
1
- onetype.AddonReady('transforms', (transforms) =>
2
- {
3
1
  transforms.ItemAdd({
4
2
  id: 'codeflask',
5
3
  icon: 'code',
@@ -15,14 +13,14 @@ onetype.AddonReady('transforms', (transforms) =>
15
13
  'readonly': ['boolean', false],
16
14
  'onUpdate': ['function']
17
15
  },
18
- code: function(data, item, compile, node, identifier)
16
+ code: function(data, node, transformer)
19
17
  {
20
18
  this.setup = () =>
21
19
  {
22
20
  node.classList.add('codeflask-editor');
23
21
  node.classList.add('codeflask-editor-' + identifier);
24
22
 
25
- const initialValue = data['value'].value || node.textContent || '';
23
+ const initialValue = data['value'] || node.textContent || '';
26
24
  node.innerHTML = '';
27
25
 
28
26
  this.container = document.createElement('div');
@@ -36,17 +34,17 @@ onetype.AddonReady('transforms', (transforms) =>
36
34
  {
37
35
  const style = document.createElement('style');
38
36
  style.textContent = `
39
- .codeflask-editor-${identifier}
37
+ .codeflask-editor-${id}
40
38
  {
41
39
  height: 100%;
42
40
  width: 100%;
43
41
  }
44
- .codeflask-editor-${identifier} .codeflask-container
42
+ .codeflask-editor-${id} .codeflask-container
45
43
  {
46
44
  height: 100%;
47
45
  width: 100%;
48
46
  }
49
- .codeflask-editor-${identifier} .codeflask
47
+ .codeflask-editor-${id} .codeflask
50
48
  {
51
49
  height: 100%;
52
50
  }
@@ -66,9 +64,9 @@ onetype.AddonReady('transforms', (transforms) =>
66
64
  }
67
65
 
68
66
  const flask = new CodeFlask(this.container, {
69
- language: data['language'].value || 'markup',
70
- lineNumbers: data['line-numbers'].value !== false,
71
- readonly: data['readonly'].value === true
67
+ language: data['language'] || 'markup',
68
+ lineNumbers: data['line-numbers'] !== false,
69
+ readonly: data['readonly'] === true
72
70
  });
73
71
 
74
72
  flask.updateCode(this.initialValue);
@@ -77,7 +75,7 @@ onetype.AddonReady('transforms', (transforms) =>
77
75
 
78
76
  flask.onUpdate((code) =>
79
77
  {
80
- // const onUpdate = data['onUpdate'].value;
78
+ // const onUpdate = data['onUpdate'];
81
79
  // if(typeof onUpdate === 'function')
82
80
  // {
83
81
  // onUpdate({value: code, node});
@@ -96,4 +94,4 @@ onetype.AddonReady('transforms', (transforms) =>
96
94
  this.initialize();
97
95
  }
98
96
  });
99
- });
97
+