@mantou/gem 1.7.1 → 1.7.2
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 +357 -362
- 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 +106 -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 +41 -69
- 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 +6 -21
- 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 +29 -58
- package/src/lib/history.ts +2 -1
- package/src/lib/utils.ts +10 -42
- package/src/lib/version.ts +1 -1
- 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;
|
|
@@ -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.2";
|
|
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;
|
|
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,14 @@ class GemElement extends HTMLElement {
|
|
|
1548
1513
|
throw new GemError(`not allow current root type`);
|
|
1549
1514
|
}
|
|
1550
1515
|
});
|
|
1551
|
-
this
|
|
1552
|
-
|
|
1553
|
-
this
|
|
1554
|
-
this
|
|
1516
|
+
addMicrotask(() => Reflect.set(this, initSymbol, false));
|
|
1517
|
+
Reflect.set(this, constructorSymbol, true);
|
|
1518
|
+
Reflect.set(this, initSymbol, true);
|
|
1519
|
+
Reflect.set(this, updateSymbol, () => {
|
|
1555
1520
|
if (__privateGet$1(this, _isMounted)) {
|
|
1556
1521
|
addMicrotask(__privateGet$1(this, _update));
|
|
1557
1522
|
}
|
|
1558
|
-
};
|
|
1523
|
+
});
|
|
1559
1524
|
__privateSet$1(this, _isAsync, isAsync);
|
|
1560
1525
|
__privateSet$1(this, _renderRoot, isLight ? this : this.attachShadow({ mode: "open", delegatesFocus, slotAssignment }));
|
|
1561
1526
|
const { adoptedStyleSheets } = new.target;
|
|
@@ -1564,37 +1529,16 @@ class GemElement extends HTMLElement {
|
|
|
1564
1529
|
if (this.shadowRoot) {
|
|
1565
1530
|
this.shadowRoot.adoptedStyleSheets = sheets;
|
|
1566
1531
|
} 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 {
|
|
1532
|
+
this.effect(
|
|
1533
|
+
() => {
|
|
1534
|
+
const root = this.getRootNode();
|
|
1592
1535
|
root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];
|
|
1593
1536
|
return () => {
|
|
1594
1537
|
root.adoptedStyleSheets = removeItems(root.adoptedStyleSheets, sheets);
|
|
1595
1538
|
};
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1539
|
+
},
|
|
1540
|
+
() => []
|
|
1541
|
+
);
|
|
1598
1542
|
}
|
|
1599
1543
|
}
|
|
1600
1544
|
}
|
|
@@ -1620,6 +1564,7 @@ class GemElement extends HTMLElement {
|
|
|
1620
1564
|
if (__privateGet$1(this, _isMounted)) {
|
|
1621
1565
|
addMicrotask(__privateGet$1(this, _update));
|
|
1622
1566
|
}
|
|
1567
|
+
return __privateGet$1(_GemElement, _final);
|
|
1623
1568
|
}
|
|
1624
1569
|
closestElement(constructorOrTag) {
|
|
1625
1570
|
const isConstructor = typeof constructorOrTag === "function";
|
|
@@ -1645,6 +1590,10 @@ class GemElement extends HTMLElement {
|
|
|
1645
1590
|
} else {
|
|
1646
1591
|
__privateGet$1(this, _connectedCallback).call(this);
|
|
1647
1592
|
}
|
|
1593
|
+
return __privateGet$1(_GemElement, _final);
|
|
1594
|
+
}
|
|
1595
|
+
adoptedCallback() {
|
|
1596
|
+
return __privateGet$1(_GemElement, _final);
|
|
1648
1597
|
}
|
|
1649
1598
|
disconnectedCallback() {
|
|
1650
1599
|
var _a2, _b2, _c, _d;
|
|
@@ -1664,26 +1613,30 @@ class GemElement extends HTMLElement {
|
|
|
1664
1613
|
});
|
|
1665
1614
|
__privateSet$1(this, _effectList, (_c = __privateGet$1(this, _effectList)) == null ? void 0 : _c.filter(({ inConstructor }) => inConstructor));
|
|
1666
1615
|
__privateSet$1(this, _memoList, (_d = __privateGet$1(this, _memoList)) == null ? void 0 : _d.filter(({ inConstructor }) => inConstructor));
|
|
1616
|
+
return __privateGet$1(_GemElement, _final);
|
|
1667
1617
|
}
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1618
|
+
};
|
|
1619
|
+
let GemElement = _GemElement;
|
|
1620
|
+
_final = /* @__PURE__ */ new WeakMap();
|
|
1621
|
+
_renderRoot = /* @__PURE__ */ new WeakMap();
|
|
1622
|
+
_internals = /* @__PURE__ */ new WeakMap();
|
|
1623
|
+
_isAppendReason = /* @__PURE__ */ new WeakMap();
|
|
1624
|
+
_isMounted = /* @__PURE__ */ new WeakMap();
|
|
1625
|
+
_isAsync = /* @__PURE__ */ new WeakMap();
|
|
1626
|
+
_effectList = /* @__PURE__ */ new WeakMap();
|
|
1627
|
+
_memoList = /* @__PURE__ */ new WeakMap();
|
|
1628
|
+
_unmountCallback = /* @__PURE__ */ new WeakMap();
|
|
1629
|
+
_exec = /* @__PURE__ */ new WeakMap();
|
|
1630
|
+
_execEffect = /* @__PURE__ */ new WeakMap();
|
|
1631
|
+
_execMemo = /* @__PURE__ */ new WeakMap();
|
|
1632
|
+
_initEffect = /* @__PURE__ */ new WeakMap();
|
|
1633
|
+
_render = /* @__PURE__ */ new WeakMap();
|
|
1634
|
+
_shouldUpdate = /* @__PURE__ */ new WeakMap();
|
|
1635
|
+
_updateCallback = /* @__PURE__ */ new WeakMap();
|
|
1636
|
+
_update = /* @__PURE__ */ new WeakMap();
|
|
1637
|
+
_updated = /* @__PURE__ */ new WeakMap();
|
|
1638
|
+
_connectedCallback = /* @__PURE__ */ new WeakMap();
|
|
1639
|
+
__privateAdd$1(GemElement, _final, Symbol());
|
|
1687
1640
|
const gemElementProxyMap = new PropProxyMap();
|
|
1688
1641
|
function defineAttribute(target, prop, attr) {
|
|
1689
1642
|
const { booleanAttributes, numberAttributes } = target.constructor;
|
|
@@ -1741,11 +1694,11 @@ function defineProperty(target, prop, event, eventOptions) {
|
|
|
1741
1694
|
if (v !== proxy[prop]) {
|
|
1742
1695
|
if (event) {
|
|
1743
1696
|
proxy[prop] = (v == null ? void 0 : v[isEventHandleSymbol]) ? v : (detail, options) => {
|
|
1744
|
-
const evt = new CustomEvent(event,
|
|
1697
|
+
const evt = new CustomEvent(event, { ...options, ...eventOptions, detail });
|
|
1745
1698
|
that.dispatchEvent(evt);
|
|
1746
1699
|
v(detail, options);
|
|
1747
1700
|
};
|
|
1748
|
-
proxy[prop]
|
|
1701
|
+
Reflect.set(proxy[prop], isEventHandleSymbol, true);
|
|
1749
1702
|
} else {
|
|
1750
1703
|
proxy[prop] = v;
|
|
1751
1704
|
this[updateSymbol]();
|
|
@@ -1768,7 +1721,9 @@ function defineRef(target, prop, ref) {
|
|
|
1768
1721
|
return ref;
|
|
1769
1722
|
},
|
|
1770
1723
|
get element() {
|
|
1771
|
-
const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map(
|
|
1724
|
+
const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map(
|
|
1725
|
+
(e) => e.target
|
|
1726
|
+
);
|
|
1772
1727
|
for (const e of [ele, ...gemReflects]) {
|
|
1773
1728
|
const result = e.querySelector(`[ref=${ref}]`);
|
|
1774
1729
|
if (result)
|
|
@@ -1814,7 +1769,7 @@ customElements.define = (name, cls, options) => {
|
|
|
1814
1769
|
nativeDefineElement(name, cls, options);
|
|
1815
1770
|
};
|
|
1816
1771
|
if (window.__GEM_DEVTOOLS__HOOK__) {
|
|
1817
|
-
Object.assign(window.__GEM_DEVTOOLS__HOOK__,
|
|
1772
|
+
Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...GemExports, ...VersionExports });
|
|
1818
1773
|
}
|
|
1819
1774
|
function pushStaticField(target, field, member, isSet = false) {
|
|
1820
1775
|
const cls = target.constructor;
|
|
@@ -1912,7 +1867,7 @@ const store = createStore({
|
|
|
1912
1867
|
$hasShouldCloseHandle: false,
|
|
1913
1868
|
$key: ""
|
|
1914
1869
|
});
|
|
1915
|
-
const paramsMap = new Map();
|
|
1870
|
+
const paramsMap = /* @__PURE__ */ new Map();
|
|
1916
1871
|
function validData(data) {
|
|
1917
1872
|
const { $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandle } = data || {};
|
|
1918
1873
|
if (store.$key === $key)
|
|
@@ -1942,18 +1897,19 @@ function normalizeParams(params) {
|
|
|
1942
1897
|
const title = params.title || (pathChanged ? "" : document.title);
|
|
1943
1898
|
const statusChanged = params.close || params.data || params.open || params.shouldClose;
|
|
1944
1899
|
const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location.hash) : "");
|
|
1945
|
-
return
|
|
1900
|
+
return { ...params, title, path, query, hash };
|
|
1946
1901
|
}
|
|
1947
1902
|
function updateHistory(p, native) {
|
|
1948
1903
|
validData(p.data);
|
|
1949
1904
|
const params = normalizeParams(p);
|
|
1950
1905
|
const { title, path, query, hash, close, open: open2, shouldClose, data } = params;
|
|
1951
|
-
const state2 =
|
|
1906
|
+
const state2 = {
|
|
1952
1907
|
$hasCloseHandle: !!close,
|
|
1953
1908
|
$hasOpenHandle: !!open2,
|
|
1954
1909
|
$hasShouldCloseHandle: !!shouldClose,
|
|
1955
|
-
$key: getKey()
|
|
1956
|
-
|
|
1910
|
+
$key: getKey(),
|
|
1911
|
+
...data
|
|
1912
|
+
};
|
|
1957
1913
|
paramsMap.set(state2.$key, params);
|
|
1958
1914
|
updateStore(cleanObject(store), state2);
|
|
1959
1915
|
const url = getUrlBarPath(path) + new QueryString(query) + hash;
|
|
@@ -1964,9 +1920,10 @@ function updateHistory(p, native) {
|
|
|
1964
1920
|
}
|
|
1965
1921
|
function updateHistoryByNative(data, title, originUrl, native) {
|
|
1966
1922
|
validData(data);
|
|
1967
|
-
const state2 =
|
|
1968
|
-
$key: getKey()
|
|
1969
|
-
|
|
1923
|
+
const state2 = {
|
|
1924
|
+
$key: getKey(),
|
|
1925
|
+
...data || {}
|
|
1926
|
+
};
|
|
1970
1927
|
const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);
|
|
1971
1928
|
const params = normalizeParams({ path: pathname, query: new QueryString(search), hash, title, data });
|
|
1972
1929
|
paramsMap.set(state2.$key, params);
|
|
@@ -2046,9 +2003,10 @@ if (!window._GEMHISTORY) {
|
|
|
2046
2003
|
gemHistory.back();
|
|
2047
2004
|
} else {
|
|
2048
2005
|
const params = normalizeParams({ title: document.title, hash: location.hash });
|
|
2049
|
-
updateStore(store,
|
|
2050
|
-
$key: getKey()
|
|
2051
|
-
|
|
2006
|
+
updateStore(store, {
|
|
2007
|
+
$key: getKey(),
|
|
2008
|
+
...nativeHistory.state || {}
|
|
2009
|
+
});
|
|
2052
2010
|
paramsMap.set(store.$key, params);
|
|
2053
2011
|
}
|
|
2054
2012
|
connect(gemTitleStore, () => {
|
|
@@ -2144,14 +2102,24 @@ class ParamsRegExp extends RegExp {
|
|
|
2144
2102
|
constructor(pattern) {
|
|
2145
2103
|
const namePosition = {};
|
|
2146
2104
|
let i = 0;
|
|
2147
|
-
super(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2105
|
+
super(
|
|
2106
|
+
`^${pattern.replace(/:([^/$]+)/g, (_m, name) => {
|
|
2107
|
+
namePosition[name] = i++;
|
|
2108
|
+
return `([^/]+)`;
|
|
2109
|
+
}).replace("*", ".*")}$`,
|
|
2110
|
+
"i"
|
|
2111
|
+
);
|
|
2151
2112
|
this.namePosition = namePosition;
|
|
2152
2113
|
}
|
|
2153
2114
|
}
|
|
2154
2115
|
function matchPath(pattern, path) {
|
|
2116
|
+
if (window.URLPattern) {
|
|
2117
|
+
const urLPattern = new window.URLPattern({ pathname: pattern });
|
|
2118
|
+
const matchResult2 = urLPattern.exec({ pathname: path }) || urLPattern.exec({ pathname: `${path}/` });
|
|
2119
|
+
if (!matchResult2)
|
|
2120
|
+
return null;
|
|
2121
|
+
return matchResult2.pathname.groups;
|
|
2122
|
+
}
|
|
2155
2123
|
const reg = new ParamsRegExp(pattern);
|
|
2156
2124
|
const matchResult = path.match(reg) || `${path}/`.match(reg);
|
|
2157
2125
|
if (!matchResult)
|
|
@@ -2176,9 +2144,10 @@ function createPath(route, options) {
|
|
|
2176
2144
|
}
|
|
2177
2145
|
function createHistoryParams(route, options) {
|
|
2178
2146
|
const path = createPath(route, options);
|
|
2179
|
-
return
|
|
2180
|
-
path
|
|
2181
|
-
|
|
2147
|
+
return {
|
|
2148
|
+
path,
|
|
2149
|
+
...options
|
|
2150
|
+
};
|
|
2182
2151
|
}
|
|
2183
2152
|
let GemRouteElement = class extends GemElement {
|
|
2184
2153
|
constructor({ isLight, routes } = {}) {
|
|
@@ -2218,39 +2187,42 @@ let GemRouteElement = class extends GemElement {
|
|
|
2218
2187
|
this.routes = routes;
|
|
2219
2188
|
}
|
|
2220
2189
|
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
|
-
|
|
2190
|
+
this.effect(
|
|
2191
|
+
([key2, path], old) => {
|
|
2192
|
+
if (old && key2 === old[0] && path === old[1]) {
|
|
2193
|
+
__privateGet2(this, _updateLocationStore).call(this);
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2196
|
+
const { route, params = {} } = GemRouteElement.findRoute(this.routes, path);
|
|
2197
|
+
const { redirect, content, getContent } = route || {};
|
|
2198
|
+
if (redirect) {
|
|
2199
|
+
history.replace({ path: redirect });
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2202
|
+
const title = route == null ? void 0 : route.title;
|
|
2203
|
+
if (title)
|
|
2204
|
+
updateStore(titleStore, { title });
|
|
2205
|
+
const contentOrLoader = content || (getContent == null ? void 0 : getContent(params));
|
|
2206
|
+
if (contentOrLoader instanceof Promise) {
|
|
2207
|
+
this.loading(route);
|
|
2208
|
+
__privateSet2(this, _lastLoader, contentOrLoader);
|
|
2209
|
+
const isSomeLoader = () => __privateGet2(this, _lastLoader) === contentOrLoader;
|
|
2210
|
+
contentOrLoader.then((content2) => {
|
|
2211
|
+
if (isSomeLoader())
|
|
2212
|
+
__privateGet2(this, _setContent).call(this, route, params, content2);
|
|
2213
|
+
}).catch((err) => {
|
|
2214
|
+
if (isSomeLoader())
|
|
2215
|
+
this.error(err);
|
|
2216
|
+
});
|
|
2217
|
+
return;
|
|
2218
|
+
}
|
|
2219
|
+
__privateGet2(this, _setContent).call(this, route, params, contentOrLoader);
|
|
2220
|
+
},
|
|
2221
|
+
() => {
|
|
2222
|
+
const { path } = history.getParams();
|
|
2223
|
+
return [this.key, path, location.search];
|
|
2248
2224
|
}
|
|
2249
|
-
|
|
2250
|
-
}, () => {
|
|
2251
|
-
const { path } = history.getParams();
|
|
2252
|
-
return [this.key, path, location.search];
|
|
2253
|
-
});
|
|
2225
|
+
);
|
|
2254
2226
|
}
|
|
2255
2227
|
shouldUpdate() {
|
|
2256
2228
|
if (this.inert)
|
|
@@ -2272,9 +2244,9 @@ let GemRouteElement = class extends GemElement {
|
|
|
2272
2244
|
`;
|
|
2273
2245
|
}
|
|
2274
2246
|
};
|
|
2275
|
-
_lastLoader = new WeakMap();
|
|
2276
|
-
_updateLocationStore = new WeakMap();
|
|
2277
|
-
_setContent = new WeakMap();
|
|
2247
|
+
_lastLoader = /* @__PURE__ */ new WeakMap();
|
|
2248
|
+
_updateLocationStore = /* @__PURE__ */ new WeakMap();
|
|
2249
|
+
_setContent = /* @__PURE__ */ new WeakMap();
|
|
2278
2250
|
GemRouteElement.createLocationStore = () => {
|
|
2279
2251
|
const { path, query, data } = history.getParams();
|
|
2280
2252
|
return createStore({ path, query, data, params: {} });
|
|
@@ -2288,7 +2260,7 @@ GemRouteElement.findRoute = (target = [], path) => {
|
|
|
2288
2260
|
routes = Object.values(target);
|
|
2289
2261
|
}
|
|
2290
2262
|
for (const route of routes) {
|
|
2291
|
-
if (route.pattern
|
|
2263
|
+
if ("*" === route.pattern) {
|
|
2292
2264
|
defaultRoute = route;
|
|
2293
2265
|
} else {
|
|
2294
2266
|
const params = matchPath(route.pattern, path);
|
|
@@ -2325,7 +2297,7 @@ GemRouteElement = __decorateClass$6([
|
|
|
2325
2297
|
], GemRouteElement);
|
|
2326
2298
|
class GemLightRouteElement extends GemRouteElement {
|
|
2327
2299
|
constructor(options = {}) {
|
|
2328
|
-
super(
|
|
2300
|
+
super({ ...options, isLight: true });
|
|
2329
2301
|
}
|
|
2330
2302
|
}
|
|
2331
2303
|
var __defProp$5 = Object.defineProperty;
|
|
@@ -2339,43 +2311,50 @@ var __decorateClass$5 = (decorators, target, key2, kind) => {
|
|
|
2339
2311
|
__defProp$5(target, key2, result);
|
|
2340
2312
|
return result;
|
|
2341
2313
|
};
|
|
2314
|
+
function isExternal(path) {
|
|
2315
|
+
return !path.startsWith("/");
|
|
2316
|
+
}
|
|
2342
2317
|
let GemLinkElement = (_a = class extends GemElement {
|
|
2343
2318
|
constructor() {
|
|
2344
2319
|
super();
|
|
2345
2320
|
__privateAdd(this, _routeOptions);
|
|
2346
|
-
this
|
|
2321
|
+
__privateAdd(this, _hint);
|
|
2322
|
+
__privateAdd(this, _onClick, void 0);
|
|
2323
|
+
__privateAdd(this, _preventDefault, void 0);
|
|
2324
|
+
__privateAdd(this, _getHint, void 0);
|
|
2325
|
+
__privateSet(this, _onClick, async () => {
|
|
2347
2326
|
var _a2;
|
|
2348
|
-
const
|
|
2349
|
-
if (!
|
|
2327
|
+
const locationString = this.getLocationString();
|
|
2328
|
+
if (!locationString)
|
|
2350
2329
|
return;
|
|
2351
|
-
if (
|
|
2330
|
+
if (isExternal(locationString)) {
|
|
2352
2331
|
switch (this.target) {
|
|
2353
2332
|
case "_self":
|
|
2354
|
-
window.location.href =
|
|
2333
|
+
window.location.href = locationString;
|
|
2355
2334
|
return;
|
|
2356
2335
|
case "_parent":
|
|
2357
|
-
window.parent.location.href =
|
|
2336
|
+
window.parent.location.href = locationString;
|
|
2358
2337
|
return;
|
|
2359
2338
|
case "_top":
|
|
2360
|
-
window.top.location.href =
|
|
2339
|
+
window.top.location.href = locationString;
|
|
2361
2340
|
return;
|
|
2362
2341
|
default:
|
|
2363
|
-
window.open(
|
|
2342
|
+
window.open(locationString);
|
|
2364
2343
|
return;
|
|
2365
2344
|
}
|
|
2366
2345
|
}
|
|
2367
2346
|
const { path, query, hash } = history.getParams();
|
|
2368
|
-
if (path + query + hash ===
|
|
2347
|
+
if (path + query + hash === locationString) {
|
|
2369
2348
|
return;
|
|
2370
2349
|
}
|
|
2371
|
-
e.stopPropagation();
|
|
2372
2350
|
await ((_a2 = this.prepare) == null ? void 0 : _a2.call(this));
|
|
2373
2351
|
if (this.route) {
|
|
2374
|
-
history.pushIgnoreCloseHandle(
|
|
2352
|
+
history.pushIgnoreCloseHandle({
|
|
2353
|
+
...createHistoryParams(this.route, __privateGet(this, _routeOptions, routeOptions_get)),
|
|
2375
2354
|
title: this.route.title || this.docTitle
|
|
2376
|
-
})
|
|
2355
|
+
});
|
|
2377
2356
|
} else if (this.href) {
|
|
2378
|
-
const { pathname, search, hash: hash2 } = new URL(
|
|
2357
|
+
const { pathname, search, hash: hash2 } = new URL(locationString, location.origin);
|
|
2379
2358
|
history.pushIgnoreCloseHandle({
|
|
2380
2359
|
path: pathname,
|
|
2381
2360
|
query: search,
|
|
@@ -2385,37 +2364,18 @@ let GemLinkElement = (_a = class extends GemElement {
|
|
|
2385
2364
|
} else {
|
|
2386
2365
|
history.pushIgnoreCloseHandle({ path: this.path, query: this.query, hash: this.hash, title: this.docTitle });
|
|
2387
2366
|
}
|
|
2388
|
-
};
|
|
2389
|
-
this
|
|
2367
|
+
});
|
|
2368
|
+
__privateSet(this, _preventDefault, (e) => {
|
|
2390
2369
|
e.preventDefault();
|
|
2391
|
-
};
|
|
2370
|
+
});
|
|
2371
|
+
__privateSet(this, _getHint, () => {
|
|
2372
|
+
const locationString = this.getLocationString();
|
|
2373
|
+
return isExternal(locationString) ? locationString : new URL(history.basePath + locationString, location.origin).toString();
|
|
2374
|
+
});
|
|
2392
2375
|
this.tabIndex = 0;
|
|
2393
|
-
this.addEventListener("click", this
|
|
2376
|
+
this.addEventListener("click", __privateGet(this, _onClick));
|
|
2394
2377
|
}
|
|
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()) {
|
|
2378
|
+
render() {
|
|
2419
2379
|
return html`
|
|
2420
2380
|
<style>
|
|
2421
2381
|
:host {
|
|
@@ -2434,16 +2394,38 @@ let GemLinkElement = (_a = class extends GemElement {
|
|
|
2434
2394
|
</style>
|
|
2435
2395
|
<a
|
|
2436
2396
|
part=${this.link}
|
|
2437
|
-
@click=${this
|
|
2438
|
-
href=${ifDefined(this
|
|
2397
|
+
@click=${__privateGet(this, _preventDefault)}
|
|
2398
|
+
href=${ifDefined(__privateGet(this, _hint, hint_get) === "off" ? void 0 : __privateGet(this, _getHint).call(this))}
|
|
2439
2399
|
>
|
|
2440
2400
|
<slot></slot>
|
|
2441
2401
|
</a>
|
|
2442
2402
|
`;
|
|
2443
2403
|
}
|
|
2404
|
+
getLocationString() {
|
|
2405
|
+
var _a2, _b2;
|
|
2406
|
+
if (this.route) {
|
|
2407
|
+
const queryProp = ((_a2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _a2.query) || "";
|
|
2408
|
+
const hashProp = ((_b2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _b2.hash) || "";
|
|
2409
|
+
return createPath(this.route, __privateGet(this, _routeOptions, routeOptions_get)) + queryProp + hashProp;
|
|
2410
|
+
} else {
|
|
2411
|
+
const url = this.href || this.path + this.query + this.hash;
|
|
2412
|
+
const { path, query } = history.getParams();
|
|
2413
|
+
if (url.startsWith("#")) {
|
|
2414
|
+
return `${path}${query}${url}`;
|
|
2415
|
+
} else if (url.startsWith("?")) {
|
|
2416
|
+
return `${path}${url}`;
|
|
2417
|
+
} else if (url.startsWith(".")) {
|
|
2418
|
+
return absoluteLocation(path, url);
|
|
2419
|
+
} else {
|
|
2420
|
+
return url;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2444
2424
|
}, _routeOptions = new WeakSet(), routeOptions_get = function() {
|
|
2445
2425
|
return this.routeOptions || this.options;
|
|
2446
|
-
},
|
|
2426
|
+
}, _hint = new WeakSet(), hint_get = function() {
|
|
2427
|
+
return this.hint || "on";
|
|
2428
|
+
}, _onClick = new WeakMap(), _preventDefault = new WeakMap(), _getHint = new WeakMap(), _a);
|
|
2447
2429
|
__decorateClass$5([
|
|
2448
2430
|
attribute
|
|
2449
2431
|
], GemLinkElement.prototype, "href", 2);
|
|
@@ -2484,16 +2466,13 @@ GemLinkElement = __decorateClass$5([
|
|
|
2484
2466
|
connectStore(basePathStore)
|
|
2485
2467
|
], GemLinkElement);
|
|
2486
2468
|
let GemActiveLinkElement = class extends GemLinkElement {
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
this.active =
|
|
2493
|
-
}
|
|
2494
|
-
this.active = false;
|
|
2495
|
-
}
|
|
2496
|
-
return super.render(pathInfo);
|
|
2469
|
+
constructor() {
|
|
2470
|
+
super();
|
|
2471
|
+
this.effect(() => {
|
|
2472
|
+
const { path, query, hash } = history.getParams();
|
|
2473
|
+
const isMatchPattern = this.pattern && matchPath(this.pattern, path);
|
|
2474
|
+
this.active = !!isMatchPattern || path + query + hash === this.getLocationString();
|
|
2475
|
+
});
|
|
2497
2476
|
}
|
|
2498
2477
|
};
|
|
2499
2478
|
__decorateClass$5([
|
|
@@ -2521,28 +2500,23 @@ var __decorateClass$4 = (decorators, target, key2, kind) => {
|
|
|
2521
2500
|
return result;
|
|
2522
2501
|
};
|
|
2523
2502
|
let GemTitleElement = class extends GemElement {
|
|
2503
|
+
constructor() {
|
|
2504
|
+
super();
|
|
2505
|
+
new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });
|
|
2506
|
+
}
|
|
2524
2507
|
static setTitle(title) {
|
|
2525
2508
|
updateStore(titleStore, { title });
|
|
2526
2509
|
}
|
|
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;
|
|
2510
|
+
static updateTitle(title = titleStore.title, prefix = "", suffix = "") {
|
|
2511
|
+
if (title === GemTitleElement.defaultTitle) {
|
|
2512
|
+
document.title = GemTitleElement.title = title;
|
|
2535
2513
|
} else {
|
|
2536
|
-
GemTitleElement.title =
|
|
2537
|
-
document.title = GemTitleElement.title;
|
|
2514
|
+
GemTitleElement.title = title;
|
|
2515
|
+
document.title = prefix + GemTitleElement.title + suffix;
|
|
2538
2516
|
}
|
|
2539
2517
|
}
|
|
2540
|
-
constructor() {
|
|
2541
|
-
super();
|
|
2542
|
-
new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });
|
|
2543
|
-
}
|
|
2544
2518
|
render() {
|
|
2545
|
-
GemTitleElement.updateTitle(this.textContent ||
|
|
2519
|
+
GemTitleElement.updateTitle(this.textContent || void 0, this.prefix, this.suffix);
|
|
2546
2520
|
if (this.hidden) {
|
|
2547
2521
|
return html``;
|
|
2548
2522
|
}
|
|
@@ -2551,7 +2525,11 @@ let GemTitleElement = class extends GemElement {
|
|
|
2551
2525
|
};
|
|
2552
2526
|
GemTitleElement.title = document.title;
|
|
2553
2527
|
GemTitleElement.defaultTitle = document.title;
|
|
2528
|
+
GemTitleElement.defaultPrefix = `${document.title} | `;
|
|
2554
2529
|
GemTitleElement.defaultSuffix = ` - ${document.title}`;
|
|
2530
|
+
__decorateClass$4([
|
|
2531
|
+
attribute
|
|
2532
|
+
], GemTitleElement.prototype, "prefix", 2);
|
|
2555
2533
|
__decorateClass$4([
|
|
2556
2534
|
attribute
|
|
2557
2535
|
], GemTitleElement.prototype, "suffix", 2);
|
|
@@ -2571,23 +2549,27 @@ var __decorateClass$3 = (decorators, target, key2, kind) => {
|
|
|
2571
2549
|
__defProp$3(target, key2, result);
|
|
2572
2550
|
return result;
|
|
2573
2551
|
};
|
|
2574
|
-
const eleCache = new Map();
|
|
2552
|
+
const eleCache = /* @__PURE__ */ new Map();
|
|
2575
2553
|
class GemUseElement extends GemElement {
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
temp
|
|
2583
|
-
|
|
2554
|
+
constructor() {
|
|
2555
|
+
super(...arguments);
|
|
2556
|
+
__privateAdd(this, _getContent, void 0);
|
|
2557
|
+
__privateSet(this, _getContent, () => {
|
|
2558
|
+
const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
|
|
2559
|
+
if (typeof ele === "string") {
|
|
2560
|
+
let temp = eleCache.get(ele);
|
|
2561
|
+
if (!temp) {
|
|
2562
|
+
temp = document.createElement("template");
|
|
2563
|
+
temp.innerHTML = ele;
|
|
2564
|
+
eleCache.set(ele, temp);
|
|
2565
|
+
}
|
|
2566
|
+
return temp.content.cloneNode(true);
|
|
2567
|
+
} else if (ele instanceof HTMLTemplateElement) {
|
|
2568
|
+
return ele.content.cloneNode(true);
|
|
2569
|
+
} else {
|
|
2570
|
+
return ele == null ? void 0 : ele.cloneNode(true);
|
|
2584
2571
|
}
|
|
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
|
-
}
|
|
2572
|
+
});
|
|
2591
2573
|
}
|
|
2592
2574
|
render() {
|
|
2593
2575
|
return html`
|
|
@@ -2602,11 +2584,12 @@ class GemUseElement extends GemElement {
|
|
|
2602
2584
|
height: 100%;
|
|
2603
2585
|
}
|
|
2604
2586
|
</style>
|
|
2605
|
-
${this.
|
|
2587
|
+
${__privateGet(this, _getContent).call(this)}
|
|
2606
2588
|
<slot></slot>
|
|
2607
2589
|
`;
|
|
2608
2590
|
}
|
|
2609
2591
|
}
|
|
2592
|
+
_getContent = new WeakMap();
|
|
2610
2593
|
__decorateClass$3([
|
|
2611
2594
|
attribute
|
|
2612
2595
|
], GemUseElement.prototype, "selector", 2);
|
|
@@ -2634,9 +2617,10 @@ var __decorateClass$2 = (decorators, target, key2, kind) => {
|
|
|
2634
2617
|
class GemUnsafeElement extends GemElement {
|
|
2635
2618
|
constructor() {
|
|
2636
2619
|
super();
|
|
2637
|
-
this.effect(
|
|
2638
|
-
|
|
2639
|
-
this.shadowRoot
|
|
2620
|
+
this.effect(
|
|
2621
|
+
() => {
|
|
2622
|
+
if (this.shadowRoot) {
|
|
2623
|
+
this.shadowRoot.innerHTML = `
|
|
2640
2624
|
<style>
|
|
2641
2625
|
:host(:where(:not([hidden]))) {
|
|
2642
2626
|
display: contents;
|
|
@@ -2645,8 +2629,10 @@ class GemUnsafeElement extends GemElement {
|
|
|
2645
2629
|
</style>
|
|
2646
2630
|
${this.content}
|
|
2647
2631
|
`;
|
|
2648
|
-
|
|
2649
|
-
|
|
2632
|
+
}
|
|
2633
|
+
},
|
|
2634
|
+
() => [this.content, this.contentcss]
|
|
2635
|
+
);
|
|
2650
2636
|
}
|
|
2651
2637
|
render() {
|
|
2652
2638
|
return void 0;
|
|
@@ -2676,18 +2662,21 @@ class GemReflectElement extends GemElement {
|
|
|
2676
2662
|
this.target = document.head;
|
|
2677
2663
|
this.hidden = true;
|
|
2678
2664
|
this.dataset.gemReflect = "";
|
|
2679
|
-
this.effect(
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
node
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2665
|
+
this.effect(
|
|
2666
|
+
() => {
|
|
2667
|
+
const childNodes = [...this.childNodes];
|
|
2668
|
+
childNodes.forEach((node) => {
|
|
2669
|
+
if (node instanceof HTMLElement) {
|
|
2670
|
+
node.dataset.reflect = "";
|
|
2671
|
+
}
|
|
2672
|
+
this.target.append(node);
|
|
2673
|
+
});
|
|
2674
|
+
return () => {
|
|
2675
|
+
childNodes.forEach((node) => node.remove());
|
|
2676
|
+
};
|
|
2677
|
+
},
|
|
2678
|
+
() => [this.target]
|
|
2679
|
+
);
|
|
2691
2680
|
}
|
|
2692
2681
|
}
|
|
2693
2682
|
__decorateClass$1([
|
|
@@ -2697,6 +2686,7 @@ customElements.define("gem-reflect", GemReflectElement);
|
|
|
2697
2686
|
const open = Symbol("open mark");
|
|
2698
2687
|
function createModalClass(options) {
|
|
2699
2688
|
var _a2;
|
|
2689
|
+
const final2 = Symbol();
|
|
2700
2690
|
return _a2 = class extends GemElement {
|
|
2701
2691
|
constructor() {
|
|
2702
2692
|
super();
|
|
@@ -2716,7 +2706,7 @@ function createModalClass(options) {
|
|
|
2716
2706
|
this.inertStore = [...document.body.children].filter((e) => !e.inert);
|
|
2717
2707
|
this.inertStore.forEach((e) => e.inert = true);
|
|
2718
2708
|
document.body.append(instance);
|
|
2719
|
-
const changeStore = () => updateStore(this.store,
|
|
2709
|
+
const changeStore = () => updateStore(this.store, { [open]: true, ...opts });
|
|
2720
2710
|
setTimeout(() => {
|
|
2721
2711
|
changeStore();
|
|
2722
2712
|
history.push({
|
|
@@ -2726,24 +2716,28 @@ function createModalClass(options) {
|
|
|
2726
2716
|
shouldClose: this.shouldClose.bind(this)
|
|
2727
2717
|
});
|
|
2728
2718
|
}, 100);
|
|
2719
|
+
return final2;
|
|
2729
2720
|
}
|
|
2730
2721
|
static close() {
|
|
2731
2722
|
history.back();
|
|
2723
|
+
return final2;
|
|
2732
2724
|
}
|
|
2733
2725
|
static closeHandle() {
|
|
2734
2726
|
var _a3;
|
|
2735
2727
|
this.inertStore.forEach((e) => e.inert = false);
|
|
2736
2728
|
(_a3 = this.instance) == null ? void 0 : _a3.remove();
|
|
2737
|
-
updateStore(this.store,
|
|
2729
|
+
updateStore(this.store, { [open]: false, ...options });
|
|
2730
|
+
return final2;
|
|
2738
2731
|
}
|
|
2739
2732
|
static shouldClose() {
|
|
2740
2733
|
return true;
|
|
2741
2734
|
}
|
|
2742
|
-
}, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore(
|
|
2743
|
-
[open]: false
|
|
2744
|
-
|
|
2735
|
+
}, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore({
|
|
2736
|
+
[open]: false,
|
|
2737
|
+
...options
|
|
2738
|
+
}), _a2;
|
|
2745
2739
|
}
|
|
2746
|
-
var
|
|
2740
|
+
var __defProp = Object.defineProperty;
|
|
2747
2741
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2748
2742
|
var __decorateClass = (decorators, target, key2, kind) => {
|
|
2749
2743
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;
|
|
@@ -2751,16 +2745,16 @@ var __decorateClass = (decorators, target, key2, kind) => {
|
|
|
2751
2745
|
if (decorator = decorators[i])
|
|
2752
2746
|
result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
|
|
2753
2747
|
if (kind && result)
|
|
2754
|
-
|
|
2748
|
+
__defProp(target, key2, result);
|
|
2755
2749
|
return result;
|
|
2756
2750
|
};
|
|
2751
|
+
const final = Symbol();
|
|
2757
2752
|
let GemDialogBaseElement = (_b = class extends GemElement {
|
|
2758
2753
|
constructor() {
|
|
2759
2754
|
super();
|
|
2760
2755
|
__privateAdd(this, _nextSibling, void 0);
|
|
2761
2756
|
__privateAdd(this, _parentElement, void 0);
|
|
2762
2757
|
__privateAdd(this, _inertStore, void 0);
|
|
2763
|
-
this.inert = true;
|
|
2764
2758
|
__privateSet(this, _inertStore, []);
|
|
2765
2759
|
this.closeHandle = () => {
|
|
2766
2760
|
var _a2;
|
|
@@ -2773,6 +2767,7 @@ let GemDialogBaseElement = (_b = class extends GemElement {
|
|
|
2773
2767
|
}
|
|
2774
2768
|
this.dispatchEvent(new CustomEvent("close"));
|
|
2775
2769
|
this.opened = false;
|
|
2770
|
+
return final;
|
|
2776
2771
|
};
|
|
2777
2772
|
this.openHandle = () => {
|
|
2778
2773
|
this.hidden = false;
|
|
@@ -2784,6 +2779,7 @@ let GemDialogBaseElement = (_b = class extends GemElement {
|
|
|
2784
2779
|
document.body.append(this);
|
|
2785
2780
|
this.dispatchEvent(new CustomEvent("open"));
|
|
2786
2781
|
this.opened = true;
|
|
2782
|
+
return final;
|
|
2787
2783
|
};
|
|
2788
2784
|
this.open = () => {
|
|
2789
2785
|
if (this.opened)
|
|
@@ -2795,14 +2791,18 @@ let GemDialogBaseElement = (_b = class extends GemElement {
|
|
|
2795
2791
|
close: this.closeHandle,
|
|
2796
2792
|
shouldClose: this.shouldClose
|
|
2797
2793
|
});
|
|
2794
|
+
return final;
|
|
2798
2795
|
};
|
|
2799
2796
|
this.close = () => {
|
|
2800
2797
|
history.back();
|
|
2798
|
+
return final;
|
|
2801
2799
|
};
|
|
2802
2800
|
this.forceClose = () => {
|
|
2803
2801
|
this.opened = false;
|
|
2804
2802
|
setTimeout(this.close, 100);
|
|
2803
|
+
return final;
|
|
2805
2804
|
};
|
|
2805
|
+
this.inert = true;
|
|
2806
2806
|
this.internals.role = "dialog";
|
|
2807
2807
|
this.internals.ariaModal = "true";
|
|
2808
2808
|
}
|
|
@@ -2819,45 +2819,41 @@ __decorateClass([
|
|
|
2819
2819
|
GemDialogBaseElement = __decorateClass([
|
|
2820
2820
|
connectStore(history.store)
|
|
2821
2821
|
], GemDialogBaseElement);
|
|
2822
|
-
const themeStoreMap = new WeakMap();
|
|
2822
|
+
const themeStoreMap = /* @__PURE__ */ new WeakMap();
|
|
2823
2823
|
function getThemeStore(theme) {
|
|
2824
2824
|
return themeStoreMap.get(theme);
|
|
2825
2825
|
}
|
|
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}}`;
|
|
2826
|
+
const themePropsMap = /* @__PURE__ */ new WeakMap();
|
|
2827
|
+
function getThemeProps(theme) {
|
|
2828
|
+
return themePropsMap.get(theme);
|
|
2839
2829
|
}
|
|
2830
|
+
const setThemeFnMap = /* @__PURE__ */ new WeakMap();
|
|
2840
2831
|
function createTheme(themeObj) {
|
|
2841
2832
|
const salt = randomStr();
|
|
2842
2833
|
const style = document.createElement("style");
|
|
2843
|
-
const
|
|
2834
|
+
const store2 = createStore(themeObj);
|
|
2844
2835
|
const theme = {};
|
|
2845
|
-
const
|
|
2846
|
-
|
|
2847
|
-
themeStoreMap.set(theme,
|
|
2848
|
-
Object.keys(
|
|
2849
|
-
|
|
2850
|
-
|
|
2836
|
+
const props = {};
|
|
2837
|
+
themePropsMap.set(theme, props);
|
|
2838
|
+
themeStoreMap.set(theme, store2);
|
|
2839
|
+
const setTheme = () => Object.keys(store2).forEach((key2) => {
|
|
2840
|
+
if (props[key2])
|
|
2841
|
+
return;
|
|
2842
|
+
props[key2] = `--${camelToKebabCase(key2)}-${salt}`;
|
|
2843
|
+
theme[key2] = `var(${props[key2]})`;
|
|
2851
2844
|
});
|
|
2852
|
-
|
|
2853
|
-
|
|
2845
|
+
setThemeFnMap.set(theme, setTheme);
|
|
2846
|
+
setTheme();
|
|
2847
|
+
const getStyle = () => `:root, :host {${Object.keys(store2).reduce((prev, key2) => prev + `${props[key2]}:${store2[key2]};`, "")}}`;
|
|
2848
|
+
const replace = () => style.textContent = getStyle();
|
|
2849
|
+
connect(store2, replace);
|
|
2854
2850
|
replace();
|
|
2855
2851
|
(document.head || document.documentElement).append(style);
|
|
2856
2852
|
return theme;
|
|
2857
2853
|
}
|
|
2858
2854
|
function updateTheme(theme, newThemeObj) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2855
|
+
updateStore(getThemeStore(theme), newThemeObj);
|
|
2856
|
+
setThemeFnMap.get(theme)();
|
|
2861
2857
|
}
|
|
2862
2858
|
const splitReg = /\$\d(?:<[^>]*>)?/;
|
|
2863
2859
|
const matchReg = /\$(\d)(<([^>]*)>)?/g;
|
|
@@ -2874,7 +2870,7 @@ function splice(rawValue, ...rest) {
|
|
|
2874
2870
|
}
|
|
2875
2871
|
return html(templateArr, ...values);
|
|
2876
2872
|
}
|
|
2877
|
-
const modules = new Set();
|
|
2873
|
+
const modules = /* @__PURE__ */ new Set();
|
|
2878
2874
|
const _I18n = class {
|
|
2879
2875
|
constructor(options) {
|
|
2880
2876
|
__privateAdd(this, _cacheCurrentKey);
|
|
@@ -3051,7 +3047,10 @@ const defaultReqInit = {
|
|
|
3051
3047
|
}
|
|
3052
3048
|
};
|
|
3053
3049
|
async function request(uri, options = {}) {
|
|
3054
|
-
const res = await fetch(uri,
|
|
3050
|
+
const res = await fetch(uri, {
|
|
3051
|
+
...defaultReqInit,
|
|
3052
|
+
...options
|
|
3053
|
+
});
|
|
3055
3054
|
if (res.status === 0)
|
|
3056
3055
|
throw new Error("Request fail");
|
|
3057
3056
|
if (res.status >= 500)
|
|
@@ -3092,63 +3091,59 @@ function put(url, body) {
|
|
|
3092
3091
|
function post(url, body) {
|
|
3093
3092
|
return request(url, { method: "POST", body: serializationBody(body) });
|
|
3094
3093
|
}
|
|
3095
|
-
const
|
|
3094
|
+
const match = (query) => window.matchMedia(query).matches;
|
|
3096
3095
|
const mediaQuery = {
|
|
3097
3096
|
PRINT: "print",
|
|
3098
3097
|
get isPrint() {
|
|
3099
|
-
return
|
|
3098
|
+
return match(this.PRINT);
|
|
3100
3099
|
},
|
|
3101
3100
|
HOVER: "(hover: hover)",
|
|
3102
3101
|
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);
|
|
3102
|
+
return match(this.HOVER);
|
|
3112
3103
|
},
|
|
3113
|
-
|
|
3114
|
-
get
|
|
3115
|
-
return
|
|
3104
|
+
PWA: "(display-mode: standalone)",
|
|
3105
|
+
get isPWA() {
|
|
3106
|
+
return match(this.PWA);
|
|
3116
3107
|
},
|
|
3117
|
-
|
|
3118
|
-
get
|
|
3119
|
-
return
|
|
3108
|
+
MOTION_REDUCE: "(prefers-reduced-motion: reduce)",
|
|
3109
|
+
get isMotionReduce() {
|
|
3110
|
+
return match(this.MOTION_REDUCE);
|
|
3120
3111
|
},
|
|
3121
|
-
|
|
3122
|
-
get
|
|
3123
|
-
return
|
|
3112
|
+
DATA_REDUCE: "(prefers-reduced-data: reduce)",
|
|
3113
|
+
get isDataReduce() {
|
|
3114
|
+
return match(this.DATA_REDUCE);
|
|
3124
3115
|
},
|
|
3125
|
-
|
|
3126
|
-
get
|
|
3127
|
-
return
|
|
3116
|
+
WATCH: "(width < 320px)",
|
|
3117
|
+
get isWatch() {
|
|
3118
|
+
return match(this.WATCH);
|
|
3128
3119
|
},
|
|
3129
|
-
SMALL_PHONE: "(
|
|
3120
|
+
SMALL_PHONE: "(320px <= width <= 480px) and (height <= 640px)",
|
|
3130
3121
|
get isSmallPhone() {
|
|
3131
|
-
return
|
|
3122
|
+
return match(this.SMALL_PHONE);
|
|
3132
3123
|
},
|
|
3133
|
-
|
|
3134
|
-
get
|
|
3135
|
-
return
|
|
3124
|
+
PHONE: "(320px <= width <= 480px)",
|
|
3125
|
+
get isPhone() {
|
|
3126
|
+
return match(this.PHONE);
|
|
3127
|
+
},
|
|
3128
|
+
PHONE_LANDSCAPE: "(480px < width < 960px) and (orientation: landscape)",
|
|
3129
|
+
get isPhoneLandscape() {
|
|
3130
|
+
return match(this.PHONE_LANDSCAPE);
|
|
3136
3131
|
},
|
|
3137
|
-
SHORT: "(
|
|
3132
|
+
SHORT: "(width >= 480px) and (height <= 320px)",
|
|
3138
3133
|
get isShort() {
|
|
3139
|
-
return
|
|
3134
|
+
return match(this.SHORT);
|
|
3140
3135
|
},
|
|
3141
|
-
|
|
3142
|
-
get
|
|
3143
|
-
return
|
|
3136
|
+
TABLET: "(480px < width <= 1280px)",
|
|
3137
|
+
get isTablet() {
|
|
3138
|
+
return match(this.TABLET);
|
|
3144
3139
|
},
|
|
3145
|
-
|
|
3146
|
-
get
|
|
3147
|
-
return
|
|
3140
|
+
DESKTOP: "(width > 1280px) and (orientation: landscape)",
|
|
3141
|
+
get isDesktop() {
|
|
3142
|
+
return match(this.DESKTOP);
|
|
3148
3143
|
},
|
|
3149
|
-
|
|
3150
|
-
get
|
|
3151
|
-
return
|
|
3144
|
+
WIDTHSCREEN: "(width >= 1920px) and (orientation: landscape)",
|
|
3145
|
+
get isWidthScreen() {
|
|
3146
|
+
return match(this.WIDTHSCREEN);
|
|
3152
3147
|
}
|
|
3153
3148
|
};
|
|
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,
|
|
3149
|
+
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 };
|