@structured-field/widget-editor 1.0.1 → 1.0.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.
@@ -129,6 +129,10 @@ const looseToNumber = (val) => {
129
129
  const n = parseFloat(val);
130
130
  return isNaN(n) ? val : n;
131
131
  };
132
+ const toNumber = (val) => {
133
+ const n = isString(val) ? Number(val) : NaN;
134
+ return isNaN(n) ? val : n;
135
+ };
132
136
  let _globalThis;
133
137
  const getGlobalThis = () => {
134
138
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
@@ -1579,44 +1583,6 @@ const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value)
1579
1583
  function isRef(r) {
1580
1584
  return r ? r["__v_isRef"] === true : false;
1581
1585
  }
1582
- // @__NO_SIDE_EFFECTS__
1583
- function ref(value) {
1584
- return createRef(value, false);
1585
- }
1586
- function createRef(rawValue, shallow) {
1587
- if (/* @__PURE__ */ isRef(rawValue)) {
1588
- return rawValue;
1589
- }
1590
- return new RefImpl(rawValue, shallow);
1591
- }
1592
- class RefImpl {
1593
- constructor(value, isShallow2) {
1594
- this.dep = new Dep();
1595
- this["__v_isRef"] = true;
1596
- this["__v_isShallow"] = false;
1597
- this._rawValue = isShallow2 ? value : toRaw(value);
1598
- this._value = isShallow2 ? value : toReactive(value);
1599
- this["__v_isShallow"] = isShallow2;
1600
- }
1601
- get value() {
1602
- {
1603
- this.dep.track();
1604
- }
1605
- return this._value;
1606
- }
1607
- set value(newValue) {
1608
- const oldValue = this._rawValue;
1609
- const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1610
- newValue = useDirectValue ? newValue : toRaw(newValue);
1611
- if (hasChanged(newValue, oldValue)) {
1612
- this._rawValue = newValue;
1613
- this._value = useDirectValue ? newValue : toReactive(newValue);
1614
- {
1615
- this.dep.trigger();
1616
- }
1617
- }
1618
- }
1619
- }
1620
1586
  function unref(ref2) {
1621
1587
  return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
1622
1588
  }
@@ -2566,191 +2532,11 @@ function invalidatePendingSetRef(rawRef) {
2566
2532
  pendingSetRefMap.delete(rawRef);
2567
2533
  }
2568
2534
  }
2569
- const isComment = (node) => node.nodeType === 8;
2570
2535
 
2571
2536
  getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
2572
2537
  getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
2573
- function forEachElement(node, cb) {
2574
- if (isComment(node) && node.data === "[") {
2575
- let depth = 1;
2576
- let next = node.nextSibling;
2577
- while (next) {
2578
- if (next.nodeType === 1) {
2579
- const result = cb(next);
2580
- if (result === false) {
2581
- break;
2582
- }
2583
- } else if (isComment(next)) {
2584
- if (next.data === "]") {
2585
- if (--depth === 0) break;
2586
- } else if (next.data === "[") {
2587
- depth++;
2588
- }
2589
- }
2590
- next = next.nextSibling;
2591
- }
2592
- } else {
2593
- cb(node);
2594
- }
2595
- }
2596
2538
 
