@koumoul/vjsf 3.0.0-alpha.0 → 3.0.0-alpha.10

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.
Files changed (129) hide show
  1. package/package.json +37 -10
  2. package/src/compat/v2.js +45 -10
  3. package/src/compile/index.js +42 -9
  4. package/src/compile/options.js +19 -0
  5. package/src/compile/v-jsf-compiled.vue.ejs +35 -57
  6. package/src/components/fragments/help-message.vue +49 -0
  7. package/src/components/fragments/node-slot.vue +3 -3
  8. package/src/components/fragments/section-header.vue +6 -2
  9. package/src/components/fragments/select-item-icon.vue +28 -0
  10. package/src/components/fragments/select-item.vue +43 -0
  11. package/src/components/fragments/select-selection.vue +35 -0
  12. package/src/components/fragments/text-field-menu.vue +4 -4
  13. package/src/components/node.vue +35 -9
  14. package/src/components/nodes/autocomplete.vue +88 -0
  15. package/src/components/nodes/checkbox.vue +3 -3
  16. package/src/components/nodes/color-picker.vue +3 -3
  17. package/src/components/nodes/combobox.vue +72 -0
  18. package/src/components/nodes/date-picker.vue +5 -6
  19. package/src/components/nodes/date-time-picker.vue +2 -2
  20. package/src/components/nodes/expansion-panels.vue +4 -4
  21. package/src/components/nodes/file-input.vue +43 -0
  22. package/src/components/nodes/list.vue +177 -91
  23. package/src/components/nodes/number-combobox.vue +72 -0
  24. package/src/components/nodes/number-field.vue +4 -6
  25. package/src/components/nodes/one-of-select.vue +4 -4
  26. package/src/components/nodes/section.vue +4 -3
  27. package/src/components/nodes/select.vue +72 -53
  28. package/src/components/nodes/slider.vue +3 -3
  29. package/src/components/nodes/stepper.vue +96 -0
  30. package/src/components/nodes/switch.vue +3 -3
  31. package/src/components/nodes/tabs.vue +4 -4
  32. package/src/components/nodes/text-field.vue +10 -5
  33. package/src/components/nodes/textarea.vue +26 -6
  34. package/src/components/nodes/vertical-tabs.vue +4 -4
  35. package/src/components/options.js +27 -2
  36. package/src/components/tree.vue +4 -3
  37. package/src/components/vjsf.vue +41 -103
  38. package/src/composables/use-dnd.js +69 -0
  39. package/src/composables/use-vjsf.js +122 -0
  40. package/src/index.js +3 -1
  41. package/src/styles/vjsf.css +14 -0
  42. package/src/{components/types.ts → types.ts} +26 -1
  43. package/src/utils/arrays.js +15 -0
  44. package/src/utils/build.js +1 -0
  45. package/src/utils/global-register.js +13 -0
  46. package/src/utils/index.js +5 -0
  47. package/src/utils/props.js +29 -10
  48. package/src/utils/slots.js +2 -3
  49. package/types/compat/v2.d.ts.map +1 -1
  50. package/types/compile/index.d.ts +3 -2
  51. package/types/compile/index.d.ts.map +1 -1
  52. package/types/compile/options.d.ts +4 -0
  53. package/types/compile/options.d.ts.map +1 -0
  54. package/types/components/fragments/help-message.vue.d.ts +8 -0
  55. package/types/components/fragments/help-message.vue.d.ts.map +1 -0
  56. package/types/components/fragments/node-slot.vue.d.ts +9 -9
  57. package/types/components/fragments/node-slot.vue.d.ts.map +1 -1
  58. package/types/components/fragments/section-header.vue.d.ts +3 -3
  59. package/types/components/fragments/select-item-icon.vue.d.ts +15 -0
  60. package/types/components/fragments/select-item-icon.vue.d.ts.map +1 -0
  61. package/types/components/fragments/select-item.vue.d.ts +12 -0
  62. package/types/components/fragments/select-item.vue.d.ts.map +1 -0
  63. package/types/components/fragments/select-selection.vue.d.ts +12 -0
  64. package/types/components/fragments/select-selection.vue.d.ts.map +1 -0
  65. package/types/components/fragments/text-field-menu.vue.d.ts +5 -5
  66. package/types/components/fragments/text-field-menu.vue.d.ts.map +1 -1
  67. package/types/components/global-register.d.ts +8 -0
  68. package/types/components/global-register.d.ts.map +1 -0
  69. package/types/components/node.vue.d.ts +5 -5
  70. package/types/components/nodes/autocomplete.vue.d.ts +27 -0
  71. package/types/components/nodes/autocomplete.vue.d.ts.map +1 -0
  72. package/types/components/nodes/checkbox.vue.d.ts +5 -5
  73. package/types/components/nodes/color-picker.vue.d.ts +5 -5
  74. package/types/components/nodes/combobox.vue.d.ts +27 -0
  75. package/types/components/nodes/combobox.vue.d.ts.map +1 -0
  76. package/types/components/nodes/date-picker.vue.d.ts +5 -5
  77. package/types/components/nodes/date-time-picker.vue.d.ts +5 -5
  78. package/types/components/nodes/expansion-panels.vue.d.ts +5 -5
  79. package/types/components/nodes/file-input.vue.d.ts +27 -0
  80. package/types/components/nodes/file-input.vue.d.ts.map +1 -0
  81. package/types/components/nodes/list.vue.d.ts +5 -5
  82. package/types/components/nodes/markdown.vue.d.ts +27 -0
  83. package/types/components/nodes/markdown.vue.d.ts.map +1 -0
  84. package/types/components/nodes/number-combobox.vue.d.ts +27 -0
  85. package/types/components/nodes/number-combobox.vue.d.ts.map +1 -0
  86. package/types/components/nodes/number-field.vue.d.ts +9 -9
  87. package/types/components/nodes/number-field.vue.d.ts.map +1 -1
  88. package/types/components/nodes/one-of-select.vue.d.ts +5 -5
  89. package/types/components/nodes/section.vue.d.ts +5 -5
  90. package/types/components/nodes/select.vue.d.ts +25 -8
  91. package/types/components/nodes/select.vue.d.ts.map +1 -1
  92. package/types/components/nodes/slider.vue.d.ts +5 -5
  93. package/types/components/nodes/stepper.vue.d.ts +10 -0
  94. package/types/components/nodes/stepper.vue.d.ts.map +1 -0
  95. package/types/components/nodes/switch.vue.d.ts +5 -5
  96. package/types/components/nodes/tabs.vue.d.ts +5 -5
  97. package/types/components/nodes/text-field.vue.d.ts +9 -9
  98. package/types/components/nodes/text-field.vue.d.ts.map +1 -1
  99. package/types/components/nodes/textarea.vue.d.ts +9 -9
  100. package/types/components/nodes/textarea.vue.d.ts.map +1 -1
  101. package/types/components/nodes/time-picker.vue.d.ts +1 -1
  102. package/types/components/nodes/vertical-tabs.vue.d.ts +5 -5
  103. package/types/components/options.d.ts +3 -2
  104. package/types/components/options.d.ts.map +1 -1
  105. package/types/components/tree.vue.d.ts +3 -3
  106. package/types/components/types.d.ts +22 -2
  107. package/types/components/types.d.ts.map +1 -1
  108. package/types/components/vjsf.vue.d.ts +8 -6
  109. package/types/composables/use-dnd.d.ts +25 -0
  110. package/types/composables/use-dnd.d.ts.map +1 -0
  111. package/types/composables/use-vjsf.d.ts +16 -0
  112. package/types/composables/use-vjsf.d.ts.map +1 -0
  113. package/types/index.d.ts +3 -1
  114. package/types/index.d.ts.map +1 -1
  115. package/types/types.d.ts +96 -0
  116. package/types/types.d.ts.map +1 -0
  117. package/types/utils/arrays.d.ts +9 -0
  118. package/types/utils/arrays.d.ts.map +1 -0
  119. package/types/utils/build.d.ts +2 -0
  120. package/types/utils/build.d.ts.map +1 -0
  121. package/types/utils/global-register.d.ts +8 -0
  122. package/types/utils/global-register.d.ts.map +1 -0
  123. package/types/utils/index.d.ts +6 -0
  124. package/types/utils/index.d.ts.map +1 -0
  125. package/types/utils/props.d.ts +8 -5
  126. package/types/utils/props.d.ts.map +1 -1
  127. package/types/utils/slots.d.ts +3 -3
  128. package/types/utils/slots.d.ts.map +1 -1
  129. package/src/utils/clone.js +0 -3
