@accelerated-agency/visual-editor 0.5.9 → 0.6.0

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 (3) hide show
  1. package/dist/vite.cjs +33 -23
  2. package/dist/vite.js +33 -23
  3. package/package.json +1 -1
package/dist/vite.cjs CHANGED
@@ -1039,24 +1039,16 @@ button.var-tab.active{
1039
1039
  .lp-body #tab-dom-tree, .lp-body #tab-elements{
1040
1040
  padding-top:4px;
1041
1041
  }
1042
- .lp-body #tab-elements .dt-lbl{
1043
- font-size: 12px;
1044
- font-style: normal;
1045
- font-weight: 500;
1046
- line-height: 14px;
1047
- letter-spacing: -0.1px;
1048
- }
1049
- .lp-body #tab-elements #elements-root > .dt-row{
1050
- padding-left: 16px!important;
1051
- }
1052
- .lp-body #dom-tree-root .dt-lbl{
1042
+ .lp-body #dom-tree-root .dt-lbl,
1043
+ .lp-body #elements-root .dt-lbl{
1053
1044
  color: var(--content-subtle, #737373);
1054
1045
  font-style: normal;
1055
1046
  font-weight: 400;
1056
- line-height: var(--font-leading-3, 12px); /* 100% */
1047
+ line-height: var(--font-leading-3, 12px);
1057
1048
  letter-spacing: -0.1px;
1058
1049
  }
1059
- .lp-body #dom-tree-root .dt-lbl .dt-tag{
1050
+ .lp-body #dom-tree-root .dt-lbl .dt-tag,
1051
+ .lp-body #elements-root .dt-lbl .dt-tag{
1060
1052
  color: var(--content-strong, #171717);
1061
1053
  font-family: "JetBrains Mono";
1062
1054
  font-size: 12px;
@@ -1070,7 +1062,6 @@ padding:3px 6px;
1070
1062
  display:inline-block;
1071
1063
  margin-right:4px;
1072
1064
  }
1073
- .lp-body #tab-elements .dt-row .dt-chev.dt-spacer{display:none;}
1074
1065
  .lp-body #tab-dom-tree .dt-row .dt-ico{display:none;}
1075
1066
  .lp-body, .section-components-body{flex:1;overflow-y:auto}
1076
1067
  .lp-body::-webkit-scrollbar, .section-components-body::-webkit-scrollbar{width:3px}
@@ -6200,17 +6191,12 @@ function renderElementsTree(filterRaw) {
6200
6191
  return 'bi bi-square';
6201
6192
  }
6202
6193
 
6203
- function labelFor(el) {
6204
- var tag = (el.tagName || '').toLowerCase();
6205
- return tag.toUpperCase();
6206
- }
6207
-
6208
6194
  var nodes = collectEditorInsertedElements(doc);
6209
6195
 
6210
6196
  root.innerHTML = '';
6211
6197
  for (var i = 0; i < nodes.length; i++) {
6212
6198
  var el = nodes[i];
6213
- var lblText = labelFor(el);
6199
+ var lblText = domTreeLabelFor(el);
6214
6200
  if (filterText && lblText.toLowerCase().indexOf(filterText) < 0) continue;
6215
6201
 
6216
6202
  var row = document.createElement('div');
@@ -6229,7 +6215,7 @@ function renderElementsTree(filterRaw) {
6229
6215
 
6230
6216
  var lbl = document.createElement('div');
6231
6217
  lbl.className = 'dt-lbl';
6232
- lbl.textContent = lblText;
6218
+ setDomTreeLabelContent(lbl, el);
6233
6219
  lbl.title = buildSelector(el);
6234
6220
 
6235
6221
  row.appendChild(spacer);
@@ -6254,11 +6240,35 @@ function renderElementsTree(filterRaw) {
6254
6240
  };
6255
6241
  }
6256
6242
 
6243
+ function domTreeLabelClassExcluded(className) {
6244
+ var c = String(className || '');
6245
+ return !c || c === 'vve-selected' || c === 'vve-tree-hover' || c.indexOf('vve-') === 0;
6246
+ }
6247
+
6248
+ function domTreeLabelClassString(el) {
6249
+ if (!el) return '';
6250
+ try {
6251
+ if (el.classList && el.classList.length) {
6252
+ var out = [];
6253
+ for (var i = 0; i < el.classList.length; i++) {
6254
+ var cls = el.classList[i];
6255
+ if (!domTreeLabelClassExcluded(cls)) out.push(cls);
6256
+ }
6257
+ return out.join(' ');
6258
+ }
6259
+ } catch(_) {}
6260
+ var cn = el.className;
6261
+ if (cn && typeof cn === 'object' && cn.baseVal != null) cn = String(cn.baseVal);
6262
+ return typeof cn === 'string' ? cn : '';
6263
+ }
6264
+
6257
6265
  function domTreeLabelSuffix(el) {
6258
6266
  if (el.id != null && el.id !== '') return '#' + String(el.id).slice(0, 40);
6259
- var cn = el.className && typeof el.className === 'string' ? el.className.trim() : '';
6267
+ var cn = domTreeLabelClassString(el).trim();
6260
6268
  if (cn) {
6261
- var parts = cn.split(/s+/).filter(function(x) { return x.indexOf('vve-') !== 0; }).slice(0, 2).join('.');
6269
+ var parts = cn.split(/s+/).filter(function(x) {
6270
+ return x && !domTreeLabelClassExcluded(x);
6271
+ }).slice(0, 2).join('.');
6262
6272
  if (parts) return '.' + parts.slice(0, 56);
6263
6273
  }
6264
6274
  return '';
package/dist/vite.js CHANGED
@@ -1031,24 +1031,16 @@ button.var-tab.active{
1031
1031
  .lp-body #tab-dom-tree, .lp-body #tab-elements{
1032
1032
  padding-top:4px;
1033
1033
  }
1034
- .lp-body #tab-elements .dt-lbl{
1035
- font-size: 12px;
1036
- font-style: normal;
1037
- font-weight: 500;
1038
- line-height: 14px;
1039
- letter-spacing: -0.1px;
1040
- }
1041
- .lp-body #tab-elements #elements-root > .dt-row{
1042
- padding-left: 16px!important;
1043
- }
1044
- .lp-body #dom-tree-root .dt-lbl{
1034
+ .lp-body #dom-tree-root .dt-lbl,
1035
+ .lp-body #elements-root .dt-lbl{
1045
1036
  color: var(--content-subtle, #737373);
1046
1037
  font-style: normal;
1047
1038
  font-weight: 400;
1048
- line-height: var(--font-leading-3, 12px); /* 100% */
1039
+ line-height: var(--font-leading-3, 12px);
1049
1040
  letter-spacing: -0.1px;
1050
1041
  }
