qc-ui-lit 0.3.0 → 0.3.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.
@@ -84,7 +84,7 @@ var v = {
84
84
  //#endregion
85
85
  //#region src/tools/document/getDomText/index.ts
86
86
  function y(e) {
87
- if (console.log("🚀 ~ getNodeText ~ node.nodeType:", e.nodeType), e.nodeType === Node.TEXT_NODE) return e.textContent || "";
87
+ if (e.nodeType === Node.TEXT_NODE) return e.textContent || "";
88
88
  if (e.nodeType === Node.ELEMENT_NODE) {
89
89
  let t = e;
90
90
  return t.tagName === "SLOT" ? t.assignedNodes({ flatten: !0 }).map(y).join("") : Array.from(t.childNodes).map(y).join("");
@@ -113,12 +113,19 @@ var x = class extends t {
113
113
  }, 800);
114
114
  }
115
115
  copy() {
116
- if (!this.shadowRoot) return;
117
- let e = this.shadowRoot.querySelector("slot"), t = b(e);
118
- this.addSuccessClass(), u.writeText(t), v.select(e);
116
+ setTimeout(() => {
117
+ if (!this.shadowRoot) return;
118
+ let e = this.shadowRoot.querySelector("slot"), t = v.getText();
119
+ if (t.length > 0) u.writeText(t);
120
+ else {
121
+ let t = b(e);
122
+ u.writeText(t), v.select(e);
123
+ }
124
+ this.addSuccessClass();
125
+ });
119
126
  }
120
127
  render() {
121
- return r`<span class=${s(this.classes)} @click=${this.copy}>
128
+ return r`<span class=${s(this.classes)} @mouseup=${this.copy}>
122
129
  <slot></slot>
123
130
  </span>`;
124
131
  }
@@ -126,7 +133,7 @@ var x = class extends t {
126
133
  this.styles = n`
127
134
  .qc-replicable {
128
135
  cursor: copy;
129
- user-select: auto;
136
+ user-select: text;
130
137
  position: relative;
131
138
  }
132
139
  .qc-replicable-success::after {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qc-ui-lit",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "基于 Lit 的 Web Components 组件库",
5
5
  "author": "",
6
6
  "license": "MIT",