@design.estate/dees-catalog 7.0.0 → 7.0.1

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.
@@ -94903,6 +94903,7 @@ var init_dees_icon = __esm({
94903
94903
  }
94904
94904
  })], _icon_dec = [n5({
94905
94905
  type: String,
94906
+ reflect: true,
94906
94907
  converter: {
94907
94908
  fromAttribute: /* @__PURE__ */ __name((value2) => value2, "fromAttribute"),
94908
94909
  toAttribute: /* @__PURE__ */ __name((value2) => value2, "toAttribute")
@@ -155107,7 +155108,7 @@ var demoFunc31 = /* @__PURE__ */ __name(() => b2`
155107
155108
  init_dist_ts26();
155108
155109
  init_dist_ts25();
155109
155110
  init_theme();
155110
- var _iconPosition_dec2, _icon_dec3, _fullWidth_dec2, _insideForm_dec, _shape_dec, _status_dec2, _size_dec3, _type_dec4, _isHidden_dec, _disabled_dec4, _eventDetailData_dec, _text_dec2, _a44, _DeesButton_decorators, _init41, _text2, _eventDetailData, _disabled4, _isHidden, _type4, _size3, _status2, _shape, _insideForm, _fullWidth2, _icon3, _iconPosition2;
155111
+ var _adoptedIconPosition_dec, _adoptedIcon_dec, _adoptedText_dec, _iconPosition_dec2, _icon_dec3, _fullWidth_dec2, _insideForm_dec, _shape_dec, _status_dec2, _size_dec3, _type_dec4, _isHidden_dec, _disabled_dec4, _eventDetailData_dec, _text_dec2, _a44, _DeesButton_decorators, _init41, _text2, _eventDetailData, _disabled4, _isHidden, _type4, _size3, _status2, _shape, _insideForm, _fullWidth2, _icon3, _iconPosition2, _adoptedText, _adoptedIcon, _adoptedIconPosition;
155111
155112
  _DeesButton_decorators = [customElement("dees-button")];
155112
155113
  var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n5({
155113
155114
  reflect: true,
@@ -155130,7 +155131,7 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155130
155131
  })], _insideForm_dec = [n5({
155131
155132
  type: Boolean,
155132
155133
  reflect: true
155133
- })], _fullWidth_dec2 = [n5({ type: Boolean, reflect: true, attribute: "full-width" })], _icon_dec3 = [n5({ type: String, reflect: true })], _iconPosition_dec2 = [n5({ type: String, reflect: true })], _a44) {
155134
+ })], _fullWidth_dec2 = [n5({ type: Boolean, reflect: true, attribute: "full-width" })], _icon_dec3 = [n5({ type: String, reflect: true })], _iconPosition_dec2 = [n5({ type: String, reflect: true })], _adoptedText_dec = [r5()], _adoptedIcon_dec = [r5()], _adoptedIconPosition_dec = [r5()], _a44) {
155134
155135
  constructor() {
155135
155136
  super();
155136
155137
  __privateAdd(this, _text2, __runInitializers(_init41, 8, this, "")), __runInitializers(_init41, 11, this);
@@ -155145,6 +155146,10 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155145
155146
  __privateAdd(this, _fullWidth2, __runInitializers(_init41, 44, this, false)), __runInitializers(_init41, 47, this);
155146
155147
  __privateAdd(this, _icon3, __runInitializers(_init41, 48, this)), __runInitializers(_init41, 51, this);
155147
155148
  __privateAdd(this, _iconPosition2, __runInitializers(_init41, 52, this, "left")), __runInitializers(_init41, 55, this);
155149
+ __privateAdd(this, _adoptedText, __runInitializers(_init41, 56, this, "")), __runInitializers(_init41, 59, this);
155150
+ __privateAdd(this, _adoptedIcon, __runInitializers(_init41, 60, this, "")), __runInitializers(_init41, 63, this);
155151
+ __privateAdd(this, _adoptedIconPosition, __runInitializers(_init41, 64, this, "left")), __runInitializers(_init41, 67, this);
155152
+ __publicField(this, "lightDomObserver");
155148
155153
  __publicField(this, "handleKeydown", /* @__PURE__ */ __name((eventArg) => {
155149
155154
  if (eventArg.key === " " || eventArg.key === "Spacebar") {
155150
155155
  eventArg.preventDefault();
@@ -155163,37 +155168,69 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155163
155168
  }, "handleKeyup"));
155164
155169
  }
155165
155170
  async connectedCallback() {
155166
- await super.connectedCallback();
155171
+ const superConnected = super.connectedCallback();
155172
+ this.observeLightDom();
155173
+ await superConnected;
155167
155174
  if (!this.insideForm && this.closest("dees-form")) {
155168
155175
  this.insideForm = true;
155169
155176
  }
155170
155177
  }
155171
- /**
155172
- * Extracts icon and text from light DOM and sets properties
155173
- */
155174
- extractLightDom() {
155175
- const iconElement = this.querySelector("dees-icon");
155176
- const textContent = Array.from(this.childNodes).filter((node2) => node2.nodeType === Node.TEXT_NODE).map((node2) => node2.textContent?.trim()).filter(Boolean).join(" ");
155177
- if (textContent && !this.text) {
155178
- this.text = textContent;
155179
- }
155180
- if (iconElement) {
155181
- const iconValue = iconElement.icon || iconElement.getAttribute("icon") || null;
155182
- if (iconValue) {
155183
- const children2 = Array.from(this.childNodes);
155184
- const iconIndex = children2.indexOf(iconElement);
155185
- const textNodes = children2.filter(
155186
- (node2) => node2.nodeType === Node.TEXT_NODE && node2.textContent?.trim()
155187
- );
155188
- if (textNodes.length > 0) {
155189
- const firstTextIndex = children2.indexOf(textNodes[0]);
155190
- this.iconPosition = iconIndex < firstTextIndex ? "left" : "right";
155178
+ async disconnectedCallback() {
155179
+ this.lightDomObserver?.disconnect();
155180
+ await super.disconnectedCallback();
155181
+ }
155182
+ observeLightDom() {
155183
+ this.lightDomObserver ??= new MutationObserver((mutationsArg) => {
155184
+ const supportedContentChanged = mutationsArg.some((mutationArg) => {
155185
+ if (mutationArg.type === "childList") {
155186
+ return mutationArg.target === this;
155187
+ }
155188
+ if (mutationArg.type === "characterData") {
155189
+ return mutationArg.target.parentNode === this;
155191
155190
  }
155192
- this.icon = iconValue;
155191
+ return mutationArg.target.parentNode === this && mutationArg.target.localName === "dees-icon";
155192
+ });
155193
+ if (supportedContentChanged) {
155194
+ this.adoptLightDom();
155193
155195
  }
155194
- iconElement.remove();
155196
+ });
155197
+ this.lightDomObserver.observe(this, {
155198
+ attributes: true,
155199
+ attributeFilter: ["icon"],
155200
+ characterData: true,
155201
+ childList: true,
155202
+ subtree: true
155203
+ });
155204
+ this.adoptLightDom();
155205
+ }
155206
+ /** Mirrors supported direct light content without taking ownership of consumer nodes. */
155207
+ adoptLightDom() {
155208
+ const children2 = Array.from(this.childNodes);
155209
+ const textNodes = children2.filter(
155210
+ (nodeArg) => nodeArg.nodeType === Node.TEXT_NODE && nodeArg.textContent?.trim()
155211
+ );
155212
+ const iconElement = children2.find(
155213
+ (nodeArg) => nodeArg instanceof HTMLElement && nodeArg.localName === "dees-icon"
155214
+ );
155215
+ const nextAdoptedText = textNodes.map((nodeArg) => nodeArg.textContent.trim()).join(" ");
155216
+ const nextAdoptedIcon = iconElement?.icon || iconElement?.getAttribute("icon") || "";
155217
+ const nextAdoptedIconPosition = iconElement && textNodes.length > 0 ? children2.indexOf(iconElement) < children2.indexOf(textNodes[0]) ? "left" : "right" : "left";
155218
+ const textFollowsLightDom = this.text === this.adoptedText;
155219
+ const iconFollowsLightDom = (this.icon || "") === this.adoptedIcon;
155220
+ const iconPositionFollowsLightDom = this.iconPosition === this.adoptedIconPosition;
155221
+ const previousAdoptedIcon = this.adoptedIcon;
155222
+ this.adoptedText = nextAdoptedText;
155223
+ this.adoptedIcon = nextAdoptedIcon;
155224
+ this.adoptedIconPosition = nextAdoptedIconPosition;
155225
+ if (textFollowsLightDom && this.text !== nextAdoptedText) {
155226
+ this.text = nextAdoptedText;
155227
+ }
155228
+ if (iconFollowsLightDom && this.icon !== nextAdoptedIcon && Boolean(nextAdoptedIcon || previousAdoptedIcon)) {
155229
+ this.icon = nextAdoptedIcon;
155230
+ }
155231
+ if (iconPositionFollowsLightDom && this.iconPosition !== nextAdoptedIconPosition) {
155232
+ this.iconPosition = nextAdoptedIconPosition;
155195
155233
  }
155196
- this.innerHTML = "";
155197
155234
  }
155198
155235
  render() {
155199
155236
  const typeMap = {
@@ -155205,9 +155242,12 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155205
155242
  };
155206
155243
  const actualType = typeMap[this.type] || this.type;
155207
155244
  const actualSize = this.type === "big" ? "lg" : this.size;
155208
- const leftIcon = this.iconPosition === "left" && this.icon ? b2`<dees-icon .icon=${this.icon}></dees-icon>` : "";
155209
- const rightIcon = this.iconPosition === "right" && this.icon ? b2`<dees-icon .icon=${this.icon}></dees-icon>` : "";
155210
- const showText = Boolean(this.text) && !(actualSize === "icon" && this.icon);
155245
+ const effectiveText = this.text;
155246
+ const effectiveIcon = this.icon;
155247
+ const effectiveIconPosition = this.iconPosition;
155248
+ const leftIcon = effectiveIconPosition === "left" && effectiveIcon ? b2`<dees-icon .icon=${effectiveIcon}></dees-icon>` : "";
155249
+ const rightIcon = effectiveIconPosition === "right" && effectiveIcon ? b2`<dees-icon .icon=${effectiveIcon}></dees-icon>` : "";
155250
+ const showText = Boolean(effectiveText) && !(actualSize === "icon" && effectiveIcon);
155211
155251
  return b2`
155212
155252
  <div
155213
155253
  class="button ${this.isHidden ? "hidden" : ""} ${actualType} size-${actualSize} shape-${this.shape} ${this.status} ${this.disabled ? "disabled" : ""}"
@@ -155215,7 +155255,7 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155215
155255
  tabindex=${this.disabled ? -1 : 0}
155216
155256
  aria-disabled=${this.disabled ? "true" : "false"}
155217
155257
  aria-busy=${this.status === "pending" ? "true" : "false"}
155218
- .ariaLabel=${showText ? null : this.text || null}
155258
+ .ariaLabel=${showText ? null : effectiveText || null}
155219
155259
  @click="${this.dispatchClick}"
155220
155260
  @keydown=${this.handleKeydown}
155221
155261
  @keyup=${this.handleKeyup}
@@ -155228,7 +155268,7 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155228
155268
  ></dees-spinner>
155229
155269
  `}
155230
155270
  ${leftIcon}
155231
- ${showText ? b2`<div class="textbox">${this.text}</div>` : ""}
155271
+ ${showText ? b2`<div class="textbox">${effectiveText}</div>` : ""}
155232
155272
  ${rightIcon}
155233
155273
  </div>
155234
155274
  `;
@@ -155291,9 +155331,6 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155291
155331
  }
155292
155332
  this.faceElement?.click();
155293
155333
  }
155294
- async firstUpdated() {
155295
- this.extractLightDom();
155296
- }
155297
155334
  };
155298
155335
  _init41 = __decoratorStart(_a44);
155299
155336
  _text2 = new WeakMap();
@@ -155308,6 +155345,9 @@ _insideForm = new WeakMap();
155308
155345
  _fullWidth2 = new WeakMap();
155309
155346
  _icon3 = new WeakMap();
155310
155347
  _iconPosition2 = new WeakMap();
155348
+ _adoptedText = new WeakMap();
155349
+ _adoptedIcon = new WeakMap();
155350
+ _adoptedIconPosition = new WeakMap();
155311
155351
  __decorateElement(_init41, 4, "text", _text_dec2, _DeesButton, _text2);
155312
155352
  __decorateElement(_init41, 4, "eventDetailData", _eventDetailData_dec, _DeesButton, _eventDetailData);
155313
155353
  __decorateElement(_init41, 4, "disabled", _disabled_dec4, _DeesButton, _disabled4);
@@ -155320,6 +155360,9 @@ __decorateElement(_init41, 4, "insideForm", _insideForm_dec, _DeesButton, _insid
155320
155360
  __decorateElement(_init41, 4, "fullWidth", _fullWidth_dec2, _DeesButton, _fullWidth2);
155321
155361
  __decorateElement(_init41, 4, "icon", _icon_dec3, _DeesButton, _icon3);
155322
155362
  __decorateElement(_init41, 4, "iconPosition", _iconPosition_dec2, _DeesButton, _iconPosition2);
155363
+ __decorateElement(_init41, 4, "adoptedText", _adoptedText_dec, _DeesButton, _adoptedText);
155364
+ __decorateElement(_init41, 4, "adoptedIcon", _adoptedIcon_dec, _DeesButton, _adoptedIcon);
155365
+ __decorateElement(_init41, 4, "adoptedIconPosition", _adoptedIconPosition_dec, _DeesButton, _adoptedIconPosition);
155323
155366
  _DeesButton = __decorateElement(_init41, 0, "DeesButton", _DeesButton_decorators, _DeesButton);
155324
155367
  __name(_DeesButton, "DeesButton");
155325
155368
  __publicField(_DeesButton, "demo", demoFunc31);
@@ -231013,7 +231056,7 @@ init_group_runtime();
231013
231056
  // ts_web/00_commitinfo_data.ts
231014
231057
  var commitinfo = {
231015
231058
  name: "@design.estate/dees-catalog",
231016
- version: "7.0.0",
231059
+ version: "7.0.1",
231017
231060
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
231018
231061
  };
231019
231062