agile-core 3.0.8 → 3.0.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.
package/dist/core.es.js CHANGED
@@ -1,413 +1 @@
1
- import { createApp as e, defineComponent as t, useAttrs as n, shallowRef as r, ref as o, useSlots as s, onMounted as i, onUpdated as a, h as u } from "vue";
2
- import { merge as l } from "ts-deepmerge";
3
- var h, c;
4
- const d = __AUI_CONFIG__.tagPrefix || "aui", p = "data-v-aui", m = "auix", f = Symbol("shadow");
5
- const _AuiComponent = class _AuiComponent extends (c = HTMLElement, h = f, c) {
6
- constructor(e2) {
7
- super(), this.__hasVue__ = false, this[h] = { needHook: false, slot: {} }, this[_AuiComponent.shadowSymbol].options = e2 || {}, this.$initAttrs();
8
- }
9
- connectedCallback() {
10
- this.$needInit() && (this.$needHook(true), this.$initVue());
11
- }
12
- set textContent(e2) {
13
- this.$needHook() ? this.$textContent(e2) : super.textContent = e2;
14
- }
15
- get textContent() {
16
- return this.$needHook() ? this.$textContent("default") : super.textContent || "";
17
- }
18
- set innerHTML(e2) {
19
- this.$needHook() ? this.$innerHTML(e2) : super.innerHTML = e2;
20
- }
21
- get innerHTML() {
22
- return this.$needHook() ? this.$innerHTML("default") : super.innerHTML || "";
23
- }
24
- set innerText(e2) {
25
- this.$ignoreLog("innerText"), super.innerText = e2;
26
- }
27
- prepend(e2) {
28
- if (!this.$needHook()) return super.prepend(e2);
29
- this.$prepend("default", e2);
30
- }
31
- appendChild(e2) {
32
- return this.$needHook() ? this.$appendChild("default", e2) : super.appendChild(e2);
33
- }
34
- set value(e2) {
35
- let t2 = e2;
36
- const n2 = this[_AuiComponent.shadowSymbol].value;
37
- let r2;
38
- this.$isArrayValue() ? (t2 = _AuiComponent.$anyToArray(e2), r2 = JSON.stringify(t2)) : r2 = t2.toString(), n2 !== r2 && (this[_AuiComponent.shadowSymbol].value = r2, this[_AuiComponent.shadowSymbol].el && this.$attrChange("value"));
39
- }
40
- get value() {
41
- const e2 = this[_AuiComponent.shadowSymbol].value;
42
- return this.$isArrayValue() && "string" == typeof e2 ? JSON.parse(e2) : e2;
43
- }
44
- hasAttribute(e2) {
45
- const t2 = this[_AuiComponent.shadowSymbol].el;
46
- return t2 ? t2.hasAttribute(e2) : super.hasAttribute(e2);
47
- }
48
- setAttribute(e2, t2) {
49
- t2 = t2.toString();
50
- const n2 = this[_AuiComponent.shadowSymbol].el;
51
- if (n2) {
52
- if (n2.getAttribute(e2) === t2) return;
53
- n2.setAttribute(e2, t2);
54
- }
55
- this.$isShowProp(b.vueAttrName(e2)) && super.setAttribute(e2, t2), "value" === e2 && n2 ? this.value = n2.getAttribute(e2) : this.$attrChange(e2);
56
- }
57
- getAttribute(e2) {
58
- const t2 = this[_AuiComponent.shadowSymbol].el;
59
- return t2 ? t2.getAttribute(e2) : super.getAttribute(e2);
60
- }
61
- removeAttribute(e2) {
62
- const t2 = this[_AuiComponent.shadowSymbol].el;
63
- t2 && t2.removeAttribute(e2);
64
- this.$isShowProp(b.vueAttrName(e2)) && super.removeAttribute(e2), this.$attrChange(e2);
65
- }
66
- attributeChangedCallback(e2, t2, n2) {
67
- const r2 = this[_AuiComponent.shadowSymbol].el;
68
- r2 && t2 !== n2 && (this.$isShowProp(b.vueAttrName(e2)) || super.removeAttribute(e2), r2.setAttribute(e2, n2 || ""), "value" !== e2 && this.$attrChange(e2));
69
- }
70
- static $anyToArray(e2) {
71
- let t2 = [];
72
- if ("string" == typeof e2) {
73
- try {
74
- const t3 = JSON.parse(e2);
75
- if (t3 instanceof Array) return t3;
76
- } catch (e3) {
77
- }
78
- t2 = e2.split(",").filter((e3) => !!e3 && e3.trim());
79
- } else e2 instanceof Array && (t2 = e2);
80
- return t2;
81
- }
82
- $customEvent(e2, t2) {
83
- this.dispatchEvent(new CustomEvent(e2, Object.assign({ bubbles: false, composed: false, cancelable: true }, t2 || {})));
84
- }
85
- $forceUpdate() {
86
- let e2 = null;
87
- const t2 = this[_AuiComponent.shadowSymbol].slot;
88
- for (const n2 in t2) {
89
- const r2 = this.$slotCollection(t2[n2]);
90
- e2 || (e2 = {}), e2[n2] = r2;
91
- }
92
- e2 && (this[_AuiComponent.shadowSymbol].slotCollection = e2), this.$customEvent("aui-force-update");
93
- }
94
- $slotCollection(e2) {
95
- var _a;
96
- const { start: t2, end: n2 } = e2, r2 = [];
97
- let o2;
98
- for (; t2 && (o2 = t2.nextSibling) && o2 !== n2; ) (_a = t2.parentNode) == null ? void 0 : _a.removeChild(o2), r2.push(o2);
99
- return r2;
100
- }
101
- $slotReplace() {
102
- const e2 = this[_AuiComponent.shadowSymbol].slotCollection;
103
- if (e2) {
104
- delete this[_AuiComponent.shadowSymbol].slotCollection;
105
- for (const t2 in e2) {
106
- this.querySelector(`aui-slot[name="${t2}"]`).$replace(this), this.$replaceChildren(t2, e2[t2]);
107
- }
108
- }
109
- }
110
- $textContent(e2, ...t2) {
111
- if (0 === t2.length) {
112
- const t3 = [], { start: n2, end: r2 } = this.$slot(e2) || {};
113
- let o2 = n2;
114
- for (; o2 && (o2 = o2.nextSibling) && o2 !== r2; ) t3.push(o2.textContent);
115
- return t3.join("");
116
- }
117
- return this.$replaceChildren(e2, [document.createTextNode(t2[0] || "")]), "";
118
- }
119
- $innerHTML(e2, ...t2) {
120
- if (0 === t2.length) {
121
- const t3 = [], { start: n2, end: r2 } = this.$slot(e2) || {};
122
- let o2 = n2;
123
- for (; o2 && (o2 = o2.nextSibling) && o2 !== r2; ) if (o2.outerHTML) t3.push(o2.outerHTML);
124
- else {
125
- let e3 = o2.textContent;
126
- o2 instanceof Comment && (e3 = `<!--${e3}-->`), t3.push(e3);
127
- }
128
- return t3.join("");
129
- }
130
- {
131
- const n2 = document.createElement("div");
132
- n2.innerHTML = t2[0] || "";
133
- const r2 = this.$moveChildren(n2);
134
- this.$replaceChildren(e2, r2.default);
135
- }
136
- return "";
137
- }
138
- $prepend(e2, t2) {
139
- var _a;
140
- const { start: n2 } = this.$slot(e2) || {};
141
- (_a = n2 == null ? void 0 : n2.parentNode) == null ? void 0 : _a.insertBefore(t2, n2.nextSibling);
142
- }
143
- $appendChild(e2, t2) {
144
- var _a;
145
- const { end: n2 } = this.$slot(e2) || {};
146
- return (_a = n2 == null ? void 0 : n2.parentNode) == null ? void 0 : _a.insertBefore(t2, n2), t2;
147
- }
148
- $childNodes(e2) {
149
- const t2 = [], { start: n2, end: r2 } = this.$slot(e2) || {};
150
- let o2 = n2;
151
- for (; o2 && (o2 = o2.nextSibling) && o2 !== r2; ) t2.push(o2);
152
- return t2;
153
- }
154
- $children(e2) {
155
- const t2 = [], { start: n2, end: r2 } = this.$slot(e2) || {};
156
- let o2 = n2;
157
- for (; o2 && (o2 = o2.nextSibling) && o2 !== r2; ) o2 instanceof HTMLElement && t2.push(o2);
158
- return t2;
159
- }
160
- $replaceChildren(e2, t2) {
161
- var _a, _b;
162
- const { start: n2, end: r2 } = this.$slot(e2) || {};
163
- let o2 = null;
164
- for (; n2 && (o2 = n2.nextSibling) && o2 !== r2; ) (_a = o2.parentNode) == null ? void 0 : _a.removeChild(o2);
165
- if (r2) for (; o2 = t2.shift(); ) (_b = r2.parentNode) == null ? void 0 : _b.insertBefore(o2, r2);
166
- }
167
- $slot(e2, t2) {
168
- if (e2 = e2 || "default", !t2) return this[_AuiComponent.shadowSymbol].slot[e2];
169
- this[_AuiComponent.shadowSymbol].slot[e2] = t2;
170
- }
171
- $needHook(e2) {
172
- return "boolean" == typeof e2 && (this[_AuiComponent.shadowSymbol].needHook = e2), this[_AuiComponent.shadowSymbol].needHook;
173
- }
174
- $ignoreLog(e2) {
175
- }
176
- $moveChildren(e2) {
177
- var _a;
178
- const t2 = (e2 = e2 || this).childNodes, n2 = { default: [] };
179
- for (; t2.length > 0; ) {
180
- const r2 = t2[0];
181
- if ((_a = r2.parentNode) == null ? void 0 : _a.removeChild(r2), $.$isForAuiSlot(r2)) {
182
- const t3 = r2.getAttribute("for") || "default";
183
- n2[t3] = n2[t3] || [];
184
- const o2 = Array.prototype.slice.call(r2.childNodes);
185
- $.prototype.$bind.call(r2, e2), n2[t3].push(...o2);
186
- } else n2.default.push(r2);
187
- }
188
- return n2;
189
- }
190
- $isArrayValue() {
191
- var _a;
192
- return ((_a = this[_AuiComponent.shadowSymbol].options) == null ? void 0 : _a.valueType) === Array;
193
- }
194
- $attrChange(e2) {
195
- if ("value" === e2) {
196
- const e3 = this.value;
197
- super.hasAttribute(p) ? this.$call("$emit", "update:value", e3) : this.$customEvent("input", { bubbles: true, composed: true });
198
- }
199
- this.$customEvent("aui-attr-change", { bubbles: true, composed: true, detail: { attributeName: b.vueAttrName(e2) } });
200
- }
201
- $initAttrs() {
202
- const e2 = this.attributes, t2 = document.createElement("div");
203
- for (let n2 = 0; n2 < e2.length; n2++) {
204
- const r2 = e2[n2];
205
- t2.setAttribute(r2.name, r2.value), this.$isShowProp(b.vueAttrName(r2.name)) || super.removeAttribute(r2.name), "value" === r2.name && (this.value = r2.value);
206
- }
207
- Object.defineProperty(this, "attributes", { get value() {
208
- return t2.attributes;
209
- }, writable: false }), this[_AuiComponent.shadowSymbol].el = t2;
210
- }
211
- $isShowProp(e2) {
212
- if (b.isVueAttr(e2)) return true;
213
- const t2 = this.$getProp(e2), n2 = t2 == null ? void 0 : t2.show;
214
- return n2;
215
- }
216
- $getProp(e2) {
217
- var _a;
218
- const t2 = b.cache.getAuiVueDefined(this.tagName);
219
- return (((_a = t2 == null ? void 0 : t2.origin) == null ? void 0 : _a.props) || {})[e2];
220
- }
221
- $initVue() {
222
- if (this.__hasVue__) return;
223
- this.__hasVue__ = true;
224
- const t2 = this.tagName.toLowerCase();
225
- b.cache.getAuiVueDefined(t2) && e(b.createVueComponent(t2, this)).mount(this);
226
- }
227
- $needInit() {
228
- return !super.hasAttribute(p);
229
- }
230
- $bindVue(e2) {
231
- var _a, _b;
232
- if (this[_AuiComponent.shadowSymbol].ref) return;
233
- this[_AuiComponent.shadowSymbol].ref = e2, this.__hasVue__ = true, this.$customEvent("aui-init", { bubbles: false, detail: { code: 0 } });
234
- const t2 = (_b = (_a = b.cache.getAuiVueDefined(this.tagName)) == null ? void 0 : _a.origin) == null ? void 0 : _b.auiInit;
235
- t2 && t2.call(e2);
236
- }
237
- $call(e2, ...t2) {
238
- const n2 = this[_AuiComponent.shadowSymbol].ref;
239
- return b.$call(n2, e2, ...t2);
240
- }
241
- };
242
- _AuiComponent.shadowSymbol = f;
243
- let AuiComponent = _AuiComponent;
244
- class $ extends HTMLElement {
245
- constructor() {
246
- super();
247
- }
248
- connectedCallback() {
249
- this.style.display = "none";
250
- }
251
- set textContent(e2) {
252
- var _a;
253
- this._name_ ? (_a = this._el_) == null ? void 0 : _a.$textContent(this._name_, e2) : super.textContent = e2;
254
- }
255
- set innerHTML(e2) {
256
- var _a;
257
- this._name_ ? (_a = this._el_) == null ? void 0 : _a.$innerHTML(this._name_, e2) : super.innerHTML = e2;
258
- }
259
- prepend(e2) {
260
- var _a;
261
- this._name_ ? (_a = this._el_) == null ? void 0 : _a.$prepend(this._name_, e2) : super.prepend(e2);
262
- }
263
- appendChild(e2) {
264
- var _a;
265
- return this._name_ ? ((_a = this._el_) == null ? void 0 : _a.$appendChild(this._name_, e2), e2) : super.appendChild(e2);
266
- }
267
- static $isAuiSlot(e2) {
268
- return !(!e2 || e2.nodeType !== Node.ELEMENT_NODE) && "aui-slot" === e2.tagName.toLowerCase();
269
- }
270
- static $isForAuiSlot(e2) {
271
- return !(!$.$isAuiSlot(e2) || !e2.hasAttribute("for"));
272
- }
273
- $bind(e2) {
274
- this._el_ = e2, this._name_ = this.getAttribute("for") || "default";
275
- }
276
- $replace(e2) {
277
- const t2 = this.getAttribute("name") || "default", n2 = document.createComment(`aui-slot-${t2}-start`), r2 = document.createComment(`aui-slot-${t2}-end`);
278
- e2.$slot(t2, { start: n2, end: r2 }), this.replaceWith(n2, r2);
279
- }
280
- }
281
- const b = { init: () => (b.defineSlot(), b), defineSlot() {
282
- b.defineCustomElement("aui-slot", $);
283
- }, $call(e2, t2, ...n2) {
284
- if (!e2) return new Error("not init");
285
- if (!t2) return e2;
286
- if ("function" == typeof e2[t2]) return e2[t2].call(e2, ...n2);
287
- const r2 = t2.split(".");
288
- let o2 = e2, s2 = r2.pop() || "", i2 = null;
289
- for (; i2 = r2.shift(); ) {
290
- if (!Object.prototype.hasOwnProperty.call(o2, i2)) return new Error("no match name");
291
- o2 = o2[i2];
292
- }
293
- return 0 === n2.length ? o2[s2] : (o2[s2] = n2[0], null);
294
- }, formatName: (e2) => e2 ? (e2 = e2.replace(/[A-Z]/g, function(e3) {
295
- return "-" + e3.toLowerCase();
296
- }), d + e2) : "", cache: { defined: {}, getAuiVueDefined: (e2) => (e2 = e2.toLowerCase(), b.cache.defined[e2]), getAuiPropNames(e2) {
297
- var _a;
298
- const t2 = b.cache.getAuiVueDefined(e2), n2 = ((_a = t2 == null ? void 0 : t2.origin) == null ? void 0 : _a.props) || {}, r2 = [];
299
- for (const e3 in n2) r2.push(b.auiAttrName(e3));
300
- return -1 === r2.indexOf(m) && r2.push(m), r2;
301
- }, addHooks(e2, t2) {
302
- e2 = e2.toLowerCase();
303
- const n2 = b.cache.getAuiVueDefined(e2);
304
- n2 ? (n2.hooks = n2.hooks || [], n2.hooks.push(t2)) : b.cache.defined[e2] = { hooks: [t2] };
305
- } }, createExtendComp: (e2) => {
306
- var _a, _b;
307
- return t({ props: { [m]: { type: String }, value: { type: ((_b = (_a = e2.props) == null ? void 0 : _a.value) == null ? void 0 : _b.type) || [String, Number, Array] } }, methods: { $anyToArray: AuiComponent.$anyToArray, $value(...e3) {
308
- const t2 = this.$aui();
309
- if (0 === e3.length) return t2 == null ? void 0 : t2.value;
310
- t2 && (t2.value = e3[0]);
311
- }, $call(e3, ...t2) {
312
- const n2 = this.$aui();
313
- return n2 ? b.$call(n2, e3, ...t2) : null;
314
- }, $aui() {
315
- var _a2;
316
- return (_a2 = this.$el) == null ? void 0 : _a2.parentNode;
317
- } }, data: () => ({}) });
318
- }, patchDefaultProps(e2) {
319
- var _a, _b;
320
- const t2 = (_b = (_a = e2.props) == null ? void 0 : _a.value) == null ? void 0 : _b.type;
321
- return e2.mixins || (e2.mixins = []), e2.mixins.push(b.createExtendComp(e2)), t2;
322
- }, defineAuiComponent(e2, t2, n2) {
323
- var _a, _b;
324
- const r2 = b.patchDefaultProps(n2);
325
- if ((_a = b.cache.defined[e2]) == null ? void 0 : _a.origin) b.cache.defined[e2].origin = n2;
326
- else {
327
- class o2 extends AuiComponent {
328
- constructor() {
329
- super({ valueType: r2 });
330
- }
331
- static get observedAttributes() {
332
- return b.cache.getAuiPropNames(e2);
333
- }
334
- }
335
- b.cache.defined[e2] = { aui: o2, vue: t2, origin: n2, hooks: ((_b = b.cache.defined[e2]) == null ? void 0 : _b.hooks) || [] }, b.defineCustomElement(e2, o2);
336
- }
337
- }, defineCustomElement(e2, t2) {
338
- try {
339
- customElements.define(e2, t2);
340
- } catch (e3) {
341
- }
342
- }, sameComponent(e2, t2) {
343
- if (!Object.prototype.hasOwnProperty.call(t2, "__hmrId")) return false;
344
- const n2 = b.cache.getAuiVueDefined(e2), r2 = n2 == null ? void 0 : n2.origin;
345
- return !!r2 && t2.__hmrId === r2.__hmrId;
346
- }, notifyComponentUpdate(e2) {
347
- document.querySelectorAll(e2).forEach((e3) => {
348
- e3.$forceUpdate();
349
- });
350
- }, define(e2, t2 = true) {
351
- const n2 = b.formatName(e2.name);
352
- if (!n2) return e2;
353
- const r2 = b.cache.getAuiVueDefined(n2);
354
- if (r2 && r2.vue) return (t2 || b.sameComponent(n2, e2)) && (b.defineAuiComponent(n2, r2.vue, e2), b.notifyComponentUpdate(n2)), r2.vue;
355
- const o2 = b.createVueComponent(n2);
356
- return b.defineAuiComponent(n2, o2, e2), o2;
357
- }, createTempSlot(e2) {
358
- const t2 = {};
359
- return Object.keys(e2).forEach((e3) => {
360
- t2[e3] = () => u("aui-slot", { name: e3 });
361
- }), t2;
362
- }, replaceTempSlot(e2, t2) {
363
- Object.keys(t2).forEach((n2) => {
364
- const r2 = e2.querySelector(`aui-slot[name="${n2}"]`);
365
- r2 && ($.prototype.$replace.call(r2, e2), e2.$replaceChildren(n2, t2[n2]));
366
- });
367
- }, createVueComponent(e2, t2) {
368
- const l2 = t2 ? t2.$moveChildren() : { default: [] };
369
- return { setup() {
370
- const h2 = n(), c2 = r(null), d2 = r(null), m2 = o({}), f2 = r(t2 ? b.createTempSlot(l2) : s()), $2 = r(null);
371
- return i(() => {
372
- c2.value && d2.value && d2.value.$bindVue && (d2.value.$bindVue(c2.value), t2 && b.replaceTempSlot(t2, l2), d2.value.addEventListener("aui-attr-change", () => {
373
- d2.value && (m2.value = b.getAuiAttrs(d2.value));
374
- }), d2.value.addEventListener("aui-force-update", () => {
375
- $2.value = null;
376
- }), d2.value.$call("$emit", "update:value", d2.value.value));
377
- }), a(() => {
378
- d2.value && d2.value.$slotReplace();
379
- }), () => {
380
- if (t2 && (d2.value = t2, m2.value = b.getAuiAttrs(t2)), $2.value || ($2.value = b.formatStructure(e2)), !$2.value) return null;
381
- const n2 = u($2.value, { ...h2, ...m2.value, ref: c2 }, f2.value || {});
382
- return t2 ? n2 : u(e2, { ref: d2, [p]: "" }, [n2]);
383
- };
384
- } };
385
- }, getAuiAttrs(e2) {
386
- const t2 = {}, n2 = e2.attributes;
387
- for (let e3 = 0; e3 < n2.length; e3++) {
388
- const r2 = n2[e3];
389
- r2.name === d || b.isVueAttr(r2.name) || (t2[r2.name] = r2.value);
390
- }
391
- return null !== e2.value && (t2.value = e2.value), t2;
392
- }, isVueAttr: (e2) => 0 === e2.indexOf("data-v-"), auiAttrName: (e2) => e2.replace(/([A-Z])/g, (e3) => "-" + e3.toLowerCase()), vueAttrName: (e2) => b.isVueAttr(e2) ? e2 : e2.replace(/-([a-z])/g, (e3, t2) => t2.toUpperCase()), hookStructure(e2, t2) {
393
- b.cache.addHooks(e2, t2);
394
- }, getHookStructure(e2) {
395
- const t2 = b.cache.getAuiVueDefined(e2);
396
- return ((t2 == null ? void 0 : t2.hooks) || []).slice(0);
397
- }, formatStructure(e2) {
398
- const t2 = b.cache.getAuiVueDefined(e2);
399
- if (!(t2 == null ? void 0 : t2.origin)) return null;
400
- let n2 = l({}, t2.origin);
401
- const r2 = b.getHookStructure(e2);
402
- let o2;
403
- for (; o2 = r2.shift(); ) {
404
- const e3 = o2(n2);
405
- e3 && (n2 = e3);
406
- }
407
- return n2;
408
- } }, v = b.init();
409
- export {
410
- AuiComponent,
411
- v as default
412
- };
413
- //# sourceMappingURL=core.es.js.map
1
+ import{createApp as e,defineComponent as t,useAttrs as n,shallowRef as o,ref as r,useSlots as i,onMounted as s,h as l}from"vue";import{merge as a}from"ts-deepmerge";var u,h;const c=function(){try{return __AUI_CONFIG__}catch(e){return{tagPrefix:"aui"}}}().tagPrefix||"aui",d="data-v-aui",p="auix",m=/* @__PURE__ */Symbol("shadow"),f=class t extends(h=HTMLElement,u=m,h){constructor(e){super(),this.__hasVue__=!1,this[u]={needHook:!1,slot:{}},this[t.shadowSymbol].options=e||{},this.$initAttrs()}connectedCallback(){this.$needInit()&&(this.$initVue(),this.$needHook(!0))}set innerHTML(e){this.$needHook()?this.$innerHTML("default",e):Reflect.set(HTMLElement.prototype,"innerHTML",e,this)}get innerHTML(){return this.$needHook()?this.$innerHTML("default"):Reflect.get(HTMLElement.prototype,"innerHTML",this)||""}set textContent(e){this.$needHook()?this.$textContent("default",e):Reflect.set(HTMLElement.prototype,"innerHTML",e,this)}get textContent(){return this.$needHook()?this.$textContent("default"):Reflect.get(HTMLElement.prototype,"innerHTML",this)||""}set innerText(e){this.$ignoreLog("innerText"),Reflect.set(HTMLElement.prototype,"innerText",e,this)}set value(e){let n=e;const o=this[t.shadowSymbol].value;let r;this.$isArrayValue()?(n=t.$anyToArray(e),r=JSON.stringify(n)):r=n.toString(),o!==r&&(this[t.shadowSymbol].value=r,this[t.shadowSymbol].el&&this.$attrChange("value"))}get value(){const e=this[t.shadowSymbol].value;return this.$isArrayValue()&&"string"==typeof e?JSON.parse(e):e}prepend(e){if(!this.$needHook())return HTMLElement.prototype.prepend.call(this,e);this.$prepend("default",e)}appendChild(e){return this.$needHook()?this.$appendChild("default",e):HTMLElement.prototype.appendChild.call(this,e)}insertBefore(e,t){return this.$needHook()?this.$insertBefore("default",e,t):HTMLElement.prototype.insertBefore.call(this,e,t)}hasAttribute(e){const n=this[t.shadowSymbol].el;return n?n.hasAttribute(e):HTMLElement.prototype.hasAttribute.call(this,e)}setAttribute(e,n){n=n.toString();const o=this[t.shadowSymbol].el;if(o){if(o.getAttribute(e)===n)return;o.setAttribute(e,n)}this.$isShowProp(b.vueAttrName(e))&&HTMLElement.prototype.setAttribute.call(this,e,n),"value"===e&&o?this.value=o.getAttribute(e):this.$attrChange(e)}getAttribute(e){const n=this[t.shadowSymbol].el;return n?n.getAttribute(e):super.getAttribute(e)}removeAttribute(e){const n=this[t.shadowSymbol].el;n&&n.removeAttribute(e),this.$isShowProp(b.vueAttrName(e))&&HTMLElement.prototype.removeAttribute.call(this,e),this.$attrChange(e)}attributeChangedCallback(e,n,o){const r=this[t.shadowSymbol].el;r&&n!==o&&(this.$isShowProp(b.vueAttrName(e))||HTMLElement.prototype.removeAttribute.call(this,e),r.setAttribute(e,o||""),"value"!==e&&this.$attrChange(e))}static $anyToArray(e){let t=[];if("string"==typeof e){try{const t=JSON.parse(e);if(t instanceof Array)return t}catch(n){}t=e.split(",").filter(e=>!!e&&e.trim())}else e instanceof Array&&(t=e);return t}$resetShadowSymbol(){this[t.shadowSymbol]={needHook:!1,slot:{}}}$customEvent(e,t){this.dispatchEvent(new CustomEvent(e,Object.assign({bubbles:!1,composed:!1,cancelable:!0},t||{})))}$forceUpdate(){let e=null;const n=this[t.shadowSymbol].slot;for(const t in n){const o=this.$slotCollection(n[t]);e||(e={}),e[t]=o}e&&(this[t.shadowSymbol].slotCollection=e),this.$customEvent("aui-force-update")}$slotCollection(e){var t;const{start:n,end:o}=e,r=[];let i;for(;n&&(i=n.nextSibling)&&i!==o;)null==(t=n.parentNode)||t.removeChild(i),r.push(i);return r}$slotReplace(){const e=this[t.shadowSymbol].slotCollection;if(e){delete this[t.shadowSymbol].slotCollection;for(const t in e)this.querySelector(`aui-slot[name="${t}"]`).$replace(this),this.$replaceChildren(t,e[t])}}$textContent(e,...t){if(0===t.length){const t=[],{start:n,end:o}=this.$slot(e)||{};let r=n;for(;r&&(r=r.nextSibling)&&r!==o;)t.push(r.textContent);return t.join("")}return this.$hasSlot()?(this.$replaceChildren(e,[document.createTextNode(t[0]||"")]),""):""}$innerHTML(e,...t){if(0===t.length){const t=[],{start:n,end:o}=this.$slot(e)||{};let r=n;for(;r&&(r=r.nextSibling)&&r!==o;)if(r.outerHTML)t.push(r.outerHTML);else{let e=r.textContent;r instanceof Comment&&(e=`\x3c!--${e}--\x3e`),t.push(e)}return t.join("")}{if(!this.$hasSlot())return"";const n=document.createElement("div");n.innerHTML=t[0]||"";const o=this.$moveChildren(n);this.$replaceChildren(e,o.default)}return""}$prepend(e,t){var n;const{start:o}=this.$slot(e)||{};null==(n=null==o?void 0:o.parentNode)||n.insertBefore(t,o.nextSibling)}$appendChild(e,t){var n;const{end:o}=this.$slot(e)||{};return null==(n=null==o?void 0:o.parentNode)||n.insertBefore(t,o),t}$insertBefore(e,t,n){const{start:o}=this.$slot(e)||{},r=(null==o?void 0:o.parentNode)||this;return n?r===this?HTMLElement.prototype.insertBefore.call(this,t,n):r.insertBefore(t,n):this.appendChild(t),t}$childNodes(e){const t=[],{start:n,end:o}=this.$slot(e)||{};let r=n;for(;r&&(r=r.nextSibling)&&r!==o;)t.push(r);return t}$children(e){const t=[],{start:n,end:o}=this.$slot(e)||{};let r=n;for(;r&&(r=r.nextSibling)&&r!==o;)r instanceof HTMLElement&&t.push(r);return t}$replaceChildren(e,t){var n,o;const{start:r,end:i}=this.$slot(e)||{};let s=null;for(;r&&(s=r.nextSibling)&&s!==i;)null==(n=s.parentNode)||n.removeChild(s);if(i)for(;s=t.shift();)null==(o=i.parentNode)||o.insertBefore(s,i)}$slot(e,n){if(e=e||"default",!n)return this[t.shadowSymbol].slot[e];this[t.shadowSymbol].slot[e]=n}$hasSlot(){return Object.keys(this[t.shadowSymbol].slot).length>0}$needHook(e){return"boolean"==typeof e&&(this[t.shadowSymbol].needHook=e),this[t.shadowSymbol].needHook}$ignoreLog(e){}$moveChildren(e){var t;const n=(e=e||this).childNodes,o={default:[]};for(;n.length>0;){const r=n[0];if(null==(t=r.parentNode)||t.removeChild(r),$.$isForAuiSlot(r)){const t=r.getAttribute("for")||"default";o[t]=o[t]||[];const n=Array.prototype.slice.call(r.childNodes);$.prototype.$bind.call(r,e),o[t].push(...n)}else o.default.push(r)}return o}$isArrayValue(){var e;return(null==(e=this[t.shadowSymbol].options)?void 0:e.valueType)===Array}$attrChange(e){if("value"===e){const e=this.value;HTMLElement.prototype.hasAttribute.call(this,d)?this.$call("$emit","update:value",e):this.$customEvent("input",{bubbles:!0,composed:!0})}this.$customEvent("aui-attr-change",{bubbles:!0,composed:!0,detail:{attributeName:b.vueAttrName(e)}})}$initAttrs(){const e=this.attributes,n=document.createElement("div");for(let t=0;t<e.length;t++){const o=e[t];n.setAttribute(o.name,o.value),this.$isShowProp(b.vueAttrName(o.name))||HTMLElement.prototype.removeAttribute.call(this,o.name),"value"===o.name&&(this.value=o.value)}Object.defineProperty(this,"attributes",{get value(){return n.attributes},writable:!1}),this[t.shadowSymbol].el=n}$isShowProp(e){if(b.isVueAttr(e))return!0;const t=this.$getProp(e);return null==t?void 0:t.show}$getProp(e){var t;const n=b.cache.getAuiVueDefined(this.tagName);return((null==(t=null==n?void 0:n.origin)?void 0:t.props)||{})[e]}$initVue(){if(this.__hasVue__)return;this.__hasVue__=!0;const t=this.tagName.toLowerCase();b.cache.getAuiVueDefined(t)&&e(b.createVueComponent(t,this)).mount(this)}$needInit(){return!HTMLElement.prototype.hasAttribute.call(this,d)}$bindVue(e){var n,o;if(this[t.shadowSymbol].ref)return;this[t.shadowSymbol].ref=e,this.__hasVue__=!0,this.$customEvent("aui-init",{bubbles:!1,detail:{code:0}});const r=null==(o=null==(n=b.cache.getAuiVueDefined(this.tagName))?void 0:n.origin)?void 0:o.auiInit;r&&r.call(e)}$call(e,...n){const o=this[t.shadowSymbol].ref;return b.$call(o,e,...n)}};f.shadowSymbol=m;let v=f;class $ extends HTMLElement{constructor(){super()}connectedCallback(){this.style.display="none"}set textContent(e){var t;this._name_?null==(t=this._el_)||t.$textContent(this._name_,e):Reflect.set(HTMLElement.prototype,"textContent",e,this)}set innerHTML(e){var t;this._name_?null==(t=this._el_)||t.$innerHTML(this._name_,e):Reflect.set(HTMLElement.prototype,"innerHTML",e,this)}prepend(e){var t;this._name_?null==(t=this._el_)||t.$prepend(this._name_,e):HTMLElement.prototype.prepend.call(this,e)}appendChild(e){var t;return this._name_?(null==(t=this._el_)||t.$appendChild(this._name_,e),e):HTMLElement.prototype.appendChild.call(this,e)}static $isAuiSlot(e){return!(!e||e.nodeType!==Node.ELEMENT_NODE)&&"aui-slot"===e.tagName.toLowerCase()}static $isForAuiSlot(e){return!(!$.$isAuiSlot(e)||!e.hasAttribute("for"))}$bind(e){this._el_=e,this._name_=this.getAttribute("for")||"default"}$replace(e){const t=this.getAttribute("name")||"default",n=document.createComment(`aui-slot-${t}-start`),o=document.createComment(`aui-slot-${t}-end`);e.$slot(t,{start:n,end:o}),this.$replaceWith(n,o)}$replaceWith(...e){var t;e.forEach(e=>{var t;null==(t=this.parentNode)||t.insertBefore(e,this)}),null==(t=this.parentNode)||t.removeChild(this)}}const b={init:()=>(b.defineSlot(),b),defineSlot(){b.defineCustomElement("aui-slot",$)},$call(e,t,...n){if(!e)return new Error("not init");if(!t)return e;if("function"==typeof e[t])return e[t].call(e,...n);const o=t.split(".");let r=e,i=null;const s=o.pop()||"";for(;i=o.shift();){if(!Object.prototype.hasOwnProperty.call(r,i))return new Error("no match name");r=r[i]}return 0===n.length?r[s]:(r[s]=n[0],null)},formatName:e=>e?(e=e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}),c+e):"",cache:{defined:{},getAuiVueDefined:e=>(e=e.toLowerCase(),b.cache.defined[e]),getAuiPropNames(e){var t;const n=b.cache.getAuiVueDefined(e),o=(null==(t=null==n?void 0:n.origin)?void 0:t.props)||{},r=[];for(const i in o)r.push(b.auiAttrName(i));return-1===r.indexOf(p)&&r.push(p),r},addHooks(e,t){e=e.toLowerCase();const n=b.cache.getAuiVueDefined(e);n?(n.hooks=n.hooks||[],n.hooks.push(t)):b.cache.defined[e]={hooks:[t]}}},createExtendComp:e=>{var n,o;return t({props:{[p]:{type:String},value:{type:(null==(o=null==(n=e.props)?void 0:n.value)?void 0:o.type)||[String,Number,Array]}},methods:{$anyToArray:v.$anyToArray,$value(...e){const t=this.$aui();if(0===e.length)return null==t?void 0:t.value;t&&(t.value=e[0])},$call(e,...t){const n=this.$aui();return n?b.$call(n,e,...t):null},$aui(){var e;return null==(e=this.$el)?void 0:e.parentNode}},data:()=>({})})},patchDefaultProps(e){var t,n;const o=null==(n=null==(t=e.props)?void 0:t.value)?void 0:n.type;return e.mixins||(e.mixins=[]),e.mixins.push(b.createExtendComp(e)),o},defineAuiComponent(e,t,n){var o,r;const i=b.patchDefaultProps(n);if(null==(o=b.cache.defined[e])?void 0:o.origin)b.cache.defined[e].origin=n;else{class o extends v{constructor(){super({valueType:i})}static get observedAttributes(){return b.cache.getAuiPropNames(e)}}b.cache.defined[e]={aui:o,vue:t,origin:n,hooks:(null==(r=b.cache.defined[e])?void 0:r.hooks)||[]},b.defineCustomElement(e,o)}},defineCustomElement(e,t){try{customElements.define(e,t)}catch(n){}},sameComponent(e,t){if(!Object.prototype.hasOwnProperty.call(t,"__hmrId"))return!1;const n=b.cache.getAuiVueDefined(e),o=null==n?void 0:n.origin;return!!o&&t.__hmrId===o.__hmrId},notifyComponentUpdate(e){document.querySelectorAll(e).forEach(e=>{e.$forceUpdate()})},define(e,t=!0){const n=b.formatName(e.name);if(!n)return e;const o=b.cache.getAuiVueDefined(n);if(o&&o.vue)return(t||b.sameComponent(n,e))&&(b.defineAuiComponent(n,o.vue,e),b.notifyComponentUpdate(n)),o.vue;const r=b.createVueComponent(n);return b.defineAuiComponent(n,r,e),r},createTempSlot(e){const t={};return Object.keys(e).forEach(n=>{t[n]=()=>l("aui-slot",{name:n,onVnodeMounted(t){const o=t.el;o&&o.$replaceWith&&o.$replaceWith(...e[n])}})}),t},replaceTempSlot(e,t){Object.keys(t).forEach(n=>{const o=e.querySelector(`aui-slot[name="${n}"]`);o&&($.prototype.$replace.call(o,e),e.$replaceChildren(n,t[n]))})},createVueComponent(e,t){const a=t?t.$moveChildren():{default:[]};return{setup(){const u=n(),h=o(null),c=o(null),p=r({}),m=o(t?b.createTempSlot(a):i()),f=o(null);return s(()=>{h.value&&c.value&&c.value.$bindVue&&(c.value.$bindVue(h.value),c.value.addEventListener("aui-attr-change",()=>{c.value&&(p.value=b.getAuiAttrs(c.value))}),c.value.addEventListener("aui-force-update",()=>{f.value=null}),c.value.$call("$emit","update:value",c.value.value))}),()=>{if(t&&(c.value=t,p.value=b.getAuiAttrs(t)),f.value||(f.value=b.formatStructure(e)),!f.value)return null;const n=l(f.value,{...u,...p.value,ref:h},m.value||{});return t?n:l(e,{ref:c,[d]:""},[n])}}}},getAuiAttrs(e){const t={},n=e.attributes;for(let o=0;o<n.length;o++){const e=n[o];e.name===c||b.isVueAttr(e.name)||(t[e.name]=e.value)}return null!==e.value&&(t.value=e.value),t},isVueAttr:e=>0===e.indexOf("data-v-"),auiAttrName:e=>e.replace(/([A-Z])/g,e=>"-"+e.toLowerCase()),vueAttrName:e=>b.isVueAttr(e)?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),hookStructure(e,t){b.cache.addHooks(e,t)},getHookStructure(e){const t=b.cache.getAuiVueDefined(e);return((null==t?void 0:t.hooks)||[]).slice(0)},formatStructure(e){const t=b.cache.getAuiVueDefined(e);if(!(null==t?void 0:t.origin))return null;let n=a({},t.origin);const o=b.getHookStructure(e);let r;for(;r=o.shift();){const e=r(n);e&&(n=e)}return n}},y=b.init();export{v as AuiComponent,$ as AuiSlot,y as default};//# sourceMappingURL=core.es.js.map