vue-formless 0.1.0 → 0.1.1

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Xu Yiming
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,86 @@
1
+ # vue-formless
2
+
3
+ English | [简体中文](./README.md)
4
+
5
+ > Vue 3 form library: a page-level control table plus FormView, with layout kept off the inputs. **0.1.1** — APIs may still change in 0.x.
6
+
7
+ Same mixed layout: Element Row/Col/Item on the left, `<User.*>` plus nested `FormView` density on the right.
8
+
9
+ ![Mixed layout code](./docs/mixed-layout-code.png)
10
+
11
+ Playground side by side (layout match):
12
+
13
+ ![Mixed layout preview](./docs/mixed-layout-preview.png)
14
+
15
+ ```bash
16
+ pnpm add vue-formless
17
+ # or npm i vue-formless
18
+ ```
19
+
20
+ Peer: `vue` ^3.3.
21
+
22
+ ## Usage
23
+
24
+ Bind host Form / Item / Row / Col once in the project (no official Element adapter):
25
+
26
+ ```ts
27
+ import { ElCol, ElForm, ElFormItem, ElInput, ElRow } from 'element-plus'
28
+ import { createFormControls, createFormView, resolveFormItemProp, type ItemFl } from 'vue-formless'
29
+
30
+ declare module 'vue-formless' {
31
+ interface ControlSchema {
32
+ label?: string
33
+ }
34
+ }
35
+
36
+ export const FormView = createFormView({
37
+ layout: { Row: ElRow, Col: ElCol, column: 2, gutter: 16 },
38
+ form: {
39
+ component: ElForm,
40
+ props: (fl) => ({ model: fl.modelValue }),
41
+ },
42
+ item: {
43
+ component: ElFormItem,
44
+ props: (fl: ItemFl) => ({
45
+ label: fl.label,
46
+ prop: resolveFormItemProp(fl.binding, fl.controlKey),
47
+ }),
48
+ },
49
+ })
50
+
51
+ export const User = createFormControls({
52
+ name: { label: 'Name', component: ElInput },
53
+ })
54
+ ```
55
+
56
+ ```vue
57
+ <FormView ref="formRef" v-model="form" fl:layout label-width="96px">
58
+ <User.Name />
59
+ <User.Name col:span="max" />
60
+ </FormView>
61
+ ```
62
+
63
+ `validate()` / `resetFields()` go through the FormView ref (proxied host Form). Layout details: [docs/adr](./docs/adr/README.md).
64
+
65
+ ## Layout
66
+
67
+ ```text
68
+ packages/vue-formless # kernel (npm: vue-formless)
69
+ packages/layout # internal grid, bundled into the kernel
70
+ playground # Element Plus baseline vs Formless
71
+ docs/adr # architecture decisions
72
+ ```
73
+
74
+ ## Development
75
+
76
+ ```bash
77
+ pnpm i
78
+ pnpm dev # playground
79
+ pnpm build # library
80
+ pnpm test
81
+ pnpm typecheck
82
+ ```
83
+
84
+ ## License
85
+
86
+ [MIT](./LICENSE)
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # vue-formless
2
+
3
+ 简体中文 | [English](./README.en.md)
4
+
5
+ > Vue 3 表单组合式库:控件表 + FormView,布局与输入拆开。当前 **0.1.1**,`0.x` 期间 API 仍可能调整。
6
+
7
+ 同一套混合布局:左边手写 Element Row/Col/Item,右边 `<User.*>` + 嵌套 `FormView` 换密度。
8
+
9
+ ![混合布局代码对照](./docs/mixed-layout-code.png)
10
+
11
+ Playground 平铺对比(布局对齐):
12
+
13
+ ![混合布局平铺对比](./docs/mixed-layout-preview.png)
14
+
15
+ ```bash
16
+ pnpm add vue-formless
17
+ # 或 npm i vue-formless
18
+ ```
19
+
20
+ peer:`vue` ^3.3。
21
+
22
+ ## 用法
23
+
24
+ 项目里绑一次宿主(无官方 Element 适配包):
25
+
26
+ ```ts
27
+ import { ElCol, ElForm, ElFormItem, ElInput, ElRow } from 'element-plus'
28
+ import { createFormControls, createFormView, resolveFormItemProp, type ItemFl } from 'vue-formless'
29
+
30
+ declare module 'vue-formless' {
31
+ interface ControlSchema {
32
+ label?: string
33
+ }
34
+ }
35
+
36
+ export const FormView = createFormView({
37
+ layout: { Row: ElRow, Col: ElCol, column: 2, gutter: 16 },
38
+ form: {
39
+ component: ElForm,
40
+ props: (fl) => ({ model: fl.modelValue }),
41
+ },
42
+ item: {
43
+ component: ElFormItem,
44
+ props: (fl: ItemFl) => ({
45
+ label: fl.label,
46
+ prop: resolveFormItemProp(fl.binding, fl.controlKey),
47
+ }),
48
+ },
49
+ })
50
+
51
+ export const User = createFormControls({
52
+ name: { label: '姓名', component: ElInput },
53
+ })
54
+ ```
55
+
56
+ ```vue
57
+ <FormView ref="formRef" v-model="form" fl:layout label-width="96px">
58
+ <User.Name />
59
+ <User.Name col:span="max" />
60
+ </FormView>
61
+ ```
62
+
63
+ `validate()` / `resetFields()` 走 FormView 的 ref(代理内层 Form)。栅格细节见 [docs/adr](./docs/adr/README.md)。
64
+
65
+ ## 仓库结构
66
+
67
+ ```text
68
+ packages/vue-formless # 内核(npm:vue-formless)
69
+ packages/layout # 内部栅格,打进内核 dist
70
+ playground # Element Plus 基线 vs Formless
71
+ docs/adr # 架构决策
72
+ ```
73
+
74
+ ## 开发
75
+
76
+ ```bash
77
+ pnpm i
78
+ pnpm dev # 启动 playground
79
+ pnpm build # 构建库
80
+ pnpm test
81
+ pnpm typecheck
82
+ ```
83
+
84
+ Playground 对照:基础表单、筛选条、只读详情、混合布局、DateRange。
85
+
86
+ ```bash
87
+ pnpm playground
88
+ # http://localhost:5173
89
+ ```
90
+
91
+ ## License
92
+
93
+ [MIT](./LICENSE)
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-formless",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Vue 3 表单组合式 hooks",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -15,16 +15,12 @@
15
15
  }
16
16
  },
17
17
  "files": [
18
- "dist"
18
+ "dist",
19
+ "docs",
20
+ "README.md",
21
+ "README.en.md",
22
+ "LICENSE"
19
23
  ],
20
- "scripts": {
21
- "build": "pnpm --filter @vue-formless/layout build && vite build",
22
- "dev": "vite build --watch",
23
- "test": "vitest run",
24
- "test:watch": "vitest",
25
- "typecheck": "tsc --noEmit",
26
- "prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
27
- },
28
24
  "repository": {
29
25
  "type": "git",
30
26
  "url": "git+https://github.com/xuyimingwork/vue-formless.git"
@@ -48,14 +44,5 @@
48
44
  },
49
45
  "peerDependencies": {
50
46
  "vue": "^3.3.0"
51
- },
52
- "devDependencies": {
53
- "@vue-formless/layout": "workspace:*",
54
- "@vitejs/plugin-vue-jsx": "^5.1.6",
55
- "typescript": "^5.8.3",
56
- "vite": "^6.3.5",
57
- "vite-plugin-dts": "^4.5.4",
58
- "vitest": "^3.2.4",
59
- "vue": "^3.5.16"
60
47
  }
61
48
  }