@wanghe1995/docx-editor-ui-lite 1.0.4 → 1.0.5

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.
@@ -1,3 +1,4 @@
1
+ (function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode("")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
1
2
  var i = Object.defineProperty;
2
3
  var s = (e, t, r) => t in e ? i(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
4
  var n = (e, t, r) => s(e, typeof t != "symbol" ? t + "" : t, r);
@@ -6,21 +7,22 @@ export * from "@wanghe1995/docx-editor-core";
6
7
  const a = (e) => {
7
8
  if (typeof e == "string") {
8
9
  const t = document.querySelector(e);
9
- if (!t)
10
- throw new Error(`Mount target not found: ${e}`);
10
+ if (!t) throw new Error(`Mount target not found: ${e}`);
11
11
  return t;
12
12
  }
13
- if (!e)
14
- throw new Error("Mount target is required");
13
+ if (!e) throw new Error("Mount target is required");
15
14
  return e;
16
15
  };
17
- class f {
16
+ class l {
18
17
  constructor(t) {
19
- n(this, "config");
20
18
  n(this, "editor", null);
21
19
  n(this, "_container");
22
20
  var r;
23
- this.config = t, this._container = a(t.container), this._applyDefaultTheme(), this.editor = new h(this._container, t.data || { main: [] }, t.options || {}), this._bindListeners(), (r = t.onReady) == null || r.call(t, this.editor);
21
+ this.config = t, this._container = a(t.container), this._applyDefaultTheme(), this.editor = new h(
22
+ this._container,
23
+ t.data || { main: [] },
24
+ t.options || {}
25
+ ), this._bindListeners(), (r = t.onReady) == null || r.call(t, this.editor);
24
26
  }
25
27
  _applyDefaultTheme() {
26
28
  const t = document.documentElement;
@@ -41,8 +43,7 @@ class f {
41
43
  return this._container;
42
44
  }
43
45
  executeCommand(t, ...r) {
44
- if (!this.editor)
45
- return;
46
+ if (!this.editor) return;
46
47
  const o = this.editor.command[t];
47
48
  if (typeof o == "function")
48
49
  return o(...r);
@@ -52,5 +53,5 @@ class f {
52
53
  }
53
54
  }
54
55
  export {
55
- f as WordEditor
56
+ l as WordEditor
56
57
  };
@@ -1 +1,2 @@
1
- (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@wanghe1995/docx-editor-core")):typeof define=="function"&&define.amd?define(["exports","@wanghe1995/docx-editor-core"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t["docx-editor-lite"]={},t.DocxEditorCore))})(this,function(t,n){"use strict";var a=Object.defineProperty;var c=(t,n,o)=>n in t?a(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o;var s=(t,n,o)=>c(t,typeof n!="symbol"?n+"":n,o);const o=i=>{if(typeof i=="string"){const e=document.querySelector(i);if(!e)throw new Error(`Mount target not found: ${i}`);return e}if(!i)throw new Error("Mount target is required");return i};class h{constructor(e){s(this,"config");s(this,"editor",null);s(this,"_container");var r;this.config=e,this._container=o(e.container),this._applyDefaultTheme(),this.editor=new n(this._container,e.data||{main:[]},e.options||{}),this._bindListeners(),(r=e.onReady)==null||r.call(e,this.editor)}_applyDefaultTheme(){const e=document.documentElement;e.style.setProperty("--tabs-bg-color","#2B579A"),e.style.setProperty("--tabs-text-color","#ffffff")}_bindListeners(){this.editor&&(this.config.onChange&&(this.editor.listener.contentChange=this.config.onChange),this.config.onPageChange&&(this.editor.listener.pageSizeChange=this.config.onPageChange),this.config.onScaleChange&&(this.editor.listener.pageScaleChange=this.config.onScaleChange))}get command(){var e;return(e=this.editor)==null?void 0:e.command}get listener(){var e;return(e=this.editor)==null?void 0:e.listener}get container(){return this._container}executeCommand(e,...r){if(!this.editor)return;const d=this.editor.command[e];if(typeof d=="function")return d(...r)}destroy(){this.editor&&(this.editor.destroy(),this.editor=null)}}t.WordEditor=h,Object.keys(n).forEach(i=>{i!=="default"&&!Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:()=>n[i]})}),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ (function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode("")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@wanghe1995/docx-editor-core")):typeof define=="function"&&define.amd?define(["exports","@wanghe1995/docx-editor-core"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t["docx-editor-lite"]={},t.DocxEditorCore))})(this,function(t,n){"use strict";var a=Object.defineProperty;var c=(t,n,o)=>n in t?a(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o;var s=(t,n,o)=>c(t,typeof n!="symbol"?n+"":n,o);const o=i=>{if(typeof i=="string"){const e=document.querySelector(i);if(!e)throw new Error(`Mount target not found: ${i}`);return e}if(!i)throw new Error("Mount target is required");return i};class h{constructor(e){s(this,"editor",null);s(this,"_container");var r;this.config=e,this._container=o(e.container),this._applyDefaultTheme(),this.editor=new n(this._container,e.data||{main:[]},e.options||{}),this._bindListeners(),(r=e.onReady)==null||r.call(e,this.editor)}_applyDefaultTheme(){const e=document.documentElement;e.style.setProperty("--tabs-bg-color","#2B579A"),e.style.setProperty("--tabs-text-color","#ffffff")}_bindListeners(){this.editor&&(this.config.onChange&&(this.editor.listener.contentChange=this.config.onChange),this.config.onPageChange&&(this.editor.listener.pageSizeChange=this.config.onPageChange),this.config.onScaleChange&&(this.editor.listener.pageScaleChange=this.config.onScaleChange))}get command(){var e;return(e=this.editor)==null?void 0:e.command}get listener(){var e;return(e=this.editor)==null?void 0:e.listener}get container(){return this._container}executeCommand(e,...r){if(!this.editor)return;const d=this.editor.command[e];if(typeof d=="function")return d(...r)}destroy(){this.editor&&(this.editor.destroy(),this.editor=null)}}t.WordEditor=h,Object.keys(n).forEach(i=>{i!=="default"&&!Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:()=>n[i]})}),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,4 @@
1
- import DocxEditor from '@wanghe1995/docx-editor-core';
2
- import type { IEditorData, IElement, IEditorOption } from '@wanghe1995/docx-editor-core';
1
+ import { default as DocxEditor, IEditorData, IElement, IEditorOption } from '@wanghe1995/docx-editor-core';
3
2
  export interface WordEditorOptions {
4
3
  container: string | HTMLElement;
5
4
  data?: IEditorData | IElement[];
@@ -16,8 +15,8 @@ export declare class WordEditor {
16
15
  constructor(config: WordEditorOptions);
17
16
  private _applyDefaultTheme;
18
17
  private _bindListeners;
19
- get command(): import("@wanghe1995/docx-editor-transform").Command | undefined;
20
- get listener(): import("@wanghe1995/docx-editor-state").Listener | undefined;
18
+ get command(): import('@wanghe1995/docx-editor-transform').Command | undefined;
19
+ get listener(): import('@wanghe1995/docx-editor-state').Listener | undefined;
21
20
  get container(): HTMLDivElement;
22
21
  executeCommand(command: string, ...args: any[]): any;
23
22
  destroy(): void;
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "@wanghe1995/docx-editor-ui-lite",
3
- "version": "1.0.4",
4
- "description": "DocxEditor 精简版UI库(Lite)",
5
- "author": "wanghe",
6
- "license": "MIT",
7
- "type": "module",
8
- "main": "./dist/docx-editor-lite.umd.cjs",
9
- "module": "./dist/docx-editor-lite.js",
10
- "types": "./dist/src/editor/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/src/editor/index.d.ts",
14
- "import": "./dist/docx-editor-lite.js",
15
- "require": "./dist/docx-editor-lite.umd.cjs"
16
- }
17
- },
18
- "publishConfig": {
19
- "access": "public"
20
- },
21
- "files": [
22
- "dist",
23
- "static",
24
- "fonts",
25
- "README.md",
26
- "package.json"
27
- ],
28
- "scripts": {
29
- "dev": "vite --config vite.config.ts",
30
- "clean": "node -e \"const fs = require('fs'); if(fs.existsSync('dist')) fs.rmSync('dist', {recursive: true})\"",
31
- "build": "npm run clean && tsc && vite build --config vite.config.ts --mode lib",
32
- "build:ui": "vite build --config vite.config.ts --mode ui",
33
- "lint": "eslint .",
34
- "type:check": "tsc --noEmit"
35
- },
36
- "devDependencies": {
37
- "@eslint/js": "^10.0.1",
38
- "@rollup/plugin-typescript": "^11.1.6",
39
- "@types/node": "^25.3.3",
40
- "@vitejs/plugin-vue": "^5.1.4",
41
- "eslint": "^10.4.0",
42
- "eslint-plugin-unused-imports": "^4.4.1",
43
- "tslib": "^2.8.1",
44
- "typescript": "^5.0.0",
45
- "typescript-eslint": "^8.59.4",
46
- "vite": "^5.4.10",
47
- "vite-plugin-dts": "^4.5.4",
48
- "vue-tsc": "^2.0.0"
49
- },
50
- "engines": {
51
- "node": ">=16.0.0"
52
- },
53
- "dependencies": {
54
- "@wanghe1995/docx-editor-core": "^3.0.8",
55
- "vue": "^3.4.0"
56
- },
57
- "peerDependencies": {
58
- "vue": "^3.4.0"
59
- }
60
- }
1
+ {
2
+ "name": "@wanghe1995/docx-editor-ui-lite",
3
+ "version": "1.0.5",
4
+ "description": "DocxEditor 精简版UI库(Lite)",
5
+ "author": "wanghe",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/docx-editor-lite.umd.cjs",
9
+ "module": "./dist/docx-editor-lite.js",
10
+ "types": "./dist/src/editor/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/src/editor/index.d.ts",
14
+ "import": "./dist/docx-editor-lite.js",
15
+ "require": "./dist/docx-editor-lite.umd.cjs"
16
+ }
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "static",
24
+ "fonts",
25
+ "README.md",
26
+ "package.json"
27
+ ],
28
+ "scripts": {
29
+ "dev": "vite --config vite.config.ts",
30
+ "clean": "node -e \"const fs = require('fs'); if(fs.existsSync('dist')) fs.rmSync('dist', {recursive: true})\"",
31
+ "build": "npm run clean && vite build --config vite.lib.config.ts",
32
+ "lint": "eslint .",
33
+ "type:check": "tsc --noEmit"
34
+ },
35
+ "devDependencies": {
36
+ "@eslint/js": "^10.0.1",
37
+ "@rollup/plugin-typescript": "^11.1.6",
38
+ "@types/node": "^25.3.3",
39
+ "@vitejs/plugin-vue": "^5.1.4",
40
+ "eslint": "^10.4.0",
41
+ "eslint-plugin-unused-imports": "^4.4.1",
42
+ "tslib": "^2.8.1",
43
+ "typescript": "^5.0.0",
44
+ "typescript-eslint": "^8.59.4",
45
+ "vite": "^5.4.10",
46
+ "vite-plugin-css-injected-by-js": "^2.4.0",
47
+ "vite-plugin-dts": "^4.5.4",
48
+ "vue-tsc": "^2.0.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=16.0.0"
52
+ },
53
+ "dependencies": {
54
+ "@wanghe1995/docx-editor-core": "^3.0.8",
55
+ "vue": "^3.4.0"
56
+ },
57
+ "peerDependencies": {
58
+ "vue": "^3.4.0"
59
+ }
60
+ }
@@ -1,23 +0,0 @@
1
- /* Material Icons Local Font */
2
- @font-face {
3
- font-family: 'Material Icons';
4
- font-style: normal;
5
- font-weight: 400;
6
- src: url('./material-icons.woff2') format('woff2');
7
- }
8
-
9
- .material-icons {
10
- font-family: 'Material Icons';
11
- font-weight: normal;
12
- font-style: normal;
13
- font-size: 0.9em;
14
- line-height: 1;
15
- letter-spacing: normal;
16
- text-transform: none;
17
- display: inline-block;
18
- white-space: nowrap;
19
- word-wrap: normal;
20
- direction: ltr;
21
- -webkit-font-feature-settings: 'liga';
22
- -webkit-font-smoothing: antialiased;
23
- }
File without changes