@tnotesjs/ui 0.3.3 → 0.4.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.
@@ -2,16 +2,16 @@
2
2
 
3
3
  .tn-swiper {
4
4
  margin: 1rem 0;
5
- overflow: visible;
6
- border-radius: 8px;
7
- box-shadow: 0 2px 8px rgb(0 0 0 / 0.18);
5
+ overflow: hidden;
6
+ border: 1px solid var(--tn-c-media-edge);
7
+ border-radius: 4px;
8
+ box-shadow: none;
8
9
  background: transparent;
9
10
  padding: 0;
10
- border: none;
11
11
  }
12
12
 
13
13
  .tn-swiper:hover {
14
- box-shadow: 0 4px 16px rgb(0 0 0 / 0.28);
14
+ box-shadow: none;
15
15
  }
16
16
 
17
17
  .tn-swiper-tabs {
@@ -22,7 +22,6 @@
22
22
  overflow-x: auto;
23
23
  overflow-y: hidden;
24
24
  border-bottom: 1px solid var(--tn-c-divider);
25
- border-radius: 8px 8px 0 0;
26
25
  background: var(--tn-c-bg-soft);
27
26
  box-shadow: inset 0 -1px var(--tn-c-divider);
28
27
  }
@@ -125,7 +124,6 @@
125
124
  width: 100%;
126
125
  overflow: hidden;
127
126
  margin: 0;
128
- border-radius: 0 0 8px 8px;
129
127
  background: var(--tn-c-bg);
130
128
  }
131
129
 
@@ -147,5 +145,35 @@
147
145
  max-width: 100%;
148
146
  height: auto;
149
147
  margin: 0 auto;
148
+ border: 0;
149
+ border-radius: 4px;
150
150
  object-fit: contain;
151
151
  }
152
+
153
+ .tn-swiper .swiper-slide.is-align-left img {
154
+ margin-left: 0;
155
+ margin-right: auto;
156
+ }
157
+
158
+ .tn-swiper .swiper-slide.is-align-right img {
159
+ margin-left: auto;
160
+ margin-right: 0;
161
+ }
162
+
163
+ .tn-swiper.is-empty .swiper-container {
164
+ display: flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ min-height: 180px;
168
+ border: 0;
169
+ border-radius: 0;
170
+ background: var(--tn-c-bg-soft);
171
+ }
172
+
173
+ .tn-swiper-empty {
174
+ margin: 0;
175
+ color: var(--tn-c-text-2);
176
+ font-size: 14px;
177
+ line-height: 1.5;
178
+ text-align: center;
179
+ }
@@ -12,9 +12,18 @@
12
12
  --tn-c-bg-input: #f6f6f7;
13
13
  --tn-c-divider: #e2e2e3;
14
14
  --tn-c-divider-strong: #c2c2c4;
15
+ /* 正文图片和 Swiper 外框。浅色里分割线就能和白底分开。 */
16
+ --tn-c-media-edge: var(--tn-c-divider);
15
17
  --tn-c-hover: rgba(142, 150, 170, 0.14);
16
18
  --tn-c-highlight: rgba(100, 108, 255, 0.16);
17
19
  --tn-c-brand-soft: var(--tn-c-highlight);
20
+ /* 阅读选区。语雀正文 ::selection:rgba(27, 162, 227, 0.2),字色不改。 */
21
+ --tn-c-selection: rgba(27, 162, 227, 0.2);
22
+ /* 正文链接。语雀看得见的字色是 #3B82CE,悬停不变,没有底。 */
23
+ --tn-c-link: #3b82ce;
24
+ /* 行内代码。语雀 ne-code-content:黑 6% 底,浅边 #e7e9e8,字色跟正文。 */
25
+ --tn-c-inline-code-bg: rgba(0, 0, 0, 0.06);
26
+ --tn-c-inline-code-border: #e7e9e8;
18
27
  --tn-c-success: #18794e;
19
28
  --tn-c-warning: #915930;
20
29
  --tn-c-danger: #b8272c;
@@ -22,17 +31,19 @@
22
31
  --tn-c-warning-soft: rgba(234, 179, 8, 0.14);
23
32
  --tn-c-danger-soft: rgba(244, 63, 94, 0.14);
24
33
  --tn-c-default-soft: #e8e8e9;
34
+ /* ==高亮== 的底色:正文、Desk 编辑器、SSG 共用 */
35
+ --tn-c-mark-bg: rgba(255, 221, 0, 0.45);
25
36
  /* 任务列表复选框(对齐语雀):16px 方框、圆角 4px、选中填充品牌绿 + 白色对勾。 */
26
37
  --tn-c-task-check: #00b96b;
27
38
  --tn-c-task-check-border: #d9d9d9;
28
39
  --tn-c-task-check-bg: #ffffff;
29
40
  --tn-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.12);
30
41
  --tn-font-sans:
31
- 'Punctuation SC', Inter, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
32
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
42
+ 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial,
43
+ sans-serif, 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
33
44
  --tn-font-mono: 'SFMono-Regular', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
34
- --tn-prose-size: 16px;
35
- --tn-prose-line-height: 28px;
45
+ --tn-prose-size: 15px;
46
+ --tn-prose-line-height: 26.1px;
36
47
  --tn-heading-weight: 600;
37
48
  --tn-heading-1-size: 32px;
38
49
  --tn-heading-1-line: 40px;
@@ -61,7 +72,14 @@
61
72
  --tn-c-bg-input: #161618;
62
73
  --tn-c-divider: #2e2e32;
