@icen.ai/ui 0.2.0 → 0.3.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 (103) hide show
  1. package/README.md +29 -16
  2. package/dist/base.css +389 -48
  3. package/dist/behaviors/accordion.mjs +20 -0
  4. package/dist/behaviors/carousel.mjs +30 -1
  5. package/dist/behaviors/charts.mjs +168 -0
  6. package/dist/behaviors/copy.mjs +4 -3
  7. package/dist/behaviors/datatable.mjs +748 -0
  8. package/dist/behaviors/input.mjs +20 -1
  9. package/dist/behaviors/modal.mjs +15 -1
  10. package/dist/behaviors/nav.mjs +31 -4
  11. package/dist/behaviors/sidebar.mjs +12 -0
  12. package/dist/behaviors/slider.mjs +35 -3
  13. package/dist/behaviors/tabs.mjs +100 -9
  14. package/dist/behaviors/tag-input.mjs +11 -0
  15. package/dist/behaviors/theme.mjs +26 -0
  16. package/dist/behaviors/toast.mjs +83 -15
  17. package/dist/behaviors/tree.mjs +57 -1
  18. package/dist/behaviors/upload.mjs +2 -3
  19. package/dist/cli.mjs +74 -0
  20. package/dist/components/accordion.mjs +3 -0
  21. package/dist/components/alert.mjs +2 -0
  22. package/dist/components/avatar.mjs +2 -0
  23. package/dist/components/breadcrumb.css +91 -18
  24. package/dist/components/breadcrumb.mjs +2 -0
  25. package/dist/components/btn.css +174 -14
  26. package/dist/components/btn.mjs +2 -0
  27. package/dist/components/card.css +118 -18
  28. package/dist/components/card.mjs +2 -0
  29. package/dist/components/carousel.mjs +3 -0
  30. package/dist/components/charts.css +225 -33
  31. package/dist/components/charts.mjs +3 -0
  32. package/dist/components/content.css +256 -74
  33. package/dist/components/context-menu.mjs +3 -0
  34. package/dist/components/datatable.css +343 -0
  35. package/dist/components/datatable.mjs +4 -0
  36. package/dist/components/desc.mjs +2 -0
  37. package/dist/components/dropdown.mjs +3 -0
  38. package/dist/components/empty.css +50 -10
  39. package/dist/components/empty.mjs +2 -0
  40. package/dist/components/feedback.css +158 -47
  41. package/dist/components/form.css +139 -22
  42. package/dist/components/input.css +165 -45
  43. package/dist/components/input.mjs +3 -0
  44. package/dist/components/kbd.mjs +2 -0
  45. package/dist/components/layout.mjs +2 -0
  46. package/dist/components/list.mjs +2 -0
  47. package/dist/components/media-card.mjs +2 -0
  48. package/dist/components/media.css +187 -40
  49. package/dist/components/menu.css +159 -32
  50. package/dist/components/modal.css +140 -34
  51. package/dist/components/modal.mjs +3 -0
  52. package/dist/components/nav.css +134 -32
  53. package/dist/components/nav.mjs +3 -0
  54. package/dist/components/pagination.css +105 -19
  55. package/dist/components/pagination.mjs +2 -0
  56. package/dist/components/panel.css +61 -6
  57. package/dist/components/panel.mjs +2 -0
  58. package/dist/components/pill.css +74 -14
  59. package/dist/components/pill.mjs +2 -0
  60. package/dist/components/popover.css +109 -7
  61. package/dist/components/popover.mjs +3 -0
  62. package/dist/components/progress.mjs +2 -0
  63. package/dist/components/rating.mjs +2 -0
  64. package/dist/components/result.mjs +2 -0
  65. package/dist/components/segmented.css +199 -50
  66. package/dist/components/segmented.mjs +2 -0
  67. package/dist/components/select.css +140 -39
  68. package/dist/components/select.mjs +3 -0
  69. package/dist/components/sidebar.css +162 -34
  70. package/dist/components/sidebar.mjs +3 -0
  71. package/dist/components/skeleton.mjs +2 -0
  72. package/dist/components/slider.css +169 -31
  73. package/dist/components/slider.mjs +3 -0
  74. package/dist/components/spinner.mjs +2 -0
  75. package/dist/components/stat.css +103 -8
  76. package/dist/components/stat.mjs +2 -0
  77. package/dist/components/steps.css +105 -31
  78. package/dist/components/steps.mjs +2 -0
  79. package/dist/components/switch.css +171 -54
  80. package/dist/components/switch.mjs +2 -0
  81. package/dist/components/table.css +114 -12
  82. package/dist/components/table.mjs +2 -0
  83. package/dist/components/tabs.css +104 -17
  84. package/dist/components/tabs.mjs +3 -0
  85. package/dist/components/tag-input.css +119 -23
  86. package/dist/components/tag-input.mjs +3 -0
  87. package/dist/components/timeline.mjs +2 -0
  88. package/dist/components/toast.css +85 -12
  89. package/dist/components/toast.mjs +3 -0
  90. package/dist/components/tooltip.css +86 -26
  91. package/dist/components/tooltip.mjs +2 -0
  92. package/dist/components/tree.mjs +3 -0
  93. package/dist/components/upload.css +144 -17
  94. package/dist/components/upload.mjs +3 -0
  95. package/dist/index.mjs +629 -48
  96. package/dist/registry.json +197 -2
  97. package/dist/retro-effects.css +264 -0
  98. package/dist/tokens/colors.css +18 -90
  99. package/dist/tokens/retro-effects.css +264 -0
  100. package/dist/tokens/style-profiles.css +47 -47
  101. package/dist/tokens.css +65 -137
  102. package/dist/ui.css +4861 -1019
  103. package/package.json +9 -1
