@bixlab/mtone 0.6.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.
package/llms.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Ready-styled React UI library built on Base UI, Tailwind CSS and Lucide icons. Install one package, not individual copied components.
4
4
 
5
- This file describes this package checkout, not necessarily the latest published npm release. Package version: 0.6.0. Prefer the llms.txt and dist/index.d.ts bundled with your installed version over the live website, which follows master.
5
+ This file describes this package checkout, not necessarily the latest published npm release. Package version: 0.8.0. Prefer the llms.txt and dist/index.d.ts bundled with your installed version over the live website, which follows master.
6
6
 
7
7
  ## Setup
8
8
 
@@ -11,7 +11,8 @@ This file describes this package checkout, not necessarily the latest published
11
11
  - Named imports: import { Button, MtoneProvider } from "@bixlab/mtone";
12
12
  - Import precompiled CSS once: import "@bixlab/mtone/styles.css";
13
13
  - Consumers do not need to install/configure Tailwind or copy component source. Base UI and Lucide are package dependencies.
14
- - Optional provider: <MtoneProvider locale="zh" density="compact"><Button>保存</Button></MtoneProvider>. Locale: zh | en; density: compact | comfortable. Provider tokens are CSS custom properties.
14
+ - Optional provider: <MtoneProvider locale="zh"><Button>保存</Button></MtoneProvider>. Locale: zh | en. Default single-line controls use a unified 34px baseline; density is no longer a provider prop. Independent size variants and CSS token customization remain available. Provider tokens are CSS custom properties.
15
+ - Color theme: <MtoneProvider theme="system">…</MtoneProvider> follows the OS in real time. Use light or dark to override. Without an explicit theme, top-level providers remain light; nested MtoneScope can override and floats inherit their React scope. The library does not store the choice.
15
16
  - Interactive components need a client boundary in React Server Component frameworks.
16
17
 
17
18
  ## AI coding guidance
@@ -28,6 +29,7 @@ This file describes this package checkout, not necessarily the latest published
28
29
  ## Documentation
29
30
 