1051
- .lp-body #dom-tree-root .dt-lbl .dt-tag{
1042
+ .lp-body #dom-tree-root .dt-lbl .dt-tag,
1043
+ .lp-body #elements-root .dt-lbl .dt-tag{
1052
1044
  color: var(--content-strong, #171717);
1053
1045
  font-family: "JetBrains Mono";
1054
1046
  font-size: 12px;
@@ -1062,7 +1054,6 @@ padding:3px 6px;
1062
1054
  display:inline-block;
1063
1055
  margin-right:4px;
1064
1056
  }
1065
- .lp-body #tab-elements .dt-row .dt-chev.dt-spacer{display:none;}
1066
1057
  .lp-body #tab-dom-tree .dt-row .dt-ico{display:none;}
1067
1058
  .lp-body, .section-components-body{flex:1;overflow-y:auto}
1068
1059
  .lp-body::-webkit-scrollbar, .section-components-body::-webkit-scrollbar{width:3px}
@@ -6192,17 +6183,12 @@ function renderElementsTree(filterRaw) {
6192
6183
  return 'bi bi-square';
6193
6184
  }
6194
6185
 
6195
- function labelFor(el) {
6196
- var tag = (el.tagName || '').toLowerCase();
6197
- return tag.toUpperCase();
6198
- }
6199
-
6200
6186
  var nodes = collectEditorInsertedElements(doc);
6201
6187
 
6202
6188
  root.innerHTML = '';
6203
6189
  for (var i = 0; i < nodes.length; i++) {
6204
6190
  var el = nodes[i];
6205
- var lblText = labelFor(el);
6191
+ var lblText = domTreeLabelFor(el);
6206
6192
  if (filterText && lblText.toLowerCase().indexOf(filterText) < 0) continue;
6207
6193
 
6208
6194
  var row = document.createElement('div');
@@ -6221,7 +6207,7 @@ function renderElementsTree(filterRaw) {
6221
6207
 
6222
6208
  var lbl = document.createElement('div');
6223
6209
  lbl.className = 'dt-lbl';
6224
- lbl.textContent = lblText;
6210
+ setDomTreeLabelContent(lbl, el);
6225
6211
  lbl.title = buildSelector(el);
6226
6212
 
6227
6213
  row.appendChild(spacer);
@@ -6246,11 +6232,35 @@ function renderElementsTree(filterRaw) {
6246
6232
  };
6247
6233
  }
6248
6234
 
6235
+ function domTreeLabelClassExcluded(className) {
6236
+ var c = String(className || '');
6237
+ return !c || c === 'vve-selected' || c === 'vve-tree-hover' || c.indexOf('vve-') === 0;
6238
+ }
6239
+
6240
+ function domTreeLabelClassString(el) {
6241
+ if (!el) return '';
6242
+ try {
6243
+ if (el.classList && el.classList.length) {
6244
+ var out = [];
6245
+ for (var i = 0; i < el.classList.length; i++) {
6246
+ var cls = el.classList[i];
6247
+ if (!domTreeLabelClassExcluded(cls)) out.push(cls);
6248
+ }
6249
+ return out.join(' ');
6250
+ }
6251
+ } catch(_) {}
6252
+ var cn = el.className;
6253
+ if (cn && typeof cn === 'object' && cn.baseVal != null) cn = String(cn.baseVal);
6254
+ return typeof cn === 'string' ? cn : '';
6255
+ }
6256
+
6249
6257
  function domTreeLabelSuffix(el) {
6250
6258
  if (el.id != null && el.id !== '') return '#' + String(el.id).slice(0, 40);
6251
- var cn = el.className && typeof el.className === 'string' ? el.className.trim() : '';
6259
+ var cn = domTreeLabelClassString(el).trim();
6252
6260
  if (cn) {
6253
- var parts = cn.split(/s+/).filter(function(x) { return x.indexOf('vve-') !== 0; }).slice(0, 2).join('.');
6261
+ var parts = cn.split(/s+/).filter(function(x) {
6262
+ return x && !domTreeLabelClassExcluded(x);
6263
+ }).slice(0, 2).join('.');
6254
6264
  if (parts) return '.' + parts.slice(0, 56);
6255
6265
  }
6256
6266
  return '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelerated-agency/visual-editor",
3
- "version": "0.5.9",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "description": "Conversion visual editor as a reusable React package",
6
6
  "type": "module",