@swiss-ai-hub/web 0.291.10 → 0.292.0

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.
@@ -617,6 +617,37 @@ export function coerceNullableToggles(
617
617
  * `element.value` looks like; behaviour here is exercised end-to-end on agent and
618
618
  * process edit forms.
619
619
  */
620
+ /**
621
+ * Seed a group field's value: leave a disabled nullable group as `null`; otherwise
622
+ * materialise its children's defaults (starting from the existing object when present).
623
+ * `coerceNullableToggles` re-nullifies disabled subtrees at submit time, so seeding a
624
+ * group whose toggle will end up off is safe.
625
+ */
626
+ function seedGroupDefault(value: unknown, children: FormElement[]): Record<string, unknown> | null {
627
+ if (value === null) return null
628
+ const groupValue = value && typeof value === 'object' && !Array.isArray(value)
629
+ ? value as Record<string, unknown>
630
+ : {}
631
+ return seedFormDefaults(groupValue, children)
632
+ }
633
+
634
+ /**
635
+ * Seed a repeater field's value: recurse into each existing item, or materialise an
636
+ * empty array for an untouched repeater (done here at load time rather than lazily in
637
+ * the render-time `:model-value` getter, which must stay pure). Any other value is
638
+ * returned unchanged.
639
+ */
640
+ function seedRepeaterDefault(value: unknown, children: FormElement[]): unknown {
641
+ if (Array.isArray(value)) {
642
+ return value.map(item =>
643
+ item && typeof item === 'object' && !Array.isArray(item)
644
+ ? seedFormDefaults(item as Record<string, unknown>, children)
645
+ : item,
646
+ )
647
+ }
648
+ return value === undefined ? [] : value
649
+ }
650
+
620
651
  export function seedFormDefaults(
621
652
  data: Record<string, unknown>,
622
653
  elements: FormElement[],
@@ -630,29 +661,10 @@ export function seedFormDefaults(
630
661
  const value = result[name]
631
662
 
632
663
  if (formkitType === 'group') {
633
- if (value === null) continue // nullable group disabled — leave as null
634
- // value === undefined (or a non-object): materialise group defaults so children
635
- // render with backend defaults. For nullable groups whose toggle is off,
636
- // coerceNullableToggles re-nullifies the whole subtree at submit time, so seeding
637
- // here is safe even when the toggle will end up disabled.
638
- const groupValue = (value && typeof value === 'object' && !Array.isArray(value))
639
- ? value as Record<string, unknown>
640
- : {}
641
- result[name] = seedFormDefaults(groupValue, children)
664
+ result[name] = seedGroupDefault(value, children)
642
665
  }
643
666
  else if (formkitType === 'repeater') {
644
- if (Array.isArray(value)) {
645
- result[name] = value.map(item =>
646
- item && typeof item === 'object' && !Array.isArray(item)
647
- ? seedFormDefaults(item as Record<string, unknown>, children)
648
- : item,
649
- )
650
- }
651
- // Materialise an empty array for untouched repeaters here (load time) rather
652
- // than lazily inside the render-time `:model-value` getter, which must stay pure.
653
- else if (value === undefined) {
654
- result[name] = []
655
- }
667
+ result[name] = seedRepeaterDefault(value, children)
656
668
  }
657
669
  else if (!(name in result) && element.value !== undefined) {
658
670
  result[name] = element.value
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "bbv Software Services AG (https://www.bbv.ch)",
5
5
  "type": "module",
6
- "version": "0.291.10",
6
+ "version": "0.292.0",
7
7
  "description": "Swiss AI Hub - Admin & Management UI (Nuxt 3 layer)",
8
8
  "main": "./nuxt.config.ts",
9
9
  "repository": {
@@ -6,7 +6,7 @@
6
6
  width="100%"
7
7
  height="100%"
8
8
  title="Open WebUI"
9
- allow="microphone"
9
+ allow="clipboard-write 'src'; clipboard-read 'src'; microphone 'src'; camera 'src'; display-capture 'src'; fullscreen 'src'; geolocation 'src'; autoplay 'src'"
10
10
  @load="handleIframeLoad"
11
11
  />
12
12
  </div>