djm-ui 0.67.3 → 0.72.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/README.md +38 -2
  3. package/dist/djm-ui.cjs +1051 -356
  4. package/dist/djm-ui.cjs.map +4 -4
  5. package/dist/djm-ui.css +752 -17
  6. package/dist/djm-ui.esm.js +1127 -432
  7. package/dist/djm-ui.esm.js.map +4 -4
  8. package/dist/djm-ui.esm.min.js +375 -229
  9. package/dist/djm-ui.min.cjs +375 -229
  10. package/dist/djm-ui.min.css +2 -2
  11. package/dist/djm-ui.umd.js +967 -272
  12. package/dist/djm-ui.umd.min.js +375 -229
  13. package/dist/mcp/manifest.json +12195 -0
  14. package/dist/mcp/server.js +90 -0
  15. package/package.json +12 -4
  16. package/src/components/icon/index.js +13 -1
  17. package/src/components/input/index.js +17 -6
  18. package/src/components/rich-editor/index.js +724 -61
  19. package/src/index.js +1 -1
  20. package/src/locale/en-US.js +33 -1
  21. package/src/locale/zh-CN.js +33 -1
  22. package/src/styles/base.css +2 -3
  23. package/src/styles/components/button.css +2 -1
  24. package/src/styles/components/console.css +5 -0
  25. package/src/styles/components/content.css +517 -0
  26. package/src/styles/components/form.css +5 -0
  27. package/src/styles/components/layout.css +327 -1
  28. package/src/styles/components/media-picker.css +3 -3
  29. package/src/styles/components/menu.css +2 -1
  30. package/src/styles/components/org-picker.css +1 -1
  31. package/src/styles/components/responsive.css +86 -0
  32. package/src/styles/components/rich-editor.css +206 -7
  33. package/src/styles/components/skin.css +54 -0
  34. package/src/styles/components/template.css +5 -0
  35. package/src/styles/index.css +1 -0
  36. package/src/styles/theme-dark.css +2 -0
  37. package/src/styles/tokens.css +8 -0
  38. package/src/theme/index.js +40 -0
  39. package/src/utils/sanitize-html.js +44 -6
  40. package/types/index.d.ts +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "djm-ui",
3
- "version": "0.67.3",
3
+ "version": "0.72.0",
4
4
  "description": "DJM UI — 企业级中后台 Vue 3 组件库",
5
5
  "homepage": "https://ui.duojumi.com",