63
74
  --tn-c-divider-strong: #3c3f44;
75
+ /* 暗色分割线贴近编辑区,掺文字色后白底图和深色图都能看见边。 */
76
+ --tn-c-media-edge: color-mix(in srgb, var(--tn-c-text-2) 42%, var(--tn-c-bg));
64
77
  --tn-c-hover: rgba(101, 117, 133, 0.16);
78
+ /* 同一青色。暗底上 0.2 太淡,提高到 0.35 才看得清。 */
79
+ --tn-c-selection: rgba(27, 162, 227, 0.35);
80
+ --tn-c-link: #8ebef5;
81
+ --tn-c-inline-code-bg: rgba(255, 255, 255, 0.08);
82
+ --tn-c-inline-code-border: rgba(255, 255, 255, 0.12);
65
83
  --tn-c-success: #3dd68c;
66
84
  --tn-c-warning: #f9b44e;
67
85
  --tn-c-danger: #f66f81;
@@ -69,6 +87,7 @@
69
87
  --tn-c-warning-soft: rgba(234, 179, 8, 0.16);
70
88
  --tn-c-danger-soft: rgba(244, 63, 94, 0.14);
71
89
  --tn-c-default-soft: #2e2e32;
90
+ --tn-c-mark-bg: rgba(250, 204, 21, 0.32);
72
91
  --tn-c-task-check-border: #4a4d54;
73
92
  --tn-c-task-check-bg: transparent;
74
93
  --tn-shadow-2: 0 4px 12px rgb(0 0 0 / 0.35);
@@ -47,6 +47,13 @@ export function wrapSlideIndex(index: number, length: number, delta: -1 | 1): nu
47
47
  return (index + delta + length) % length
48
48
  }
49
49
 
50
+ export const SWIPER_EMPTY_TEXT = 'empty swiper'
51
+
52
+ /** 没有图片幻灯片时的壳。Desk 与站点用同一段结构。 */
53
+ export function emptySwiperMarkup(): string {
54
+ return `<div class="tn-swiper is-empty"><div class="swiper-container"><p class="tn-swiper-empty">${SWIPER_EMPTY_TEXT}</p></div></div>`
55
+ }
56
+
50
57
  const READY = 'tnSwiperReady'
51
58
 
52
59
  /**
@@ -76,6 +83,7 @@ export function hydrateTnSwipers(root: ParentNode = document): number {
76
83
  }
77
84
 
78
85
  function hydrateOne(host: HTMLElement): boolean {
86
+ if (host.classList.contains('is-empty')) return true
79
87
  const tabs = host.querySelector<HTMLElement>('.tn-swiper-tabs')
80
88
  const wrapper = host.querySelector<HTMLElement>('.swiper-wrapper')
81
89
  if (!wrapper) return false
@@ -1,37 +0,0 @@
1
- /**
2
- * 思维导图编辑器外壳入口:Web 与 VS Code 扩展共用同一套三视图 UI。
3
- *
4
- * 与 `./mindmap` 的分工:`./mindmap` 是 SSG / Desk 笔记里内嵌的「预览 + 可选编辑」块
5
- * (`components/Mindmap/Mindmap.vue`,自带 `--mm-*` 主题变量与只读渲染);本入口导出它
6
- * 内部复用的编辑器组件,供自带页面外壳的宿主(Web 整页、VS Code webview)直接组装。
7
- *
8
- * 宿主职责:`MindmapSession` 归属、`--mm-*` 变量定义、落盘 / 剪贴板 / 图片写入
9
- * (`apps/mindmap-web`、`apps/mindmap-vscode`)。浮层默认不 teleport,嵌入笔记的宿主
10
- * 保持默认即可;整页宿主传 `teleport-to="body"`。
11
- */
12
- export { default as AppIcon } from '../components/Mindmap/editor/AppIcon.vue'
13
- export { default as CanvasContextMenu } from '../components/Mindmap/editor/CanvasContextMenu.vue'
14
- export { default as CollapseMenu } from '../components/Mindmap/editor/CollapseMenu.vue'
15
- export { default as IconButton } from '../components/Mindmap/editor/IconButton.vue'
16
- export { default as LinkPopover } from '../components/Mindmap/editor/LinkPopover.vue'
17
- export { default as MarkdownView } from '../components/Mindmap/editor/MarkdownView.vue'
18
- export { default as MindmapView } from '../components/Mindmap/editor/MindmapView.vue'
19
- export { default as OutlineView } from '../components/Mindmap/editor/OutlineView.vue'
20
- export { default as RichInlineEditor } from '../components/Mindmap/editor/RichInlineEditor.vue'
21
- export { default as SearchBar } from '../components/Mindmap/editor/SearchBar.vue'
22
- export { default as SelectionToolbar } from '../components/Mindmap/editor/SelectionToolbar.vue'
23
- export { default as FocusBreadcrumbs } from '../components/Mindmap/FocusBreadcrumbs.vue'
24
-
25
- export { insertImageIntoSource } from '../components/Mindmap/editor/imagePaste'
26
- export {
27
- pasteCanvasOutline,
28
- readMindmapClipboard,
29
- writeMindmapClipboard
30
- } from '../components/Mindmap/editor/mindmapClipboard'
31
- export { resolveAfterDropLevel } from '../components/Mindmap/editor/outlineDrag'
32
- export type { DropLevel } from '../components/Mindmap/editor/outlineDrag'
33
- export {
34
- altShortcut,
35
- isApplePlatform,
36
- primaryShortcut
37
- } from '../components/Mindmap/editor/platform'