package/dist/tokens.css CHANGED
@@ -4,10 +4,15 @@
4
4
  /*
5
5
  * Icen Design System — 色彩 Tokens
6
6
  *
7
- * 5 体系 × 2 模式 = 10 套完整配色
8
- * 每套: 12 base + 4 glow + 8 derived + 8 semantic + 8 fill + 4 border + 2 shadow + n bridge
7
+ * 6 预设 × 2 模式 = 12 套完整配色
8
+ * clay(默认)/ piano / art / vangogh / ink / retro
9
9
  *
10
- * 用法: import "./colors.css";
10
+ * 每套包含:
11
+ * 12 base + 2 glow + 6 derived + 6 semantic + 4 fill + 2 shadow + 3 outline
12
+ * + depth 层级(canvas/sidebar/panel/card/control)+ scrollbar + bridge 别名
13
+ *
14
+ * 用法: import "./colors.css"; —— 挂在 <html> 的 preset 类决定 base 取值,
15
+ * .dark 类切换明暗,二者正交组合。
11
16
  */
12
17
 
13
18
  /* ══════════════════════════════════════════════════════════════
@@ -1140,6 +1145,16 @@
1140
1145
  --token-shadow-card: 0 1px 2px color-mix(in srgb, var(--token-text) 5%, transparent), 0 6px 18px color-mix(in srgb, var(--token-text) 5%, transparent);
1141
1146
  --token-shadow-inset: inset 0 1px 1px color-mix(in srgb, var(--token-surface) 42%, transparent), inset 0 -1px 1px color-mix(in srgb, var(--token-text) 4%, transparent);
1142
1147
  --token-top-highlight: color-mix(in srgb, var(--token-surface) 36%, transparent);
1148
+
1149
+ /* ── Scrollbar ──
1150
+ 由 base.css 的全局滚动条消费;每个预设可在自己的块里覆盖这 5 个 token,
1151
+ 以表达品牌色差(如 piano 用金、ink 用青)。retro/terminal 风格在
1152
+ style-profiles.css 里另有像素化硬覆盖。 */
1153
+ --token-scrollbar-size: 8px;
1154
+ --token-scrollbar-track: transparent;
1155
+ --token-scrollbar-thumb: color-mix(in srgb, var(--token-text) 16%, transparent);
1156
+ --token-scrollbar-thumb-hover: color-mix(in srgb, var(--token-accent) 50%, transparent);
1157
+ --token-scrollbar-button: transparent;
1143
1158
  }
