@icen.ai/ui 0.4.0 → 0.8.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 (155) hide show
  1. package/AGENTS.md +256 -0
  2. package/README.md +47 -13
  3. package/dist/base.css +31 -4
  4. package/dist/behaviors/accordion.d.mts +4 -0
  5. package/dist/behaviors/accordion.mjs +4 -3
  6. package/dist/behaviors/ai-chat.d.mts +57 -0
  7. package/dist/behaviors/ai-chat.mjs +557 -0
  8. package/dist/behaviors/ai-composer.d.mts +112 -0
  9. package/dist/behaviors/ai-composer.mjs +2032 -0
  10. package/dist/behaviors/ai-core.d.mts +151 -0
  11. package/dist/behaviors/ai-core.mjs +491 -0
  12. package/dist/behaviors/ai-diff.d.mts +53 -0
  13. package/dist/behaviors/ai-diff.mjs +282 -0
  14. package/dist/behaviors/ai-panel.d.mts +98 -0
  15. package/dist/behaviors/ai-panel.mjs +1012 -0
  16. package/dist/behaviors/ai-provider.d.mts +198 -0
  17. package/dist/behaviors/ai-provider.mjs +1055 -0
  18. package/dist/behaviors/ai-tool.d.mts +18 -0
  19. package/dist/behaviors/ai-tool.mjs +2125 -0
  20. package/dist/behaviors/ai-tools.d.mts +81 -0
  21. package/dist/behaviors/ai-tools.mjs +1658 -0
  22. package/dist/behaviors/back-top.d.mts +20 -0
  23. package/dist/behaviors/back-top.mjs +101 -0
  24. package/dist/behaviors/carousel.d.mts +4 -0
  25. package/dist/behaviors/carousel.mjs +34 -16
  26. package/dist/behaviors/charts.d.mts +250 -0
  27. package/dist/behaviors/charts.mjs +1301 -448
  28. package/dist/behaviors/command-palette.d.mts +8 -0
  29. package/dist/behaviors/command-palette.mjs +189 -0
  30. package/dist/behaviors/context-menu.d.mts +36 -0
  31. package/dist/behaviors/context-menu.mjs +6 -2
  32. package/dist/behaviors/copy.d.mts +4 -0
  33. package/dist/behaviors/copy.mjs +7 -6
  34. package/dist/behaviors/datatable.d.mts +78 -0
  35. package/dist/behaviors/datatable.mjs +54 -11
  36. package/dist/behaviors/date-picker.d.mts +4 -0
  37. package/dist/behaviors/date-picker.mjs +296 -0
  38. package/dist/behaviors/dropdown.d.mts +4 -0
  39. package/dist/behaviors/dropdown.mjs +7 -3
  40. package/dist/behaviors/input.d.mts +4 -0
  41. package/dist/behaviors/input.mjs +184 -8
  42. package/dist/behaviors/modal.d.mts +11 -0
  43. package/dist/behaviors/modal.mjs +11 -6
  44. package/dist/behaviors/nav.d.mts +7 -0
  45. package/dist/behaviors/nav.mjs +25 -9
  46. package/dist/behaviors/notification.d.mts +172 -0
  47. package/dist/behaviors/notification.mjs +908 -0
  48. package/dist/behaviors/popover.d.mts +46 -0
  49. package/dist/behaviors/popover.mjs +2 -1
  50. package/dist/behaviors/select.d.mts +4 -0
  51. package/dist/behaviors/select.mjs +268 -34
  52. package/dist/behaviors/sidebar.d.mts +4 -0
  53. package/dist/behaviors/sidebar.mjs +4 -3
  54. package/dist/behaviors/slider.d.mts +4 -0
  55. package/dist/behaviors/slider.mjs +4 -3
  56. package/dist/behaviors/split-pane.d.mts +4 -0
  57. package/dist/behaviors/split-pane.mjs +102 -0
  58. package/dist/behaviors/tabs.d.mts +8 -0
  59. package/dist/behaviors/tabs.mjs +44 -19
  60. package/dist/behaviors/tag-input.d.mts +4 -0
  61. package/dist/behaviors/tag-input.mjs +12 -3
  62. package/dist/behaviors/theme.d.mts +25 -0
  63. package/dist/behaviors/theme.mjs +3 -1
  64. package/dist/behaviors/toast.d.mts +26 -0
  65. package/dist/behaviors/toast.mjs +24 -18
  66. package/dist/behaviors/tree.d.mts +4 -0
  67. package/dist/behaviors/tree.mjs +4 -3
  68. package/dist/behaviors/upload.d.mts +4 -0
  69. package/dist/behaviors/upload.mjs +205 -17
  70. package/dist/components/ai-chat.css +1037 -0
  71. package/dist/components/ai-chat.mjs +3 -0
  72. package/dist/components/ai-composer.mjs +3 -0
  73. package/dist/components/ai-context.mjs +2 -0
  74. package/dist/components/ai-diff.css +311 -0
  75. package/dist/components/ai-diff.mjs +3 -0
  76. package/dist/components/ai-files.mjs +3 -0
  77. package/dist/components/ai-message.mjs +3 -0
  78. package/dist/components/ai-panel.css +682 -0
  79. package/dist/components/ai-reasoning.mjs +3 -0
  80. package/dist/components/ai-subagent.mjs +2 -0
  81. package/dist/components/ai-todo.mjs +2 -0
  82. package/dist/components/ai-tool-call.mjs +2 -0
  83. package/dist/components/ai-tool.css +532 -0
  84. package/dist/components/ai-usage.mjs +3 -0
  85. package/dist/components/back-top.css +88 -0
  86. package/dist/components/back-top.mjs +3 -0
  87. package/dist/components/badge.css +127 -0
  88. package/dist/components/badge.mjs +2 -0
  89. package/dist/components/breadcrumb.css +53 -0
  90. package/dist/components/btn.css +4 -7
  91. package/dist/components/card.css +66 -1
  92. package/dist/components/chart-bar.css +10 -0
  93. package/dist/components/chart-calendar.mjs +5 -0
  94. package/dist/components/chart-gauge.css +1 -1
  95. package/dist/components/chart-heatmap.css +40 -0
  96. package/dist/components/chart-scatter.css +24 -0
  97. package/dist/components/chart-scatter.mjs +4 -0
  98. package/dist/components/charts.css +86 -1
  99. package/dist/components/charts.mjs +1 -0
  100. package/dist/components/command-palette.css +246 -0
  101. package/dist/components/command-palette.mjs +3 -0
  102. package/dist/components/content.css +221 -8
  103. package/dist/components/copy.css +93 -0
  104. package/dist/components/copy.mjs +3 -0
  105. package/dist/components/datatable.css +4 -8
  106. package/dist/components/date-picker.css +240 -0
  107. package/dist/components/date-picker.mjs +3 -0
  108. package/dist/components/empty.css +69 -3
  109. package/dist/components/feedback.css +241 -10
  110. package/dist/components/form.css +129 -11
  111. package/dist/components/form.mjs +2 -0
  112. package/dist/components/input.css +25 -2
  113. package/dist/components/layout.css +36 -36
  114. package/dist/components/media.css +153 -6
  115. package/dist/components/menu.css +2 -2
  116. package/dist/components/modal.css +1 -1
  117. package/dist/components/nav.css +106 -2
  118. package/dist/components/notification.css +387 -0
  119. package/dist/components/notification.mjs +3 -0
  120. package/dist/components/pagination.css +1 -1
  121. package/dist/components/panel.css +104 -9
  122. package/dist/components/pill.css +82 -12
  123. package/dist/components/scroll-area.css +112 -0
  124. package/dist/components/scroll-area.mjs +2 -0
  125. package/dist/components/segmented.css +80 -5
  126. package/dist/components/segmented.mjs +1 -0
  127. package/dist/components/select.css +104 -17
  128. package/dist/components/sidebar.css +119 -1
  129. package/dist/components/slider.css +113 -0
  130. package/dist/components/split-pane.css +111 -0
  131. package/dist/components/split-pane.mjs +3 -0
  132. package/dist/components/stat.css +131 -12
  133. package/dist/components/steps.css +98 -1
  134. package/dist/components/switch.css +145 -7
  135. package/dist/components/table.css +111 -29
  136. package/dist/components/tabs.css +132 -22
  137. package/dist/components/tag-input.css +4 -4
  138. package/dist/components/tag.css +164 -0
  139. package/dist/components/tag.mjs +2 -0
  140. package/dist/components/toast.css +122 -5
  141. package/dist/components/toolbar.css +101 -0
  142. package/dist/components/toolbar.mjs +2 -0
  143. package/dist/components/tooltip.css +2 -2
  144. package/dist/components/upload.css +61 -4
  145. package/dist/index.d.mts +37 -0
  146. package/dist/index.mjs +9409 -929
  147. package/dist/registry.json +176 -4
  148. package/dist/retro-effects.css +21 -17
  149. package/dist/tokens/colors.css +4 -1
  150. package/dist/tokens/retro-effects.css +21 -17
  151. package/dist/tokens/style-profiles.css +21 -0
  152. package/dist/tokens.css +25 -1
  153. package/dist/ui.css +9616 -2839
  154. package/docs/spec/ai-native.md +659 -0
  155. package/package.json +15 -5
