@texaryn/vue 0.4.1 → 0.4.3
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/CHANGELOG.md +19 -0
- package/README.md +30 -8
- package/dist/widgets/containers.d.ts.map +1 -1
- package/dist/widgets/containers.js +2 -1
- package/dist/widgets/containers.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @texaryn/vue
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eae5f41: Object children are keyed by property name, with `objectChildKey` from
|
|
8
|
+
`@texaryn/core`, so a field keeps its element and its focus when the form grows
|
|
9
|
+
ahead of it, for example when typing into a recursive object exposes the next
|
|
10
|
+
level.
|
|
11
|
+
- Updated dependencies [eae5f41]
|
|
12
|
+
- @texaryn/core@0.13.0
|
|
13
|
+
|
|
14
|
+
## 0.4.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 609ad71: The README quick start creates the adapter in `main.ts` and passes it to `App`
|
|
19
|
+
as a prop, so the example renders as the root component without a `<Suspense>`
|
|
20
|
+
boundary. No code changes.
|
|
21
|
+
|
|
3
22
|
## 0.4.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -15,20 +15,42 @@ pnpm add @texaryn/core @texaryn/schema-json @texaryn/vue vue
|
|
|
15
15
|
|
|
16
16
|
## Quick start
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
`main.ts` creates the adapter before mounting and passes it to `App` as a prop,
|
|
19
|
+
because awaiting `createJsonSchemaAdapter` inside `<script setup>` would make
|
|
20
|
+
`App` an async component, which renders nothing as the root without a
|
|
21
|
+
`<Suspense>` boundary.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// schema.ts
|
|
25
|
+
export const schema = {
|
|
24
26
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
25
27
|
type: 'object',
|
|
26
28
|
properties: { name: { type: 'string', title: 'Name' } },
|
|
27
29
|
required: ['name'],
|
|
28
30
|
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// main.ts
|
|
35
|
+
import { createApp } from 'vue'
|
|
36
|
+
import { createJsonSchemaAdapter } from '@texaryn/schema-json'
|
|
37
|
+
import App from './App.vue'
|
|
38
|
+
import { schema } from './schema'
|
|
39
|
+
|
|
40
|
+
const adapter = await createJsonSchemaAdapter(schema)
|
|
41
|
+
|
|
42
|
+
createApp(App, { adapter }).mount('#app')
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<!-- App.vue -->
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import type { SchemaEvaluationPort } from '@texaryn/core'
|
|
49
|
+
import { ErrorSummary, FormRoot, createDefaultRegistry, provideFormRuntime, useForm } from '@texaryn/vue'
|
|
50
|
+
|
|
51
|
+
const props = defineProps<{ adapter: SchemaEvaluationPort }>()
|
|
29
52
|
|
|
30
|
-
const
|
|
31
|
-
const form = useForm(port, { initialData: { name: '' } })
|
|
53
|
+
const form = useForm(props.adapter, { initialData: { name: '' } })
|
|
32
54
|
provideFormRuntime(form.runtime)
|
|
33
55
|
|
|
34
56
|
const registry = createDefaultRegistry()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containers.d.ts","sourceRoot":"","sources":["../../src/widgets/containers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"containers.d.ts","sourceRoot":"","sources":["../../src/widgets/containers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAA;AAQ1D,eAAO,MAAM,YAAY;;uBAFkB,QAAQ,CAAC,MAAM,CAAC;;;;;;;uBAAhB,QAAQ,CAAC,MAAM,CAAC;;;iGAyCzD,CAAA;AAEF,eAAO,MAAM,YAAY;;uBA3CkB,QAAQ,CAAC,MAAM,CAAC;;;;;;;uBAAhB,QAAQ,CAAC,MAAM,CAAC;;;iGA0HzD,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, defineComponent, h } from 'vue';
|
|
2
|
+
import { objectChildKey } from '@texaryn/core';
|
|
2
3
|
import { useFormMessages, useFormRuntime } from '../context.js';
|
|
3
4
|
import { useStore } from '../use-store.js';
|
|
4
5
|
import { useFieldArray } from '../use-field-array.js';
|
|
@@ -22,7 +23,7 @@ export const ObjectLayout = defineComponent({
|
|
|
22
23
|
.map((id) => document.value.nodes[id])
|
|
23
24
|
.filter((child) => child != null));
|
|
24
25
|
return () => {
|
|
25
|
-
const rendered = children.value.map((child) => h(NodeRenderer, { key: child
|
|
26
|
+
const rendered = children.value.map((child) => h(NodeRenderer, { key: objectChildKey(child), node: child }));
|
|
26
27
|
if (!nested)
|
|
27
28
|
return h('div', rendered);
|
|
28
29
|
// The root object is the form itself, so only a nested titled object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../src/widgets/containers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../src/widgets/containers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE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,EACR,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,EAChF,GAAG,CAAC,KAAK,CACV,CAAA;gBACH,CAAC,CAAC,EAAE;gBACN,CAAC,CAAC,IAAI;SACT,CAAC,CAAA;IACN,CAAC;CACF,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texaryn/vue",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Vue 3 bindings, composables, and default widgets for Texaryn",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"CHANGELOG.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@texaryn/core": "^0.
|
|
47
|
+
"@texaryn/core": "^0.13.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"vue": ">=3.5.0"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"jsdom": "^25.0.0",
|
|
56
56
|
"vue": "^3.5.0",
|
|
57
57
|
"@texaryn/examples": "0.0.0",
|
|
58
|
-
"@texaryn/schema-json": "0.
|
|
58
|
+
"@texaryn/schema-json": "0.7.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsc --build"
|