1144
1159
 
1145
1160
  .dark {
@@ -1222,93 +1237,6 @@
1222
1237
  --token-top-highlight: color-mix(in srgb, var(--token-surface) 18%, transparent);
1223
1238
  }
1224
1239
 
1225
- /* ── Workbench Chrome Tokens ──
1226
- Shared spatial hierarchy for Studio and Creation editors. These sit on top
1227
- of theme depth tokens so light/dark and style profiles keep their own voice
1228
- while still exposing clear IDE-like regions. */
1229
- :root {
1230
- --token-workbench-canvas: color-mix(in srgb, var(--token-bg-soft) 78%, var(--token-line-soft) 22%);
1231
- --token-workbench-sidebar: color-mix(in srgb, var(--token-bg) 76%, var(--token-surface) 24%);
1232
- --token-workbench-editor: color-mix(in srgb, var(--token-bg) 82%, var(--token-surface) 18%);
1233
- --token-workbench-panel: color-mix(in srgb, var(--token-card) 82%, var(--token-surface) 18%);
1234
- --token-workbench-panel-strong: color-mix(in srgb, var(--token-card-strong) 78%, var(--token-surface) 22%);
1235
- --token-workbench-chrome: color-mix(in srgb, var(--token-workbench-panel) 86%, var(--token-surface) 14%);
1236
- --token-workbench-rail: color-mix(in srgb, var(--token-sidebar) 84%, var(--token-bg) 16%);
1237
- --token-workbench-gutter: color-mix(in srgb, var(--token-line-soft) 30%, transparent);
1238
- --token-workbench-edge: color-mix(in srgb, var(--token-text) 10%, transparent);
1239
- --token-workbench-edge-soft: color-mix(in srgb, var(--token-text) 7%, transparent);
1240
- --token-workbench-shadow: 0 1px 1px color-mix(in srgb, var(--token-text) 3%, transparent), 0 8px 22px color-mix(in srgb, var(--token-text) 4%, transparent);
1241
- --token-workbench-shadow-inset: inset 0 1px 0 color-mix(in srgb, var(--token-surface) 28%, transparent);
1242
- --token-editor-paper: #f5efe5;
1243
- --token-editor-paper-soft: color-mix(in srgb, var(--token-editor-paper) 88%, var(--token-bg-soft) 12%);
1244
- --token-editor-paper-chrome: color-mix(in srgb, var(--token-editor-paper) 92%, var(--token-surface) 8%);
1245
- --token-editor-paper-edge: color-mix(in srgb, var(--token-text) 7%, transparent);
1246
- }
1247
-
1248
- .dark {
1249
- --token-workbench-canvas: color-mix(in srgb, var(--token-bg) 72%, black 28%);
1250
- --token-workbench-sidebar: color-mix(in srgb, var(--token-bg-soft) 72%, black 28%);
1251
- --token-workbench-editor: color-mix(in srgb, var(--token-bg) 84%, black 16%);
1252
- --token-workbench-panel: color-mix(in srgb, var(--token-panel) 82%, black 18%);
1253
- --token-workbench-panel-strong: color-mix(in srgb, var(--token-card-strong) 82%, black 18%);
1254
- --token-workbench-chrome: color-mix(in srgb, var(--token-workbench-panel) 78%, black 22%);
1255
- --token-workbench-rail: color-mix(in srgb, var(--token-sidebar) 76%, black 24%);
1256
- --token-workbench-gutter: color-mix(in srgb, var(--token-line-soft) 44%, transparent);
1257
- --token-workbench-edge: color-mix(in srgb, var(--token-text) 11%, transparent);
1258
- --token-workbench-edge-soft: color-mix(in srgb, var(--token-text) 8%, transparent);
1259
- --token-workbench-shadow: 0 1px 1px rgba(0,0,0,.16), 0 10px 26px rgba(0,0,0,.18);
1260
- --token-workbench-shadow-inset: inset 0 1px 0 color-mix(in srgb, var(--token-text) 4%, transparent);
1261
- --token-editor-paper: #26211b;
1262
- --token-editor-paper-soft: color-mix(in srgb, var(--token-editor-paper) 88%, var(--token-bg-soft) 12%);
1263
- --token-editor-paper-chrome: color-mix(in srgb, var(--token-editor-paper) 90%, var(--token-surface-strong) 10%);
1264
- --token-editor-paper-edge: color-mix(in srgb, var(--token-text) 8%, transparent);
1265
- }
1266
-
1267
- .piano {
1268
- --token-editor-paper: #fbf8ef;
1269
- }
1270
-
1271
- .piano.dark {
1272
- --token-editor-paper: #1d1b17;
1273
- }
1274
-
1275
- .art {
1276
- --token-editor-paper: #e9f2ed;
1277
- }
1278
-
1279
- .art.dark {
1280
- --token-editor-paper: #203a34;
1281
- }
1282
-
1283
- .vangogh {
1284
- --token-editor-paper: #eee5bf;
1285
- }
1286
-
1287
- .vangogh.dark {
1288
- --token-editor-paper: #172742;
1289
- }
1290
-
1291
- .ink {
1292
- --token-editor-paper: #fbf8f1;
1293
- }
1294
-
1295
- .ink.dark {
1296
- --token-editor-paper: #1b221e;
1297
- }
1298
-
1299
- .retro {
1300
- --token-editor-paper: #f4f4ea;
1301
- }
1302
-
1303
- .retro.dark {
1304
- --token-editor-paper: #24243f;
1305
- }
1306
-
1307
- .style-retro {
1308
- --token-workbench-shadow: var(--token-shadow-card);
1309
- --token-workbench-shadow-inset: var(--token-shadow-inset);
1310
- }
1311
-
1312
1240
  /* ── 动画 ── */
