@djvlc/runtime-web 1.1.4 → 1.1.5
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/runtime.esm.js +94 -70
- package/dist/runtime.iife.js +1 -1
- package/package.json +2 -2
package/dist/runtime.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const RUNTIME_VERSION = "1.1.
|
|
1
|
+
const RUNTIME_VERSION = "1.1.4";
|
|
2
2
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
3
3
|
ErrorCode2["SYSTEM_INTERNAL_ERROR"] = "SYSTEM_INTERNAL_ERROR";
|
|
4
4
|
ErrorCode2["SYSTEM_SERVICE_UNAVAILABLE"] = "SYSTEM_SERVICE_UNAVAILABLE";
|
|
@@ -2338,7 +2338,7 @@ var $ = v, x = class {
|
|
|
2338
2338
|
if (this.depth++, this.depth > (this.options.maxDepth ?? 100)) throw new h("", "Maximum recursion depth exceeded");
|
|
2339
2339
|
if (Date.now() - this.startTime > (this.options.timeout ?? 1e3)) throw new h("", "Expression evaluation timeout");
|
|
2340
2340
|
}
|
|
2341
|
-
},
|
|
2341
|
+
}, j = class {
|
|
2342
2342
|
constructor(t3 = {}) {
|
|
2343
2343
|
this.astCache = /* @__PURE__ */ new Map(), this.options = { cacheAST: true, maxCacheSize: 1e3, ...t3 }, this.evaluator = new E(t3);
|
|
2344
2344
|
}
|
|
@@ -2421,7 +2421,7 @@ var $ = v, x = class {
|
|
|
2421
2421
|
log(t3, e, ...n) {
|
|
2422
2422
|
this.options.logger ? this.options.logger[t3](e, ...n) : this.options.debug;
|
|
2423
2423
|
}
|
|
2424
|
-
},
|
|
2424
|
+
}, I = class {
|
|
2425
2425
|
constructor(t3) {
|
|
2426
2426
|
this.loadingCount = 0, this.loadingElement = null, this.clipboard = { write: async (t4) => {
|
|
2427
2427
|
try {
|
|
@@ -2831,7 +2831,7 @@ var $ = v, x = class {
|
|
|
2831
2831
|
this.log("debug", "Renderer initialized");
|
|
2832
2832
|
}
|
|
2833
2833
|
render(t3, e) {
|
|
2834
|
-
this.container = e, this.log("debug", "Rendering page", t3.pageId), this.cleanup(), e.innerHTML = "", this.applyPageConfig(t3, e), this.initializePageState(t3);
|
|
2834
|
+
this.container = e, this.log("debug", "Rendering page", t3.pageId), this.cleanup(), e.innerHTML = "", this.applyPageConfig(t3, e), this.applySEO(t3), this.initializePageState(t3);
|
|
2835
2835
|
const n = this.renderNode(t3.root);
|
|
2836
2836
|
n && e.appendChild(n), this.log("info", `Page rendered with root component: ${t3.root.componentType}`);
|
|
2837
2837
|
}
|
|
@@ -2846,7 +2846,7 @@ var $ = v, x = class {
|
|
|
2846
2846
|
return { ...this.expressionContext };
|
|
2847
2847
|
}
|
|
2848
2848
|
destroy() {
|
|
2849
|
-
this.cleanup(), this.container && (this.container.innerHTML = ""), this.log("debug", "Renderer destroyed");
|
|
2849
|
+
this.cleanup(), this.container && (this.container.innerHTML = ""), document.querySelectorAll('[data-djvlc="true"]').forEach((t3) => t3.remove()), this.log("debug", "Renderer destroyed");
|
|
2850
2850
|
}
|
|
2851
2851
|
cleanup() {
|
|
2852
2852
|
this.componentEventListeners.forEach((t3, e) => {
|
|
@@ -3040,6 +3040,30 @@ var $ = v, x = class {
|
|
|
3040
3040
|
const e = [];
|
|
3041
3041
|
return void 0 !== t3.x && e.push(`left: ${t3.x}px`), void 0 !== t3.y && e.push(`top: ${t3.y}px`), void 0 !== t3.width && e.push(`width: ${t3.width}px`), void 0 !== t3.height && e.push(`height: ${t3.height}px`), void 0 !== t3.rotation && e.push(`transform: rotate(${t3.rotation}deg)`), void 0 !== t3.zIndex && e.push(`z-index: ${t3.zIndex}`), e.join("; ");
|
|
3042
3042
|
}
|
|
3043
|
+
applySEO(t3) {
|
|
3044
|
+
const e = t3.seo, n = t3.meta, s = (e == null ? void 0 : e.title) || (n == null ? void 0 : n.title);
|
|
3045
|
+
s && (document.title = s);
|
|
3046
|
+
const i2 = (e == null ? void 0 : e.description) || (n == null ? void 0 : n.description);
|
|
3047
|
+
i2 && this.t("description", i2), (e == null ? void 0 : e.keywords) && e.keywords.length > 0 && this.t("keywords", e.keywords.join(",")), (e == null ? void 0 : e.canonicalUrl) && this.i("canonical", e.canonicalUrl), false === (e == null ? void 0 : e.indexable) && this.t("robots", "noindex, nofollow"), s && this.o("og:title", s), i2 && this.o("og:description", i2), (e == null ? void 0 : e.ogImage) && this.o("og:image", e.ogImage), (e == null ? void 0 : e.ogType) && this.o("og:type", e.ogType), (e == null ? void 0 : e.canonicalUrl) && this.o("og:url", e.canonicalUrl), (e == null ? void 0 : e.structuredData) && Object.keys(e.structuredData).length > 0 && this.l(e.structuredData), this.log("debug", "SEO applied", { title: s, description: i2, keywords: e == null ? void 0 : e.keywords });
|
|
3048
|
+
}
|
|
3049
|
+
t(t3, e) {
|
|
3050
|
+
let n = document.querySelector(`meta[name="${t3}"]`);
|
|
3051
|
+
n || (n = document.createElement("meta"), n.name = t3, document.head.appendChild(n)), n.content = e, n.setAttribute("data-djvlc", "true");
|
|
3052
|
+
}
|
|
3053
|
+
o(t3, e) {
|
|
3054
|
+
let n = document.querySelector(`meta[property="${t3}"]`);
|
|
3055
|
+
n || (n = document.createElement("meta"), n.setAttribute("property", t3), document.head.appendChild(n)), n.content = e, n.setAttribute("data-djvlc", "true");
|
|
3056
|
+
}
|
|
3057
|
+
i(t3, e) {
|
|
3058
|
+
let n = document.querySelector(`link[rel="${t3}"][data-djvlc]`);
|
|
3059
|
+
n || (n = document.createElement("link"), n.rel = t3, document.head.appendChild(n)), n.href = e, n.setAttribute("data-djvlc", "true");
|
|
3060
|
+
}
|
|
3061
|
+
l(t3) {
|
|
3062
|
+
const e = document.querySelector('script[type="application/ld+json"][data-djvlc]');
|
|
3063
|
+
e && e.remove();
|
|
3064
|
+
const n = document.createElement("script");
|
|
3065
|
+
n.type = "application/ld+json", n.setAttribute("data-djvlc", "true"), n.textContent = JSON.stringify(t3), document.head.appendChild(n);
|
|
3066
|
+
}
|
|
3043
3067
|
applyPageConfig(t3, e) {
|
|
3044
3068
|
e.classList.add("djvlc-page"), e.setAttribute("data-page-id", t3.pageId), e.setAttribute("data-page-version", t3.pageVersion), e.setAttribute("data-schema-version", t3.schemaVersion);
|
|
3045
3069
|
const n = t3.config;
|
|
@@ -3217,7 +3241,7 @@ function L(t3, e, n) {
|
|
|
3217
3241
|
Object.defineProperty(t3, e, { get() {
|
|
3218
3242
|
return this[s] ?? n;
|
|
3219
3243
|
}, set(t4) {
|
|
3220
|
-
this[s] = t4, "function" == typeof this.
|
|
3244
|
+
this[s] = t4, "function" == typeof this.u && this.u();
|
|
3221
3245
|
}, configurable: true, enumerable: true });
|
|
3222
3246
|
}
|
|
3223
3247
|
var O = class extends HTMLElement {
|
|
@@ -3225,9 +3249,9 @@ var O = class extends HTMLElement {
|
|
|
3225
3249
|
super(), this.attachShadow({ mode: "open" });
|
|
3226
3250
|
}
|
|
3227
3251
|
connectedCallback() {
|
|
3228
|
-
this.
|
|
3252
|
+
this.u();
|
|
3229
3253
|
}
|
|
3230
|
-
|
|
3254
|
+
u() {
|
|
3231
3255
|
if (!this.shadowRoot) return;
|
|
3232
3256
|
const t3 = this.content ?? "请输入文本", e = this.fontSize ?? 14, n = this.textAlign ?? "left", s = this.fontWeight ?? 400, i2 = this.lineHeight ?? 1.6, r2 = this.color ?? "#333333";
|
|
3233
3257
|
this.shadowRoot.innerHTML = `
|
|
@@ -3247,10 +3271,10 @@ var O = class extends HTMLElement {
|
|
|
3247
3271
|
white-space: pre-wrap;
|
|
3248
3272
|
}
|
|
3249
3273
|
</style>
|
|
3250
|
-
<p class="text">${this.
|
|
3274
|
+
<p class="text">${this.p(t3)}</p>
|
|
3251
3275
|
`;
|
|
3252
3276
|
}
|
|
3253
|
-
|
|
3277
|
+
p(t3) {
|
|
3254
3278
|
return t3.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3255
3279
|
}
|
|
3256
3280
|
};
|
|
@@ -3260,9 +3284,9 @@ var P = class extends HTMLElement {
|
|
|
3260
3284
|
super(), this.attachShadow({ mode: "open" });
|
|
3261
3285
|
}
|
|
3262
3286
|
connectedCallback() {
|
|
3263
|
-
this.
|
|
3287
|
+
this.u();
|
|
3264
3288
|
}
|
|
3265
|
-
|
|
3289
|
+
u() {
|
|
3266
3290
|
if (!this.shadowRoot) return;
|
|
3267
3291
|
const t3 = this.src ?? "", e = this.alt ?? "", n = this.objectFit ?? "cover", s = this.borderRadius ?? 0, i2 = this.placeholder ?? "";
|
|
3268
3292
|
this.shadowRoot.innerHTML = `
|
|
@@ -3282,10 +3306,10 @@ var P = class extends HTMLElement {
|
|
|
3282
3306
|
border-radius: ${s}px;
|
|
3283
3307
|
}
|
|
3284
3308
|
</style>
|
|
3285
|
-
${t3 ? `<img src="${this.
|
|
3309
|
+
${t3 ? `<img src="${this.m(t3)}" alt="${this.m(e)}" loading="lazy" />` : `<div class="placeholder">${i2 || "暂无图片"}</div>`}
|
|
3286
3310
|
`;
|
|
3287
3311
|
}
|
|
3288
|
-
|
|
3312
|
+
m(t3) {
|
|
3289
3313
|
return t3.replace(/"/g, """).replace(/</g, "<");
|
|
3290
3314
|
}
|
|
3291
3315
|
};
|
|
@@ -3295,9 +3319,9 @@ var V = class extends HTMLElement {
|
|
|
3295
3319
|
super(), this.attachShadow({ mode: "open" });
|
|
3296
3320
|
}
|
|
3297
3321
|
connectedCallback() {
|
|
3298
|
-
this.
|
|
3322
|
+
this.u();
|
|
3299
3323
|
}
|
|
3300
|
-
|
|
3324
|
+
u() {
|
|
3301
3325
|
if (!this.shadowRoot) return;
|
|
3302
3326
|
const t3 = this.text ?? "按钮", e = this.type ?? "primary", n = this.size ?? "middle", s = this.block ?? false, i2 = this.shape ?? "default", r2 = this.disabled ?? false, o2 = { small: { h: 28, px: 12, fs: 12 }, middle: { h: 36, px: 16, fs: 14 }, large: { h: 44, px: 20, fs: 16 } }, a2 = o2[n] || o2.middle, c2 = { primary: { bg: "#1677ff", fg: "#fff", border: "#1677ff", hoverBg: "#4096ff" }, default: { bg: "#fff", fg: "#333", border: "#d9d9d9", hoverBg: "#f5f5f5" }, danger: { bg: "#ff4d4f", fg: "#fff", border: "#ff4d4f", hoverBg: "#ff7875" }, link: { bg: "transparent", fg: "#1677ff", border: "transparent", hoverBg: "transparent" } }, h2 = c2[e] || c2.primary, l2 = "round" === i2 ? a2.h / 2 + "px" : "circle" === i2 ? "50%" : "6px";
|
|
3303
3327
|
this.shadowRoot.innerHTML = `
|
|
@@ -3323,14 +3347,14 @@ var V = class extends HTMLElement {
|
|
|
3323
3347
|
transform: scale(0.97);
|
|
3324
3348
|
}
|
|
3325
3349
|
</style>
|
|
3326
|
-
<button ${r2 ? "disabled" : ""}>${this.
|
|
3350
|
+
<button ${r2 ? "disabled" : ""}>${this.p(t3)}</button>
|
|
3327
3351
|
`;
|
|
3328
3352
|
const d2 = this.shadowRoot.querySelector("button");
|
|
3329
3353
|
d2 == null ? void 0 : d2.addEventListener("click", (t4) => {
|
|
3330
3354
|
r2 || this.dispatchEvent(new CustomEvent("onClick", { detail: { originalEvent: t4 }, bubbles: true, composed: true }));
|
|
3331
3355
|
});
|
|
3332
3356
|
}
|
|
3333
|
-
|
|
3357
|
+
p(t3) {
|
|
3334
3358
|
return t3.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
3335
3359
|
}
|
|
3336
3360
|
};
|
|
@@ -3340,9 +3364,9 @@ var B = class extends HTMLElement {
|
|
|
3340
3364
|
super(), this.attachShadow({ mode: "open" });
|
|
3341
3365
|
}
|
|
3342
3366
|
connectedCallback() {
|
|
3343
|
-
this.
|
|
3367
|
+
this.u();
|
|
3344
3368
|
}
|
|
3345
|
-
|
|
3369
|
+
u() {
|
|
3346
3370
|
if (!this.shadowRoot) return;
|
|
3347
3371
|
const t3 = this.name ?? "star", e = this.size ?? 16, n = this.color ?? "currentColor";
|
|
3348
3372
|
this.shadowRoot.innerHTML = `
|
|
@@ -3360,9 +3384,9 @@ var U = class extends HTMLElement {
|
|
|
3360
3384
|
super(), this.attachShadow({ mode: "open" });
|
|
3361
3385
|
}
|
|
3362
3386
|
connectedCallback() {
|
|
3363
|
-
this.
|
|
3387
|
+
this.u();
|
|
3364
3388
|
}
|
|
3365
|
-
|
|
3389
|
+
u() {
|
|
3366
3390
|
if (!this.shadowRoot) return;
|
|
3367
3391
|
const t3 = this.href ?? "#", e = this.text ?? "链接", n = this.target ?? "_self", s = this.color ?? "#1677ff", i2 = false !== this.underline;
|
|
3368
3392
|
this.shadowRoot.innerHTML = `
|
|
@@ -3375,26 +3399,26 @@ var U = class extends HTMLElement {
|
|
|
3375
3399
|
}
|
|
3376
3400
|
a:hover { opacity: 0.8; }
|
|
3377
3401
|
</style>
|
|
3378
|
-
<a href="${t3}" target="${n}" rel="noopener noreferrer">${this.
|
|
3402
|
+
<a href="${t3}" target="${n}" rel="noopener noreferrer">${this.p(e)}</a>
|
|
3379
3403
|
`;
|
|
3380
3404
|
const r2 = this.shadowRoot.querySelector("a");
|
|
3381
3405
|
r2 == null ? void 0 : r2.addEventListener("click", (e2) => {
|
|
3382
3406
|
this.dispatchEvent(new CustomEvent("onClick", { detail: { href: t3, originalEvent: e2 }, bubbles: true, composed: true }));
|
|
3383
3407
|
});
|
|
3384
3408
|
}
|
|
3385
|
-
|
|
3409
|
+
p(t3) {
|
|
3386
3410
|
return t3.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
3387
3411
|
}
|
|
3388
3412
|
};
|
|
3389
3413
|
L(U.prototype, "href", "#"), L(U.prototype, "text", "链接"), L(U.prototype, "target", "_self"), L(U.prototype, "color", "#1677ff"), L(U.prototype, "underline", true);
|
|
3390
|
-
var
|
|
3414
|
+
var _ = class extends HTMLElement {
|
|
3391
3415
|
constructor() {
|
|
3392
3416
|
super(), this.attachShadow({ mode: "open" });
|
|
3393
3417
|
}
|
|
3394
3418
|
connectedCallback() {
|
|
3395
|
-
this.
|
|
3419
|
+
this.u();
|
|
3396
3420
|
}
|
|
3397
|
-
|
|
3421
|
+
u() {
|
|
3398
3422
|
if (!this.shadowRoot) return;
|
|
3399
3423
|
const t3 = this.direction ?? "horizontal", e = this.color ?? "#e8e8e8", n = this.thickness ?? 1, s = this.dashed ?? false, i2 = this.text ?? "", r2 = s ? "dashed" : "solid";
|
|
3400
3424
|
this.shadowRoot.innerHTML = "vertical" === t3 ? `
|
|
@@ -3424,23 +3448,23 @@ var z = class extends HTMLElement {
|
|
|
3424
3448
|
`;
|
|
3425
3449
|
}
|
|
3426
3450
|
};
|
|
3427
|
-
function
|
|
3451
|
+
function z(t3, e, n) {
|
|
3428
3452
|
const s = `__${e}`;
|
|
3429
3453
|
Object.defineProperty(t3, e, { get() {
|
|
3430
3454
|
return this[s] ?? n;
|
|
3431
3455
|
}, set(t4) {
|
|
3432
|
-
this[s] = t4, "function" == typeof this.
|
|
3456
|
+
this[s] = t4, "function" == typeof this.u && this.u();
|
|
3433
3457
|
}, configurable: true, enumerable: true });
|
|
3434
3458
|
}
|
|
3435
|
-
L(
|
|
3459
|
+
L(_.prototype, "direction", "horizontal"), L(_.prototype, "color", "#e8e8e8"), L(_.prototype, "thickness", 1), L(_.prototype, "dashed", false), L(_.prototype, "text", "");
|
|
3436
3460
|
var H = class extends HTMLElement {
|
|
3437
3461
|
constructor() {
|
|
3438
3462
|
super(), this.attachShadow({ mode: "open" });
|
|
3439
3463
|
}
|
|
3440
3464
|
connectedCallback() {
|
|
3441
|
-
this.
|
|
3465
|
+
this.u();
|
|
3442
3466
|
}
|
|
3443
|
-
|
|
3467
|
+
u() {
|
|
3444
3468
|
if (!this.shadowRoot) return;
|
|
3445
3469
|
const t3 = this.background ?? "transparent", e = this.overflow ?? "visible";
|
|
3446
3470
|
this.shadowRoot.innerHTML = `
|
|
@@ -3463,15 +3487,15 @@ var H = class extends HTMLElement {
|
|
|
3463
3487
|
`;
|
|
3464
3488
|
}
|
|
3465
3489
|
};
|
|
3466
|
-
|
|
3490
|
+
z(H.prototype, "direction", "column"), z(H.prototype, "align", "stretch"), z(H.prototype, "justify", "flex-start"), z(H.prototype, "gap", 0), z(H.prototype, "padding", 0), z(H.prototype, "background", "transparent"), z(H.prototype, "overflow", "visible");
|
|
3467
3491
|
var F = class extends HTMLElement {
|
|
3468
3492
|
constructor() {
|
|
3469
3493
|
super(), this.attachShadow({ mode: "open" });
|
|
3470
3494
|
}
|
|
3471
3495
|
connectedCallback() {
|
|
3472
|
-
this.
|
|
3496
|
+
this.u();
|
|
3473
3497
|
}
|
|
3474
|
-
|
|
3498
|
+
u() {
|
|
3475
3499
|
if (!this.shadowRoot) return;
|
|
3476
3500
|
const t3 = this.gutter ?? 0, e = this.align ?? "stretch", n = this.justify ?? "flex-start", s = false !== this.wrap;
|
|
3477
3501
|
this.shadowRoot.innerHTML = `
|
|
@@ -3491,15 +3515,15 @@ var F = class extends HTMLElement {
|
|
|
3491
3515
|
`;
|
|
3492
3516
|
}
|
|
3493
3517
|
};
|
|
3494
|
-
|
|
3518
|
+
z(F.prototype, "gutter", 0), z(F.prototype, "align", "stretch"), z(F.prototype, "justify", "flex-start"), z(F.prototype, "wrap", true);
|
|
3495
3519
|
var q = class extends HTMLElement {
|
|
3496
3520
|
constructor() {
|
|
3497
3521
|
super(), this.attachShadow({ mode: "open" });
|
|
3498
3522
|
}
|
|
3499
3523
|
connectedCallback() {
|
|
3500
|
-
this.
|
|
3524
|
+
this.u();
|
|
3501
3525
|
}
|
|
3502
|
-
|
|
3526
|
+
u() {
|
|
3503
3527
|
if (!this.shadowRoot) return;
|
|
3504
3528
|
const t3 = Math.min(24, Math.max(1, this.span ?? 24)), e = Math.min(23, Math.max(0, this.offset ?? 0)), n = (t3 / 24 * 100).toFixed(4), s = e > 0 ? `${(e / 24 * 100).toFixed(4)}%` : "0";
|
|
3505
3529
|
this.shadowRoot.innerHTML = `
|
|
@@ -3517,15 +3541,15 @@ var q = class extends HTMLElement {
|
|
|
3517
3541
|
`;
|
|
3518
3542
|
}
|
|
3519
3543
|
};
|
|
3520
|
-
|
|
3544
|
+
z(q.prototype, "span", 24), z(q.prototype, "offset", 0);
|
|
3521
3545
|
var K = class extends HTMLElement {
|
|
3522
3546
|
constructor() {
|
|
3523
3547
|
super(), this.attachShadow({ mode: "open" });
|
|
3524
3548
|
}
|
|
3525
3549
|
connectedCallback() {
|
|
3526
|
-
this.
|
|
3550
|
+
this.u();
|
|
3527
3551
|
}
|
|
3528
|
-
|
|
3552
|
+
u() {
|
|
3529
3553
|
if (!this.shadowRoot) return;
|
|
3530
3554
|
const t3 = this.size ?? 16, e = "horizontal" === (this.direction ?? "vertical");
|
|
3531
3555
|
this.shadowRoot.innerHTML = `
|
|
@@ -3540,23 +3564,23 @@ var K = class extends HTMLElement {
|
|
|
3540
3564
|
`;
|
|
3541
3565
|
}
|
|
3542
3566
|
};
|
|
3543
|
-
function
|
|
3567
|
+
function J(t3, e, n) {
|
|
3544
3568
|
const s = `__${e}`;
|
|
3545
3569
|
Object.defineProperty(t3, e, { get() {
|
|
3546
3570
|
return this[s] ?? n;
|
|
3547
3571
|
}, set(t4) {
|
|
3548
|
-
this[s] = t4, "function" == typeof this.
|
|
3572
|
+
this[s] = t4, "function" == typeof this.u && this.u();
|
|
3549
3573
|
}, configurable: true, enumerable: true });
|
|
3550
3574
|
}
|
|
3551
|
-
|
|
3552
|
-
var
|
|
3575
|
+
z(K.prototype, "size", 16), z(K.prototype, "direction", "vertical");
|
|
3576
|
+
var Q = class extends HTMLElement {
|
|
3553
3577
|
constructor() {
|
|
3554
3578
|
super(), this.attachShadow({ mode: "open" });
|
|
3555
3579
|
}
|
|
3556
3580
|
connectedCallback() {
|
|
3557
|
-
this.
|
|
3581
|
+
this.u();
|
|
3558
3582
|
}
|
|
3559
|
-
|
|
3583
|
+
u() {
|
|
3560
3584
|
if (!this.shadowRoot) return;
|
|
3561
3585
|
const t3 = "horizontal" === (this.layout ?? "vertical");
|
|
3562
3586
|
this.shadowRoot.innerHTML = `
|
|
@@ -3592,18 +3616,18 @@ function W(t3, e, n) {
|
|
|
3592
3616
|
Object.defineProperty(t3, e, { get() {
|
|
3593
3617
|
return this[s] ?? n;
|
|
3594
3618
|
}, set(t4) {
|
|
3595
|
-
this[s] = t4, "function" == typeof this.
|
|
3619
|
+
this[s] = t4, "function" == typeof this.u && this.u();
|
|
3596
3620
|
}, configurable: true, enumerable: true });
|
|
3597
3621
|
}
|
|
3598
|
-
Q
|
|
3622
|
+
J(Q.prototype, "layout", "vertical"), J(Q.prototype, "labelWidth", 80), J(Q.prototype, "labelAlign", "right"), J(Q.prototype, "disabled", false);
|
|
3599
3623
|
var Y = class extends HTMLElement {
|
|
3600
3624
|
constructor() {
|
|
3601
3625
|
super(), this.attachShadow({ mode: "open" });
|
|
3602
3626
|
}
|
|
3603
3627
|
connectedCallback() {
|
|
3604
|
-
this.
|
|
3628
|
+
this.u();
|
|
3605
3629
|
}
|
|
3606
|
-
|
|
3630
|
+
u() {
|
|
3607
3631
|
if (!this.shadowRoot) return;
|
|
3608
3632
|
const t3 = this.src ?? "", e = this.size ?? "cover", n = this.position ?? "center", s = this.repeat ?? "no-repeat", i2 = this.opacity ?? 1;
|
|
3609
3633
|
this.shadowRoot.innerHTML = `
|
|
@@ -3642,7 +3666,7 @@ function G(t3, e, n) {
|
|
|
3642
3666
|
Object.defineProperty(t3, e, { get() {
|
|
3643
3667
|
return this[s] ?? n;
|
|
3644
3668
|
}, set(t4) {
|
|
3645
|
-
this[s] = t4, "function" == typeof this.
|
|
3669
|
+
this[s] = t4, "function" == typeof this.u && this.u();
|
|
3646
3670
|
}, configurable: true, enumerable: true });
|
|
3647
3671
|
}
|
|
3648
3672
|
W(Y.prototype, "src", ""), W(Y.prototype, "size", "cover"), W(Y.prototype, "position", "center"), W(Y.prototype, "repeat", "no-repeat"), W(Y.prototype, "opacity", 1);
|
|
@@ -3651,7 +3675,7 @@ var Z = class extends HTMLElement {
|
|
|
3651
3675
|
super(), this.attachShadow({ mode: "open" });
|
|
3652
3676
|
}
|
|
3653
3677
|
connectedCallback() {
|
|
3654
|
-
this.
|
|
3678
|
+
this.u();
|
|
3655
3679
|
}
|
|
3656
3680
|
open() {
|
|
3657
3681
|
this.visible = true;
|
|
@@ -3659,7 +3683,7 @@ var Z = class extends HTMLElement {
|
|
|
3659
3683
|
close() {
|
|
3660
3684
|
this.visible = false;
|
|
3661
3685
|
}
|
|
3662
|
-
|
|
3686
|
+
u() {
|
|
3663
3687
|
if (!this.shadowRoot) return;
|
|
3664
3688
|
const t3 = this.title ?? "", e = this.content ?? "", n = this.variant ?? "center", s = this.visible ?? false, i2 = false !== this.showClose, r2 = false !== this.showConfirm, o2 = this.showCancel ?? false, a2 = this.confirmText ?? "确定", c2 = this.cancelText ?? "取消", h2 = false !== this.maskClosable, l2 = this.maskColor ?? "#000000", d2 = this.maskOpacity ?? 50, u = this.widthPercent ?? 80, p2 = this.borderRadius ?? 12, f2 = this.backgroundColor ?? "#ffffff", m2 = this.backgroundImage ?? "", g2 = "bottom" === n ? "flex-end" : "center", y2 = "fullscreen" === n ? "100%" : `${u}%`, b2 = "fullscreen" === n ? "100%" : "480px", w2 = "fullscreen" === n ? "0" : "bottom" === n ? `${p2}px ${p2}px 0 0` : `${p2}px`, v2 = m2 ? `background-image: url(${m2}); background-size: cover; background-position: center;` : `background: ${f2};`;
|
|
3665
3689
|
this.shadowRoot.innerHTML = `
|
|
@@ -3743,33 +3767,33 @@ var Z = class extends HTMLElement {
|
|
|
3743
3767
|
<div class="mask"></div>
|
|
3744
3768
|
<div class="dialog">
|
|
3745
3769
|
<div class="header">
|
|
3746
|
-
<h3 class="title">${this.
|
|
3770
|
+
<h3 class="title">${this.p(t3)}</h3>
|
|
3747
3771
|
<button class="close-btn">✕</button>
|
|
3748
3772
|
</div>
|
|
3749
3773
|
<div class="body">
|
|
3750
|
-
${this.
|
|
3774
|
+
${this.p(e)}
|
|
3751
3775
|
<slot></slot>
|
|
3752
3776
|
</div>
|
|
3753
3777
|
<div class="footer">
|
|
3754
|
-
<button class="btn btn-cancel">${this.
|
|
3755
|
-
<button class="btn btn-confirm">${this.
|
|
3778
|
+
<button class="btn btn-cancel">${this.p(c2)}</button>
|
|
3779
|
+
<button class="btn btn-confirm">${this.p(a2)}</button>
|
|
3756
3780
|
</div>
|
|
3757
3781
|
</div>
|
|
3758
3782
|
</div>
|
|
3759
3783
|
`;
|
|
3760
3784
|
const $2 = this.shadowRoot.querySelector(".mask"), x2 = this.shadowRoot.querySelector(".close-btn"), k2 = this.shadowRoot.querySelector(".btn-cancel"), S2 = this.shadowRoot.querySelector(".btn-confirm");
|
|
3761
|
-
h2 && ($2 == null ? void 0 : $2.addEventListener("click", () => this.
|
|
3785
|
+
h2 && ($2 == null ? void 0 : $2.addEventListener("click", () => this.v())), x2 == null ? void 0 : x2.addEventListener("click", () => this.v()), k2 == null ? void 0 : k2.addEventListener("click", () => this.$()), S2 == null ? void 0 : S2.addEventListener("click", () => this.k());
|
|
3762
3786
|
}
|
|
3763
|
-
|
|
3787
|
+
v() {
|
|
3764
3788
|
this.visible = false, this.dispatchEvent(new CustomEvent("onClose", { detail: {}, bubbles: true, composed: true }));
|
|
3765
3789
|
}
|
|
3766
|
-
|
|
3790
|
+
$() {
|
|
3767
3791
|
this.visible = false, this.dispatchEvent(new CustomEvent("onCancel", { detail: {}, bubbles: true, composed: true }));
|
|
3768
3792
|
}
|
|
3769
|
-
|
|
3793
|
+
k() {
|
|
3770
3794
|
this.visible = false, this.dispatchEvent(new CustomEvent("onConfirm", { detail: {}, bubbles: true, composed: true }));
|
|
3771
3795
|
}
|
|
3772
|
-
|
|
3796
|
+
p(t3) {
|
|
3773
3797
|
return t3.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
3774
3798
|
}
|
|
3775
3799
|
};
|
|
@@ -3779,9 +3803,9 @@ var X = class extends HTMLElement {
|
|
|
3779
3803
|
super(), this.attachShadow({ mode: "open" });
|
|
3780
3804
|
}
|
|
3781
3805
|
connectedCallback() {
|
|
3782
|
-
this.
|
|
3806
|
+
this.u();
|
|
3783
3807
|
}
|
|
3784
|
-
|
|
3808
|
+
u() {
|
|
3785
3809
|
if (!this.shadowRoot) return;
|
|
3786
3810
|
const t3 = this.text ?? "", e = this.size ?? "default", n = this.color ?? "#1677ff", s = { small: 20, default: 32, large: 48 }, i2 = s[e] || s.default;
|
|
3787
3811
|
this.shadowRoot.innerHTML = `
|
|
@@ -3812,9 +3836,9 @@ var tt = class extends HTMLElement {
|
|
|
3812
3836
|
super(), this.attachShadow({ mode: "open" });
|
|
3813
3837
|
}
|
|
3814
3838
|
connectedCallback() {
|
|
3815
|
-
this.
|
|
3839
|
+
this.u();
|
|
3816
3840
|
}
|
|
3817
|
-
|
|
3841
|
+
u() {
|
|
3818
3842
|
if (!this.shadowRoot) return;
|
|
3819
3843
|
const t3 = this.description ?? "暂无数据", e = this.image ?? "", n = this.imageSize ?? 80, s = `
|
|
3820
3844
|
<svg width="${n}" height="${n}" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -3847,7 +3871,7 @@ var tt = class extends HTMLElement {
|
|
|
3847
3871
|
}
|
|
3848
3872
|
};
|
|
3849
3873
|
G(tt.prototype, "description", "暂无数据"), G(tt.prototype, "image", ""), G(tt.prototype, "imageSize", 80);
|
|
3850
|
-
var et = { "djvlc-text": O, "djvlc-image": P, "djvlc-button": V, "djvlc-icon": B, "djvlc-link": U, "djvlc-divider":
|
|
3874
|
+
var et = { "djvlc-text": O, "djvlc-image": P, "djvlc-button": V, "djvlc-icon": B, "djvlc-link": U, "djvlc-divider": _, "djvlc-container": H, "djvlc-row": F, "djvlc-col": q, "djvlc-spacer": K, "djvlc-form": Q, "djvlc-background-image": Y, "djvlc-dialog": Z, "djvlc-loading": X, "djvlc-empty": tt };
|
|
3851
3875
|
function nt(t3 = false) {
|
|
3852
3876
|
for (const t4 of BUILTIN_COMPONENT_NAMES) {
|
|
3853
3877
|
if (customElements.get(t4)) continue;
|
|
@@ -3927,7 +3951,7 @@ function ot(t3) {
|
|
|
3927
3951
|
var at = class {
|
|
3928
3952
|
constructor(t3) {
|
|
3929
3953
|
if (this.container = null, !t3.pageId) throw new Error("pageId is required");
|
|
3930
|
-
if (this.options = { channel: "prod", debug: false, enableSRI: true, env: "production", ...t3 }, this.logger = this.createLogger(), this.stateManager = new y(), this.eventBus = new w({ debug: t3.debug, logger: this.logger }), this.expressionEngine = new
|
|
3954
|
+
if (this.options = { channel: "prod", debug: false, enableSRI: true, env: "production", ...t3 }, this.logger = this.createLogger(), this.stateManager = new y(), this.eventBus = new w({ debug: t3.debug, logger: this.logger }), this.expressionEngine = new j({ debug: t3.debug, logger: this.logger }), !t3.userApiAdapter) throw new Error("userApiAdapter is required. Inject a UserApiAdapter implementation (e.g. from @djvlc/runtime-web or your host).");
|
|
3931
3955
|
this.userApiAdapter = t3.userApiAdapter, this.pageLoader = new p({ apiBaseUrl: t3.apiBaseUrl, userApiAdapter: this.userApiAdapter, channel: t3.channel, previewToken: t3.previewToken, headers: t3.headers, logger: this.logger }), this.componentLoader = new m({ cdnBaseUrl: t3.cdnBaseUrl, enableSRI: t3.enableSRI, headers: t3.headers, logger: this.logger });
|
|
3932
3956
|
const e = this.safeParseHost(t3.cdnBaseUrl), n = this.safeParseHost(t3.apiBaseUrl);
|
|
3933
3957
|
this.assetLoader = new g({ cdnHosts: e ? [e] : [], apiHosts: n ? [n] : [] }), this.securityManager = new A({ enableSRI: t3.enableSRI, cdnDomains: e ? [e] : [], apiDomains: n ? [n] : [], logger: this.logger }), this.log("info", "Runtime created", { version: rt });
|
|
@@ -4054,7 +4078,7 @@ var at = class {
|
|
|
4054
4078
|
return t3;
|
|
4055
4079
|
}
|
|
4056
4080
|
initHostApi(t3) {
|
|
4057
|
-
this.hostApi = new
|
|
4081
|
+
this.hostApi = new I({ userApiAdapter: this.userApiAdapter, stateManager: this.stateManager, eventBus: this.eventBus, expressionEngine: this.expressionEngine, context: { pageId: t3.pageId, pageVersionId: t3.pageVersionId, runtimeVersion: rt, userId: this.options.userId, deviceId: this.options.deviceId, channel: this.options.channel, appId: this.options.appId || "", env: this.options.env || "production", isEditMode: false, isPreviewMode: t3.isPreview || false }, debug: this.options.debug, logger: this.logger });
|
|
4058
4082
|
}
|
|
4059
4083
|
initActionBridge() {
|
|
4060
4084
|
this.actionBridge = new $({ executor: { executeAction: (t3, e) => this.hostApi.executeAction(t3, e), requestData: (t3, e) => this.hostApi.requestData(t3, e), navigate: (t3) => this.hostApi.navigate(t3), openDialog: (t3) => this.hostApi.openDialog(t3), closeDialog: () => this.hostApi.closeDialog(), showToast: (t3) => this.hostApi.showToast(t3), showLoading: (t3) => this.hostApi.showLoading(t3), hideLoading: () => this.hostApi.hideLoading(), track: (t3) => this.hostApi.track(t3), setState: (t3, e) => this.stateManager.setVariable(t3, e), getState: (t3) => this.stateManager.getVariable(t3), refreshData: (t3) => this.refreshData(t3) }, expressionEngine: this.expressionEngine, debug: this.options.debug, logger: this.logger, onActionStart: (t3, e) => {
|