@mantou/gem 1.6.9 → 1.6.10

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 +170 -182
  2. package/dist/gem.umd.js +23 -23
  3. package/elements/{dialog-base.d.ts → base/dialog.d.ts} +3 -3
  4. package/elements/base/dialog.d.ts.map +1 -0
  5. package/elements/{dialog-base.js → base/dialog.js} +24 -24
  6. package/elements/base/dialog.js.map +1 -0
  7. package/elements/base/gesture.d.ts +66 -0
  8. package/elements/base/gesture.d.ts.map +1 -0
  9. package/elements/base/gesture.js +214 -0
  10. package/elements/base/gesture.js.map +1 -0
  11. package/elements/base/link.d.ts +44 -0
  12. package/elements/base/link.d.ts.map +1 -0
  13. package/elements/base/link.js +206 -0
  14. package/elements/base/link.js.map +1 -0
  15. package/elements/{modal-base.d.ts → base/modal-factory.d.ts} +17 -8
  16. package/elements/base/modal-factory.d.ts.map +1 -0
  17. package/elements/{modal-base.js → base/modal-factory.js} +4 -4
  18. package/elements/base/modal-factory.js.map +1 -0
  19. package/elements/base/reflect.d.ts +6 -0
  20. package/elements/base/reflect.d.ts.map +1 -0
  21. package/elements/base/reflect.js +33 -0
  22. package/elements/base/reflect.js.map +1 -0
  23. package/elements/base/route.d.ts +78 -0
  24. package/elements/base/route.d.ts.map +1 -0
  25. package/elements/base/route.js +220 -0
  26. package/elements/base/route.js.map +1 -0
  27. package/elements/base/title.d.ts +30 -0
  28. package/elements/base/title.d.ts.map +1 -0
  29. package/elements/base/title.js +74 -0
  30. package/elements/base/title.js.map +1 -0
  31. package/elements/base/unsafe.d.ts +14 -0
  32. package/elements/base/unsafe.d.ts.map +1 -0
  33. package/elements/base/unsafe.js +42 -0
  34. package/elements/base/unsafe.js.map +1 -0
  35. package/elements/base/use.d.ts +19 -0
  36. package/elements/base/use.d.ts.map +1 -0
  37. package/elements/base/use.js +70 -0
  38. package/elements/base/use.js.map +1 -0
  39. package/elements/gesture.d.ts +1 -67
  40. package/elements/gesture.d.ts.map +1 -1
  41. package/elements/gesture.js +3 -219
  42. package/elements/gesture.js.map +1 -1
  43. package/elements/link.d.ts +1 -45
  44. package/elements/link.d.ts.map +1 -1
  45. package/elements/link.js +4 -208
  46. package/elements/link.js.map +1 -1
  47. package/elements/reflect.d.ts +1 -8
  48. package/elements/reflect.d.ts.map +1 -1
  49. package/elements/reflect.js +3 -39
  50. package/elements/reflect.js.map +1 -1
  51. package/elements/route.d.ts +1 -81
  52. package/elements/route.d.ts.map +1 -1
  53. package/elements/route.js +4 -228
  54. package/elements/route.js.map +1 -1
  55. package/elements/title.d.ts +1 -30
  56. package/elements/title.d.ts.map +1 -1
  57. package/elements/title.js +3 -75
  58. package/elements/title.js.map +1 -1
  59. package/elements/unsafe.d.ts +1 -14
  60. package/elements/unsafe.d.ts.map +1 -1
  61. package/elements/unsafe.js +3 -46
  62. package/elements/unsafe.js.map +1 -1
  63. package/elements/use.d.ts +1 -19
  64. package/elements/use.d.ts.map +1 -1
  65. package/elements/use.js +3 -74
  66. package/elements/use.js.map +1 -1
  67. package/lib/history.d.ts +28 -16
  68. package/lib/history.d.ts.map +1 -1
  69. package/lib/history.js +166 -168
  70. package/lib/history.js.map +1 -1
  71. package/lib/utils.d.ts.map +1 -1
  72. package/lib/utils.js +2 -1
  73. package/lib/utils.js.map +1 -1
  74. package/package.json +2 -2
  75. package/src/dist.ts +5 -2
  76. package/src/elements/{dialog-base.ts → base/dialog.ts} +4 -4
  77. package/src/elements/base/gesture.ts +256 -0
  78. package/src/elements/base/link.ts +178 -0
  79. package/src/elements/{modal-base.ts → base/modal-factory.ts} +3 -3
  80. package/src/elements/base/reflect.ts +29 -0
  81. package/src/elements/base/route.ts +244 -0
  82. package/src/elements/base/title.ts +68 -0
  83. package/src/elements/base/unsafe.ts +37 -0
  84. package/src/elements/base/use.ts +57 -0
  85. package/src/elements/gesture.ts +3 -257
  86. package/src/elements/link.ts +4 -179
  87. package/src/elements/reflect.ts +3 -31
  88. package/src/elements/route.ts +4 -248
  89. package/src/elements/title.ts +3 -68
  90. package/src/elements/unsafe.ts +3 -37
  91. package/src/elements/use.ts +3 -57
  92. package/src/lib/history.ts +182 -194
  93. package/src/lib/utils.ts +2 -1
  94. package/src/test/history.test.ts +15 -10
  95. package/elements/dialog-base.d.ts.map +0 -1
  96. package/elements/dialog-base.js.map +0 -1
  97. package/elements/modal-base.d.ts.map +0 -1
  98. package/elements/modal-base.js.map +0 -1