1313
1241
  @keyframes blink {
1314
1242
  0%, 100% { opacity: 1; }
@@ -1334,6 +1262,10 @@
1334
1262
  * 1. 这些类挂在 <html> 上,与 .clay/.piano/.art/.vangogh/.ink/.retro 共存。
1335
1263
  * 2. 只覆盖与“风格”相关的变量:字体、圆角、阴影硬度、抗锯齿、图像渲染。
1336
1264
  * 3. 颜色仍由 preset 决定,保持正交。
1265
+ *
1266
+ * 注:选择器引用的是 base.css 的交互基元(.pressable / .control / .lift),
1267
+ * 而非源项目 opengal 的 .og-* 命名——切换 profile 时这些基元自动获得
1268
+ * 对应风格的几何/边框/阴影形态。
1337
1269
  */
1338
1270
 
1339
1271
  /* ══════════════════════════════════════════════════════════════
@@ -1488,6 +1420,19 @@
1488
1420
  /* ── 滚动条 ── */
1489
1421
  --token-scrollbar-size: 10px;
1490
1422
 
1423
+ /* ── icen 原语覆盖:retro 的聚焦环/按下/悬停全部像素化 ── */
1424
+ --icen-ring: 2px solid var(--token-accent);
1425
+ --icen-ring-soft: 2px solid var(--token-accent);
1426
+ --icen-ring-error: 2px solid var(--token-error);
1427
+ --icen-ring-success: 2px solid var(--token-success);
1428
+ --icen-press: translate(2px, 2px);
1429
+ --icen-press-soft: translate(1px, 1px);
1430
+ --icen-hover-border: var(--token-accent);
1431
+ --icen-hover-border-strong: var(--token-accent);
1432
+ --icen-control-focus-shadow: inset 2px 2px 0 var(--token-line-soft), inset -1px -1px 0 var(--token-surface-strong);
1433
+ --icen-control-focus-border: var(--token-accent);
1434
+ --icen-control-error-shadow: inset 2px 2px 0 var(--token-line-soft), inset -1px -1px 0 var(--token-surface-strong);
1435
+
1491
1436
  /* ── 渲染 ── */
1492
1437
  image-rendering: pixelated;
1493
1438
  -webkit-font-smoothing: none;
@@ -1516,9 +1461,13 @@
1516
1461
 
1517
1462
  /* ══════════════════════════════════════════════════════════════
1518
1463
  按钮 / 可点击元素 — 8-bit 像素按钮
1464
+ base.css 的 .pressable / 原生 button / [role=button] / 复位按钮
1465
+ 注:聚焦环 / 按下形变 / 悬停边框 由 --icen-* 原语驱动,
1466
+ 在 .style-retro 块里已统一覆盖;这里只补"按钮的像素投影",
1467
+ 这是 .pressable::after 高光无法表达的形态。
1519
1468
  ══════════════════════════════════════════════════════════════ */
1520
1469
 
1521
- .style-retro .og-pressable,
1470
+ .style-retro .pressable,
1522
1471
  .style-retro button,
1523
1472
  .style-retro [role="button"],
1524
1473
  .style-retro input[type="button"],
@@ -1534,42 +1483,42 @@
1534
1483
  transition: all var(--duration-fast) var(--ease-out);
1535
1484
  }
