@mantou/gem 1.7.0 → 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.
Files changed (98) hide show
  1. package/dist/gem.es.js +402 -543
  2. package/dist/gem.umd.js +27 -33
  3. package/elements/base/dialog.d.ts +9 -7
  4. package/elements/base/dialog.d.ts.map +1 -1
  5. package/elements/base/dialog.js +12 -3
  6. package/elements/base/dialog.js.map +1 -1
  7. package/elements/base/gesture.d.ts +4 -13
  8. package/elements/base/gesture.d.ts.map +1 -1
  9. package/elements/base/gesture.js +152 -135
  10. package/elements/base/gesture.js.map +1 -1
  11. package/elements/base/link.d.ts +12 -9
  12. package/elements/base/link.d.ts.map +1 -1
  13. package/elements/base/link.js +81 -62
  14. package/elements/base/link.js.map +1 -1
  15. package/elements/base/modal-factory.d.ts +104 -80
  16. package/elements/base/modal-factory.d.ts.map +1 -1
  17. package/elements/base/modal-factory.js +12 -8
  18. package/elements/base/modal-factory.js.map +1 -1
  19. package/elements/base/reflect.js.map +1 -1
  20. package/elements/base/route.d.ts +12 -5
  21. package/elements/base/route.d.ts.map +1 -1
  22. package/elements/base/route.js +17 -5
  23. package/elements/base/route.js.map +1 -1
  24. package/elements/base/title.d.ts +3 -1
  25. package/elements/base/title.d.ts.map +1 -1
  26. package/elements/base/title.js +14 -16
  27. package/elements/base/title.js.map +1 -1
  28. package/elements/base/unsafe.js +1 -1
  29. package/elements/base/unsafe.js.map +1 -1
  30. package/elements/base/use.d.ts +1 -1
  31. package/elements/base/use.d.ts.map +1 -1
  32. package/elements/base/use.js +28 -20
  33. package/elements/base/use.js.map +1 -1
  34. package/helper/i18n.d.ts +4 -4
  35. package/helper/i18n.d.ts.map +1 -1
  36. package/helper/i18n.js.map +1 -1
  37. package/helper/mediaquery.d.ts +16 -18
  38. package/helper/mediaquery.d.ts.map +1 -1
  39. package/helper/mediaquery.js +42 -41
  40. package/helper/mediaquery.js.map +1 -1
  41. package/helper/request.d.ts +1 -1
  42. package/helper/request.d.ts.map +1 -1
  43. package/helper/request.js.map +1 -1
  44. package/helper/ssr-shim.d.ts +2 -0
  45. package/helper/ssr-shim.d.ts.map +1 -0
  46. package/helper/ssr-shim.js +29 -0
  47. package/helper/ssr-shim.js.map +1 -0
  48. package/helper/theme.d.ts +2 -2
  49. package/helper/theme.d.ts.map +1 -1
  50. package/helper/theme.js +20 -24
  51. package/helper/theme.js.map +1 -1
  52. package/index.d.ts +0 -10
  53. package/index.d.ts.map +1 -1
  54. package/index.js +0 -7
  55. package/index.js.map +1 -1
  56. package/lib/decorators.d.ts +4 -4
  57. package/lib/decorators.d.ts.map +1 -1
  58. package/lib/decorators.js +1 -2
  59. package/lib/decorators.js.map +1 -1
  60. package/lib/element.d.ts +16 -10
  61. package/lib/element.d.ts.map +1 -1
  62. package/lib/element.js +57 -79
  63. package/lib/element.js.map +1 -1
  64. package/lib/history.d.ts +1 -1
  65. package/lib/history.d.ts.map +1 -1
  66. package/lib/history.js +2 -2
  67. package/lib/history.js.map +1 -1
  68. package/lib/store.d.ts +2 -2
  69. package/lib/store.d.ts.map +1 -1
  70. package/lib/store.js.map +1 -1
  71. package/lib/utils.d.ts +8 -32
  72. package/lib/utils.d.ts.map +1 -1
  73. package/lib/utils.js +6 -21
  74. package/lib/utils.js.map +1 -1
  75. package/lib/version.d.ts +1 -1
  76. package/lib/version.js +1 -1
  77. package/package.json +2 -2
  78. package/src/elements/base/dialog.ts +10 -3
  79. package/src/elements/base/gesture.ts +52 -46
  80. package/src/elements/base/link.ts +69 -61
  81. package/src/elements/base/modal-factory.ts +5 -0
  82. package/src/elements/base/route.ts +22 -5
  83. package/src/elements/base/title.ts +8 -11
  84. package/src/elements/base/unsafe.ts +1 -1
  85. package/src/elements/base/use.ts +4 -6
  86. package/src/helper/i18n.ts +3 -3
  87. package/src/helper/mediaquery.ts +43 -42
  88. package/src/helper/ssr-shim.ts +29 -0
  89. package/src/helper/theme.ts +22 -24
  90. package/src/index.ts +0 -16
  91. package/src/lib/decorators.ts +1 -2
  92. package/src/lib/element.ts +56 -71
  93. package/src/lib/history.ts +2 -1
  94. package/src/lib/utils.ts +10 -42
  95. package/src/lib/version.ts +1 -1
  96. package/src/test/gem-element/decorators.test.ts +6 -6
  97. package/src/test/history.test.ts +3 -1
  98. 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,36 +20,26 @@ 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, _nextSibling, _parentElement, _inertStore, _a, _cacheCurrentKey, cacheCurrentKey_get, _urlParamsLang, urlParamsLang_get, _cacheLang, cacheLang_get, _isMain, isMain_get, _lang, lang_set;