2597
2539
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2598
- // @__NO_SIDE_EFFECTS__
2599
- function defineAsyncComponent(source) {
2600
- if (isFunction(source)) {
2601
- source = { loader: source };
2602
- }
2603
- const {
2604
- loader,
2605
- loadingComponent,
2606
- errorComponent,
2607
- delay = 200,
2608
- hydrate: hydrateStrategy,
2609
- timeout,
2610
- // undefined = never times out
2611
- suspensible = true,
2612
- onError: userOnError
2613
- } = source;
2614
- let pendingRequest = null;
2615
- let resolvedComp;
2616
- let retries = 0;
2617
- const retry = () => {
2618
- retries++;
2619
- pendingRequest = null;
2620
- return load();
2621
- };
2622
- const load = () => {
2623
- let thisRequest;
2624
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2625
- err = err instanceof Error ? err : new Error(String(err));
2626
- if (userOnError) {
2627
- return new Promise((resolve, reject) => {
2628
- const userRetry = () => resolve(retry());
2629
- const userFail = () => reject(err);
2630
- userOnError(err, userRetry, userFail, retries + 1);
2631
- });
2632
- } else {
2633
- throw err;
2634
- }
2635
- }).then((comp) => {
2636
- if (thisRequest !== pendingRequest && pendingRequest) {
2637
- return pendingRequest;
2638
- }
2639
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2640
- comp = comp.default;
2641
- }
2642
- resolvedComp = comp;
2643
- return comp;
2644
- }));
2645
- };
2646
- return defineComponent({
2647
- name: "AsyncComponentWrapper",
2648
- __asyncLoader: load,
2649
- __asyncHydrate(el, instance, hydrate) {
2650
- let patched = false;
2651
- (instance.bu || (instance.bu = [])).push(() => patched = true);
2652
- const performHydrate = () => {
2653
- if (patched) {
2654
- return;
2655
- }
2656
- hydrate();
2657
- };
2658
- const doHydrate = hydrateStrategy ? () => {
2659
- const teardown = hydrateStrategy(
2660
- performHydrate,
2661
- (cb) => forEachElement(el, cb)
2662
- );
2663
- if (teardown) {
2664
- (instance.bum || (instance.bum = [])).push(teardown);
2665
- }
2666
- } : performHydrate;
2667
- if (resolvedComp) {
2668
- doHydrate();
2669
- } else {
2670
- load().then(() => !instance.isUnmounted && doHydrate());
2671
- }
2672
- },
2673
- get __asyncResolved() {
2674
- return resolvedComp;
2675
- },
2676
- setup() {
2677
- const instance = currentInstance;
2678
- markAsyncBoundary(instance);
2679
- if (resolvedComp) {
2680
- return () => createInnerComp(resolvedComp, instance);
2681
- }
2682
- const onError = (err) => {
2683
- pendingRequest = null;
2684
- handleError(
2685
- err,
2686
- instance,
2687
- 13,
2688
- !errorComponent
2689
- );
2690
- };
2691
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
2692
- return load().then((comp) => {
2693
- return () => createInnerComp(comp, instance);
2694
- }).catch((err) => {
2695
- onError(err);
2696
- return () => errorComponent ? createVNode(errorComponent, {
2697
- error: err
2698
- }) : null;
2699
- });
2700
- }
2701
- const loaded = ref(false);
2702
- const error = ref();
2703
- const delayed = ref(!!delay);
2704
- if (delay) {
2705
- setTimeout(() => {
2706
- delayed.value = false;
2707
- }, delay);
2708
- }
2709
- if (timeout != null) {
2710
- setTimeout(() => {
2711
- if (!loaded.value && !error.value) {
2712
- const err = new Error(
2713
- `Async component timed out after ${timeout}ms.`
2714
- );
2715
- onError(err);
2716
- error.value = err;
2717
- }
2718
- }, timeout);
2719
- }
2720
- load().then(() => {
2721
- loaded.value = true;
2722
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2723
- instance.parent.update();
2724
- }
2725
- }).catch((err) => {
2726
- onError(err);
2727
- error.value = err;
2728
- });
2729
- return () => {
2730
- if (loaded.value && resolvedComp) {
2731
- return createInnerComp(resolvedComp, instance);
2732
- } else if (error.value && errorComponent) {
2733
- return createVNode(errorComponent, {
2734
- error: error.value
2735
- });
2736
- } else if (loadingComponent && !delayed.value) {
2737
- return createInnerComp(
2738
- loadingComponent,
2739
- instance
2740
- );
2741
- }
2742
- };
2743
- }
2744
- });
2745
- }
2746
- function createInnerComp(comp, parent) {
2747
- const { ref: ref2, props, children, ce } = parent.vnode;
2748
- const vnode = createVNode(comp, props, children);
2749
- vnode.ref = ref2;
2750
- vnode.ce = ce;
2751
- delete parent.vnode.ce;
2752
- return vnode;
2753
- }
2754
2540
 
