godown 1.1.4 → 1.1.6

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 (179) hide show
  1. package/README.md +35 -35
  2. package/conf.d.ts +18 -18
  3. package/conf.js +22 -22
  4. package/deps.d.ts +7 -7
  5. package/deps.js +7 -7
  6. package/effect/index.d.ts +3 -3
  7. package/effect/index.js +3 -3
  8. package/effect/ov-effect.d.ts +23 -23
  9. package/effect/ov-effect.d.ts.map +1 -1
  10. package/effect/ov-effect.js +299 -275
  11. package/effect/ro-effect.d.ts +19 -19
  12. package/effect/ro-effect.d.ts.map +1 -1
  13. package/effect/ro-effect.js +125 -120
  14. package/effect/std.d.ts +3 -3
  15. package/effect/std.d.ts.map +1 -1
  16. package/effect/std.js +3 -3
  17. package/effect/tw-effect.d.ts +21 -21
  18. package/effect/tw-effect.d.ts.map +1 -1
  19. package/effect/tw-effect.js +108 -107
  20. package/glob.d.ts +8 -8
  21. package/glob.d.ts.map +1 -1
  22. package/glob.js +25 -24
  23. package/group/avatar-group.d.ts +20 -20
  24. package/group/avatar-group.d.ts.map +1 -1
  25. package/group/avatar-group.js +112 -88
  26. package/group/button-group.d.ts +12 -12
  27. package/group/button-group.d.ts.map +1 -1
  28. package/group/button-group.js +79 -74
  29. package/group/details-group.d.ts +16 -16
  30. package/group/details-group.d.ts.map +1 -1
  31. package/group/details-group.js +55 -53
  32. package/group/index.d.ts +3 -3
  33. package/group/index.js +3 -3
  34. package/group/std.d.ts +3 -3
  35. package/group/std.d.ts.map +1 -1
  36. package/group/std.js +3 -3
  37. package/index.d.ts +7 -7
  38. package/index.js +7 -7
  39. package/input-form/base-input.d.ts +32 -32
  40. package/input-form/base-input.d.ts.map +1 -1
  41. package/input-form/base-input.js +229 -226
  42. package/input-form/exp-input.d.ts +22 -22
  43. package/input-form/exp-input.d.ts.map +1 -1
  44. package/input-form/exp-input.js +218 -205
  45. package/input-form/index.d.ts +8 -8
  46. package/input-form/index.js +8 -8
  47. package/input-form/label-input.d.ts +21 -21
  48. package/input-form/label-input.d.ts.map +1 -1
  49. package/input-form/label-input.js +150 -137
  50. package/input-form/search-input.d.ts +36 -36
  51. package/input-form/search-input.d.ts.map +1 -1
  52. package/input-form/search-input.js +311 -297
  53. package/input-form/select-input.d.ts +31 -31
  54. package/input-form/select-input.d.ts.map +1 -1
  55. package/input-form/select-input.js +354 -330
  56. package/input-form/sign-form.d.ts +25 -23
  57. package/input-form/sign-form.d.ts.map +1 -1
  58. package/input-form/sign-form.js +165 -160
  59. package/input-form/split-input.d.ts +26 -26
  60. package/input-form/split-input.d.ts.map +1 -1
  61. package/input-form/split-input.js +181 -173
  62. package/input-form/std.d.ts +19 -19
  63. package/input-form/std.d.ts.map +1 -1
  64. package/input-form/std.js +72 -68
  65. package/input-form/switch-input.d.ts +22 -22
  66. package/input-form/switch-input.d.ts.map +1 -1
  67. package/input-form/switch-input.js +181 -175
  68. package/items/alert-item.d.ts +16 -16
  69. package/items/alert-item.d.ts.map +1 -1
  70. package/items/alert-item.js +143 -142
  71. package/items/avatar-anchor.d.ts +19 -19
  72. package/items/avatar-anchor.d.ts.map +1 -1
  73. package/items/avatar-anchor.js +150 -148
  74. package/items/base-button.d.ts +16 -16
  75. package/items/base-button.d.ts.map +1 -1
  76. package/items/base-button.js +170 -167
  77. package/items/dialog-item.d.ts +24 -24
  78. package/items/dialog-item.d.ts.map +1 -1
  79. package/items/dialog-item.js +157 -156
  80. package/items/index.d.ts +7 -7
  81. package/items/index.js +7 -7
  82. package/items/link-a.d.ts +19 -19
  83. package/items/link-a.d.ts.map +1 -1
  84. package/items/link-a.js +98 -97
  85. package/items/load-track.d.ts +20 -20
  86. package/items/load-track.d.ts.map +1 -1
  87. package/items/load-track.js +115 -109
  88. package/items/std.d.ts +3 -3
  89. package/items/std.d.ts.map +1 -1
  90. package/items/std.js +3 -3
  91. package/items/super-a.d.ts +15 -15
  92. package/items/super-a.d.ts.map +1 -1
  93. package/items/super-a.js +99 -88
  94. package/layout/div-line.d.ts +15 -15
  95. package/layout/div-line.d.ts.map +1 -1
  96. package/layout/div-line.js +71 -65
  97. package/layout/drag-box.d.ts +25 -25
  98. package/layout/drag-box.d.ts.map +1 -1
  99. package/layout/drag-box.js +95 -94
  100. package/layout/flex-flow.d.ts +13 -13
  101. package/layout/flex-flow.d.ts.map +1 -1
  102. package/layout/flex-flow.js +39 -34
  103. package/layout/index.d.ts +5 -5
  104. package/layout/index.js +5 -5
  105. package/layout/nav-aside.d.ts +13 -13
  106. package/layout/nav-aside.d.ts.map +1 -1
  107. package/layout/nav-aside.js +61 -54
  108. package/layout/nav-layout.d.ts +16 -16
  109. package/layout/nav-layout.d.ts.map +1 -1
  110. package/layout/nav-layout.js +167 -146
  111. package/layout/std.d.ts +4 -4
  112. package/layout/std.d.ts.map +1 -1
  113. package/layout/std.js +10 -8
  114. package/package.json +48 -40
  115. package/react/effect.d.ts +9 -9
  116. package/react/effect.d.ts.map +1 -1
  117. package/react/effect.js +33 -33
  118. package/react/group.d.ts +4 -4
  119. package/react/group.d.ts.map +1 -1
  120. package/react/group.js +19 -19
  121. package/react/index.d.ts +7 -7
  122. package/react/index.d.ts.map +1 -1
  123. package/react/index.js +7 -7
  124. package/react/input-form.d.ts +32 -32
  125. package/react/input-form.d.ts.map +1 -1
  126. package/react/input-form.js +65 -65
  127. package/react/items.d.ts +8 -8
  128. package/react/items.d.ts.map +1 -1
  129. package/react/items.js +39 -39
  130. package/react/layout.d.ts +6 -6
  131. package/react/layout.d.ts.map +1 -1
  132. package/react/layout.js +29 -29
  133. package/react/view.d.ts +6 -6
  134. package/react/view.d.ts.map +1 -1
  135. package/react/view.js +29 -29
  136. package/view/details-expand.d.ts +18 -18
  137. package/view/details-expand.d.ts.map +1 -1
  138. package/view/details-expand.js +85 -80
  139. package/view/down-drop.d.ts +18 -18
  140. package/view/down-drop.d.ts.map +1 -1
  141. package/view/down-drop.js +98 -94
  142. package/view/index.d.ts +5 -5
  143. package/view/index.js +5 -5
  144. package/view/menu-list.d.ts +16 -16
  145. package/view/menu-list.d.ts.map +1 -1
  146. package/view/menu-list.js +77 -72
  147. package/view/route-view.d.ts +57 -57
  148. package/view/route-view.d.ts.map +1 -1
  149. package/view/route-view.js +261 -258
  150. package/view/scroll-x.d.ts +14 -14
  151. package/view/scroll-x.d.ts.map +1 -1
  152. package/view/scroll-x.js +77 -72
  153. package/view/std.d.ts +4 -4
  154. package/view/std.d.ts.map +1 -1
  155. package/view/std.js +37 -37
  156. package/with.d.ts +27 -27
  157. package/with.d.ts.map +1 -1
  158. package/with.js +77 -78
  159. package/view/react/effect.d.ts +0 -10
  160. package/view/react/effect.d.ts.map +0 -1
  161. package/view/react/effect.js +0 -32
  162. package/view/react/group.d.ts +0 -5
  163. package/view/react/group.d.ts.map +0 -1
  164. package/view/react/group.js +0 -18
  165. package/view/react/index.d.ts +0 -7
  166. package/view/react/index.d.ts.map +0 -1
  167. package/view/react/index.js +0 -6
  168. package/view/react/input-form.d.ts +0 -33
  169. package/view/react/input-form.d.ts.map +0 -1
  170. package/view/react/input-form.js +0 -64
  171. package/view/react/items.d.ts +0 -9
  172. package/view/react/items.d.ts.map +0 -1
  173. package/view/react/items.js +0 -38
  174. package/view/react/layout.d.ts +0 -7
  175. package/view/react/layout.d.ts.map +0 -1
  176. package/view/react/layout.js +0 -28
  177. package/view/react/view.d.ts +0 -7
  178. package/view/react/view.d.ts.map +0 -1
  179. package/view/react/view.js +0 -28
