@social-mail/social-mail-client 1.0.55 → 1.0.57

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.
@@ -22859,7 +22859,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22859
22859
 
22860
22860
  display: flex;
22861
22861
  flex-direction: column;
22862
- gap: 5px;
22863
22862
 
22864
22863
  & [data-layout=tree-view-item] {
22865
22864
 
@@ -22868,11 +22867,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22868
22867
  grid-template-rows: auto auto;
22869
22868
  align-items: center;
22870
22869
 
22871
- &[data-selected] {
22872
- & > [data-element=label] {
22873
- background-color: Highlight;
22874
- color: HighlightText;
22875
- }
22870
+ &:hover {
22871
+ background-color: var(--hover-color);
22872
+ color: var(--hover-text-color);
22876
22873
  }
22877
22874
 
22878
22875
  & > [data-element=action] {
@@ -22883,9 +22880,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22883
22880
  & > [data-element=label] {
22884
22881
  grid-row: 1;
22885
22882
  grid-column: 2;
22886
- padding: 2px;
22887
- padding-left: 5px;
22888
- padding-right: 5px;
22883
+ padding: 5px;
22889
22884
  max-width: 200px;
22890
22885
  white-space: nowrap;
22891
22886
  text-overflow: ellipsis;
@@ -22893,11 +22888,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22893
22888
  cursor: pointer;
22894
22889
  }
22895
22890
 
22891
+ &[data-selected] {
22892
+ background-color: var(--selection-color);
22893
+ color: var(--selection-text-color);
22894
+ }
22895
+
22896
22896
  & > [data-element=expand-collapse] {
22897
22897
 
22898
22898
  grid-row: 1;
22899
22899
  grid-column: 1;
22900
- padding-right: 5px;
22900
+ padding: 5px;
22901
22901
  cursor: pointer;
22902
22902
 
22903
22903
  &::before {
@@ -22905,15 +22905,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22905
22905
  }
22906
22906
  }
22907
22907
 
22908
- & > [data-element=children] {
22909
-
22910
- display: none;
22911
- padding: 5px;
22912
- grid-row: 2;
22913
- grid-column: 1 / span 2;
22914
- padding-left: 10px;
22915
- }
22916
-
22917
22908
  &[data-expanded] {
22918
22909
 
22919
22910
  & > [data-element=expand-collapse] {
@@ -22986,7 +22977,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22986
22977
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.dispose();
22987
22978
  if (this.root && this.childrenProperty && this.labelRenderer && this.collapseIconRenderer) {
22988
22979
  this.element.innerHTML = "";
22989
- this.createElement(this.element, this.root, -1);
22980
+ this.createElement(this.root, void 0, -1);
22990
22981
  this.expand(this.root);
22991
22982
  if (this.selectedItem) {
22992
22983
  this.selectItem(this.selectedItem);
@@ -23026,7 +23017,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
23026
23017
  this.runAfterInit(() => {
23027
23018
  if (this.root && !this.element.firstElementChild) {
23028
23019
  if (this.childrenProperty) {
23029
- this.createElement(this.element, this.root);
23020
+ this.createElement(this.root);
23030
23021
  this.expand(this.root);
23031
23022
  }
23032
23023
  if (this.selectedItem) {
@@ -23046,92 +23037,143 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
23046
23037
  });
23047
23038
  }
23048
23039
  expandElement(element, toggle = true) {
23049
- if (element === null || element === void 0 ? void 0 : element.dataItem) {
23050
- if (element.getAttribute("data-expanded")) {
23051
- if (toggle) {
23052
- element.removeAttribute("data-expanded");
23053
- element.dispatchEvent(new CustomEvent("itemCollapsed", {
23054
- detail: element.dataItem,
23055
- bubbles: true,
23056
- cancelable: true
23057
- }));
23058
- }
23059
- } else {
23060
- element.setAttribute("data-expanded", "true");
23061
- element.dispatchEvent(new CustomEvent("itemExpanded", {
23062
- detail: element.dataItem,
23040
+ if (!element) {
23041
+ return;
23042
+ }
23043
+ const {
23044
+ dataItem
23045
+ } = element;
23046
+ if (!dataItem) {
23047
+ return;
23048
+ }
23049
+ if (element.getAttribute("data-expanded")) {
23050
+ if (toggle) {
23051
+ element.removeAttribute("data-expanded");
23052
+ element.dispatchEvent(new CustomEvent("itemCollapsed", {
23053
+ detail: dataItem,
23063
23054
  bubbles: true,
23064
23055
  cancelable: true
23065
23056
  }));
23057
+ this.updateExpanded(dataItem, false);
23066
23058
  }
23059
+ } else {
23060
+ element.setAttribute("data-expanded", "true");
23061
+ element.dispatchEvent(new CustomEvent("itemExpanded", {
23062
+ detail: dataItem,
23063
+ bubbles: true,
23064
+ cancelable: true
23065
+ }));
23066
+ this.updateExpanded(dataItem, true);
23067
23067
  }
23068
23068
  }
23069
- createElement(parent, item, insertIndex = -1) {
23069
+ createElement(item, parentItem, insertIndex = -1) {
23070
23070
  var _a, _b, _c, _d, _e, _f;
23071
23071
  const element = document.createElement("div");
23072
23072
  element.setAttribute("data-layout", "tree-view-item");
23073
23073
  element.dataItem = item;
23074
- element.parentItem = ((_a = parent.parentElement) !== null && _a !== void 0 ? _a : parent).dataItem;
23074
+ element.parentItem = parentItem;
23075
23075
  this.map.set(item, element);
23076
23076
  const children = this.childrenProperty(item);
23077
23077
  if (!children) {
23078
23078
  throw new Error("Children array must not be empty");
23079
23079
  }
23080
- const childrenElement = document.createElement("div");
23081
- childrenElement.setAttribute("data-element", "children");
23082
- element.appendChild(childrenElement);
23083
23080
  const watcher = children.watch((target, event, index, child) => {
23081
+ var _a;
23084
23082
  if (event === "add" || event === "set") {
23085
- this.createElement(childrenElement, child, index);
23083
+ this.createElement(child, item, index);
23086
23084
  return;
23087
23085
  }
23088
23086
  if (event === "remove") {
23089
- for (const iterator of Array.from(childrenElement.children)) {
23090
- if (iterator.dataItem === child) {
23091
- iterator.remove();
23092
- return;
23093
- }
23094
- }
23087
+ const childElement = this.map.get(child);
23088
+ childElement === null || childElement === void 0 ? void 0 : childElement.dispose();
23089
+ return;
23095
23090
  }
23096
- for (const iterator of Array.from(childrenElement.children)) {
23097
- iterator === null || iterator === void 0 ? void 0 : iterator.dispose();
23091
+ for (const iterator of children) {
23092
+ (_a = this.map.get(iterator)) === null || _a === void 0 ? void 0 : _a.dispose();
23098
23093
  }
23099
23094
  for (const iterator of children) {
23100
- this.createElement(element, iterator);
23095
+ this.createElement(iterator, item);
23101
23096
  }
23102
23097
  });
23103
23098
  element.dispose = () => {
23099
+ var _a;
23104
23100
  watcher.dispose();
23105
- for (const iterator of Array.from(childrenElement.children)) {
23106
- iterator === null || iterator === void 0 ? void 0 : iterator.dispose();
23101
+ for (const iterator of children) {
23102
+ (_a = this.map.get(iterator)) === null || _a === void 0 ? void 0 : _a.dispose();
23107
23103
  }
23108
23104
  element.remove();
23109
23105
  };
23110
- const actionElement = (_b = this.actionRenderer) === null || _b === void 0 ? void 0 : _b.call(this, item);
23106
+ const actionElement = (_a = this.actionRenderer) === null || _a === void 0 ? void 0 : _a.call(this, item);
23111
23107
  const collapseElement = this.collapseIconRenderer(item);
23112
23108
  const labelElement = this.labelRenderer(item);
23113
23109
  if (labelElement) {
23114
- const a = (_c = labelElement.attributes) !== null && _c !== void 0 ? _c : labelElement.attributes = {};
23110
+ const a = (_b = labelElement.attributes) !== null && _b !== void 0 ? _b : labelElement.attributes = {};
23115
23111
  a["data-element"] = "label";
23116
- (_d = a["data-click-event"]) !== null && _d !== void 0 ? _d : a["data-click-event"] = "select-item";
23112
+ (_c = a["data-click-event"]) !== null && _c !== void 0 ? _c : a["data-click-event"] = "select-item";
23117
23113
  this.render(XNode.create("div", null, labelElement), element, this);
23118
23114
  }
23119
23115
  if (actionElement) {
23120
- ((_e = actionElement.attributes) !== null && _e !== void 0 ? _e : actionElement.attributes = {})["data-element"] = "action";
23116
+ ((_d = actionElement.attributes) !== null && _d !== void 0 ? _d : actionElement.attributes = {})["data-element"] = "action";
23121
23117
  this.render(XNode.create("div", null, actionElement), element, this);
23122
23118
  }
23123
23119
  if (collapseElement) {
23124
- const a = (_f = collapseElement.attributes) !== null && _f !== void 0 ? _f : collapseElement.attributes = {};
23120
+ const a = (_e = collapseElement.attributes) !== null && _e !== void 0 ? _e : collapseElement.attributes = {};
23125
23121
  a["data-element"] = "expand-collapse";
23126
23122
  a["data-click-event"] = "toggle-expand";
23127
23123
  this.render(XNode.create("div", null, collapseElement), element, this);
23128
23124
  }
23125
+ const header = document.createElement("div");
23126
+ header.setAttribute("data-element", "header");
23127
+ element.appendChild(header);
23128
+ const parentElement = this.map.get(parentItem);
23129
+ let last = parentElement;
23130
+ if (parentItem) {
23131
+ const siblings = this.childrenProperty(parentItem);
23132
+ if (insertIndex === -1) {
23133
+ insertIndex = siblings.indexOf(item);
23134
+ }
23135
+ if (insertIndex >= 1) {
23136
+ last = this.map.get(siblings[insertIndex - 1]);
23137
+ }
23138
+ last.insertAdjacentElement("afterend", element);
23139
+ const pad = Number((_f = parentElement.getAttribute("data-pad")) !== null && _f !== void 0 ? _f : "0") + 10;
23140
+ element.setAttribute("data-pad", `${pad}`);
23141
+ element.style.paddingLeft = `${pad}px`;
23142
+ } else {
23143
+ this.element.appendChild(element);
23144
+ this.expandElement(element, false);
23145
+ }
23129
23146
  for (const iterator of children) {
23130
- this.createElement(childrenElement, iterator);
23147
+ this.createElement(iterator, item);
23131
23148
  }
23132
- parent.appendChild(element);
23149
+ setTimeout(() => this.updateExpanded(), 1);
23133
23150
  return element;
23134
23151
  }
23152
+ updateExpanded(item, show) {
23153
+ if (!item) {
23154
+ item = this.root;
23155
+ show = true;
23156
+ }
23157
+ const element = this.map.get(item);
23158
+ if (!element) {
23159
+ return;
23160
+ }
23161
+ if (item === this.root) {
23162
+ show = true;
23163
+ } else if (show === void 0) {
23164
+ show = element.getAttribute("data-expanded") === "true";
23165
+ }
23166
+ if (show) {
23167
+ element.style.display = "";
23168
+ } else {
23169
+ element.style.display = "none";
23170
+ }
23171
+ const children = this.childrenProperty(element.dataItem);
23172
+ show && (show = element.getAttribute("data-expanded") === "true");
23173
+ for (const iterator of children) {
23174
+ this.updateExpanded(iterator, show);
23175
+ }
23176
+ }
23135
23177
  });
23136
23178
  __decorate([BindableProperty, __metadata("design:type", Object)], TreeView.prototype, "root", void 0);
23137
23179
  __decorate([BindableProperty, __metadata("design:type", Object)], TreeView.prototype, "selectedItem", void 0);
@@ -26228,7 +26270,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
26228
26270
  "data-padding": "large",
26229
26271
  "data-font-size": "large",
26230
26272
  "data-color": "white",
26231
- text: "Social Mail Admin"
26273
+ text: "Social Mail"
26232
26274
  })), XNode.create(MenuItem, {
26233
26275
  icon: "fas fa-home",
26234
26276
  label: "Home",