@mantou/gem 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gem.es.js +367 -369
- package/dist/gem.umd.js +24 -28
- package/elements/base/dialog.d.ts +7 -7
- package/elements/base/dialog.d.ts.map +1 -1
- package/elements/base/dialog.js +10 -3
- package/elements/base/dialog.js.map +1 -1
- package/elements/base/gesture.d.ts +4 -13
- package/elements/base/gesture.d.ts.map +1 -1
- package/elements/base/gesture.js +151 -134
- package/elements/base/gesture.js.map +1 -1
- package/elements/base/link.d.ts +10 -10
- package/elements/base/link.d.ts.map +1 -1
- package/elements/base/link.js +69 -63
- package/elements/base/link.js.map +1 -1
- package/elements/base/modal-factory.d.ts +117 -83
- package/elements/base/modal-factory.d.ts.map +1 -1
- package/elements/base/modal-factory.js +12 -8
- package/elements/base/modal-factory.js.map +1 -1
- package/elements/base/reflect.js.map +1 -1
- package/elements/base/route.d.ts +12 -5
- package/elements/base/route.d.ts.map +1 -1
- package/elements/base/route.js +16 -4
- package/elements/base/route.js.map +1 -1
- package/elements/base/title.d.ts +3 -1
- package/elements/base/title.d.ts.map +1 -1
- package/elements/base/title.js +14 -16
- package/elements/base/title.js.map +1 -1
- package/elements/base/unsafe.js.map +1 -1
- package/elements/base/use.d.ts +1 -1
- package/elements/base/use.d.ts.map +1 -1
- package/elements/base/use.js +27 -17
- package/elements/base/use.js.map +1 -1
- package/helper/i18n.d.ts +2 -2
- package/helper/i18n.d.ts.map +1 -1
- package/helper/i18n.js.map +1 -1
- package/helper/mediaquery.d.ts +16 -18
- package/helper/mediaquery.d.ts.map +1 -1
- package/helper/mediaquery.js +42 -41
- package/helper/mediaquery.js.map +1 -1
- package/helper/request.d.ts +1 -1
- package/helper/request.d.ts.map +1 -1
- package/helper/request.js.map +1 -1
- package/helper/ssr-shim.js.map +1 -1
- package/helper/theme.d.ts +2 -2
- package/helper/theme.d.ts.map +1 -1
- package/helper/theme.js +20 -24
- package/helper/theme.js.map +1 -1
- package/lib/decorators.d.ts +4 -4
- package/lib/decorators.d.ts.map +1 -1
- package/lib/decorators.js +1 -2
- package/lib/decorators.js.map +1 -1
- package/lib/element.d.ts +5 -7
- package/lib/element.d.ts.map +1 -1
- package/lib/element.js +46 -71
- package/lib/element.js.map +1 -1
- package/lib/history.d.ts +1 -1
- package/lib/history.d.ts.map +1 -1
- package/lib/history.js +2 -2
- package/lib/history.js.map +1 -1
- package/lib/store.d.ts +2 -2
- package/lib/store.d.ts.map +1 -1
- package/lib/store.js.map +1 -1
- package/lib/utils.d.ts +8 -32
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +7 -22
- package/lib/utils.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/elements/base/dialog.ts +8 -3
- package/src/elements/base/gesture.ts +51 -45
- package/src/elements/base/link.ts +64 -62
- package/src/elements/base/modal-factory.ts +5 -0
- package/src/elements/base/route.ts +21 -4
- package/src/elements/base/title.ts +8 -11
- package/src/elements/base/use.ts +3 -3
- package/src/helper/mediaquery.ts +43 -42
- package/src/helper/theme.ts +22 -24
- package/src/lib/decorators.ts +1 -2
- package/src/lib/element.ts +38 -63
- package/src/lib/history.ts +2 -1
- package/src/lib/utils.ts +11 -43
- package/src/lib/version.ts +1 -1
- package/src/test/gem-element/advance.test.ts +16 -8
- package/src/test/history.test.ts +3 -1
- package/src/test/utils.test.ts +8 -1
package/dist/gem.es.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
var __accessCheck = (obj, member, msg) => {
|
|
21
2
|
if (!member.has(obj))
|
|
22
3
|
throw TypeError("Cannot " + msg);
|
|
@@ -39,10 +20,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
39
20
|
__accessCheck(obj, member, "access private method");
|
|
40
21
|
return method;
|
|
41
22
|
};
|
|
42
|
-
var _map, _firstItem, _lastItem, _delete, delete_fn, _stringify, _parse, _routeOptions, routeOptions_get, _a, _nextSibling, _parentElement, _inertStore, _b, _cacheCurrentKey, cacheCurrentKey_get, _urlParamsLang, urlParamsLang_get, _cacheLang, cacheLang_get, _isMain, isMain_get, _lang, lang_set;
|
|
43
|
-
var GemExports = /* @__PURE__ */ Object.freeze({
|
|
23
|
+
var _map, _firstItem, _lastItem, _delete, delete_fn, _stringify, _parse, _routeOptions, routeOptions_get, _hint, hint_get, _onClick, _preventDefault, _getHint, _a, _getContent, _nextSibling, _parentElement, _inertStore, _b, _cacheCurrentKey, cacheCurrentKey_get, _urlParamsLang, urlParamsLang_get, _cacheLang, cacheLang_get, _isMain, isMain_get, _lang, lang_set;
|
|
24
|
+
var GemExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
44
25
|
__proto__: null,
|
|
45
|
-
[Symbol.toStringTag]: "Module",
|
|
46
26
|
get GemElement() {
|
|
47
27
|
return GemElement;
|
|
48
28
|
},
|
|
@@ -88,7 +68,7 @@ var GemExports = /* @__PURE__ */ Object.freeze({
|
|
|
88
68
|
get ifDefined() {
|
|
89
69
|
return ifDefined;
|
|
90
70
|
}
|
|
91
|
-
});
|
|
71
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
92
72
|
/**
|
|
93
73
|
* @license
|
|
94
74
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -102,7 +82,7 @@ var GemExports = /* @__PURE__ */ Object.freeze({
|
|
|
102
82
|
* subject to an additional IP rights grant found at
|
|
103
83
|
* http://polymer.github.io/PATENTS.txt
|
|
104
84
|
*/
|
|
105
|
-
const directives = new WeakMap();
|
|
85
|
+
const directives = /* @__PURE__ */ new WeakMap();
|
|
106
86
|
const directive = (f) => (...args) => {
|
|
107
87
|
const d = f(...args);
|
|
108
88
|
directives.set(d, true);
|
|
@@ -226,9 +206,9 @@ class Template {
|
|
|
226
206
|
if (s === "") {
|
|
227
207
|
insert = createMarker();
|
|
228
208
|
} else {
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
s = s.slice(0,
|
|
209
|
+
const match2 = lastAttributeNameRegex.exec(s);
|
|
210
|
+
if (match2 !== null && endsWith(match2[2], boundAttributeSuffix)) {
|
|
211
|
+
s = s.slice(0, match2.index) + match2[1] + match2[2].slice(0, -boundAttributeSuffix.length) + match2[3];
|
|
232
212
|
}
|
|
233
213
|
insert = document.createTextNode(s);
|
|
234
214
|
}
|
|
@@ -805,8 +785,8 @@ function templateFactory(result) {
|
|
|
805
785
|
let templateCache = templateCaches.get(result.type);
|
|
806
786
|
if (templateCache === void 0) {
|
|
807
787
|
templateCache = {
|
|
808
|
-
stringsArray: new WeakMap(),
|
|
809
|
-
keyString: new Map()
|
|
788
|
+
stringsArray: /* @__PURE__ */ new WeakMap(),
|
|
789
|
+
keyString: /* @__PURE__ */ new Map()
|
|
810
790
|
};
|
|
811
791
|
templateCaches.set(result.type, templateCache);
|
|
812
792
|
}
|
|
@@ -823,7 +803,7 @@ function templateFactory(result) {
|
|
|
823
803
|
templateCache.stringsArray.set(result.strings, template);
|
|
824
804
|
return template;
|
|
825
805
|
}
|
|
826
|
-
const templateCaches = new Map();
|
|
806
|
+
const templateCaches = /* @__PURE__ */ new Map();
|
|
827
807
|
/**
|
|
828
808
|
* @license
|
|
829
809
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -837,7 +817,7 @@ const templateCaches = new Map();
|
|
|
837
817
|
* subject to an additional IP rights grant found at
|
|
838
818
|
* http://polymer.github.io/PATENTS.txt
|
|
839
819
|
*/
|
|
840
|
-
const parts = new WeakMap();
|
|
820
|
+
const parts = /* @__PURE__ */ new WeakMap();
|
|
841
821
|
const render = (result, container, options) => {
|
|
842
822
|
let part2 = parts.get(container);
|
|
843
823
|
if (part2 === void 0) {
|
|
@@ -866,7 +846,7 @@ if (typeof window !== "undefined") {
|
|
|
866
846
|
}
|
|
867
847
|
const html = (strings, ...values) => new TemplateResult(strings, values, "html", defaultTemplateProcessor);
|
|
868
848
|
const svg = (strings, ...values) => new SVGTemplateResult(strings, values, "svg", defaultTemplateProcessor);
|
|
869
|
-
const microtaskSet = new Set();
|
|
849
|
+
const microtaskSet = /* @__PURE__ */ new Set();
|
|
870
850
|
function addMicrotask(func) {
|
|
871
851
|
if (typeof func !== "function")
|
|
872
852
|
return;
|
|
@@ -896,14 +876,14 @@ function absoluteLocation(currentPath = "", relativePath = "") {
|
|
|
896
876
|
const { pathname, search, hash } = new URL(relativePath, location.origin + currentPath);
|
|
897
877
|
return pathname + search + hash;
|
|
898
878
|
}
|
|
899
|
-
class LinkedList extends
|
|
879
|
+
class LinkedList extends EventTarget {
|
|
900
880
|
constructor() {
|
|
901
881
|
super(...arguments);
|
|
902
882
|
__privateAdd(this, _delete);
|
|
903
883
|
__privateAdd(this, _map, void 0);
|
|
904
884
|
__privateAdd(this, _firstItem, void 0);
|
|
905
885
|
__privateAdd(this, _lastItem, void 0);
|
|
906
|
-
__privateSet(this, _map, new Map());
|
|
886
|
+
__privateSet(this, _map, /* @__PURE__ */ new Map());
|
|
907
887
|
}
|
|
908
888
|
get size() {
|
|
909
889
|
return __privateGet(this, _map).size;
|
|
@@ -935,7 +915,7 @@ class LinkedList extends (globalThis.EventTarget || Object) {
|
|
|
935
915
|
const firstItem = __privateGet(this, _firstItem);
|
|
936
916
|
if (!firstItem)
|
|
937
917
|
return;
|
|
938
|
-
|
|
918
|
+
this.delete(firstItem.value);
|
|
939
919
|
return firstItem.value;
|
|
940
920
|
}
|
|
941
921
|
}
|
|
@@ -1030,20 +1010,6 @@ function css(arr, ...args) {
|
|
|
1030
1010
|
return raw(arr, ...args);
|
|
1031
1011
|
}
|
|
1032
1012
|
const SheetToken = Symbol.for("gem@sheetToken");
|
|
1033
|
-
let useNativeCSSStyleSheet = true;
|
|
1034
|
-
let CSSStyleSheet = globalThis.CSSStyleSheet;
|
|
1035
|
-
try {
|
|
1036
|
-
new CSSStyleSheet();
|
|
1037
|
-
} catch {
|
|
1038
|
-
useNativeCSSStyleSheet = false;
|
|
1039
|
-
CSSStyleSheet = class {
|
|
1040
|
-
constructor() {
|
|
1041
|
-
this.media = { mediaText: "" };
|
|
1042
|
-
this.style = "";
|
|
1043
|
-
this.replaceSync = (style) => this.style = style;
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
1013
|
function createCSSSheet(rules, mediaQuery2 = "") {
|
|
1048
1014
|
const styleSheet = new CSSStyleSheet();
|
|
1049
1015
|
const sheet = {};
|
|
@@ -1142,21 +1108,29 @@ function objectMapToString(object, separate, toString) {
|
|
|
1142
1108
|
return result;
|
|
1143
1109
|
}
|
|
1144
1110
|
function styleMap(object) {
|
|
1145
|
-
return objectMapToString(
|
|
1111
|
+
return objectMapToString(
|
|
1112
|
+
object,
|
|
1113
|
+
";",
|
|
1114
|
+
(key2, value) => value !== void 0 ? `${camelToKebabCase(key2)}:${value}` : ""
|
|
1115
|
+
);
|
|
1146
1116
|
}
|
|
1147
1117
|
function classMap(object) {
|
|
1148
1118
|
return objectMapToString(object, " ", (key2, value) => value ? key2 : "");
|
|
1149
1119
|
}
|
|
1150
1120
|
const partMap = classMap;
|
|
1151
1121
|
function exportPartsMap(object) {
|
|
1152
|
-
return objectMapToString(
|
|
1122
|
+
return objectMapToString(
|
|
1123
|
+
object,
|
|
1124
|
+
",",
|
|
1125
|
+
(key2, value) => value === true || key2 === value ? key2 : value ? `${key2}:${value}` : ""
|
|
1126
|
+
);
|
|
1153
1127
|
}
|
|
1154
|
-
const StoreListenerMap = new WeakMap();
|
|
1128
|
+
const StoreListenerMap = /* @__PURE__ */ new WeakMap();
|
|
1155
1129
|
function createStore(originStore) {
|
|
1156
1130
|
if (StoreListenerMap.has(originStore)) {
|
|
1157
1131
|
throw new GemError("argument error");
|
|
1158
1132
|
}
|
|
1159
|
-
StoreListenerMap.set(originStore, new Set());
|
|
1133
|
+
StoreListenerMap.set(originStore, /* @__PURE__ */ new Set());
|
|
1160
1134
|
return originStore;
|
|
1161
1135
|
}
|
|
1162
1136
|
function createStoreSet(originStoreSet) {
|
|
@@ -1181,12 +1155,11 @@ function disconnect(store2, func) {
|
|
|
1181
1155
|
const listeners = StoreListenerMap.get(store2);
|
|
1182
1156
|
listeners == null ? void 0 : listeners.delete(func);
|
|
1183
1157
|
}
|
|
1184
|
-
const version = "1.7.
|
|
1185
|
-
var VersionExports = /* @__PURE__ */ Object.freeze({
|
|
1158
|
+
const version = "1.7.3";
|
|
1159
|
+
var VersionExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1186
1160
|
__proto__: null,
|
|
1187
|
-
[Symbol.toStringTag]: "Module",
|
|
1188
1161
|
version
|
|
1189
|
-
});
|
|
1162
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1190
1163
|
/**
|
|
1191
1164
|
* @license
|
|
1192
1165
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -1226,14 +1199,14 @@ const removePart = (part2) => {
|
|
|
1226
1199
|
removeNodes(part2.startNode.parentNode, part2.startNode, part2.endNode.nextSibling);
|
|
1227
1200
|
};
|
|
1228
1201
|
const generateMap = (list, start, end) => {
|
|
1229
|
-
const map = new Map();
|
|
1202
|
+
const map = /* @__PURE__ */ new Map();
|
|
1230
1203
|
for (let i = start; i <= end; i++) {
|
|
1231
1204
|
map.set(list[i], i);
|
|
1232
1205
|
}
|
|
1233
1206
|
return map;
|
|
1234
1207
|
};
|
|
1235
|
-
const partListCache = new WeakMap();
|
|
1236
|
-
const keyListCache = new WeakMap();
|
|
1208
|
+
const partListCache = /* @__PURE__ */ new WeakMap();
|
|
1209
|
+
const keyListCache = /* @__PURE__ */ new WeakMap();
|
|
1237
1210
|
const repeat = directive((items, keyFnOrTemplate, template) => {
|
|
1238
1211
|
let keyFn;
|
|
1239
1212
|
if (template === void 0) {
|
|
@@ -1340,7 +1313,7 @@ const repeat = directive((items, keyFnOrTemplate, template) => {
|
|
|
1340
1313
|
* subject to an additional IP rights grant found at
|
|
1341
1314
|
* http://polymer.github.io/PATENTS.txt
|
|
1342
1315
|
*/
|
|
1343
|
-
const previousValues$1 = new WeakMap();
|
|
1316
|
+
const previousValues$1 = /* @__PURE__ */ new WeakMap();
|
|
1344
1317
|
const guard = directive((value, f) => (part2) => {
|
|
1345
1318
|
const previousValue = previousValues$1.get(part2);
|
|
1346
1319
|
if (Array.isArray(value)) {
|
|
@@ -1366,7 +1339,7 @@ const guard = directive((value, f) => (part2) => {
|
|
|
1366
1339
|
* subject to an additional IP rights grant found at
|
|
1367
1340
|
* http://polymer.github.io/PATENTS.txt
|
|
1368
1341
|
*/
|
|
1369
|
-
const previousValues = new WeakMap();
|
|
1342
|
+
const previousValues = /* @__PURE__ */ new WeakMap();
|
|
1370
1343
|
const ifDefined = directive((value) => (part2) => {
|
|
1371
1344
|
const previousValue = previousValues.get(part2);
|
|
1372
1345
|
if (value === void 0 && part2 instanceof AttributePart) {
|
|
@@ -1397,7 +1370,7 @@ var __privateSet$1 = (obj, member, value, setter) => {
|
|
|
1397
1370
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
1398
1371
|
return value;
|
|
1399
1372
|
};
|
|
1400
|
-
var _renderRoot, _internals, _isAppendReason, _isMounted, _isAsync, _effectList, _memoList, _unmountCallback, _exec, _execEffect, _execMemo, _initEffect, _render, _shouldUpdate, _updateCallback, _update, _updated, _connectedCallback;
|
|
1373
|
+
var _final, _renderRoot, _internals, _isAppendReason, _isMounted, _isAsync, _effectList, _memoList, _unmountCallback, _exec, _execEffect, _execMemo, _initEffect, _render, _shouldUpdate, _updateCallback, _update, _updated, _connectedCallback, _filterEffect;
|
|
1401
1374
|
function emptyFunction() {
|
|
1402
1375
|
}
|
|
1403
1376
|
function execCallback(fun) {
|
|
@@ -1417,7 +1390,7 @@ asyncRenderTaskList.addEventListener("start", () => addMicrotask(tick));
|
|
|
1417
1390
|
const constructorSymbol = Symbol("constructor");
|
|
1418
1391
|
const initSymbol = Symbol("init");
|
|
1419
1392
|
const updateSymbol = Symbol("update");
|
|
1420
|
-
class
|
|
1393
|
+
const _GemElement = class extends HTMLElement {
|
|
1421
1394
|
constructor({ isAsync, isLight, delegatesFocus, slotAssignment } = {}) {
|
|
1422
1395
|
super();
|
|
1423
1396
|
__privateAdd$1(this, _renderRoot, void 0);
|
|
@@ -1489,18 +1462,10 @@ class GemElement extends HTMLElement {
|
|
|
1489
1462
|
});
|
|
1490
1463
|
});
|
|
1491
1464
|
__privateAdd$1(this, _render, () => {
|
|
1492
|
-
var _a2, _b2;
|
|
1493
1465
|
__privateGet$1(this, _execMemo).call(this);
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
</style>
|
|
1498
|
-
`)}`;
|
|
1499
|
-
if (this.render) {
|
|
1500
|
-
const r = this.render();
|
|
1501
|
-
return r && html`${r}${styles}`;
|
|
1502
|
-
}
|
|
1503
|
-
return __privateGet$1(this, _renderRoot) === this ? void 0 : html`<slot></slot>${styles}`;
|
|
1466
|
+
if (this.render)
|
|
1467
|
+
return this.render();
|
|
1468
|
+
return __privateGet$1(this, _renderRoot) === this ? void 0 : html`<slot></slot>`;
|
|
1504
1469
|
});
|
|
1505
1470
|
__privateAdd$1(this, _shouldUpdate, () => {
|
|
1506
1471
|
return this.shouldUpdate ? this.shouldUpdate() : true;
|
|
@@ -1529,11 +1494,11 @@ class GemElement extends HTMLElement {
|
|
|
1529
1494
|
});
|
|
1530
1495
|
__privateAdd$1(this, _connectedCallback, () => {
|
|
1531
1496
|
var _a2, _b2, _c;
|
|
1532
|
-
this[constructorSymbol] = false;
|
|
1533
1497
|
if (__privateGet$1(this, _isAppendReason)) {
|
|
1534
1498
|
__privateSet$1(this, _isAppendReason, false);
|
|
1535
1499
|
return;
|
|
1536
1500
|
}
|
|
1501
|
+
Reflect.set(this, constructorSymbol, false);
|
|
1537
1502
|
(_a2 = this.willMount) == null ? void 0 : _a2.call(this);
|
|
1538
1503
|
const { observedStores, rootElement: rootElement2 } = this.constructor;
|
|
1539
1504
|
observedStores == null ? void 0 : observedStores.forEach((store2) => {
|
|
@@ -1548,14 +1513,18 @@ class GemElement extends HTMLElement {
|
|
|
1548
1513
|
throw new GemError(`not allow current root type`);
|
|
1549
1514
|
}
|
|
1550
1515
|
});
|
|
1551
|
-
this
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1516
|
+
__privateAdd$1(this, _filterEffect, (e) => {
|
|
1517
|
+
e.initialized = false;
|
|
1518
|
+
return e.inConstructor;
|
|
1519
|
+
});
|
|
1520
|
+
addMicrotask(() => Reflect.set(this, initSymbol, false));
|
|
1521
|
+
Reflect.set(this, constructorSymbol, true);
|
|
1522
|
+
Reflect.set(this, initSymbol, true);
|
|
1523
|
+
Reflect.set(this, updateSymbol, () => {
|
|
1555
1524
|
if (__privateGet$1(this, _isMounted)) {
|
|
1556
1525
|
addMicrotask(__privateGet$1(this, _update));
|
|
1557
1526
|
}
|
|
1558
|
-
};
|
|
1527
|
+
});
|
|
1559
1528
|
__privateSet$1(this, _isAsync, isAsync);
|
|
1560
1529
|
__privateSet$1(this, _renderRoot, isLight ? this : this.attachShadow({ mode: "open", delegatesFocus, slotAssignment }));
|
|
1561
1530
|
const { adoptedStyleSheets } = new.target;
|
|
@@ -1564,37 +1533,16 @@ class GemElement extends HTMLElement {
|
|
|
1564
1533
|
if (this.shadowRoot) {
|
|
1565
1534
|
this.shadowRoot.adoptedStyleSheets = sheets;
|
|
1566
1535
|
} else {
|
|
1567
|
-
this.effect(
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
const ele = root === document ? document.body : root;
|
|
1571
|
-
ele._sheets = ele._sheets || {};
|
|
1572
|
-
sheets.forEach(({ style, media }) => {
|
|
1573
|
-
if (ele._sheets[style]) {
|
|
1574
|
-
ele._sheets[style].count++;
|
|
1575
|
-
} else {
|
|
1576
|
-
const s = document.createElement("style");
|
|
1577
|
-
s.innerHTML = style;
|
|
1578
|
-
s.media = media.mediaText;
|
|
1579
|
-
ele.append(s);
|
|
1580
|
-
ele._sheets[style] = { ele: s, count: 1 };
|
|
1581
|
-
}
|
|
1582
|
-
});
|
|
1583
|
-
return () => {
|
|
1584
|
-
sheets.forEach(({ style }) => {
|
|
1585
|
-
ele._sheets[style].count--;
|
|
1586
|
-
if (!ele._sheets[style].count) {
|
|
1587
|
-
delete ele._sheets[style];
|
|
1588
|
-
}
|
|
1589
|
-
});
|
|
1590
|
-
};
|
|
1591
|
-
} else {
|
|
1536
|
+
this.effect(
|
|
1537
|
+
() => {
|
|
1538
|
+
const root = this.getRootNode();
|
|
1592
1539
|
root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];
|
|
1593
1540
|
return () => {
|
|
1594
1541
|
root.adoptedStyleSheets = removeItems(root.adoptedStyleSheets, sheets);
|
|
1595
1542
|
};
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1543
|
+
},
|
|
1544
|
+
() => []
|
|
1545
|
+
);
|
|
1598
1546
|
}
|
|
1599
1547
|
}
|
|
1600
1548
|
}
|
|
@@ -1620,6 +1568,7 @@ class GemElement extends HTMLElement {
|
|
|
1620
1568
|
if (__privateGet$1(this, _isMounted)) {
|
|
1621
1569
|
addMicrotask(__privateGet$1(this, _update));
|
|
1622
1570
|
}
|
|
1571
|
+
return __privateGet$1(_GemElement, _final);
|
|
1623
1572
|
}
|
|
1624
1573
|
closestElement(constructorOrTag) {
|
|
1625
1574
|
const isConstructor = typeof constructorOrTag === "function";
|
|
@@ -1645,6 +1594,10 @@ class GemElement extends HTMLElement {
|
|
|
1645
1594
|
} else {
|
|
1646
1595
|
__privateGet$1(this, _connectedCallback).call(this);
|
|
1647
1596
|
}
|
|
1597
|
+
return __privateGet$1(_GemElement, _final);
|
|
1598
|
+
}
|
|
1599
|
+
adoptedCallback() {
|
|
1600
|
+
return __privateGet$1(_GemElement, _final);
|
|
1648
1601
|
}
|
|
1649
1602
|
disconnectedCallback() {
|
|
1650
1603
|
var _a2, _b2, _c, _d;
|
|
@@ -1659,31 +1612,34 @@ class GemElement extends HTMLElement {
|
|
|
1659
1612
|
});
|
|
1660
1613
|
execCallback(__privateGet$1(this, _unmountCallback));
|
|
1661
1614
|
(_a2 = this.unmounted) == null ? void 0 : _a2.call(this);
|
|
1662
|
-
(_b2 = __privateGet$1(this, _effectList)) == null ? void 0 : _b2.forEach((
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1615
|
+
(_b2 = __privateGet$1(this, _effectList)) == null ? void 0 : _b2.forEach(({ preCallback }) => execCallback(preCallback));
|
|
1616
|
+
__privateSet$1(this, _effectList, (_c = __privateGet$1(this, _effectList)) == null ? void 0 : _c.filter(__privateGet$1(this, _filterEffect)));
|
|
1617
|
+
__privateSet$1(this, _memoList, (_d = __privateGet$1(this, _memoList)) == null ? void 0 : _d.filter(__privateGet$1(this, _filterEffect)));
|
|
1618
|
+
return __privateGet$1(_GemElement, _final);
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
let GemElement = _GemElement;
|
|
1622
|
+
_final = /* @__PURE__ */ new WeakMap();
|
|
1623
|
+
_renderRoot = /* @__PURE__ */ new WeakMap();
|
|
1624
|
+
_internals = /* @__PURE__ */ new WeakMap();
|
|
1625
|
+
_isAppendReason = /* @__PURE__ */ new WeakMap();
|
|
1626
|
+
_isMounted = /* @__PURE__ */ new WeakMap();
|
|
1627
|
+
_isAsync = /* @__PURE__ */ new WeakMap();
|
|
1628
|
+
_effectList = /* @__PURE__ */ new WeakMap();
|
|
1629
|
+
_memoList = /* @__PURE__ */ new WeakMap();
|
|
1630
|
+
_unmountCallback = /* @__PURE__ */ new WeakMap();
|
|
1631
|
+
_exec = /* @__PURE__ */ new WeakMap();
|
|
1632
|
+
_execEffect = /* @__PURE__ */ new WeakMap();
|
|
1633
|
+
_execMemo = /* @__PURE__ */ new WeakMap();
|
|
1634
|
+
_initEffect = /* @__PURE__ */ new WeakMap();
|
|
1635
|
+
_render = /* @__PURE__ */ new WeakMap();
|
|
1636
|
+
_shouldUpdate = /* @__PURE__ */ new WeakMap();
|
|
1637
|
+
_updateCallback = /* @__PURE__ */ new WeakMap();
|
|
1638
|
+
_update = /* @__PURE__ */ new WeakMap();
|
|
1639
|
+
_updated = /* @__PURE__ */ new WeakMap();
|
|
1640
|
+
_connectedCallback = /* @__PURE__ */ new WeakMap();
|
|
1641
|
+
_filterEffect = /* @__PURE__ */ new WeakMap();
|
|
1642
|
+
__privateAdd$1(GemElement, _final, Symbol());
|
|
1687
1643
|
const gemElementProxyMap = new PropProxyMap();
|
|
1688
1644
|
function defineAttribute(target, prop, attr) {
|
|
1689
1645
|
const { booleanAttributes, numberAttributes } = target.constructor;
|
|
@@ -1741,11 +1697,11 @@ function defineProperty(target, prop, event, eventOptions) {
|
|
|
1741
1697
|
if (v !== proxy[prop]) {
|
|
1742
1698
|
if (event) {
|
|
1743
1699
|
proxy[prop] = (v == null ? void 0 : v[isEventHandleSymbol]) ? v : (detail, options) => {
|
|
1744
|
-
const evt = new CustomEvent(event,
|
|
1700
|
+
const evt = new CustomEvent(event, { ...options, ...eventOptions, detail });
|
|
1745
1701
|
that.dispatchEvent(evt);
|
|
1746
1702
|
v(detail, options);
|
|
1747
1703
|
};
|
|
1748
|
-
proxy[prop]
|
|
1704
|
+
Reflect.set(proxy[prop], isEventHandleSymbol, true);
|
|
1749
1705
|
} else {
|
|
1750
1706
|
proxy[prop] = v;
|
|
1751
1707
|
this[updateSymbol]();
|
|
@@ -1768,7 +1724,9 @@ function defineRef(target, prop, ref) {
|
|
|
1768
1724
|
return ref;
|
|
1769
1725
|
},
|
|
1770
1726
|
get element() {
|
|
1771
|
-
const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map(
|
|
1727
|
+
const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map(
|
|
1728
|
+
(e) => e.target
|
|
1729
|
+
);
|
|
1772
1730
|
for (const e of [ele, ...gemReflects]) {
|
|
1773
1731
|
const result = e.querySelector(`[ref=${ref}]`);
|
|
1774
1732
|
if (result)
|
|
@@ -1814,7 +1772,7 @@ customElements.define = (name, cls, options) => {
|
|
|
1814
1772
|
nativeDefineElement(name, cls, options);
|
|
1815
1773
|
};
|
|
1816
1774
|
if (window.__GEM_DEVTOOLS__HOOK__) {
|
|
1817
|
-
Object.assign(window.__GEM_DEVTOOLS__HOOK__,
|
|
1775
|
+
Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...GemExports, ...VersionExports });
|
|
1818
1776
|
}
|
|
1819
1777
|
function pushStaticField(target, field, member, isSet = false) {
|
|
1820
1778
|
const cls = target.constructor;
|
|
@@ -1912,7 +1870,7 @@ const store = createStore({
|
|
|
1912
1870
|
$hasShouldCloseHandle: false,
|
|
1913
1871
|
$key: ""
|
|
1914
1872
|
});
|
|
1915
|
-
const paramsMap = new Map();
|
|
1873
|
+
const paramsMap = /* @__PURE__ */ new Map();
|
|
1916
1874
|
function validData(data) {
|
|
1917
1875
|
const { $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandle } = data || {};
|
|
1918
1876
|
if (store.$key === $key)
|
|
@@ -1942,18 +1900,19 @@ function normalizeParams(params) {
|
|
|
1942
1900
|
const title = params.title || (pathChanged ? "" : document.title);
|
|
1943
1901
|
const statusChanged = params.close || params.data || params.open || params.shouldClose;
|
|
1944
1902
|
const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location.hash) : "");
|
|
1945
|
-
return
|
|
1903
|
+
return { ...params, title, path, query, hash };
|
|
1946
1904
|
}
|
|
1947
1905
|
function updateHistory(p, native) {
|
|
1948
1906
|
validData(p.data);
|
|
1949
1907
|
const params = normalizeParams(p);
|
|
1950
1908
|
const { title, path, query, hash, close, open: open2, shouldClose, data } = params;
|
|
1951
|
-
const state2 =
|
|
1909
|
+
const state2 = {
|
|
1952
1910
|
$hasCloseHandle: !!close,
|
|
1953
1911
|
$hasOpenHandle: !!open2,
|
|
1954
1912
|
$hasShouldCloseHandle: !!shouldClose,
|
|
1955
|
-
$key: getKey()
|
|
1956
|
-
|
|
1913
|
+
$key: getKey(),
|
|
1914
|
+
...data
|
|
1915
|
+
};
|
|
1957
1916
|
paramsMap.set(state2.$key, params);
|
|
1958
1917
|
updateStore(cleanObject(store), state2);
|
|
1959
1918
|
const url = getUrlBarPath(path) + new QueryString(query) + hash;
|
|
@@ -1964,9 +1923,10 @@ function updateHistory(p, native) {
|
|
|
1964
1923
|
}
|
|
1965
1924
|
function updateHistoryByNative(data, title, originUrl, native) {
|
|
1966
1925
|
validData(data);
|
|
1967
|
-
const state2 =
|
|
1968
|
-
$key: getKey()
|
|
1969
|
-
|
|
1926
|
+
const state2 = {
|
|
1927
|
+
$key: getKey(),
|
|
1928
|
+
...data || {}
|
|
1929
|
+
};
|
|
1970
1930
|
const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);
|
|
1971
1931
|
const params = normalizeParams({ path: pathname, query: new QueryString(search), hash, title, data });
|
|
1972
1932
|
paramsMap.set(state2.$key, params);
|
|
@@ -2046,9 +2006,10 @@ if (!window._GEMHISTORY) {
|
|
|
2046
2006
|
gemHistory.back();
|
|
2047
2007
|
} else {
|
|
2048
2008
|
const params = normalizeParams({ title: document.title, hash: location.hash });
|
|
2049
|
-
updateStore(store,
|
|
2050
|
-
$key: getKey()
|
|
2051
|
-
|
|
2009
|
+
updateStore(store, {
|
|
2010
|
+
$key: getKey(),
|
|
2011
|
+
...nativeHistory.state || {}
|
|
2012
|
+
});
|
|
2052
2013
|
paramsMap.set(store.$key, params);
|
|
2053
2014
|
}
|
|
2054
2015
|
connect(gemTitleStore, () => {
|
|
@@ -2144,14 +2105,24 @@ class ParamsRegExp extends RegExp {
|
|
|
2144
2105
|
constructor(pattern) {
|
|
2145
2106
|
const namePosition = {};
|
|
2146
2107
|
let i = 0;
|
|
2147
|
-
super(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2108
|
+
super(
|
|
2109
|
+
`^${pattern.replace(/:([^/$]+)/g, (_m, name) => {
|
|
2110
|
+
namePosition[name] = i++;
|
|
2111
|
+
return `([^/]+)`;
|
|
2112
|
+
}).replace("*", ".*")}$`,
|
|
2113
|
+
"i"
|
|
2114
|
+
);
|
|
2151
2115
|
this.namePosition = namePosition;
|
|
2152
2116
|
}
|
|
2153
2117
|
}
|
|
2154
2118
|
function matchPath(pattern, path) {
|
|
2119
|
+
if (window.URLPattern) {
|
|
2120
|
+
const urLPattern = new window.URLPattern({ pathname: pattern });
|
|
2121
|
+
const matchResult2 = urLPattern.exec({ pathname: path }) || urLPattern.exec({ pathname: `${path}/` });
|
|
2122
|
+
if (!matchResult2)
|
|
2123
|
+
return null;
|
|
2124
|
+
return matchResult2.pathname.groups;
|
|
2125
|
+
}
|
|
2155
2126
|
const reg = new ParamsRegExp(pattern);
|
|
2156
2127
|
const matchResult = path.match(reg) || `${path}/`.match(reg);
|
|
2157
2128
|
if (!matchResult)
|
|
@@ -2176,9 +2147,10 @@ function createPath(route, options) {
|
|
|
2176
2147
|
}
|
|
2177
2148
|
function createHistoryParams(route, options) {
|
|
2178
2149
|
const path = createPath(route, options);
|
|
2179
|
-
return
|
|
2180
|
-
path
|
|
2181
|
-
|
|
2150
|
+
return {
|
|
2151
|
+
path,
|
|
2152
|
+
...options
|
|
2153
|
+
};
|
|
2182
2154
|
}
|
|
2183
2155
|
let GemRouteElement = class extends GemElement {
|
|
2184
2156
|
constructor({ isLight, routes } = {}) {
|
|
@@ -2218,39 +2190,42 @@ let GemRouteElement = class extends GemElement {
|
|
|
2218
2190
|
this.routes = routes;
|
|
2219
2191
|
}
|
|
2220
2192
|
mounted() {
|
|
2221
|
-
this.effect(
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2193
|
+
this.effect(
|
|
2194
|
+
([key2, path], old) => {
|
|
2195
|
+
if (old && key2 === old[0] && path === old[1]) {
|
|
2196
|
+
__privateGet2(this, _updateLocationStore).call(this);
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
const { route, params = {} } = GemRouteElement.findRoute(this.routes, path);
|
|
2200
|
+
const { redirect, content, getContent } = route || {};
|
|
2201
|
+
if (redirect) {
|
|
2202
|
+
history.replace({ path: redirect });
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
const title = route == null ? void 0 : route.title;
|
|
2206
|
+
if (title)
|
|
2207
|
+
updateStore(titleStore, { title });
|
|
2208
|
+
const contentOrLoader = content || (getContent == null ? void 0 : getContent(params));
|
|
2209
|
+
if (contentOrLoader instanceof Promise) {
|
|
2210
|
+
this.loading(route);
|
|
2211
|
+
__privateSet2(this, _lastLoader, contentOrLoader);
|
|
2212
|
+
const isSomeLoader = () => __privateGet2(this, _lastLoader) === contentOrLoader;
|
|
2213
|
+
contentOrLoader.then((content2) => {
|
|
2214
|
+
if (isSomeLoader())
|
|
2215
|
+
__privateGet2(this, _setContent).call(this, route, params, content2);
|
|
2216
|
+
}).catch((err) => {
|
|
2217
|
+
if (isSomeLoader())
|
|
2218
|
+
this.error(err);
|
|
2219
|
+
});
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
__privateGet2(this, _setContent).call(this, route, params, contentOrLoader);
|
|
2223
|
+
},
|
|
2224
|
+
() => {
|
|
2225
|
+
const { path } = history.getParams();
|
|
2226
|
+
return [this.key, path, location.search];
|
|
2248
2227
|
}
|
|
2249
|
-
|
|
2250
|
-
}, () => {
|
|
2251
|
-
const { path } = history.getParams();
|
|
2252
|
-
return [this.key, path, location.search];
|
|
2253
|
-
});
|
|
2228
|
+
);
|
|
2254
2229
|
}
|
|
2255
2230
|
shouldUpdate() {
|
|
2256
2231
|
if (this.inert)
|
|
@@ -2272,9 +2247,9 @@ let GemRouteElement = class extends GemElement {
|
|
|
2272
2247
|
`;
|
|
2273
2248
|
}
|
|
2274
2249
|
};
|
|
2275
|
-
_lastLoader = new WeakMap();
|
|
2276
|
-
_updateLocationStore = new WeakMap();
|
|
2277
|
-
_setContent = new WeakMap();
|
|
2250
|
+
_lastLoader = /* @__PURE__ */ new WeakMap();
|
|
2251
|
+
_updateLocationStore = /* @__PURE__ */ new WeakMap();
|
|
2252
|
+
_setContent = /* @__PURE__ */ new WeakMap();
|
|
2278
2253
|
GemRouteElement.createLocationStore = () => {
|
|
2279
2254
|
const { path, query, data } = history.getParams();
|
|
2280
2255
|
return createStore({ path, query, data, params: {} });
|
|
@@ -2288,7 +2263,7 @@ GemRouteElement.findRoute = (target = [], path) => {
|
|
|
2288
2263
|
routes = Object.values(target);
|
|
2289
2264
|
}
|
|
2290
2265
|
for (const route of routes) {
|
|
2291
|
-
if (route.pattern
|
|
2266
|
+
if ("*" === route.pattern) {
|
|
2292
2267
|
defaultRoute = route;
|
|
2293
2268
|
} else {
|
|
2294
2269
|
const params = matchPath(route.pattern, path);
|
|
@@ -2325,7 +2300,7 @@ GemRouteElement = __decorateClass$6([
|
|
|
2325
2300
|
], GemRouteElement);
|
|
2326
2301
|
class GemLightRouteElement extends GemRouteElement {
|
|
2327
2302
|
constructor(options = {}) {
|
|
2328
|
-
super(
|
|
2303
|
+
super({ ...options, isLight: true });
|
|
2329
2304
|
}
|
|
2330
2305
|
}
|
|
2331
2306
|
var __defProp$5 = Object.defineProperty;
|
|
@@ -2339,43 +2314,50 @@ var __decorateClass$5 = (decorators, target, key2, kind) => {
|
|
|
2339
2314
|
__defProp$5(target, key2, result);
|
|
2340
2315
|
return result;
|
|
2341
2316
|
};
|
|
2317
|
+
function isExternal(path) {
|
|
2318
|
+
return !path.startsWith("/");
|
|
2319
|
+
}
|
|
2342
2320
|
let GemLinkElement = (_a = class extends GemElement {
|
|
2343
2321
|
constructor() {
|
|
2344
2322
|
super();
|
|
2345
2323
|
__privateAdd(this, _routeOptions);
|
|
2346
|
-
this
|
|
2324
|
+
__privateAdd(this, _hint);
|
|
2325
|
+
__privateAdd(this, _onClick, void 0);
|
|
2326
|
+
__privateAdd(this, _preventDefault, void 0);
|
|
2327
|
+
__privateAdd(this, _getHint, void 0);
|
|
2328
|
+
__privateSet(this, _onClick, async () => {
|
|
2347
2329
|
var _a2;
|
|
2348
|
-
const
|
|
2349
|
-
if (!
|
|
2330
|
+
const locationString = this.getLocationString();
|
|
2331
|
+
if (!locationString)
|
|
2350
2332
|
return;
|
|
2351
|
-
if (
|
|
2333
|
+
if (isExternal(locationString)) {
|
|
2352
2334
|
switch (this.target) {
|
|
2353
2335
|
case "_self":
|
|
2354
|
-
window.location.href =
|
|
2336
|
+
window.location.href = locationString;
|
|
2355
2337
|
return;
|
|
2356
2338
|
case "_parent":
|
|
2357
|
-
window.parent.location.href =
|
|
2339
|
+
window.parent.location.href = locationString;
|
|
2358
2340
|
return;
|
|
2359
2341
|
case "_top":
|
|
2360
|
-
window.top.location.href =
|
|
2342
|
+
window.top.location.href = locationString;
|
|
2361
2343
|
return;
|
|
2362
2344
|
default:
|
|
2363
|
-
window.open(
|
|
2345
|
+
window.open(locationString);
|
|
2364
2346
|
return;
|
|
2365
2347
|
}
|
|
2366
2348
|
}
|
|
2367
2349
|
const { path, query, hash } = history.getParams();
|
|
2368
|
-
if (path + query + hash ===
|
|
2350
|
+
if (path + query + hash === locationString) {
|
|
2369
2351
|
return;
|
|
2370
2352
|
}
|
|
2371
|
-
e.stopPropagation();
|
|
2372
2353
|
await ((_a2 = this.prepare) == null ? void 0 : _a2.call(this));
|
|
2373
2354
|
if (this.route) {
|
|
2374
|
-
history.pushIgnoreCloseHandle(
|
|
2355
|
+
history.pushIgnoreCloseHandle({
|
|
2356
|
+
...createHistoryParams(this.route, __privateGet(this, _routeOptions, routeOptions_get)),
|
|
2375
2357
|
title: this.route.title || this.docTitle
|
|
2376
|
-
})
|
|
2358
|
+
});
|
|
2377
2359
|
} else if (this.href) {
|
|
2378
|
-
const { pathname, search, hash: hash2 } = new URL(
|
|
2360
|
+
const { pathname, search, hash: hash2 } = new URL(locationString, location.origin);
|
|
2379
2361
|
history.pushIgnoreCloseHandle({
|
|
2380
2362
|
path: pathname,
|
|
2381
2363
|
query: search,
|
|
@@ -2385,37 +2367,18 @@ let GemLinkElement = (_a = class extends GemElement {
|
|
|
2385
2367
|
} else {
|
|
2386
2368
|
history.pushIgnoreCloseHandle({ path: this.path, query: this.query, hash: this.hash, title: this.docTitle });
|
|
2387
2369
|
}
|
|
2388
|
-
};
|
|
2389
|
-
this
|
|
2370
|
+
});
|
|
2371
|
+
__privateSet(this, _preventDefault, (e) => {
|
|
2390
2372
|
e.preventDefault();
|
|
2391
|
-
};
|
|
2373
|
+
});
|
|
2374
|
+
__privateSet(this, _getHint, () => {
|
|
2375
|
+
const locationString = this.getLocationString();
|
|
2376
|
+
return isExternal(locationString) ? locationString : new URL(history.basePath + locationString, location.origin).toString();
|
|
2377
|
+
});
|
|
2392
2378
|
this.tabIndex = 0;
|
|
2393
|
-
this.addEventListener("click", this
|
|
2379
|
+
this.addEventListener("click", __privateGet(this, _onClick));
|
|
2394
2380
|
}
|
|
2395
|
-
|
|
2396
|
-
var _a2, _b2;
|
|
2397
|
-
if (this.route) {
|
|
2398
|
-
const queryProp = ((_a2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _a2.query) || "";
|
|
2399
|
-
const hashProp = ((_b2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _b2.hash) || "";
|
|
2400
|
-
return createPath(this.route, __privateGet(this, _routeOptions, routeOptions_get)) + queryProp + hashProp;
|
|
2401
|
-
} else {
|
|
2402
|
-
const url = this.href || this.path + this.query + this.hash;
|
|
2403
|
-
const { path, query } = history.getParams();
|
|
2404
|
-
if (url.startsWith("#")) {
|
|
2405
|
-
return `${path}${query}${url}`;
|
|
2406
|
-
} else if (url.startsWith("?")) {
|
|
2407
|
-
return `${path}${url}`;
|
|
2408
|
-
} else if (url.startsWith(".")) {
|
|
2409
|
-
return absoluteLocation(path, url);
|
|
2410
|
-
} else {
|
|
2411
|
-
return url;
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
isExternal(pathInfo) {
|
|
2416
|
-
return !pathInfo.startsWith("/");
|
|
2417
|
-
}
|
|
2418
|
-
render(pathInfo = this.getPathInfo()) {
|
|
2381
|
+
render() {
|
|
2419
2382
|
return html`
|
|
2420
2383
|
<style>
|
|
2421
2384
|
:host {
|
|
@@ -2434,16 +2397,38 @@ let GemLinkElement = (_a = class extends GemElement {
|
|
|
2434
2397
|
</style>
|
|
2435
2398
|
<a
|
|
2436
2399
|
part=${this.link}
|
|
2437
|
-
@click=${this
|
|
2438
|
-
href=${ifDefined(this
|
|
2400
|
+
@click=${__privateGet(this, _preventDefault)}
|
|
2401
|
+
href=${ifDefined(__privateGet(this, _hint, hint_get) === "off" ? void 0 : __privateGet(this, _getHint).call(this))}
|
|
2439
2402
|
>
|
|
2440
2403
|
<slot></slot>
|
|
2441
2404
|
</a>
|
|
2442
2405
|
`;
|
|
2443
2406
|
}
|
|
2407
|
+
getLocationString() {
|
|
2408
|
+
var _a2, _b2;
|
|
2409
|
+
if (this.route) {
|
|
2410
|
+
const queryProp = ((_a2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _a2.query) || "";
|
|
2411
|
+
const hashProp = ((_b2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _b2.hash) || "";
|
|
2412
|
+
return createPath(this.route, __privateGet(this, _routeOptions, routeOptions_get)) + queryProp + hashProp;
|
|
2413
|
+
} else {
|
|
2414
|
+
const url = this.href || this.path + this.query + this.hash;
|
|
2415
|
+
const { path, query } = history.getParams();
|
|
2416
|
+
if (url.startsWith("#")) {
|
|
2417
|
+
return `${path}${query}${url}`;
|
|
2418
|
+
} else if (url.startsWith("?")) {
|
|
2419
|
+
return `${path}${url}`;
|
|
2420
|
+
} else if (url.startsWith(".")) {
|
|
2421
|
+
return absoluteLocation(path, url);
|
|
2422
|
+
} else {
|
|
2423
|
+
return url;
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2444
2427
|
}, _routeOptions = new WeakSet(), routeOptions_get = function() {
|
|
2445
2428
|
return this.routeOptions || this.options;
|
|
2446
|
-
},
|
|
2429
|
+
}, _hint = new WeakSet(), hint_get = function() {
|
|
2430
|
+
return this.hint || "on";
|
|
2431
|
+
}, _onClick = new WeakMap(), _preventDefault = new WeakMap(), _getHint = new WeakMap(), _a);
|
|
2447
2432
|
__decorateClass$5([
|
|
2448
2433
|
attribute
|
|
2449
2434
|
], GemLinkElement.prototype, "href", 2);
|
|
@@ -2484,16 +2469,13 @@ GemLinkElement = __decorateClass$5([
|
|
|
2484
2469
|
connectStore(basePathStore)
|
|
2485
2470
|
], GemLinkElement);
|
|
2486
2471
|
let GemActiveLinkElement = class extends GemLinkElement {
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
this.active =
|
|
2493
|
-
}
|
|
2494
|
-
this.active = false;
|
|
2495
|
-
}
|
|
2496
|
-
return super.render(pathInfo);
|
|
2472
|
+
constructor() {
|
|
2473
|
+
super();
|
|
2474
|
+
this.effect(() => {
|
|
2475
|
+
const { path, query, hash } = history.getParams();
|
|
2476
|
+
const isMatchPattern = this.pattern && matchPath(this.pattern, path);
|
|
2477
|
+
this.active = !!isMatchPattern || path + query + hash === this.getLocationString();
|
|
2478
|
+
});
|
|
2497
2479
|
}
|
|
2498
2480
|
};
|
|
2499
2481
|
__decorateClass$5([
|
|
@@ -2521,28 +2503,23 @@ var __decorateClass$4 = (decorators, target, key2, kind) => {
|
|
|
2521
2503
|
return result;
|
|
2522
2504
|
};
|
|
2523
2505
|
let GemTitleElement = class extends GemElement {
|
|
2506
|
+
constructor() {
|
|
2507
|
+
super();
|
|
2508
|
+
new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });
|
|
2509
|
+
}
|
|
2524
2510
|
static setTitle(title) {
|
|
2525
2511
|
updateStore(titleStore, { title });
|
|
2526
2512
|
}
|
|
2527
|
-
static updateTitle(
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
GemTitleElement.title = title;
|
|
2531
|
-
document.title = GemTitleElement.title + suffix;
|
|
2532
|
-
} else if (str) {
|
|
2533
|
-
GemTitleElement.title = str;
|
|
2534
|
-
document.title = GemTitleElement.title + suffix;
|
|
2513
|
+
static updateTitle(title = titleStore.title, prefix = "", suffix = "") {
|
|
2514
|
+
if (title === GemTitleElement.defaultTitle) {
|
|
2515
|
+
document.title = GemTitleElement.title = title;
|
|
2535
2516
|
} else {
|
|
2536
|
-
GemTitleElement.title =
|
|
2537
|
-
document.title = GemTitleElement.title;
|
|
2517
|
+
GemTitleElement.title = title;
|
|
2518
|
+
document.title = prefix + GemTitleElement.title + suffix;
|
|
2538
2519
|
}
|
|
2539
2520
|
}
|
|
2540
|
-
constructor() {
|
|
2541
|
-
super();
|
|
2542
|
-
new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });
|
|
2543
|
-
}
|
|
2544
2521
|
render() {
|
|
2545
|
-
GemTitleElement.updateTitle(this.textContent ||
|
|
2522
|
+
GemTitleElement.updateTitle(this.textContent || void 0, this.prefix, this.suffix);
|
|
2546
2523
|
if (this.hidden) {
|
|
2547
2524
|
return html``;
|
|
2548
2525
|
}
|
|
@@ -2551,7 +2528,11 @@ let GemTitleElement = class extends GemElement {
|
|
|
2551
2528
|
};
|
|
2552
2529
|
GemTitleElement.title = document.title;
|
|
2553
2530
|
GemTitleElement.defaultTitle = document.title;
|
|
2531
|
+
GemTitleElement.defaultPrefix = `${document.title} | `;
|
|
2554
2532
|
GemTitleElement.defaultSuffix = ` - ${document.title}`;
|
|
2533
|
+
__decorateClass$4([
|
|
2534
|
+
attribute
|
|
2535
|
+
], GemTitleElement.prototype, "prefix", 2);
|
|
2555
2536
|
__decorateClass$4([
|
|
2556
2537
|
attribute
|
|
2557
2538
|
], GemTitleElement.prototype, "suffix", 2);
|
|
@@ -2571,23 +2552,27 @@ var __decorateClass$3 = (decorators, target, key2, kind) => {
|
|
|
2571
2552
|
__defProp$3(target, key2, result);
|
|
2572
2553
|
return result;
|
|
2573
2554
|
};
|
|
2574
|
-
const eleCache = new Map();
|
|
2555
|
+
const eleCache = /* @__PURE__ */ new Map();
|
|
2575
2556
|
class GemUseElement extends GemElement {
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
temp
|
|
2583
|
-
|
|
2557
|
+
constructor() {
|
|
2558
|
+
super(...arguments);
|
|
2559
|
+
__privateAdd(this, _getContent, void 0);
|
|
2560
|
+
__privateSet(this, _getContent, () => {
|
|
2561
|
+
const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
|
|
2562
|
+
if (typeof ele === "string") {
|
|
2563
|
+
let temp = eleCache.get(ele);
|
|
2564
|
+
if (!temp) {
|
|
2565
|
+
temp = document.createElement("template");
|
|
2566
|
+
temp.innerHTML = ele;
|
|
2567
|
+
eleCache.set(ele, temp);
|
|
2568
|
+
}
|
|
2569
|
+
return temp.content.cloneNode(true);
|
|
2570
|
+
} else if (ele instanceof HTMLTemplateElement) {
|
|
2571
|
+
return ele.content.cloneNode(true);
|
|
2572
|
+
} else {
|
|
2573
|
+
return ele == null ? void 0 : ele.cloneNode(true);
|
|
2584
2574
|
}
|
|
2585
|
-
|
|
2586
|
-
} else if (ele instanceof HTMLTemplateElement) {
|
|
2587
|
-
return ele.content.cloneNode(true);
|
|
2588
|
-
} else {
|
|
2589
|
-
return ele == null ? void 0 : ele.cloneNode(true);
|
|
2590
|
-
}
|
|
2575
|
+
});
|
|
2591
2576
|
}
|
|
2592
2577
|
render() {
|
|
2593
2578
|
return html`
|
|
@@ -2602,11 +2587,12 @@ class GemUseElement extends GemElement {
|
|
|
2602
2587
|
height: 100%;
|
|
2603
2588
|
}
|
|
2604
2589
|
</style>
|
|
2605
|
-
${this.
|
|
2590
|
+
${__privateGet(this, _getContent).call(this)}
|
|
2606
2591
|
<slot></slot>
|
|
2607
2592
|
`;
|
|
2608
2593
|
}
|
|
2609
2594
|
}
|
|
2595
|
+
_getContent = new WeakMap();
|
|
2610
2596
|
__decorateClass$3([
|
|
2611
2597
|
attribute
|
|
2612
2598
|
], GemUseElement.prototype, "selector", 2);
|
|
@@ -2634,9 +2620,10 @@ var __decorateClass$2 = (decorators, target, key2, kind) => {
|
|
|
2634
2620
|
class GemUnsafeElement extends GemElement {
|
|
2635
2621
|
constructor() {
|
|
2636
2622
|
super();
|
|
2637
|
-
this.effect(
|
|
2638
|
-
|
|
2639
|
-
this.shadowRoot
|
|
2623
|
+
this.effect(
|
|
2624
|
+
() => {
|
|
2625
|
+
if (this.shadowRoot) {
|
|
2626
|
+
this.shadowRoot.innerHTML = `
|
|
2640
2627
|
<style>
|
|
2641
2628
|
:host(:where(:not([hidden]))) {
|
|
2642
2629
|
display: contents;
|
|
@@ -2645,8 +2632,10 @@ class GemUnsafeElement extends GemElement {
|
|
|
2645
2632
|
</style>
|
|
2646
2633
|
${this.content}
|
|
2647
2634
|
`;
|
|
2648
|
-
|
|
2649
|
-
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2637
|
+
() => [this.content, this.contentcss]
|
|
2638
|
+
);
|
|
2650
2639
|
}
|
|
2651
2640
|
render() {
|
|
2652
2641
|
return void 0;
|
|
@@ -2676,18 +2665,21 @@ class GemReflectElement extends GemElement {
|
|
|
2676
2665
|
this.target = document.head;
|
|
2677
2666
|
this.hidden = true;
|
|
2678
2667
|
this.dataset.gemReflect = "";
|
|
2679
|
-
this.effect(
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
node
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2668
|
+
this.effect(
|
|
2669
|
+
() => {
|
|
2670
|
+
const childNodes = [...this.childNodes];
|
|
2671
|
+
childNodes.forEach((node) => {
|
|
2672
|
+
if (node instanceof HTMLElement) {
|
|
2673
|
+
node.dataset.reflect = "";
|
|
2674
|
+
}
|
|
2675
|
+
this.target.append(node);
|
|
2676
|
+
});
|
|
2677
|
+
return () => {
|
|
2678
|
+
childNodes.forEach((node) => node.remove());
|
|
2679
|
+
};
|
|
2680
|
+
},
|
|
2681
|
+
() => [this.target]
|
|
2682
|
+
);
|
|
2691
2683
|
}
|
|
2692
2684
|
}
|
|
2693
2685
|
__decorateClass$1([
|
|
@@ -2697,6 +2689,7 @@ customElements.define("gem-reflect", GemReflectElement);
|
|
|
2697
2689
|
const open = Symbol("open mark");
|
|
2698
2690
|
function createModalClass(options) {
|
|
2699
2691
|
var _a2;
|
|
2692
|
+
const final2 = Symbol();
|
|
2700
2693
|
return _a2 = class extends GemElement {
|
|
2701
2694
|
constructor() {
|
|
2702
2695
|
super();
|
|
@@ -2716,7 +2709,7 @@ function createModalClass(options) {
|
|
|
2716
2709
|
this.inertStore = [...document.body.children].filter((e) => !e.inert);
|
|
2717
2710
|
this.inertStore.forEach((e) => e.inert = true);
|
|
2718
2711
|
document.body.append(instance);
|
|
2719
|
-
const changeStore = () => updateStore(this.store,
|
|
2712
|
+
const changeStore = () => updateStore(this.store, { [open]: true, ...opts });
|
|
2720
2713
|
setTimeout(() => {
|
|
2721
2714
|
changeStore();
|
|
2722
2715
|
history.push({
|
|
@@ -2726,24 +2719,28 @@ function createModalClass(options) {
|
|
|
2726
2719
|
shouldClose: this.shouldClose.bind(this)
|
|
2727
2720
|
});
|
|
2728
2721
|
}, 100);
|
|
2722
|
+
return final2;
|
|
2729
2723
|
}
|
|
2730
2724
|
static close() {
|
|
2731
2725
|
history.back();
|
|
2726
|
+
return final2;
|
|
2732
2727
|
}
|
|
2733
2728
|
static closeHandle() {
|
|
2734
2729
|
var _a3;
|
|
2735
2730
|
this.inertStore.forEach((e) => e.inert = false);
|
|
2736
2731
|
(_a3 = this.instance) == null ? void 0 : _a3.remove();
|
|
2737
|
-
updateStore(this.store,
|
|
2732
|
+
updateStore(this.store, { [open]: false, ...options });
|
|
2733
|
+
return final2;
|
|
2738
2734
|
}
|
|
2739
2735
|
static shouldClose() {
|
|
2740
2736
|
return true;
|
|
2741
2737
|
}
|
|
2742
|
-
}, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore(
|
|
2743
|
-
[open]: false
|
|
2744
|
-
|
|
2738
|
+
}, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore({
|
|
2739
|
+
[open]: false,
|
|
2740
|
+
...options
|
|
2741
|
+
}), _a2;
|
|
2745
2742
|
}
|
|
2746
|
-
var
|
|
2743
|
+
var __defProp = Object.defineProperty;
|
|
2747
2744
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2748
2745
|
var __decorateClass = (decorators, target, key2, kind) => {
|
|
2749
2746
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;
|
|
@@ -2751,16 +2748,16 @@ var __decorateClass = (decorators, target, key2, kind) => {
|
|
|
2751
2748
|
if (decorator = decorators[i])
|
|
2752
2749
|
result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
|
|
2753
2750
|
if (kind && result)
|
|
2754
|
-
|
|
2751
|
+
__defProp(target, key2, result);
|
|
2755
2752
|
return result;
|
|
2756
2753
|
};
|
|
2754
|
+
const final = Symbol();
|
|
2757
2755
|
let GemDialogBaseElement = (_b = class extends GemElement {
|
|
2758
2756
|
constructor() {
|
|
2759
2757
|
super();
|
|
2760
2758
|
__privateAdd(this, _nextSibling, void 0);
|
|
2761
2759
|
__privateAdd(this, _parentElement, void 0);
|
|
2762
2760
|
__privateAdd(this, _inertStore, void 0);
|
|
2763
|
-
this.inert = true;
|
|
2764
2761
|
__privateSet(this, _inertStore, []);
|
|
2765
2762
|
this.closeHandle = () => {
|
|
2766
2763
|
var _a2;
|
|
@@ -2773,6 +2770,7 @@ let GemDialogBaseElement = (_b = class extends GemElement {
|
|
|
2773
2770
|
}
|
|
2774
2771
|
this.dispatchEvent(new CustomEvent("close"));
|
|
2775
2772
|
this.opened = false;
|
|
2773
|
+
return final;
|
|
2776
2774
|
};
|
|
2777
2775
|
this.openHandle = () => {
|
|
2778
2776
|
this.hidden = false;
|
|
@@ -2784,6 +2782,7 @@ let GemDialogBaseElement = (_b = class extends GemElement {
|
|
|
2784
2782
|
document.body.append(this);
|
|
2785
2783
|
this.dispatchEvent(new CustomEvent("open"));
|
|
2786
2784
|
this.opened = true;
|
|
2785
|
+
return final;
|
|
2787
2786
|
};
|
|
2788
2787
|
this.open = () => {
|
|
2789
2788
|
if (this.opened)
|
|
@@ -2795,14 +2794,18 @@ let GemDialogBaseElement = (_b = class extends GemElement {
|
|
|
2795
2794
|
close: this.closeHandle,
|
|
2796
2795
|
shouldClose: this.shouldClose
|
|
2797
2796
|
});
|
|
2797
|
+
return final;
|
|
2798
2798
|
};
|
|
2799
2799
|
this.close = () => {
|
|
2800
2800
|
history.back();
|
|
2801
|
+
return final;
|
|
2801
2802
|
};
|
|
2802
2803
|
this.forceClose = () => {
|
|
2803
2804
|
this.opened = false;
|
|
2804
2805
|
setTimeout(this.close, 100);
|
|
2806
|
+
return final;
|
|
2805
2807
|
};
|
|
2808
|
+
this.inert = true;
|
|
2806
2809
|
this.internals.role = "dialog";
|
|
2807
2810
|
this.internals.ariaModal = "true";
|
|
2808
2811
|
}
|
|
@@ -2819,45 +2822,41 @@ __decorateClass([
|
|
|
2819
2822
|
GemDialogBaseElement = __decorateClass([
|
|
2820
2823
|
connectStore(history.store)
|
|
2821
2824
|
], GemDialogBaseElement);
|
|
2822
|
-
const themeStoreMap = new WeakMap();
|
|
2825
|
+
const themeStoreMap = /* @__PURE__ */ new WeakMap();
|
|
2823
2826
|
function getThemeStore(theme) {
|
|
2824
2827
|
return themeStoreMap.get(theme);
|
|
2825
2828
|
}
|
|
2826
|
-
const
|
|
2827
|
-
function
|
|
2828
|
-
return
|
|
2829
|
-
}
|
|
2830
|
-
function replaceStyle(style, theme) {
|
|
2831
|
-
const themeStore = themeStoreMap.get(theme);
|
|
2832
|
-
const themeProp = themePropMap.get(theme);
|
|
2833
|
-
const rules = Object.keys(themeStore).reduce((prev, key2) => {
|
|
2834
|
-
if (!themeStore[key2] || !themeProp[key2])
|
|
2835
|
-
return prev;
|
|
2836
|
-
return prev + `${themeProp[key2]}:${themeStore[key2]};`;
|
|
2837
|
-
}, "");
|
|
2838
|
-
style.textContent = `:root, :host {${rules}}`;
|
|
2829
|
+
const themePropsMap = /* @__PURE__ */ new WeakMap();
|
|
2830
|
+
function getThemeProps(theme) {
|
|
2831
|
+
return themePropsMap.get(theme);
|
|
2839
2832
|
}
|
|
2833
|
+
const setThemeFnMap = /* @__PURE__ */ new WeakMap();
|
|
2840
2834
|
function createTheme(themeObj) {
|
|
2841
2835
|
const salt = randomStr();
|
|
2842
2836
|
const style = document.createElement("style");
|
|
2843
|
-
const
|
|
2837
|
+
const store2 = createStore(themeObj);
|
|
2844
2838
|
const theme = {};
|
|
2845
|
-
const
|
|
2846
|
-
|
|
2847
|
-
themeStoreMap.set(theme,
|
|
2848
|
-
Object.keys(
|
|
2849
|
-
|
|
2850
|
-
|
|
2839
|
+
const props = {};
|
|
2840
|
+
themePropsMap.set(theme, props);
|
|
2841
|
+
themeStoreMap.set(theme, store2);
|
|
2842
|
+
const setTheme = () => Object.keys(store2).forEach((key2) => {
|
|
2843
|
+
if (props[key2])
|
|
2844
|
+
return;
|
|
2845
|
+
props[key2] = `--${camelToKebabCase(key2)}-${salt}`;
|
|
2846
|
+
theme[key2] = `var(${props[key2]})`;
|
|
2851
2847
|
});
|
|
2852
|
-
|
|
2853
|
-
|
|
2848
|
+
setThemeFnMap.set(theme, setTheme);
|
|
2849
|
+
setTheme();
|
|
2850
|
+
const getStyle = () => `:root, :host {${Object.keys(store2).reduce((prev, key2) => prev + `${props[key2]}:${store2[key2]};`, "")}}`;
|
|
2851
|
+
const replace = () => style.textContent = getStyle();
|
|
2852
|
+
connect(store2, replace);
|
|
2854
2853
|
replace();
|
|
2855
2854
|
(document.head || document.documentElement).append(style);
|
|
2856
2855
|
return theme;
|
|
2857
2856
|
}
|
|
2858
2857
|
function updateTheme(theme, newThemeObj) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2858
|
+
updateStore(getThemeStore(theme), newThemeObj);
|
|
2859
|
+
setThemeFnMap.get(theme)();
|
|
2861
2860
|
}
|
|
2862
2861
|
const splitReg = /\$\d(?:<[^>]*>)?/;
|
|
2863
2862
|
const matchReg = /\$(\d)(<([^>]*)>)?/g;
|
|
@@ -2874,7 +2873,7 @@ function splice(rawValue, ...rest) {
|
|
|
2874
2873
|
}
|
|
2875
2874
|
return html(templateArr, ...values);
|
|
2876
2875
|
}
|
|
2877
|
-
const modules = new Set();
|
|
2876
|
+
const modules = /* @__PURE__ */ new Set();
|
|
2878
2877
|
const _I18n = class {
|
|
2879
2878
|
constructor(options) {
|
|
2880
2879
|
__privateAdd(this, _cacheCurrentKey);
|
|
@@ -3051,7 +3050,10 @@ const defaultReqInit = {
|
|
|
3051
3050
|
}
|
|
3052
3051
|
};
|
|
3053
3052
|
async function request(uri, options = {}) {
|
|
3054
|
-
const res = await fetch(uri,
|
|
3053
|
+
const res = await fetch(uri, {
|
|
3054
|
+
...defaultReqInit,
|
|
3055
|
+
...options
|
|
3056
|
+
});
|
|
3055
3057
|
if (res.status === 0)
|
|
3056
3058
|
throw new Error("Request fail");
|
|
3057
3059
|
if (res.status >= 500)
|
|
@@ -3092,63 +3094,59 @@ function put(url, body) {
|
|
|
3092
3094
|
function post(url, body) {
|
|
3093
3095
|
return request(url, { method: "POST", body: serializationBody(body) });
|
|
3094
3096
|
}
|
|
3095
|
-
const
|
|
3097
|
+
const match = (query) => window.matchMedia(query).matches;
|
|
3096
3098
|
const mediaQuery = {
|
|
3097
3099
|
PRINT: "print",
|
|
3098
3100
|
get isPrint() {
|
|
3099
|
-
return
|
|
3101
|
+
return match(this.PRINT);
|
|
3100
3102
|
},
|
|
3101
3103
|
HOVER: "(hover: hover)",
|
|
3102
3104
|
get isHover() {
|
|
3103
|
-
return
|
|
3104
|
-
},
|
|
3105
|
-
PHONE: "(min-width: 319px) and (max-width: 480px)",
|
|
3106
|
-
get isPhone() {
|
|
3107
|
-
return matche(this.PHONE);
|
|
3108
|
-
},
|
|
3109
|
-
LAPTOP: "(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)",
|
|
3110
|
-
get isLaptop() {
|
|
3111
|
-
return matche(this.LAPTOP);
|
|
3105
|
+
return match(this.HOVER);
|
|
3112
3106
|
},
|
|
3113
|
-
|
|
3114
|
-
get
|
|
3115
|
-
return
|
|
3107
|
+
PWA: "(display-mode: standalone)",
|
|
3108
|
+
get isPWA() {
|
|
3109
|
+
return match(this.PWA);
|
|
3116
3110
|
},
|
|
3117
|
-
|
|
3118
|
-
get
|
|
3119
|
-
return
|
|
3111
|
+
MOTION_REDUCE: "(prefers-reduced-motion: reduce)",
|
|
3112
|
+
get isMotionReduce() {
|
|
3113
|
+
return match(this.MOTION_REDUCE);
|
|
3120
3114
|
},
|
|
3121
|
-
|
|
3122
|
-
get
|
|
3123
|
-
return
|
|
3115
|
+
DATA_REDUCE: "(prefers-reduced-data: reduce)",
|
|
3116
|
+
get isDataReduce() {
|
|
3117
|
+
return match(this.DATA_REDUCE);
|
|
3124
3118
|
},
|
|
3125
|
-
|
|
3126
|
-
get
|
|
3127
|
-
return
|
|
3119
|
+
WATCH: "(width < 320px)",
|
|
3120
|
+
get isWatch() {
|
|
3121
|
+
return match(this.WATCH);
|
|
3128
3122
|
},
|
|
3129
|
-
SMALL_PHONE: "(
|
|
3123
|
+
SMALL_PHONE: "(320px <= width <= 480px) and (height <= 640px)",
|
|
3130
3124
|
get isSmallPhone() {
|
|
3131
|
-
return
|
|
3125
|
+
return match(this.SMALL_PHONE);
|
|
3132
3126
|
},
|
|
3133
|
-
|
|
3134
|
-
get
|
|
3135
|
-
return
|
|
3127
|
+
PHONE: "(320px <= width <= 480px)",
|
|
3128
|
+
get isPhone() {
|
|
3129
|
+
return match(this.PHONE);
|
|
3130
|
+
},
|
|
3131
|
+
PHONE_LANDSCAPE: "(480px < width < 960px) and (orientation: landscape)",
|
|
3132
|
+
get isPhoneLandscape() {
|
|
3133
|
+
return match(this.PHONE_LANDSCAPE);
|
|
3136
3134
|
},
|
|
3137
|
-
SHORT: "(
|
|
3135
|
+
SHORT: "(width >= 480px) and (height <= 320px)",
|
|
3138
3136
|
get isShort() {
|
|
3139
|
-
return
|
|
3137
|
+
return match(this.SHORT);
|
|
3140
3138
|
},
|
|
3141
|
-
|
|
3142
|
-
get
|
|
3143
|
-
return
|
|
3139
|
+
TABLET: "(480px < width <= 1280px)",
|
|
3140
|
+
get isTablet() {
|
|
3141
|
+
return match(this.TABLET);
|
|
3144
3142
|
},
|
|
3145
|
-
|
|
3146
|
-
get
|
|
3147
|
-
return
|
|
3143
|
+
DESKTOP: "(width > 1280px) and (orientation: landscape)",
|
|
3144
|
+
get isDesktop() {
|
|
3145
|
+
return match(this.DESKTOP);
|
|
3148
3146
|
},
|
|
3149
|
-
|
|
3150
|
-
get
|
|
3151
|
-
return
|
|
3147
|
+
WIDTHSCREEN: "(width >= 1920px) and (orientation: landscape)",
|
|
3148
|
+
get isWidthScreen() {
|
|
3149
|
+
return match(this.WIDTHSCREEN);
|
|
3152
3150
|
}
|
|
3153
3151
|
};
|
|
3154
|
-
export { GemActiveLinkElement, GemDialogBaseElement, GemElement, GemError, GemLightRouteElement, GemLinkElement, GemReflectElement, GemRouteElement, GemTitleElement, GemUnsafeElement, GemUseElement, I18n, LinkedList, PropProxyMap, QueryString, SVGTemplateResult, SheetToken, StoreListenerMap, TemplateResult, absoluteLocation, addMicrotask, addMicrotaskToStack, adoptedStyle, attribute, basePathStore, boolattribute, camelToKebabCase, classMap, cleanObject, connect, connectStore, createCSSSheet, createHistoryParams, createModalClass, createPath, createStore, createStoreSet, createTheme, css, customElement, defaultReqInit, defineAttribute, defineCSSState, defineProperty, defineRef, del, directive, disconnect, emitter, exportPartsMap, get,
|
|
3152
|
+
export { GemActiveLinkElement, GemDialogBaseElement, GemElement, GemError, GemLightRouteElement, GemLinkElement, GemReflectElement, GemRouteElement, GemTitleElement, GemUnsafeElement, GemUseElement, I18n, LinkedList, PropProxyMap, QueryString, SVGTemplateResult, SheetToken, StoreListenerMap, TemplateResult, absoluteLocation, addMicrotask, addMicrotaskToStack, adoptedStyle, attribute, basePathStore, boolattribute, camelToKebabCase, classMap, cleanObject, connect, connectStore, createCSSSheet, createHistoryParams, createModalClass, createPath, createStore, createStoreSet, createTheme, css, customElement, defaultReqInit, defineAttribute, defineCSSState, defineProperty, defineRef, del, directive, disconnect, emitter, exportPartsMap, get, getThemeProps, getThemeStore, globalemitter, guard, history, html, ifDefined, isArrayChange, kebabToCamelCase, matchPath, mediaQuery, nativeDefineElement, numattribute, objectMapToString, part, partMap, post, property, put, randomStr, raw, refobject, removeItems, render, repeat, request, rootElement, slot, splice, state, styleMap, styled, svg, titleStore, updateStore, updateTheme, version };
|