tools_dj 1.0.91 → 1.0.93

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.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 复制文字到剪贴板
3
+ * @param text 要复制的文本
4
+ * @returns Promise<boolean> 复制是否成功
5
+ */
6
+ export declare function copyText(text: any): Promise<boolean>;
7
+ /**
8
+ * 检查浏览器是否支持剪贴板 API
9
+ * @returns boolean 是否支持
10
+ */
11
+ export declare function isClipboardSupported(): boolean;
12
+ /**
13
+ * 从剪贴板读取文本
14
+ * @returns Promise<string> 剪贴板中的文本
15
+ */
16
+ export declare function readText(): Promise<string>;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyText=function(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!t)return!1;try{return navigator.clipboard&&window.isSecureContext?(yield navigator.clipboard.writeText(t),!0):function(e){try{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,99999);const r=document.execCommand("copy");return document.body.removeChild(t),!!r}catch(e){return console.error("降级复制方案失败:",e),!1}}(t)}catch(e){return console.error("复制到剪贴板失败:",e),!1}}))},exports.isClipboardSupported=function(){return!(!navigator.clipboard||!window.isSecureContext)},exports.readText=function(){return e.__awaiter(this,void 0,void 0,(function*(){try{if(navigator.clipboard&&window.isSecureContext)return yield navigator.clipboard.readText();throw new Error("当前环境不支持剪贴板读取")}catch(e){throw console.error("读取剪贴板失败:",e),e}}))};const e=require("tslib");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tools_dj",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "dj tools 工具库",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",