package/dist/gem.es.js CHANGED
@@ -64,12 +64,12 @@ var Gem = /* @__PURE__ */ Object.freeze({
64
64
  get history() {
65
65
  return history;
66
66
  },
67
- get basePathStore() {
68
- return basePathStore;
69
- },
70
67
  get titleStore() {
71
68
  return titleStore;
72
69
  },
70
+ get basePathStore() {
71
+ return basePathStore;
72
+ },
73
73
  get html() {
74
74
  return html;
75
75
  },
@@ -1167,7 +1167,7 @@ function raw(arr, ...args) {
1167
1167
  function css(arr, ...args) {
1168
1168
  return raw(arr, ...args);
1169
1169
  }
1170
- const SheetToken = Symbol("sheet token");
1170
+ const SheetToken = Symbol.for("gem@sheetToken");
1171
1171
  let useNativeCSSStyleSheet = true;
1172
1172
  let CSSStyleSheet = window.CSSStyleSheet;
1173
1173
  try {
@@ -2027,10 +2027,9 @@ function customElement(name) {
2027
2027
  nativeDefineElement(name, cls);
2028
2028
  };
2029
2029
  }
2030
- const history = window.history;
2031
- const location$1 = window.location;
2032
- const pushState = history.pushState.bind(history);
2033
- const replaceState = history.replaceState.bind(history);
2030
+ const nativeHistory = window.history;
2031
+ const nativePushState = nativeHistory.pushState.bind(nativeHistory);
2032
+ const nativeReplaceState = nativeHistory.replaceState.bind(nativeHistory);
2034
2033
  let key = 0;
2035
2034
  const getKey = () => `${performance.now()}-${++key}`;
2036
2035
  const store = createStore({
@@ -2053,26 +2052,26 @@ function validData({ $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandl
2053
2052
  throw new GemError("`$hasShouldCloseHandle` is not allowed");
2054
2053
  }
2055
2054
  function getUrlbarPath(internalPath) {
2056
- return history.basePath ? history.basePath + internalPath : internalPath;
2055
+ return gemHistory.basePath ? gemHistory.basePath + internalPath : internalPath;
2057
2056
  }
2058
2057
  function getInternalPath(urlbarPath) {
2059
- if (urlbarPath === history.basePath)
2058
+ if (urlbarPath === gemHistory.basePath)
2060
2059
  return "/";
2061
- return urlbarPath.replace(new RegExp(`^${history.basePath}/`), "/");
2060
+ return urlbarPath.replace(new RegExp(`^${gemHistory.basePath}/`), "/");
2062
2061
  }
2063
- function initParams(params) {
2062
+ function normalizeParams(params) {
2064
2063
  const current = paramsMap.get(store.$key) || {};
2065
- const path = params.path ? absoluteLocation(current.path, params.path) : getInternalPath(location$1.pathname);
2066
- const query = new QueryString(params.query || (params.path ? "" : location$1.search));
2064
+ const path = params.path ? absoluteLocation(current.path, params.path) : getInternalPath(location.pathname);
2065
+ const query = new QueryString(params.query || (params.path ? "" : location.search));
2067
2066
  const pathChanged = params.path && params.path !== current.path || params.query && String(params.query) !== String(current.query);
2068
2067
  const title = params.title || (pathChanged ? "" : document.title);
2069
2068
  const statusChanged = params.close || params.data || params.open || params.shouldClose;
2070
- const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location$1.hash) : "");
2069
+ const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location.hash) : "");
2071
2070
  return __spreadProps(__spreadValues({}, params), { title, path, query, hash });
2072
2071
  }
2073
- function updateHistory(type, p) {
2072
+ function updateHistory(p, native) {
2074
2073
  validData(p.data);
2075
- const params = initParams(p);
2074
+ const params = normalizeParams(p);
2076
2075
  const { title, path, query, hash, close, open: open2, shouldClose, data } = params;
2077
2076
  const state2 = __spreadValues({
2078
2077
  $hasCloseHandle: !!close,
@@ -2083,162 +2082,158 @@ function updateHistory(type, p) {
2083
2082
  paramsMap.set(state2.$key, params);
2084
2083
  updateStore(cleanObject(store), state2);
2085
2084
  const url = getUrlbarPath(path) + new QueryString(query) + hash;
2086
- const prevHave = decodeURIComponent(location$1.hash);
2087
- (type === "push" ? pushState : replaceState)(state2, title, url);
2088
- if (prevHave !== hash)
2085
+ const prevHash = decodeURIComponent(location.hash);
2086
+ native(state2, title, url);
2087
+ if (prevHash !== hash)
2089
2088
  window.dispatchEvent(new CustomEvent("hashchange"));
2090
2089
  }
2091
- function updateHistoryByNative(type, data, title, originUrl) {
2090
+ function updateHistoryByNative(data, title, originUrl, native) {
2092
2091
  validData(data);
2093
2092
  const state2 = __spreadValues({
2094
2093
  $key: getKey()
2095
2094
  }, data || {});
2096
- const { pathname, search, hash } = new URL(originUrl, location$1.origin + location$1.pathname);
2097
- const params = initParams({ path: pathname, query: new QueryString(search), hash, title, data });
2095
+ const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);
2096
+ const params = normalizeParams({ path: pathname, query: new QueryString(search), hash, title, data });
2098
2097
  paramsMap.set(state2.$key, params);
2099
2098
  updateStore(cleanObject(store), state2);
2100
2099
  const url = getUrlbarPath(pathname) + params.query + hash;
2101
- const prevHash = location$1.hash;
2102
- (type === "push" ? pushState : replaceState)(state2, title, url);
2100
+ const prevHash = location.hash;
2101
+ native(state2, title, url);
2103
2102
  if (prevHash !== hash)
2104
2103
  window.dispatchEvent(new CustomEvent("hashchange"));
2105
2104
  }
2106
- const basePathStore = createStore({
2105
+ const gemBasePathStore = createStore({
2107
2106
  basePath: ""
2108
2107
  });
2109
- window.addEventListener("hashchange", ({ isTrusted }) => {
2110
- if (isTrusted) {
2111
- history.replace({ hash: decodeURIComponent(location$1.hash) });
2108
+ class GemHistory {
2109
+ get store() {
2110
+ return store;
2112
2111
  }
2113
- });
2114
- Object.defineProperties(history, {
2115
- basePath: {
2116
- get() {
2117
- return basePathStore.basePath;
2118
- },
2119
- set(basePath) {
2120
- updateStore(basePathStore, { basePath });
2121
- Object.assign(paramsMap.get(store.$key), { path: getInternalPath(location$1.pathname) });
2122
- }
2123
- },
2124
- getParams: {
2125
- value: function() {
2126
- return paramsMap.get(store.$key);
2127
- }
2128
- },
2129
- updateParams: {
2130
- value: function(params) {
2131
- Object.assign(paramsMap.get(store.$key), params);
2132
- updateStore(store, {});
2133
- }
2134
- },
2135
- store: {
2136
- value: store
2137
- },
2138
- push: {
2139
- value: function(params) {
2140
- history.pushState(params, "");
2141
- }
2142
- },
2143
- pushIgnoreCloseHandle: {
2144
- value: function(params) {
2145
- var _a2, _b;
2146
- if (store.$hasCloseHandle) {
2147
- (_b = (_a2 = paramsMap.get(store.$key)) == null ? void 0 : _a2.close) == null ? void 0 : _b.call(_a2);
2148
- history.replace(params);
2149
- } else {
2150
- history.push(params);
2151
- }
2152
- }
2153
- },
2154
- replace: {
2155
- value: function(params) {
2156
- updateHistory("replace", params);
2157
- }
2112
+ get basePath() {
2113
+ return gemBasePathStore.basePath;
2158
2114
  }
2159
- });
2160
- history.pushState = function(data, title, path) {
2161
- if (path) {
2162
- updateHistoryByNative("push", data, title, path);
2163
- } else {
2164
- updateHistory("push", data);
2115
+ set basePath(basePath) {
2116
+ updateStore(gemBasePathStore, { basePath });
2117
+ Object.assign(paramsMap.get(store.$key), { path: getInternalPath(location.pathname) });
2165
2118
  }
2166
- };
2167
- history.replaceState = function(data, title, path) {
2168
- updateHistoryByNative("replace", data, title, path);
2169
- };
2170
- if (!history.state) {
2171
- const { pathname, search, hash } = location$1;
2172
- history.replace({ path: pathname, query: search, hash });
2173
- } else if (history.state.$hasCloseHandle) {
2174
- updateStore(store, history.state);
2175
- const params = initParams({ title: document.title });
2176
- paramsMap.set(store.$key, params);
2177
- history.back();
2178
- } else {
2179
- const params = initParams({ title: document.title, hash: location$1.hash });
2180
- updateStore(store, __spreadValues({
2181
- $key: getKey()
2182
- }, history.state || {}));
2183
- paramsMap.set(store.$key, params);
2184
- }
2185
- const titleStore = createStore({ title: "" });
2186
- connect(titleStore, () => {
2187
- const params = paramsMap.get(store.$key);
2188
- if (params) {
2189
- params.title = titleStore.title;
2119
+ getParams() {
2120
+ return paramsMap.get(store.$key);
2190
2121
  }
2191
- });
2192
- connect(store, () => {
2193
- const { title } = history.getParams();
2194
- if (title !== titleStore.title) {
2195
- updateStore(titleStore, { title });
2122
+ updateParams(params) {
2123
+ Object.assign(paramsMap.get(store.$key), params);
2124
+ updateStore(store, {});
2196
2125
  }
2197
- });
2198
- let navigating = false;
2199
- window.addEventListener("popstate", (event) => {
2200
- var _a2, _b;
2201
- const newState = event.state;
2202
- if (!(newState == null ? void 0 : newState.$key)) {
2203
- return;
2126
+ push(params) {
2127
+ updateHistory(params, nativePushState);
2204
2128
  }
2205
- if (navigating) {
2206
- navigating = false;
2207
- return;
2129
+ replace(params) {
2130
+ updateHistory(params, nativeReplaceState);
2208
2131
  }
2209
- if (!paramsMap.has(newState.$key)) {
2210
- const { pathname, search, hash } = location$1;
2211
- paramsMap.set(newState.$key, {
2212
- path: pathname,
2213
- query: new QueryString(search),
2214
- hash,
2215
- title: document.title,
2216
- data: newState
2217
- });
2132
+ pushIgnoreCloseHandle(params) {
2133
+ var _a2, _b;
2134
+ if (store.$hasCloseHandle) {
2135
+ (_b = (_a2 = paramsMap.get(store.$key)) == null ? void 0 : _a2.close) == null ? void 0 : _b.call(_a2);
2136
+ this.replace(params);
2137
+ } else {
2138
+ this.push(params);
2139
+ }
2140
+ }
2141
+ forward() {
2142
+ nativeHistory.forward();
2218
2143
  }
2219
- const prevState = store;
2220
- if (parseFloat(newState.$key) > parseFloat(prevState.$key) && newState.$hasOpenHandle) {
2221
- (_b = (_a2 = paramsMap.get(newState.$key)) == null ? void 0 : _a2.open) == null ? void 0 : _b.call(_a2);
2222
- } else if (prevState.$hasCloseHandle) {
2223
- const prevParams = paramsMap.get(prevState.$key);
2224
- const closeHandle = prevParams == null ? void 0 : prevParams.close;
2225
- const shouldCloseHandle = prevParams == null ? void 0 : prevParams.shouldClose;
2226
- const notAllowClose = shouldCloseHandle && !shouldCloseHandle();
2227
- if (notAllowClose) {
2228
- navigating = true;
2229
- history.forward();
2144
+ back() {
2145
+ nativeHistory.back();
2146
+ }
2147
+ }
2148
+ const gemHistory = new GemHistory();
2149
+ const gemTitleStore = createStore({ title: "" });
2150
+ const _GEMHISTORY = { history: gemHistory, titleStore: gemTitleStore, basePathStore: gemBasePathStore };
2151
+ if (!window._GEMHISTORY) {
2152
+ window._GEMHISTORY = _GEMHISTORY;
2153
+ nativeHistory.pushState = function(state2, title, path) {
2154
+ updateHistoryByNative(state2, title, path, nativePushState);
2155
+ };
2156
+ nativeHistory.replaceState = function(state2, title, path) {
2157
+ updateHistoryByNative(state2, title, path, nativeReplaceState);
2158
+ };
2159
+ window.addEventListener("hashchange", ({ isTrusted }) => {
2160
+ if (isTrusted) {
2161
+ gemHistory.replace({ hash: decodeURIComponent(location.hash) });
2162
+ }
2163
+ });
2164
+ if (!nativeHistory.state) {
2165
+ const { pathname, search, hash } = location;
2166
+ gemHistory.replace({ path: pathname, query: search, hash });
2167
+ } else if (nativeHistory.state.$hasCloseHandle) {
2168
+ updateStore(store, nativeHistory.state);
2169
+ const params = normalizeParams({ title: document.title });
2170
+ paramsMap.set(store.$key, params);
2171
+ gemHistory.back();
2172
+ } else {
2173
+ const params = normalizeParams({ title: document.title, hash: location.hash });
2174
+ updateStore(store, __spreadValues({
2175
+ $key: getKey()
2176
+ }, nativeHistory.state || {}));
2177
+ paramsMap.set(store.$key, params);
2178
+ }
2179
+ connect(gemTitleStore, () => {
2180
+ const params = paramsMap.get(store.$key);
2181
+ if (params) {
2182
+ params.title = gemTitleStore.title;
2183
+ }
2184
+ });
2185
+ connect(store, () => {
2186
+ const { title } = gemHistory.getParams();
2187
+ if (title !== gemTitleStore.title) {
2188
+ updateStore(gemTitleStore, { title });
2189
+ }
2190
+ });
2191
+ let navigating = false;
2192
+ window.addEventListener("popstate", (event) => {
2193
+ var _a2, _b;
2194
+ const newState = event.state;
2195
+ if (!(newState == null ? void 0 : newState.$key)) {
2230
2196
  return;
2231
- } else {
2232
- if (closeHandle) {
2233
- closeHandle();
2234
- } else if (newState.$hasCloseHandle) {
2197
+ }
2198
+ if (navigating) {
2199
+ navigating = false;
2200
+ return;
2201
+ }
2202
+ if (!paramsMap.has(newState.$key)) {
2203
+ const { pathname, search, hash } = location;
2204
+ paramsMap.set(newState.$key, {
2205
+ path: pathname,
2206
+ query: new QueryString(search),
2207
+ hash,
2208
+ title: document.title,
2209
+ data: newState
2210
+ });
2211
+ }
2212
+ const prevState = store;
2213
+ if (parseFloat(newState.$key) > parseFloat(prevState.$key) && newState.$hasOpenHandle) {
2214
+ (_b = (_a2 = paramsMap.get(newState.$key)) == null ? void 0 : _a2.open) == null ? void 0 : _b.call(_a2);
2215
+ } else if (prevState.$hasCloseHandle) {
2216
+ const prevParams = paramsMap.get(prevState.$key);
2217
+ const closeHandle = prevParams == null ? void 0 : prevParams.close;
2218
+ const shouldCloseHandle = prevParams == null ? void 0 : prevParams.shouldClose;
2219
+ const notAllowClose = shouldCloseHandle && !shouldCloseHandle();
2220
+ if (notAllowClose) {
2235
2221
  navigating = true;
2236
- history.back();
2222
+ gemHistory.forward();
2223
+ return;
2224
+ } else {
2225
+ if (closeHandle) {
2226
+ closeHandle();
2227
+ } else if (newState.$hasCloseHandle) {
2228
+ navigating = true;
2229
+ gemHistory.back();
2230
+ }
2237
2231
  }
2238
2232
  }
2239
- }
2240
- updateStore(cleanObject(store), newState);
2241
- });
2233
+ updateStore(cleanObject(store), newState);
2234
+ });
2235
+ }
2236
+ const { history, titleStore, basePathStore } = window._GEMHISTORY;
2242
2237
  var __defProp$6 = Object.defineProperty;
2243
2238
  var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
2244
2239
  var __decorateClass$6 = (decorators, target, key2, kind) => {
@@ -2334,9 +2329,6 @@ let GemRouteElement = class extends GemElement {
2334
2329
  this.currentParams = params;
2335
2330
  this.setState({ content });
2336
2331
  this.routechange(this.currentRoute);
2337
- const title = route == null ? void 0 : route.title;
2338
- if (title)
2339
- updateStore(titleStore, { title });
2340
2332
  __privateGet2(this, _updateLocationStore).call(this);
2341
2333
  });
2342
2334
  this.routes = routes;
@@ -2353,6 +2345,9 @@ let GemRouteElement = class extends GemElement {
2353
2345
  history.replace({ path: redirect });
2354
2346
  return;
2355
2347
  }
2348
+ const title = route == null ? void 0 : route.title;
2349
+ if (title)
2350
+ updateStore(titleStore, { title });
2356
2351
  const contentOrLoader = content || (getContent == null ? void 0 : getContent(params));
2357
2352
  if (contentOrLoader instanceof Promise) {
2358
2353
  this.loading(route);
@@ -2439,17 +2434,13 @@ __decorateClass$6([
2439
2434
  emitter
2440
2435
  ], GemRouteElement.prototype, "error", 2);
2441
2436
  GemRouteElement = __decorateClass$6([
2442
- connectStore(history.store),
2443
- customElement("gem-route")
2437
+ connectStore(history.store)
2444
2438
  ], GemRouteElement);
2445
- let GemLightRouteElement = class extends GemRouteElement {
2439
+ class GemLightRouteElement extends GemRouteElement {
2446
2440
  constructor(options = {}) {
2447
2441
  super(__spreadProps(__spreadValues({}, options), { isLight: true }));
2448
2442
  }
2449
- };
2450
- GemLightRouteElement = __decorateClass$6([
2451
- customElement("gem-light-route")
2452
- ], GemLightRouteElement);
2443
+ }
2453
2444
  var __defProp$5 = Object.defineProperty;
2454
2445
  var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
2455
2446
  var __decorateClass$5 = (decorators, target, key2, kind) => {
@@ -2510,6 +2501,7 @@ let GemLinkElement = class extends GemElement {
2510
2501
  this.preventDefault = (e) => {
2511
2502
  e.preventDefault();
2512
2503
  };
2504
+ this.tabIndex = 0;
2513
2505
  this.addEventListener("click", this.clickHandle);
2514
2506
  }
2515
2507
  getPathInfo() {
@@ -2596,7 +2588,6 @@ __decorateClass$5([
2596
2588
  part
2597
2589
  ], GemLinkElement.prototype, "link", 2);
2598
2590
  GemLinkElement = __decorateClass$5([
2599
- customElement("gem-link"),
2600
2591
  connectStore(basePathStore)
2601
2592
  ], GemLinkElement);
2602
2593
  let GemActiveLinkElement = class extends GemLinkElement {
@@ -2619,9 +2610,12 @@ __decorateClass$5([
2619
2610
  state
2620
2611
  ], GemActiveLinkElement.prototype, "active", 2);
2621
2612
  GemActiveLinkElement = __decorateClass$5([
2622
- customElement("gem-active-link"),
2623
2613
  connectStore(history.store)
2624
2614
  ], GemActiveLinkElement);
2615
+ customElements.define("gem-link", GemLinkElement);
2616
+ customElements.define("gem-active-link", GemActiveLinkElement);
2617
+ customElements.define("gem-route", GemRouteElement);
2618
+ customElements.define("gem-light-route", GemLightRouteElement);
2625
2619
  var __defProp$4 = Object.defineProperty;
2626
2620
  var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
2627
2621
  var __decorateClass$4 = (decorators, target, key2, kind) => {
@@ -2669,10 +2663,10 @@ __decorateClass$4([
2669
2663
  attribute
2670
2664
  ], GemTitleElement.prototype, "suffix", 2);
2671
2665
  GemTitleElement = __decorateClass$4([
2672
- connectStore(titleStore),
2673
- customElement("gem-title")
2666
+ connectStore(titleStore)
2674
2667
  ], GemTitleElement);
2675
2668
  connect(titleStore, GemTitleElement.updateTitle);
2669
+ customElements.define("gem-title", GemTitleElement);
2676
2670
  var __defProp$3 = Object.defineProperty;
2677
2671
  var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
2678
2672
  var __decorateClass$3 = (decorators, target, key2, kind) => {
@@ -2685,7 +2679,7 @@ var __decorateClass$3 = (decorators, target, key2, kind) => {
2685
2679
  return result;
2686
2680
  };
2687
2681
  const eleCache = new Map();
2688
- let GemUseElement = class extends GemElement {
2682
+ class GemUseElement extends GemElement {
2689
2683
  getContent() {
2690
2684
  const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
2691
2685
  if (typeof ele === "string") {
@@ -2721,7 +2715,7 @@ let GemUseElement = class extends GemElement {
2721
2715
  <slot></slot>
2722
2716
  `;
2723
2717
  }
2724
- };
2718
+ }
2725
2719
  __decorateClass$3([
2726
2720
  attribute
2727
2721
  ], GemUseElement.prototype, "selector", 2);
@@ -2734,9 +2728,7 @@ __decorateClass$3([
2734
2728
  __decorateClass$3([
2735
2729
  state
2736
2730
  ], GemUseElement.prototype, "active", 2);
2737
- GemUseElement = __decorateClass$3([
2738
- customElement("gem-use")
2739
- ], GemUseElement);
2731
+ customElements.define("gem-use", GemUseElement);
2740
2732
  var __defProp$2 = Object.defineProperty;
2741
2733
  var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
2742
2734
  var __decorateClass$2 = (decorators, target, key2, kind) => {
@@ -2748,7 +2740,7 @@ var __decorateClass$2 = (decorators, target, key2, kind) => {
2748
2740
  __defProp$2(target, key2, result);
2749
2741
  return result;
2750
2742
  };
2751
- let GemUnsafeElement = class extends GemElement {
2743
+ class GemUnsafeElement extends GemElement {
2752
2744
  constructor() {
2753
2745
  super();
2754
2746
  this.effect(() => {
@@ -2768,16 +2760,14 @@ let GemUnsafeElement = class extends GemElement {
2768
2760
  render() {
2769
2761
  return void 0;
2770
2762
  }
2771
- };
2763
+ }
2772
2764
  __decorateClass$2([
2773
2765
  attribute
2774
2766
  ], GemUnsafeElement.prototype, "content", 2);
2775
2767
  __decorateClass$2([
2776
2768
  attribute
2777
2769
  ], GemUnsafeElement.prototype, "contentcss", 2);
2778
- GemUnsafeElement = __decorateClass$2([
2779
- customElement("gem-unsafe")
2780
- ], GemUnsafeElement);
2770
+ customElements.define("gem-unsafe", GemUnsafeElement);
2781
2771
  var __defProp$1 = Object.defineProperty;
2782
2772
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
2783
2773
  var __decorateClass$1 = (decorators, target, key2, kind) => {
@@ -2790,7 +2780,7 @@ var __decorateClass$1 = (decorators, target, key2, kind) => {
2790
2780
  return result;
2791
2781
  };
2792
2782
  document.querySelectorAll("[data-reflect]").forEach((e) => e.remove());
2793
- let GemReflectElement = class extends GemElement {
2783
+ class GemReflectElement extends GemElement {
2794
2784
  constructor() {
2795
2785
  super({ isLight: true });
2796
2786
  this.target = document.head;
@@ -2808,13 +2798,11 @@ let GemReflectElement = class extends GemElement {
2808
2798
  };
2809
2799
  }, () => [this.target]);
2810
2800
  }
2811
- };
2801
+ }
2812
2802
  __decorateClass$1([
2813
2803
  property
2814
2804
  ], GemReflectElement.prototype, "target", 2);
2815
- GemReflectElement = __decorateClass$1([
2816
- customElement("gem-reflect")
2817
- ], GemReflectElement);
2805
+ customElements.define("gem-reflect", GemReflectElement);
2818
2806
  const open = Symbol("open mark");
2819
2807
  function createModalClass(options) {
2820
2808
  var _a2;
@@ -2875,7 +2863,7 @@ var __decorateClass = (decorators, target, key2, kind) => {
2875
2863
  __defProp2(target, key2, result);
2876
2864
  return result;
2877
2865
  };
2878
- let DialogBaseElement = (_a = class extends GemElement {
2866
+ let GemDialogBaseElement = (_a = class extends GemElement {
2879
2867
  constructor() {
2880
2868
  super();
2881
2869
  __privateAdd(this, _nextSibling, void 0);
@@ -2933,13 +2921,13 @@ let DialogBaseElement = (_a = class extends GemElement {
2933
2921
  }, _nextSibling = new WeakMap(), _parentElement = new WeakMap(), _inertStore = new WeakMap(), _a);
2934
2922
  __decorateClass([
2935
2923
  attribute
2936
- ], DialogBaseElement.prototype, "label", 2);
2924
+ ], GemDialogBaseElement.prototype, "label", 2);
2937
2925
  __decorateClass([
2938
2926
  state
2939
- ], DialogBaseElement.prototype, "opened", 2);
2940
- DialogBaseElement = __decorateClass([
2927
+ ], GemDialogBaseElement.prototype, "opened", 2);
2928
+ GemDialogBaseElement = __decorateClass([
2941
2929
  connectStore(history.store)
2942
- ], DialogBaseElement);
2930
+ ], GemDialogBaseElement);
2943
2931
  const themeStoreMap = new WeakMap();
2944
2932
  function getThemeStore(theme) {
2945
2933
  return themeStoreMap.get(theme);
@@ -3269,4 +3257,4 @@ const version = "1.6.5";
3269
3257
  if (window.__GEM_DEVTOOLS__HOOK__) {
3270
3258
  Object.assign(window.__GEM_DEVTOOLS__HOOK__, __spreadValues({}, Gem));
3271
3259
  }
3272
- export { DialogBaseElement, GemActiveLinkElement, 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, defineAttribute, defineCSSState, defineProperty, defineRef, del, directive, disconnect, emitter, get, getThemeProp, getThemeStore, globalemitter, guard, history, html, ifDefined, isArrayChange, kebabToCamelCase, matchPath, mediaQuery, nativeDefineElement, numattribute, part, partMap, post, property, put, randomStr, raw, refobject, removeItems, render, repeat, request, rootElement, slot, splice, state, styleMap, styled, svg, titleStore, updateStore, updateTheme, useNativeCSSStyleSheet, version };
3260
+ 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, defineAttribute, defineCSSState, defineProperty, defineRef, del, directive, disconnect, emitter, get, getThemeProp, getThemeStore, globalemitter, guard, history, html, ifDefined, isArrayChange, kebabToCamelCase, matchPath, mediaQuery, nativeDefineElement, numattribute, part, partMap, post, property, put, randomStr, raw, refobject, removeItems, render, repeat, request, rootElement, slot, splice, state, styleMap, styled, svg, titleStore, updateStore, updateTheme, useNativeCSSStyleSheet, version };