qc-ui-lit 0.0.1
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/components/AMap/a-map.d.ts +26 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/qc-ui-lit.js +641 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/loadAMap/loadAMap.d.ts +12 -0
- package/package.json +47 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
'a-map': AMap;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export declare class AMap extends LitElement {
|
|
8
|
+
version: string;
|
|
9
|
+
key: string;
|
|
10
|
+
secret: string;
|
|
11
|
+
AMapUrl: string;
|
|
12
|
+
AMapLocaUrl: string;
|
|
13
|
+
plugins: Array<string>;
|
|
14
|
+
viewMode: string;
|
|
15
|
+
zoom: number;
|
|
16
|
+
center: [number, number];
|
|
17
|
+
zooms: [number, number];
|
|
18
|
+
animateEnable: boolean;
|
|
19
|
+
AMap: any;
|
|
20
|
+
map: any;
|
|
21
|
+
protected createRenderRoot(): this;
|
|
22
|
+
constructor();
|
|
23
|
+
firstUpdated(): Promise<void>;
|
|
24
|
+
initAMap(): void;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AMap/a-map';
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#a-map{width:100%;height:100%;position:relative}#a-map .a-map-container{background-color:#0ff;width:100%;height:100%}.amap-logo,.amap-copyright{display:none!important}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
//#region src/tools/loadAMap/loadAMap.ts
|
|
2
|
+
var e, t = {
|
|
3
|
+
version: "2.0",
|
|
4
|
+
key: "94af010abe03a5b2a2f98e6739a11d0c",
|
|
5
|
+
secret: "031abe8352fc9fa9ac8d14a86a5ec1cf"
|
|
6
|
+
};
|
|
7
|
+
function n() {
|
|
8
|
+
return new Promise((t) => {
|
|
9
|
+
let n = document.createElement("script");
|
|
10
|
+
n.innerHTML = `
|
|
11
|
+
window._AMapSecurityConfig = {
|
|
12
|
+
securityJsCode: '${e.secret}',
|
|
13
|
+
};`, document.head.appendChild(n), t(null);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function r() {
|
|
17
|
+
let t = `${e.url}?v=${e.version}&key=${e.key}&plugin=${e.plugins.join(",")}`;
|
|
18
|
+
return new Promise((e, n) => {
|
|
19
|
+
let r = document.createElement("script");
|
|
20
|
+
r.async = !1, r.src = t, r.onerror = n, r.onload = e, document.head.appendChild(r);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function i() {
|
|
24
|
+
let t = `${e.locaUrl}?v=${e.version}&key=${e.key}&plugin=${e.plugins.join(",")}`;
|
|
25
|
+
return new Promise((e, n) => {
|
|
26
|
+
let r = document.createElement("script");
|
|
27
|
+
r.async = !1, r.src = t, r.onerror = n, r.onload = e, document.head.appendChild(r);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
var a = async (a) => {
|
|
31
|
+
e = {
|
|
32
|
+
...a,
|
|
33
|
+
key: a.key || t.key,
|
|
34
|
+
secret: a.secret || t.secret,
|
|
35
|
+
plugins: a.plugins || []
|
|
36
|
+
};
|
|
37
|
+
try {
|
|
38
|
+
let e = window;
|
|
39
|
+
if (await n(), await r(), await i(), e.AMap) a.onLoad && a.onLoad();
|
|
40
|
+
else throw Error("AMap not loaded");
|
|
41
|
+
} catch (e) {
|
|
42
|
+
a.onError && a.onError(e);
|
|
43
|
+
}
|
|
44
|
+
}, o = (e) => (t, n) => {
|
|
45
|
+
n === void 0 ? customElements.define(e, t) : n.addInitializer(() => {
|
|
46
|
+
customElements.define(e, t);
|
|
47
|
+
});
|
|
48
|
+
}, s = globalThis, c = s.ShadowRoot && (s.ShadyCSS === void 0 || s.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, l = Symbol(), u = /* @__PURE__ */ new WeakMap(), d = class {
|
|
49
|
+
constructor(e, t, n) {
|
|
50
|
+
if (this._$cssResult$ = !0, n !== l) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
51
|
+
this.cssText = e, this.t = t;
|
|
52
|
+
}
|
|
53
|
+
get styleSheet() {
|
|
54
|
+
let e = this.o, t = this.t;
|
|
55
|
+
if (c && e === void 0) {
|
|
56
|
+
let n = t !== void 0 && t.length === 1;
|
|
57
|
+
n && (e = u.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && u.set(t, e));
|
|
58
|
+
}
|
|
59
|
+
return e;
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
62
|
+
return this.cssText;
|
|
63
|
+
}
|
|
64
|
+
}, ee = (e) => new d(typeof e == "string" ? e : e + "", void 0, l), te = (e, t) => {
|
|
65
|
+
if (c) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
66
|
+
else for (let n of t) {
|
|
67
|
+
let t = document.createElement("style"), r = s.litNonce;
|
|
68
|
+
r !== void 0 && t.setAttribute("nonce", r), t.textContent = n.cssText, e.appendChild(t);
|
|
69
|
+
}
|
|
70
|
+
}, f = c ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
|
|
71
|
+
let t = "";
|
|
72
|
+
for (let n of e.cssRules) t += n.cssText;
|
|
73
|
+
return ee(t);
|
|
74
|
+
})(e) : e, { is: ne, defineProperty: re, getOwnPropertyDescriptor: ie, getOwnPropertyNames: ae, getOwnPropertySymbols: oe, getPrototypeOf: se } = Object, p = globalThis, m = p.trustedTypes, ce = m ? m.emptyScript : "", le = p.reactiveElementPolyfillSupport, h = (e, t) => e, g = {
|
|
75
|
+
toAttribute(e, t) {
|
|
76
|
+
switch (t) {
|
|
77
|
+
case Boolean:
|
|
78
|
+
e = e ? ce : null;
|
|
79
|
+
break;
|
|
80
|
+
case Object:
|
|
81
|
+
case Array: e = e == null ? e : JSON.stringify(e);
|
|
82
|
+
}
|
|
83
|
+
return e;
|
|
84
|
+
},
|
|
85
|
+
fromAttribute(e, t) {
|
|
86
|
+
let n = e;
|
|
87
|
+
switch (t) {
|
|
88
|
+
case Boolean:
|
|
89
|
+
n = e !== null;
|
|
90
|
+
break;
|
|
91
|
+
case Number:
|
|
92
|
+
n = e === null ? null : Number(e);
|
|
93
|
+
break;
|
|
94
|
+
case Object:
|
|
95
|
+
case Array: try {
|
|
96
|
+
n = JSON.parse(e);
|
|
97
|
+
} catch {
|
|
98
|
+
n = null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return n;
|
|
102
|
+
}
|
|
103
|
+
}, _ = (e, t) => !ne(e, t), v = {
|
|
104
|
+
attribute: !0,
|
|
105
|
+
type: String,
|
|
106
|
+
converter: g,
|
|
107
|
+
reflect: !1,
|
|
108
|
+
useDefault: !1,
|
|
109
|
+
hasChanged: _
|
|
110
|
+
};
|
|
111
|
+
Symbol.metadata ??= Symbol("metadata"), p.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
112
|
+
var y = class extends HTMLElement {
|
|
113
|
+
static addInitializer(e) {
|
|
114
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
115
|
+
}
|
|
116
|
+
static get observedAttributes() {
|
|
117
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
118
|
+
}
|
|
119
|
+
static createProperty(e, t = v) {
|
|
120
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
121
|
+
let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
|
|
122
|
+
r !== void 0 && re(this.prototype, e, r);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
static getPropertyDescriptor(e, t, n) {
|
|
126
|
+
let { get: r, set: i } = ie(this.prototype, e) ?? {
|
|
127
|
+
get() {
|
|
128
|
+
return this[t];
|
|
129
|
+
},
|
|
130
|
+
set(e) {
|
|
131
|
+
this[t] = e;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
get: r,
|
|
136
|
+
set(t) {
|
|
137
|
+
let a = r?.call(this);
|
|
138
|
+
i?.call(this, t), this.requestUpdate(e, a, n);
|
|
139
|
+
},
|
|
140
|
+
configurable: !0,
|
|
141
|
+
enumerable: !0
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
static getPropertyOptions(e) {
|
|
145
|
+
return this.elementProperties.get(e) ?? v;
|
|
146
|
+
}
|
|
147
|
+
static _$Ei() {
|
|
148
|
+
if (this.hasOwnProperty(h("elementProperties"))) return;
|
|
149
|
+
let e = se(this);
|
|
150
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
151
|
+
}
|
|
152
|
+
static finalize() {
|
|
153
|
+
if (this.hasOwnProperty(h("finalized"))) return;
|
|
154
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(h("properties"))) {
|
|
155
|
+
let e = this.properties, t = [...ae(e), ...oe(e)];
|
|
156
|
+
for (let n of t) this.createProperty(n, e[n]);
|
|
157
|
+
}
|
|
158
|
+
let e = this[Symbol.metadata];
|
|
159
|
+
if (e !== null) {
|
|
160
|
+
let t = litPropertyMetadata.get(e);
|
|
161
|
+
if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
|
|
162
|
+
}
|
|
163
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
164
|
+
for (let [e, t] of this.elementProperties) {
|
|
165
|
+
let n = this._$Eu(e, t);
|
|
166
|
+
n !== void 0 && this._$Eh.set(n, e);
|
|
167
|
+
}
|
|
168
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
169
|
+
}
|
|
170
|
+
static finalizeStyles(e) {
|
|
171
|
+
let t = [];
|
|
172
|
+
if (Array.isArray(e)) {
|
|
173
|
+
let n = new Set(e.flat(Infinity).reverse());
|
|
174
|
+
for (let e of n) t.unshift(f(e));
|
|
175
|
+
} else e !== void 0 && t.push(f(e));
|
|
176
|
+
return t;
|
|
177
|
+
}
|
|
178
|
+
static _$Eu(e, t) {
|
|
179
|
+
let n = t.attribute;
|
|
180
|
+
return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
181
|
+
}
|
|
182
|
+
constructor() {
|
|
183
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
184
|
+
}
|
|
185
|
+
_$Ev() {
|
|
186
|
+
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
|
|
187
|
+
}
|
|
188
|
+
addController(e) {
|
|
189
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
190
|
+
}
|
|
191
|
+
removeController(e) {
|
|
192
|
+
this._$EO?.delete(e);
|
|
193
|
+
}
|
|
194
|
+
_$E_() {
|
|
195
|
+
let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
196
|
+
for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
|
|
197
|
+
e.size > 0 && (this._$Ep = e);
|
|
198
|
+
}
|
|
199
|
+
createRenderRoot() {
|
|
200
|
+
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
201
|
+
return te(e, this.constructor.elementStyles), e;
|
|
202
|
+
}
|
|
203
|
+
connectedCallback() {
|
|
204
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
205
|
+
}
|
|
206
|
+
enableUpdating(e) {}
|
|
207
|
+
disconnectedCallback() {
|
|
208
|
+
this._$EO?.forEach((e) => e.hostDisconnected?.());
|
|
209
|
+
}
|
|
210
|
+
attributeChangedCallback(e, t, n) {
|
|
211
|
+
this._$AK(e, n);
|
|
212
|
+
}
|
|
213
|
+
_$ET(e, t) {
|
|
214
|
+
let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
|
|
215
|
+
if (r !== void 0 && !0 === n.reflect) {
|
|
216
|
+
let i = (n.converter?.toAttribute === void 0 ? g : n.converter).toAttribute(t, n.type);
|
|
217
|
+
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
_$AK(e, t) {
|
|
221
|
+
let n = this.constructor, r = n._$Eh.get(e);
|
|
222
|
+
if (r !== void 0 && this._$Em !== r) {
|
|
223
|
+
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? g : e.converter;
|
|
224
|
+
this._$Em = r;
|
|
225
|
+
let a = i.fromAttribute(t, e.type);
|
|
226
|
+
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
requestUpdate(e, t, n, r = !1, i) {
|
|
230
|
+
if (e !== void 0) {
|
|
231
|
+
let a = this.constructor;
|
|
232
|
+
if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? _)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
|
|
233
|
+
this.C(e, t, n);
|
|
234
|
+
}
|
|
235
|
+
!1 === this.isUpdatePending && (this._$ES = this._$EP());
|
|
236
|
+
}
|
|
237
|
+
C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
|
|
238
|
+
n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
239
|
+
}
|
|
240
|
+
async _$EP() {
|
|
241
|
+
this.isUpdatePending = !0;
|
|
242
|
+
try {
|
|
243
|
+
await this._$ES;
|
|
244
|
+
} catch (e) {
|
|
245
|
+
Promise.reject(e);
|
|
246
|
+
}
|
|
247
|
+
let e = this.scheduleUpdate();
|
|
248
|
+
return e != null && await e, !this.isUpdatePending;
|
|
249
|
+
}
|
|
250
|
+
scheduleUpdate() {
|
|
251
|
+
return this.performUpdate();
|
|
252
|
+
}
|
|
253
|
+
performUpdate() {
|
|
254
|
+
if (!this.isUpdatePending) return;
|
|
255
|
+
if (!this.hasUpdated) {
|
|
256
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
257
|
+
for (let [e, t] of this._$Ep) this[e] = t;
|
|
258
|
+
this._$Ep = void 0;
|
|
259
|
+
}
|
|
260
|
+
let e = this.constructor.elementProperties;
|
|
261
|
+
if (e.size > 0) for (let [t, n] of e) {
|
|
262
|
+
let { wrapped: e } = n, r = this[t];
|
|
263
|
+
!0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
let e = !1, t = this._$AL;
|
|
267
|
+
try {
|
|
268
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
|
|
269
|
+
} catch (t) {
|
|
270
|
+
throw e = !1, this._$EM(), t;
|
|
271
|
+
}
|
|
272
|
+
e && this._$AE(t);
|
|
273
|
+
}
|
|
274
|
+
willUpdate(e) {}
|
|
275
|
+
_$AE(e) {
|
|
276
|
+
this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
277
|
+
}
|
|
278
|
+
_$EM() {
|
|
279
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
280
|
+
}
|
|
281
|
+
get updateComplete() {
|
|
282
|
+
return this.getUpdateComplete();
|
|
283
|
+
}
|
|
284
|
+
getUpdateComplete() {
|
|
285
|
+
return this._$ES;
|
|
286
|
+
}
|
|
287
|
+
shouldUpdate(e) {
|
|
288
|
+
return !0;
|
|
289
|
+
}
|
|
290
|
+
update(e) {
|
|
291
|
+
this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
|
|
292
|
+
}
|
|
293
|
+
updated(e) {}
|
|
294
|
+
firstUpdated(e) {}
|
|
295
|
+
};
|
|
296
|
+
y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[h("elementProperties")] = /* @__PURE__ */ new Map(), y[h("finalized")] = /* @__PURE__ */ new Map(), le?.({ ReactiveElement: y }), (p.reactiveElementVersions ??= []).push("2.1.2");
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region node_modules/@lit/reactive-element/decorators/property.js
|
|
299
|
+
var b = {
|
|
300
|
+
attribute: !0,
|
|
301
|
+
type: String,
|
|
302
|
+
converter: g,
|
|
303
|
+
reflect: !1,
|
|
304
|
+
hasChanged: _
|
|
305
|
+
}, ue = (e = b, t, n) => {
|
|
306
|
+
let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
|
|
307
|
+
if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
|
|
308
|
+
let { name: r } = n;
|
|
309
|
+
return {
|
|
310
|
+
set(n) {
|
|
311
|
+
let i = t.get.call(this);
|
|
312
|
+
t.set.call(this, n), this.requestUpdate(r, i, e, !0, n);
|
|
313
|
+
},
|
|
314
|
+
init(t) {
|
|
315
|
+
return t !== void 0 && this.C(r, void 0, e, t), t;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
if (r === "setter") {
|
|
320
|
+
let { name: r } = n;
|
|
321
|
+
return function(n) {
|
|
322
|
+
let i = this[r];
|
|
323
|
+
t.call(this, n), this.requestUpdate(r, i, e, !0, n);
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
throw Error("Unsupported decorator location: " + r);
|
|
327
|
+
};
|
|
328
|
+
function x(e) {
|
|
329
|
+
return (t, n) => typeof n == "object" ? ue(e, t, n) : ((e, t, n) => {
|
|
330
|
+
let r = t.hasOwnProperty(n);
|
|
331
|
+
return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
|
|
332
|
+
})(e, t, n);
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region node_modules/lit-html/lit-html.js
|
|
336
|
+
var S = globalThis, C = (e) => e, w = S.trustedTypes, T = w ? w.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, E = "$lit$", D = `lit$${Math.random().toFixed(9).slice(2)}$`, O = "?" + D, de = `<${O}>`, k = document, A = () => k.createComment(""), j = (e) => e === null || typeof e != "object" && typeof e != "function", M = Array.isArray, fe = (e) => M(e) || typeof e?.[Symbol.iterator] == "function", N = "[ \n\f\r]", P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, F = /-->/g, I = />/g, L = RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), R = /'/g, z = /"/g, B = /^(?:script|style|textarea|title)$/i, pe = ((e) => (t, ...n) => ({
|
|
337
|
+
_$litType$: e,
|
|
338
|
+
strings: t,
|
|
339
|
+
values: n
|
|
340
|
+
}))(1), V = Symbol.for("lit-noChange"), H = Symbol.for("lit-nothing"), U = /* @__PURE__ */ new WeakMap(), W = k.createTreeWalker(k, 129);
|
|
341
|
+
function G(e, t) {
|
|
342
|
+
if (!M(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
343
|
+
return T === void 0 ? t : T.createHTML(t);
|
|
344
|
+
}
|
|
345
|
+
var me = (e, t) => {
|
|
346
|
+
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = P;
|
|
347
|
+
for (let t = 0; t < n; t++) {
|
|
348
|
+
let n = e[t], s, c, l = -1, u = 0;
|
|
349
|
+
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === P ? c[1] === "!--" ? o = F : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = L) : (B.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = L) : o = I : o === L ? c[0] === ">" ? (o = i ?? P, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? L : c[3] === "\"" ? z : R) : o === z || o === R ? o = L : o === F || o === I ? o = P : (o = L, i = void 0);
|
|
350
|
+
let d = o === L && e[t + 1].startsWith("/>") ? " " : "";
|
|
351
|
+
a += o === P ? n + de : l >= 0 ? (r.push(s), n.slice(0, l) + E + n.slice(l) + D + d) : n + D + (l === -2 ? t : d);
|
|
352
|
+
}
|
|
353
|
+
return [G(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
354
|
+
}, K = class e {
|
|
355
|
+
constructor({ strings: t, _$litType$: n }, r) {
|
|
356
|
+
let i;
|
|
357
|
+
this.parts = [];
|
|
358
|
+
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = me(t, n);
|
|
359
|
+
if (this.el = e.createElement(l, r), W.currentNode = this.el.content, n === 2 || n === 3) {
|
|
360
|
+
let e = this.el.content.firstChild;
|
|
361
|
+
e.replaceWith(...e.childNodes);
|
|
362
|
+
}
|
|
363
|
+
for (; (i = W.nextNode()) !== null && c.length < s;) {
|
|
364
|
+
if (i.nodeType === 1) {
|
|
365
|
+
if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(E)) {
|
|
366
|
+
let t = u[o++], n = i.getAttribute(e).split(D), r = /([.?@])?(.*)/.exec(t);
|
|
367
|
+
c.push({
|
|
368
|
+
type: 1,
|
|
369
|
+
index: a,
|
|
370
|
+
name: r[2],
|
|
371
|
+
strings: n,
|
|
372
|
+
ctor: r[1] === "." ? ge : r[1] === "?" ? _e : r[1] === "@" ? ve : Y
|
|
373
|
+
}), i.removeAttribute(e);
|
|
374
|
+
} else e.startsWith(D) && (c.push({
|
|
375
|
+
type: 6,
|
|
376
|
+
index: a
|
|
377
|
+
}), i.removeAttribute(e));
|
|
378
|
+
if (B.test(i.tagName)) {
|
|
379
|
+
let e = i.textContent.split(D), t = e.length - 1;
|
|
380
|
+
if (t > 0) {
|
|
381
|
+
i.textContent = w ? w.emptyScript : "";
|
|
382
|
+
for (let n = 0; n < t; n++) i.append(e[n], A()), W.nextNode(), c.push({
|
|
383
|
+
type: 2,
|
|
384
|
+
index: ++a
|
|
385
|
+
});
|
|
386
|
+
i.append(e[t], A());
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
} else if (i.nodeType === 8) if (i.data === O) c.push({
|
|
390
|
+
type: 2,
|
|
391
|
+
index: a
|
|
392
|
+
});
|
|
393
|
+
else {
|
|
394
|
+
let e = -1;
|
|
395
|
+
for (; (e = i.data.indexOf(D, e + 1)) !== -1;) c.push({
|
|
396
|
+
type: 7,
|
|
397
|
+
index: a
|
|
398
|
+
}), e += D.length - 1;
|
|
399
|
+
}
|
|
400
|
+
a++;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
static createElement(e, t) {
|
|
404
|
+
let n = k.createElement("template");
|
|
405
|
+
return n.innerHTML = e, n;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
function q(e, t, n = e, r) {
|
|
409
|
+
if (t === V) return t;
|
|
410
|
+
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = j(t) ? void 0 : t._$litDirective$;
|
|
411
|
+
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = q(e, i._$AS(e, t.values), i, r)), t;
|
|
412
|
+
}
|
|
413
|
+
var he = class {
|
|
414
|
+
constructor(e, t) {
|
|
415
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
416
|
+
}
|
|
417
|
+
get parentNode() {
|
|
418
|
+
return this._$AM.parentNode;
|
|
419
|
+
}
|
|
420
|
+
get _$AU() {
|
|
421
|
+
return this._$AM._$AU;
|
|
422
|
+
}
|
|
423
|
+
u(e) {
|
|
424
|
+
let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? k).importNode(t, !0);
|
|
425
|
+
W.currentNode = r;
|
|
426
|
+
let i = W.nextNode(), a = 0, o = 0, s = n[0];
|
|
427
|
+
for (; s !== void 0;) {
|
|
428
|
+
if (a === s.index) {
|
|
429
|
+
let t;
|
|
430
|
+
s.type === 2 ? t = new J(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new ye(i, this, e)), this._$AV.push(t), s = n[++o];
|
|
431
|
+
}
|
|
432
|
+
a !== s?.index && (i = W.nextNode(), a++);
|
|
433
|
+
}
|
|
434
|
+
return W.currentNode = k, r;
|
|
435
|
+
}
|
|
436
|
+
p(e) {
|
|
437
|
+
let t = 0;
|
|
438
|
+
for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
|
|
439
|
+
}
|
|
440
|
+
}, J = class e {
|
|
441
|
+
get _$AU() {
|
|
442
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
443
|
+
}
|
|
444
|
+
constructor(e, t, n, r) {
|
|
445
|
+
this.type = 2, this._$AH = H, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
446
|
+
}
|
|
447
|
+
get parentNode() {
|
|
448
|
+
let e = this._$AA.parentNode, t = this._$AM;
|
|
449
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
450
|
+
}
|
|
451
|
+
get startNode() {
|
|
452
|
+
return this._$AA;
|
|
453
|
+
}
|
|
454
|
+
get endNode() {
|
|
455
|
+
return this._$AB;
|
|
456
|
+
}
|
|
457
|
+
_$AI(e, t = this) {
|
|
458
|
+
e = q(this, e, t), j(e) ? e === H || e == null || e === "" ? (this._$AH !== H && this._$AR(), this._$AH = H) : e !== this._$AH && e !== V && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? fe(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
|
|
459
|
+
}
|
|
460
|
+
O(e) {
|
|
461
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
462
|
+
}
|
|
463
|
+
T(e) {
|
|
464
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
465
|
+
}
|
|
466
|
+
_(e) {
|
|
467
|
+
this._$AH !== H && j(this._$AH) ? this._$AA.nextSibling.data = e : this.T(k.createTextNode(e)), this._$AH = e;
|
|
468
|
+
}
|
|
469
|
+
$(e) {
|
|
470
|
+
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = K.createElement(G(n.h, n.h[0]), this.options)), n);
|
|
471
|
+
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
472
|
+
else {
|
|
473
|
+
let e = new he(r, this), n = e.u(this.options);
|
|
474
|
+
e.p(t), this.T(n), this._$AH = e;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
_$AC(e) {
|
|
478
|
+
let t = U.get(e.strings);
|
|
479
|
+
return t === void 0 && U.set(e.strings, t = new K(e)), t;
|
|
480
|
+
}
|
|
481
|
+
k(t) {
|
|
482
|
+
M(this._$AH) || (this._$AH = [], this._$AR());
|
|
483
|
+
let n = this._$AH, r, i = 0;
|
|
484
|
+
for (let a of t) i === n.length ? n.push(r = new e(this.O(A()), this.O(A()), this, this.options)) : r = n[i], r._$AI(a), i++;
|
|
485
|
+
i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
|
|
486
|
+
}
|
|
487
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
488
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
|
|
489
|
+
let t = C(e).nextSibling;
|
|
490
|
+
C(e).remove(), e = t;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
setConnected(e) {
|
|
494
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
495
|
+
}
|
|
496
|
+
}, Y = class {
|
|
497
|
+
get tagName() {
|
|
498
|
+
return this.element.tagName;
|
|
499
|
+
}
|
|
500
|
+
get _$AU() {
|
|
501
|
+
return this._$AM._$AU;
|
|
502
|
+
}
|
|
503
|
+
constructor(e, t, n, r, i) {
|
|
504
|
+
this.type = 1, this._$AH = H, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = H;
|
|
505
|
+
}
|
|
506
|
+
_$AI(e, t = this, n, r) {
|
|
507
|
+
let i = this.strings, a = !1;
|
|
508
|
+
if (i === void 0) e = q(this, e, t, 0), a = !j(e) || e !== this._$AH && e !== V, a && (this._$AH = e);
|
|
509
|
+
else {
|
|
510
|
+
let r = e, o, s;
|
|
511
|
+
for (e = i[0], o = 0; o < i.length - 1; o++) s = q(this, r[n + o], t, o), s === V && (s = this._$AH[o]), a ||= !j(s) || s !== this._$AH[o], s === H ? e = H : e !== H && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
|
|
512
|
+
}
|
|
513
|
+
a && !r && this.j(e);
|
|
514
|
+
}
|
|
515
|
+
j(e) {
|
|
516
|
+
e === H ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
517
|
+
}
|
|
518
|
+
}, ge = class extends Y {
|
|
519
|
+
constructor() {
|
|
520
|
+
super(...arguments), this.type = 3;
|
|
521
|
+
}
|
|
522
|
+
j(e) {
|
|
523
|
+
this.element[this.name] = e === H ? void 0 : e;
|
|
524
|
+
}
|
|
525
|
+
}, _e = class extends Y {
|
|
526
|
+
constructor() {
|
|
527
|
+
super(...arguments), this.type = 4;
|
|
528
|
+
}
|
|
529
|
+
j(e) {
|
|
530
|
+
this.element.toggleAttribute(this.name, !!e && e !== H);
|
|
531
|
+
}
|
|
532
|
+
}, ve = class extends Y {
|
|
533
|
+
constructor(e, t, n, r, i) {
|
|
534
|
+
super(e, t, n, r, i), this.type = 5;
|
|
535
|
+
}
|
|
536
|
+
_$AI(e, t = this) {
|
|
537
|
+
if ((e = q(this, e, t, 0) ?? H) === V) return;
|
|
538
|
+
let n = this._$AH, r = e === H && n !== H || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== H && (n === H || r);
|
|
539
|
+
r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
540
|
+
}
|
|
541
|
+
handleEvent(e) {
|
|
542
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
543
|
+
}
|
|
544
|
+
}, ye = class {
|
|
545
|
+
constructor(e, t, n) {
|
|
546
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
|
|
547
|
+
}
|
|
548
|
+
get _$AU() {
|
|
549
|
+
return this._$AM._$AU;
|
|
550
|
+
}
|
|
551
|
+
_$AI(e) {
|
|
552
|
+
q(this, e);
|
|
553
|
+
}
|
|
554
|
+
}, be = S.litHtmlPolyfillSupport;
|
|
555
|
+
be?.(K, J), (S.litHtmlVersions ??= []).push("3.3.2");
|
|
556
|
+
var xe = (e, t, n) => {
|
|
557
|
+
let r = n?.renderBefore ?? t, i = r._$litPart$;
|
|
558
|
+
if (i === void 0) {
|
|
559
|
+
let e = n?.renderBefore ?? null;
|
|
560
|
+
r._$litPart$ = i = new J(t.insertBefore(A(), e), e, void 0, n ?? {});
|
|
561
|
+
}
|
|
562
|
+
return i._$AI(e), i;
|
|
563
|
+
}, X = globalThis, Z = class extends y {
|
|
564
|
+
constructor() {
|
|
565
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
566
|
+
}
|
|
567
|
+
createRenderRoot() {
|
|
568
|
+
let e = super.createRenderRoot();
|
|
569
|
+
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
570
|
+
}
|
|
571
|
+
update(e) {
|
|
572
|
+
let t = this.render();
|
|
573
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = xe(t, this.renderRoot, this.renderOptions);
|
|
574
|
+
}
|
|
575
|
+
connectedCallback() {
|
|
576
|
+
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
577
|
+
}
|
|
578
|
+
disconnectedCallback() {
|
|
579
|
+
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
580
|
+
}
|
|
581
|
+
render() {
|
|
582
|
+
return V;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
Z._$litElement$ = !0, Z.finalized = !0, X.litElementHydrateSupport?.({ LitElement: Z });
|
|
586
|
+
var Se = X.litElementPolyfillSupport;
|
|
587
|
+
Se?.({ LitElement: Z }), (X.litElementVersions ??= []).push("4.2.2");
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region \0@oxc-project+runtime@0.126.0/helpers/decorate.js
|
|
590
|
+
function Q(e, t, n, r) {
|
|
591
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
592
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
593
|
+
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
594
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
595
|
+
}
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/components/AMap/a-map.ts
|
|
598
|
+
var $ = class extends Z {
|
|
599
|
+
createRenderRoot() {
|
|
600
|
+
return this;
|
|
601
|
+
}
|
|
602
|
+
constructor() {
|
|
603
|
+
super(), this.version = "2.0", this.key = "94af010abe03a5b2a2f98e6739a11d0c", this.secret = "031abe8352fc9fa9ac8d14a86a5ec1cf", this.AMapUrl = "https://webapi.amap.com/maps", this.AMapLocaUrl = "https://webapi.amap.com/loca", this.plugins = [], this.viewMode = "2D", this.zoom = 10, this.center = [116.397428, 39.90923], this.zooms = [3, 18], this.animateEnable = !0;
|
|
604
|
+
}
|
|
605
|
+
async firstUpdated() {
|
|
606
|
+
await a({
|
|
607
|
+
key: this.key,
|
|
608
|
+
secret: this.secret,
|
|
609
|
+
version: this.version,
|
|
610
|
+
url: this.AMapUrl,
|
|
611
|
+
locaUrl: this.AMapLocaUrl,
|
|
612
|
+
plugins: this.plugins,
|
|
613
|
+
onLoad: () => {
|
|
614
|
+
this.AMap = window.AMap, this.initAMap();
|
|
615
|
+
},
|
|
616
|
+
onError: (e) => {
|
|
617
|
+
console.error("AMap load error", e);
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
initAMap() {
|
|
622
|
+
let e = this.querySelector(".a-map-container");
|
|
623
|
+
e && (this.map = new this.AMap.Map(e, {
|
|
624
|
+
resizeEnable: !0,
|
|
625
|
+
viewMode: this.viewMode,
|
|
626
|
+
zoom: this.zoom,
|
|
627
|
+
center: this.center,
|
|
628
|
+
zooms: this.zooms,
|
|
629
|
+
animateEnable: this.animateEnable
|
|
630
|
+
}), this.dispatchEvent(new CustomEvent("load", { detail: {
|
|
631
|
+
map: this.map,
|
|
632
|
+
AMap: this.AMap
|
|
633
|
+
} })));
|
|
634
|
+
}
|
|
635
|
+
render() {
|
|
636
|
+
return pe` <section id="a-map"><div class="a-map-container"></div></section>`;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
Q([x({ type: String })], $.prototype, "version", void 0), Q([x({ type: String })], $.prototype, "key", void 0), Q([x({ type: String })], $.prototype, "secret", void 0), Q([x({ type: String })], $.prototype, "AMapUrl", void 0), Q([x({ type: String })], $.prototype, "AMapLocaUrl", void 0), Q([x({ type: Array })], $.prototype, "plugins", void 0), Q([x({ type: String })], $.prototype, "viewMode", void 0), Q([x({ type: Number })], $.prototype, "zoom", void 0), Q([x({ type: Array })], $.prototype, "center", void 0), Q([x({ type: Array })], $.prototype, "zooms", void 0), Q([x({ type: Boolean })], $.prototype, "animateEnable", void 0), $ = Q([o("a-map")], $);
|
|
640
|
+
//#endregion
|
|
641
|
+
export { $ as AMap, a as loadAMap };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Options = {
|
|
2
|
+
version: string;
|
|
3
|
+
key: string;
|
|
4
|
+
secret: string;
|
|
5
|
+
url: string;
|
|
6
|
+
locaUrl: string;
|
|
7
|
+
plugins: string[];
|
|
8
|
+
onLoad?: Function;
|
|
9
|
+
onError?: Function;
|
|
10
|
+
};
|
|
11
|
+
export declare const loadAMap: (options: Options) => Promise<void>;
|
|
12
|
+
export default loadAMap;
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qc-ui-lit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "基于 Lit 的 Web Components 组件库",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": ""
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"web-components",
|
|
13
|
+
"lit",
|
|
14
|
+
"components",
|
|
15
|
+
"amap"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./dist/qc-ui-lit.js",
|
|
19
|
+
"module": "./dist/qc-ui-lit.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/qc-ui-lit.js",
|
|
24
|
+
"types": "./dist/index.d.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
33
|
+
"preview": "vite preview"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^25.6.0",
|
|
38
|
+
"lit": "^3.3.2",
|
|
39
|
+
"postcss": "^8.5.10",
|
|
40
|
+
"postcss-import": "^16.1.1",
|
|
41
|
+
"postcss-loader": "^2.0.8",
|
|
42
|
+
"postcss-preset-env": "^10.1.1",
|
|
43
|
+
"postcss-url": "^7.2.1",
|
|
44
|
+
"typescript": "~6.0.2",
|
|
45
|
+
"vite": "^8.0.9"
|
|
46
|
+
}
|
|
47
|
+
}
|