43
- var Gem = /* @__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
- get StoreListenerMap() {
47
- return StoreListenerMap;
48
- },
49
- get createStore() {
50
- return createStore;
51
- },
52
- get createStoreSet() {
53
- return createStoreSet;
54
- },
55
- get updateStore() {
56
- return updateStore;
26
+ get GemElement() {
27
+ return GemElement;
57
28
  },
58
- get connect() {
59
- return connect;
29
+ get defineAttribute() {
30
+ return defineAttribute;
60
31
  },
61
- get disconnect() {
62
- return disconnect;
32
+ get defineProperty() {
33
+ return defineProperty;
63
34
  },
64
- get history() {
65
- return history;
35
+ get defineRef() {
36
+ return defineRef;
66
37
  },
67
- get titleStore() {
68
- return titleStore;
38
+ get defineCSSState() {
39
+ return defineCSSState;
69
40
  },
70
- get basePathStore() {
71
- return basePathStore;
41
+ get nativeDefineElement() {
42
+ return nativeDefineElement;
72
43
  },
73
44
  get html() {
74
45
  return html;
@@ -96,143 +67,8 @@ var Gem = /* @__PURE__ */ Object.freeze({
96
67
  },
97
68
  get ifDefined() {
98
69
  return ifDefined;
99
- },
100
- get GemElement() {
101
- return GemElement;
102
- },
103
- get defineAttribute() {
104
- return defineAttribute;
105
- },
106
- get defineProperty() {
107
- return defineProperty;
108
- },
109
- get defineRef() {
110
- return defineRef;
111
- },
112
- get defineCSSState() {
113
- return defineCSSState;
114
- },
115
- get nativeDefineElement() {
116
- return nativeDefineElement;
117
- },
118
- get refobject() {
119
- return refobject;
120
- },
121
- get attribute() {
122
- return attribute;
123
- },
124
- get boolattribute() {
125
- return boolattribute;
126
- },
127
- get numattribute() {
128
- return numattribute;
129
- },
130
- get property() {
131
- return property;
132
- },
133
- get state() {
134
- return state;
135
- },
136
- get slot() {
137
- return slot;
138
- },
139
- get part() {
140
- return part;
141
- },
142
- get emitter() {
143
- return emitter;
144
- },
145
- get globalemitter() {
146
- return globalemitter;
147
- },
148
- get adoptedStyle() {
149
- return adoptedStyle;
150
- },
151
- get connectStore() {
152
- return connectStore;
153
- },
154
- get rootElement() {
155
- return rootElement;
156
- },
157
- get customElement() {
158
- return customElement;
159
- },
160
- get addMicrotask() {
161
- return addMicrotask;
162
- },
163
- get addMicrotaskToStack() {
164
- return addMicrotaskToStack;
165
- },
166
- get absoluteLocation() {
167
- return absoluteLocation;
168
- },
169
- get LinkedList() {
170
- return LinkedList;
171
- },
172
- get PropProxyMap() {
173
- return PropProxyMap;
174
- },
175
- get QueryString() {
176
- return QueryString;
177
- },
178
- get raw() {
179
- return raw;
180
- },
181
- get css() {
182
- return css;
183
- },
184
- get SheetToken() {
185
- return SheetToken;
186
- },
187
- get useNativeCSSStyleSheet() {
188
- return useNativeCSSStyleSheet;
189
- },
190
- get createCSSSheet() {
191
- return createCSSSheet;
192
- },
193
- get randomStr() {
194
- return randomStr;
195
- },
196
- get styled() {
197
- return styled;
198
- },
199
- get camelToKebabCase() {
200
- return camelToKebabCase;
201
- },
202
- get kebabToCamelCase() {
203
- return kebabToCamelCase;
204
- },
205
- get cleanObject() {
206
- return cleanObject;
207
- },
208
- get GemError() {
209
- return GemError;
210
- },
211
- get isArrayChange() {
212
- return isArrayChange;
213
- },
214
- get removeItems() {
215
- return removeItems;
216
- },
217
- get objectMapToString() {
218
- return objectMapToString;
219
- },
220
- get styleMap() {
221
- return styleMap;
222
- },
223
- get classMap() {
224
- return classMap;
225
- },
226
- get partMap() {
227
- return partMap;
228
- },
229
- get exportPartsMap() {
230
- return exportPartsMap;
231
- },
232
- get version() {
233
- return version;
234
70
  }
235
- });
71
+ }, Symbol.toStringTag, { value: "Module" }));
236
72
  /**
237
73
  * @license
238
74
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -246,7 +82,7 @@ var Gem = /* @__PURE__ */ Object.freeze({
246
82
  * subject to an additional IP rights grant found at
247
83
  * http://polymer.github.io/PATENTS.txt
248
84
  */
249
- const directives = new WeakMap();
85
+ const directives = /* @__PURE__ */ new WeakMap();
250
86
  const directive = (f) => (...args) => {
251
87
  const d = f(...args);
252
88
  directives.set(d, true);
@@ -370,9 +206,9 @@ class Template {
370
206
  if (s === "") {
371
207
  insert = createMarker();
372
208
  } else {
373
- const match = lastAttributeNameRegex.exec(s);
374
- if (match !== null && endsWith(match[2], boundAttributeSuffix)) {
375
- s = s.slice(0, match.index) + match[1] + match[2].slice(0, -boundAttributeSuffix.length) + match[3];
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];
376
212
  }
377
213
  insert = document.createTextNode(s);
378
214
  }
@@ -949,8 +785,8 @@ function templateFactory(result) {
949
785
  let templateCache = templateCaches.get(result.type);
950
786
  if (templateCache === void 0) {
951
787
  templateCache = {
952
- stringsArray: new WeakMap(),
953
- keyString: new Map()
788
+ stringsArray: /* @__PURE__ */ new WeakMap(),
789
+ keyString: /* @__PURE__ */ new Map()
954
790
  };
955
791
  templateCaches.set(result.type, templateCache);
956
792
  }
@@ -967,7 +803,7 @@ function templateFactory(result) {
967
803
  templateCache.stringsArray.set(result.strings, template);
968
804
  return template;
969
805
  }
970
- const templateCaches = new Map();
806
+ const templateCaches = /* @__PURE__ */ new Map();
971
807
  /**
972
808
  * @license
973
809
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -981,7 +817,7 @@ const templateCaches = new Map();
981
817
  * subject to an additional IP rights grant found at
982
818
  * http://polymer.github.io/PATENTS.txt
983
819
  */
984
- const parts = new WeakMap();
820
+ const parts = /* @__PURE__ */ new WeakMap();
985
821
  const render = (result, container, options) => {
986
822
  let part2 = parts.get(container);
987
823
  if (part2 === void 0) {
@@ -1010,7 +846,7 @@ if (typeof window !== "undefined") {
1010
846
  }
1011
847
  const html = (strings, ...values) => new TemplateResult(strings, values, "html", defaultTemplateProcessor);
1012
848
  const svg = (strings, ...values) => new SVGTemplateResult(strings, values, "svg", defaultTemplateProcessor);
1013
- const microtaskSet = new Set();
849
+ const microtaskSet = /* @__PURE__ */ new Set();
1014
850
  function addMicrotask(func) {
1015
851
  if (typeof func !== "function")
1016
852
  return;
@@ -1040,14 +876,14 @@ function absoluteLocation(currentPath = "", relativePath = "") {
1040
876
  const { pathname, search, hash } = new URL(relativePath, location.origin + currentPath);
1041
877
  return pathname + search + hash;
1042
878
  }
1043
- class LinkedList extends (globalThis.EventTarget || Object) {
879
+ class LinkedList extends EventTarget {
1044
880
  constructor() {
1045
881
  super(...arguments);
1046
882
  __privateAdd(this, _delete);
1047
883
  __privateAdd(this, _map, void 0);
1048
884
  __privateAdd(this, _firstItem, void 0);
1049
885
  __privateAdd(this, _lastItem, void 0);
1050
- __privateSet(this, _map, new Map());
886
+ __privateSet(this, _map, /* @__PURE__ */ new Map());
1051
887
  }
1052
888
  get size() {
1053
889
  return __privateGet(this, _map).size;
@@ -1174,20 +1010,6 @@ function css(arr, ...args) {
1174
1010
  return raw(arr, ...args);
1175
1011
  }
1176
1012
  const SheetToken = Symbol.for("gem@sheetToken");
1177
- let useNativeCSSStyleSheet = true;
1178
- let CSSStyleSheet = window.CSSStyleSheet;
1179
- try {
1180
- new CSSStyleSheet();
1181
- } catch {
1182
- useNativeCSSStyleSheet = false;
1183
- CSSStyleSheet = class {
1184
- constructor() {
1185
- this.media = { mediaText: "" };
1186
- this.style = "";
1187
- this.replaceSync = (style) => this.style = style;
1188
- }
1189
- };
1190
- }
1191
1013
  function createCSSSheet(rules, mediaQuery2 = "") {
1192
1014
  const styleSheet = new CSSStyleSheet();
1193
1015
  const sheet = {};
@@ -1286,21 +1108,29 @@ function objectMapToString(object, separate, toString) {
1286
1108
  return result;
1287
1109
  }
1288
1110
  function styleMap(object) {
1289
- return objectMapToString(object, ";", (key2, value) => value !== void 0 ? `${camelToKebabCase(key2)}:${value}` : "");
1111
+ return objectMapToString(
1112
+ object,
1113
+ ";",
1114
+ (key2, value) => value !== void 0 ? `${camelToKebabCase(key2)}:${value}` : ""
1115
+ );
1290
1116
  }
1291
1117
  function classMap(object) {
1292
1118
  return objectMapToString(object, " ", (key2, value) => value ? key2 : "");
1293
1119
  }
1294
1120
  const partMap = classMap;
1295
1121
  function exportPartsMap(object) {
1296
- return objectMapToString(object, ",", (key2, value) => value !== void 0 ? `${key2}:${value}` : "");
1122
+ return objectMapToString(
1123
+ object,
1124
+ ",",
1125
+ (key2, value) => value === true || key2 === value ? key2 : value ? `${key2}:${value}` : ""
1126
+ );
1297
1127
  }
1298
- const StoreListenerMap = new WeakMap();
1128
+ const StoreListenerMap = /* @__PURE__ */ new WeakMap();
1299
1129
  function createStore(originStore) {
1300
1130
  if (StoreListenerMap.has(originStore)) {
1301
1131
  throw new GemError("argument error");
1302
1132
  }
1303
- StoreListenerMap.set(originStore, new Set());
1133
+ StoreListenerMap.set(originStore, /* @__PURE__ */ new Set());
1304
1134
  return originStore;
1305
1135
  }
1306
1136
  function createStoreSet(originStoreSet) {
@@ -1325,6 +1155,11 @@ function disconnect(store2, func) {
1325
1155
  const listeners = StoreListenerMap.get(store2);
1326
1156
  listeners == null ? void 0 : listeners.delete(func);
1327
1157
  }
1158
+ const version = "1.7.2";
1159
+ var VersionExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1160
+ __proto__: null,
1161
+ version
1162
+ }, Symbol.toStringTag, { value: "Module" }));
1328
1163
  /**
1329
1164
  * @license
1330
1165
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -1364,14 +1199,14 @@ const removePart = (part2) => {
1364
1199
  removeNodes(part2.startNode.parentNode, part2.startNode, part2.endNode.nextSibling);
1365
1200
  };
1366
1201
  const generateMap = (list, start, end) => {
1367
- const map = new Map();
1202
+ const map = /* @__PURE__ */ new Map();
1368
1203
  for (let i = start; i <= end; i++) {
1369
1204
  map.set(list[i], i);
1370
1205
  }
1371
1206
  return map;
1372
1207
  };
1373
- const partListCache = new WeakMap();
1374
- const keyListCache = new WeakMap();
1208
+ const partListCache = /* @__PURE__ */ new WeakMap();
1209
+ const keyListCache = /* @__PURE__ */ new WeakMap();
1375
1210
  const repeat = directive((items, keyFnOrTemplate, template) => {
1376
1211
  let keyFn;
1377
1212
  if (template === void 0) {
@@ -1478,7 +1313,7 @@ const repeat = directive((items, keyFnOrTemplate, template) => {
1478
1313
  * subject to an additional IP rights grant found at
1479
1314
  * http://polymer.github.io/PATENTS.txt
1480
1315
  */
1481
- const previousValues$1 = new WeakMap();
1316
+ const previousValues$1 = /* @__PURE__ */ new WeakMap();
1482
1317
  const guard = directive((value, f) => (part2) => {
1483
1318
  const previousValue = previousValues$1.get(part2);
1484
1319
  if (Array.isArray(value)) {
@@ -1504,7 +1339,7 @@ const guard = directive((value, f) => (part2) => {
1504
1339
  * subject to an additional IP rights grant found at
1505
1340
  * http://polymer.github.io/PATENTS.txt
1506
1341
  */
1507
- const previousValues = new WeakMap();
1342
+ const previousValues = /* @__PURE__ */ new WeakMap();
1508
1343
  const ifDefined = directive((value) => (part2) => {
1509
1344
  const previousValue = previousValues.get(part2);
1510
1345
  if (value === void 0 && part2 instanceof AttributePart) {
@@ -1535,7 +1370,7 @@ var __privateSet$1 = (obj, member, value, setter) => {
1535
1370
  setter ? setter.call(obj, value) : member.set(obj, value);
1536
1371
  return value;
1537
1372
  };
1538
- 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;
1539
1374
  function emptyFunction() {
1540
1375
  }
1541
1376
  function execCallback(fun) {
@@ -1555,8 +1390,8 @@ asyncRenderTaskList.addEventListener("start", () => addMicrotask(tick));
1555
1390
  const constructorSymbol = Symbol("constructor");
1556
1391
  const initSymbol = Symbol("init");
1557
1392
  const updateSymbol = Symbol("update");
1558
- class GemElement extends HTMLElement {
1559
- constructor({ isAsync, isLight, delegatesFocus } = {}) {
1393
+ const _GemElement = class extends HTMLElement {
1394
+ constructor({ isAsync, isLight, delegatesFocus, slotAssignment } = {}) {
1560
1395
  super();
1561
1396
  __privateAdd$1(this, _renderRoot, void 0);
1562
1397
  __privateAdd$1(this, _internals, void 0);
@@ -1627,18 +1462,10 @@ class GemElement extends HTMLElement {
1627
1462
  });
1628
1463
  });
1629
1464
  __privateAdd$1(this, _render, () => {
1630
- var _a2, _b;
1631
1465
  __privateGet$1(this, _execMemo).call(this);
1632
- const styles = useNativeCSSStyleSheet ? "" : html`${(_b = (_a2 = this.shadowRoot) == null ? void 0 : _a2.adoptedStyleSheets) == null ? void 0 : _b.map((e) => html`
1633
- <style media=${e.media.mediaText}>
1634
- ${e.style}
1635
- </style>
1636
- `)}`;
1637
- if (this.render) {
1638
- const r = this.render();
1639
- return r && html`${r}${styles}`;
1640
- }
1641
- 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>`;
1642
1469
  });
1643
1470
  __privateAdd$1(this, _shouldUpdate, () => {
1644
1471
  return this.shouldUpdate ? this.shouldUpdate() : true;
@@ -1666,12 +1493,12 @@ class GemElement extends HTMLElement {
1666
1493
  (_a2 = this.updated) == null ? void 0 : _a2.call(this);
1667
1494
  });
1668
1495
  __privateAdd$1(this, _connectedCallback, () => {
1669
- var _a2, _b, _c;
1670
- this[constructorSymbol] = false;
1496
+ var _a2, _b2, _c;
1671
1497
  if (__privateGet$1(this, _isAppendReason)) {
1672
1498
  __privateSet$1(this, _isAppendReason, false);
1673
1499
  return;
1674
1500
  }
1501
+ Reflect.set(this, constructorSymbol, false);
1675
1502
  (_a2 = this.willMount) == null ? void 0 : _a2.call(this);
1676
1503
  const { observedStores, rootElement: rootElement2 } = this.constructor;
1677
1504
  observedStores == null ? void 0 : observedStores.forEach((store2) => {
@@ -1680,76 +1507,54 @@ class GemElement extends HTMLElement {
1680
1507
  const temp = __privateGet$1(this, _render).call(this);
1681
1508
  temp !== void 0 && render(temp, __privateGet$1(this, _renderRoot));
1682
1509
  __privateSet$1(this, _isMounted, true);
1683
- __privateSet$1(this, _unmountCallback, (_b = this.mounted) == null ? void 0 : _b.call(this));
1510
+ __privateSet$1(this, _unmountCallback, (_b2 = this.mounted) == null ? void 0 : _b2.call(this));
1684
1511
  __privateGet$1(this, _initEffect).call(this);
1685
1512
  if (rootElement2 && ((_c = this.getRootNode().host) == null ? void 0 : _c.tagName) !== rootElement2.toUpperCase()) {
1686
1513
  throw new GemError(`not allow current root type`);
1687
1514
  }
1688
1515
  });
1689
- this[constructorSymbol] = true;
1690
- addMicrotask(() => this[initSymbol] = false);
1691
- this[initSymbol] = true;
1692
- this[updateSymbol] = () => {
1516
+ addMicrotask(() => Reflect.set(this, initSymbol, false));
1517
+ Reflect.set(this, constructorSymbol, true);
1518
+ Reflect.set(this, initSymbol, true);
1519
+ Reflect.set(this, updateSymbol, () => {
1693
1520
  if (__privateGet$1(this, _isMounted)) {
1694
1521
  addMicrotask(__privateGet$1(this, _update));
1695
1522
  }
1696
- };
1523
+ });
1697
1524
  __privateSet$1(this, _isAsync, isAsync);
1698
- __privateSet$1(this, _renderRoot, isLight ? this : this.attachShadow({ mode: "open", delegatesFocus }));
1525
+ __privateSet$1(this, _renderRoot, isLight ? this : this.attachShadow({ mode: "open", delegatesFocus, slotAssignment }));
1699
1526
  const { adoptedStyleSheets } = new.target;
1700
1527
  if (adoptedStyleSheets) {
1701
1528
  const sheets = adoptedStyleSheets.map((item) => item[SheetToken] || item);
1702
1529
  if (this.shadowRoot) {
1703
1530
  this.shadowRoot.adoptedStyleSheets = sheets;
1704
1531
  } else {
1705
- this.effect(() => {
1706
- const root = this.getRootNode();
1707
- if (!useNativeCSSStyleSheet) {
1708
- const ele = root === document ? document.body : root;
1709
- ele._sheets = ele._sheets || {};
1710
- sheets.forEach(({ style, media }) => {
1711
- if (ele._sheets[style]) {
1712
- ele._sheets[style].count++;
1713
- } else {
1714
- const s = document.createElement("style");
1715
- s.innerHTML = style;
1716
- s.media = media.mediaText;
1717
- ele.append(s);
1718
- ele._sheets[style] = { ele: s, count: 1 };
1719
- }
1720
- });
1721
- return () => {
1722
- sheets.forEach(({ style }) => {
1723
- ele._sheets[style].count--;
1724
- if (!ele._sheets[style].count) {
1725
- delete ele._sheets[style];
1726
- }
1727
- });
1728
- };
1729
- } else {
1532
+ this.effect(
1533
+ () => {
1534
+ const root = this.getRootNode();
1730
1535
  root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];
1731
1536
  return () => {
1732
1537
  root.adoptedStyleSheets = removeItems(root.adoptedStyleSheets, sheets);
1733
1538
  };
1734
- }
1735
- }, () => []);
1539
+ },
1540
+ () => []
1541
+ );
1736
1542
  }
1737
1543
  }
1738
1544
  }
1739
1545
  get internals() {
1740
- var _a2, _b;
1741
1546
  if (!__privateGet$1(this, _internals)) {
1742
1547
  __privateSet$1(this, _internals, this.attachInternals());
1743
1548
  try {
1744
- (_a2 = __privateGet$1(this, _internals).states) == null ? void 0 : _a2.add("foo");
1745
- (_b = __privateGet$1(this, _internals).states) == null ? void 0 : _b.delete("foo");
1549
+ __privateGet$1(this, _internals).states.add("foo");
1550
+ __privateGet$1(this, _internals).states.delete("foo");
1746
1551
  } catch {
1747
1552
  Reflect.defineProperty(__privateGet$1(this, _internals), "states", {
1748
- value: new Proxy(__privateGet$1(this, _internals).states, {
1749
- get(target, p) {
1750
- return (str) => target[p](`--${str}`);
1751
- }
1752
- })
1553
+ value: {
1554
+ has: (v) => kebabToCamelCase(v) in this.dataset,
1555
+ add: (v) => this.dataset[kebabToCamelCase(v)] = "",
1556
+ delete: (v) => delete this.dataset[kebabToCamelCase(v)]
1557
+ }
1753
1558
  });
1754
1559
  }
1755
1560
  }
@@ -1759,6 +1564,7 @@ class GemElement extends HTMLElement {
1759
1564
  if (__privateGet$1(this, _isMounted)) {
1760
1565
  addMicrotask(__privateGet$1(this, _update));
1761
1566
  }
1567
+ return __privateGet$1(_GemElement, _final);
1762
1568
  }
1763
1569
  closestElement(constructorOrTag) {
1764
1570
  const isConstructor = typeof constructorOrTag === "function";
@@ -1784,9 +1590,13 @@ class GemElement extends HTMLElement {
1784
1590
  } else {
1785
1591
  __privateGet$1(this, _connectedCallback).call(this);
1786
1592
  }
1593
+ return __privateGet$1(_GemElement, _final);
1594
+ }
1595
+ adoptedCallback() {
1596
+ return __privateGet$1(_GemElement, _final);
1787
1597
  }
1788
1598
  disconnectedCallback() {
1789
- var _a2, _b, _c, _d;
1599
+ var _a2, _b2, _c, _d;
1790
1600
  if (this.isConnected) {
1791
1601
  __privateSet$1(this, _isAppendReason, true);
1792
1602
  return;
@@ -1798,31 +1608,35 @@ class GemElement extends HTMLElement {
1798
1608
  });
1799
1609
  execCallback(__privateGet$1(this, _unmountCallback));
1800
1610
  (_a2 = this.unmounted) == null ? void 0 : _a2.call(this);
1801
- (_b = __privateGet$1(this, _effectList)) == null ? void 0 : _b.forEach((effectItem) => {
1611
+ (_b2 = __privateGet$1(this, _effectList)) == null ? void 0 : _b2.forEach((effectItem) => {
1802
1612
  execCallback(effectItem.preCallback);
1803
1613
  });
1804
1614
  __privateSet$1(this, _effectList, (_c = __privateGet$1(this, _effectList)) == null ? void 0 : _c.filter(({ inConstructor }) => inConstructor));
1805
1615
  __privateSet$1(this, _memoList, (_d = __privateGet$1(this, _memoList)) == null ? void 0 : _d.filter(({ inConstructor }) => inConstructor));
1616
+ return __privateGet$1(_GemElement, _final);
1806
1617
  }
1807
- }
1808
- _renderRoot = new WeakMap();
1809
- _internals = new WeakMap();
1810
- _isAppendReason = new WeakMap();
1811
- _isMounted = new WeakMap();
1812
- _isAsync = new WeakMap();
1813
- _effectList = new WeakMap();
1814
- _memoList = new WeakMap();
1815
- _unmountCallback = new WeakMap();
1816
- _exec = new WeakMap();
1817
- _execEffect = new WeakMap();
1818
- _execMemo = new WeakMap();
1819
- _initEffect = new WeakMap();
1820
- _render = new WeakMap();
1821
- _shouldUpdate = new WeakMap();
1822
- _updateCallback = new WeakMap();
1823
- _update = new WeakMap();
1824
- _updated = new WeakMap();
1825
- _connectedCallback = new WeakMap();
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());
1826
1640
  const gemElementProxyMap = new PropProxyMap();
1827
1641
  function defineAttribute(target, prop, attr) {
1828
1642
  const { booleanAttributes, numberAttributes } = target.constructor;
@@ -1880,11 +1694,11 @@ function defineProperty(target, prop, event, eventOptions) {
1880
1694
  if (v !== proxy[prop]) {
1881
1695
  if (event) {
1882
1696
  proxy[prop] = (v == null ? void 0 : v[isEventHandleSymbol]) ? v : (detail, options) => {
1883
- const evt = new CustomEvent(event, __spreadProps(__spreadValues(__spreadValues({}, options), eventOptions), { detail }));
1697
+ const evt = new CustomEvent(event, { ...options, ...eventOptions, detail });
1884
1698
  that.dispatchEvent(evt);
1885
1699
  v(detail, options);
1886
1700
  };
1887
- proxy[prop][isEventHandleSymbol] = true;
1701
+ Reflect.set(proxy[prop], isEventHandleSymbol, true);
1888
1702
  } else {
1889
1703
  proxy[prop] = v;
1890
1704
  this[updateSymbol]();
@@ -1907,7 +1721,9 @@ function defineRef(target, prop, ref) {
1907
1721
  return ref;
1908
1722
  },
1909
1723
  get element() {
1910
- const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map((e) => e.target);
1724
+ const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map(
1725
+ (e) => e.target
1726
+ );
1911
1727
  for (const e of [ele, ...gemReflects]) {
1912
1728
  const result = e.querySelector(`[ref=${ref}]`);
1913
1729
  if (result)
@@ -1952,6 +1768,9 @@ customElements.define = (name, cls, options) => {
1952
1768
  }
1953
1769
  nativeDefineElement(name, cls, options);
1954
1770
  };
1771
+ if (window.__GEM_DEVTOOLS__HOOK__) {
1772
+ Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...GemExports, ...VersionExports });
1773
+ }
1955
1774
  function pushStaticField(target, field, member, isSet = false) {
1956
1775
  const cls = target.constructor;
1957
1776
  const current = cls[field];
@@ -2048,7 +1867,7 @@ const store = createStore({
2048
1867
  $hasShouldCloseHandle: false,
2049
1868
  $key: ""
2050
1869
  });
2051
- const paramsMap = new Map();
1870
+ const paramsMap = /* @__PURE__ */ new Map();
2052
1871
  function validData(data) {
2053
1872
  const { $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandle } = data || {};
2054
1873
  if (store.$key === $key)
@@ -2078,18 +1897,19 @@ function normalizeParams(params) {
2078
1897
  const title = params.title || (pathChanged ? "" : document.title);
2079
1898
  const statusChanged = params.close || params.data || params.open || params.shouldClose;
2080
1899
  const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location.hash) : "");
2081
- return __spreadProps(__spreadValues({}, params), { title, path, query, hash });
1900
+ return { ...params, title, path, query, hash };
2082
1901
  }
2083
1902
  function updateHistory(p, native) {
2084
1903
  validData(p.data);
2085
1904
  const params = normalizeParams(p);
2086
1905
  const { title, path, query, hash, close, open: open2, shouldClose, data } = params;
2087
- const state2 = __spreadValues({
1906
+ const state2 = {
2088
1907
  $hasCloseHandle: !!close,
2089
1908
  $hasOpenHandle: !!open2,
2090
1909
  $hasShouldCloseHandle: !!shouldClose,
2091
- $key: getKey()
2092
- }, data);
1910
+ $key: getKey(),
1911
+ ...data
1912
+ };
2093
1913
  paramsMap.set(state2.$key, params);
2094
1914
  updateStore(cleanObject(store), state2);
2095
1915
  const url = getUrlBarPath(path) + new QueryString(query) + hash;
@@ -2100,9 +1920,10 @@ function updateHistory(p, native) {
2100
1920
  }
2101
1921
  function updateHistoryByNative(data, title, originUrl, native) {
2102
1922
  validData(data);
2103
- const state2 = __spreadValues({
2104
- $key: getKey()
2105
- }, data || {});
1923
+ const state2 = {
1924
+ $key: getKey(),
1925
+ ...data || {}
1926
+ };
2106
1927
  const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);
2107
1928
  const params = normalizeParams({ path: pathname, query: new QueryString(search), hash, title, data });
2108
1929
  paramsMap.set(state2.$key, params);
@@ -2141,9 +1962,9 @@ class GemHistory {
2141
1962
  updateHistory(params, nativeReplaceState);
2142
1963
  }
2143
1964
  pushIgnoreCloseHandle(params) {
2144
- var _a2, _b;
1965
+ var _a2, _b2;
2145
1966
  if (store.$hasCloseHandle) {
2146
- (_b = (_a2 = paramsMap.get(store.$key)) == null ? void 0 : _a2.close) == null ? void 0 : _b.call(_a2);
1967
+ (_b2 = (_a2 = paramsMap.get(store.$key)) == null ? void 0 : _a2.close) == null ? void 0 : _b2.call(_a2);
2147
1968
  this.replace(params);
2148
1969
  } else {
2149
1970
  this.push(params);
@@ -2182,9 +2003,10 @@ if (!window._GEMHISTORY) {
2182
2003
  gemHistory.back();
2183
2004
  } else {
2184
2005
  const params = normalizeParams({ title: document.title, hash: location.hash });
2185
- updateStore(store, __spreadValues({
2186
- $key: getKey()
2187
- }, nativeHistory.state || {}));
2006
+ updateStore(store, {
2007
+ $key: getKey(),
2008
+ ...nativeHistory.state || {}
2009
+ });
2188
2010
  paramsMap.set(store.$key, params);
2189
2011
  }
2190
2012
  connect(gemTitleStore, () => {
@@ -2201,7 +2023,7 @@ if (!window._GEMHISTORY) {
2201
2023
  });
2202
2024
  let navigating = false;
2203
2025
  window.addEventListener("popstate", (event) => {
2204
- var _a2, _b;
2026
+ var _a2, _b2;
2205
2027
  const newState = event.state;
2206
2028
  if (!(newState == null ? void 0 : newState.$key)) {
2207
2029
  return;
@@ -2223,7 +2045,7 @@ if (!window._GEMHISTORY) {
2223
2045
  const prevState = store;
2224
2046
  const isForward = parseFloat(newState.$key) > parseFloat(prevState.$key);
2225
2047
  if (isForward && newState.$hasOpenHandle) {
2226
- (_b = (_a2 = paramsMap.get(newState.$key)) == null ? void 0 : _a2.open) == null ? void 0 : _b.call(_a2);
2048
+ (_b2 = (_a2 = paramsMap.get(newState.$key)) == null ? void 0 : _a2.open) == null ? void 0 : _b2.call(_a2);
2227
2049
  } else if (prevState.$hasCloseHandle) {
2228
2050
  const prevParams = paramsMap.get(prevState.$key);
2229
2051
  const closeHandle = prevParams == null ? void 0 : prevParams.close;
@@ -2280,14 +2102,24 @@ class ParamsRegExp extends RegExp {
2280
2102
  constructor(pattern) {
2281
2103
  const namePosition = {};
2282
2104
  let i = 0;
2283
- super(`^${pattern.replace(/:([^/$]+)/g, (_m, name) => {
2284
- namePosition[name] = i++;
2285
- return `([^/]+)`;
2286
- }).replace("*", ".*")}$`, "i");
2105
+ super(
2106
+ `^${pattern.replace(/:([^/$]+)/g, (_m, name) => {
2107
+ namePosition[name] = i++;
2108
+ return `([^/]+)`;
2109
+ }).replace("*", ".*")}$`,
2110
+ "i"
2111
+ );
2287
2112
  this.namePosition = namePosition;
2288
2113
  }
2289
2114
  }
2290
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
+ }
2291
2123
  const reg = new ParamsRegExp(pattern);
2292
2124
  const matchResult = path.match(reg) || `${path}/`.match(reg);
2293
2125
  if (!matchResult)
@@ -2312,9 +2144,10 @@ function createPath(route, options) {
2312
2144
  }
2313
2145
  function createHistoryParams(route, options) {
2314
2146
  const path = createPath(route, options);
2315
- return __spreadValues({
2316
- path
2317
- }, options);
2147
+ return {
2148
+ path,
2149
+ ...options
2150
+ };
2318
2151
  }
2319
2152
  let GemRouteElement = class extends GemElement {
2320
2153
  constructor({ isLight, routes } = {}) {
@@ -2354,39 +2187,42 @@ let GemRouteElement = class extends GemElement {
2354
2187
  this.routes = routes;
2355
2188
  }
2356
2189
  mounted() {
2357
- this.effect(([key2, path], old) => {
2358
- if (old && key2 === old[0] && path === old[1]) {
2359
- __privateGet2(this, _updateLocationStore).call(this);
2360
- return;
2361
- }
2362
- const { route, params = {} } = GemRouteElement.findRoute(this.routes, path);
2363
- const { redirect, content, getContent } = route || {};
2364
- if (redirect) {
2365
- history.replace({ path: redirect });
2366
- return;
2367
- }
2368
- const title = route == null ? void 0 : route.title;
2369
- if (title)
2370
- updateStore(titleStore, { title });
2371
- const contentOrLoader = content || (getContent == null ? void 0 : getContent(params));
2372
- if (contentOrLoader instanceof Promise) {
2373
- this.loading(route);
2374
- __privateSet2(this, _lastLoader, contentOrLoader);
2375
- const isSomeLoader = () => __privateGet2(this, _lastLoader) === contentOrLoader;
2376
- contentOrLoader.then((content2) => {
2377
- if (isSomeLoader())
2378
- __privateGet2(this, _setContent).call(this, route, params, content2);
2379
- }).catch((err) => {
2380
- if (isSomeLoader())
2381
- this.error(err);
2382
- });
2383
- return;
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];
2384
2224
  }
2385
- __privateGet2(this, _setContent).call(this, route, params, contentOrLoader);
2386
- }, () => {
2387
- const { path } = history.getParams();
2388
- return [this.key, path, location.search];
2389
- });
2225
+ );
2390
2226
  }
2391
2227
  shouldUpdate() {
2392
2228
  if (this.inert)
@@ -2399,7 +2235,7 @@ let GemRouteElement = class extends GemElement {
2399
2235
  return html`${content}`;
2400
2236
  return html`
2401
2237
  <style>
2402
- :host,
2238
+ :host(:where(:not([hidden]))),
2403
2239
  :not(:defined) {
2404
2240
  display: contents;
2405
2241
  }
@@ -2408,9 +2244,9 @@ let GemRouteElement = class extends GemElement {
2408
2244
  `;
2409
2245
  }
2410
2246
  };
2411
- _lastLoader = new WeakMap();
2412
- _updateLocationStore = new WeakMap();
2413
- _setContent = new WeakMap();
2247
+ _lastLoader = /* @__PURE__ */ new WeakMap();
2248
+ _updateLocationStore = /* @__PURE__ */ new WeakMap();
2249
+ _setContent = /* @__PURE__ */ new WeakMap();
2414
2250
  GemRouteElement.createLocationStore = () => {
2415
2251
  const { path, query, data } = history.getParams();
2416
2252
  return createStore({ path, query, data, params: {} });
@@ -2424,7 +2260,7 @@ GemRouteElement.findRoute = (target = [], path) => {
2424
2260
  routes = Object.values(target);
2425
2261
  }
2426
2262
  for (const route of routes) {
2427
- if (route.pattern === "*") {
2263
+ if ("*" === route.pattern) {
2428
2264
  defaultRoute = route;
2429
2265
  } else {
2430
2266
  const params = matchPath(route.pattern, path);
@@ -2461,7 +2297,7 @@ GemRouteElement = __decorateClass$6([
2461
2297
  ], GemRouteElement);
2462
2298
  class GemLightRouteElement extends GemRouteElement {
2463
2299
  constructor(options = {}) {
2464
- super(__spreadProps(__spreadValues({}, options), { isLight: true }));
2300
+ super({ ...options, isLight: true });
2465
2301
  }
2466
2302
  }
2467
2303
  var __defProp$5 = Object.defineProperty;
@@ -2475,42 +2311,50 @@ var __decorateClass$5 = (decorators, target, key2, kind) => {
2475
2311
  __defProp$5(target, key2, result);
2476
2312
  return result;
2477
2313
  };
2478
- let GemLinkElement = class extends GemElement {
2314
+ function isExternal(path) {
2315
+ return !path.startsWith("/");
2316
+ }
2317
+ let GemLinkElement = (_a = class extends GemElement {
2479
2318
  constructor() {
2480
2319
  super();
2481
- this.clickHandle = async (e) => {
2320
+ __privateAdd(this, _routeOptions);
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 () => {
2482
2326
  var _a2;
2483
- const pathInfo = this.getPathInfo();
2484
- if (!pathInfo)
2327
+ const locationString = this.getLocationString();
2328
+ if (!locationString)
2485
2329
  return;
2486
- if (this.isExternal(pathInfo)) {
2330
+ if (isExternal(locationString)) {
2487
2331
  switch (this.target) {
2488
2332
  case "_self":
2489
- window.location.href = pathInfo;
2333
+ window.location.href = locationString;
2490
2334
  return;
2491
2335
  case "_parent":
2492
- window.parent.location.href = pathInfo;
2336
+ window.parent.location.href = locationString;
2493
2337
  return;
2494
2338
  case "_top":
2495
- window.top.location.href = pathInfo;
2339
+ window.top.location.href = locationString;
2496
2340
  return;
2497
2341
  default:
2498
- window.open(pathInfo);
2342
+ window.open(locationString);
2499
2343
  return;
2500
2344
  }
2501
2345
  }
2502
2346
  const { path, query, hash } = history.getParams();
2503
- if (path + query + hash === pathInfo) {
2347
+ if (path + query + hash === locationString) {
2504
2348
  return;
2505
2349
  }
2506
- e.stopPropagation();
2507
2350
  await ((_a2 = this.prepare) == null ? void 0 : _a2.call(this));
2508
2351
  if (this.route) {
2509
- history.pushIgnoreCloseHandle(__spreadProps(__spreadValues({}, createHistoryParams(this.route, this.options)), {
2352
+ history.pushIgnoreCloseHandle({
2353
+ ...createHistoryParams(this.route, __privateGet(this, _routeOptions, routeOptions_get)),
2510
2354
  title: this.route.title || this.docTitle
2511
- }));
2355
+ });
2512
2356
  } else if (this.href) {
2513
- const { pathname, search, hash: hash2 } = new URL(pathInfo, location.origin);
2357
+ const { pathname, search, hash: hash2 } = new URL(locationString, location.origin);
2514
2358
  history.pushIgnoreCloseHandle({
2515
2359
  path: pathname,
2516
2360
  query: search,
@@ -2520,37 +2364,18 @@ let GemLinkElement = class extends GemElement {
2520
2364
  } else {
2521
2365
  history.pushIgnoreCloseHandle({ path: this.path, query: this.query, hash: this.hash, title: this.docTitle });
2522
2366
  }
2523
- };
2524
- this.preventDefault = (e) => {
2367
+ });
2368
+ __privateSet(this, _preventDefault, (e) => {
2525
2369
  e.preventDefault();
2526
- };
2370
+ });
2371
+ __privateSet(this, _getHint, () => {
2372
+ const locationString = this.getLocationString();
2373
+ return isExternal(locationString) ? locationString : new URL(history.basePath + locationString, location.origin).toString();
2374
+ });
2527
2375
  this.tabIndex = 0;
2528
- this.addEventListener("click", this.clickHandle);
2376
+ this.addEventListener("click", __privateGet(this, _onClick));
2529
2377
  }
2530
- getPathInfo() {
2531
- var _a2, _b;
2532
- if (this.route) {
2533
- const queryProp = ((_a2 = this.options) == null ? void 0 : _a2.query) || "";
2534
- const hashProp = ((_b = this.options) == null ? void 0 : _b.hash) || "";
2535
- return createPath(this.route, this.options) + queryProp + hashProp;
2536
- } else {
2537
- const url = this.href || this.path + this.query + this.hash;
2538
- const { path, query } = history.getParams();
2539
- if (url.startsWith("#")) {
2540
- return `${path}${query}${url}`;
2541
- } else if (url.startsWith("?")) {
2542
- return `${path}${url}`;
2543
- } else if (url.startsWith(".")) {
2544
- return absoluteLocation(path, url);
2545
- } else {
2546
- return url;
2547
- }
2548
- }
2549
- }
2550
- isExternal(pathInfo) {
2551
- return !pathInfo.startsWith("/");
2552
- }
2553
- render(pathInfo = this.getPathInfo()) {
2378
+ render() {
2554
2379
  return html`
2555
2380
  <style>
2556
2381
  :host {
@@ -2569,14 +2394,38 @@ let GemLinkElement = class extends GemElement {
2569
2394
  </style>
2570
2395
  <a
2571
2396
  part=${this.link}
2572
- @click=${this.preventDefault}
2573
- href=${ifDefined(this.hint === "off" ? void 0 : this.isExternal(pathInfo) ? pathInfo : new URL(history.basePath + pathInfo, location.origin).toString())}
2397
+ @click=${__privateGet(this, _preventDefault)}
2398
+ href=${ifDefined(__privateGet(this, _hint, hint_get) === "off" ? void 0 : __privateGet(this, _getHint).call(this))}
2574
2399
  >
2575
2400
  <slot></slot>
2576
2401
  </a>
2577
2402
  `;
2578
2403
  }
2579
- };
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
+ }
2424
+ }, _routeOptions = new WeakSet(), routeOptions_get = function() {
2425
+ return this.routeOptions || this.options;
2426
+ }, _hint = new WeakSet(), hint_get = function() {
2427
+ return this.hint || "on";
2428
+ }, _onClick = new WeakMap(), _preventDefault = new WeakMap(), _getHint = new WeakMap(), _a);
2580
2429
  __decorateClass$5([
2581
2430
  attribute
2582
2431
  ], GemLinkElement.prototype, "href", 2);
@@ -2604,6 +2453,9 @@ __decorateClass$5([
2604
2453
  __decorateClass$5([
2605
2454
  property
2606
2455
  ], GemLinkElement.prototype, "options", 2);
2456
+ __decorateClass$5([
2457
+ property
2458
+ ], GemLinkElement.prototype, "routeOptions", 2);
2607
2459
  __decorateClass$5([
2608
2460
  property
2609
2461
  ], GemLinkElement.prototype, "prepare", 2);
@@ -2614,16 +2466,13 @@ GemLinkElement = __decorateClass$5([
2614
2466
  connectStore(basePathStore)
2615
2467
  ], GemLinkElement);
2616
2468
  let GemActiveLinkElement = class extends GemLinkElement {
2617
- render() {
2618
- const { path, query, hash } = history.getParams();
2619
- const isMatchPattern = this.pattern && matchPath(this.pattern, path);
2620
- const pathInfo = this.getPathInfo();
2621
- if (isMatchPattern || path + query + hash === pathInfo) {
2622
- this.active = true;
2623
- } else {
2624
- this.active = false;
2625
- }
2626
- 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
+ });
2627
2476
  }
2628
2477
  };
2629
2478
  __decorateClass$5([
@@ -2651,28 +2500,23 @@ var __decorateClass$4 = (decorators, target, key2, kind) => {
2651
2500
  return result;
2652
2501
  };
2653
2502
  let GemTitleElement = class extends GemElement {
2503
+ constructor() {
2504
+ super();
2505
+ new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });
2506
+ }
2654
2507
  static setTitle(title) {
2655
2508
  updateStore(titleStore, { title });
2656
2509
  }
2657
- static updateTitle(str = "", suffix = "") {
2658
- const { title } = titleStore;
2659
- if (title && title !== GemTitleElement.defaultTitle) {
2660
- GemTitleElement.title = title;
2661
- document.title = GemTitleElement.title + suffix;
2662
- } else if (str) {
2663
- GemTitleElement.title = str;
2664
- document.title = GemTitleElement.title + suffix;
2510
+ static updateTitle(title = titleStore.title, prefix = "", suffix = "") {
2511
+ if (title === GemTitleElement.defaultTitle) {
2512
+ document.title = GemTitleElement.title = title;
2665
2513
  } else {
2666
- GemTitleElement.title = GemTitleElement.defaultTitle;
2667
- document.title = GemTitleElement.title;
2514
+ GemTitleElement.title = title;
2515
+ document.title = prefix + GemTitleElement.title + suffix;
2668
2516
  }
2669
2517
  }
2670
- constructor() {
2671
- super();
2672
- new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });
2673
- }
2674
2518
  render() {
2675
- GemTitleElement.updateTitle(this.textContent || "", this.suffix);
2519
+ GemTitleElement.updateTitle(this.textContent || void 0, this.prefix, this.suffix);
2676
2520
  if (this.hidden) {
2677
2521
  return html``;
2678
2522
  }
@@ -2681,7 +2525,11 @@ let GemTitleElement = class extends GemElement {
2681
2525
  };
2682
2526
  GemTitleElement.title = document.title;
2683
2527
  GemTitleElement.defaultTitle = document.title;
2528
+ GemTitleElement.defaultPrefix = `${document.title} | `;
2684
2529
  GemTitleElement.defaultSuffix = ` - ${document.title}`;
2530
+ __decorateClass$4([
2531
+ attribute
2532
+ ], GemTitleElement.prototype, "prefix", 2);
2685
2533
  __decorateClass$4([
2686
2534
  attribute
2687
2535
  ], GemTitleElement.prototype, "suffix", 2);
@@ -2701,31 +2549,33 @@ var __decorateClass$3 = (decorators, target, key2, kind) => {
2701
2549
  __defProp$3(target, key2, result);
2702
2550
  return result;
2703
2551
  };
2704
- const eleCache = new Map();
2552
+ const eleCache = /* @__PURE__ */ new Map();
2705
2553
  class GemUseElement extends GemElement {
2706
- getContent() {
2707
- const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
2708
- if (typeof ele === "string") {
2709
- let temp = eleCache.get(ele);
2710
- if (!temp) {
2711
- temp = document.createElement("template");
2712
- temp.innerHTML = ele;
2713
- eleCache.set(ele, temp);
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);
2714
2571
  }
2715
- return temp.content.cloneNode(true);
2716
- } else if (ele instanceof HTMLTemplateElement) {
2717
- return ele.content.cloneNode(true);
2718
- } else {
2719
- return ele == null ? void 0 : ele.cloneNode(true);
2720
- }
2572
+ });
2721
2573
  }
2722
2574
  render() {
2723
2575
  return html`
2724
2576
  <style>
2725
- :host {
2577
+ :host(:where(:not([hidden]))) {
2726
2578
  position: relative;
2727
- }
2728
- :host(:not([hidden])) {
2729
2579
  display: inline-flex;
2730
2580
  align-items: center;
2731
2581
  }
@@ -2734,11 +2584,12 @@ class GemUseElement extends GemElement {
2734
2584
  height: 100%;
2735
2585
  }
2736
2586
  </style>
2737
- ${this.getContent()}
2587
+ ${__privateGet(this, _getContent).call(this)}
2738
2588
  <slot></slot>
2739
2589
  `;
2740
2590
  }
2741
2591
  }
2592
+ _getContent = new WeakMap();
2742
2593
  __decorateClass$3([
2743
2594
  attribute
2744
2595
  ], GemUseElement.prototype, "selector", 2);
@@ -2766,19 +2617,22 @@ var __decorateClass$2 = (decorators, target, key2, kind) => {
2766
2617
  class GemUnsafeElement extends GemElement {
2767
2618
  constructor() {
2768
2619
  super();
2769
- this.effect(() => {
2770
- if (this.shadowRoot) {
2771
- this.shadowRoot.innerHTML = `
2620
+ this.effect(
2621
+ () => {
2622
+ if (this.shadowRoot) {
2623
+ this.shadowRoot.innerHTML = `
2772
2624
  <style>
2773
- :host {
2625
+ :host(:where(:not([hidden]))) {
2774
2626
  display: contents;
2775
2627
  }
2776
2628
  ${this.contentcss}
2777
2629
  </style>
2778
2630
  ${this.content}
2779
2631
  `;
2780
- }
2781
- }, () => [this.content, this.contentcss]);
2632
+ }
2633
+ },
2634
+ () => [this.content, this.contentcss]
2635
+ );
2782
2636
  }
2783
2637
  render() {
2784
2638
  return void 0;
@@ -2808,18 +2662,21 @@ class GemReflectElement extends GemElement {
2808
2662
  this.target = document.head;
2809
2663
  this.hidden = true;
2810
2664
  this.dataset.gemReflect = "";
2811
- this.effect(() => {
2812
- const childNodes = [...this.childNodes];
2813
- childNodes.forEach((node) => {
2814
- if (node instanceof HTMLElement) {
2815
- node.dataset.reflect = "";
2816
- }
2817
- this.target.append(node);
2818
- });
2819
- return () => {
2820
- childNodes.forEach((node) => node.remove());
2821
- };
2822
- }, () => [this.target]);
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
+ );
2823
2680
  }
2824
2681
  }
2825
2682
  __decorateClass$1([
@@ -2829,6 +2686,7 @@ customElements.define("gem-reflect", GemReflectElement);
2829
2686
  const open = Symbol("open mark");
2830
2687
  function createModalClass(options) {
2831
2688
  var _a2;
2689
+ const final2 = Symbol();
2832
2690
  return _a2 = class extends GemElement {
2833
2691
  constructor() {
2834
2692
  super();
@@ -2848,7 +2706,7 @@ function createModalClass(options) {
2848
2706
  this.inertStore = [...document.body.children].filter((e) => !e.inert);
2849
2707
  this.inertStore.forEach((e) => e.inert = true);
2850
2708
  document.body.append(instance);
2851
- const changeStore = () => updateStore(this.store, __spreadValues({ [open]: true }, opts));
2709
+ const changeStore = () => updateStore(this.store, { [open]: true, ...opts });
2852
2710
  setTimeout(() => {
2853
2711
  changeStore();
2854
2712
  history.push({
@@ -2858,24 +2716,28 @@ function createModalClass(options) {
2858
2716
  shouldClose: this.shouldClose.bind(this)
2859
2717
  });
2860
2718
  }, 100);
2719
+ return final2;
2861
2720
  }
2862
2721
  static close() {
2863
2722
  history.back();
2723
+ return final2;
2864
2724
  }
2865
2725
  static closeHandle() {
2866
2726
  var _a3;
2867
2727
  this.inertStore.forEach((e) => e.inert = false);
2868
2728
  (_a3 = this.instance) == null ? void 0 : _a3.remove();
2869
- updateStore(this.store, __spreadValues({ [open]: false }, options));
2729
+ updateStore(this.store, { [open]: false, ...options });
2730
+ return final2;
2870
2731
  }
2871
2732
  static shouldClose() {
2872
2733
  return true;
2873
2734
  }
2874
- }, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore(__spreadValues({
2875
- [open]: false
2876
- }, options)), _a2;
2735
+ }, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore({
2736
+ [open]: false,
2737
+ ...options
2738
+ }), _a2;
2877
2739
  }
2878
- var __defProp2 = Object.defineProperty;
2740
+ var __defProp = Object.defineProperty;
2879
2741
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2880
2742
  var __decorateClass = (decorators, target, key2, kind) => {
2881
2743
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;
@@ -2883,16 +2745,16 @@ var __decorateClass = (decorators, target, key2, kind) => {
2883
2745
  if (decorator = decorators[i])
2884
2746
  result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2885
2747
  if (kind && result)
2886
- __defProp2(target, key2, result);
2748
+ __defProp(target, key2, result);
2887
2749
  return result;
2888
2750
  };
2889
- let GemDialogBaseElement = (_a = class extends GemElement {
2751
+ const final = Symbol();
2752
+ let GemDialogBaseElement = (_b = class extends GemElement {
2890
2753
  constructor() {
2891
2754
  super();
2892
2755
  __privateAdd(this, _nextSibling, void 0);
2893
2756
  __privateAdd(this, _parentElement, void 0);
2894
2757
  __privateAdd(this, _inertStore, void 0);
2895
- this.inert = true;
2896
2758
  __privateSet(this, _inertStore, []);
2897
2759
  this.closeHandle = () => {
2898
2760
  var _a2;
@@ -2905,6 +2767,7 @@ let GemDialogBaseElement = (_a = class extends GemElement {
2905
2767
  }
2906
2768
  this.dispatchEvent(new CustomEvent("close"));
2907
2769
  this.opened = false;
2770
+ return final;
2908
2771
  };
2909
2772
  this.openHandle = () => {
2910
2773
  this.hidden = false;
@@ -2916,6 +2779,7 @@ let GemDialogBaseElement = (_a = class extends GemElement {
2916
2779
  document.body.append(this);
2917
2780
  this.dispatchEvent(new CustomEvent("open"));
2918
2781
  this.opened = true;
2782
+ return final;
2919
2783
  };
2920
2784
  this.open = () => {
2921
2785
  if (this.opened)
@@ -2927,21 +2791,25 @@ let GemDialogBaseElement = (_a = class extends GemElement {
2927
2791
  close: this.closeHandle,
2928
2792
  shouldClose: this.shouldClose
2929
2793
  });
2794
+ return final;
2930
2795
  };
2931
2796
  this.close = () => {
2932
2797
  history.back();
2798
+ return final;
2933
2799
  };
2934
2800
  this.forceClose = () => {
2935
2801
  this.opened = false;
2936
2802
  setTimeout(this.close, 100);
2803
+ return final;
2937
2804
  };
2805
+ this.inert = true;
2938
2806
  this.internals.role = "dialog";
2939
2807
  this.internals.ariaModal = "true";
2940
2808
  }
2941
2809
  shouldClose() {
2942
2810
  return true;
2943
2811
  }
2944
- }, _nextSibling = new WeakMap(), _parentElement = new WeakMap(), _inertStore = new WeakMap(), _a);
2812
+ }, _nextSibling = new WeakMap(), _parentElement = new WeakMap(), _inertStore = new WeakMap(), _b);
2945
2813
  __decorateClass([
2946
2814
  attribute
2947
2815
  ], GemDialogBaseElement.prototype, "label", 2);
@@ -2951,45 +2819,41 @@ __decorateClass([
2951
2819
  GemDialogBaseElement = __decorateClass([
2952
2820
  connectStore(history.store)
2953
2821
  ], GemDialogBaseElement);
2954
- const themeStoreMap = new WeakMap();
2822
+ const themeStoreMap = /* @__PURE__ */ new WeakMap();
2955
2823
  function getThemeStore(theme) {
2956
2824
  return themeStoreMap.get(theme);
2957
2825
  }
2958
- const themePropMap = new WeakMap();
2959
- function getThemeProp(theme) {
2960
- return themePropMap.get(theme);
2961
- }
2962
- function replaceStyle(style, theme) {
2963
- const themeStore = themeStoreMap.get(theme);
2964
- const themeProp = themePropMap.get(theme);
2965
- const rules = Object.keys(themeStore).reduce((prev, key2) => {
2966
- if (!themeStore[key2] || !themeProp[key2])
2967
- return prev;
2968
- return prev + `${themeProp[key2]}:${themeStore[key2]};`;
2969
- }, "");
2970
- style.textContent = `:root, :host {${rules}}`;
2826
+ const themePropsMap = /* @__PURE__ */ new WeakMap();
2827
+ function getThemeProps(theme) {
2828
+ return themePropsMap.get(theme);
2971
2829
  }
2830
+ const setThemeFnMap = /* @__PURE__ */ new WeakMap();
2972
2831
  function createTheme(themeObj) {
2973
2832
  const salt = randomStr();
2974
2833
  const style = document.createElement("style");
2975
- const themeStore = createStore(themeObj);
2834
+ const store2 = createStore(themeObj);
2976
2835
  const theme = {};
2977
- const themeProp = {};
2978
- themePropMap.set(theme, themeProp);
2979
- themeStoreMap.set(theme, themeStore);
2980
- Object.keys(themeStore).forEach((key2) => {
2981
- themeProp[key2] = `--${camelToKebabCase(key2)}-${salt}`;
2982
- theme[key2] = `var(${themeProp[key2]})`;
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]})`;
2983
2844
  });
2984
- const replace = () => replaceStyle(style, theme);
2985
- connect(themeStore, replace);
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);
2986
2850
  replace();
2987
2851
  (document.head || document.documentElement).append(style);
2988
2852
  return theme;
2989
2853
  }
2990
2854
  function updateTheme(theme, newThemeObj) {
2991
- const store2 = getThemeStore(theme);
2992
- updateStore(store2, newThemeObj);
2855
+ updateStore(getThemeStore(theme), newThemeObj);
2856
+ setThemeFnMap.get(theme)();
2993
2857
  }
2994
2858
  const splitReg = /\$\d(?:<[^>]*>)?/;
2995
2859
  const matchReg = /\$(\d)(<([^>]*)>)?/g;
@@ -3006,7 +2870,7 @@ function splice(rawValue, ...rest) {
3006
2870
  }
3007
2871
  return html(templateArr, ...values);
3008
2872
  }
3009
- const modules = new Set();
2873
+ const modules = /* @__PURE__ */ new Set();
3010
2874
  const _I18n = class {
3011
2875
  constructor(options) {
3012
2876
  __privateAdd(this, _cacheCurrentKey);
@@ -3183,7 +3047,10 @@ const defaultReqInit = {
3183
3047
  }
3184
3048
  };
3185
3049
  async function request(uri, options = {}) {
3186
- const res = await fetch(uri, __spreadValues(__spreadValues({}, defaultReqInit), options));
3050
+ const res = await fetch(uri, {
3051
+ ...defaultReqInit,
3052
+ ...options
3053
+ });
3187
3054
  if (res.status === 0)
3188
3055
  throw new Error("Request fail");
3189
3056
  if (res.status >= 500)
@@ -3224,67 +3091,59 @@ function put(url, body) {
3224
3091
  function post(url, body) {
3225
3092
  return request(url, { method: "POST", body: serializationBody(body) });
3226
3093
  }
3227
- const matche = (query) => window.matchMedia(query).matches;
3094
+ const match = (query) => window.matchMedia(query).matches;
3228
3095
  const mediaQuery = {
3229
3096
  PRINT: "print",
3230
3097
  get isPrint() {
3231
- return matche(this.PRINT);
3098
+ return match(this.PRINT);
3232
3099
  },
3233
3100
  HOVER: "(hover: hover)",
3234
3101
  get isHover() {
3235
- return matche(this.HOVER);
3102
+ return match(this.HOVER);
3236
3103
  },
3237
- PHONE: "(min-width: 319px) and (max-width: 480px)",
3238
- get isPhone() {
3239
- return matche(this.PHONE);
3240
- },
3241
- LAPTOP: "(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)",
3242
- get isLaptop() {
3243
- return matche(this.LAPTOP);
3244
- },
3245
- DESKTOP: "(min-width: 1279px) and (orientation: landscape)",
3246
- get isDesktop() {
3247
- return matche(this.DESKTOP);
3104
+ PWA: "(display-mode: standalone)",
3105
+ get isPWA() {
3106
+ return match(this.PWA);
3248
3107
  },
3249
- WIDTHSCREEN: "(min-width: 1919px) and (orientation: landscape)",
3250
- get isWidthScreen() {
3251
- return matche(this.WIDTHSCREEN);
3108
+ MOTION_REDUCE: "(prefers-reduced-motion: reduce)",
3109
+ get isMotionReduce() {
3110
+ return match(this.MOTION_REDUCE);
3252
3111
  },
3253
- PHONE_LANDSCAPE: "(min-width: 479px) and (max-width: 959px) and (orientation: landscape)",
3254
- get isPhoneLandscape() {
3255
- return matche(this.PHONE_LANDSCAPE);
3112
+ DATA_REDUCE: "(prefers-reduced-data: reduce)",
3113
+ get isDataReduce() {
3114
+ return match(this.DATA_REDUCE);
3256
3115
  },
3257
- TABLET: "(min-width: 768px) and (max-width: 1024px)",
3258
- get isTablet() {
3259
- return matche(this.TABLET);
3116
+ WATCH: "(width < 320px)",
3117
+ get isWatch() {
3118
+ return match(this.WATCH);
3260
3119
  },
3261
- SMALL_PHONE: "(min-width: 319px) and (max-width: 480px) and (max-height: 640px)",
3120
+ SMALL_PHONE: "(320px <= width <= 480px) and (height <= 640px)",
3262
3121
  get isSmallPhone() {
3263
- return matche(this.SMALL_PHONE);
3122
+ return match(this.SMALL_PHONE);
3264
3123
  },
3265
- WATCH: "(max-width: 319px)",
3266
- get isWatch() {
3267
- return matche(this.WATCH);
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);
3268
3131
  },
3269
- SHORT: "(min-width: 479px) and (max-height: 320px)",
3132
+ SHORT: "(width >= 480px) and (height <= 320px)",
3270
3133
  get isShort() {
3271
- return matche(this.SHORT);
3134
+ return match(this.SHORT);
3272
3135
  },
3273
- PWA: "(display-mode: standalone)",
3274
- get isPWA() {
3275
- return matche(this.PWA);
3136
+ TABLET: "(480px < width <= 1280px)",
3137
+ get isTablet() {
3138
+ return match(this.TABLET);
3276
3139
  },
3277
- MOTION_REDUCE: "(prefers-reduced-motion: reduce)",
3278
- get isMotionReduce() {
3279
- return matche(this.MOTION_REDUCE);
3140
+ DESKTOP: "(width > 1280px) and (orientation: landscape)",
3141
+ get isDesktop() {
3142
+ return match(this.DESKTOP);
3280
3143
  },
3281
- DATA_REDUCE: "(prefers-reduced-data: reduce)",
3282
- get isDataReduce() {
3283
- return matche(this.DATA_REDUCE);
3144
+ WIDTHSCREEN: "(width >= 1920px) and (orientation: landscape)",
3145
+ get isWidthScreen() {
3146
+ return match(this.WIDTHSCREEN);
3284
3147
  }
3285
3148
  };
3286
- const version = "1.7.0";
3287
- if (window.__GEM_DEVTOOLS__HOOK__) {
3288
- Object.assign(window.__GEM_DEVTOOLS__HOOK__, __spreadValues({}, Gem));
3289
- }
3290
- 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, getThemeProp, 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, useNativeCSSStyleSheet, version };
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 };