@lemoncat7/dsh-knowledge 2.2.10 → 2.2.13

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 (74) hide show
  1. package/README.md +3 -3
  2. package/docs/architecture.md +6 -2
  3. package/lib/api.d.ts.map +1 -1
  4. package/lib/api.js +20 -0
  5. package/lib/api.js.map +1 -1
  6. package/lib/client.js +22 -22
  7. package/lib/client.js.map +2 -2
  8. package/lib/local-provider.d.ts +8 -1
  9. package/lib/local-provider.d.ts.map +1 -1
  10. package/lib/local-provider.js +12 -0
  11. package/lib/local-provider.js.map +1 -1
  12. package/lib/management-proxy.js +1 -1
  13. package/lib/management-proxy.js.map +1 -1
  14. package/lib/notes/domain.d.ts +10 -0
  15. package/lib/notes/domain.d.ts.map +1 -1
  16. package/lib/notes/domain.js.map +1 -1
  17. package/lib/notes/store.d.ts +15 -1
  18. package/lib/notes/store.d.ts.map +1 -1
  19. package/lib/notes/store.js +277 -28
  20. package/lib/notes/store.js.map +1 -1
  21. package/lib/provider.d.ts +8 -1
  22. package/lib/provider.d.ts.map +1 -1
  23. package/lib/remote-provider.d.ts +8 -1
  24. package/lib/remote-provider.d.ts.map +1 -1
  25. package/lib/remote-provider.js +22 -0
  26. package/lib/remote-provider.js.map +1 -1
  27. package/lib/theme-bridge.js +7 -7
  28. package/lib/theme-bridge.js.map +1 -1
  29. package/lib/tool-authorization.js +11 -16
  30. package/lib/tool-authorization.js.map +1 -1
  31. package/lib/web-note-editor-chrome.d.ts +17 -0
  32. package/lib/web-note-editor-chrome.d.ts.map +1 -0
  33. package/lib/web-note-editor-chrome.js +38 -0
  34. package/lib/web-note-editor-chrome.js.map +1 -0
  35. package/lib/web-note-editor-find.d.ts +17 -0
  36. package/lib/web-note-editor-find.d.ts.map +1 -0
  37. package/lib/web-note-editor-find.js +225 -0
  38. package/lib/web-note-editor-find.js.map +1 -0
  39. package/lib/web-note-editor-outline.d.ts +15 -0
  40. package/lib/web-note-editor-outline.d.ts.map +1 -0
  41. package/lib/web-note-editor-outline.js +169 -0
  42. package/lib/web-note-editor-outline.js.map +1 -0
  43. package/lib/web-note-editor-search.d.ts +30 -0
  44. package/lib/web-note-editor-search.d.ts.map +1 -0
  45. package/lib/web-note-editor-search.js +143 -0
  46. package/lib/web-note-editor-search.js.map +1 -0
  47. package/lib/web-note-editor-selection.d.ts +15 -0
  48. package/lib/web-note-editor-selection.d.ts.map +1 -0
  49. package/lib/web-note-editor-selection.js +255 -0
  50. package/lib/web-note-editor-selection.js.map +1 -0
  51. package/lib/web-note-editor.d.ts +7 -0
  52. package/lib/web-note-editor.d.ts.map +1 -1
  53. package/lib/web-note-editor.js +36 -6
  54. package/lib/web-note-editor.js.map +1 -1
  55. package/lib/web-note-history.d.ts +28 -0
  56. package/lib/web-note-history.d.ts.map +1 -0
  57. package/lib/web-note-history.js +163 -0
  58. package/lib/web-note-history.js.map +1 -0
  59. package/lib/web-workspace-effects.d.ts.map +1 -1
  60. package/lib/web-workspace-effects.js +1 -2
  61. package/lib/web-workspace-effects.js.map +1 -1
  62. package/lib/web.d.ts.map +1 -1
  63. package/lib/web.js +4 -0
  64. package/lib/web.js.map +1 -1
  65. package/package.json +1 -1
  66. package/web/api-client.js +94 -0
  67. package/web/app.js +248 -230
  68. package/web/host-theme.js +63 -0
  69. package/web/index.html +1 -0
  70. package/web/note-editor.js +70 -70
  71. package/web/note-history.js +1 -0
  72. package/web/styles.css +353 -154
  73. package/web/ui-primitives.js +77 -0
  74. package/web/workspace-effects.js +1 -1
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Small, dependency-free DOM primitives shared by the management views.
3
+ * Business renderers should describe content; browser normalization and
4
+ * element construction stay here.
5
+ */
6
+ export function element(tag, attributes = {}, ...children) {
7
+ const node = document.createElement(tag)
8
+ for (const [key, value] of Object.entries(attributes)) {
9
+ if (value === undefined || value === null || value === false) continue
10
+ if (key === 'class') node.className = value
11
+ else if (key === 'text') node.textContent = value
12
+ else if (key.startsWith('on') && typeof value === 'function') node.addEventListener(key.slice(2).toLowerCase(), value)
13
+ else if (key === 'checked' || key === 'selected' || key === 'disabled') node[key] = Boolean(value)
14
+ else node.setAttribute(key, String(value))
15
+ }
16
+ for (const child of children.flat(Infinity)) {
17
+ if (child === undefined || child === null || child === false) continue
18
+ node.append(child instanceof Node ? child : document.createTextNode(String(child)))
19
+ }
20
+ return node
21
+ }
22
+
23
+ export function actionButton(label, onClick, variant = '', attributes = {}) {
24
+ return element('button', { type: 'button', class: `button ${variant}`.trim(), onClick, ...attributes }, label)
25
+ }
26
+
27
+ function vectorElement(tag, attributes = {}, ...children) {
28
+ const node = document.createElementNS('http://www.w3.org/2000/svg', tag)
29
+ for (const [key, value] of Object.entries(attributes)) {
30
+ if (value === undefined || value === null || value === false) continue
31
+ node.setAttribute(key === 'class' ? 'class' : key, String(value))
32
+ }
33
+ for (const child of children.flat(Infinity)) {
34
+ if (child instanceof Node) node.append(child)
35
+ }
36
+ return node
37
+ }
38
+
39
+ export function paneToggleButton(pane, visible, onClick, label) {
40
+ const action = `${visible ? '隐藏' : '显示'}${label}`
41
+ return element('button', {
42
+ type: 'button', class: 'pane-toggle-button', 'data-pane': pane,
43
+ 'aria-label': action, 'aria-pressed': String(visible), title: action, onClick,
44
+ }, element('span', { class: `pane-icon pane-icon-${pane}`, 'aria-hidden': 'true' }))
45
+ }
46
+
47
+ export function interfaceIcon(name, className = 'interface-icon') {
48
+ const paths = {
49
+ search: 'M10.8 4.5a6.3 6.3 0 1 0 0 12.6 6.3 6.3 0 0 0 0-12.6Zm4.6 11 4.1 4',
50
+ more: 'M5 12h.01M12 12h.01M19 12h.01',
51
+ save: 'M5 3.5h11l3 3v14H5zM8 3.5v6h8v-6M8 20.5v-7h8v7',
52
+ outline: 'M8 6h11M8 12h11M8 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',
53
+ history: 'M4 4v5h5M4.8 8.2A8 8 0 1 1 4 13M12 7.5V12l3 2',
54
+ download: 'M12 3v11M8 10l4 4 4-4M5 20h14',
55
+ link: 'M9.5 14.5l5-5M8.5 17H6a5 5 0 0 1 0-10h3M15.5 7H18a5 5 0 0 1 0 10h-3',
56
+ rename: 'M4 20l4.2-1 10.4-10.4a2.1 2.1 0 0 0-3-3L5.2 16zM14.5 6.5l3 3',
57
+ }
58
+ return vectorElement('svg', {
59
+ class: className, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor',
60
+ 'stroke-width': '1.8', 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true',
61
+ }, vectorElement('path', { d: paths[name] }))
62
+ }
63
+
64
+ export function badge(label, variant = '') {
65
+ return element('span', { class: `badge ${variant}`.trim() }, label)
66
+ }
67
+
68
+ export function createToastPresenter(region) {
69
+ return (message, kind = '') => {
70
+ const toast = element('div', { class: `toast ${kind}`.trim(), role: kind === 'error' ? 'alert' : 'status' },
71
+ element('span', {}, message),
72
+ kind === 'error' ? actionButton('关闭', () => toast.remove(), 'ghost small toast-close', { 'aria-label': '关闭错误提示' }) : null,
73
+ )
74
+ region.append(toast)
75
+ if (kind !== 'error') window.setTimeout(() => toast.remove(), 4200)
76
+ }
77
+ }
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var M="http://www.w3.org/2000/svg",x=[".sidebar",".topbar",".note-tree-panel",".notes-browser",".notes-content-header",".notes-document-toolbar",".note-editor-toolbar",".dialog"].join(","),A=[".sidebar",".topbar",".note-tree-panel",".notes-browser"].join(","),L=[".login-card",".metric",".panel",".library-detail-header",".mount-manager",".knowledge-card",".candidate",".api-access-card"].join(","),R=[".mount-table",".note-workspace",".notes-workspace",".dialog",L].join(","),T=[".button",".nav-button",".tab",".pane-toggle-button",".note-tree-base",".note-tree-document",".note-tree-new",".notes-tree-row",".notes-search-row",".notes-file-main"].join(","),C=[".note-tree",".notes-tree",".base-grid",".mount-table"].join(","),G="[data-knowledge-motion-key]",F=700,P=38,m=new Map,b=new Map,u=new Map,g=new Map,$=0,d,O=window.matchMedia("(prefers-reduced-motion: reduce)"),_=window.matchMedia("(prefers-reduced-transparency: reduce)");function v(e,t){let n=Array.from(e.querySelectorAll(t));return e instanceof HTMLElement&&e.matches(t)&&n.unshift(e),n}function H(){return d?.isConnected||(d=document.createElementNS(M,"svg"),d.classList.add("knowledge-glass-filter-bank"),d.setAttribute("aria-hidden","true"),d.setAttribute("focusable","false"),document.body.append(d)),d}function h(e,t){let n=document.createElementNS(M,e);for(let[o,s]of Object.entries(t))n.setAttribute(o,s);return n}function N(e){let t=h("filter",{id:e,x:"0%",y:"0%",width:"100%",height:"100%","color-interpolation-filters":"sRGB"}),n=h("feImage",{x:"0",y:"0",width:"100%",height:"100%",preserveAspectRatio:"none",result:"map"});return t.append(n,h("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"6",result:"frosted"})),t.append(h("feDisplacementMap",{in:"frosted",in2:"map",scale:"-16",xChannelSelector:"R",yChannelSelector:"G",result:"refracted"}),h("feGaussianBlur",{in:"refracted",stdDeviation:".12"})),{filter:t,image:n}}function I(){if(_.matches)return!1;let e=navigator.userAgent;return/Firefox/i.test(e)||/Safari/i.test(e)&&!/(Chrome|Chromium|CriOS)/i.test(e)?!1:CSS.supports?.("backdrop-filter","url(#knowledge-glass-support)")||CSS.supports?.("-webkit-backdrop-filter","url(#knowledge-glass-support)")||!1}function D(e,t,n){let o=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius);return Number.isFinite(o)?Math.max(0,Math.min(o,Math.min(t,n)/2)):Math.min(t,n)*.16}function B(e,t,n){let o=Math.min(12,Math.max(4,Math.min(e,t)*.08)),s=`<svg viewBox="0 0 ${e} ${t}" xmlns="${M}">
1
+ "use strict";(()=>{var M="http://www.w3.org/2000/svg",x=[".sidebar",".topbar",".note-tree-panel",".notes-browser",".notes-content-header",".notes-document-toolbar",".notes-document-statusbar",".note-editor-toolbar"].join(","),A=[".sidebar",".topbar",".note-tree-panel",".notes-browser"].join(","),L=[".login-card",".metric",".panel",".library-detail-header",".mount-manager",".knowledge-card",".candidate",".api-access-card"].join(","),R=[".mount-table",".note-workspace",".notes-workspace",L].join(","),T=[".button",".nav-button",".tab",".pane-toggle-button",".note-tree-base",".note-tree-document",".note-tree-new",".notes-tree-row",".notes-search-row",".notes-file-main"].join(","),C=[".note-tree",".notes-tree",".base-grid",".mount-table"].join(","),G="[data-knowledge-motion-key]",F=700,P=38,m=new Map,b=new Map,u=new Map,g=new Map,$=0,d,O=window.matchMedia("(prefers-reduced-motion: reduce)"),_=window.matchMedia("(prefers-reduced-transparency: reduce)");function v(e,t){let n=Array.from(e.querySelectorAll(t));return e instanceof HTMLElement&&e.matches(t)&&n.unshift(e),n}function H(){return d?.isConnected||(d=document.createElementNS(M,"svg"),d.classList.add("knowledge-glass-filter-bank"),d.setAttribute("aria-hidden","true"),d.setAttribute("focusable","false"),document.body.append(d)),d}function h(e,t){let n=document.createElementNS(M,e);for(let[o,s]of Object.entries(t))n.setAttribute(o,s);return n}function N(e){let t=h("filter",{id:e,x:"0%",y:"0%",width:"100%",height:"100%","color-interpolation-filters":"sRGB"}),n=h("feImage",{x:"0",y:"0",width:"100%",height:"100%",preserveAspectRatio:"none",result:"map"});return t.append(n,h("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"6",result:"frosted"})),t.append(h("feDisplacementMap",{in:"frosted",in2:"map",scale:"-16",xChannelSelector:"R",yChannelSelector:"G",result:"refracted"}),h("feGaussianBlur",{in:"refracted",stdDeviation:".12"})),{filter:t,image:n}}function I(){if(_.matches)return!1;let e=navigator.userAgent;return/Firefox/i.test(e)||/Safari/i.test(e)&&!/(Chrome|Chromium|CriOS)/i.test(e)?!1:CSS.supports?.("backdrop-filter","url(#knowledge-glass-support)")||CSS.supports?.("-webkit-backdrop-filter","url(#knowledge-glass-support)")||!1}function D(e,t,n){let o=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius);return Number.isFinite(o)?Math.max(0,Math.min(o,Math.min(t,n)/2)):Math.min(t,n)*.16}function B(e,t,n){let o=Math.min(12,Math.max(4,Math.min(e,t)*.08)),s=`<svg viewBox="0 0 ${e} ${t}" xmlns="${M}">
2
2
  <defs>
3
3
  <clipPath id="shape"><rect width="${e}" height="${t}" rx="${n}"/></clipPath>
4
4
  <linearGradient id="left" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" stop-color="rgb(92 128 128)"/><stop offset="100%" stop-color="rgb(128 128 128)"/></linearGradient>