@tmagic/editor 1.0.0-rc.1 → 1.0.0-rc.12

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 (96) hide show
  1. package/dist/style.css +7 -3
  2. package/dist/tmagic-editor.es.js +304 -1405
  3. package/dist/tmagic-editor.es.js.map +1 -1
  4. package/dist/tmagic-editor.umd.js +304 -1407
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/dist/types/src/Editor.vue.d.ts +42 -1
  7. package/dist/types/src/fields/Code.vue.d.ts +4 -4
  8. package/dist/types/src/fields/CodeLink.vue.d.ts +1 -3
  9. package/dist/types/src/layouts/Framework.vue.d.ts +15 -3
  10. package/dist/types/src/layouts/PropsPanel.vue.d.ts +2 -4
  11. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +3 -27
  12. package/dist/types/src/services/BaseService.d.ts +1 -1
  13. package/dist/types/src/services/editor.d.ts +6 -3
  14. package/dist/types/src/services/history.d.ts +1 -18
  15. package/dist/types/src/services/props.d.ts +8 -2
  16. package/dist/types/src/type.d.ts +9 -0
  17. package/dist/types/src/utils/editor.d.ts +0 -6
  18. package/dist/types/src/utils/props.d.ts +10 -1
  19. package/package.json +17 -18
  20. package/src/Editor.vue +41 -9
  21. package/src/components/ContentMenu.vue +59 -26
  22. package/src/layouts/CodeEditor.vue +1 -4
  23. package/src/layouts/Framework.vue +14 -1
  24. package/src/layouts/PropsPanel.vue +1 -1
  25. package/src/layouts/sidebar/LayerMenu.vue +3 -0
  26. package/src/layouts/sidebar/TabPane.vue +1 -1
  27. package/src/layouts/workspace/Stage.vue +14 -31
  28. package/src/layouts/workspace/ViewerMenu.vue +17 -2
  29. package/src/layouts/workspace/Workspace.vue +21 -26
  30. package/src/services/BaseService.ts +1 -1
  31. package/src/services/editor.ts +49 -14
  32. package/src/services/props.ts +64 -9
  33. package/src/theme/page-bar.scss +1 -0
  34. package/src/theme/props-panel.scss +6 -4
  35. package/src/theme/workspace.scss +4 -0
  36. package/src/type.ts +10 -0
  37. package/src/utils/editor.ts +7 -52
  38. package/src/utils/polyfills.ts +5 -19
  39. package/src/utils/props.ts +31 -7
  40. package/LICENSE +0 -5432
  41. package/coverage/clover.xml +0 -1560
  42. package/coverage/coverage-final.json +0 -36
  43. package/coverage/lcov-report/base.css +0 -224
  44. package/coverage/lcov-report/block-navigation.js +0 -87
  45. package/coverage/lcov-report/favicon.png +0 -0
  46. package/coverage/lcov-report/index.html +0 -206
  47. package/coverage/lcov-report/prettify.css +0 -1
  48. package/coverage/lcov-report/prettify.js +0 -2
  49. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  50. package/coverage/lcov-report/sorter.js +0 -196
  51. package/coverage/lcov-report/src/Editor.vue.html +0 -787
  52. package/coverage/lcov-report/src/components/ContentMenu.vue.html +0 -406
  53. package/coverage/lcov-report/src/components/Icon.vue.html +0 -172
  54. package/coverage/lcov-report/src/components/ScrollViewer.vue.html +0 -283
  55. package/coverage/lcov-report/src/components/ToolButton.vue.html +0 -772
  56. package/coverage/lcov-report/src/components/index.html +0 -161
  57. package/coverage/lcov-report/src/index.html +0 -131
  58. package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +0 -214
  59. package/coverage/lcov-report/src/layouts/Framework.vue.html +0 -304
  60. package/coverage/lcov-report/src/layouts/NavMenu.vue.html +0 -208
  61. package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +0 -319
  62. package/coverage/lcov-report/src/layouts/Resizer.vue.html +0 -268
  63. package/coverage/lcov-report/src/layouts/index.html +0 -176
  64. package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +0 -358
  65. package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +0 -421
  66. package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +0 -775
  67. package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +0 -226
  68. package/coverage/lcov-report/src/layouts/sidebar/TabPane.vue.html +0 -289
  69. package/coverage/lcov-report/src/layouts/sidebar/index.html +0 -176
  70. package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +0 -718
  71. package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +0 -757
  72. package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +0 -532
  73. package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +0 -586
  74. package/coverage/lcov-report/src/layouts/workspace/index.html +0 -161
  75. package/coverage/lcov-report/src/services/BaseService.ts.html +0 -643
  76. package/coverage/lcov-report/src/services/componentList.ts.html +0 -229
  77. package/coverage/lcov-report/src/services/editor.ts.html +0 -2077
  78. package/coverage/lcov-report/src/services/events.ts.html +0 -331
  79. package/coverage/lcov-report/src/services/history.ts.html +0 -478
  80. package/coverage/lcov-report/src/services/index.html +0 -206
  81. package/coverage/lcov-report/src/services/props.ts.html +0 -415
  82. package/coverage/lcov-report/src/services/ui.ts.html +0 -580
  83. package/coverage/lcov-report/src/type.ts.html +0 -850
  84. package/coverage/lcov-report/src/utils/compose.ts.html +0 -184
  85. package/coverage/lcov-report/src/utils/config.ts.html +0 -172
  86. package/coverage/lcov-report/src/utils/editor.ts.html +0 -838
  87. package/coverage/lcov-report/src/utils/index.html +0 -221
  88. package/coverage/lcov-report/src/utils/index.ts.html +0 -151
  89. package/coverage/lcov-report/src/utils/logger.ts.html +0 -226
  90. package/coverage/lcov-report/src/utils/props.ts.html +0 -796
  91. package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +0 -733
  92. package/coverage/lcov-report/src/utils/undo-redo.ts.html +0 -313
  93. package/coverage/lcov.info +0 -3708
  94. package/dist/types/src/components/ToolButton.vue.d.ts +0 -46
  95. package/dist/types/src/fields/UISelect.vue.d.ts +0 -35
  96. package/dist/types/src/layouts/workspace/PageBar.vue.d.ts +0 -18