2755
2541
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2756
2542
  function onActivated(hook, target) {
@@ -6183,32 +5969,6 @@ const computed = (getterOrOptions, debugOptions) => {
6183
5969
  return c;
6184
5970
  };
6185
5971
 
6186
- function h(type, propsOrChildren, children) {
6187
- try {
6188
- setBlockTracking(-1);
6189
- const l = arguments.length;
6190
- if (l === 2) {
6191
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
6192
- if (isVNode(propsOrChildren)) {
6193
- return createVNode(type, null, [propsOrChildren]);
6194
- }
6195
- return createVNode(type, propsOrChildren);
6196
- } else {
6197
- return createVNode(type, null, propsOrChildren);
6198
- }
6199
- } else {
6200
- if (l > 3) {
6201
- children = Array.prototype.slice.call(arguments, 2);
6202
- } else if (l === 3 && isVNode(children)) {
6203
- children = [children];
6204
- }
6205
- return createVNode(type, propsOrChildren, children);
6206
- }
6207
- } finally {
6208
- setBlockTracking(1);
6209
- }
6210
- }
6211
-
6212
5972
  const version = "3.5.30";
6213
5973
 
6214
5974
  /**
@@ -6671,6 +6431,437 @@ function shouldSetAsPropForVueCE(el, key) {
6671
6431
  return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
6672
6432
  }
6673
6433
 
6434
+ const REMOVAL = {};
6435
+ // @__NO_SIDE_EFFECTS__
6436
+ function defineCustomElement(options, extraOptions, _createApp) {
6437
+ let Comp = defineComponent(options, extraOptions);
6438
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
6439
+ class VueCustomElement extends VueElement {
6440
+ constructor(initialProps) {
6441
+ super(Comp, initialProps, _createApp);
6442
+ }
6443
+ }
6444
+ VueCustomElement.def = Comp;
6445
+ return VueCustomElement;
6446
+ }
6447
+ const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
6448
+ };
6449
+ class VueElement extends BaseClass {
6450
+ constructor(_def, _props = {}, _createApp = createApp) {
6451
+ super();
6452
+ this._def = _def;
6453
+ this._props = _props;
6454
+ this._createApp = _createApp;
6455
+ this._isVueCE = true;
6456
+ /**
6457
+ * @internal
6458
+ */
6459
+ this._instance = null;
6460
+ /**
6461
+ * @internal
6462
+ */
6463
+ this._app = null;
6464
+ /**
6465
+ * @internal
6466
+ */
6467
+ this._nonce = this._def.nonce;
6468
+ this._connected = false;
6469
+ this._resolved = false;
6470
+ this._patching = false;
6471
+ this._dirty = false;
6472
+ this._numberProps = null;
6473
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
6474
+ this._styleAnchors = /* @__PURE__ */ new WeakMap();
6475
+ this._ob = null;
6476
+ if (this.shadowRoot && _createApp !== createApp) {
6477
+ this._root = this.shadowRoot;
6478
+ } else {
6479
+ if (_def.shadowRoot !== false) {
6480
+ this.attachShadow(
6481
+ extend({}, _def.shadowRootOptions, {
6482
+ mode: "open"
6483
+ })
6484
+ );
6485
+ this._root = this.shadowRoot;
6486
+ } else {
6487
+ this._root = this;
6488
+ }
6489
+ }
6490
+ }
6491
+ connectedCallback() {
6492
+ if (!this.isConnected) return;
6493
+ if (!this.shadowRoot && !this._resolved) {
6494
+ this._parseSlots();
6495
+ }
6496
+ this._connected = true;
6497
+ let parent = this;
6498
+ while (parent = parent && // #12479 should check assignedSlot first to get correct parent
6499
+ (parent.assignedSlot || parent.parentNode || parent.host)) {
6500
+ if (parent instanceof VueElement) {
6501
+ this._parent = parent;
6502
+ break;
6503
+ }
6504
+ }
6505
+ if (!this._instance) {
6506
+ if (this._resolved) {
6507
+ this._mount(this._def);
6508
+ } else {
6509
+ if (parent && parent._pendingResolve) {
6510
+ this._pendingResolve = parent._pendingResolve.then(() => {
6511
+ this._pendingResolve = void 0;
6512
+ this._resolveDef();
6513
+ });
6514
+ } else {
6515
+ this._resolveDef();
6516
+ }
6517
+ }
6518
+ }
6519
+ }
6520
+ _setParent(parent = this._parent) {
6521
+ if (parent) {
6522
+ this._instance.parent = parent._instance;
6523
+ this._inheritParentContext(parent);
6524
+ }
6525
+ }
6526
+ _inheritParentContext(parent = this._parent) {
6527
+ if (parent && this._app) {
6528
+ Object.setPrototypeOf(
6529
+ this._app._context.provides,
6530
+ parent._instance.provides
6531
+ );
6532
+ }
6533
+ }
6534
+ disconnectedCallback() {
6535
+ this._connected = false;
6536
+ nextTick(() => {
6537
+ if (!this._connected) {
6538
+ if (this._ob) {
6539
+ this._ob.disconnect();
6540
+ this._ob = null;
6541
+ }
6542
+ this._app && this._app.unmount();
6543
+ if (this._instance) this._instance.ce = void 0;
6544
+ this._app = this._instance = null;
6545
+ if (this._teleportTargets) {
6546
+ this._teleportTargets.clear();
6547
+ this._teleportTargets = void 0;
6548
+ }
6549
+ }
6550
+ });
6551
+ }
6552
+ _processMutations(mutations) {
6553
+ for (const m of mutations) {
6554
+ this._setAttr(m.attributeName);
6555
+ }
6556
+ }
6557
+ /**
6558
+ * resolve inner component definition (handle possible async component)
6559
+ */
6560
+ _resolveDef() {
6561
+ if (this._pendingResolve) {
6562
+ return;
6563
+ }
6564
+ for (let i = 0; i < this.attributes.length; i++) {
6565
+ this._setAttr(this.attributes[i].name);
6566
+ }
6567
+ this._ob = new MutationObserver(this._processMutations.bind(this));
6568
+ this._ob.observe(this, { attributes: true });
6569
+ const resolve = (def, isAsync = false) => {
6570
+ this._resolved = true;
6571
+ this._pendingResolve = void 0;
6572
+ const { props, styles } = def;
6573
+ let numberProps;
6574
+ if (props && !isArray(props)) {
6575
+ for (const key in props) {
6576
+ const opt = props[key];
6577
+ if (opt === Number || opt && opt.type === Number) {
6578
+ if (key in this._props) {
6579
+ this._props[key] = toNumber(this._props[key]);
6580
+ }
6581
+ (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
6582
+ }
6583
+ }
6584
+ }
6585
+ this._numberProps = numberProps;
6586
+ this._resolveProps(def);
6587
+ if (this.shadowRoot) {
6588
+ this._applyStyles(styles);
6589
+ }
6590
+ this._mount(def);
6591
+ };
6592
+ const asyncDef = this._def.__asyncLoader;
6593
+ if (asyncDef) {
6594
+ this._pendingResolve = asyncDef().then((def) => {
6595
+ def.configureApp = this._def.configureApp;
6596
+ resolve(this._def = def, true);
6597
+ });
6598
+ } else {
6599
+ resolve(this._def);
6600
+ }
6601
+ }
6602
+ _mount(def) {
6603
+ this._app = this._createApp(def);
6604
+ this._inheritParentContext();
6605
+ if (def.configureApp) {
6606
+ def.configureApp(this._app);
6607
+ }
6608
+ this._app._ceVNode = this._createVNode();
6609
+ this._app.mount(this._root);
6610
+ const exposed = this._instance && this._instance.exposed;
6611
+ if (!exposed) return;
6612
+ for (const key in exposed) {
6613
+ if (!hasOwn(this, key)) {
6614
+ Object.defineProperty(this, key, {
6615
+ // unwrap ref to be consistent with public instance behavior
6616
+ get: () => unref(exposed[key])
6617
+ });
6618
+ }
6619
+ }
6620
+ }
6621
+ _resolveProps(def) {
6622
+ const { props } = def;
6623
+ const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
6624
+ for (const key of Object.keys(this)) {
6625
+ if (key[0] !== "_" && declaredPropKeys.includes(key)) {
6626
+ this._setProp(key, this[key]);
6627
+ }
6628
+ }
6629
+ for (const key of declaredPropKeys.map(camelize)) {
6630
+ Object.defineProperty(this, key, {
6631
+ get() {
6632
+ return this._getProp(key);
6633
+ },
6634
+ set(val) {
6635
+ this._setProp(key, val, true, !this._patching);
6636
+ }
6637
+ });
6638
+ }
6639
+ }
6640
+ _setAttr(key) {
6641
+ if (key.startsWith("data-v-")) return;
6642
+ const has = this.hasAttribute(key);
6643
+ let value = has ? this.getAttribute(key) : REMOVAL;
6644
+ const camelKey = camelize(key);
6645
+ if (has && this._numberProps && this._numberProps[camelKey]) {
6646
+ value = toNumber(value);
6647
+ }
6648
+ this._setProp(camelKey, value, false, true);
6649
+ }
6650
+ /**
6651
+ * @internal
6652
+ */
6653
+ _getProp(key) {
6654
+ return this._props[key];
6655
+ }
6656
+ /**
6657
+ * @internal
6658
+ */
6659
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
6660
+ if (val !== this._props[key]) {
6661
+ this._dirty = true;
6662
+ if (val === REMOVAL) {
6663
+ delete this._props[key];
6664
+ } else {
6665
+ this._props[key] = val;
6666
+ if (key === "key" && this._app) {
6667
+ this._app._ceVNode.key = val;
6668
+ }
6669
+ }
6670
+ if (shouldUpdate && this._instance) {
6671
+ this._update();
6672
+ }
6673
+ if (shouldReflect) {
6674
+ const ob = this._ob;
6675
+ if (ob) {
6676
+ this._processMutations(ob.takeRecords());
6677
+ ob.disconnect();
6678
+ }
6679
+ if (val === true) {
6680
+ this.setAttribute(hyphenate(key), "");
6681
+ } else if (typeof val === "string" || typeof val === "number") {
6682
+ this.setAttribute(hyphenate(key), val + "");
6683
+ } else if (!val) {
6684
+ this.removeAttribute(hyphenate(key));
6685
+ }
6686
+ ob && ob.observe(this, { attributes: true });
6687
+ }
6688
+ }
6689
+ }
6690
+ _update() {
6691
+ const vnode = this._createVNode();
6692
+ if (this._app) vnode.appContext = this._app._context;
6693
+ render$c(vnode, this._root);
6694
+ }
6695
+ _createVNode() {
6696
+ const baseProps = {};
6697
+ if (!this.shadowRoot) {
6698
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
6699
+ }
6700
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
6701
+ if (!this._instance) {
6702
+ vnode.ce = (instance) => {
6703
+ this._instance = instance;
6704
+ instance.ce = this;
6705
+ instance.isCE = true;
6706
+ const dispatch = (event, args) => {
6707
+ this.dispatchEvent(
6708
+ new CustomEvent(
6709
+ event,
6710
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
6711
+ )
6712
+ );
6713
+ };
6714
+ instance.emit = (event, ...args) => {
6715
+ dispatch(event, args);
6716
+ if (hyphenate(event) !== event) {
6717
+ dispatch(hyphenate(event), args);
6718
+ }
6719
+ };
6720
+ this._setParent();
6721
+ };
6722
+ }
6723
+ return vnode;
6724
+ }
6725
+ _applyStyles(styles, owner, parentComp) {
6726
+ if (!styles) return;
6727
+ if (owner) {
6728
+ if (owner === this._def || this._styleChildren.has(owner)) {
6729
+ return;
6730
+ }
6731
+ this._styleChildren.add(owner);
6732
+ }
6733
+ const nonce = this._nonce;
6734
+ const root = this.shadowRoot;
6735
+ const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
6736
+ let last = null;
6737
+ for (let i = styles.length - 1; i >= 0; i--) {
6738
+ const s = document.createElement("style");
6739
+ if (nonce) s.setAttribute("nonce", nonce);
6740
+ s.textContent = styles[i];
6741
+ root.insertBefore(s, last || insertionAnchor);
6742
+ last = s;
6743
+ if (i === 0) {
6744
+ if (!parentComp) this._styleAnchors.set(this._def, s);
6745
+ if (owner) this._styleAnchors.set(owner, s);
6746
+ }
6747
+ }
6748
+ }
6749
+ _getStyleAnchor(comp) {
6750
+ if (!comp) {
6751
+ return null;
6752
+ }
6753
+ const anchor = this._styleAnchors.get(comp);
6754
+ if (anchor && anchor.parentNode === this.shadowRoot) {
6755
+ return anchor;
6756
+ }
6757
+ if (anchor) {
6758
+ this._styleAnchors.delete(comp);
6759
+ }
6760
+ return null;
6761
+ }
6762
+ _getRootStyleInsertionAnchor(root) {
6763
+ for (let i = 0; i < root.childNodes.length; i++) {
6764
+ const node = root.childNodes[i];
6765
+ if (!(node instanceof HTMLStyleElement)) {
6766
+ return node;
6767
+ }
6768
+ }
6769
+ return null;
6770
+ }
6771
+ /**
6772
+ * Only called when shadowRoot is false
6773
+ */
6774
+ _parseSlots() {
6775
+ const slots = this._slots = {};
6776
+ let n;
6777
+ while (n = this.firstChild) {
6778
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
6779
+ (slots[slotName] || (slots[slotName] = [])).push(n);
6780
+ this.removeChild(n);
6781
+ }
6782
+ }
6783
+ /**
6784
+ * Only called when shadowRoot is false
6785
+ */
6786
+ _renderSlots() {
6787
+ const outlets = this._getSlots();
6788
+ const scopeId = this._instance.type.__scopeId;
6789
+ for (let i = 0; i < outlets.length; i++) {
6790
+ const o = outlets[i];
6791
+ const slotName = o.getAttribute("name") || "default";
6792
+ const content = this._slots[slotName];
6793
+ const parent = o.parentNode;
6794
+ if (content) {
6795
+ for (const n of content) {
6796
+ if (scopeId && n.nodeType === 1) {
6797
+ const id = scopeId + "-s";
6798
+ const walker = document.createTreeWalker(n, 1);
6799
+ n.setAttribute(id, "");
6800
+ let child;
6801
+ while (child = walker.nextNode()) {
6802
+ child.setAttribute(id, "");
6803
+ }
6804
+ }
6805
+ parent.insertBefore(n, o);
6806
+ }
6807
+ } else {
6808
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
6809
+ }
6810
+ parent.removeChild(o);
6811
+ }
6812
+ }
6813
+ /**
6814
+ * @internal
6815
+ */
6816
+ _getSlots() {
6817
+ const roots = [this];
6818
+ if (this._teleportTargets) {
6819
+ roots.push(...this._teleportTargets);
6820
+ }
6821
+ const slots = /* @__PURE__ */ new Set();
6822
+ for (const root of roots) {
6823
+ const found = root.querySelectorAll("slot");
6824
+ for (let i = 0; i < found.length; i++) {
6825
+ slots.add(found[i]);
6826
+ }
6827
+ }
6828
+ return Array.from(slots);
6829
+ }
6830
+ /**
6831
+ * @internal
6832
+ */
6833
+ _injectChildStyle(comp, parentComp) {
6834
+ this._applyStyles(comp.styles, comp, parentComp);
6835
+ }
6836
+ /**
6837
+ * @internal
6838
+ */
6839
+ _beginPatch() {
6840
+ this._patching = true;
6841
+ this._dirty = false;
6842
+ }
6843
+ /**
6844
+ * @internal
6845
+ */
6846
+ _endPatch() {
6847
+ this._patching = false;
6848
+ if (this._dirty && this._instance) {
6849
+ this._update();
6850
+ }
6851
+ }
6852
+ /**
6853
+ * @internal
6854
+ */
6855
+ _hasShadowRoot() {
6856
+ return this._def.shadowRoot !== false;
6857
+ }
6858
+ /**
6859
+ * @internal
6860
+ */
6861
+ _removeChildStyle(comp) {
6862
+ }
6863
+ }
6864
+
6674
6865
  const getModelAssigner = (vnode) => {
6675
6866
  const fn = vnode.props["onUpdate:modelValue"] || false;
6676
6867
  return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
@@ -6766,6 +6957,9 @@ let renderer;
6766
6957
  function ensureRenderer() {
6767
6958
  return renderer || (renderer = createRenderer(rendererOptions));
6768
6959
  }
6960
+ const render$c = ((...args) => {
6961
+ ensureRenderer().render(...args);
6962
+ });
6769
6963
  const createApp = ((...args) => {
6770
6964
  const app = ensureRenderer().createApp(...args);
6771
6965
  const { mount } = app;
@@ -7094,7 +7288,10 @@ script$7.__file = "src/editors/HiddenEditor.vue";
7094
7288
 
7095
7289
  var script$6 = {
7096
7290
  name: 'ObjectEditor',
7097
- components: { SchemaEditor: defineAsyncComponent(() => Promise.resolve().then(function () { return SchemaEditor; })) },
7291
+ beforeCreate() {
7292
+ if (!this.$options.components) this.$options.components = {};
7293
+ this.$options.components.SchemaEditor = script$1;
7294
+ },
7098
7295
  props: {
7099
7296
  schema: { type: Object, required: true },
7100
7297
  modelValue: { default: () => ({}) },
@@ -7140,6 +7337,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
7140
7337
  return ($options.isRoot)
7141
7338
  ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
7142
7339
  createBaseVNode("div", _hoisted_2$4, [
7340
+ createCommentVNode(" {{ schema.properties }}\n <span v-for=\"(propSchema, key) in schema.properties\" :key=\"key\">\n {{ key }}: {{ form.resolveSchema(propSchema) }}\n </span> "),
7143
7341
  (openBlock(true), createElementBlock(Fragment, null, renderList(($props.schema.properties || {}), (propSchema, key) => {
7144
7342
  return (openBlock(), createBlock(_component_SchemaEditor, {
7145
7343
  key: key,
@@ -7215,7 +7413,10 @@ let keyCounter = 0;
7215
7413
 
7216
7414
  var script$5 = {
7217
7415
  name: 'ArrayEditor',
7218
- components: { SchemaEditor: defineAsyncComponent(() => Promise.resolve().then(function () { return SchemaEditor; })) },
7416
+ beforeCreate() {
7417
+ if (!this.$options.components) this.$options.components = {};
7418
+ this.$options.components.SchemaEditor = script$1;
7419
+ },
7219
7420
  props: {
7220
7421
  schema: { type: Object, required: true },
7221
7422
  modelValue: { default: () => [] },
@@ -7369,7 +7570,10 @@ script$5.__file = "src/editors/ArrayEditor.vue";
7369
7570
 
7370
7571
  var script$4 = {
7371
7572
  name: 'NullableEditor',
7372
- components: { SchemaEditor: defineAsyncComponent(() => Promise.resolve().then(function () { return SchemaEditor; })) },
7573
+ beforeCreate() {
7574
+ if (!this.$options.components) this.$options.components = {};
7575
+ this.$options.components.SchemaEditor = script$1;
7576
+ },
7373
7577
  props: {
7374
7578
  schema: { type: Object, required: true },
7375
7579
  modelValue: { default: null },
@@ -7488,7 +7692,10 @@ script$4.__file = "src/editors/NullableEditor.vue";
7488
7692
 
7489
7693
  var script$3 = {
7490
7694
  name: 'UnionEditor',
7491
- components: { SchemaEditor: defineAsyncComponent(() => Promise.resolve().then(function () { return SchemaEditor; })) },
7695
+ beforeCreate() {
7696
+ if (!this.$options.components) this.$options.components = {};
7697
+ this.$options.components.SchemaEditor = script$1;
7698
+ },
7492
7699
  props: {
7493
7700
  schema: { type: Object, required: true },
7494
7701
  modelValue: { default: null },
@@ -7914,11 +8121,6 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
7914
8121
  script$1.render = render$1;
7915
8122
  script$1.__file = "src/editors/SchemaEditor.vue";
7916
8123
 
7917
- var SchemaEditor = /*#__PURE__*/Object.freeze({
7918
- __proto__: null,
7919
- default: script$1
7920
- });
7921
-
7922
8124
  var script = {
7923
8125
  name: 'SchemaForm',
7924
8126
  components: { SchemaEditor: script$1 },
@@ -7928,6 +8130,7 @@ var script = {
7928
8130
  errors: { type: Object, default: () => ({}) },
7929
8131
  },
7930
8132
  emits: ['change'],
8133
+ expose: ['getValue'],
7931
8134
  data() {
7932
8135
  const parsedSchema = typeof this.schema === 'string' ? JSON.parse(this.schema) : this.schema;
7933
8136
  const defs = parsedSchema.$defs || parsedSchema.definitions || {};
@@ -8066,137 +8269,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
8066
8269
  script.render = render;
8067
8270
  script.__file = "src/SchemaForm.vue";
8068
8271
 
8069
- class SchemaFormElement extends HTMLElement {
8070
- constructor() {
8071
- super();
8072
- this._formRef = ref(null);
8073
- this._props = reactive({
8074
- schema: {},
8075
- initialData: undefined,
8076
- errors: {},
8077
- });
8078
- this._app = null;
8079
- this._mountPoint = null;
8080
- }
8081
-
8082
- connectedCallback() {
8083
- this._mountPoint = document.createElement('div');
8084
- this.appendChild(this._mountPoint);
8085
-
8086
- // Read from attributes if properties haven't been set programmatically
8087
- if (!this._propsSet) {
8088
- const schemaAttr = this.getAttribute('schema');
8089
- const dataAttr = this.getAttribute('initial-data');
8090
- if (schemaAttr) this._props.schema = JSON.parse(schemaAttr);
8091
- if (dataAttr) this._props.initialData = JSON.parse(dataAttr);
8092
- }
8093
-
8094
- const formRef = this._formRef;
8095
- const props = this._props;
8096
-
8097
- this._app = createApp({
8098
- render: () => h(script, {
8099
- ref: formRef,
8100
- schema: props.schema,
8101
- initialData: props.initialData,
8102
- errors: props.errors,
8103
- onChange: (val) => {
8104
- this.dispatchEvent(new CustomEvent('change', { detail: val, bubbles: true }));
8105
- },
8106
- }),
8107
- });
8108
-
8109
- this._app.mount(this._mountPoint);
8110
- }
8111
-
8112
- disconnectedCallback() {
8113
- if (this._app) {
8114
- this._app.unmount();
8115
- this._app = null;
8116
- }
8117
- this._mountPoint = null;
8118
- }
8119
-
8120
- // --- Property API ---
8121
-
8122
- get schema() {
8123
- return this._props.schema;
8124
- }
8125
-
8126
- set schema(val) {
8127
- this._propsSet = true;
8128
- this._props.schema = typeof val === 'string' ? JSON.parse(val) : val;
8129
- this._rerender();
8130
- }
8131
-
8132
- get initialData() {
8133
- return this._props.initialData;
8134
- }
8135
-
8136
- set initialData(val) {
8137
- this._propsSet = true;
8138
- this._props.initialData = typeof val === 'string' ? JSON.parse(val) : val;
8139
- this._rerender();
8140
- }
8141
-
8142
- get errors() {
8143
- return this._props.errors;
8144
- }
8145
-
8146
- set errors(val) {
8147
- this._propsSet = true;
8148
- this._props.errors = typeof val === 'string' ? JSON.parse(val) : (val || {});
8149
- this._rerender();
8150
- }
8151
-
8152
- // --- Attribute reflection ---
8153
-
8154
- static get observedAttributes() {
8155
- return ['schema', 'initial-data', 'errors'];
8156
- }
8157
-
8158
- attributeChangedCallback(name, oldVal, newVal) {
8159
- if (oldVal === newVal || this._propsSet) return;
8160
- if (name === 'schema') {
8161
- this._props.schema = newVal ? JSON.parse(newVal) : {};
8162
- } else if (name === 'initial-data') {
8163
- this._props.initialData = newVal ? JSON.parse(newVal) : undefined;
8164
- } else if (name === 'errors') {
8165
- this._props.errors = newVal ? JSON.parse(newVal) : {};
8166
- }
8167
- this._rerender();
8168
- }
8169
-
8170
- // --- Public methods ---
8171
-
8172
- getValue() {
8173
- return this._formRef.value?.getValue?.() ?? null;
8174
- }
8175
-
8176
- // --- Internal ---
8177
-
8178
- _rerender() {
8179
- if (!this._app) return;
8180
- this._app.unmount();
8181
- this._mountPoint.innerHTML = '';
8182
- const formRef = this._formRef;
8183
- const props = this._props;
8184
-
8185
- this._app = createApp({
8186
- render: () => h(script, {
8187
- ref: formRef,
8188
- schema: props.schema,
8189
- initialData: props.initialData,
8190
- errors: props.errors,
8191
- onChange: (val) => {
8192
- this.dispatchEvent(new CustomEvent('change', { detail: val, bubbles: true }));
8193
- },
8194
- }),
8195
- });
8196
-
8197
- this._app.mount(this._mountPoint);
8198
- }
8199
- }
8272
+ const SchemaFormElement = defineCustomElement({
8273
+ ...script,
8274
+ shadowRoot: false,
8275
+ });
8200
8276
 
8201
8277
  function registerCustomElement(tagName = 'schema-form') {
8202
8278
  if (!customElements.get(tagName)) {