@humanonlyweb/ui 0.2.1 → 0.2.2
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/dist/composables/use-form.js +23 -1
- package/dist/docs/changelog.md +5 -0
- package/dist/docs/forms.md +7 -0
- package/dist/package.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,29 @@ import { useEventListener } from "./internal/use-event-listener.js";
|
|
|
2
2
|
import { isEqual } from "./internal/is-equal.js";
|
|
3
3
|
import { computed, nextTick, reactive, ref, shallowRef, toRaw, watch } from "vue";
|
|
4
4
|
//#region src/composables/use-form.ts
|
|
5
|
-
const
|
|
5
|
+
const isPlainObject = (value) => {
|
|
6
|
+
const proto = Object.getPrototypeOf(value);
|
|
7
|
+
return proto === Object.prototype || proto === null;
|
|
8
|
+
};
|
|
9
|
+
function deepToRaw(value, seen = /* @__PURE__ */ new Map()) {
|
|
10
|
+
const raw = toRaw(value);
|
|
11
|
+
if (typeof raw !== "object" || raw === null) return raw;
|
|
12
|
+
if (seen.has(raw)) return seen.get(raw);
|
|
13
|
+
if (Array.isArray(raw)) {
|
|
14
|
+
const copy = [];
|
|
15
|
+
seen.set(raw, copy);
|
|
16
|
+
for (const item of raw) copy.push(deepToRaw(item, seen));
|
|
17
|
+
return copy;
|
|
18
|
+
}
|
|
19
|
+
if (isPlainObject(raw)) {
|
|
20
|
+
const copy = {};
|
|
21
|
+
seen.set(raw, copy);
|
|
22
|
+
for (const [key, item] of Object.entries(raw)) copy[key] = deepToRaw(item, seen);
|
|
23
|
+
return copy;
|
|
24
|
+
}
|
|
25
|
+
return raw;
|
|
26
|
+
}
|
|
27
|
+
const clone = (values) => structuredClone(deepToRaw(values));
|
|
6
28
|
function pathKey(path) {
|
|
7
29
|
if (!path?.length) return void 0;
|
|
8
30
|
return path.map((segment) => String(typeof segment === "object" ? segment.key : segment)).join(".");
|
package/dist/docs/changelog.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> What changed in each release.
|
|
4
4
|
|
|
5
|
+
## 0.2.2 (2026-11-04)
|
|
6
|
+
|
|
7
|
+
- chore: bump version to 0.2.2 in package.json
|
|
8
|
+
- fix: useForm no longer throws when nested values are rebuilt from the form (#3)
|
|
9
|
+
|
|
5
10
|
## 0.2.1 (2026-11-01)
|
|
6
11
|
|
|
7
12
|
- feat: add Toggle and ToggleGroup components with styling and demos
|
package/dist/docs/forms.md
CHANGED
|
@@ -143,6 +143,13 @@ const { form, errors, submit, processing } = useForm({
|
|
|
143
143
|
/>
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
Add or remove list items by mutating the array, or by assigning a new one built from it:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
form.items = [...form.items, { name: "" }];
|
|
150
|
+
form.items = form.items.filter((_, i) => i !== index);
|
|
151
|
+
```
|
|
152
|
+
|
|
146
153
|
## Options
|
|
147
154
|
|
|
148
155
|
| Option | Description |
|
package/dist/package.js
CHANGED