@@ -1,258 +1,261 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var RouteView_1;
8
- import { conf, css, define, html, LitElement, property } from "../deps.js";
9
- import { unsafeHTML } from "lit/directives/unsafe-html.js";
10
- let RouteView = RouteView_1 = class RouteView extends LitElement {
11
- constructor() {
12
- super(...arguments);
13
- this._routes = [];
14
- this.params = {};
15
- this.static = false;
16
- this.type = "united";
17
- this.baseURL = "";
18
- this.path = "";
19
- this.override = false;
20
- this.compoent = null;
21
- }
22
- set routes(v) {
23
- if (Object.prototype.toString.call(v) !== "[object Array]") {
24
- this._routes = [];
25
- return;
26
- }
27
- if (this.static) {
28
- this._routes = v;
29
- }
30
- else {
31
- this._routes = RouteView_1.sortRoutesPaths(v);
32
- }
33
- this.requestUpdate();
34
- }
35
- get routes() {
36
- return this._routes;
37
- }
38
- render() {
39
- var _a, _b, _c;
40
- if (this.type === "field") {
41
- return (_a = this.render_field()) !== null && _a !== void 0 ? _a : html `<slot></slot>`;
42
- }
43
- if (this.type === "slotted" || this.type === "child") {
44
- return (_b = this.render_slotted()) !== null && _b !== void 0 ? _b : html `<slot></slot>`;
45
- }
46
- return (_c = this.render_united()) !== null && _c !== void 0 ? _c : html `<slot></slot>`;
47
- }
48
- useRouter() {
49
- return {
50
- path: this.path,
51
- params: this.params,
52
- };
53
- }
54
- connectedCallback() {
55
- super.connectedCallback();
56
- this.path = window.location.pathname;
57
- window.addEventListener("popstate", (e) => {
58
- this.path = window.location.pathname;
59
- });
60
- if (!this.override)
61
- return;
62
- const self = this;
63
- const pushHistory = history.pushState;
64
- history.pushState = function () {
65
- pushHistory.apply(this, arguments);
66
- self.path = window.location.pathname;
67
- };
68
- const replaceHistory = history.replaceState;
69
- history.replaceState = function () {
70
- replaceHistory.apply(this, arguments);
71
- self.path = window.location.pathname;
72
- };
73
- }
74
- render_united() {
75
- const slottedCompoent = this.render_slotted();
76
- if (slottedCompoent)
77
- return slottedCompoent;
78
- const Compoent = this.render_field();
79
- return Compoent;
80
- }
81
- render_slotted() {
82
- const childNodes = this.querySelectorAll(":scope > *[slot]");
83
- const slots = Array.from(childNodes).map((node) => {
84
- const slotname = node.getAttribute("slot");
85
- return {
86
- path: this.baseURL + slotname,
87
- slotname
88
- };
89
- });
90
- let slotsSort;
91
- if (this.static) {
92
- slotsSort = slots;
93
- }
94
- else {
95
- slotsSort = RouteView_1.sortRoutesPaths(slots);
96
- }
97
- const usedRouteTemplate = RouteView_1.useWhichRoute(slotsSort, this.path);
98
- const Compoent = this.slottedCompoent(usedRouteTemplate, slotsSort);
99
- return Compoent;
100
- }
101
- render_field() {
102
- const usedRouteTemplate = RouteView_1.useWhichRoute(this.routes, this.path);
103
- const RouterParmasObject = RouteView_1.parseRouterParams(usedRouteTemplate, this.path);
104
- this.params = RouterParmasObject;
105
- const Compoent = this.fieldComponent(usedRouteTemplate);
106
- return Compoent;
107
- }
108
- fieldComponent(usedRouteTemplate) {
109
- if (!usedRouteTemplate)
110
- return;
111
- const route = this.routes.find((r) => r.path === usedRouteTemplate);
112
- if (!route)
113
- return null;
114
- return route.component || (route.html ? unsafeHTML(route.html) : null);
115
- }
116
- slottedCompoent(usedRouteTemplate, ObjectArrayIncludePath) {
117
- if (!usedRouteTemplate)
118
- return;
119
- const slotElement = ObjectArrayIncludePath.find((s) => s.path === usedRouteTemplate);
120
- if (!slotElement)
121
- return null;
122
- const RouterParmasObject = RouteView_1.parseRouterParams(usedRouteTemplate, this.path);
123
- this.params = RouterParmasObject;
124
- return html `<slot name="${slotElement.slotname}"></slot>`;
125
- }
126
- static sortRoutesPaths(ObjectArrayIncludePath) {
127
- const all = ObjectArrayIncludePath.map((route) => {
128
- const path = route.path;
129
- const pathArray = path.split("/");
130
- const Single_dynamicRouteCount = pathArray.filter((p) => p.startsWith(":")).length;
131
- return {
132
- ...route,
133
- path,
134
- Single_dynamicRouteCount,
135
- };
136
- });
137
- const allSort = all.sort((a, b) => a.Single_dynamicRouteCount - b.Single_dynamicRouteCount);
138
- const multi = allSort.filter((route) => {
139
- const path = route.path;
140
- const pathArray = path.split("/");
141
- const double_dynamicRouteCount = pathArray.filter((p) => p.startsWith("...") || p.startsWith("*")).length;
142
- return double_dynamicRouteCount > 0;
143
- });
144
- multi.sort((a, b) => {
145
- const aIndex = a.path.split("/").findIndex((template) => template.startsWith("...") || template.startsWith("*"));
146
- const bIndex = b.path.split("/").findIndex((template) => template.startsWith("...") || template.startsWith("*"));
147
- return aIndex !== -1 && bIndex !== -1 ? bIndex - aIndex : 0;
148
- });
149
- const sigle = allSort.filter((route) => {
150
- const path = route.path;
151
- const pathArray = path.split("/");
152
- const double_dynamicRouteCount = pathArray.filter((p) => p.startsWith("...") || p.startsWith("*")).length;
153
- return double_dynamicRouteCount === 0;
154
- });
155
- return [...sigle, ...multi];
156
- }
157
- static useWhichRoute(ObjectArrayIncludePath, path, baseURL = "") {
158
- const originpath = baseURL + path;
159
- const originsplits = originpath.split("/").slice(1);
160
- const routes = ObjectArrayIncludePath;
161
- const pathTemplateArray = routes.map((r) => r.path);
162
- for (const pathTemplate of pathTemplateArray) {
163
- const pathsplits = pathTemplate.split("/").slice(1);
164
- const ifmatched = pathsplits.every((pathsplit, index) => {
165
- const originsplit = originsplits[index];
166
- if (pathsplit.startsWith(":")) {
167
- return originsplits.length <= pathsplits.length;
168
- }
169
- else if (pathsplit.startsWith("...")) {
170
- return originsplits.length >= pathsplits.length;
171
- }
172
- else {
173
- return originsplits.length === pathsplits.length && originsplit === pathsplit;
174
- }
175
- });
176
- if (ifmatched) {
177
- return pathTemplate;
178
- }
179
- }
180
- return null;
181
- /*
182
- const originpath: string = baseURL + path;
183
- const routes = ObjectArrayIncludePath as Array<{ path?: string; }>;
184
- const pathTemplateArray = routes.map((r) => r.path) as Array<string>;
185
- for (const pathTemplate of pathTemplateArray) {
186
- const pathsplits = pathTemplate.split("/").slice(1);
187
- const reg = new RegExp(pathsplits.map((s: string) => {
188
- if (s.startsWith(":")) {
189
- return "^\/[^\/]+$";
190
- } else if (s.startsWith("...") || s.startsWith("*")) {
191
- return ".*";
192
- } else {
193
- return s;
194
- }
195
- }).join("/") + "$");
196
- if (reg.test(originpath)) {
197
- return pathTemplate;
198
- }
199
- }
200
- return null;
201
- */
202
- }
203
- static parseRouterParams(routeTemplate, originpath) {
204
- if (!routeTemplate || !originpath)
205
- return;
206
- const params = {};
207
- const originpathArray = originpath.split("/").splice(1);
208
- const routeTemplateSplit = routeTemplate.split("/").splice(1);
209
- for (const [index, path] of routeTemplateSplit.entries()) {
210
- if (path.startsWith(":")) {
211
- params[path.slice(1)] = originpathArray[index];
212
- }
213
- else if (path.startsWith("*")) {
214
- params[path.slice(1)] = originpathArray.slice(index).join("/");
215
- }
216
- else if (path.startsWith("...")) {
217
- params[path.slice(3)] = originpathArray.slice(index).join("/");
218
- }
219
- else {
220
- if (path !== originpathArray[index]) {
221
- return;
222
- }
223
- }
224
- }
225
- return params;
226
- }
227
- static updateAll() {
228
- const routeViewTagName = conf.namemap.get("route-view");
229
- const routeViewArray = document.querySelectorAll(`${routeViewTagName}:not([override])`);
230
- for (let index = 0, ArrayItem; ArrayItem = routeViewArray[index]; index++) {
231
- ArrayItem.path = window.location.pathname;
232
- }
233
- }
234
- };
235
- RouteView.styles = css `:host{display:contents}`;
236
- __decorate([
237
- property({ type: Boolean })
238
- ], RouteView.prototype, "static", void 0);
239
- __decorate([
240
- property()
241
- ], RouteView.prototype, "type", void 0);
242
- __decorate([
243
- property()
244
- ], RouteView.prototype, "baseURL", void 0);
245
- __decorate([
246
- property()
247
- ], RouteView.prototype, "path", void 0);
248
- __decorate([
249
- property({ type: Boolean })
250
- ], RouteView.prototype, "override", void 0);
251
- __decorate([
252
- property({ type: Object })
253
- ], RouteView.prototype, "compoent", void 0);
254
- RouteView = RouteView_1 = __decorate([
255
- define("route-view")
256
- ], RouteView);
257
- export { RouteView };
258
- export default RouteView;
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var RouteView_1;
8
+ import { conf, css, define, html, LitElement, property } from "../deps.js";
9
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
10
+ let RouteView = RouteView_1 = class RouteView extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this._routes = [];
14
+ this.params = {};
15
+ this.static = false;
16
+ this.type = "united";
17
+ this.baseURL = "";
18
+ this.path = "";
19
+ this.override = false;
20
+ this.compoent = null;
21
+ }
22
+ set routes(v) {
23
+ if (Object.prototype.toString.call(v) !== "[object Array]") {
24
+ this._routes = [];
25
+ return;
26
+ }
27
+ if (this.static) {
28
+ this._routes = v;
29
+ }
30
+ else {
31
+ this._routes = RouteView_1.sortRoutesPaths(v);
32
+ }
33
+ this.requestUpdate();
34
+ }
35
+ get routes() {
36
+ return this._routes;
37
+ }
38
+ render() {
39
+ var _a, _b, _c;
40
+ if (this.type === "field") {
41
+ return (_a = this.render_field()) !== null && _a !== void 0 ? _a : html `<slot></slot>`;
42
+ }
43
+ if (this.type === "slotted" || this.type === "child") {
44
+ return (_b = this.render_slotted()) !== null && _b !== void 0 ? _b : html `<slot></slot>`;
45
+ }
46
+ return (_c = this.render_united()) !== null && _c !== void 0 ? _c : html `<slot></slot>`;
47
+ }
48
+ useRouter() {
49
+ return {
50
+ path: this.path,
51
+ params: this.params,
52
+ };
53
+ }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ this.path = window.location.pathname;
57
+ window.addEventListener("popstate", (e) => {
58
+ this.path = window.location.pathname;
59
+ });
60
+ if (!this.override)
61
+ return;
62
+ const pushHistory = history.pushState;
63
+ history.pushState = function () {
64
+ pushHistory.apply(this, arguments);
65
+ this.path = window.location.pathname;
66
+ };
67
+ const replaceHistory = history.replaceState;
68
+ history.replaceState = function () {
69
+ replaceHistory.apply(this, arguments);
70
+ this.path = window.location.pathname;
71
+ };
72
+ }
73
+ render_united() {
74
+ const slottedCompoent = this.render_slotted();
75
+ if (slottedCompoent)
76
+ return slottedCompoent;
77
+ const Compoent = this.render_field();
78
+ return Compoent;
79
+ }
80
+ render_slotted() {
81
+ const childNodes = this.querySelectorAll(":scope > *[slot]");
82
+ const slots = Array.from(childNodes).map((node) => {
83
+ const slotname = node.getAttribute("slot");
84
+ return {
85
+ path: this.baseURL + slotname,
86
+ slotname,
87
+ };
88
+ });
89
+ let slotsSort;
90
+ if (this.static) {
91
+ slotsSort = slots;
92
+ }
93
+ else {
94
+ slotsSort = RouteView_1.sortRoutesPaths(slots);
95
+ }
96
+ const usedRouteTemplate = RouteView_1.useWhichRoute(slotsSort, this.path);
97
+ const Compoent = this.slottedCompoent(usedRouteTemplate, slotsSort);
98
+ return Compoent;
99
+ }
100
+ render_field() {
101
+ const usedRouteTemplate = RouteView_1.useWhichRoute(this.routes, this.path);
102
+ const RouterParmasObject = RouteView_1.parseRouterParams(usedRouteTemplate, this.path);
103
+ this.params = RouterParmasObject;
104
+ const Compoent = this.fieldComponent(usedRouteTemplate);
105
+ return Compoent;
106
+ }
107
+ fieldComponent(usedRouteTemplate) {
108
+ if (!usedRouteTemplate)
109
+ return;
110
+ const route = this.routes.find((r) => r.path === usedRouteTemplate);
111
+ if (!route)
112
+ return null;
113
+ return route.component || (route.html ? unsafeHTML(route.html) : null);
114
+ }
115
+ slottedCompoent(usedRouteTemplate, ObjectArrayIncludePath) {
116
+ if (!usedRouteTemplate)
117
+ return;
118
+ const slotElement = ObjectArrayIncludePath.find((s) => s.path === usedRouteTemplate);
119
+ if (!slotElement)
120
+ return null;
121
+ const RouterParmasObject = RouteView_1.parseRouterParams(usedRouteTemplate, this.path);
122
+ this.params = RouterParmasObject;
123
+ return html `<slot name="${slotElement.slotname}"></slot>`;
124
+ }
125
+ static sortRoutesPaths(ObjectArrayIncludePath) {
126
+ const all = ObjectArrayIncludePath.map((route) => {
127
+ const path = route.path;
128
+ const pathArray = path.split("/");
129
+ const Single_dynamicRouteCount = pathArray.filter((p) => p.startsWith(":")).length;
130
+ return {
131
+ ...route,
132
+ path,
133
+ Single_dynamicRouteCount,
134
+ };
135
+ });
136
+ const allSort = all.sort((a, b) => a.Single_dynamicRouteCount - b.Single_dynamicRouteCount);
137
+ const multi = allSort.filter((route) => {
138
+ const path = route.path;
139
+ const pathArray = path.split("/");
140
+ const double_dynamicRouteCount = pathArray.filter((p) => p.startsWith("...") || p.startsWith("*")).length;
141
+ return double_dynamicRouteCount > 0;
142
+ });
143
+ multi.sort((a, b) => {
144
+ const aIndex = a.path.split("/").findIndex((template) => template.startsWith("...") || template.startsWith("*"));
145
+ const bIndex = b.path.split("/").findIndex((template) => template.startsWith("...") || template.startsWith("*"));
146
+ return aIndex !== -1 && bIndex !== -1 ? bIndex - aIndex : 0;
147
+ });
148
+ const sigle = allSort.filter((route) => {
149
+ const path = route.path;
150
+ const pathArray = path.split("/");
151
+ const double_dynamicRouteCount = pathArray.filter((p) => p.startsWith("...") || p.startsWith("*")).length;
152
+ return double_dynamicRouteCount === 0;
153
+ });
154
+ return [...sigle, ...multi];
155
+ }
156
+ static useWhichRoute(ObjectArrayIncludePath, path, baseURL = "") {
157
+ const originpath = baseURL + path;
158
+ const originsplits = originpath.split("/").slice(1);
159
+ const routes = ObjectArrayIncludePath;
160
+ const pathTemplateArray = routes.map((r) => r.path);
161
+ for (const pathTemplate of pathTemplateArray) {
162
+ const pathsplits = pathTemplate.split("/").slice(1);
163
+ const ifmatched = pathsplits.every((pathsplit, index) => {
164
+ const originsplit = originsplits[index];
165
+ if (pathsplit.startsWith(":")) {
166
+ return originsplits.length <= pathsplits.length;
167
+ }
168
+ else if (pathsplit.startsWith("...")) {
169
+ return originsplits.length >= pathsplits.length;
170
+ }
171
+ else {
172
+ return originsplits.length === pathsplits.length && originsplit === pathsplit;
173
+ }
174
+ });
175
+ if (ifmatched) {
176
+ return pathTemplate;
177
+ }
178
+ }
179
+ return null;
180
+ /*
181
+ const originpath: string = baseURL + path;
182
+ const routes = ObjectArrayIncludePath as Array<{ path?: string; }>;
183
+ const pathTemplateArray = routes.map((r) => r.path) as Array<string>;
184
+ for (const pathTemplate of pathTemplateArray) {
185
+ const pathsplits = pathTemplate.split("/").slice(1);
186
+ const reg = new RegExp(pathsplits.map((s: string) => {
187
+ if (s.startsWith(":")) {
188
+ return "^\/[^\/]+$";
189
+ } else if (s.startsWith("...") || s.startsWith("*")) {
190
+ return ".*";
191
+ } else {
192
+ return s;
193
+ }
194
+ }).join("/") + "$");
195
+ if (reg.test(originpath)) {
196
+ return pathTemplate;
197
+ }
198
+ }
199
+ return null;
200
+ */
201
+ }
202
+ static parseRouterParams(routeTemplate, originpath) {
203
+ if (!routeTemplate || !originpath)
204
+ return;
205
+ const params = {};
206
+ const originpathArray = originpath.split("/").splice(1);
207
+ const routeTemplateSplit = routeTemplate.split("/").splice(1);
208
+ for (const [index, path] of routeTemplateSplit.entries()) {
209
+ if (path.startsWith(":")) {
210
+ params[path.slice(1)] = originpathArray[index];
211
+ }
212
+ else if (path.startsWith("*")) {
213
+ params[path.slice(1)] = originpathArray.slice(index).join("/");
214
+ }
215
+ else if (path.startsWith("...")) {
216
+ params[path.slice(3)] = originpathArray.slice(index).join("/");
217
+ }
218
+ else {
219
+ if (path !== originpathArray[index]) {
220
+ return;
221
+ }
222
+ }
223
+ }
224
+ return params;
225
+ }
226
+ static updateAll() {
227
+ const routeViewTagName = conf.namemap.get("route-view");
228
+ const routeViewArray = document.querySelectorAll(`${routeViewTagName}:not([override])`);
229
+ for (let index = 0, ArrayItem; (ArrayItem = routeViewArray[index]); index++) {
230
+ ArrayItem.path = window.location.pathname;
231
+ }
232
+ }
233
+ };
234
+ RouteView.styles = css `
235
+ :host {
236
+ display: contents;
237
+ }
238
+ `;
239
+ __decorate([
240
+ property({ type: Boolean })
241
+ ], RouteView.prototype, "static", void 0);
242
+ __decorate([
243
+ property()
244
+ ], RouteView.prototype, "type", void 0);
245
+ __decorate([
246
+ property()
247
+ ], RouteView.prototype, "baseURL", void 0);
248
+ __decorate([
249
+ property()
250
+ ], RouteView.prototype, "path", void 0);
251
+ __decorate([
252
+ property({ type: Boolean })
253
+ ], RouteView.prototype, "override", void 0);
254
+ __decorate([
255
+ property({ type: Object })
256
+ ], RouteView.prototype, "compoent", void 0);
257
+ RouteView = RouteView_1 = __decorate([
258
+ define("route-view")
259
+ ], RouteView);
260
+ export { RouteView };
261
+ export default RouteView;
@@ -1,15 +1,15 @@
1
- import STD from "./std.js";
2
- export declare class ScrollX extends STD {
3
- static styles: import("lit").CSSResult;
4
- get _section(): HTMLElement;
5
- render(): import("lit").TemplateResult<1>;
6
- firstUpdated(): void;
7
- resize(): void;
8
- }
9
- export default ScrollX;
10
- declare global {
11
- interface HTMLElementTagNameMap {
12
- "scroll-x": ScrollX;
13
- }
14
- }
1
+ import STD from "./std.js";
2
+ export declare class ScrollX extends STD {
3
+ static styles: import("lit").CSSResult;
4
+ get _section(): HTMLElement;
5
+ render(): import("lit-html").TemplateResult<1>;
6
+ firstUpdated(): void;
7
+ resize(): void;
8
+ }
9
+ export default ScrollX;
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ "scroll-x": ScrollX;
13
+ }
14
+ }
15
15
  //# sourceMappingURL=scroll-x.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-x.d.ts","sourceRoot":"","sources":["../../src/view/scroll-x.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,qBACa,OAAQ,SAAQ,GAAG;IAC9B,MAAM,CAAC,MAAM,0BAyBV;IACH,IAAI,QAAQ,gBAEX;IACD,MAAM;IAGN,YAAY;IASZ,MAAM;CAcP;AACD,eAAe,OAAO,CAAC;AACvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
1
+ {"version":3,"file":"scroll-x.d.ts","sourceRoot":"","sources":["../../src/view/scroll-x.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,qBACa,OAAQ,SAAQ,GAAG;IAC9B,MAAM,CAAC,MAAM,0BA0BX;IACF,IAAI,QAAQ,gBAEX;IACD,MAAM;IAON,YAAY;IASZ,MAAM;CAcP;AACD,eAAe,OAAO,CAAC;AACvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}