@@ -0,0 +1,172 @@
1
+ type NotificationKind = 'success' | 'warning' | 'error' | 'info';
2
+ interface NotificationAction {
3
+ /** 按钮文字 */
4
+ label: string;
5
+ /** 点击回调;返回 false 阻止通知关闭 */
6
+ onClick?: () => void | Promise<void> | boolean;
7
+ /** 视觉变体:默认 ghost / primary 实底 / danger 危险色 */
8
+ type?: 'primary' | 'ghost' | 'danger';
9
+ /** 点击后是否保持通知打开(默认 false) */
10
+ keepOpen?: boolean;
11
+ }
12
+ interface NotificationOptions {
13
+ /** 显式 id(不传自动生成;用于后续 update/dismiss/get) */
14
+ id?: string;
15
+ /** 副标题(正文) */
16
+ description?: string;
17
+ /** 自动关闭延时(毫秒),默认 0 = 不自动关闭 */
18
+ duration?: number;
19
+ /** 是否显示关闭按钮,默认 true */
20
+ closable?: boolean;
21
+ /** hover 时暂停自动关闭倒计时,默认跟随全局 config.pauseOnHover */
22
+ pauseOnHover?: boolean;
23
+ /** duration > 0 时是否显示底部倒计时进度条,默认 true */
24
+ showCountdown?: boolean;
25
+ /** 自定义图标:SVG 字符串 / 图片 URL / false(关闭) */
26
+ icon?: string | false;
27
+ /** 头像 URL(会覆盖 kind 图标) */
28
+ avatar?: string;
29
+ /** 优先级:normal(默认)/ high(置顶) */
30
+ priority?: 'normal' | 'high';
31
+ /** 未读标记,默认 false(push 后可 markRead) */
32
+ unread?: boolean;
33
+ /** 多动作按钮(actions 优先于 actionLabel) */
34
+ actions?: NotificationAction[];
35
+ /** 兼容旧版单按钮 */
36
+ actionLabel?: string;
37
+ onAction?: () => void | Promise<void> | boolean;
38
+ /** 进度(0–1);progress > 0 时显示进度条。推荐用 notify.progress() 返回的 handle.setProgress */
39
+ progress?: number;
40
+ /** 进度条下方文字(如「正在导出 64%」) */
41
+ progressLabel?: string;
42
+ /** 详情链接(绝对 / 相对路径) */
43
+ link?: string;
44
+ linkLabel?: string;
45
+ /** 分组键:同 tag 的多条会聚合显示计数 */
46
+ tag?: string;
47
+ /** 自定义数据(持久化时保留) */
48
+ data?: unknown;
49
+ /** 点击通知体的回调(不含按钮与关闭) */
50
+ onClick?: (handle: NotificationHandle) => void;
51
+ /** 显示后回调 */
52
+ onShow?: (handle: NotificationHandle) => void;
53
+ /** 关闭后回调 */
54
+ onClose?: (handle: NotificationHandle) => void;
55
+ }
56
+ interface NotificationConfig {
57
+ /** 位置:top-right(默认)/ top-left / bottom-left / bottom-right */
58
+ position?: 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';
59
+ /** 同屏最大堆叠,默认 5;超出从最早的开始折叠/移除 */
60
+ maxStack?: number;
61
+ /** hover 暂停倒计时,默认 true */
62
+ pauseOnHover?: boolean;
63
+ /** 持久化:true 用默认 key / 字符串=自定义 key / 不传=不持久化 */
64
+ persist?: boolean | string;
65
+ /** 声音提示:true 用默认蜂鸣 / 字符串=data URL / 不传=无声 */
66
+ sound?: boolean | string;
67
+ }
68
+ interface NotificationHandle {
69
+ /** 通知 id */
70
+ id: string;
71
+ /** 当前 DOM 元素(可能已脱离 DOM) */
72
+ el: HTMLElement;
73
+ /** 关闭本条 */
74
+ dismiss(): void;
75
+ /** 部分更新(title / description / progress / unread / actions / tag 等) */
76
+ update(patch: NotificationUpdatePatch): void;
77
+ /** 设置进度(0–1)与可选标签 */
78
+ setProgress(value: number, label?: string): void;
79
+ /** 标记已读 */
80
+ markRead(): void;
81
+ /** 暂停自动关闭倒计时 */
82
+ pause(): void;
83
+ /** 恢复自动关闭倒计时(继续剩余时间) */
84
+ resume(): void;
85
+ }
86
+ /** update 接受的局部字段(title 在 push 时传,update 时也接受) */
87
+ interface NotificationUpdatePatch {
88
+ title?: string;
89
+ description?: string;
90
+ duration?: number;
91
+ unread?: boolean;
92
+ progress?: number;
93
+ progressLabel?: string;
94
+ actions?: NotificationAction[];
95
+ tag?: string;
96
+ priority?: 'normal' | 'high';
97
+ icon?: string | false;
98
+ avatar?: string;
99
+ link?: string;
100
+ linkLabel?: string;
101
+ }
102
+ interface NotificationRecord {
103
+ id: string;
104
+ title: string;
105
+ kind: NotificationKind;
106
+ opts: NotificationOptions;
107
+ el: HTMLElement | null;
108
+ createdAt: number;
109
+ duration: number;
110
+ remaining: number;
111
+ paused: boolean;
112
+ timer: number;
113
+ /** 本次计时的起始时间戳(pause 时据此扣减 remaining) */
114
+ startedAt: number;
115
+ /** 所属 NotificationCenter 的局部配置(全局单例通知为 undefined) */
116
+ cfgRef?: Required<NotificationConfig>;
117
+ /** 所属 center 的 localStore(全局通知为 undefined);dismiss 时同步清理,避免残留僵尸记录 */
118
+ ownerStore?: Map<string, NotificationRecord>;
119
+ /** attachTimer 注入的重启入口(update duration 时按新时长重启计时) */
120
+ restartTimer?: () => void;
121
+ /** hover 暂停监听是否已绑定(attachTimer 幂等保护) */
122
+ hoverBound?: boolean;
123
+ }
124
+ interface NotifyFn {
125
+ (title: string, opts?: NotificationOptions): NotificationHandle | null;
126
+ success(title: string, opts?: NotificationOptions): NotificationHandle | null;
127
+ warn(title: string, opts?: NotificationOptions): NotificationHandle | null;
128
+ error(title: string, opts?: NotificationOptions): NotificationHandle | null;
129
+ info(title: string, opts?: NotificationOptions): NotificationHandle | null;
130
+ progress(title: string, opts?: NotificationOptions): NotificationHandle | null;
131
+ confirm(title: string, opts?: NotificationConfirmOptions): Promise<boolean>;
132
+ dismiss(id?: string): void;
133
+ clear(): void;
134
+ markRead(id?: string): void;
135
+ update(id: string, patch: NotificationUpdatePatch): void;
136
+ get(id: string): NotificationRecord | null;
137
+ getAll(): NotificationRecord[];
138
+ config(opts: NotificationConfig): void;
139
+ }
140
+ interface NotificationConfirmOptions extends Omit<NotificationOptions, 'actions' | 'duration' | 'closable'> {
141
+ confirmLabel?: string;
142
+ cancelLabel?: string;
143
+ /** 自动关闭毫秒(默认 0 = 不自动关闭) */
144
+ duration?: number;
145
+ }
146
+ interface NotificationCenterHandle {
147
+ push(notif: NotificationPushInput): NotificationHandle | null;
148
+ dismiss(id?: string): void;
149
+ clear(): void;
150
+ markAllRead(): void;
151
+ /** 销毁容器:移除 DOM、清掉其所有 timer 与监听器;之后 push 返回 null */
152
+ destroy(): void;
153
+ get(id: string): NotificationRecord | null;
154
+ getAll(): NotificationRecord[];
155
+ config(opts: NotificationConfig): void;
156
+ el: HTMLElement;
157
+ }
158
+ interface NotificationPushInput {
159
+ title: string;
160
+ kind?: NotificationKind;
161
+ options?: NotificationOptions;
162
+ }
163
+ /**
164
+ * 创建一个独立的通知中心容器(可同时存在多个,比如顶部=警告、右下=消息)。
165
+ * 注意:默认全局 notify.* 走单例容器,与本函数创建的额外容器并存。
166
+ */
167
+ declare function createNotificationCenter(parent?: ParentNode, opts?: NotificationConfig): NotificationCenterHandle;
168
+ declare const notify: NotifyFn;
169
+ /** 委托初始化:建立默认容器 + 恢复持久化通知。幂等。 */
170
+ declare function initNotification(): void;
171
+
172
+ export { type NotificationAction, type NotificationCenterHandle, type NotificationConfig, type NotificationConfirmOptions, type NotificationHandle, type NotificationKind, type NotificationOptions, type NotificationPushInput, type NotificationUpdatePatch, createNotificationCenter, initNotification, notify };