1536
1485
 
1537
- .style-retro .og-pressable::after,
1486
+ /* 禁用 .pressable::after 的现代渐变高光,retro 用硬投影表达层级 */
1487
+ .style-retro .pressable::after,
1538
1488
  .style-retro button::after {
1539
1489
  display: none;
1540
1490
  }
1541
1491
 
1542
- /* 悬停:像素高亮 */
1543
- .style-retro .og-pressable:hover,
1544
- .style-retro button:hover {
1545
- outline: 2px solid var(--token-accent);
1546
- outline-offset: -2px;
1492
+ /* 悬停:边框高亮(聚焦环由 --icen-ring 接管,不再硬覆盖 outline) */
1493
+ .style-retro .pressable:hover,
1494
+ .style-retro button:hover,
1495
+ .style-retro [role="button"]:hover {
1496
+ border-color: var(--token-accent);
1547
1497
  }
1548
1498
 
1549
- /* 按下:内移 + 阴影消失 */
1550
- .style-retro .og-pressable:active,
1499
+ /* 按下:内移 + 阴影消失(位移值由 --icen-press 驱动) */
1500
+ .style-retro .pressable:active,
1551
1501
  .style-retro button:active,
1552
1502
  .style-retro [role="button"]:active {
1553
- transform: translate(2px, 2px);
1554
1503
  box-shadow:
1555
1504
  inset -2px -2px 0 var(--token-line-soft),
1556
1505
  inset 2px 2px 0 var(--token-surface-strong);
1557
1506
  }
1558
1507
 
1559
1508
  /* 禁用状态 */
1560
- .style-retro .og-pressable:where(:disabled, [aria-disabled="true"], [data-disabled]),
1509
+ .style-retro .pressable:where(:disabled, [aria-disabled="true"], [data-disabled]),
1561
1510
  .style-retro button:disabled {
1562
- transform: none;
1563
1511
  box-shadow: none;
1564
1512
  outline: none;
1565
- opacity: 0.5;
1566
1513
  }
1567
1514
 
1568
1515
  /* ══════════════════════════════════════════════════════════════
1569
1516
  输入框 / 表单元素 — 像素输入框
1517
+ base.css 的 .control 是 wrapper 基元;原生 input/textarea/select 同样适用
1518
+ 注:聚焦阴影/边框已由 --icen-control-focus-* 接管,这里只补像素 inset 阴影
1570
1519
  ══════════════════════════════════════════════════════════════ */
1571
1520
 
1572
- .style-retro .og-control,
1521
+ .style-retro .control,
1573
1522
  .style-retro input,
1574
1523
  .style-retro textarea,
1575
1524
  .style-retro select {
@@ -1582,18 +1531,12 @@
1582
1531
  transition: none;
1583
1532
  }
1584
1533
 
1585
- .style-retro .og-control::after {
1586
- display: none;
1587
- }
1588
-
1589
- /* 被 og-control / vn-editable-field 容器包裹的输入框:自身边框透明化,
1534
+ /* 被 .control 容器包裹的输入框:自身边框透明化,
1590
1535
  完全交给外层容器承担像素边框,避免常驻/聚焦状态出现双层内框。 */
1591
- .style-retro .og-control input:not([type="checkbox"]):not([type="radio"]),
1592
- .style-retro .og-control textarea,
1593
- .style-retro .og-control select,
1594
- .style-retro .vn-editable-field input:not([type="checkbox"]):not([type="radio"]),
1595
- .style-retro .vn-editable-field textarea,
1596
- .style-retro .vn-editable-field [contenteditable="true"] {
1536
+ .style-retro .control input:not([type="checkbox"]):not([type="radio"]),
1537
+ .style-retro .control textarea,
1538
+ .style-retro .control select,
1539
+ .style-retro .control [contenteditable="true"] {
1597
1540
  border-color: transparent !important;
1598
1541
  box-shadow: none !important;
1599
1542
  background: transparent !important;
@@ -1602,22 +1545,12 @@
1602
1545
  .style-retro input:hover,
1603
1546
  .style-retro textarea:hover,
1604
1547
  .style-retro select:hover,
1605
- .style-retro .og-control:hover,
1606
- .style-retro .vn-editable-field:hover {
1607
- border-color: var(--token-accent);
1548
+ .style-retro .control:hover {
1549
+ border-color: var(--icen-hover-border);
1608
1550
  }
1609
1551
 
1610
- .style-retro .og-control:focus-within,
1611
- .style-retro .vn-editable-field:focus-within {
1612
- border-color: var(--token-accent);
1613
- box-shadow:
1614
- inset 2px 2px 0 var(--token-line-soft),
1615
- inset -1px -1px 0 var(--token-surface-strong);
1616
- outline: 2px solid var(--token-accent);
1617
- outline-offset: -2px;
1618
- }
1619
-
1620
- /* 文本输入区自身无焦点环,完全交给外层容器 */
1552
+ /* 文本输入区自身无焦点环,完全交给外层容器;
1553
+ .control:focus-within 的 box-shadow / border 由 --icen-control-focus-* 自动驱动 */
1621
1554
  .style-retro input:focus,
1622
1555
  .style-retro textarea:focus,
1623
1556
  .style-retro select:focus,
@@ -1701,8 +1634,8 @@
1701
1634
  border-color: var(--token-line-strong);
1702
1635
  }
1703
1636
 
1704
- /* 禁用平滑悬停提升 */
1705
- .style-retro .og-surface-lift:hover {
1637
+ /* 禁用平滑悬停提升;.lift 在 retro 下用硬投影 + 边框色变化表达悬停 */
1638
+ .style-retro .lift:hover {
1706
1639
  transform: none;
1707
1640
  box-shadow:
1708
1641
  2px 2px 0 var(--token-accent);
@@ -1819,7 +1752,7 @@
1819
1752
  box-shadow: var(--token-shadow-card);
1820
1753
  }
1821
1754
 
1822
- /* 非文本元素的硬像素焦点环(已在 retro-effects.css 有基础,这里强化 specificity) */
1755
+ /* 非文本元素的硬像素焦点环 */
1823
1756
  .style-retro :focus-visible:not(input):not(textarea):not(select):not([contenteditable="true"]) {
1824
1757
  outline: 2px solid var(--token-accent);
1825
1758
  outline-offset: -2px;
@@ -1827,11 +1760,6 @@
1827
1760
  border-radius: var(--radius-md);
1828
1761
  }
1829
1762
 
1830
- /* 非输入按钮在 retro 下禁用现代渐变高光(::after 渐变由 .og-pressable 提供) */
1831
- .style-retro .og-pressable::after {
1832
- display: none;
1833
- }
1834
-
1835
1763
  /* ══════════════════════════════════════════════════════════════
1836
1764
  TERMINAL — 命令行 / CRT 终端(预留,可组合任意 dark preset)
1837
1765
  ══════════════════════════════════════════════════════════════ */