fu-vue-ui 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,66 @@
1
+ fu-vue-ui 非商业使用与商业授权许可证
2
+ 版本:1.0
3
+ 生效日期:2026年11月18日
4
+
5
+ 版权所有 (c) 2025-2026 位志国。保留所有权利。
6
+
7
+ 一、适用范围与定义
8
+
9
+ 1. 本许可证适用于 fu-vue-ui 中由版权人拥有并以本许可证提供的源代码、构建产物、样式、示例、文档及其修改版本(以下统称“本软件”)。第三方代码、依赖和其他单独标注许可证的内容,遵循各自许可证;本许可证不授予版权人无权授予的权利。
10
+ 2. “版权人”指位志国,或依法承继相关权利并有权作出授权的主体。
11
+ 3. “非商业学习研究”指不直接或间接服务于商业活动、企业实际业务运行或客户交付的学习、教学、研究、技术实验和个人演示。
12
+ 4. “商业使用”包括将本软件用于企业实际业务运行,或直接、间接用于经营、获利、商业产品、商业服务、客户项目和交付。是否收费、盈利、公开源代码或对外提供服务,不是认定商业使用的唯一标准。
13
+ 5. “书面授权”指版权人或其有权代表向特定被授权人出具的、可核验且明确许可范围的书面文件,包括签署的纸质协议、有效电子协议或明确作出授权的电子邮件。询价、申请、付款、下载、公开仓库可访问、未收到回复或版权人未提出异议,本身均不构成商业授权。
14
+
15
+ 二、免费许可范围
16
+
17
+ 在遵守本许可证的前提下,版权人授予使用者免费、非独占的有限许可:
18
+
19
+ 1. 为非商业学习研究目的获取、安装、运行、复制、阅读和修改本软件,并制作不服务于商业活动的演示或实验项目。
20
+ 2. 为上述目的,非商业地分发本软件的原始版本或修改版本,但必须遵守第四条。接收者须独立遵守本许可证,分发者无权代版权人授予商业使用许可。
21
+ 3. 企业或其他组织可在隔离的非生产环境中进行有限目的的技术选型、兼容性测试和概念验证,但不得用于实际业务、客户项目开发、商业交付或向客户提供试用服务。进入这些用途之前,必须取得书面授权。
22
+ 4. 不服务于商业活动的教学、学术研究和非商业个人演示可适用本条。使用者属于教育、慈善、政府或其他非营利组织,并不使其所有用途自动获得许可;仍应根据实际用途判断是否属于免费范围。
23
+
24
+ 三、必须取得书面授权的用途
25
+
26
+ 未经事先书面授权,不得将本软件用于以下用途,包括通过修改、封装、嵌入、托管或由第三方代为使用等方式实施:
27
+
28
+ 1. 企业实际业务系统,包括内部 ERP、管理后台、办公平台、运营工具及其他支持企业业务运行的系统,即使仅内部使用且不对外收费。
29
+ 2. 客户项目、外包开发、委托开发、系统集成,以及向客户交付软件、源代码、构建产物、模板或服务;是否单独收取本软件费用不影响本项要求。
30
+ 3. 商业软件、SaaS、付费或订阅服务、商业组件库、网站模板及其开发、运营、销售、出租、商业分发或再许可。
31
+ 4. 通过广告、营销、引流、付费支持、交易撮合等方式获取商业利益的产品或服务,即使产品或服务本身免费。
32
+ 5. 原本属于非商业学习研究的项目转为上述用途。必须在转变用途之前取得授权;原有免费许可不会自动扩大为商业许可。
33
+
34
+ 书面授权应约定被授权主体、项目或产品、用途、期限、部署范围,以及是否允许修改、客户交付、分发和再许可等事项。向某一主体或项目的授权不会自动覆盖其关联公司、其他项目、客户或后续接收者。具体授权范围及费用以双方书面约定为准,本许可证不预先授予商业使用权。
35
+
36
+ 四、修改与非商业分发条件
37
+
38
+ 1. 复制或分发本软件及其包含本软件的修改版本时,必须随附完整的本许可证和版权声明;修改版本须明确标注修改事实,不得冒充版权人发布的官方版本。
39
+ 2. 不得删除、隐藏或篡改本软件中的版权、许可和权利归属信息。对本软件作出的修改、重新命名、封装或组合,不解除其中原有软件部分的非商业限制和商业授权要求。
40
+ 3. 不得对本软件原有部分作出比本许可证更宽泛的授权,也不得声称其可无条件商用。修改者对其自行创作部分依法享有的权利不受本条否定,但不得据此扩大对原有软件部分的许可。
41
+ 4. 本条不强制仅在本地使用的修改版本公开源代码,也不授权使用者披露其无权披露的第三方内容。
42
+
43
+ 五、权利保留与法定权利
44
+
45
+ 1. 本许可证不构成软件著作权、商标或其他知识产权的转让,亦不授予使用版权人姓名、商标或标识进行背书、认证或推广的权利。
46
+ 2. 除本许可证或单独书面授权明确授予的权利外,其他权利均由相应权利人保留。
47
+ 3. 本许可证不排除或限制适用法律规定的、无须版权人许可即可实施的行为,也不限制依法不得限制的使用者权利。
48
+
49
+ 六、违反条款与终止
50
+
51
+ 1. 使用者超出许可范围或违反许可条件时,应立即停止相应行为。版权人有权依法要求停止侵害、采取补救措施并追究相应责任;商业使用的后续授权不自动免除授权前行为的责任。
52
+ 2. 依本许可证授予的权利在违反许可条件时终止。使用者应停止基于本许可证的相关使用、复制和分发;恢复许可须由版权人书面确认,适用法律另有规定的除外。
53
+ 3. 单独商业授权的生效、终止及违约处理,以相应书面协议为准。依法成立的其他有效授权,不因本许可证的发布或更新而被追溯撤销。
54
+
55
+ 七、免责声明与责任限制
56
+
57
+ 在适用法律允许的范围内,本软件按“现状”和“可用”状态提供,不作适销性、特定用途适用性、持续可用性或不侵权等明示或默示保证。版权人不承担由使用或无法使用本软件导致的损失或损害,但法律规定不得免除或限制的责任除外。商业授权另有书面约定的,从其约定。
58
+
59
+ 八、适用法律与解释
60
+
61
+ 1. 本许可证适用中华人民共和国法律。争议可先协商解决;协商不成的,向依法有管辖权的人民法院提起诉讼。
62
+ 2. 某项条款依法无效或不可执行,不影响其他条款在法律允许范围内的效力。
63
+ 3. 本许可证中文文本为正式文本;README、文档、示例页面和问答仅作说明,不能扩大本许可证授予的权利。与单独商业授权约定不一致的事项,对获授权主体在相应授权范围内以单独书面约定为准。
64
+ 4. 本许可证的后续版本不自动替代使用者已合法取得的软件副本所适用的版本;使用者取得新版本软件时,应核对该版本随附的许可条件。
65
+
66
+ 本软件采用自定义源码可用许可,不是 MIT、Apache、GPL 或其他标准开源许可证。商业使用及商业交付前,请通过 https://gitee.com/weijunfu/fu-vue-ui 联系维护者申请书面授权;提交申请不代表已获授权。
package/README.md CHANGED
@@ -1,3 +1,162 @@
1
- # Temporary Holding Version
1
+ # fu-vue-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Vue 3 桌面组件库,目前提供从 ERP 抽离的分栏组件。组件按目录封装并提供独立子入口,不依赖 ERP、Element Plus 或业务模块。
4
+
5
+ 项目目录与 npm 包名均为 `fu-vue-ui`。分栏组件可通过 `fu-vue-ui/split-pane` 单独导入或注册,无需注册整个组件库。ERP 继续使用原组件,此次未修改 ERP。
6
+
7
+ ## 许可证与商用授权
8
+
9
+ 本项目采用自定义《非商业使用与商业授权许可证》:**非商业学习研究免费;企业实际业务使用和商业交付必须事先取得书面授权**。企业内部系统即使不对外收费,仍需授权。隔离的非生产选型评估可在许可证限定范围内免费进行。
10
+
11
+ 非商业分发须保留完整许可证、版权声明并标注修改;修改、封装或开源发布不解除商业使用限制。完整条款见 [LICENSE](LICENSE),具体场景和申请方式见 [授权说明](https://gitee.com/weijunfu/fu-vue-ui/blob/main/docs/licensing.md)。本项目为源码可用软件,不采用标准开源许可证。
12
+
13
+ ## 开发与验证
14
+
15
+ 需要 Node.js 22.13+(22.x)或 24+,pnpm 9.9.0。
16
+
17
+ ```sh
18
+ pnpm install --frozen-lockfile
19
+ pnpm dev
20
+ pnpm typecheck
21
+ pnpm lint
22
+ pnpm test
23
+ pnpm build
24
+ pnpm build:demo
25
+ pnpm pack
26
+ ```
27
+
28
+ `pnpm dev` 先构建组件库,再启动中文组件文档与交互演示,示例通过公开包入口导入。支持独立使用、基础分栏、嵌套、配置实验室、事件记录、API、键盘操作及主题变量。`pnpm build` 生成 ESM、CommonJS、独立 CSS 和 TypeScript 类型声明;`pnpm pack` 先执行检查、测试、构建,再生成可安装的本地压缩包。不需要发布到 npm 即可使用。
29
+
30
+ ## 安装与使用
31
+
32
+ 构建并打包后,在其他 Vue 项目中安装生成的压缩包:
33
+
34
+ ```sh
35
+ pnpm add /absolute/path/to/fu-vue-ui-0.1.0.tgz
36
+ ```
37
+
38
+ ```vue
39
+ <script setup lang="ts">
40
+ import { FuSplitPane, FuSplitPanePanel } from 'fu-vue-ui/split-pane'
41
+ import 'fu-vue-ui/split-pane/style.css'
42
+ </script>
43
+
44
+ <template>
45
+ <FuSplitPane style="height: 600px" layout="horizontal" lazy>
46
+ <FuSplitPanePanel size="30%" :min="160">
47
+ 左栏内容
48
+ </FuSplitPanePanel>
49
+ <FuSplitPanePanel :min="300">
50
+ 右栏内容
51
+ </FuSplitPanePanel>
52
+ </FuSplitPane>
53
+ </template>
54
+ ```
55
+
56
+ 也可仅全局注册分栏组件:
57
+
58
+ ```ts
59
+ import { createApp } from 'vue'
60
+ import FuSplitPanePlugin from 'fu-vue-ui/split-pane'
61
+ import 'fu-vue-ui/split-pane/style.css'
62
+ import App from './App.vue'
63
+
64
+ createApp(App).use(FuSplitPanePlugin).mount('#app')
65
+ ```
66
+
67
+ 也支持从组件库根入口导入:
68
+
69
+ ```ts
70
+ import FuVueUI, { FuSplitPane, FuSplitPanePanel } from 'fu-vue-ui'
71
+ import 'fu-vue-ui/style.css'
72
+ ```
73
+
74
+ 根入口默认导出组件库插件;子入口默认导出分栏插件,同时具名导出两个分栏组件与相关类型。当前组件库只有分栏组件,两种样式入口对应同一个 CSS 文件;独立入口不依赖根入口,使用时选择一组组件及样式入口即可。
75
+
76
+ 源码结构:
77
+
78
+ ```text
79
+ src/
80
+ index.ts # 组件库总入口
81
+ components/
82
+ split-pane/
83
+ index.ts # 分栏独立入口与插件
84
+ FuSplitPane.vue
85
+ FuSplitPanePanel.vue
86
+ sizes.ts
87
+ selectionLock.ts
88
+ ```
89
+
90
+ ## API
91
+
92
+ `FuSplitPane` 属性:
93
+
94
+ | 属性 | 类型 | 默认值 | 说明 |
95
+ | --- | --- | --- | --- |
96
+ | `layout` | `string` | `horizontal` | `horizontal` 为左右分栏,`vertical` 为上下分栏 |
97
+ | `lazy` | `boolean` | `false` | 拖动期间仅显示预览线,松开后应用尺寸 |
98
+
99
+ `FuSplitPanePanel` 属性:
100
+
101
+ | 属性 | 类型 | 默认值 | 说明 |
102
+ | --- | --- | --- | --- |
103
+ | `size` | `number \| string` | 自动分配 | 支持像素数字、数字字符串、`px` 或 `%`;百分比相对于扣除分隔条后的可用空间 |
104
+ | `min` | `number` | `0` | 最小尺寸,单位为 CSS 像素 |
105
+
106
+ `size` 是初始/外部指定尺寸;拖动后保留用户偏好。修改 `size`、`min`、方向或面板结构会重新计算布局。容器小于面板最小尺寸总和时保留最小尺寸并允许滚动。每条分隔条占 12px。
107
+
108
+ | 事件 | 参数 | 说明 |
109
+ | --- | --- | --- |
110
+ | `resizeStart` | `(index: number, sizes: number[])` | 开始拖动或键盘调整 |
111
+ | `resize` | `(sizes: number[])` | 应用尺寸(不在初始测量或普通容器变化时触发) |
112
+ | `resizeEnd` | `(index: number, sizes: number[])` | 调整结束;取消交互时返回开始时的尺寸 |
113
+
114
+ `index` 是从 0 开始的分隔条索引,`sizes` 是所有面板的像素尺寸副本。可导入 `SplitterPanelSize`、`SplitPaneResizeHandler` 和 `SplitPaneResizeBoundaryHandler` 类型。
115
+
116
+ 使用默认插槽直接放置 `FuSplitPanePanel`,支持 `v-if`、`v-for` 与 Fragment;不识别额外自定义组件包装后的面板。嵌套分栏放在面板内部。容器必须有明确的宽高;父级 flex/grid 容器按需要设置 `min-width: 0`、`min-height: 0`,让滚动区域保持可达。
117
+
118
+ 支持方向键每次调整 10px、Shift + 方向键调整 50px、Home/End 到达相邻面板允许的边界、Escape 取消拖动。包含焦点、ARIA separator、中文提示、RTL 横向拖动和 KeepAlive 生命周期清理。
119
+
120
+ ## 主题
121
+
122
+ 组件不读取 ERP 的 CSS 变量。可在 `:root` 或分栏容器上设置下列变量;提示通过 Teleport 渲染到 `body`,提示的主题变量应设置在 `:root` 上。
123
+
124
+ | CSS 变量 | 默认值 |
125
+ | --- | --- |
126
+ | `--fu-ui-border` | `#d5dee8` |
127
+ | `--fu-ui-surface-subtle` | `#f7f9fc` |
128
+ | `--fu-ui-text-muted` | `#7b8798` |
129
+ | `--fu-ui-primary-soft` | `#e7effc` |
130
+ | `--fu-ui-primary` | `#1765e8` |
131
+ | `--fu-ui-primary-active` | `#145ad0` |
132
+ | `--fu-ui-surface` | `#fff` |
133
+ | `--fu-ui-text` | `#172033` |
134
+
135
+ 现代桌面浏览器需支持 Pointer Events、ResizeObserver 和 CSS Grid。组件样式类统一为 `fu-ui*`,不包含移动端适配。
136
+
137
+ ## 来源与范围
138
+
139
+ 源实现来自 `erp-yst/erp-ui/src/components/app/splitter`:组件命名由 `AppSplitter` / `AppSplitterPanel` 改为 `FuSplitPane` / `FuSplitPanePanel`;尺寸计算、交互和生命周期逻辑保持一致,样式类、注入符号和 CSS 变量使用独立前缀。
140
+
141
+ 原有五组测试随库迁移,覆盖尺寸分配、随机配置不变量、键盘和指针交互、选择锁、嵌套分栏与生命周期边界;另有公开导出和插件注册测试。发布前应运行上述检查,并在桌面浏览器中检查缩小窗口、浏览器缩放和父级侧栏展开后的滚动及按钮可达性。
142
+
143
+ ## 组件文档与演示
144
+
145
+ 运行 `pnpm docs:dev` 查看本地文档;运行 `pnpm docs:build` 生成 `demo-dist` 静态文档,运行 `pnpm docs:preview` 预览构建结果。静态资源使用相对路径,可将整个 `demo-dist` 目录托管到静态 HTTP 站点的根路径或子目录,无需服务端路由重写。
146
+
147
+ 演示覆盖独立导入、嵌套、横纵方向、百分比与像素尺寸、最小尺寸与滚动、lazy、第三栏动态切换、RTL、主题和事件;代码可展开并复制。详细集成说明见 [分栏组件文档](https://gitee.com/weijunfu/fu-vue-ui/blob/main/docs/split-pane.md)。
148
+
149
+ ## 发布范围与检查
150
+
151
+ npm 安装包使用逐文件白名单,只包含 ESM / CommonJS 运行产物、CSS、公开入口所需的类型声明、README、LICENSE 和 npm 必需的 package.json。组件实现源码、开发文档目录、演示、测试、开发脚本、构建配置、环境文件、凭据文件和源码映射不随包发布。类型声明用于编辑器提示,不包含组件实现。
152
+
153
+ ```sh
154
+ pnpm pack
155
+ sh scripts/check-release.sh fu-vue-ui-0.1.0.tgz
156
+ ```
157
+
158
+ 打包前自动执行类型检查、Lint、测试、干净输出构建和发布清单预检;检查脚本也可验证实际压缩包。发布检查拒绝白名单外文件、缺失入口、链接、源码映射、本机路径和常见凭据特征,错误信息不输出疑似敏感内容。新增发布产物时需同步调整 package.json 白名单和检查脚本中的允许清单。
159
+
160
+ 仅在核对实际安装包后发布该压缩包;本任务不自动上传 npm 或 Gitee。组件文档站点是单独的构建产物,其中包含用于展示的示例源码,不应作为 npm 安装包发布。JavaScript 运行产物仍可被查看和分析;此流程排除原始实现源码及配置,不提供不可逆的代码保密或任意秘密检测保证。
161
+
162
+ 构建完成后自动为所有 JS、CommonJS、CSS 和类型声明文件添加统一的 `/*! ... */` 版权头,包含版权人、非商业使用范围、商用书面授权要求、许可证提示及项目地址。版权模板位于 `scripts/copyright-banner.txt`;发布检查要求每个发布产物以完整版权头开头,缺失时拒绝打包。重复构建或执行版权添加脚本不会重复叠加版权头。
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ import { type VNode } from 'vue';
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
12
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
13
+ layout: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ validator: (value: string) => boolean;
17
+ };
18
+ lazy: BooleanConstructor;
19
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
20
+ [key: string]: any;
21
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("resizeStart" | "resize" | "resizeEnd")[], "resizeStart" | "resize" | "resizeEnd", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
22
+ layout: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ validator: (value: string) => boolean;
26
+ };
27
+ lazy: BooleanConstructor;
28
+ }>> & Readonly<{
29
+ onResizeStart?: ((...args: any[]) => any) | undefined;
30
+ onResize?: ((...args: any[]) => any) | undefined;
31
+ onResizeEnd?: ((...args: any[]) => any) | undefined;
32
+ }>, {
33
+ lazy: boolean;
34
+ layout: string;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ type __VLS_Props = {
10
+ size?: number | string;
11
+ min?: number;
12
+ };
13
+ declare const __VLS_template: () => {
14
+ __VLS_Slots: {
15
+ default?: (props: {}) => any;
16
+ };
17
+ };
18
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ import type { Plugin } from 'vue';
10
+ import FuSplitPane from './FuSplitPane.vue';
11
+ import FuSplitPanePanel from './FuSplitPanePanel.vue';
12
+ export { FuSplitPane, FuSplitPanePanel };
13
+ export type { SplitterPanelSize } from './sizes';
14
+ /** Sizes are CSS pixels; index identifies the separator before the following panel. */
15
+ export type SplitPaneResizeHandler = (sizes: number[]) => void;
16
+ export type SplitPaneResizeBoundaryHandler = (index: number, sizes: number[]) => void;
17
+ declare const plugin: Plugin;
18
+ export default plugin;
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ export interface SplitterPanelSize {
10
+ size?: number | string;
11
+ min?: number;
12
+ }
13
+ export declare const SPLITTER_BAR_SIZE = 12;
14
+ export declare function panelMinimum(panel: SplitterPanelSize): number;
15
+ /** Preserve minimums and fit the remaining space without feeding content dimensions back into the host. */
16
+ export declare function fitPanelSizes(requested: number[], minimums: number[], available: number): number[];
17
+ export declare function resolvePanelSizes(panels: SplitterPanelSize[], containerSize: number, preferred?: number[]): number[];
18
+ export declare function resizeAdjacentPanels(sizes: number[], minimums: number[], index: number, delta: number): number[];
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ .fu-ui-panel[data-v-880cb5b9]{box-sizing:border-box;min-width:0;min-height:0;overflow:auto}.fu-ui[data-v-b0f8c075]{display:grid;box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0;contain:size;overflow:auto;position:relative;align-content:start;justify-content:start}.fu-ui-bar[data-v-b0f8c075]{position:relative;min-width:0;min-height:0;touch-action:none;-webkit-user-select:none;user-select:none;cursor:col-resize;z-index:1;transition:background-color .14s ease}.fu-ui--vertical>.fu-ui-bar[data-v-b0f8c075]{cursor:row-resize}.fu-ui-bar__line[data-v-b0f8c075],.fu-ui-bar__origin[data-v-b0f8c075]{display:block;position:absolute;left:calc(50% - .5px);top:0;bottom:0;width:1px;background:var(--fu-ui-border, #d5dee8);pointer-events:none}.fu-ui--vertical>.fu-ui-bar>.fu-ui-bar__line[data-v-b0f8c075],.fu-ui--vertical>.fu-ui-bar>.fu-ui-bar__origin[data-v-b0f8c075]{left:0;right:0;top:calc(50% - .5px);bottom:auto;width:auto;height:1px}.fu-ui-bar__grip[data-v-b0f8c075]{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:3PX;position:absolute;left:calc(50% - 3PX);top:max(0PX,calc(50% - 14PX));width:6PX;height:min(28PX,100%);box-sizing:border-box;border:1px solid var(--fu-ui-border, #d5dee8);border-radius:4PX;background:var(--fu-ui-surface-subtle, #f7f9fc);color:var(--fu-ui-text-muted, #7b8798);overflow:hidden;pointer-events:none;transition:background-color .14s ease,border-color .14s ease}.fu-ui--vertical>.fu-ui-bar>.fu-ui-bar__grip[data-v-b0f8c075]{flex-direction:row;left:max(0PX,calc(50% - 14PX));top:calc(50% - 3PX);width:min(28PX,100%);height:6PX}.fu-ui-bar__grip>i[data-v-b0f8c075]{width:2PX;height:2PX;border-radius:50%;background:currentColor}.fu-ui-bar--hovered[data-v-b0f8c075]:not([aria-disabled=true]),.fu-ui-bar--active[data-v-b0f8c075]{background:var(--fu-ui-primary-soft, #e7effc)}.fu-ui-bar--hovered:not([aria-disabled=true])>.fu-ui-bar__line[data-v-b0f8c075],.fu-ui-bar--active>.fu-ui-bar__line[data-v-b0f8c075]{background:var(--fu-ui-primary, #1765e8)}.fu-ui-bar--hovered:not([aria-disabled=true])>.fu-ui-bar__grip[data-v-b0f8c075],.fu-ui-bar--active>.fu-ui-bar__grip[data-v-b0f8c075]{background:var(--fu-ui-primary, #1765e8);border-color:var(--fu-ui-primary, #1765e8);color:var(--fu-ui-surface, #fff)}.fu-ui-bar--active[data-v-b0f8c075]{z-index:2}.fu-ui-bar--active>.fu-ui-bar__grip[data-v-b0f8c075]{background:var(--fu-ui-primary-active, #145ad0);border-color:var(--fu-ui-primary-active, #145ad0)}.fu-ui-bar--lazy>.fu-ui-bar__origin[data-v-b0f8c075]{background:repeating-linear-gradient(to bottom,var(--fu-ui-border, #d5dee8) 0 3PX,transparent 3PX 6PX)}.fu-ui--vertical>.fu-ui-bar--lazy>.fu-ui-bar__origin[data-v-b0f8c075]{background:repeating-linear-gradient(to right,var(--fu-ui-border, #d5dee8) 0 3PX,transparent 3PX 6PX)}.fu-ui-bar[data-v-b0f8c075]:focus-visible{outline:none}.fu-ui-bar:focus-visible:not([aria-disabled=true])>.fu-ui-bar__line[data-v-b0f8c075]{background:var(--fu-ui-primary, #1765e8)}.fu-ui-bar:focus-visible:not([aria-disabled=true])>.fu-ui-bar__grip[data-v-b0f8c075]{outline:2PX solid var(--fu-ui-primary, #1765e8);outline-offset:1PX}.fu-ui-bar[aria-disabled=true][data-v-b0f8c075]{cursor:default}.fu-ui-bar[aria-disabled=true]>.fu-ui-bar__grip[data-v-b0f8c075]{opacity:.55}.fu-ui-tooltip[data-v-b0f8c075]{position:fixed;z-index:3000;width:max-content;max-width:calc(100vw - 16PX);box-sizing:border-box;padding:6PX 10PX;border:1px solid rgb(255 255 255 / 14%);border-radius:6PX;background:var(--fu-ui-text, #172033);color:var(--fu-ui-surface, #fff);box-shadow:0 3PX 12PX #10244029;font:12PX/1.4 system-ui,sans-serif;overflow-wrap:anywhere;pointer-events:none}@media(prefers-reduced-motion:reduce){.fu-ui-bar[data-v-b0f8c075],.fu-ui-bar__grip[data-v-b0f8c075]{transition:none}}
package/dist/index.cjs ADDED
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./split-pane.cjs");exports.FuSplitPane=e.FuSplitPane;exports.FuSplitPanePanel=e.FuSplitPanePanel;exports.default=e.default;
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ export { default } from './components/split-pane';
10
+ export * from './components/split-pane';
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ import { FuSplitPane as l, FuSplitPanePanel as t, default as n } from "./split-pane.js";
10
+ export {
11
+ l as FuSplitPane,
12
+ t as FuSplitPanePanel,
13
+ n as default
14
+ };
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),Se={class:"fu-ui-panel"},_e=o.defineComponent({name:"FuSplitPanePanel",__name:"FuSplitPanePanel",props:{size:{},min:{}},setup(t){return(r,l)=>(o.openBlock(),o.createElementBlock("div",Se,[o.renderSlot(r.$slots,"default",{},void 0,!0)]))}}),he=(t,r)=>{const l=t.__vccOpts||t;for(const[f,b]of r)l[f]=b;return l},Z=he(_e,[["__scopeId","data-v-880cb5b9"]]),U=new WeakMap;function Me(t){let r=U.get(t);r||(r={count:0,value:t.body.style.getPropertyValue("user-select"),priority:t.body.style.getPropertyPriority("user-select")},U.set(t,r),t.body.style.setProperty("user-select","none")),r.count+=1;let l=!1;return()=>{l||(l=!0,r.count-=1,!r.count&&(r.value?t.body.style.setProperty("user-select",r.value,r.priority):t.body.style.removeProperty("user-select"),U.delete(t)))}}const X=12;function $(t){const r=Number(t.min??0);return Number.isFinite(r)?Math.max(0,r):0}function Ee(t,r){if(t===void 0||t==="")return;const l=String(t).trim(),f=Number(l.replace(/(?:px|%)$/,""));if(!(!Number.isFinite(f)||f<0))return l.endsWith("%")?r*f/100:f}function ce(t,r,l){const f=t.map((c,d)=>Math.max(r[d],Number.isFinite(c)?c:0)),b=r.reduce((c,d)=>c+d,0);if(l<=b)return[...r];const y=f.reduce((c,d)=>c+d,0),v=f.map((c,d)=>c-r[d]),_=y-b,F=l-b;return f.map((c,d)=>r[d]+F*(_>0?v[d]/_:1/f.length))}function fe(t,r,l){if(!t.length)return[];const f=Math.max(0,r-X*(t.length-1)),b=t.map($);if(l?.length===t.length)return ce(l,b,f);const y=t.map(c=>Ee(c.size,f)),v=y.filter(c=>c===void 0).length,_=y.reduce((c,d)=>c+(d??0),0),F=Math.max(0,f-_)/(v||1);return ce(y.map(c=>c??F),b,f)}function de(t,r,l,f){if(l<0||l>=t.length-1)return[...t];const b=Math.max(r[l]-t[l],Math.min(f,t[l+1]-r[l+1]));return t.map((y,v)=>v===l?y+b:v===l+1?y-b:y)}const ve=Symbol("fu-ui-layout-change");function Y(t){return Array.isArray(t)?t.flatMap(r=>Array.isArray(r)?Y(r):o.isVNode(r)?r.type===o.Fragment?Y(r.children):r.type===Z?[r]:[]:[]):[]}const ke=o.defineComponent({name:"FuSplitPane",props:{layout:{type:String,default:"horizontal",validator:t=>["horizontal","vertical"].includes(t)},lazy:Boolean},emits:["resizeStart","resize","resizeEnd"],setup(t,{slots:r,emit:l}){const f=o.inject(ve,void 0),b=o.shallowRef({});o.provide(ve,b);const y=()=>{b.value={}},v=o.ref(),_=o.ref(0),F=o.ref(0),c=o.ref(0),d=o.ref(null);let O,P=[],h=[],K,G=[];const ye=[],me=[];let J,L,I,i,j,M=!1;const Q=`fu-ui-tooltip-${o.getCurrentInstance().uid}`,H=o.ref(),A=o.ref(null),V=o.ref(null),k=o.shallowRef(),ee=o.ref({left:"8px",top:"8px"}),C=e=>_.value>0&&e>=0&&e<h.length-1&&h[e]+h[e+1]>$(P[e])+$(P[e+1])+.1;let R=0;const E=()=>{R+=1,k.value=void 0},ge=()=>{if(!k.value||!H.value||!M)return;const e=v.value?.ownerDocument.defaultView;if(!e)return;const n=H.value.getBoundingClientRect(),{x:a,y:u}=k.value,m=t.layout==="vertical",z=m?a-n.width/2:a+14+n.width<=e.innerWidth-8?a+14:a-n.width-14,w=m?u-n.height-14>=8?u-n.height-14:u+14:u-n.height/2;ee.value={left:`${Math.max(8,Math.min(z,e.innerWidth-n.width-8))}px`,top:`${Math.max(8,Math.min(w,e.innerHeight-n.height-8))}px`}},W=(e,n,a,u=h)=>{if(i||!C(e)){E();return}const m=t.layout==="vertical"?"高度":"宽度";let z=n==="hover"?`拖动调整${m}`:n==="focus"?`方向键调整${m}`:`${m} ${Math.round(u[e])} px`;n==="keyboard"&&(u[e]<=$(P[e])+.1?z+=` · 已到最小${m}`:u[e+1]<=$(P[e+1])+.1&&(z+=` · 相邻区域已到最小${m}`));const w=a.getBoundingClientRect(),D={x:w.left+w.width/2,y:w.top+w.height/2};R+=1,k.value={index:e,kind:n,text:z,...D},o.nextTick(ge)},T=()=>{i&&S(),E()};f&&o.watch(f,()=>{T(),y()});const te=e=>{const n=v.value,a=e.target;n&&(a===L||a===n.ownerDocument||a&&"document"in a&&a.document===n.ownerDocument||a&&"contains"in a&&typeof a.contains=="function"&&a.contains(n))&&T()},ne=()=>t.layout==="horizontal"&&v.value&&(v.value.ownerDocument.defaultView||window).getComputedStyle(v.value).direction==="rtl"?-1:1,oe=e=>t.layout==="vertical"?e.clientY:e.clientX,ae=()=>{const e=v.value;if(!e)return;const n=(e.ownerDocument.defaultView||window).getComputedStyle(e);I={width:Math.max(0,e.clientWidth-parseFloat(n.paddingLeft||"0")-parseFloat(n.paddingRight||"0")),height:Math.max(0,e.clientHeight-parseFloat(n.paddingTop||"0")-parseFloat(n.paddingBottom||"0"))},_.value=t.layout==="vertical"?I.height:I.width},N=e=>{K=e,h=e,F.value+=1,y(),l("resize",[...e])},q=()=>{const e=i;i=void 0,e&&(e.view.removeEventListener("pointermove",ie),e.view.removeEventListener("pointerup",le),e.view.removeEventListener("pointercancel",S),e.view.removeEventListener("blur",S),e.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId),j?.(),j=void 0),d.value=null,c.value=0,E()},re=e=>i?de(i.sizes,P.map($),i.index,(oe(e)-i.start)/i.scale*i.direction):h;function ie(e){if(!i||e.pointerId!==i.pointerId)return;e.preventDefault();const n=i,a=re(e);n.lazy?c.value=a[n.index]-n.sizes[n.index]:N(a)}function le(e){if(!i||e.pointerId!==i.pointerId)return;const n=i.index,a=re(e);q(),N(a),M&&l("resizeEnd",n,[...a])}function S(e){if(!i||e&&"pointerId"in e&&e.pointerId!==i.pointerId)return;const n=i.index,a=i.sizes,u=i.lazy;q(),u||N(a),M&&l("resizeEnd",n,[...a])}const we=(e,n)=>{if(e.button!==0||e.isPrimary===!1||i||_.value<=0||!C(n))return;e.preventDefault();const a=e.currentTarget;a.focus({preventScroll:!0});const u=a.ownerDocument.defaultView||window,m=a.getBoundingClientRect(),z=(t.layout==="vertical"?m.height:m.width)/X;i={index:n,start:oe(e),sizes:[...h],pointerId:e.pointerId,handle:a,lazy:t.lazy,view:u,scale:z>0?z:1,direction:ne()},d.value=n,j=Me(a.ownerDocument),E(),e.isTrusted&&a.setPointerCapture?.(e.pointerId),u.addEventListener("pointermove",ie,{passive:!1}),u.addEventListener("pointerup",le),u.addEventListener("pointercancel",S),u.addEventListener("blur",S),l("resizeStart",n,[...h])},be=(e,n)=>{if(i){e.key==="Escape"&&(e.preventDefault(),S());return}if(e.key==="Escape"){E();return}if(!C(n))return;const a=t.layout==="vertical"?"ArrowUp":"ArrowLeft",u=t.layout==="vertical"?"ArrowDown":"ArrowRight";if(![a,u,"Home","End"].includes(e.key))return;e.preventDefault();const m=e.key==="Home"?-1/0:e.key==="End"?1/0:(e.key===a?-1:1)*(e.shiftKey?50:10)*ne(),z=de(h,P.map($),n,m),w=R;if(l("resizeStart",n,[...h]),!M||(N(z),!M)||(l("resizeEnd",n,[...z]),!M||i||w!==R))return;const D=e.currentTarget,B=++R;o.nextTick(()=>{M&&D.isConnected&&B===R&&W(n,"keyboard",D,z)})};o.watch(()=>t.layout,async()=>{S(),await o.nextTick(),ae()}),o.watch(()=>t.lazy,()=>S());const se=()=>{M=!0,L=v.value?.ownerDocument.defaultView||window,L.addEventListener("scroll",te,!0),L.addEventListener("resize",T),L.addEventListener("blur",T),ae(),y(),v.value&&O?.observe(v.value)},ue=()=>{O?.disconnect(),L?.removeEventListener("scroll",te,!0),L?.removeEventListener("resize",T),L?.removeEventListener("blur",T)};return o.onMounted(()=>{O=new ResizeObserver(e=>{const n=e[0];if(!n||!M)return;const a=Math.max(0,t.layout==="vertical"?n.contentRect.height:n.contentRect.width),u=I&&Math.abs(t.layout==="vertical"?n.contentRect.width-I.width:n.contentRect.height-I.height)>=.1;if(I={width:n.contentRect.width,height:n.contentRect.height},Math.abs(a-_.value)<.1){u&&(E(),y());return}i&&S(),E(),_.value=a,y()}),se()}),o.onActivated(se),o.onDeactivated(()=>{S(),E(),M=!1,ue()}),o.onBeforeUnmount(()=>{M=!1,q(),ue()}),()=>{const e=Y(r.default?.()||[]),n=e.map(g=>({size:g.props?.size,min:g.props?.min})),a=e.map(g=>g.key),u=J===t.layout&&P.length===n.length&&n.every((g,p)=>a[p]===G[p]&&Object.is(g.min,P[p].min)),m=u&&n.every((g,p)=>Object.is(g.size,P[p].size)),z=!m&&u&&K&&fe(n,_.value).every((g,p)=>Math.abs(g-h[p])<.1);!m&&!z&&(i&&S(),E(),A.value=null,V.value=null,K=void 0,y()),P=n,G=a,J=t.layout,F.value,h=fe(P,_.value,K);const w=t.layout==="vertical",D=h.flatMap((g,p)=>p?[`${X}px`,`${g}px`]:[`${g}px`]).join(" "),B=[];return e.forEach((g,p)=>{if(p){const s=p-1,ze=$(P[s]),Pe=h[s]+h[p]-$(P[p]);B.push(o.h("div",{key:ye[s]??=Symbol("separator"),class:["fu-ui-bar",{"fu-ui-bar--active":d.value===s,"fu-ui-bar--hovered":A.value===s,"fu-ui-bar--focused":V.value===s,"fu-ui-bar--lazy":t.lazy&&d.value===s}],role:"separator",tabindex:C(s)?0:-1,"aria-label":`调整第 ${p} 和第 ${p+1} 个区域大小`,"aria-orientation":w?"horizontal":"vertical","aria-valuemin":Math.round(ze),"aria-valuemax":Math.round(Pe),"aria-valuenow":Math.round(h[s]),"aria-valuetext":`${Math.round(h[s])}px`,"aria-disabled":!C(s),"aria-describedby":k.value?.index===s?Q:void 0,onPointerenter:x=>{!C(s)||i||(A.value=s,W(s,"hover",x.currentTarget))},onPointerleave:()=>{A.value===s&&(A.value=null),!i&&k.value?.kind==="hover"&&E()},onFocus:x=>{C(s)&&(V.value=s,i||W(s,"focus",x.currentTarget))},onBlur:()=>{V.value===s&&(V.value=null),i?.index===s?S():i||E()},onPointerdown:x=>we(x,s),onLostpointercapture:x=>{i?.index===s&&S(x)},onKeydown:x=>be(x,s)},[t.lazy&&d.value===s?o.h("span",{class:"fu-ui-bar__origin","aria-hidden":"true"}):null,o.h("span",{class:"fu-ui-bar__line","aria-hidden":"true",style:t.lazy&&d.value===s?{transform:`translate${w?"Y":"X"}(${c.value*(i?.direction??1)}px)`}:void 0}),o.h("span",{class:"fu-ui-bar__grip","aria-hidden":"true",style:t.lazy&&d.value===s?{transform:`translate${w?"Y":"X"}(${c.value*(i?.direction??1)}px)`}:void 0},[o.h("i"),o.h("i"),o.h("i")])]))}B.push(o.cloneVNode(g,{key:g.key??(me[p]??=Symbol("panel"))}))}),k.value&&B.push(o.h(o.Teleport,{to:v.value?.ownerDocument.body||"body"},[o.h("div",{ref:H,id:Q,role:"tooltip",class:"fu-ui-tooltip","data-kind":k.value.kind,"data-axis":w?"height":"width",style:ee.value},k.value.text)])),o.h("div",{ref:v,class:["fu-ui",`fu-ui--${t.layout}`],style:{gridTemplateRows:w?D:"minmax(0, 1fr)",gridTemplateColumns:w?"minmax(0, 1fr)":D}},B)}}}),pe=he(ke,[["__scopeId","data-v-b0f8c075"]]),xe={install(t){t.component("FuSplitPane",pe),t.component("FuSplitPanePanel",Z)}};exports.FuSplitPane=pe;exports.FuSplitPanePanel=Z;exports.default=xe;
@@ -0,0 +1,273 @@
1
+ /*!
2
+ * fu-vue-ui
3
+ * Copyright (c) 2025-2026 位志国. All rights reserved.
4
+ * 非商业学习研究免费;企业实际业务使用和商业交付须事先取得书面授权。
5
+ * Noncommercial study and research are free; enterprise business use and commercial delivery require prior written authorization.
6
+ * @license SEE LICENSE IN LICENSE
7
+ * https://gitee.com/weijunfu/fu-vue-ui
8
+ */
9
+ import { defineComponent as me, openBlock as ke, createElementBlock as $e, renderSlot as xe, inject as Le, shallowRef as de, provide as Ie, ref as x, getCurrentInstance as De, watch as Y, nextTick as q, onMounted as Ce, onActivated as Fe, onDeactivated as Re, onBeforeUnmount as Te, h as M, cloneVNode as Be, Teleport as Ae, isVNode as Ve, Fragment as Ke } from "vue";
10
+ const Ne = { class: "fu-ui-panel" }, He = /* @__PURE__ */ me({
11
+ name: "FuSplitPanePanel",
12
+ __name: "FuSplitPanePanel",
13
+ props: {
14
+ size: {},
15
+ min: {}
16
+ },
17
+ setup(t) {
18
+ return (a, i) => (ke(), $e("div", Ne, [
19
+ xe(a.$slots, "default", {}, void 0, !0)
20
+ ]));
21
+ }
22
+ }), ge = (t, a) => {
23
+ const i = t.__vccOpts || t;
24
+ for (const [u, w] of a)
25
+ i[u] = w;
26
+ return i;
27
+ }, we = /* @__PURE__ */ ge(He, [["__scopeId", "data-v-880cb5b9"]]), Z = /* @__PURE__ */ new WeakMap();
28
+ function Oe(t) {
29
+ let a = Z.get(t);
30
+ a || (a = { count: 0, value: t.body.style.getPropertyValue("user-select"), priority: t.body.style.getPropertyPriority("user-select") }, Z.set(t, a), t.body.style.setProperty("user-select", "none")), a.count += 1;
31
+ let i = !1;
32
+ return () => {
33
+ i || (i = !0, a.count -= 1, !a.count && (a.value ? t.body.style.setProperty("user-select", a.value, a.priority) : t.body.style.removeProperty("user-select"), Z.delete(t)));
34
+ };
35
+ }
36
+ const G = 12;
37
+ function L(t) {
38
+ const a = Number(t.min ?? 0);
39
+ return Number.isFinite(a) ? Math.max(0, a) : 0;
40
+ }
41
+ function je(t, a) {
42
+ if (t === void 0 || t === "") return;
43
+ const i = String(t).trim(), u = Number(i.replace(/(?:px|%)$/, ""));
44
+ if (!(!Number.isFinite(u) || u < 0))
45
+ return i.endsWith("%") ? a * u / 100 : u;
46
+ }
47
+ function ve(t, a, i) {
48
+ const u = t.map((c, f) => Math.max(a[f], Number.isFinite(c) ? c : 0)), w = a.reduce((c, f) => c + f, 0);
49
+ if (i <= w) return [...a];
50
+ const p = u.reduce((c, f) => c + f, 0), d = u.map((c, f) => c - a[f]), S = p - w, R = i - w;
51
+ return u.map((c, f) => a[f] + R * (S > 0 ? d[f] / S : 1 / u.length));
52
+ }
53
+ function he(t, a, i) {
54
+ if (!t.length) return [];
55
+ const u = Math.max(0, a - G * (t.length - 1)), w = t.map(L);
56
+ if (i?.length === t.length) return ve(i, w, u);
57
+ const p = t.map((c) => je(c.size, u)), d = p.filter((c) => c === void 0).length, S = p.reduce((c, f) => c + (f ?? 0), 0), R = Math.max(0, u - S) / (d || 1);
58
+ return ve(p.map((c) => c ?? R), w, u);
59
+ }
60
+ function pe(t, a, i, u) {
61
+ if (i < 0 || i >= t.length - 1) return [...t];
62
+ const w = Math.max(a[i] - t[i], Math.min(u, t[i + 1] - a[i + 1]));
63
+ return t.map((p, d) => d === i ? p + w : d === i + 1 ? p - w : p);
64
+ }
65
+ const ye = /* @__PURE__ */ Symbol("fu-ui-layout-change");
66
+ function J(t) {
67
+ return Array.isArray(t) ? t.flatMap((a) => Array.isArray(a) ? J(a) : Ve(a) ? a.type === Ke ? J(a.children) : a.type === we ? [a] : [] : []) : [];
68
+ }
69
+ const We = me({
70
+ name: "FuSplitPane",
71
+ props: {
72
+ layout: { type: String, default: "horizontal", validator: (t) => ["horizontal", "vertical"].includes(t) },
73
+ lazy: Boolean
74
+ },
75
+ emits: ["resizeStart", "resize", "resizeEnd"],
76
+ setup(t, { slots: a, emit: i }) {
77
+ const u = Le(ye, void 0), w = de({});
78
+ Ie(ye, w);
79
+ const p = () => {
80
+ w.value = {};
81
+ }, d = x(), S = x(0), R = x(0), c = x(0), f = x(null);
82
+ let O, z = [], v = [], N, Q = [];
83
+ const be = [], ze = [];
84
+ let ee, I, D, r, j, E = !1;
85
+ const te = `fu-ui-tooltip-${De().uid}`, W = x(), V = x(null), K = x(null), k = de(), ne = x({ left: "8px", top: "8px" }), C = (e) => S.value > 0 && e >= 0 && e < v.length - 1 && v[e] + v[e + 1] > L(z[e]) + L(z[e + 1]) + 0.1;
86
+ let T = 0;
87
+ const _ = () => {
88
+ T += 1, k.value = void 0;
89
+ }, Pe = () => {
90
+ if (!k.value || !W.value || !E) return;
91
+ const e = d.value?.ownerDocument.defaultView;
92
+ if (!e) return;
93
+ const n = W.value.getBoundingClientRect(), { x: o, y: s } = k.value, y = t.layout === "vertical", b = y ? o - n.width / 2 : o + 14 + n.width <= e.innerWidth - 8 ? o + 14 : o - n.width - 14, g = y ? s - n.height - 14 >= 8 ? s - n.height - 14 : s + 14 : s - n.height / 2;
94
+ ne.value = {
95
+ left: `${Math.max(8, Math.min(b, e.innerWidth - n.width - 8))}px`,
96
+ top: `${Math.max(8, Math.min(g, e.innerHeight - n.height - 8))}px`
97
+ };
98
+ }, U = (e, n, o, s = v) => {
99
+ if (r || !C(e)) {
100
+ _();
101
+ return;
102
+ }
103
+ const y = t.layout === "vertical" ? "高度" : "宽度";
104
+ let b = n === "hover" ? `拖动调整${y}` : n === "focus" ? `方向键调整${y}` : `${y} ${Math.round(s[e])} px`;
105
+ n === "keyboard" && (s[e] <= L(z[e]) + 0.1 ? b += ` · 已到最小${y}` : s[e + 1] <= L(z[e + 1]) + 0.1 && (b += ` · 相邻区域已到最小${y}`));
106
+ const g = o.getBoundingClientRect(), F = { x: g.left + g.width / 2, y: g.top + g.height / 2 };
107
+ T += 1, k.value = { index: e, kind: n, text: b, ...F }, q(Pe);
108
+ }, B = () => {
109
+ r && P(), _();
110
+ };
111
+ u && Y(u, () => {
112
+ B(), p();
113
+ });
114
+ const oe = (e) => {
115
+ const n = d.value, o = e.target;
116
+ n && (o === I || o === n.ownerDocument || o && "document" in o && o.document === n.ownerDocument || o && "contains" in o && typeof o.contains == "function" && o.contains(n)) && B();
117
+ }, ae = () => t.layout === "horizontal" && d.value && (d.value.ownerDocument.defaultView || window).getComputedStyle(d.value).direction === "rtl" ? -1 : 1, re = (e) => t.layout === "vertical" ? e.clientY : e.clientX, ie = () => {
118
+ const e = d.value;
119
+ if (!e) return;
120
+ const n = (e.ownerDocument.defaultView || window).getComputedStyle(e);
121
+ D = {
122
+ width: Math.max(0, e.clientWidth - parseFloat(n.paddingLeft || "0") - parseFloat(n.paddingRight || "0")),
123
+ height: Math.max(0, e.clientHeight - parseFloat(n.paddingTop || "0") - parseFloat(n.paddingBottom || "0"))
124
+ }, S.value = t.layout === "vertical" ? D.height : D.width;
125
+ }, H = (e) => {
126
+ N = e, v = e, R.value += 1, p(), i("resize", [...e]);
127
+ }, X = () => {
128
+ const e = r;
129
+ r = void 0, e && (e.view.removeEventListener("pointermove", se), e.view.removeEventListener("pointerup", ce), e.view.removeEventListener("pointercancel", P), e.view.removeEventListener("blur", P), e.handle.hasPointerCapture?.(e.pointerId) && e.handle.releasePointerCapture(e.pointerId), j?.(), j = void 0), f.value = null, c.value = 0, _();
130
+ }, le = (e) => r ? pe(r.sizes, z.map(L), r.index, (re(e) - r.start) / r.scale * r.direction) : v;
131
+ function se(e) {
132
+ if (!r || e.pointerId !== r.pointerId) return;
133
+ e.preventDefault();
134
+ const n = r, o = le(e);
135
+ n.lazy ? c.value = o[n.index] - n.sizes[n.index] : H(o);
136
+ }
137
+ function ce(e) {
138
+ if (!r || e.pointerId !== r.pointerId) return;
139
+ const n = r.index, o = le(e);
140
+ X(), H(o), E && i("resizeEnd", n, [...o]);
141
+ }
142
+ function P(e) {
143
+ if (!r || e && "pointerId" in e && e.pointerId !== r.pointerId) return;
144
+ const n = r.index, o = r.sizes, s = r.lazy;
145
+ X(), s || H(o), E && i("resizeEnd", n, [...o]);
146
+ }
147
+ const Se = (e, n) => {
148
+ if (e.button !== 0 || e.isPrimary === !1 || r || S.value <= 0 || !C(n)) return;
149
+ e.preventDefault();
150
+ const o = e.currentTarget;
151
+ o.focus({ preventScroll: !0 });
152
+ const s = o.ownerDocument.defaultView || window, y = o.getBoundingClientRect(), b = (t.layout === "vertical" ? y.height : y.width) / G;
153
+ r = { index: n, start: re(e), sizes: [...v], pointerId: e.pointerId, handle: o, lazy: t.lazy, view: s, scale: b > 0 ? b : 1, direction: ae() }, f.value = n, j = Oe(o.ownerDocument), _(), e.isTrusted && o.setPointerCapture?.(e.pointerId), s.addEventListener("pointermove", se, { passive: !1 }), s.addEventListener("pointerup", ce), s.addEventListener("pointercancel", P), s.addEventListener("blur", P), i("resizeStart", n, [...v]);
154
+ }, Ee = (e, n) => {
155
+ if (r) {
156
+ e.key === "Escape" && (e.preventDefault(), P());
157
+ return;
158
+ }
159
+ if (e.key === "Escape") {
160
+ _();
161
+ return;
162
+ }
163
+ if (!C(n)) return;
164
+ const o = t.layout === "vertical" ? "ArrowUp" : "ArrowLeft", s = t.layout === "vertical" ? "ArrowDown" : "ArrowRight";
165
+ if (![o, s, "Home", "End"].includes(e.key)) return;
166
+ e.preventDefault();
167
+ const y = e.key === "Home" ? -1 / 0 : e.key === "End" ? 1 / 0 : (e.key === o ? -1 : 1) * (e.shiftKey ? 50 : 10) * ae(), b = pe(v, z.map(L), n, y), g = T;
168
+ if (i("resizeStart", n, [...v]), !E || (H(b), !E) || (i("resizeEnd", n, [...b]), !E || r || g !== T)) return;
169
+ const F = e.currentTarget, A = ++T;
170
+ q(() => {
171
+ E && F.isConnected && A === T && U(n, "keyboard", F, b);
172
+ });
173
+ };
174
+ Y(() => t.layout, async () => {
175
+ P(), await q(), ie();
176
+ }), Y(() => t.lazy, () => P());
177
+ const ue = () => {
178
+ E = !0, I = d.value?.ownerDocument.defaultView || window, I.addEventListener("scroll", oe, !0), I.addEventListener("resize", B), I.addEventListener("blur", B), ie(), p(), d.value && O?.observe(d.value);
179
+ }, fe = () => {
180
+ O?.disconnect(), I?.removeEventListener("scroll", oe, !0), I?.removeEventListener("resize", B), I?.removeEventListener("blur", B);
181
+ };
182
+ return Ce(() => {
183
+ O = new ResizeObserver((e) => {
184
+ const n = e[0];
185
+ if (!n || !E) return;
186
+ const o = Math.max(0, t.layout === "vertical" ? n.contentRect.height : n.contentRect.width), s = D && Math.abs(t.layout === "vertical" ? n.contentRect.width - D.width : n.contentRect.height - D.height) >= 0.1;
187
+ if (D = { width: n.contentRect.width, height: n.contentRect.height }, Math.abs(o - S.value) < 0.1) {
188
+ s && (_(), p());
189
+ return;
190
+ }
191
+ r && P(), _(), S.value = o, p();
192
+ }), ue();
193
+ }), Fe(ue), Re(() => {
194
+ P(), _(), E = !1, fe();
195
+ }), Te(() => {
196
+ E = !1, X(), fe();
197
+ }), () => {
198
+ const e = J(a.default?.() || []), n = e.map((m) => ({ size: m.props?.size, min: m.props?.min })), o = e.map((m) => m.key), s = ee === t.layout && z.length === n.length && n.every((m, h) => o[h] === Q[h] && Object.is(m.min, z[h].min)), y = s && n.every((m, h) => Object.is(m.size, z[h].size)), b = !y && s && N && he(n, S.value).every((m, h) => Math.abs(m - v[h]) < 0.1);
199
+ !y && !b && (r && P(), _(), V.value = null, K.value = null, N = void 0, p()), z = n, Q = o, ee = t.layout, R.value, v = he(z, S.value, N);
200
+ const g = t.layout === "vertical", F = v.flatMap((m, h) => h ? [`${G}px`, `${m}px`] : [`${m}px`]).join(" "), A = [];
201
+ return e.forEach((m, h) => {
202
+ if (h) {
203
+ const l = h - 1, _e = L(z[l]), Me = v[l] + v[h] - L(z[h]);
204
+ A.push(M("div", {
205
+ key: be[l] ??= /* @__PURE__ */ Symbol("separator"),
206
+ class: ["fu-ui-bar", { "fu-ui-bar--active": f.value === l, "fu-ui-bar--hovered": V.value === l, "fu-ui-bar--focused": K.value === l, "fu-ui-bar--lazy": t.lazy && f.value === l }],
207
+ role: "separator",
208
+ tabindex: C(l) ? 0 : -1,
209
+ "aria-label": `调整第 ${h} 和第 ${h + 1} 个区域大小`,
210
+ "aria-orientation": g ? "horizontal" : "vertical",
211
+ "aria-valuemin": Math.round(_e),
212
+ "aria-valuemax": Math.round(Me),
213
+ "aria-valuenow": Math.round(v[l]),
214
+ "aria-valuetext": `${Math.round(v[l])}px`,
215
+ "aria-disabled": !C(l),
216
+ "aria-describedby": k.value?.index === l ? te : void 0,
217
+ onPointerenter: ($) => {
218
+ !C(l) || r || (V.value = l, U(l, "hover", $.currentTarget));
219
+ },
220
+ onPointerleave: () => {
221
+ V.value === l && (V.value = null), !r && k.value?.kind === "hover" && _();
222
+ },
223
+ onFocus: ($) => {
224
+ C(l) && (K.value = l, r || U(l, "focus", $.currentTarget));
225
+ },
226
+ onBlur: () => {
227
+ K.value === l && (K.value = null), r?.index === l ? P() : r || _();
228
+ },
229
+ onPointerdown: ($) => Se($, l),
230
+ onLostpointercapture: ($) => {
231
+ r?.index === l && P($);
232
+ },
233
+ onKeydown: ($) => Ee($, l)
234
+ }, [
235
+ t.lazy && f.value === l ? M("span", { class: "fu-ui-bar__origin", "aria-hidden": "true" }) : null,
236
+ M("span", {
237
+ class: "fu-ui-bar__line",
238
+ "aria-hidden": "true",
239
+ style: t.lazy && f.value === l ? { transform: `translate${g ? "Y" : "X"}(${c.value * (r?.direction ?? 1)}px)` } : void 0
240
+ }),
241
+ M("span", {
242
+ class: "fu-ui-bar__grip",
243
+ "aria-hidden": "true",
244
+ style: t.lazy && f.value === l ? { transform: `translate${g ? "Y" : "X"}(${c.value * (r?.direction ?? 1)}px)` } : void 0
245
+ }, [M("i"), M("i"), M("i")])
246
+ ]));
247
+ }
248
+ A.push(Be(m, { key: m.key ?? (ze[h] ??= /* @__PURE__ */ Symbol("panel")) }));
249
+ }), k.value && A.push(M(Ae, { to: d.value?.ownerDocument.body || "body" }, [M("div", {
250
+ ref: W,
251
+ id: te,
252
+ role: "tooltip",
253
+ class: "fu-ui-tooltip",
254
+ "data-kind": k.value.kind,
255
+ "data-axis": g ? "height" : "width",
256
+ style: ne.value
257
+ }, k.value.text)])), M("div", {
258
+ ref: d,
259
+ class: ["fu-ui", `fu-ui--${t.layout}`],
260
+ style: { gridTemplateRows: g ? F : "minmax(0, 1fr)", gridTemplateColumns: g ? "minmax(0, 1fr)" : F }
261
+ }, A);
262
+ };
263
+ }
264
+ }), Ue = /* @__PURE__ */ ge(We, [["__scopeId", "data-v-b0f8c075"]]), Ye = {
265
+ install(t) {
266
+ t.component("FuSplitPane", Ue), t.component("FuSplitPanePanel", we);
267
+ }
268
+ };
269
+ export {
270
+ Ue as FuSplitPane,
271
+ we as FuSplitPanePanel,
272
+ Ye as default
273
+ };
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "fu-vue-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Vue 3 桌面组件库,支持分栏组件独立按需使用",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": "^22.13.0 || >=24.0.0"
8
+ },
9
+ "main": "./dist/index.cjs",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ },
18
+ "./split-pane": {
19
+ "types": "./dist/components/split-pane/index.d.ts",
20
+ "import": "./dist/split-pane.js",
21
+ "require": "./dist/split-pane.cjs"
22
+ },
23
+ "./style.css": "./dist/fu-vue-ui.css",
24
+ "./split-pane/style.css": "./dist/fu-vue-ui.css"
25
+ },
26
+ "files": [
27
+ "dist/index.js",
28
+ "dist/index.cjs",
29
+ "dist/split-pane.js",
30
+ "dist/split-pane.cjs",
31
+ "dist/fu-vue-ui.css",
32
+ "dist/index.d.ts",
33
+ "dist/components/split-pane/index.d.ts",
34
+ "dist/components/split-pane/FuSplitPane.vue.d.ts",
35
+ "dist/components/split-pane/FuSplitPanePanel.vue.d.ts",
36
+ "dist/components/split-pane/sizes.d.ts"
37
+ ],
38
+ "sideEffects": [
39
+ "**/*.css"
40
+ ],
41
+ "peerDependencies": {
42
+ "vue": "^3.5.0"
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/js": "10.0.1",
46
+ "@types/node": "^22.0.0",
47
+ "@vitejs/plugin-vue": "6.0.8",
48
+ "@vue/compiler-sfc": "3.5.12",
49
+ "eslint": "10.8.0",
50
+ "eslint-plugin-vue": "10.10.0",
51
+ "globals": "17.8.0",
52
+ "happy-dom": "^20.10.2",
53
+ "typescript": "5.6.3",
54
+ "typescript-eslint": "8.65.0",
55
+ "vite": "7.3.8",
56
+ "vitest": "3.2.7",
57
+ "vue": "3.5.12",
58
+ "vue-tsc": "^3.2.7"
59
+ },
60
+ "license": "SEE LICENSE IN LICENSE",
61
+ "scripts": {
62
+ "dev": "pnpm build && vite --config vite.demo.config.ts",
63
+ "build": "vite build && vue-tsc -p tsconfig.build.json && sh scripts/add-copyright.sh",
64
+ "build:demo": "pnpm build && vite build --config vite.demo.config.ts",
65
+ "typecheck": "vue-tsc --noEmit -p tsconfig.json",
66
+ "lint": "eslint .",
67
+ "test": "vitest run",
68
+ "docs:dev": "pnpm dev",
69
+ "docs:build": "pnpm build:demo",
70
+ "docs:preview": "vite preview --config vite.demo.config.ts",
71
+ "check:release": "sh scripts/check-release.sh"
72
+ }
6
73
  }