6
6
  "repository": {
@@ -17,6 +17,9 @@
17
17
  "unpkg": "./dist/djm-ui.umd.min.js",
18
18
  "jsdelivr": "./dist/djm-ui.umd.min.js",
19
19
  "types": "./types/index.d.ts",
20
+ "bin": {
21
+ "djm-ui-mcp": "./dist/mcp/server.js"
22
+ },
20
23
  "exports": {
21
24
  ".": {
22
25
  "types": "./types/index.d.ts",
@@ -54,11 +57,14 @@
54
57
  "scripts": {
55
58
  "dev": "python3 -m http.server 5180",
56
59
  "docs": "python3 -m http.server 5181",
57
- "build": "npm run build:css && npm run build:js",
60
+ "build": "npm run build:css && npm run build:js && npm run build:mcp",
58
61
  "build:css": "node scripts/build-css.js",
59
62
  "build:js": "node scripts/build-js.js",
63
+ "build:mcp": "node scripts/build-mcp.js",
60
64
  "build:qrcode": "esbuild node_modules/qrcode/lib/browser.js --bundle --format=esm --minify --outfile=vendor/qrcode.esm.js",
61
- "test": "node scripts/check-syntax.js && node scripts/check-namespace.js && node scripts/audit.js",
65
+ "test": "node scripts/check-syntax.js && node scripts/check-namespace.js && node scripts/audit.js && node scripts/check-mcp.js",
66
+ "test:mcp": "npm run build:mcp && node scripts/test-mcp.js",
67
+ "check:mcp": "node scripts/check-mcp.js",
62
68
  "typecheck": "tsc -p tsconfig.json",
63
69
  "audit": "node scripts/audit.js",
64
70
  "release": "node scripts/release.js",
@@ -83,10 +89,12 @@
83
89
  ],
84
90
  "license": "MIT",
85
91
  "devDependencies": {
92
+ "@modelcontextprotocol/sdk": "^1.32.2",
86
93
  "axe-core": "^4.10.2",
87
94
  "esbuild": "^0.28.2",
88
95
  "qrcode": "^1.5.4",
89
96
  "typescript": "^5.6.3",
90
- "vue": "^3.5.13"
97
+ "vue": "^3.5.13",
98
+ "zod": "^4.6.7"
91
99
  }
92
100
  }
@@ -56,7 +56,19 @@ const PATHS = {
56
56
  activity: 'M22 12h-4l-3 9L9 3l-3 9H2',
57
57
  database: 'M12 8c4.42 0 8-1.34 8-3s-3.58-3-8-3-8 1.34-8 3 3.58 3 8 3zM4 5v14c0 1.66 3.58 3 8 3s8-1.34 8-3V5M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3',
58
58
  sun: 'M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42',
59
- moon: 'M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z'
59
+ moon: 'M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z',
60
+ undo: 'M3 10h11a5 5 0 1 1 0 10H8M3 10l4-4M3 10l4 4',
61
+ redo: 'M21 10H10a5 5 0 1 0 0 10h6M21 10l-4-4M21 10l-4 4',
62
+ 'align-left': 'M4 6h16M4 12h10M4 18h13',
63
+ 'align-center': 'M4 6h16M7 12h10M6 18h12',
64
+ 'align-right': 'M4 6h16M10 12h10M7 18h13',
65
+ 'align-justify': 'M4 6h16M4 12h16M4 18h16',
66
+ list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',
67
+ 'list-ordered': 'M10 6h10M10 12h10M10 18h10M4 6h1v4M4 12h2M4 16h2v2H4',
68
+ outdent: 'M4 6h16M10 12h10M10 18h10M8 9l-3 3 3 3',
69
+ indent: 'M4 6h16M10 12h10M10 18h10M5 9l3 3-3 3',
70
+ unlink: 'M10 13a5 5 0 0 0 7.5.5M14 11a5 5 0 0 0-7.5-.5M2 2l20 20',
71
+ images: 'M8 3h12v12M4 7h12v12H4zM7 15l3-3 3 3'
60
72
  }
61
73
 
62
74
  export default {
@@ -64,20 +64,31 @@ export default {
64
64
  this.focus()
65
65
  },
66
66
  focus () {
67
+ this.clearStaleValue()
67
68
  if (this.$refs.input) this.$refs.input.focus()
68
69
  },
70
+ onFocus (event) {
71
+ // 点进来时再兜一次,避免填充值被当成用户输入继续使用
72
+ this.clearStaleValue()
73
+ this.$emit('focus', event)
74
+ },
69
75
  blur () {
70
76
  if (this.$refs.input) this.$refs.input.blur()
71
77
  }
72
78
  },
73
79
  mounted () {
74
- // 自动填充通常发生在挂载之后,补两次校验;后退恢复走 pageshow
75
- this.clearStaleValue()
76
- this.staleTimer = setTimeout(() => this.clearStaleValue(), 300)
80
+ // 自动填充的时机不固定,挂载后多校验几次;后退恢复走 pageshow,点击进入再校验一次
81
+ this.staleTimers = [null, 200, 600, 1200, 2400].map((delay) => {
82
+ if (delay === null) {
83
+ this.clearStaleValue()
84
+ return null
85
+ }
86
+ return setTimeout(() => this.clearStaleValue(), delay)
87
+ })
77
88
  window.addEventListener('pageshow', this.clearStaleValue)
78
89
  },
79
90
  beforeUnmount () {
80
- clearTimeout(this.staleTimer)
91
+ this.staleTimers.forEach((timer) => clearTimeout(timer))
81
92
  window.removeEventListener('pageshow', this.clearStaleValue)
82
93
  },
83
94
  template: `
@@ -97,7 +108,7 @@ export default {
97
108
  @input="onInput"
98
109
  @change="$emit('change', $event)"
99
110
  @keyup.enter="$emit('enter', $event)"
100
- @focus="$emit('focus', $event)"
111
+ @focus="onFocus"
101
112
  @blur="$emit('blur', $event)"
102
113
  />
103
114
  <button
@@ -127,7 +138,7 @@ export default {
127
138
  @input="onInput"
128
139
  @change="$emit('change', $event)"
129
140
  @keyup.enter="$emit('enter', $event)"
130
- @focus="$emit('focus', $event)"
141
+ @focus="onFocus"
131
142
  @blur="$emit('blur', $event)"
132
143
  />
133
144
  `