godown 3.4.0 → 3.5.1

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 (330) hide show
  1. package/build/godown+lit.iife.js +2 -2
  2. package/build/godown+lit.iife.js.map +1 -1
  3. package/build/godown+lit.js +2 -2
  4. package/build/godown+lit.js.map +1 -1
  5. package/build/godown+lit.umd.js +2 -2
  6. package/build/godown+lit.umd.js.map +1 -1
  7. package/build/godown.iife.js +5 -5
  8. package/build/godown.js +4 -4
  9. package/build/godown.js.map +1 -1
  10. package/build/godown.umd.js +5 -5
  11. package/build/godown.umd.js.map +1 -1
  12. package/components/avatar.d.ts.map +1 -1
  13. package/components/avatar.js +1 -1
  14. package/components/avatar.js.map +1 -1
  15. package/components/badge.js +1 -1
  16. package/components/badge.js.map +1 -1
  17. package/components/button.js +1 -1
  18. package/components/button.js.map +1 -1
  19. package/components/card.js +1 -1
  20. package/components/card.js.map +1 -1
  21. package/components/details.js +1 -1
  22. package/components/details.js.map +1 -1
  23. package/components/dialog.js +1 -1
  24. package/components/dialog.js.map +1 -1
  25. package/components/divider.d.ts.map +1 -1
  26. package/components/divider.js +1 -1
  27. package/components/divider.js.map +1 -1
  28. package/components/range.d.ts +7 -6
  29. package/components/range.d.ts.map +1 -1
  30. package/components/range.js.map +1 -1
  31. package/components/split.js +1 -1
  32. package/components/split.js.map +1 -1
  33. package/components/switch.d.ts +5 -13
  34. package/components/switch.d.ts.map +1 -1
  35. package/components/switch.js +1 -1
  36. package/components/switch.js.map +1 -1
  37. package/core/global-style.js +1 -1
  38. package/core/super-input.d.ts +2 -2
  39. package/core/super-input.d.ts.map +1 -1
  40. package/core/super-input.js +1 -1
  41. package/core/super-input.js.map +1 -1
  42. package/core/super-openable.d.ts +0 -1
  43. package/core/super-openable.d.ts.map +1 -1
  44. package/core/super-openable.js +1 -1
  45. package/core/super-openable.js.map +1 -1
  46. package/custom-elements.json +1 -1
  47. package/package.json +6 -18
  48. package/src/components/avatar.ts +2 -1
  49. package/src/components/button.ts +2 -3
  50. package/src/components/card.ts +4 -0
  51. package/src/components/details.ts +1 -1
  52. package/src/components/dialog.ts +4 -6
  53. package/src/components/divider.ts +2 -1
  54. package/src/components/range.ts +13 -11
  55. package/src/components/split.ts +2 -1
  56. package/src/components/switch.ts +43 -60
  57. package/src/core/global-style.ts +2 -2
  58. package/src/core/super-input.ts +13 -8
  59. package/src/core/super-openable.ts +0 -4
  60. package/tsconfig.json +33 -0
  61. package/vscode.html-custom-data.json +1 -1
  62. package/web-types.json +1 -1
  63. package/dev/alert.d.ts +0 -9
  64. package/dev/alert.d.ts.map +0 -1
  65. package/dev/alert.js +0 -5
  66. package/dev/alert.js.map +0 -1
  67. package/dev/avatar.d.ts +0 -9
  68. package/dev/avatar.d.ts.map +0 -1
  69. package/dev/avatar.js +0 -5
  70. package/dev/avatar.js.map +0 -1
  71. package/dev/badge.d.ts +0 -9
  72. package/dev/badge.d.ts.map +0 -1
  73. package/dev/badge.js +0 -5
  74. package/dev/badge.js.map +0 -1
  75. package/dev/breath.d.ts +0 -9
  76. package/dev/breath.d.ts.map +0 -1
  77. package/dev/breath.js +0 -5
  78. package/dev/breath.js.map +0 -1
  79. package/dev/button.d.ts +0 -9
  80. package/dev/button.d.ts.map +0 -1
  81. package/dev/button.js +0 -5
  82. package/dev/button.js.map +0 -1
  83. package/dev/card.d.ts +0 -9
  84. package/dev/card.d.ts.map +0 -1
  85. package/dev/card.js +0 -5
  86. package/dev/card.js.map +0 -1
  87. package/dev/carousel.d.ts +0 -9
  88. package/dev/carousel.d.ts.map +0 -1
  89. package/dev/carousel.js +0 -5
  90. package/dev/carousel.js.map +0 -1
  91. package/dev/components/alert.d.ts +0 -55
  92. package/dev/components/alert.d.ts.map +0 -1
  93. package/dev/components/alert.js +0 -236
  94. package/dev/components/alert.js.map +0 -1
  95. package/dev/components/avatar.d.ts +0 -33
  96. package/dev/components/avatar.d.ts.map +0 -1
  97. package/dev/components/avatar.js +0 -118
  98. package/dev/components/avatar.js.map +0 -1
  99. package/dev/components/badge.d.ts +0 -31
  100. package/dev/components/badge.d.ts.map +0 -1
  101. package/dev/components/badge.js +0 -122
  102. package/dev/components/badge.js.map +0 -1
  103. package/dev/components/breath.d.ts +0 -36
  104. package/dev/components/breath.d.ts.map +0 -1
  105. package/dev/components/breath.js +0 -135
  106. package/dev/components/breath.js.map +0 -1
  107. package/dev/components/button.d.ts +0 -60
  108. package/dev/components/button.d.ts.map +0 -1
  109. package/dev/components/button.js +0 -288
  110. package/dev/components/button.js.map +0 -1
  111. package/dev/components/card.d.ts +0 -27
  112. package/dev/components/card.d.ts.map +0 -1
  113. package/dev/components/card.js +0 -83
  114. package/dev/components/card.js.map +0 -1
  115. package/dev/components/carousel.d.ts +0 -39
  116. package/dev/components/carousel.d.ts.map +0 -1
  117. package/dev/components/carousel.js +0 -184
  118. package/dev/components/carousel.js.map +0 -1
  119. package/dev/components/details.d.ts +0 -24
  120. package/dev/components/details.d.ts.map +0 -1
  121. package/dev/components/details.js +0 -124
  122. package/dev/components/details.js.map +0 -1
  123. package/dev/components/dialog.d.ts +0 -43
  124. package/dev/components/dialog.d.ts.map +0 -1
  125. package/dev/components/dialog.js +0 -154
  126. package/dev/components/dialog.js.map +0 -1
  127. package/dev/components/divider.d.ts +0 -17
  128. package/dev/components/divider.d.ts.map +0 -1
  129. package/dev/components/divider.js +0 -63
  130. package/dev/components/divider.js.map +0 -1
  131. package/dev/components/dragbox.d.ts +0 -42
  132. package/dev/components/dragbox.d.ts.map +0 -1
  133. package/dev/components/dragbox.js +0 -126
  134. package/dev/components/dragbox.js.map +0 -1
  135. package/dev/components/flex.d.ts +0 -34
  136. package/dev/components/flex.d.ts.map +0 -1
  137. package/dev/components/flex.js +0 -73
  138. package/dev/components/flex.js.map +0 -1
  139. package/dev/components/form.d.ts +0 -24
  140. package/dev/components/form.d.ts.map +0 -1
  141. package/dev/components/form.js +0 -76
  142. package/dev/components/form.js.map +0 -1
  143. package/dev/components/grid.d.ts +0 -38
  144. package/dev/components/grid.d.ts.map +0 -1
  145. package/dev/components/grid.js +0 -67
  146. package/dev/components/grid.js.map +0 -1
  147. package/dev/components/heading.d.ts +0 -31
  148. package/dev/components/heading.d.ts.map +0 -1
  149. package/dev/components/heading.js +0 -127
  150. package/dev/components/heading.js.map +0 -1
  151. package/dev/components/input.d.ts +0 -23
  152. package/dev/components/input.d.ts.map +0 -1
  153. package/dev/components/input.js +0 -99
  154. package/dev/components/input.js.map +0 -1
  155. package/dev/components/layout.d.ts +0 -28
  156. package/dev/components/layout.d.ts.map +0 -1
  157. package/dev/components/layout.js +0 -96
  158. package/dev/components/layout.js.map +0 -1
  159. package/dev/components/link.d.ts +0 -54
  160. package/dev/components/link.d.ts.map +0 -1
  161. package/dev/components/link.js +0 -110
  162. package/dev/components/link.js.map +0 -1
  163. package/dev/components/progress.d.ts +0 -16
  164. package/dev/components/progress.d.ts.map +0 -1
  165. package/dev/components/progress.js +0 -101
  166. package/dev/components/progress.js.map +0 -1
  167. package/dev/components/range.d.ts +0 -121
  168. package/dev/components/range.d.ts.map +0 -1
  169. package/dev/components/range.js +0 -391
  170. package/dev/components/range.js.map +0 -1
  171. package/dev/components/rotate.d.ts +0 -30
  172. package/dev/components/rotate.d.ts.map +0 -1
  173. package/dev/components/rotate.js +0 -93
  174. package/dev/components/rotate.js.map +0 -1
  175. package/dev/components/router.d.ts +0 -116
  176. package/dev/components/router.d.ts.map +0 -1
  177. package/dev/components/router.js +0 -240
  178. package/dev/components/router.js.map +0 -1
  179. package/dev/components/select.d.ts +0 -53
  180. package/dev/components/select.d.ts.map +0 -1
  181. package/dev/components/select.js +0 -269
  182. package/dev/components/select.js.map +0 -1
  183. package/dev/components/skeleton.d.ts +0 -28
  184. package/dev/components/skeleton.d.ts.map +0 -1
  185. package/dev/components/skeleton.js +0 -122
  186. package/dev/components/skeleton.js.map +0 -1
  187. package/dev/components/split.d.ts +0 -56
  188. package/dev/components/split.d.ts.map +0 -1
  189. package/dev/components/split.js +0 -219
  190. package/dev/components/split.js.map +0 -1
  191. package/dev/components/switch.d.ts +0 -40
  192. package/dev/components/switch.d.ts.map +0 -1
  193. package/dev/components/switch.js +0 -166
  194. package/dev/components/switch.js.map +0 -1
  195. package/dev/components/text.d.ts +0 -21
  196. package/dev/components/text.d.ts.map +0 -1
  197. package/dev/components/text.js +0 -96
  198. package/dev/components/text.js.map +0 -1
  199. package/dev/components/time.d.ts +0 -36
  200. package/dev/components/time.d.ts.map +0 -1
  201. package/dev/components/time.js +0 -75
  202. package/dev/components/time.js.map +0 -1
  203. package/dev/components/tooltip.d.ts +0 -51
  204. package/dev/components/tooltip.d.ts.map +0 -1
  205. package/dev/components/tooltip.js +0 -140
  206. package/dev/components/tooltip.js.map +0 -1
  207. package/dev/components/typewriter.d.ts +0 -49
  208. package/dev/components/typewriter.d.ts.map +0 -1
  209. package/dev/components/typewriter.js +0 -149
  210. package/dev/components/typewriter.js.map +0 -1
  211. package/dev/core/direction.d.ts +0 -27
  212. package/dev/core/direction.d.ts.map +0 -1
  213. package/dev/core/direction.js +0 -56
  214. package/dev/core/direction.js.map +0 -1
  215. package/dev/core/global-style.d.ts +0 -20
  216. package/dev/core/global-style.d.ts.map +0 -1
  217. package/dev/core/global-style.js +0 -82
  218. package/dev/core/global-style.js.map +0 -1
  219. package/dev/core/outline.d.ts +0 -20
  220. package/dev/core/outline.d.ts.map +0 -1
  221. package/dev/core/outline.js +0 -44
  222. package/dev/core/outline.js.map +0 -1
  223. package/dev/core/super-anchor.d.ts +0 -18
  224. package/dev/core/super-anchor.d.ts.map +0 -1
  225. package/dev/core/super-anchor.js +0 -60
  226. package/dev/core/super-anchor.js.map +0 -1
  227. package/dev/core/super-input.d.ts +0 -43
  228. package/dev/core/super-input.d.ts.map +0 -1
  229. package/dev/core/super-input.js +0 -197
  230. package/dev/core/super-input.js.map +0 -1
  231. package/dev/core/super-openable.d.ts +0 -16
  232. package/dev/core/super-openable.d.ts.map +0 -1
  233. package/dev/core/super-openable.js +0 -36
  234. package/dev/core/super-openable.js.map +0 -1
  235. package/dev/details.d.ts +0 -9
  236. package/dev/details.d.ts.map +0 -1
  237. package/dev/details.js +0 -5
  238. package/dev/details.js.map +0 -1
  239. package/dev/dialog.d.ts +0 -9
  240. package/dev/dialog.d.ts.map +0 -1
  241. package/dev/dialog.js +0 -5
  242. package/dev/dialog.js.map +0 -1
  243. package/dev/divider.d.ts +0 -9
  244. package/dev/divider.d.ts.map +0 -1
  245. package/dev/divider.js +0 -5
  246. package/dev/divider.js.map +0 -1
  247. package/dev/dragbox.d.ts +0 -9
  248. package/dev/dragbox.d.ts.map +0 -1
  249. package/dev/dragbox.js +0 -5
  250. package/dev/dragbox.js.map +0 -1
  251. package/dev/flex.d.ts +0 -9
  252. package/dev/flex.d.ts.map +0 -1
  253. package/dev/flex.js +0 -5
  254. package/dev/flex.js.map +0 -1
  255. package/dev/form.d.ts +0 -9
  256. package/dev/form.d.ts.map +0 -1
  257. package/dev/form.js +0 -5
  258. package/dev/form.js.map +0 -1
  259. package/dev/grid.d.ts +0 -9
  260. package/dev/grid.d.ts.map +0 -1
  261. package/dev/grid.js +0 -5
  262. package/dev/grid.js.map +0 -1
  263. package/dev/heading.d.ts +0 -9
  264. package/dev/heading.d.ts.map +0 -1
  265. package/dev/heading.js +0 -5
  266. package/dev/heading.js.map +0 -1
  267. package/dev/index.d.ts +0 -31
  268. package/dev/index.d.ts.map +0 -1
  269. package/dev/index.js +0 -31
  270. package/dev/index.js.map +0 -1
  271. package/dev/input.d.ts +0 -9
  272. package/dev/input.d.ts.map +0 -1
  273. package/dev/input.js +0 -5
  274. package/dev/input.js.map +0 -1
  275. package/dev/layout.d.ts +0 -9
  276. package/dev/layout.d.ts.map +0 -1
  277. package/dev/layout.js +0 -5
  278. package/dev/layout.js.map +0 -1
  279. package/dev/link.d.ts +0 -9
  280. package/dev/link.d.ts.map +0 -1
  281. package/dev/link.js +0 -5
  282. package/dev/link.js.map +0 -1
  283. package/dev/progress.d.ts +0 -9
  284. package/dev/progress.d.ts.map +0 -1
  285. package/dev/progress.js +0 -5
  286. package/dev/progress.js.map +0 -1
  287. package/dev/range.d.ts +0 -9
  288. package/dev/range.d.ts.map +0 -1
  289. package/dev/range.js +0 -5
  290. package/dev/range.js.map +0 -1
  291. package/dev/rotate.d.ts +0 -9
  292. package/dev/rotate.d.ts.map +0 -1
  293. package/dev/rotate.js +0 -5
  294. package/dev/rotate.js.map +0 -1
  295. package/dev/router.d.ts +0 -9
  296. package/dev/router.d.ts.map +0 -1
  297. package/dev/router.js +0 -5
  298. package/dev/router.js.map +0 -1
  299. package/dev/select.d.ts +0 -9
  300. package/dev/select.d.ts.map +0 -1
  301. package/dev/select.js +0 -5
  302. package/dev/select.js.map +0 -1
  303. package/dev/skeleton.d.ts +0 -9
  304. package/dev/skeleton.d.ts.map +0 -1
  305. package/dev/skeleton.js +0 -5
  306. package/dev/skeleton.js.map +0 -1
  307. package/dev/split.d.ts +0 -9
  308. package/dev/split.d.ts.map +0 -1
  309. package/dev/split.js +0 -5
  310. package/dev/split.js.map +0 -1
  311. package/dev/switch.d.ts +0 -9
  312. package/dev/switch.d.ts.map +0 -1
  313. package/dev/switch.js +0 -5
  314. package/dev/switch.js.map +0 -1
  315. package/dev/text.d.ts +0 -9
  316. package/dev/text.d.ts.map +0 -1
  317. package/dev/text.js +0 -5
  318. package/dev/text.js.map +0 -1
  319. package/dev/time.d.ts +0 -9
  320. package/dev/time.d.ts.map +0 -1
  321. package/dev/time.js +0 -5
  322. package/dev/time.js.map +0 -1
  323. package/dev/tooltip.d.ts +0 -9
  324. package/dev/tooltip.d.ts.map +0 -1
  325. package/dev/tooltip.js +0 -5
  326. package/dev/tooltip.js.map +0 -1
  327. package/dev/typewriter.d.ts +0 -9
  328. package/dev/typewriter.d.ts.map +0 -1
  329. package/dev/typewriter.js +0 -5
  330. package/dev/typewriter.js.map +0 -1