@@ -1,196 +0,0 @@
1
- /* eslint-disable */
2
- var addSorting = (function() {
3
- 'use strict';
4
- var cols,
5
- currentSort = {
6
- index: 0,
7
- desc: false
8
- };
9
-
10
- // returns the summary table element
11
- function getTable() {
12
- return document.querySelector('.coverage-summary');
13
- }
14
- // returns the thead element of the summary table
15
- function getTableHeader() {
16
- return getTable().querySelector('thead tr');
17
- }
18
- // returns the tbody element of the summary table
19
- function getTableBody() {
20
- return getTable().querySelector('tbody');
21
- }
22
- // returns the th element for nth column
23
- function getNthColumn(n) {
24
- return getTableHeader().querySelectorAll('th')[n];
25
- }
26
-
27
- function onFilterInput() {
28
- const searchValue = document.getElementById('fileSearch').value;
29
- const rows = document.getElementsByTagName('tbody')[0].children;
30
- for (let i = 0; i < rows.length; i++) {
31
- const row = rows[i];
32
- if (
33
- row.textContent
34
- .toLowerCase()
35
- .includes(searchValue.toLowerCase())
36
- ) {
37
- row.style.display = '';
38
- } else {
39
- row.style.display = 'none';
40
- }
41
- }
42
- }
43
-
44
- // loads the search box
45
- function addSearchBox() {
46
- var template = document.getElementById('filterTemplate');
47
- var templateClone = template.content.cloneNode(true);
48
- templateClone.getElementById('fileSearch').oninput = onFilterInput;
49
- template.parentElement.appendChild(templateClone);
50
- }
51
-
52
- // loads all columns
53
- function loadColumns() {
54
- var colNodes = getTableHeader().querySelectorAll('th'),
55
- colNode,
56
- cols = [],
57
- col,
58
- i;
59
-
60
- for (i = 0; i < colNodes.length; i += 1) {
61
- colNode = colNodes[i];
62
- col = {
63
- key: colNode.getAttribute('data-col'),
64
- sortable: !colNode.getAttribute('data-nosort'),
65
- type: colNode.getAttribute('data-type') || 'string'
66
- };
67
- cols.push(col);
68
- if (col.sortable) {
69
- col.defaultDescSort = col.type === 'number';
70
- colNode.innerHTML =
71
- colNode.innerHTML + '<span class="sorter"></span>';
72
- }
73
- }
74
- return cols;
75
- }
76
- // attaches a data attribute to every tr element with an object
77
- // of data values keyed by column name
78
- function loadRowData(tableRow) {
79
- var tableCols = tableRow.querySelectorAll('td'),
80
- colNode,
81
- col,
82
- data = {},
83
- i,
84
- val;
85
- for (i = 0; i < tableCols.length; i += 1) {
86
- colNode = tableCols[i];
87
- col = cols[i];
88
- val = colNode.getAttribute('data-value');
89
- if (col.type === 'number') {
90
- val = Number(val);
91
- }
92
- data[col.key] = val;
93
- }
94
- return data;
95
- }
96
- // loads all row data
97
- function loadData() {
98
- var rows = getTableBody().querySelectorAll('tr'),
99
- i;
100
-
101
- for (i = 0; i < rows.length; i += 1) {
102
- rows[i].data = loadRowData(rows[i]);
103
- }
104
- }
105
- // sorts the table using the data for the ith column
106
- function sortByIndex(index, desc) {
107
- var key = cols[index].key,
108
- sorter = function(a, b) {
109
- a = a.data[key];
110
- b = b.data[key];
111
- return a < b ? -1 : a > b ? 1 : 0;
112
- },
113
- finalSorter = sorter,
114
- tableBody = document.querySelector('.coverage-summary tbody'),
115
- rowNodes = tableBody.querySelectorAll('tr'),
116
- rows = [],
117
- i;
118
-
119
- if (desc) {
120
- finalSorter = function(a, b) {
121
- return -1 * sorter(a, b);
122
- };
123
- }
124
-
125
- for (i = 0; i < rowNodes.length; i += 1) {
126
- rows.push(rowNodes[i]);
127
- tableBody.removeChild(rowNodes[i]);
128
- }
129
-
130
- rows.sort(finalSorter);
131
-
132
- for (i = 0; i < rows.length; i += 1) {
133
- tableBody.appendChild(rows[i]);
134
- }
135
- }
136
- // removes sort indicators for current column being sorted
137
- function removeSortIndicators() {
138
- var col = getNthColumn(currentSort.index),
139
- cls = col.className;
140
-
141
- cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
142
- col.className = cls;
143
- }
144
- // adds sort indicators for current column being sorted
145
- function addSortIndicators() {
146
- getNthColumn(currentSort.index).className += currentSort.desc
147
- ? ' sorted-desc'
148
- : ' sorted';
149
- }
150
- // adds event listeners for all sorter widgets
151
- function enableUI() {
152
- var i,
153
- el,
154
- ithSorter = function ithSorter(i) {
155
- var col = cols[i];
156
-
157
- return function() {
158
- var desc = col.defaultDescSort;
159
-
160
- if (currentSort.index === i) {
161
- desc = !currentSort.desc;
162
- }
163
- sortByIndex(i, desc);
164
- removeSortIndicators();
165
- currentSort.index = i;
166
- currentSort.desc = desc;
167
- addSortIndicators();
168
- };
169
- };
170
- for (i = 0; i < cols.length; i += 1) {
171
- if (cols[i].sortable) {
172
- // add the click event handler on the th so users
173
- // dont have to click on those tiny arrows
174
- el = getNthColumn(i).querySelector('.sorter').parentElement;
175
- if (el.addEventListener) {
176
- el.addEventListener('click', ithSorter(i));
177
- } else {
178
- el.attachEvent('onclick', ithSorter(i));
179
- }
180
- }
181
- }
182
- }
183
- // adds sorting functionality to the UI
184
- return function() {
185
- if (!getTable()) {
186
- return;
187
- }
188
- cols = loadColumns();
189
- loadData();
190
- addSearchBox();
191
- addSortIndicators();
192
- enableUI();
193
- };
194
- })();
195
-
196
- window.addEventListener('load', addSorting);