@jboltai/tokui 0.2.0 → 0.2.2
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.
- package/CHANGELOG.md +193 -0
- package/README.md +5 -5
- package/dist/tokui.cjs +8 -8
- package/dist/tokui.cjs.map +1 -1
- package/dist/tokui.css +1 -1
- package/dist/tokui.mjs +2650 -1325
- package/dist/tokui.mjs.map +1 -1
- package/dist/tokui.umd.js +8 -8
- package/dist/tokui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +32 -0
- package/src/server/tokui-builder.d.ts +16 -0
- package/src/server/tokui-builder.js +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jboltai/tokui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "TokUI — Zero-dependency streaming UI description & rendering framework for AI chat. Describe UI with a tiny DSL, stream over SSE, render to real DOM incrementally.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tokui",
|
package/src/index.d.ts
CHANGED
|
@@ -149,6 +149,34 @@ export declare function el(
|
|
|
149
149
|
textContent?: string
|
|
150
150
|
): HTMLElement;
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* modal.confirm 命令式确认对话框选项
|
|
154
|
+
*/
|
|
155
|
+
export interface TokUIModalConfirmOptions {
|
|
156
|
+
/** 标题(缺省取 i18n modal.aria) */
|
|
157
|
+
tt?: string;
|
|
158
|
+
/** 正文文本 */
|
|
159
|
+
tx?: string;
|
|
160
|
+
/** 确认按钮类型:'danger' 红色警示,缺省 primary */
|
|
161
|
+
t?: 'danger' | 'primary';
|
|
162
|
+
/** 确认按钮文案(缺省 i18n common.ok) */
|
|
163
|
+
'ok-text'?: string;
|
|
164
|
+
/** 取消按钮文案(缺省 i18n common.cancel) */
|
|
165
|
+
'cancel-text'?: string;
|
|
166
|
+
/** 确认回调(Promise resolve(true) 之前触发) */
|
|
167
|
+
onOk?: () => void;
|
|
168
|
+
/** 取消/关闭回调(Promise resolve(false) 之前触发) */
|
|
169
|
+
onCancel?: () => void;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 命令式确认对话框 API(宿主侧 JS 调用,不经 DSL)。
|
|
174
|
+
* `TokUI.modal.confirm(opts)` / `TokUI.confirm(opts)` → Promise<boolean>(确认 true / 取消·Esc·遮罩 false)
|
|
175
|
+
*/
|
|
176
|
+
export interface TokUIModalApi {
|
|
177
|
+
confirm(opts?: TokUIModalConfirmOptions): Promise<boolean>;
|
|
178
|
+
}
|
|
179
|
+
|
|
152
180
|
/** 公共命名空间对象(ESM default 导出) */
|
|
153
181
|
export interface TokUINamespace {
|
|
154
182
|
TokUI: typeof TokUI;
|
|
@@ -160,6 +188,10 @@ export interface TokUINamespace {
|
|
|
160
188
|
getLocale: typeof getLocale;
|
|
161
189
|
registerLocale: typeof registerLocale;
|
|
162
190
|
el: typeof el;
|
|
191
|
+
/** 命令式确认对话框(浏览器环境可用;SSR 为 undefined) */
|
|
192
|
+
readonly modal?: TokUIModalApi;
|
|
193
|
+
/** modal.confirm 的便捷别名 */
|
|
194
|
+
readonly confirm?: (opts?: TokUIModalConfirmOptions) => Promise<boolean>;
|
|
163
195
|
}
|
|
164
196
|
|
|
165
197
|
declare const TokUINamespace: TokUINamespace;
|
|
@@ -78,6 +78,22 @@ export declare class TokUIBuilder {
|
|
|
78
78
|
btngroup(attrs?: BuilderAttrs): this;
|
|
79
79
|
picker(attrs?: BuilderAttrs): this;
|
|
80
80
|
toggleGroup(attrs?: BuilderAttrs): this;
|
|
81
|
+
affix(attrs?: BuilderAttrs): this;
|
|
82
|
+
tour(attrs?: BuilderAttrs): this;
|
|
83
|
+
previewGroup(attrs?: BuilderAttrs): this;
|
|
84
|
+
|
|
85
|
+
// —— Phase 4 自闭合 ——
|
|
86
|
+
segmented(attrs?: BuilderAttrs): this;
|
|
87
|
+
colorPicker(attrs?: BuilderAttrs): this;
|
|
88
|
+
anchor(attrs?: BuilderAttrs): this;
|
|
89
|
+
lk(attrs?: BuilderAttrs): this;
|
|
90
|
+
tourStep(attrs?: BuilderAttrs): this;
|
|
91
|
+
|
|
92
|
+
// —— P2 组件 ——
|
|
93
|
+
kbd(content?: string, attrs?: BuilderAttrs): this;
|
|
94
|
+
editable(attrs?: BuilderAttrs): this;
|
|
95
|
+
floatButton(attrs?: BuilderAttrs): this;
|
|
96
|
+
masonry(attrs?: BuilderAttrs): this;
|
|
81
97
|
|
|
82
98
|
// —— 表格辅助 ——
|
|
83
99
|
thead(attrs?: BuilderAttrs): this;
|
|
@@ -552,6 +552,35 @@ class TokUIBuilder {
|
|
|
552
552
|
/** 菜单容器 */
|
|
553
553
|
menu(attrs) { return this._open('menu', attrs); }
|
|
554
554
|
|
|
555
|
+
/** 分段控制器(自闭合,opt:"v:label;...") */
|
|
556
|
+
segmented(attrs) { return this._selfClosing('segmented', null, attrs); }
|
|
557
|
+
/** 颜色选择器(自闭合) */
|
|
558
|
+
colorPicker(attrs) { return this._selfClosing('color-picker', null, attrs); }
|
|
559
|
+
/** 固钉容器 */
|
|
560
|
+
affix(attrs) { return this._open('affix', attrs); }
|
|
561
|
+
/** 锚点导航(带 opt 简写 → 原子自闭合;否则容器收 lk 子项) */
|
|
562
|
+
anchor(attrs) {
|
|
563
|
+
if (attrs && attrs.opt) return this._selfClosing('anchor', null, attrs);
|
|
564
|
+
return this._open('anchor', attrs);
|
|
565
|
+
}
|
|
566
|
+
/** 锚点子项(自闭合,anchor 容器模式用;d 为层级深度) */
|
|
567
|
+
lk(attrs) { return this._selfClosing('lk', null, attrs); }
|
|
568
|
+
|
|
569
|
+
/** 键盘按键(行内自闭合) */
|
|
570
|
+
kbd(content, attrs) { return this._selfClosing('kbd', content, attrs); }
|
|
571
|
+
/** 行内编辑(自闭合) */
|
|
572
|
+
editable(attrs) { return this._selfClosing('editable', null, attrs); }
|
|
573
|
+
/** 浮动按钮组容器 */
|
|
574
|
+
floatButton(attrs) { return this._open('float-button', attrs); }
|
|
575
|
+
/** 瀑布流容器 */
|
|
576
|
+
masonry(attrs) { return this._open('masonry', attrs); }
|
|
577
|
+
/** 漫游引导容器 */
|
|
578
|
+
tour(attrs) { return this._open('tour', attrs); }
|
|
579
|
+
/** 漫游引导步骤(自闭合标记) */
|
|
580
|
+
tourStep(attrs) { return this._selfClosing('tour-step', null, attrs); }
|
|
581
|
+
/** 图片预览组容器 */
|
|
582
|
+
previewGroup(attrs) { return this._open('preview-group', attrs); }
|
|
583
|
+
|
|
555
584
|
/** 对话输入框(容器模式,支持自定义子节点) */
|
|
556
585
|
chatInput(attrs) { return this._open('chat-input', attrs); }
|
|
557
586
|
|