@texaryn/vue 0.4.1 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @texaryn/vue
2
2
 
3
+ ## 0.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 609ad71: The README quick start creates the adapter in `main.ts` and passes it to `App`
8
+ as a prop, so the example renders as the root component without a `<Suspense>`
9
+ boundary. No code changes.
10
+
3
11
  ## 0.4.1
4
12
 
5
13
  ### 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
- ```vue
19
- <script setup lang="ts">
20
- import { createJsonSchemaAdapter } from '@texaryn/schema-json'
21
- import { ErrorSummary, FormRoot, useForm, provideFormRuntime, createDefaultRegistry } from '@texaryn/vue'
22
-
23
- const schema = {
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 port = await createJsonSchemaAdapter(schema)
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()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@texaryn/vue",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Vue 3 bindings, composables, and default widgets for Texaryn",
5
5
  "keywords": [
6
6
  "vue",
@@ -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.6.2"
58
+ "@texaryn/schema-json": "0.6.3"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsc --build"