@@ -1,240 +0,0 @@
1
- var Router_1;
2
- import { __decorate } from "tslib";
3
- import { RouteTree, godown, htmlSlot, omit, styles } from "@godown/element";
4
- import { css } from "lit";
5
- import { property, state } from "lit/decorators.js";
6
- import { GlobalStyle } from "../core/global-style.js";
7
- const routerTypes = {
8
- field: "field",
9
- slotted: "slotted",
10
- united: "united",
11
- };
12
- const protoName = "router";
13
- /**
14
- * {@linkcode Router} has basic routing control.
15
- *
16
- * To switch routes, use `router-link component`.
17
- *
18
- * It has two methods to collect routes.
19
- *
20
- * 1. From field `routes`, an array, each elements require "path".
21
- * 2. From child elements, which have the slot attribute for matching routes.
22
- *
23
- * If only the method 1 is used, set `type` to `"field"`.
24
- *
25
- * If only the method 2 is used, set `type` to `"slotted"`.
26
- *
27
- * `type` defaults to `"united"`, which will try method 1, then method 2.
28
- *
29
- * If no routes are matched, the default value (no named slot) will be rendered.
30
- *
31
- * @slot - Display slot when there is no match.
32
- * @slot * - Matching slot will be displayed.
33
- * @category navigation
34
- */
35
- let Router = Router_1 = class Router extends GlobalStyle {
36
- constructor() {
37
- super(...arguments);
38
- this.__fieldRouteTree = new RouteTree();
39
- this.__slottedRouteTree = new RouteTree();
40
- this.__cacheRecord = new Map();
41
- /**
42
- * Render result.
43
- */
44
- this.component = null;
45
- /**
46
- * Current pathname (equals to location.pathname).
47
- */
48
- this.pathname = location.pathname;
49
- /**
50
- * Rendered content when there is no match.
51
- */
52
- this.default = htmlSlot();
53
- /**
54
- * The type of routing sources.
55
- *
56
- * If field, it won't collect the slot attribute of the child elements.
57
- *
58
- * This property should not be changed after the rendering is complete.
59
- */
60
- this.type = routerTypes.united;
61
- /**
62
- * Cache accessed records.
63
- *
64
- * Emptied at each re-collection.
65
- */
66
- this.cache = false;
67
- this.handlePopstate = this.events.add(window, "popstate", () => {
68
- this.pathname = location.pathname;
69
- });
70
- }
71
- /**
72
- * Dynamic parameters record.
73
- */
74
- get params() {
75
- if (!this.path) {
76
- return {};
77
- }
78
- return RouteTree.parseParams(this.pathname, this.path);
79
- }
80
- set routes(value) {
81
- this.__routes = value;
82
- this.collectFieldRoutes(value);
83
- }
84
- get routes() {
85
- return this.__routes;
86
- }
87
- clear() {
88
- this.__cacheRecord.clear();
89
- }
90
- render() {
91
- let cached;
92
- if (this.cache && (cached = this.__cacheRecord.get(this.pathname))) {
93
- this.component = cached.component;
94
- this.path = cached.path;
95
- this.pathname = cached.pathname;
96
- }
97
- if (!cached) {
98
- switch (this.type) {
99
- case routerTypes.field:
100
- this.component = this.fieldComponent();
101
- break;
102
- case routerTypes.slotted:
103
- this.component = this.slottedComponent();
104
- break;
105
- default:
106
- this.component = this.fieldComponent() ?? this.slottedComponent();
107
- }
108
- }
109
- return this.component ?? this.default;
110
- }
111
- connectedCallback() {
112
- super.connectedCallback();
113
- Router_1.routerInstances.add(this);
114
- if (this.type !== "field") {
115
- this.observers.add(this, MutationObserver, this.collectSlottedRoutes, {
116
- attributes: true,
117
- attributeFilter: ["slot"],
118
- subtree: true,
119
- });
120
- this.collectSlottedRoutes();
121
- }
122
- }
123
- disconnectedCallback() {
124
- super.disconnectedCallback();
125
- Router_1.routerInstances.delete(this);
126
- }
127
- useRouter() {
128
- return {
129
- pathname: this.pathname,
130
- params: this.params,
131
- path: this.path,
132
- component: this.component,
133
- };
134
- }
135
- updated(changedProperties) {
136
- const shouldDispatch = changedProperties.has("pathname") || changedProperties.has("path");
137
- if (shouldDispatch) {
138
- const ur = this.useRouter();
139
- if (!this.__cacheRecord.has(this.pathname) && this.path) {
140
- this.__cacheRecord.set(this.pathname, ur);
141
- }
142
- this.dispatchEvent(new CustomEvent("change", { detail: ur }));
143
- }
144
- }
145
- /**
146
- * Get component from {@linkcode routes} by query.
147
- */
148
- fieldComponent(query) {
149
- query ||= this.__fieldRouteTree.search(this.pathname)?.pattern;
150
- this.path = query;
151
- if (!query) {
152
- return null;
153
- }
154
- const route = this.routes.find((r) => r.path === query);
155
- if (!route) {
156
- return null;
157
- }
158
- if ("render" in route) {
159
- return route.render?.(omit(this.useRouter(), "component")) || null;
160
- }
161
- return route.component;
162
- }
163
- /**
164
- * Get component from slotted elements by query.
165
- */
166
- slottedComponent(query) {
167
- const slottedPaths = this._slottedNames;
168
- query ||= this.__slottedRouteTree.search(this.pathname)?.pattern;
169
- this.path = query;
170
- if (!query) {
171
- return null;
172
- }
173
- this.path = slottedPaths.find((s) => s === query);
174
- if (!this.path) {
175
- return null;
176
- }
177
- return htmlSlot(this.path);
178
- }
179
- /**
180
- * Reset the route tree, clear cache, collect routes from child elements.
181
- */
182
- collectSlottedRoutes() {
183
- this.__slottedRouteTree = new RouteTree();
184
- this.clear();
185
- this._slottedNames.forEach((slotName) => {
186
- this.__slottedRouteTree.insert(slotName);
187
- });
188
- }
189
- /**
190
- * Reset the route tree, clear cache, collect routes from value.
191
- */
192
- collectFieldRoutes(value) {
193
- this.__fieldRouteTree = new RouteTree();
194
- this.clear();
195
- value.forEach(({ path }) => {
196
- this.__fieldRouteTree.insert(path);
197
- });
198
- }
199
- static updateAll() {
200
- this.routerInstances.forEach((i) => {
201
- i.handlePopstate();
202
- });
203
- }
204
- search(pathname) {
205
- return this.__fieldRouteTree.search(pathname) || this.__slottedRouteTree.search(pathname);
206
- }
207
- };
208
- Router.routerInstances = new Set();
209
- __decorate([
210
- state()
211
- ], Router.prototype, "component", void 0);
212
- __decorate([
213
- state()
214
- ], Router.prototype, "path", void 0);
215
- __decorate([
216
- property()
217
- ], Router.prototype, "pathname", void 0);
218
- __decorate([
219
- state()
220
- ], Router.prototype, "default", void 0);
221
- __decorate([
222
- property()
223
- ], Router.prototype, "type", void 0);
224
- __decorate([
225
- property({ type: Boolean })
226
- ], Router.prototype, "cache", void 0);
227
- __decorate([
228
- state()
229
- ], Router.prototype, "routes", null);
230
- Router = Router_1 = __decorate([
231
- godown(protoName),
232
- styles(css `
233
- :host {
234
- display: contents;
235
- }
236
- `)
237
- ], Router);
238
- export default Router;
239
- export { Router };
240
- //# sourceMappingURL=router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/components/router.ts"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CACd;AAGd;IADC,KAAK,EAAE;oCAIP;AAhEG,MAAM;IANX,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC,GAAG,CAAA;;;;CAIV,CAAC;GACI,MAAM,CAqNX;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,53 +0,0 @@
1
- import { type HandlerEvent } from "@godown/element";
2
- import { type TemplateResult } from "lit";
3
- import Input from "./input.js";
4
- import { type DirectionCardinalY } from "../core/direction.js";
5
- /**
6
- * {@linkcode Select} is similar to `<select>`.
7
- *
8
- * Elements with the value attribute/property can be used as options.
9
- *
10
- * The checked attribute will be added to the selected element.
11
- *
12
- * Multi-selected state looks the same as single-selected.
13
- *
14
- * Input will filter the element.
15
- *
16
- * @fires input - Fires when the input value changes.
17
- * @fires change - Fires when the input value changes.
18
- * @fires select - Fires when select an option.
19
- * @slot - Options.
20
- * @category input
21
- */
22
- declare class Select extends Input {
23
- value: string | string[];
24
- /**
25
- * Selected texts.
26
- */
27
- text: string;
28
- protected _content: HTMLElement;
29
- direction: DirectionCardinalY;
30
- multiple: boolean;
31
- visible: boolean;
32
- protected autoDirection: DirectionCardinalY;
33
- protected lastChecked: HTMLElement;
34
- protected defaultText: string;
35
- protected defaultChecked: HTMLElement[];
36
- private __store;
37
- get observedRecord(): Record<string, any>;
38
- protected render(): TemplateResult<1>;
39
- protected _handleFocus(): void;
40
- protected firstUpdated(): void;
41
- protected _connectedInit(): void;
42
- reset(): void;
43
- select(value: string, text?: string): 0 | 1;
44
- filter(query?: string): void;
45
- filterCallback(element: HTMLElement, match: boolean, query: string): void;
46
- protected _handleInput(e: HandlerEvent<HTMLInputElement>): void;
47
- focus(options?: FocusOptions): void;
48
- blur(): void;
49
- optionValue(option: HTMLElement): string;
50
- }
51
- export default Select;
52
- export { Select };
53
- //# sourceMappingURL=select.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.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AS,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAW/D,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAKnC,IAAI,IAAI,IAAI;IAMZ,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM;CAGzC;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,269 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { attr, godown, htmlSlot, part, styles } from "@godown/element";
3
- import svgCaretDown from "@godown/f7-icon/icons/chevron-down.js";
4
- import { css, html, nothing } from "lit";
5
- import { property, state } from "lit/decorators.js";
6
- import Input from "./input.js";
7
- import { cssGlobalVars } from "../core/global-style.js";
8
- import { directionOutsetPlace } from "../core/direction.js";
9
- function contain(a, b) {
10
- return a && b && a.toLowerCase().includes(b.toLowerCase());
11
- }
12
- function betweenAt(i, s, c) {
13
- const start = s.slice(0, i).lastIndexOf(c) + 1 || 0;
14
- const end = s.indexOf(c, i) || s.length;
15
- return s.slice(start, end);
16
- }
17
- function updateChecked(element, operation) {
18
- if (element) {
19
- const name = "checked";
20
- if (operation) {
21
- element.setAttribute(name, "");
22
- }
23
- else {
24
- element.removeAttribute(name);
25
- }
26
- }
27
- }
28
- const protoName = "select";
29
- /**
30
- * {@linkcode Select} is similar to `<select>`.
31
- *
32
- * Elements with the value attribute/property can be used as options.
33
- *
34
- * The checked attribute will be added to the selected element.
35
- *
36
- * Multi-selected state looks the same as single-selected.
37
- *
38
- * Input will filter the element.
39
- *
40
- * @fires input - Fires when the input value changes.
41
- * @fires change - Fires when the input value changes.
42
- * @fires select - Fires when select an option.
43
- * @slot - Options.
44
- * @category input
45
- */
46
- let Select = class Select extends Input {
47
- constructor() {
48
- super(...arguments);
49
- this.multiple = false;
50
- this.visible = false;
51
- this.autoDirection = "bottom";
52
- this.__store = [];
53
- }
54
- get observedRecord() {
55
- return {
56
- ...super.observedRecord,
57
- direction: this.direction || this.autoDirection,
58
- };
59
- }
60
- render() {
61
- return html `
62
- <div
63
- part="root"
64
- ${attr(this.observedRecord)}
65
- class="input-field"
66
- >
67
- ${[
68
- this._renderPrefix(),
69
- html `
70
- <input
71
- part="input"
72
- type="${this.type}"
73
- .value="${this.text}"
74
- ?autofocus="${this.autofocus}"
75
- ?disabled="${this.disabled}"
76
- autocapitalize="${this.autocapitalize || nothing}"
77
- autocomplete="${this.autocomplete || nothing}"
78
- placeholder="${this.placeholder || nothing}"
79
- id="${this.makeId}"
80
- @focus="${this._handleFocus}"
81
- @input="${this._handleInput}"
82
- />
83
- `,
84
- html `
85
- <label
86
- for="${this.makeId}"
87
- part="suffix"
88
- >
89
- <i part="icon">${svgCaretDown()}</i>
90
- </label>
91
- `,
92
- html `
93
- <label
94
- for="${this.makeId}"
95
- part="content"
96
- direction-outset-place
97
- >
98
- ${htmlSlot()}
99
- </label>
100
- `,
101
- ]}
102
- </div>
103
- `;
104
- }
105
- _handleFocus() {
106
- if (!this.direction) {
107
- const { top, bottom } = this.getBoundingClientRect();
108
- if (window.innerHeight - bottom < this._content.clientHeight && top > this._content.clientHeight) {
109
- this.autoDirection = "top";
110
- }
111
- else {
112
- this.autoDirection = "bottom";
113
- }
114
- }
115
- this.visible = true;
116
- }
117
- firstUpdated() {
118
- this.events.add(this._content, "click", (e) => {
119
- e.preventDefault();
120
- e.stopPropagation();
121
- const { target } = e;
122
- const value = this.optionValue(target);
123
- if (value) {
124
- const operation = this.select(value, target.textContent);
125
- if (!this.multiple) {
126
- updateChecked(this.lastChecked, 0);
127
- }
128
- updateChecked(target, operation);
129
- this.lastChecked = target;
130
- }
131
- this._input.focus();
132
- });
133
- this.events.add(document, "click", (e) => {
134
- // e.preventDefault();
135
- e.stopPropagation();
136
- const composed1 = e.composedPath()[0];
137
- if (composed1 && !this.shadowRoot.contains(composed1)) {
138
- this.blur();
139
- }
140
- });
141
- }
142
- _connectedInit() {
143
- if (!this.value) {
144
- const checked = [...this.querySelectorAll("[checked]")];
145
- const list = this.multiple ? checked : checked.length ? [(this.lastChecked = checked[0])] : [];
146
- list.forEach((element) => {
147
- const operation = this.select(this.optionValue(element), element.textContent);
148
- updateChecked(element, operation);
149
- });
150
- this.default = this.value;
151
- this.defaultText = this.text;
152
- this.defaultChecked = checked;
153
- }
154
- if (!this.text) {
155
- this.text = "";
156
- }
157
- }
158
- reset() {
159
- this.value = this.default;
160
- this.text = this.defaultText;
161
- this.querySelectorAll("[checked]").forEach((element) => updateChecked(element, 0));
162
- this.defaultChecked.forEach((element) => updateChecked(element, 1));
163
- }
164
- select(value, text) {
165
- text ||= value;
166
- let operation = 0;
167
- if (this.multiple) {
168
- const i = this.__store.findIndex((s) => s.value === value);
169
- if (i > -1) {
170
- this.__store.splice(i, 1);
171
- }
172
- else {
173
- this.__store.push({ value, text });
174
- operation = 1;
175
- }
176
- this.value = this.__store.map((s) => s.value);
177
- this.text = this.__store.map((s) => s.text).join(", ");
178
- }
179
- else {
180
- if (this.value === value) {
181
- this.value = "";
182
- this.text = "";
183
- }
184
- else {
185
- this.value = value;
186
- this.text = text;
187
- operation = 1;
188
- }
189
- }
190
- this.dispatchEvent(new CustomEvent("select", { detail: this.value, composed: true }));
191
- this.filter();
192
- return operation;
193
- }
194
- filter(query) {
195
- query = query?.trim();
196
- [...this.children].forEach((element) => {
197
- this.filterCallback(element, !query || contain(this.optionValue(element), query) || contain(element.textContent, query), query);
198
- });
199
- }
200
- filterCallback(element, match, query) {
201
- element.style.display = match ? "" : "none";
202
- }
203
- _handleInput(e) {
204
- e.stopPropagation();
205
- if (this.compositing) {
206
- return;
207
- }
208
- const s = this._input.value;
209
- this.filter(this.multiple ? betweenAt(this._input.selectionStart, s, ",") : s);
210
- this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
211
- this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
212
- }
213
- focus(options) {
214
- this._input.focus(options);
215
- this.visible = true;
216
- }
217
- blur() {
218
- this._input.blur();
219
- this.visible = false;
220
- super.blur();
221
- }
222
- optionValue(option) {
223
- return option.value || option.getAttribute("value") || "";
224
- }
225
- };
226
- __decorate([
227
- property()
228
- ], Select.prototype, "text", void 0);
229
- __decorate([
230
- part("content")
231
- ], Select.prototype, "_content", void 0);
232
- __decorate([
233
- property()
234
- ], Select.prototype, "direction", void 0);
235
- __decorate([
236
- property({ type: Boolean })
237
- ], Select.prototype, "multiple", void 0);
238
- __decorate([
239
- property({ type: Boolean })
240
- ], Select.prototype, "visible", void 0);
241
- __decorate([
242
- state()
243
- ], Select.prototype, "autoDirection", void 0);
244
- Select = __decorate([
245
- godown(protoName),
246
- styles(directionOutsetPlace, css `
247
- :host(:focus-within),
248
- .outline {
249
- ${cssGlobalVars.input}-outline-color: var(${cssGlobalVars.active});
250
- }
251
-
252
- [part="input"] {
253
- text-overflow: ellipsis;
254
- }
255
-
256
- [part="content"] {
257
- position: absolute;
258
- width: 100%;
259
- visibility: hidden;
260
- }
261
-
262
- [visible] [part="content"] {
263
- visibility: visible;
264
- }
265
- `)
266
- ], Select);
267
- export default Select;
268
- export { Select };
269
- //# sourceMappingURL=select.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/components/select.ts"],"names":[],"mappings":";AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,YAAY,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAuB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAA2B,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;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;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,KAAK,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAED,WAAW,CAAC,MAAmB;QAC7B,OAAQ,MAAc,CAAC,KAAK,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACrE,CAAC;CACF,CAAA;AA9MC;IADC,QAAQ,EAAE;oCACE;AAGH;IADT,IAAI,CAAC,SAAS,CAAC;wCACgB;AAGhC;IADC,QAAQ,EAAE;yCACmB;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACZ;AAGN;IADT,KAAK,EAAE;6CAC+C;AAvBnD,MAAM;IAxBX,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CACL,oBAAoB,EACpB,GAAG,CAAA;;;QAGG,aAAa,CAAC,KAAK,uBAAuB,aAAa,CAAC,MAAM;;;;;;;;;;;;;;;;GAgBnE,CACF;GACK,MAAM,CAsNX;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,28 +0,0 @@
1
- import { type TemplateResult } from "lit";
2
- import { GlobalStyle } from "../core/global-style.js";
3
- /**
4
- * {@linkcode Skeleton} renders a skeleton screen.
5
- *
6
- * @slot loading - The content if loading is true.
7
- * @slot - The content if loading is false.
8
- * @category feedback
9
- */
10
- declare class Skeleton extends GlobalStyle {
11
- /**
12
- * If "image", render a image placeholder.
13
- */
14
- type: "text" | "image";
15
- /**
16
- * Animation type.
17
- * opacity animation only effect on slotted element and image icon.
18
- */
19
- animation: "position" | "opacity";
20
- /**
21
- * If false, render slot only.
22
- */
23
- loading: boolean;
24
- protected render(): TemplateResult<1>;
25
- }
26
- export default Skeleton;
27
- export { Skeleton };
28
- //# sourceMappingURL=skeleton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../src/components/skeleton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAA8B,MAAM,yBAAyB,CAAC;AAKlF;;;;;;GAMG;AACH,cAkEM,QAAS,SAAQ,WAAW;IAChC;;OAEG;IAEH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvB;;;OAGG;IAEH,SAAS,EAAE,UAAU,GAAG,SAAS,CAAc;IAE/C;;OAEG;IAEH,OAAO,UAAQ;IAEf,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAatC;AAED,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC"}