30
31
  - [Getting started](https://xingjianxu.github.io/mtone/#/start): installation and AI usage
32
+ - [Theme and styling](https://xingjianxu.github.io/mtone/#/theme): color modes and tokens
31
33
  - [Component gallery](https://xingjianxu.github.io/mtone/#/gallery): independent component examples
32
34
  - [Application showcase](https://xingjianxu.github.io/mtone/showcase.html): interactive in-memory demo, not a backend
33
35
  - [Source repository](https://github.com/xingjianxu/mtone): current code and migration notes
@@ -62,7 +64,7 @@ This file describes this package checkout, not necessarily the latest published
62
64
  - showLine / showIcon: boolean / boolean (default: false). 树连接线和节点图标;图标来自节点 icon。
63
65
  - titleRender: (node: TreeItem) => ReactNode. 自定义树节点标题。
64
66
  - height / virtual: number / boolean. 树面板高度和窗口化渲染开关;高度默认 256px,virtual 默认 true。
65
- - size: "sm" | "md" | "lg" (default: "md"). 触发器高度为 24 / 28 / 34px。
67
+ - size: "sm" | "md" | "lg" (default: "md"). 触发器高度为 24 / 34 / 34px。
66
68
  - status: "error" | "warning". 校验边框状态。
67
69
  - placement: "bottom-start" | "bottom-end" | "top-start" | "top-end" (default: "bottom-start"). 弹层的方向与逻辑对齐。
68
70
  - dropdownWidth: CSSProperties["width"]. 指定弹层宽度;默认跟随触发器,最小 180px 且受视口约束。
@@ -204,7 +206,7 @@ export default function Demo() {
204
206
  - disabled / readOnly: boolean (default: false). 禁用或只读;不允许修改值。弹出式 Cascader 不打开弹层
205
207
  - open / defaultOpen / onOpenChange: boolean / boolean / (open:boolean)=>void (default: false). 仅 Cascader:控制弹层
206
208
  - placeholder / allowClear / onClear: string / boolean / ()=>void (default: 本地化提示 / false). 仅 Cascader:提示文字、清除按钮及清除回调
207
- - size / status: "sm" | "md" | "lg" / "error" | "warning" (default: md). 仅 Cascader:高度 24 / 28 / 34px,及校验状态
209
+ - size / status: "sm" | "md" | "lg" / "error" | "warning" (default: md). 仅 Cascader:高度 24 / 34 / 34px,及校验状态
208
210
  - placement: "bottom-start" | "bottom-end" | "top-start" | "top-end" (default: bottom-start). 仅 Cascader:弹层位置
209
211
  - showCheckedStrategy: "parent" | "leaf" (default: parent). 仅 Cascader:多选标签合并父级或展示叶级,不改变回调的叶路径数组
210
212
  - maxTagCount: number (default: 3). 仅 Cascader:最大可见标签数,其余显示计数
@@ -306,7 +308,7 @@ export default function Demo() {
306
308
  - autoHighlight / backfill: boolean (default: false). 自动首项高亮 / 键盘临时回填
307
309
  - allowClear / onClear: boolean / ()=>void (default: false). 清除按钮及回调
308
310
  - loading / notFoundContent: boolean / ReactNode (default: false / 本地化空状态). 加载状态和无结果内容
309
- - size / status: sm | md | lg / error | warning (default: md). 高度24/28/34px和校验状态
311
+ - size / status: sm | md | lg / error | warning (default: md). 高度24/34/34px和校验状态
310
312
  - prefix / suffix: ReactNode (default: —). 输入前后装饰
311
313
  - placement / popupWidth: top | bottom / number (default: bottom / 跟随输入). 浮层方向/像素宽度
312
314
  - popupClassName / popupStyle: string / CSSProperties (default: —). 浮层样式
@@ -678,7 +680,7 @@ export default function Demo() {
678
680
  - 插入替换光标之前的当前触发符和查询,保留光标之后的文本;超出 maxLength 时不插入,不截断候选。不会把已有提及变成不可分割的标签。默认查询禁止空白,含空格的实体值不适合默认解析规则。
679
681
  - 异步示例只模拟本地延迟,不发送网络请求。业务端须自行请求、处理错误、取消或忽略旧响应;loading 时不会选中旧候选,filterOption={false} 可保留服务端排序。
680
682
  - FormField 可直接绑定字符串 value/onChange。原生表单 reset 会恢复非受控 defaultValue,受控值仍由应用管理。getMentions 只解析文本,不能替代成员校验或权限检查。
681
- - 候选使用灰色背景高亮,不加蓝色边框。弹层挂到 document.body 时通过 MtoneProvider 继承 tokens/密度;自定义 popupRender 应保留完整 menu 与可访问语义。复杂变换容器、自定义候选内容需在目标布局验证。
683
+ - 候选使用灰色背景高亮,不加蓝色边框。弹层挂到 document.body 时通过 MtoneProvider 继承 tokens/颜色主题;自定义 popupRender 应保留完整 menu 与可访问语义。复杂变换容器、自定义候选内容需在目标布局验证。
682
684
 
683
685
  ```tsx
684
686
  import { useState } from "react";
@@ -838,7 +840,7 @@ export default function Demo() {
838
840
  - children / className / style / 原生属性: ReactNode / string / CSSProperties / HTMLAttributes. 各区域均可嵌套内容和覆盖样式;默认不生成主体 Footer,显式组合 AdminLayout.Footer 时显示,默认高度 42px。
839
841
  - 主体 Footer 与侧栏版本/折叠底栏是独立区域,默认高度均为 42px。需要时加入 <AdminLayout.Footer>内容</AdminLayout.Footer>;主体 Footer 可用 style.height 覆盖高度;--mt-layout-footer-height 可统一覆盖左右两个底栏高度。Topbar 与品牌行使用 --mt-layout-header-height(默认 48px),窄屏内容换行时可自然增高。
840
842
  - 使用 AdminLayout.Sider、AdminLayout.Header、AdminLayout.Content、AdminLayout.Footer 组合,不需要单独安装子组件。支持的属性以 mtone 文档与类型声明为准。
841
- - AdminLayout.Sider 复用本库 Sidebar 的状态、NavItem 图标窄栏和键盘提示,不重写导航逻辑。Header 推荐复用 Breadcrumb、IconButton 等已有组件。
843
+ - AdminLayout.Sider 复用本库 Sidebar 的状态、34px 高的 NavItem、图标窄栏和键盘提示,不重写导航逻辑。Header 推荐复用 Breadcrumb、IconButton 等已有组件。
842
844
  - 默认头部 48px,侧栏 240px,窄栏 52px;可通过 width、collapsedWidth 和区域 style 配置。使用有限高度或 fullHeight 后,侧栏内容和 Content 独立滚动,品牌、侧栏底部版本/折叠行与顶部操作保持可见。
843
845
  - 响应式收起为图标窄栏,不是弹出式抽屉。breakpoint 按浏览器视口判断,不按示例容器宽度判断;希望自定义手机抽屉时可组合已有 Drawer。
844
846
  - 受控状态必须在 onCollapsedChange 中更新,否则切换只发出请求。导航、路由、数据保存、账号菜单与持久化由应用实现。
@@ -996,7 +998,7 @@ export default function Demo() {
996
998
  - Input.OTP: length / mask / separator: number / boolean / ReactNode. 默认6格,限制1–32;mask 使用原生密码显示,separator 在格间显示装饰。
997
999
  - Input.OTP: inputMode / name / form / disabled / readOnly: native attributes. inputMode 默认 numeric,仅作为键盘提示,不限制内容;name 通过隐藏字段提交整串值。
998
1000
  - Input.OTP: controlSize / ref / aria-label: 'sm' | 'md' | 'lg' / Ref<HTMLInputElement> / string. ref 指向第一格;为验证码组提供可访问名称。
999
- - 默认单行28px,comfortable密度36px,sm为24px,lg为36px;焦点保持浅蓝 #93B4DC 的1px细边框,不加粗。
1001
+ - 默认单行34px,sm为24px,lg为36px;焦点保持浅蓝 #93B4DC 的1px细边框,不加粗。
1000
1002
  - Input.Search 是搜索子组件;SearchInput 是同一组件的兼容导出。Input.TextArea 与 Textarea 也是同一组件;新代码推荐子组件写法。
1001
1003
  - 原生 size、type、name、form、aria-* 和原生 ref 保留。className/style 面向原生输入,不代表外层容器。
1002
1004
  - Input.OTP 支持粘贴、组合输入、方向键与删除;删除会将后续字符前移,不保留空格占位。空白字符会移除。mask 不提供任意字符替换。
@@ -1028,7 +1030,7 @@ export default function Demo() {
1028
1030
  - disabled / readOnly: boolean. 禁用或只读。
1029
1031
  - aria-label / id: string. 可访问名称或与 label 关联的标识。
1030
1032
  - 原生属性: HTMLAttributes. 支持对应元素的 className、style 与适用的 DOM 属性;以 TypeScript 定义为准。
1031
- - 默认单行外框高度为 28px(含边框),搜索图标垂直居中;comfortable 密度保留 36px,可通过 --mt-height 定制。
1033
+ - 默认单行外框高度为 34px(含边框),搜索图标垂直居中,可通过 --mt-height 定制。
1032
1034
  - 输入表面聚焦时只将现有边框改为 #93B4DC,不加粗、不加外圈;错误与禁用状态保留,强制颜色模式使用系统焦点提示。
1033
1035
  - 支持对应原生输入元素属性和 ref。占位提示不能替代标签。
1034
1036
 
@@ -1305,7 +1307,7 @@ export default function Demo() {
1305
1307
  - defaultOpen: boolean. 非受控初始开关。
1306
1308
  - onOpenChange: (open: boolean) => void. 开关变化回调。
1307
1309
  - 同组相邻菜单或选项行之间保留 3px 间距;首项、分组标题和分隔线不额外增加间距。
1308
- - 默认单行外框高度为 28px(含边框);长选中标签在行内省略,comfortable 密度保留 34px。可用 className 覆盖尺寸。
1310
+ - 默认单行外框高度为 34px(含边框);长选中标签在行内省略。可用 className 覆盖尺寸。
1309
1311
  - 输入表面聚焦时只将现有边框改为 #93B4DC,不加粗、不加外圈;错误与禁用状态保留,强制颜色模式使用系统焦点提示。
1310
1312
  - 支持键盘选择、禁用选项和焦点恢复。
1311
1313
  - 选中项使用垂直居中的 16px Lucide Check 细线对号(1.5px 描边),无需新增属性配置。
@@ -1321,6 +1323,34 @@ export default function Demo() {
1321
1323
  }
1322
1324
  ```
1323
1325
 
1326
+ ### TagSelect
1327
+
1328
+ - [TagSelect](https://xingjianxu.github.io/mtone/#/components/TagSelect): 将多选选项平铺为标签,空间不足时可展开。
1329
+ - Import: TagSelect from @bixlab/mtone
1330
+ - options: readonly TagSelectOption[]. 每项包含唯一 value、可渲染 label 和可选 disabled。
1331
+ - value / defaultValue: readonly string[]. 受控值或初始选中值。
1332
+ - onValueChange: (value: string[]) => void. 标签切换时返回选中的值。
1333
+ - disabled: boolean. 禁用整个控件,亦继承 Fieldset 禁用。
1334
+ - selectAll: boolean (default: false). 在第一位显示全选按钮;选择或取消所有可用选项,包括折叠隐藏的选项,保留禁用选项的选中状态。
1335
+ - selectAllLabel: string (default: 全选). 全选按钮文字。
1336
+ - expandable: boolean (default: true). 选项超出一行时折叠;关闭后始终换行展示。
1337
+ - expanded / defaultExpanded: boolean. 受控展开状态或初始展开状态,默认折叠。
1338
+ - onExpandedChange: (expanded: boolean) => void. 请求切换展开状态时触发。
1339
+ - expandLabel / collapseLabel: string. 展开与收起按钮文字,默认「展开」与「收起」。
1340
+ - 选项按钮、展开按钮及单行折叠视口统一采用 34px 基准高度。建议用 aria-label 或 aria-labelledby 为整组选项命名。折叠不会清除已选值。
1341
+
1342
+ ```tsx
1343
+ import { TagSelect } from "@bixlab/mtone";
1344
+ import "@bixlab/mtone/styles.css";
1345
+
1346
+ export default function Demo() {
1347
+ return <TagSelect aria-label="主题" defaultValue={["design"]} options={[
1348
+ { value: "design", label: "产品设计" },
1349
+ { value: "research", label: "用户研究" },
1350
+ ]} />;
1351
+ }
1352
+ ```
1353
+
1324
1354
  ### MultiSelect
1325
1355
 
1326
1356
  - [MultiSelect](https://xingjianxu.github.io/mtone/#/components/MultiSelect): 支持搜索与移除标签的多选控件。
@@ -1338,7 +1368,7 @@ export default function Demo() {
1338
1368
  - defaultOpen: boolean. 非受控初始开关。
1339
1369
  - onOpenChange: (open: boolean) => void. 开关变化回调。
1340
1370
  - 同组相邻菜单或选项行之间保留 3px 间距;首项、分组标题和分隔线不额外增加间距。
1341
- - 默认单行外框最小高度为 28px(含边框);多个标签换行时自动增高,不强制裁剪为 28px。comfortable 密度下仍以 28px 为最小高度;可用 className 定制。
1371
+ - 默认单行外框最小高度为 34px(含边框);多个标签换行时自动增高,不强制裁剪为 34px;可用 className 定制。
1342
1372
  - 输入表面聚焦时只将现有边框改为 #93B4DC,不加粗、不加外圈;错误与禁用状态保留,强制颜色模式使用系统焦点提示。
1343
1373
  - MultiSelect 建议使用纯文本 label,以确保搜索与标签显示正确。
1344
1374
 
@@ -1392,7 +1422,7 @@ export default function Demo() {
1392
1422
  - onValueChange: (value: number | null) => void. 值变化回调。
1393
1423
  - min / max: number. 数值下限与上限。
1394
1424
  - step: number. 步进大小。
1395
- - 默认整体外框高度为 28px(含边框),增减按钮位于边框内;comfortable 密度保留 36px。可用 className 定制尺寸。
1425
+ - 默认整体外框高度为 34px(含边框),增减按钮位于边框内。可用 className 定制尺寸。
1396
1426
  - 输入表面聚焦时只将现有边框改为 #93B4DC,不加粗、不加外圈;错误与禁用状态保留,强制颜色模式使用系统焦点提示。
1397
1427
  - 清空时 value 可为 null;defaultValue 应传 number。
1398
1428
 
@@ -1421,7 +1451,7 @@ export default function Demo() {
1421
1451
  - min / max: string. ISO YYYY-MM-DD 日期边界。
1422
1452
  - disabledDate: (date: string) => boolean. 返回 true 的日期在选择后被拒绝。
1423
1453
  - clearable: boolean (default: true). 显示清除按钮。
1424
- - 默认单行输入外框高度为 28px(含边框);comfortable 密度保留 36px,可通过 --mt-height 定制。原生日历弹层尺寸由浏览器决定。
1454
+ - 默认单行输入外框高度为 34px(含边框),可通过 --mt-height 定制。原生日历弹层尺寸由浏览器决定。
1425
1455
  - 输入表面聚焦时只将现有边框改为 #93B4DC,不加粗、不加外圈;错误与禁用状态保留,强制颜色模式使用系统焦点提示。
1426
1456
  - 值为 YYYY-MM-DD,清空返回空字符串,不进行 UTC 转换。
1427
1457
  - 日历外观和键盘操作由浏览器决定;disabledDate 不会在原生日历中绘制禁用状态。
@@ -1453,7 +1483,7 @@ export default function Demo() {
1453
1483
  - collapseLabel / expandLabel: string (default: 收起侧边栏 / 展开侧边栏). 切换按钮的可访问名称和提示,可本地化。
1454
1484
  - children: ReactNode. 组件内容。
1455
1485
  - 原生属性: HTMLAttributes. 支持对应元素的 className、style 与适用的 DOM 属性;以 TypeScript 定义为准。
1456
- - 同组相邻菜单或选项行之间保留 3px 间距;首项、分组标题和分隔线不额外增加间距。
1486
+ - NavItem 默认行高为 34px,图标与文字垂直居中。相邻项间距不变,分组标题和分隔线不受行高影响。
1457
1487
  - 收起为 52px 图标窄栏,NavItem 保留可访问名称;NavGroup 隐藏标题并保留分组分隔。建议每个 NavItem 提供 icon,没有图标时显示圆形占位。
1458
1488
  - 收起时悬停或键盘聚焦显示提示,Escape 可关闭提示。复杂 children 请提供 aria-label 作为提示文字。
1459
1489
  - 受控用法:const [collapsed, setCollapsed] = useState(false); <Sidebar collapsible collapsed={collapsed} onCollapsedChange={setCollapsed}>…</Sidebar>。
@@ -1479,6 +1509,7 @@ export default function Demo() {
1479
1509
  - onClick: MouseEventHandler. 由应用执行导航。
1480
1510
  - children: ReactNode. 组件内容。
1481
1511
  - 原生属性: HTMLAttributes. 支持对应元素的 className、style 与适用的 DOM 属性;以 TypeScript 定义为准。
1512
+ - 默认行高 34px,图标和标签垂直居中。长纯文本标签单行省略,仍保留完整的可访问名称;可通过 --mt-height 调整。
1482
1513
  - 底层为 button,不是链接;应用负责与路由集成。
1483
1514
 
1484
1515
  ```tsx
@@ -1498,7 +1529,7 @@ export default function Demo() {
1498
1529
  - Import: NavGroup, NavItem from @bixlab/mtone
1499
1530
  - label: ReactNode. 可选分组标题。
1500
1531
  - children: ReactNode. 组件内容。
1501
- - 同组相邻 NavItem 之间保留 3px 间距,与侧边栏菜单一致;分组标题和组间距保持不变。
1532
+ - 组内 NavItem 默认行高 34px,相邻项仍保留 3px 间距;分组标题和组间距保持不变。
1502
1533
 
1503
1534
  ```tsx
1504
1535
  import { NavGroup, NavItem } from "@bixlab/mtone";
@@ -1696,7 +1727,7 @@ export default function Demo() {
1696
1727
  - Import: FilterChip from @bixlab/mtone
1697
1728
  - children: ReactNode. 组件内容。
1698
1729
  - onRemove: () => void. 必填;移除请求,由应用更新条件。
1699
- - 默认单行外框高度为 28px,与输入及选择控件对齐;comfortable 密度下仍为 28px。可通过宿主 CSS 覆盖 .mt-filter-chip 的尺寸,不新增 size 属性。
1730
+ - 默认单行外框高度为 34px,与输入及选择控件对齐。可通过宿主 CSS 覆盖 .mt-filter-chip 的尺寸,不新增 size 属性。
1700
1731
  - 点击移除不会自行隐藏,应用负责更新状态。
1701
1732
 
1702
1733
  ```tsx
@@ -2155,7 +2186,7 @@ export default function Demo() {
2155
2186
  - 原生属性: HTMLAttributes<HTMLUListElement>. 支持 className、style、aria-label、tabIndex 和 onScroll 等。
2156
2187
  - List 的数据渲染仍使用 ul/li;renderItem 仅返回条目内容。ListItem 和 DocumentList 既有用法保持不变。
2157
2188
  - 虚拟列表通过估算未挂载行和测量可见行支持不等高内容;跳到尚未测量的位置是估算定位,滚动过程中总高度可能修正。需要精确定位时使用固定高度或关闭虚拟滚动。
2158
- - List 不内置网络请求、分页、选择或排序库。加载与排序由外部受控数据组合;文档提供拖放和键盘按钮排序示例。
2189
+ - List 不内置网络请求、分页、选择或排序库。加载与排序由外部受控数据组合;数据模式可在 renderItem 的起始位置放置 List.SortHandle(接受 span 拖放事件);保留上移和下移按钮供键盘操作。
2159
2190
  - 自定义内容的按钮、链接与拖放可访问性由调用方负责;可为滚动容器设置 aria-label 和 tabIndex。
2160
2191
 
2161
2192
  ```tsx
@@ -2172,6 +2203,7 @@ export default function Demo() {
2172
2203
 
2173
2204
  - [ListItem](https://xingjianxu.github.io/mtone/#/components/ListItem): 包含图标、说明与尾部操作的列表项。
2174
2205
  - Import: ListItem, List, Button from @bixlab/mtone
2206
+ - sortHandle: ListSortHandleProps. 可选拖拽手柄,默认在条目起始侧显示六点图标;传入 onDragStart、onDragEnd 等事件,排序由应用维护。
2175
2207
  - children: ReactNode. 组件内容。
2176
2208
  - icon: ReactNode. 前置图标。
2177
2209
  - description: ReactNode. 次级描述。
@@ -2771,13 +2803,13 @@ export default function Demo() {
2771
2803
 
2772
2804
  ### MtoneProvider
2773
2805
 
2774
- - [MtoneProvider](https://xingjianxu.github.io/mtone/#/components/MtoneProvider): 为组件及其浮层配置语言、密度和主题变量。
2806
+ - [MtoneProvider](https://xingjianxu.github.io/mtone/#/components/MtoneProvider): 为组件及其浮层配置颜色模式、语言和主题变量。
2775
2807
  - Import: MtoneProvider, Button from @bixlab/mtone
2776
2808
  - children: ReactNode. 组件内容。
2777
2809
  - locale: "zh" | "en" (default: zh). 内置控件文案语言。
2778
- - density: "compact" | "comfortable" (default: compact). 控件密度。
2810
+ - theme: MtoneTheme ("light" | "dark" | "system") (default: 最外层为 light). 浅色、深色或实时跟随设备设置;省略时继承上层主题。
2779
2811
  - tokens: Tokens. CSS 自定义属性与 CSSProperties,常用 --mt-fg、--mt-bg、--mt-primary。
2780
- - 简单组件不使用 Provider 时也可用默认值。
2812
+ - 简单组件不使用 Provider 时也可用默认值,保持浅色。
2781
2813
  - 库分发预编译 CSS,不要求宿主安装 Tailwind。浮层继承 Provider 上下文。
2782
2814
  - 主题通过 CSS 变量传播,不是 Shadow DOM 隔离;自定义层级请检查 z-index 1200–1300。
2783
2815
 
@@ -2787,18 +2819,19 @@ import "@bixlab/mtone/styles.css";
2787
2819
 
2788
2820
  export default function Demo() {
2789
2821
  return (
2790
- <MtoneProvider locale="zh" density="comfortable" tokens={{"--mt-primary":"#446c52"}}><Button variant="solid">保存</Button></MtoneProvider>
2822
+ <MtoneProvider locale="zh" theme="system" tokens={{"--mt-primary":"#446c52"}}><Button variant="solid">保存</Button></MtoneProvider>
2791
2823
  );
2792
2824
  }
2793
2825
  ```
2794
2826
 
2795
2827
  ### MtoneScope
2796
2828
 
2797
- - [MtoneScope](https://xingjianxu.github.io/mtone/#/components/MtoneScope): 把当前 Provider 的主题变量和密度应用到一个 div。
2829
+ - [MtoneScope](https://xingjianxu.github.io/mtone/#/components/MtoneScope): 把当前 Provider 的主题变量应用到一个 div,可局部覆盖颜色模式。
2798
2830
  - Import: MtoneScope, MtoneProvider, Button from @bixlab/mtone
2799
2831
  - children: ReactNode. 组件内容。
2832
+ - theme: MtoneTheme ("light" | "dark" | "system") (default: 继承上层主题). 仅覆盖此作用域及其浮层的颜色模式。
2800
2833
  - 原生属性: HTMLAttributes. 支持对应元素的 className、style 与适用的 DOM 属性;以 TypeScript 定义为准。
2801
- - 通常无需手动使用;库内部用它让 Portal 浮层继承主题。它读取已有上下文,不创建新的 Provider。
2834
+ - 通常无需手动使用;库内部用它让 Portal 浮层继承主题。可覆盖颜色模式,仍继承语言和主题变量。
2802
2835
 
2803
2836
  ```tsx
2804
2837
  import { MtoneScope, MtoneProvider, Button } from "@bixlab/mtone";
@@ -2806,7 +2839,7 @@ import "@bixlab/mtone/styles.css";
2806
2839
 
2807
2840
  export default function Demo() {
2808
2841
  return (
2809
- <MtoneProvider tokens={{"--mt-primary":"#446c52"}}><MtoneScope><Button variant="solid">主题作用域</Button></MtoneScope></MtoneProvider>
2842
+ <MtoneProvider tokens={{"--mt-primary":"#446c52"}}><MtoneScope theme="dark"><Button variant="solid">主题作用域</Button></MtoneScope></MtoneProvider>
2810
2843
  );
2811
2844
  }
2812
2845
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bixlab/mtone",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Compact, ready-styled React components powered by Base UI",
6
6
  "files": [