@@ -0,0 +1,122 @@
1
+ import { StatefulLayout } from '@json-layout/core'
2
+ import { inject, toRaw, shallowRef, computed, ref, watch, useSlots } from 'vue'
3
+ import { useElementSize } from '@vueuse/core'
4
+ import { getFullOptions } from '../components/options.js'
5
+ import { registeredNodeComponents } from '../utils/index.js'
6
+
7
+ export const emits = {
8
+ /**
9
+ * @arg {any} data
10
+ */
11
+ 'update:modelValue': (data) => true,
12
+ /**
13
+ * @arg {import('../types.js').VjsfStatefulLayout} state
14
+ */
15
+ 'update:state': (state) => true
16
+ }
17
+
18
+ /**
19
+ * @param {import('vue').Ref<Object>} schema
20
+ * @param {import('vue').Ref<any>} modelValue
21
+ * @param {import('vue').Ref<import("../types.js").PartialVjsfOptions | null>} options
22
+ * @param {Record<string, import('vue').Component>} nodeComponents
23
+ * @param {any} emit
24
+ * @param {typeof import('@json-layout/core').compile} [compile]
25
+ * @param {import('vue').Ref<import('@json-layout/core').CompiledLayout>} [precompiledLayout]
26
+ */
27
+ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compile, precompiledLayout) => {
28
+ const el = ref(null)
29
+ const { width } = useElementSize(el)
30
+
31
+ /** @type import('vue').ShallowRef<import('../types.js').VjsfStatefulLayout | null> */
32
+ const statefulLayout = shallowRef(null)
33
+ /** @type import('vue').ShallowRef<import('@json-layout/core').StateTree | null> */
34
+ const stateTree = shallowRef(null)
35
+
36
+ // cf https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/form.ts
37
+ const form = inject(Symbol.for('vuetify:form'))
38
+ if (form) {
39
+ form.register({
40
+ id: 'vjsf', // TODO: a unique random id ?
41
+ validate: () => {
42
+ statefulLayout.value?.validate()
43
+ return statefulLayout.value?.errors
44
+ },
45
+ reset: () => statefulLayout.value?.resetValidation(), // TODO: also empty the data ?
46
+ resetValidation: () => statefulLayout.value?.resetValidation()
47
+ })
48
+ }
49
+
50
+ const slots = useSlots()
51
+
52
+ const fullOptions = computed(() => getFullOptions(options.value, form, width.value, slots, { ...nodeComponents, ...toRaw(registeredNodeComponents.value) }))
53
+
54
+ const compiledLayout = computed(() => {
55
+ if (precompiledLayout?.value) return precompiledLayout?.value
56
+ if (!compile) throw new Error('compile function is not available')
57
+ const compiledLayout = compile(schema.value, fullOptions.value)
58
+ return compiledLayout
59
+ })
60
+
61
+ const onStatefulLayoutUpdate = () => {
62
+ if (!statefulLayout.value) return
63
+ stateTree.value = statefulLayout.value.stateTree
64
+ emit('update:modelValue', statefulLayout.value.data)
65
+ emit('update:state', statefulLayout.value)
66
+ if (form) {
67
+ // cf https://vuetifyjs.com/en/components/forms/#validation-state
68
+ if (statefulLayout.value.valid) form.update('vjsf', true, [])
69
+ else if (statefulLayout.value.hasHiddenError) form.update('vjsf', null, [])
70
+ else form.update('vjsf', false, [])
71
+ }
72
+ }
73
+
74
+ const initStatefulLayout = () => {
75
+ if (!width.value) return
76
+ // @ts-ignore
77
+ const _statefulLayout = /** @type {import('../types.js').VjsfStatefulLayout} */(new StatefulLayout(
78
+ toRaw(compiledLayout.value),
79
+ toRaw(compiledLayout.value.skeletonTree),
80
+ toRaw(fullOptions.value),
81
+ toRaw(modelValue.value)
82
+ ))
83
+ statefulLayout.value = _statefulLayout
84
+ onStatefulLayoutUpdate()
85
+ _statefulLayout.events.on('update', () => {
86
+ onStatefulLayoutUpdate()
87
+ })
88
+ emit('update:state', _statefulLayout)
89
+ _statefulLayout.events.on('autofocus', () => {
90
+ if (!el.value) return
91
+ // @ts-ignore
92
+ const autofocusNodeElement = el.value.querySelector('.vjsf-input--autofocus')
93
+ if (autofocusNodeElement) {
94
+ const autofocusInputElement = autofocusNodeElement.querySelector('input') ?? autofocusNodeElement.querySelector('textarea:not([style*="display: none"]')
95
+ if (autofocusInputElement) autofocusInputElement.focus()
96
+ }
97
+ })
98
+ }
99
+
100
+ watch(fullOptions, (newOptions) => {
101
+ // in case of runtime compilation the watch on compiledLayout will be triggered
102
+ if (!precompiledLayout?.value) return
103
+
104
+ if (statefulLayout.value) {
105
+ statefulLayout.value.options = newOptions
106
+ } else {
107
+ initStatefulLayout()
108
+ }
109
+ })
110
+
111
+ // case where data is updated from outside
112
+ watch(modelValue, (newData) => {
113
+ if (statefulLayout.value && statefulLayout.value.data !== newData) statefulLayout.value.data = toRaw(newData)
114
+ })
115
+
116
+ // case where schema is updated from outside
117
+ watch(compiledLayout, (newCompiledLayout) => {
118
+ initStatefulLayout()
119
+ })
120
+
121
+ return { el, statefulLayout, stateTree }
122
+ }
package/src/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  import Vjsf from './components/vjsf.vue'
2
- export { Vjsf }
2
+ import { defaultOptions } from './components/options.js'
3
+ export { Vjsf, defaultOptions }
4
+ export default Vjsf
@@ -0,0 +1,14 @@
1
+ .vjsf {
2
+ overflow: hidden;
3
+ }
4
+
5
+ /* override vuetify styles to manage readOnly fields more usable than the default disabled fields */
6
+ .vjsf-input--readonly.v-input--disabled.v-text-field .v-field--disabled input {
7
+ pointer-events: auto;
8
+ }
9
+ .vjsf-input--readonly.v-input--disabled .v-field--disabled,
10
+ .vjsf-input--readonly.v-input--disabled .v-input__details,
11
+ .vjsf-input--readonly.v-input--disabled .v-input__append,
12
+ .vjsf-input--readonly.v-input--disabled .v-input__prepend {
13
+ opacity: inherit;
14
+ }
@@ -1,4 +1,7 @@
1
+ import { Component } from 'vue'
2
+
1
3
  import {
4
+ StatefulLayout,
2
5
  StatefulLayoutOptions,
3
6
  StateNode,
4
7
  CheckboxNode,
@@ -17,17 +20,22 @@ import {
17
20
  TextFieldNode,
18
21
  TextareaNode,
19
22
  VerticalTabsNode,
23
+ StepperNode,
24
+ ComboboxNode,
25
+ MarkdownNode,
26
+ FileInputNode,
20
27
  CompileOptions
21
28
  } from '@json-layout/core'
22
29
 
23
30
  export type Density = 'default' | 'comfortable' | 'compact'
24
31
 
25
- export type VjsfOptions = StatefulLayoutOptions & CompileOptions & {
32
+ export type VjsfStatefulLayoutOptions = StatefulLayoutOptions & {
26
33
  density: Density,
27
34
  fieldProps: Record<string, unknown>,
28
35
  fieldPropsCompact: Record<string, unknown>,
29
36
  fieldPropsComfortable: Record<string, unknown>,
30
37
  fieldPropsReadOnly: Record<string, unknown>,
38
+ fieldPropsSummary: Record<string, unknown>,
31
39
  textfieldProps: Record<string, unknown>,
32
40
  textfieldPropsReadOnly: Record<string, unknown>,
33
41
  textareaProps: Record<string, unknown>,
@@ -38,8 +46,21 @@ export type VjsfOptions = StatefulLayoutOptions & CompileOptions & {
38
46
  switchPropsReadOnly: Record<string, unknown>,
39
47
  errorAlertProps: Record<string, unknown>,
40
48
  vjsfSlots: Record<string, () => unknown>,
49
+ easyMDEOptions: Record<string, unknown>,
50
+ nodeComponents: Record<string, Component>,
51
+ }
52
+
53
+ export type VjsfCompileOptions = CompileOptions & {
54
+ nodeComponentImports: Record<string, string>
41
55
  }
42
56
 
57
+ export type VjsfOptions = VjsfCompileOptions & VjsfStatefulLayoutOptions
58
+
59
+ export type VjsfStatefulLayout = Omit<StatefulLayout, 'options'> & {options: VjsfStatefulLayoutOptions}
60
+
61
+ export type PartialVjsfCompileOptions = Partial<Omit<VjsfCompileOptions, 'width'>>
62
+ export type PartialVjsfOptions = Partial<Omit<VjsfOptions, 'width'>>
63
+
43
64
  export type VjsfNode = Omit<StateNode, 'options'> & {options: VjsfOptions}
44
65
  export type VjsfTabsNode = Omit<TabsNode, 'options'> & {options: VjsfOptions}
45
66
  export type VjsfCheckboxNode = Omit<CheckboxNode, 'options'> & {options: VjsfOptions}
@@ -56,4 +77,8 @@ export type VjsfSliderNode = Omit<SliderNode, 'options'> & {options: VjsfOptions
56
77
  export type VjsfSwitchNode = Omit<SwitchNode, 'options'> & {options: VjsfOptions}
57
78
  export type VjsfTextFieldNode = Omit<TextFieldNode, 'options'> & {options: VjsfOptions}
58
79
  export type VjsfTextareaNode = Omit<TextareaNode, 'options'> & {options: VjsfOptions}
80
+ export type VjsfMarkdownNode = Omit<MarkdownNode, 'options'> & {options: VjsfOptions}
59
81
  export type VjsfVerticalTabsNode = Omit<VerticalTabsNode, 'options'> & {options: VjsfOptions}
82
+ export type VjsfStepperNode = Omit<StepperNode, 'options'> & {options: VjsfOptions}
83
+ export type VjsfComboboxNode = Omit<ComboboxNode, 'options'> & {options: VjsfOptions}
84
+ export type VjsfFileInputNode = Omit<FileInputNode, 'options'> & {options: VjsfOptions}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @template T
3
+ * @param {T[]} array
4
+ * @param {number} fromIndex
5
+ * @param {number} toIndex
6
+ * @return {T[]}
7
+ */
8
+ export function moveArrayItem (array, fromIndex, toIndex) {
9
+ if (fromIndex === toIndex || fromIndex === -1 || toIndex === -1) return array
10
+ const newArray = [...array]
11
+ const element = newArray[fromIndex]
12
+ newArray.splice(fromIndex, 1)
13
+ newArray.splice(toIndex, 0, element)
14
+ return newArray
15
+ }
@@ -0,0 +1 @@
1
+ export { commonjsDeps } from '@json-layout/core/utils/build'
@@ -0,0 +1,13 @@
1
+ import { ref } from 'vue'
2
+
3
+ /** @type {import('vue').Ref<Record<string, import('vue').Component>>} */
4
+ export const registeredNodeComponents = ref({})
5
+
6
+ /**
7
+ * @param {string} name
8
+ * @param {import('vue').Component} component
9
+ */
10
+ export function registerNodeComponent (name, component) {
11
+ console.log('vjsf - register plugin node component', name)
12
+ registeredNodeComponents.value[name] = component
13
+ }
@@ -0,0 +1,5 @@
1
+ export * from './arrays.js'
2
+ export * from './dates.js'
3
+ export * from './props.js'
4
+ export * from './slots.js'
5
+ export * from './global-register.js'
@@ -3,15 +3,23 @@ import { camelize } from 'vue'
3
3
 
4
4
  /**
5
5
  * @param {(Record<string, any> | undefined)[]} propsLevels
6
- * @returns Record<string, any>
6
+ * @returns {Record<string, any> & {class: string[]}}
7
7
  */
8
8
  export function mergePropsLevels (propsLevels) {
9
- /** @type Record<string, any> */
10
- const fullProps = {}
9
+ /** @type {Record<string, any> & {class: string[]}} */
10
+ const fullProps = { class: [] }
11
11
  for (const propsLevel of propsLevels) {
12
12
  if (propsLevel) {
13
13
  for (const key of Object.keys(propsLevel)) {
14
- fullProps[camelize(key)] = propsLevel[key]
14
+ if (key === 'class') {
15
+ // a small convention for merging/overwriting classes:
16
+ // a class defined as a simple string overwrites the previous ones
17
+ // a class defined as an array is merged with the previous ones
18
+ if (Array.isArray(propsLevel.class)) fullProps.class = fullProps.class.concat(propsLevel.class)
19
+ else fullProps.class = [propsLevel.class]
20
+ } else {
21
+ fullProps[camelize(key)] = propsLevel[key]
22
+ }
15
23
  }
16
24
  }
17
25
  }
@@ -21,13 +29,14 @@ export function mergePropsLevels (propsLevels) {
21
29
  // calculate the props of a field/input type component (text fields, etc)
22
30
  // isMainComp is used to determine if this input component is also the main rendered component or if is mostly a wrapper (date picker, etc.)
23
31
  /**
24
- * @param {import('@json-layout/core').StateNode} node
25
- * @param {import('@json-layout/core').StatefulLayout} statefulLayout
32
+ * @param {import('../types.js').VjsfNode} node
33
+ * @param {import('../types.js').VjsfStatefulLayout} statefulLayout
34
+ * @param {(string | [string, string])[]} [layoutPropsMap]
26
35
  * @param {boolean} isMainComp
27
36
  * @returns {Record<string, any>}
28
37
  */
29
- export function getInputProps (node, statefulLayout, isMainComp = true) {
30
- const options = /** @type import('../components/types.js').VjsfOptions */(node.options)
38
+ export function getInputProps (node, statefulLayout, layoutPropsMap, isMainComp = true) {
39
+ const options = node.options
31
40
  /** @type {(Record<string, any> | undefined)[]} */
32
41
  const propsLevels = [options.fieldProps]
33
42
  if (options.density === 'comfortable') propsLevels.push(options.fieldPropsComfortable)
@@ -48,7 +57,17 @@ export function getInputProps (node, statefulLayout, isMainComp = true) {
48
57
  fullProps.modelValue = node.data
49
58
  if (node.options.readOnly) {
50
59
  fullProps.disabled = true
51
- fullProps.class = 'vjsf-input--readonly'
60
+ fullProps.class.push('vjsf-input--readonly')
61
+ }
62
+ if (node.autofocus) {
63
+ fullProps.class.push('vjsf-input--autofocus')
64
+ }
65
+
66
+ if (layoutPropsMap) {
67
+ for (const propMap of layoutPropsMap) {
68
+ if (typeof propMap === 'string') fullProps[propMap] = node.layout[propMap]
69
+ else fullProps[propMap[0]] = node.layout[propMap[1]]
70
+ }
52
71
  }
53
72
 
54
73
  if (isMainComp) {
@@ -67,7 +86,7 @@ export function getInputProps (node, statefulLayout, isMainComp = true) {
67
86
  * @returns {Record<string, any>}
68
87
  */
69
88
  export function getCompProps (node, comp, isMainComp = true) {
70
- const options = /** @type import('../components/types.js').VjsfOptions */(node.options)
89
+ const options = /** @type import('../types.js').VjsfOptions */(node.options)
71
90
  /** @type {(Record<string, any> | undefined)[]} */
72
91
  const propsLevels = [{ density: options.density }]
73
92
  propsLevels.push(/** @type Record<string, any> | undefined */(options[`${comp}Props`]))
@@ -3,13 +3,12 @@ import NodeSlot from '../components/fragments/node-slot.vue'
3
3
 
4
4
  // calculate the slots of components
5
5
  /**
6
- * @param {import('@json-layout/core').StateNode} node
7
- * @param {import('@json-layout/core').StatefulLayout} statefulLayout
6
+ * @param {import('../types.js').VjsfNode} node
7
+ * @param {import('../types.js').VjsfStatefulLayout} statefulLayout
8
8
  * @returns {Record<string, any>}
9
9
  */
10
10
  export function getCompSlots (node, statefulLayout) {
11
11
  if (!node.layout.slots) return {}
12
- // const options = /** @type import('../components/types.js').VjsfOptions */(node.options)
13
12
  /** @type {Record<string, any>} */
14
13
  const slots = {}
15
14
  for (const [key, layoutSlot] of Object.entries(node.layout.slots)) {
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AA2DA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBAjFqB,KAAK"}
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AA8FA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBApHqB,KAAK"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @param {object} schema
3
- * @param {string} baseImport
3
+ * @param {import('../types.js').PartialVjsfCompileOptions} [options]
4
+ * @param {string} [baseImport]
4
5
  * @returns {string}
5
6
  */
6
- export function compile(schema: object, baseImport?: string): string;
7
+ export function compile(schema: object, options?: Partial<Omit<import("../types.js").VjsfCompileOptions, "width">> | undefined, baseImport?: string | undefined): string;
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,gCAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAgBlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.js"],"names":[],"mappings":"AAmCA;;;;;GAKG;AACH,gCALW,MAAM,4HAGJ,MAAM,CAyBlB"}
@@ -0,0 +1,4 @@
1
+ /** @type import("../types.js").PartialVjsfCompileOptions */
2
+ export const defaultOptions: import("../types.js").PartialVjsfCompileOptions;
3
+ export function getFullOptions(options: import("../types.js").PartialVjsfCompileOptions): import("../types.js").VjsfCompileOptions;
4
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/compile/options.js"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,6BADU,OAAO,aAAa,EAAE,yBAAyB,CAKxD;AAOM,wCAHI,OAAO,aAAa,EAAE,yBAAyB,4CASzD"}
@@ -0,0 +1,8 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ node: import("../../types.js").VjsfNode;
3
+ $props: {
4
+ readonly node?: import("../../types.js").VjsfNode | undefined;
5
+ };
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
7
+ export default _default;
8
+ //# sourceMappingURL=help-message.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help-message.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/help-message.vue.js"],"names":[],"mappings":""}
@@ -5,13 +5,13 @@ declare const _default: import("vue").DefineComponent<{
5
5
  required: true;
6
6
  };
7
7
  node: {
8
- /** @type import('vue').PropType<import('../types.js').VjsfNode> */
9
- type: import('vue').PropType<import('../types.js').VjsfNode>;
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfNode> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfNode>;
10
10
  required: true;
11
11
  };
12
12
  statefulLayout: {
13
- /** @type import('vue').PropType<import('@json-layout/core').StatefulLayout> */
14
- type: import('vue').PropType<import('@json-layout/core').StatefulLayout>;
13
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
14
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
15
15
  required: true;
16
16
  };
17
17
  tag: {
@@ -19,20 +19,20 @@ declare const _default: import("vue").DefineComponent<{
19
19
  type: import('vue').PropType<string>;
20
20
  default: null;
21
21
  };
22
- }, any, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
+ }, any, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
23
  layoutSlot: {
24
24
  /** @type import('vue').PropType<import('@json-layout/vocabulary').Slot> */
25
25
  type: import('vue').PropType<import('@json-layout/vocabulary').Slot>;
26
26
  required: true;
27
27
  };
28
28
  node: {
29
- /** @type import('vue').PropType<import('../types.js').VjsfNode> */
30
- type: import('vue').PropType<import('../types.js').VjsfNode>;
29
+ /** @type import('vue').PropType<import('../../types.js').VjsfNode> */
30
+ type: import('vue').PropType<import('../../types.js').VjsfNode>;
31
31
  required: true;
32
32
  };
33
33
  statefulLayout: {
34
- /** @type import('vue').PropType<import('@json-layout/core').StatefulLayout> */
35
- type: import('vue').PropType<import('@json-layout/core').StatefulLayout>;
34
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
35
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
36
36
  required: true;
37
37
  };
38
38
  tag: {
@@ -1 +1 @@
1
- {"version":3,"file":"node-slot.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/node-slot.vue.js"],"names":[],"mappings":";;QAUM,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,yBAAyB,EAAE,IAAI,CAAC;;;;QAKxE,mEAAmE;cAAzD,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC;;;;QAKhE,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC;;;;QAK5E,2CAA2C;cAAjC,OAAO,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;;;;;QAfxC,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,yBAAyB,EAAE,IAAI,CAAC;;;;QAKxE,mEAAmE;cAAzD,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC;;;;QAKhE,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC;;;;QAK5E,2CAA2C;cAAjC,OAAO,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC"}
1
+ {"version":3,"file":"node-slot.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/node-slot.vue.js"],"names":[],"mappings":";;QAUM,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,yBAAyB,EAAE,IAAI,CAAC;;;;QAKxE,sEAAsE;cAA5D,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,QAAQ,CAAC;;;;QAKnE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;QAK7E,2CAA2C;cAAjC,OAAO,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;;;;;QAfxC,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,yBAAyB,EAAE,IAAI,CAAC;;;;QAKxE,sEAAsE;cAA5D,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,QAAQ,CAAC;;;;QAKnE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;QAK7E,2CAA2C;cAAjC,OAAO,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC"}
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
- node: import("../types.js").VjsfNode;
2
+ node: import("../../types.js").VjsfNode;
3
3
  $props: {
4
- readonly node?: import("../types.js").VjsfNode | undefined;
4
+ readonly node?: import("../../types.js").VjsfNode | undefined;
5
5
  };
6
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
7
7
  export default _default;
8
8
  //# sourceMappingURL=section-header.vue.d.ts.map
@@ -0,0 +1,15 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ icon: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
9
+ icon: {
10
+ type: StringConstructor;
11
+ required: true;
12
+ };
13
+ }>>, {}, {}>;
14
+ export default _default;
15
+ //# sourceMappingURL=select-item-icon.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-item-icon.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-item-icon.vue.js"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ multiple: boolean;
3
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
+ itemProps: Record<string, any>;
5
+ $props: {
6
+ readonly multiple?: boolean | undefined;
7
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
8
+ readonly itemProps?: Record<string, any> | undefined;
9
+ };
10
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
11
+ export default _default;
12
+ //# sourceMappingURL=select-item.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-item.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-item.vue.js"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ multiple: boolean;
3
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
+ last: boolean;
5
+ $props: {
6
+ readonly multiple?: boolean | undefined;
7
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
8
+ readonly last?: boolean | undefined;
9
+ };
10
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
11
+ export default _default;
12
+ //# sourceMappingURL=select-selection.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-selection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-selection.vue.js"],"names":[],"mappings":""}
@@ -1,13 +1,13 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {
2
- modelValue: import("../types.js").VjsfNode;
3
- statefulLayout: import("@json-layout/core").StatefulLayout;
2
+ modelValue: import("../../types.js").VjsfNode;
3
+ statefulLayout: import("../../types.js").VjsfStatefulLayout;
4
4
  formattedValue: string | null;
5
5
  $props: {
6
- readonly modelValue?: import("../types.js").VjsfNode | undefined;
7
- readonly statefulLayout?: import("@json-layout/core").StatefulLayout | undefined;
6
+ readonly modelValue?: import("../../types.js").VjsfNode | undefined;
7
+ readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
8
8
  readonly formattedValue?: string | null | undefined;
9
9
  };
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
10
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
11
11
  "prepend-inner"?(_: {}): any;
12
12
  default?(_: {
13
13
  close: () => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;6BAmIsC,GAAG;;;QACX,GAAG"}
1
+ {"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;6BAkIsC,GAAG;;;QACX,GAAG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @param {string} name
3
+ * @param {import('vue').Component} component
4
+ */
5
+ export function registerNodeComponent(name: string, component: import('vue').Component): void;
6
+ /** @type {Record<string, import('vue').Component>} */
7
+ export const registeredNodeComponents: Record<string, import('vue').Component>;
8
+ //# sourceMappingURL=global-register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-register.d.ts","sourceRoot":"","sources":["../../src/components/global-register.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,4CAHW,MAAM,aACN,OAAO,KAAK,EAAE,SAAS,QAIjC;AATD,sDAAsD;AACtD,uCADW,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,CACR"}
@@ -1,10 +1,10 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
- modelValue: import("./types.js").VjsfNode;
3
- statefulLayout: import("@json-layout/core").StatefulLayout;
2
+ modelValue: import("../types.js").VjsfNode;
3
+ statefulLayout: import("../types.js").VjsfStatefulLayout;
4
4
  $props: {
5
- readonly modelValue?: import("./types.js").VjsfNode | undefined;
6
- readonly statefulLayout?: import("@json-layout/core").StatefulLayout | undefined;
5
+ readonly modelValue?: import("../types.js").VjsfNode | undefined;
6
+ readonly statefulLayout?: import("../types.js").VjsfStatefulLayout | undefined;
7
7
  };
8
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
9
9
  export default _default;
10
10
  //# sourceMappingURL=node.vue.d.ts.map
@@ -0,0 +1,27 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ /** @type import('vue').PropType<import('../../types.js').VjsfSelectNode> */
4
+ type: import('vue').PropType<import('../../types.js').VjsfSelectNode>;
5
+ required: true;
6
+ };
7
+ statefulLayout: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
10
+ required: true;
11
+ };
12
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ modelValue: {
16
+ /** @type import('vue').PropType<import('../../types.js').VjsfSelectNode> */
17
+ type: import('vue').PropType<import('../../types.js').VjsfSelectNode>;
18
+ required: true;
19
+ };
20
+ statefulLayout: {
21
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
22
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
23
+ required: true;
24
+ };
25
+ }>>, {}, {}>;
26
+ export default _default;
27
+ //# sourceMappingURL=autocomplete.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/autocomplete.vue.js"],"names":[],"mappings":";;QAWI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
- modelValue: import("../types.js").VjsfCheckboxNode;
3
- statefulLayout: import("@json-layout/core").StatefulLayout;
2
+ modelValue: import("../../types.js").VjsfCheckboxNode;
3
+ statefulLayout: import("../../types.js").VjsfStatefulLayout;
4
4
  $props: {
5
- readonly modelValue?: import("../types.js").VjsfCheckboxNode | undefined;
6
- readonly statefulLayout?: import("@json-layout/core").StatefulLayout | undefined;
5
+ readonly modelValue?: import("../../types.js").VjsfCheckboxNode | undefined;
6
+ readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
7
7
  };
8
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
9
9
  export default _default;
10
10
  //# sourceMappingURL=checkbox.vue.d.ts.map