@jboltai/tokui 0.2.3 → 0.2.5
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 +382 -2
- package/README.md +2 -2
- package/dist/tokui.cjs +12 -12
- package/dist/tokui.cjs.map +1 -1
- package/dist/tokui.css +1 -1
- package/dist/tokui.mjs +3306 -2071
- package/dist/tokui.mjs.map +1 -1
- package/dist/tokui.umd.js +12 -12
- package/dist/tokui.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/server/tokui-builder.d.ts +15 -0
- package/src/server/tokui-builder.js +23 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jboltai/tokui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
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",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"typecheck": "tsc",
|
|
92
92
|
"coverage": "c8 --include='src/**/*.js' --exclude='src/server/**' npm run test:all",
|
|
93
93
|
"server": "node demo/server/sse-server.js",
|
|
94
|
+
"demo:validate": "node demo/server/validate-demos.js",
|
|
94
95
|
"demo:sync": "npm run build && cp dist/tokui.umd.js dist/tokui.css demo/lib/ && perl -i -ne 'print unless m{^//# sourceMappingURL=}' demo/lib/tokui.umd.js && cp src/server/tokui-builder.js demo/server/tokui-builder.js",
|
|
95
96
|
"dev": "vite",
|
|
96
97
|
"build": "vite build --mode lib",
|
|
@@ -94,6 +94,21 @@ export declare class TokUIBuilder {
|
|
|
94
94
|
editable(attrs?: BuilderAttrs): this;
|
|
95
95
|
floatButton(attrs?: BuilderAttrs): this;
|
|
96
96
|
masonry(attrs?: BuilderAttrs): this;
|
|
97
|
+
scrollArea(attrs?: BuilderAttrs): this;
|
|
98
|
+
/** 科技边框容器(容器) */
|
|
99
|
+
panel(attrs?: BuilderAttrs): this;
|
|
100
|
+
/** 指标卡(容器) */
|
|
101
|
+
kpi(attrs?: BuilderAttrs): this;
|
|
102
|
+
/** 数字翻牌器(自闭合) */
|
|
103
|
+
flipNum(attrs?: BuilderAttrs): this;
|
|
104
|
+
/** 轮播榜单(容器) */
|
|
105
|
+
scrollboard(attrs?: BuilderAttrs): this;
|
|
106
|
+
/** 大屏缩放容器 */
|
|
107
|
+
fitScreen(attrs?: BuilderAttrs): this;
|
|
108
|
+
|
|
109
|
+
// —— 高级网格布局(容器,需 end() 闭合)——
|
|
110
|
+
grid(attrs?: BuilderAttrs): this;
|
|
111
|
+
cell(attrs?: BuilderAttrs): this;
|
|
97
112
|
|
|
98
113
|
// —— 表格辅助 ——
|
|
99
114
|
thead(attrs?: BuilderAttrs): this;
|
|
@@ -296,6 +296,10 @@ class TokUIBuilder {
|
|
|
296
296
|
row_layout(attrs) { return this._open('row', attrs); }
|
|
297
297
|
/** 栅格列 */
|
|
298
298
|
col_layout(attrs) { return this._open('col', attrs); }
|
|
299
|
+
/** 高级网格容器(显式二维网格:cols/rows 轨道、areas 模板区域、gap/h 等) */
|
|
300
|
+
grid(attrs) { return this._open('grid', attrs); }
|
|
301
|
+
/** 网格单元(grid 子容器:area 区域名 / c 列跨 / r 行跨 / align / justify) */
|
|
302
|
+
cell(attrs) { return this._open('cell', attrs); }
|
|
299
303
|
/** 列表 */
|
|
300
304
|
list(attrs) { return this._open('list', attrs); }
|
|
301
305
|
/** 列表项(有内容自闭合 [item 文本],无内容开容器供嵌套子 list)。
|
|
@@ -344,9 +348,9 @@ class TokUIBuilder {
|
|
|
344
348
|
var a = attrs || {};
|
|
345
349
|
// hasInline 判定:凡带内联数据载体的 chart 均自闭合。
|
|
346
350
|
// d=柱/折/面积/饼/雷达/散点/气泡/直方/瀑布/箱线/K线/树图; tasks=甘特;
|
|
347
|
-
// rows=热力; nodes+flows=桑基; v=仪表盘/进度条(单值)
|
|
351
|
+
// rows=热力; nodes+flows=桑基; v=仪表盘/进度条(单值); region=地图省级热力。
|
|
348
352
|
// 漏判会让本应自闭合的 chart 走容器分支,.end() 错位闭合 → 后续栅格结构串味乱套。
|
|
349
|
-
var hasInline = a.d || a.tasks || a.rows || (a.nodes && a.flows) ||
|
|
353
|
+
var hasInline = a.d || a.tasks || a.rows || a.region || (a.nodes && a.flows) ||
|
|
350
354
|
(a.v !== undefined && (a.t === 'gauge' || a.t === 'progress'));
|
|
351
355
|
// 布局属性前置:流式预览阶段 d/tasks 边到边长,若 orient/stack/smooth/area 排在数据后,
|
|
352
356
|
// parser 半成品看不到 → 预览用默认布局,] 闭合才翻转(如 orient:h 末尾到达致纵向→横向闪)。
|
|
@@ -664,6 +668,23 @@ class TokUIBuilder {
|
|
|
664
668
|
|
|
665
669
|
/** 终端输出(容器) */
|
|
666
670
|
terminal(attrs) { return this._open('terminal', attrs); }
|
|
671
|
+
// ========== 数据大屏组件(M1 Dashboard Pack) ==========
|
|
672
|
+
|
|
673
|
+
/** 科技边框容器(容器) */
|
|
674
|
+
panel(attrs) { return this._open('panel', attrs); }
|
|
675
|
+
|
|
676
|
+
/** 指标卡(容器,子节点为底部说明行) */
|
|
677
|
+
kpi(attrs) { return this._open('kpi', attrs); }
|
|
678
|
+
|
|
679
|
+
/** 数字翻牌器(自闭合) */
|
|
680
|
+
flipNum(attrs) { return this._selfClosing('flip-num', null, attrs); }
|
|
681
|
+
|
|
682
|
+
/** 轮播榜单(容器,可加 tr 子节点行) */
|
|
683
|
+
scrollboard(attrs) { return this._open('scrollboard', attrs); }
|
|
684
|
+
|
|
685
|
+
/** 大屏缩放容器(1920×1080 设计稿等比适配) */
|
|
686
|
+
fitScreen(attrs) { return this._open('fit-screen', attrs); }
|
|
687
|
+
|
|
667
688
|
|
|
668
689
|
/** 流式闪光加载(自闭合) */
|
|
669
690
|
shimmer(attrs) { return this._selfClosing('shimmer', null, attrs); }
|