godown 2.7.5 → 2.7.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 (463) hide show
  1. package/README.md +18 -45
  2. package/{.deps.d.ts → _deps.d.ts} +1 -2
  3. package/{.deps.d.ts.map → _deps.d.ts.map} +1 -1
  4. package/{.deps.js → _deps.js} +1 -2
  5. package/_deps.js.map +1 -0
  6. package/alert.d.ts +8 -1
  7. package/alert.d.ts.map +1 -1
  8. package/alert.js +4 -1
  9. package/alert.js.map +1 -1
  10. package/avatar-group.d.ts +8 -1
  11. package/avatar-group.d.ts.map +1 -1
  12. package/avatar-group.js +4 -1
  13. package/avatar-group.js.map +1 -1
  14. package/avatar.d.ts +8 -1
  15. package/avatar.d.ts.map +1 -1
  16. package/avatar.js +4 -1
  17. package/avatar.js.map +1 -1
  18. package/button.d.ts +8 -1
  19. package/button.d.ts.map +1 -1
  20. package/button.js +4 -1
  21. package/button.js.map +1 -1
  22. package/card.d.ts +8 -1
  23. package/card.d.ts.map +1 -1
  24. package/card.js +4 -1
  25. package/card.js.map +1 -1
  26. package/carousel.d.ts +8 -1
  27. package/carousel.d.ts.map +1 -1
  28. package/carousel.js +4 -1
  29. package/carousel.js.map +1 -1
  30. package/components.json +194 -0
  31. package/conf.d.ts +6 -75
  32. package/conf.d.ts.map +1 -1
  33. package/conf.js +8 -34
  34. package/conf.js.map +1 -1
  35. package/decorators/godown.d.ts +4 -0
  36. package/decorators/godown.d.ts.map +1 -0
  37. package/decorators/godown.js +9 -0
  38. package/decorators/godown.js.map +1 -0
  39. package/decorators/part.d.ts +7 -0
  40. package/decorators/part.d.ts.map +1 -0
  41. package/decorators/part.js +8 -0
  42. package/decorators/part.js.map +1 -0
  43. package/decorators/styles.d.ts +3 -0
  44. package/decorators/styles.d.ts.map +1 -0
  45. package/decorators/styles.js +8 -0
  46. package/decorators/styles.js.map +1 -0
  47. package/details.d.ts +8 -1
  48. package/details.d.ts.map +1 -1
  49. package/details.js +4 -1
  50. package/details.js.map +1 -1
  51. package/dialog.d.ts +8 -1
  52. package/dialog.d.ts.map +1 -1
  53. package/dialog.js +4 -1
  54. package/dialog.js.map +1 -1
  55. package/divider.d.ts +8 -1
  56. package/divider.d.ts.map +1 -1
  57. package/divider.js +4 -1
  58. package/divider.js.map +1 -1
  59. package/dragbox.d.ts +8 -1
  60. package/dragbox.d.ts.map +1 -1
  61. package/dragbox.js +4 -1
  62. package/dragbox.js.map +1 -1
  63. package/flex-flow.d.ts +8 -1
  64. package/flex-flow.d.ts.map +1 -1
  65. package/flex-flow.js +4 -1
  66. package/flex-flow.js.map +1 -1
  67. package/form.d.ts +8 -1
  68. package/form.d.ts.map +1 -1
  69. package/form.js +4 -1
  70. package/form.js.map +1 -1
  71. package/grid-flow.d.ts +9 -0
  72. package/grid-flow.d.ts.map +1 -0
  73. package/grid-flow.js +5 -0
  74. package/grid-flow.js.map +1 -0
  75. package/index.d.ts +32 -3
  76. package/index.d.ts.map +1 -1
  77. package/index.js +32 -3
  78. package/index.js.map +1 -1
  79. package/input.d.ts +8 -1
  80. package/input.d.ts.map +1 -1
  81. package/input.js +4 -1
  82. package/input.js.map +1 -1
  83. package/label-input.d.ts +8 -1
  84. package/label-input.d.ts.map +1 -1
  85. package/label-input.js +4 -1
  86. package/label-input.js.map +1 -1
  87. package/layout.d.ts +9 -0
  88. package/layout.d.ts.map +1 -0
  89. package/layout.js +5 -0
  90. package/layout.js.map +1 -0
  91. package/lib/css.d.ts +13 -0
  92. package/lib/css.d.ts.map +1 -0
  93. package/lib/css.js +29 -0
  94. package/lib/css.js.map +1 -0
  95. package/lib/directives.d.ts +16 -20
  96. package/lib/directives.d.ts.map +1 -1
  97. package/lib/directives.js +33 -31
  98. package/lib/directives.js.map +1 -1
  99. package/lib/event-coll.d.ts +13 -0
  100. package/lib/event-coll.d.ts.map +1 -0
  101. package/lib/event-coll.js +45 -0
  102. package/lib/event-coll.js.map +1 -0
  103. package/lib/{templates.d.ts → icons.d.ts} +1 -17
  104. package/lib/icons.d.ts.map +1 -0
  105. package/lib/icons.js +73 -0
  106. package/lib/icons.js.map +1 -0
  107. package/lib/jsx.d.ts +4 -0
  108. package/lib/jsx.d.ts.map +1 -0
  109. package/lib/jsx.js +52 -0
  110. package/lib/jsx.js.map +1 -0
  111. package/lib/route-tree.d.ts +5 -5
  112. package/lib/route-tree.js +5 -5
  113. package/lib/route-tree.js.map +1 -1
  114. package/lib/utils.d.ts +6 -46
  115. package/lib/utils.d.ts.map +1 -1
  116. package/lib/utils.js +25 -110
  117. package/lib/utils.js.map +1 -1
  118. package/link.d.ts +9 -0
  119. package/link.d.ts.map +1 -0
  120. package/link.js +5 -0
  121. package/link.js.map +1 -0
  122. package/overbreath.d.ts +8 -1
  123. package/overbreath.d.ts.map +1 -1
  124. package/overbreath.js +4 -1
  125. package/overbreath.js.map +1 -1
  126. package/package.json +18 -23
  127. package/progress.d.ts +8 -1
  128. package/progress.d.ts.map +1 -1
  129. package/progress.js +4 -1
  130. package/progress.js.map +1 -1
  131. package/proto/godown-config.d.ts +41 -0
  132. package/proto/godown-config.d.ts.map +1 -0
  133. package/proto/godown-config.js +27 -0
  134. package/proto/godown-config.js.map +1 -0
  135. package/{godown-element.d.ts → proto/godown-element.d.ts} +48 -16
  136. package/proto/godown-element.d.ts.map +1 -0
  137. package/{godown-element.js → proto/godown-element.js} +82 -26
  138. package/proto/godown-element.js.map +1 -0
  139. package/proto/super-a.d.ts +30 -0
  140. package/proto/super-a.d.ts.map +1 -0
  141. package/proto/super-a.js +141 -0
  142. package/proto/super-a.js.map +1 -0
  143. package/proto/super-input.d.ts +44 -0
  144. package/proto/super-input.d.ts.map +1 -0
  145. package/proto/super-input.js +119 -0
  146. package/proto/super-input.js.map +1 -0
  147. package/proto/super-openable.d.ts +23 -0
  148. package/proto/super-openable.d.ts.map +1 -0
  149. package/proto/super-openable.js +43 -0
  150. package/proto/super-openable.js.map +1 -0
  151. package/range-input.d.ts +9 -0
  152. package/range-input.d.ts.map +1 -0
  153. package/range-input.js +5 -0
  154. package/range-input.js.map +1 -0
  155. package/react/create.d.ts.map +1 -1
  156. package/react/create.js +4 -1
  157. package/react/create.js.map +1 -1
  158. package/react/index.d.ts +64 -34
  159. package/react/index.d.ts.map +1 -1
  160. package/react/index.js +78 -51
  161. package/react/index.js.map +1 -1
  162. package/rotate.d.ts +9 -0
  163. package/rotate.d.ts.map +1 -0
  164. package/rotate.js +5 -0
  165. package/rotate.js.map +1 -0
  166. package/router-link.d.ts +9 -0
  167. package/router-link.d.ts.map +1 -0
  168. package/router-link.js +5 -0
  169. package/router-link.js.map +1 -0
  170. package/router.d.ts +8 -1
  171. package/router.d.ts.map +1 -1
  172. package/router.js +4 -1
  173. package/router.js.map +1 -1
  174. package/search-input.d.ts +8 -1
  175. package/search-input.d.ts.map +1 -1
  176. package/search-input.js +4 -1
  177. package/search-input.js.map +1 -1
  178. package/select-input.d.ts +8 -1
  179. package/select-input.d.ts.map +1 -1
  180. package/select-input.js +4 -1
  181. package/select-input.js.map +1 -1
  182. package/skeleton.d.ts +8 -1
  183. package/skeleton.d.ts.map +1 -1
  184. package/skeleton.js +4 -1
  185. package/skeleton.js.map +1 -1
  186. package/split-input.d.ts +8 -1
  187. package/split-input.d.ts.map +1 -1
  188. package/split-input.js +4 -1
  189. package/split-input.js.map +1 -1
  190. package/styles/colors/presets.d.ts +13 -0
  191. package/styles/colors/presets.d.ts.map +1 -0
  192. package/styles/colors/presets.js +6 -0
  193. package/styles/colors/presets.js.map +1 -0
  194. package/styles/colors/presetsRGB.d.ts +16 -0
  195. package/styles/colors/presetsRGB.d.ts.map +1 -0
  196. package/styles/colors/presetsRGB.js +134 -0
  197. package/styles/colors/presetsRGB.js.map +1 -0
  198. package/styles/global.d.ts +18 -0
  199. package/styles/global.d.ts.map +1 -0
  200. package/styles/global.js +78 -0
  201. package/styles/global.js.map +1 -0
  202. package/styles/inputStyle.d.ts +3 -0
  203. package/styles/inputStyle.d.ts.map +1 -0
  204. package/styles/inputStyle.js +59 -0
  205. package/styles/inputStyle.js.map +1 -0
  206. package/switch-input.d.ts +8 -1
  207. package/switch-input.d.ts.map +1 -1
  208. package/switch-input.js +4 -1
  209. package/switch-input.js.map +1 -1
  210. package/text.d.ts +8 -1
  211. package/text.d.ts.map +1 -1
  212. package/text.js +4 -1
  213. package/text.js.map +1 -1
  214. package/time.d.ts +8 -1
  215. package/time.d.ts.map +1 -1
  216. package/time.js +4 -1
  217. package/time.js.map +1 -1
  218. package/tooltip.d.ts +8 -1
  219. package/tooltip.d.ts.map +1 -1
  220. package/tooltip.js +4 -1
  221. package/tooltip.js.map +1 -1
  222. package/typewriter.d.ts +8 -1
  223. package/typewriter.d.ts.map +1 -1
  224. package/typewriter.js +4 -1
  225. package/typewriter.js.map +1 -1
  226. package/web-components/alert/alert.d.ts +2 -10
  227. package/web-components/alert/alert.d.ts.map +1 -1
  228. package/web-components/alert/alert.js +93 -91
  229. package/web-components/alert/alert.js.map +1 -1
  230. package/web-components/avatar/avatar-group.d.ts +21 -0
  231. package/web-components/avatar/avatar-group.d.ts.map +1 -0
  232. package/web-components/avatar/avatar-group.js +86 -0
  233. package/web-components/avatar/avatar-group.js.map +1 -0
  234. package/web-components/avatar/avatar.d.ts +5 -18
  235. package/web-components/avatar/avatar.d.ts.map +1 -1
  236. package/web-components/avatar/avatar.js +70 -85
  237. package/web-components/avatar/avatar.js.map +1 -1
  238. package/web-components/button/button.d.ts +10 -43
  239. package/web-components/button/button.d.ts.map +1 -1
  240. package/web-components/button/button.js +183 -226
  241. package/web-components/button/button.js.map +1 -1
  242. package/web-components/card/card.d.ts +2 -27
  243. package/web-components/card/card.d.ts.map +1 -1
  244. package/web-components/card/card.js +57 -132
  245. package/web-components/card/card.js.map +1 -1
  246. package/web-components/carousel/carousel.d.ts +5 -16
  247. package/web-components/carousel/carousel.d.ts.map +1 -1
  248. package/web-components/carousel/carousel.js +102 -106
  249. package/web-components/carousel/carousel.js.map +1 -1
  250. package/web-components/details/details.d.ts +4 -15
  251. package/web-components/details/details.d.ts.map +1 -1
  252. package/web-components/details/details.js +91 -97
  253. package/web-components/details/details.js.map +1 -1
  254. package/web-components/dialog/dialog.d.ts +6 -17
  255. package/web-components/dialog/dialog.d.ts.map +1 -1
  256. package/web-components/dialog/dialog.js +87 -137
  257. package/web-components/dialog/dialog.js.map +1 -1
  258. package/web-components/divider/divider.d.ts +13 -0
  259. package/web-components/divider/divider.d.ts.map +1 -0
  260. package/web-components/divider/divider.js +95 -0
  261. package/web-components/divider/divider.js.map +1 -0
  262. package/web-components/form/form.d.ts +15 -22
  263. package/web-components/form/form.d.ts.map +1 -1
  264. package/web-components/form/form.js +47 -117
  265. package/web-components/form/form.js.map +1 -1
  266. package/web-components/input/input.d.ts +5 -18
  267. package/web-components/input/input.d.ts.map +1 -1
  268. package/web-components/input/input.js +74 -169
  269. package/web-components/input/input.js.map +1 -1
  270. package/web-components/input/label-input.d.ts +5 -19
  271. package/web-components/input/label-input.d.ts.map +1 -1
  272. package/web-components/input/label-input.js +74 -141
  273. package/web-components/input/label-input.js.map +1 -1
  274. package/web-components/input/range-input.d.ts +53 -0
  275. package/web-components/input/range-input.d.ts.map +1 -0
  276. package/web-components/input/range-input.js +316 -0
  277. package/web-components/input/range-input.js.map +1 -0
  278. package/web-components/input/search-input.d.ts +4 -12
  279. package/web-components/input/search-input.d.ts.map +1 -1
  280. package/web-components/input/search-input.js +118 -113
  281. package/web-components/input/search-input.js.map +1 -1
  282. package/web-components/input/select-input.d.ts +17 -32
  283. package/web-components/input/select-input.d.ts.map +1 -1
  284. package/web-components/input/select-input.js +154 -286
  285. package/web-components/input/select-input.js.map +1 -1
  286. package/web-components/input/split-input.d.ts +8 -15
  287. package/web-components/input/split-input.d.ts.map +1 -1
  288. package/web-components/input/split-input.js +82 -72
  289. package/web-components/input/split-input.js.map +1 -1
  290. package/web-components/input/switch-input.d.ts +8 -17
  291. package/web-components/input/switch-input.d.ts.map +1 -1
  292. package/web-components/input/switch-input.js +122 -158
  293. package/web-components/input/switch-input.js.map +1 -1
  294. package/web-components/layout/flex-flow.d.ts +11 -19
  295. package/web-components/layout/flex-flow.d.ts.map +1 -1
  296. package/web-components/layout/flex-flow.js +57 -35
  297. package/web-components/layout/flex-flow.js.map +1 -1
  298. package/web-components/layout/grid-flow.d.ts +14 -0
  299. package/web-components/layout/grid-flow.d.ts.map +1 -0
  300. package/web-components/layout/grid-flow.js +56 -0
  301. package/web-components/layout/grid-flow.js.map +1 -0
  302. package/web-components/layout/layout.d.ts +18 -0
  303. package/web-components/layout/layout.d.ts.map +1 -0
  304. package/web-components/layout/layout.js +76 -0
  305. package/web-components/layout/layout.js.map +1 -0
  306. package/web-components/link/link.d.ts +10 -0
  307. package/web-components/link/link.d.ts.map +1 -0
  308. package/web-components/link/link.js +17 -0
  309. package/web-components/link/link.js.map +1 -0
  310. package/web-components/link/router-link.d.ts +19 -0
  311. package/web-components/link/router-link.d.ts.map +1 -0
  312. package/web-components/link/router-link.js +60 -0
  313. package/web-components/link/router-link.js.map +1 -0
  314. package/web-components/progress/progress.d.ts +2 -12
  315. package/web-components/progress/progress.d.ts.map +1 -1
  316. package/web-components/progress/progress.js +52 -48
  317. package/web-components/progress/progress.js.map +1 -1
  318. package/web-components/router/router.d.ts +15 -21
  319. package/web-components/router/router.d.ts.map +1 -1
  320. package/web-components/router/router.js +35 -37
  321. package/web-components/router/router.js.map +1 -1
  322. package/web-components/skeleton/skeleton.d.ts +5 -12
  323. package/web-components/skeleton/skeleton.d.ts.map +1 -1
  324. package/web-components/skeleton/skeleton.js +90 -98
  325. package/web-components/skeleton/skeleton.js.map +1 -1
  326. package/web-components/text/overbreath.d.ts +15 -20
  327. package/web-components/text/overbreath.d.ts.map +1 -1
  328. package/web-components/text/overbreath.js +108 -202
  329. package/web-components/text/overbreath.js.map +1 -1
  330. package/web-components/text/text.d.ts +5 -18
  331. package/web-components/text/text.d.ts.map +1 -1
  332. package/web-components/text/text.js +70 -80
  333. package/web-components/text/text.js.map +1 -1
  334. package/web-components/text/time.d.ts +5 -14
  335. package/web-components/text/time.d.ts.map +1 -1
  336. package/web-components/text/time.js +32 -31
  337. package/web-components/text/time.js.map +1 -1
  338. package/web-components/text/typewriter.d.ts +3 -11
  339. package/web-components/text/typewriter.d.ts.map +1 -1
  340. package/web-components/text/typewriter.js +42 -40
  341. package/web-components/text/typewriter.js.map +1 -1
  342. package/web-components/tooltip/tooltip.d.ts +21 -17
  343. package/web-components/tooltip/tooltip.d.ts.map +1 -1
  344. package/web-components/tooltip/tooltip.js +98 -60
  345. package/web-components/tooltip/tooltip.js.map +1 -1
  346. package/web-components/wrapper/dragbox.d.ts +5 -10
  347. package/web-components/wrapper/dragbox.d.ts.map +1 -1
  348. package/web-components/wrapper/dragbox.js +40 -31
  349. package/web-components/wrapper/dragbox.js.map +1 -1
  350. package/web-components/wrapper/rotate.d.ts +30 -0
  351. package/web-components/wrapper/rotate.d.ts.map +1 -0
  352. package/web-components/wrapper/rotate.js +92 -0
  353. package/web-components/wrapper/rotate.js.map +1 -0
  354. package/.deps.js.map +0 -1
  355. package/a.d.ts +0 -2
  356. package/a.d.ts.map +0 -1
  357. package/a.js +0 -2
  358. package/a.js.map +0 -1
  359. package/clip.d.ts +0 -2
  360. package/clip.d.ts.map +0 -1
  361. package/clip.js +0 -2
  362. package/clip.js.map +0 -1
  363. package/decorators/define.d.ts +0 -7
  364. package/decorators/define.d.ts.map +0 -1
  365. package/decorators/define.js +0 -11
  366. package/decorators/define.js.map +0 -1
  367. package/details-group.d.ts +0 -2
  368. package/details-group.d.ts.map +0 -1
  369. package/details-group.js +0 -2
  370. package/details-group.js.map +0 -1
  371. package/godown-element.d.ts.map +0 -1
  372. package/godown-element.js.map +0 -1
  373. package/lib/event-collection.d.ts +0 -14
  374. package/lib/event-collection.d.ts.map +0 -1
  375. package/lib/event-collection.js +0 -71
  376. package/lib/event-collection.js.map +0 -1
  377. package/lib/templates.d.ts.map +0 -1
  378. package/lib/templates.js +0 -76
  379. package/lib/templates.js.map +0 -1
  380. package/naming.d.ts +0 -91
  381. package/naming.d.ts.map +0 -1
  382. package/naming.js +0 -67
  383. package/naming.js.map +0 -1
  384. package/nav-layout.d.ts +0 -2
  385. package/nav-layout.d.ts.map +0 -1
  386. package/nav-layout.js +0 -2
  387. package/nav-layout.js.map +0 -1
  388. package/open-offset.d.ts +0 -2
  389. package/open-offset.d.ts.map +0 -1
  390. package/open-offset.js +0 -2
  391. package/open-offset.js.map +0 -1
  392. package/router-a.d.ts +0 -2
  393. package/router-a.d.ts.map +0 -1
  394. package/router-a.js +0 -2
  395. package/router-a.js.map +0 -1
  396. package/supers/anchor.d.ts +0 -26
  397. package/supers/anchor.d.ts.map +0 -1
  398. package/supers/anchor.js +0 -124
  399. package/supers/anchor.js.map +0 -1
  400. package/supers/input.d.ts +0 -28
  401. package/supers/input.d.ts.map +0 -1
  402. package/supers/input.js +0 -117
  403. package/supers/input.js.map +0 -1
  404. package/supers/openable.d.ts +0 -38
  405. package/supers/openable.d.ts.map +0 -1
  406. package/supers/openable.js +0 -77
  407. package/supers/openable.js.map +0 -1
  408. package/supers/root.d.ts +0 -18
  409. package/supers/root.d.ts.map +0 -1
  410. package/supers/root.js +0 -76
  411. package/supers/root.js.map +0 -1
  412. package/tabs.d.ts +0 -2
  413. package/tabs.d.ts.map +0 -1
  414. package/tabs.js +0 -2
  415. package/tabs.js.map +0 -1
  416. package/web-components/a/a.d.ts +0 -16
  417. package/web-components/a/a.d.ts.map +0 -1
  418. package/web-components/a/a.js +0 -17
  419. package/web-components/a/a.js.map +0 -1
  420. package/web-components/group/avatar-group.d.ts +0 -29
  421. package/web-components/group/avatar-group.d.ts.map +0 -1
  422. package/web-components/group/avatar-group.js +0 -88
  423. package/web-components/group/avatar-group.js.map +0 -1
  424. package/web-components/group/details-group.d.ts +0 -28
  425. package/web-components/group/details-group.d.ts.map +0 -1
  426. package/web-components/group/details-group.js +0 -59
  427. package/web-components/group/details-group.js.map +0 -1
  428. package/web-components/index.d.ts +0 -35
  429. package/web-components/index.d.ts.map +0 -1
  430. package/web-components/index.js +0 -35
  431. package/web-components/index.js.map +0 -1
  432. package/web-components/layout/divider.d.ts +0 -22
  433. package/web-components/layout/divider.d.ts.map +0 -1
  434. package/web-components/layout/divider.js +0 -85
  435. package/web-components/layout/divider.js.map +0 -1
  436. package/web-components/layout/nav-layout.d.ts +0 -38
  437. package/web-components/layout/nav-layout.d.ts.map +0 -1
  438. package/web-components/layout/nav-layout.js +0 -69
  439. package/web-components/layout/nav-layout.js.map +0 -1
  440. package/web-components/offset/open-offset.d.ts +0 -27
  441. package/web-components/offset/open-offset.d.ts.map +0 -1
  442. package/web-components/offset/open-offset.js +0 -130
  443. package/web-components/offset/open-offset.js.map +0 -1
  444. package/web-components/router/router-a.d.ts +0 -25
  445. package/web-components/router/router-a.d.ts.map +0 -1
  446. package/web-components/router/router-a.js +0 -70
  447. package/web-components/router/router-a.js.map +0 -1
  448. package/web-components/tabs/tabs.d.ts +0 -52
  449. package/web-components/tabs/tabs.d.ts.map +0 -1
  450. package/web-components/tabs/tabs.js +0 -165
  451. package/web-components/tabs/tabs.js.map +0 -1
  452. package/web-components/text/clip.d.ts +0 -22
  453. package/web-components/text/clip.d.ts.map +0 -1
  454. package/web-components/text/clip.js +0 -45
  455. package/web-components/text/clip.js.map +0 -1
  456. package/web-components/wrapper/wrapper.d.ts +0 -27
  457. package/web-components/wrapper/wrapper.d.ts.map +0 -1
  458. package/web-components/wrapper/wrapper.js +0 -95
  459. package/web-components/wrapper/wrapper.js.map +0 -1
  460. package/wrapper.d.ts +0 -2
  461. package/wrapper.d.ts.map +0 -1
  462. package/wrapper.js +0 -2
  463. package/wrapper.js.map +0 -1
@@ -1,13 +1,19 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, property, query } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { ifValue } from "../../lib/directives.js";
5
- import { htmlSlot, svgDelta, svgX } from "../../lib/templates.js";
6
- import { GodownInput } from "../../supers/input.js";
7
- import { cssvarValues, GodownElement } from "../../supers/root.js";
8
- const defineName = "select-input";
2
+ import { css, html, property } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { styles } from "../../decorators/styles.js";
5
+ import { htmlSlot } from "../../lib/directives.js";
6
+ import { svgDelta, svgX } from "../../lib/icons.js";
7
+ import GodownInput from "../../proto/super-input.js";
8
+ import { cssGlobalVars } from "../../styles/global.js";
9
+ import { fieldStyle, inputStyle } from "../../styles/inputStyle.js";
10
+ const protoName = "select-input";
9
11
  /**
10
12
  * {@linkcode SelectInput} select matched elements.
13
+ *
14
+ * This will not support multi-selection operations.
15
+ *
16
+ * @slot - Options.
11
17
  */
12
18
  let SelectInput = class SelectInput extends GodownInput {
13
19
  constructor() {
@@ -16,327 +22,189 @@ let SelectInput = class SelectInput extends GodownInput {
16
22
  * Open content.
17
23
  */
18
24
  this.open = false;
19
- /**
20
- * Only a single option is allowed.
21
- */
22
- this.only = false;
23
- /**
24
- * Selected values.
25
- */
26
- this.value = [];
27
- /**
28
- * Input name.
29
- */
30
- this.name = "select";
31
- /**
32
- * Selected texts.
33
- */
34
- this.text = [];
35
- }
36
- get assigned() {
37
- return super.assigned;
38
25
  }
39
26
  render() {
40
- return html ` <div>
41
- <section>${this.renderList()}</section>
27
+ return html `<div part="root" class="input-field">
28
+ <section part="selected">
29
+ ${this.value &&
30
+ html `<div class="selected-item">
31
+ ${this.value}
32
+ <i
33
+ @click="${() => {
34
+ this.value = "";
35
+ }}"
36
+ >${svgX()}</i
37
+ >
38
+ </div>`}
39
+ </section>
42
40
  <input
41
+ part="input"
43
42
  ?autofocus="${this.autofocus}"
44
- id="input"
43
+ id="${this.makeId}"
45
44
  @focus="${() => {
46
45
  this.open = true;
47
46
  }}"
48
47
  @input="${this._handleInput}"
49
- placeholder="${this.pla}"
48
+ placeholder="${this.placeholder}"
50
49
  />
51
- <label for="input"> ${ifValue(this.children.length > 0, svgDelta())}</label>
52
- <aside ?open="${this.open}">${htmlSlot()}</aside>
50
+ <label for="${this.makeId}"> <i>${svgDelta()}</i></label>
51
+ <div class="content" part="slot">${htmlSlot()}</div>
53
52
  </div>`;
54
53
  }
55
- renderList() {
56
- const itemTemplates = [];
57
- if (this.value.length) {
58
- for (const i in this.value) {
59
- itemTemplates.push(html `<i class="selected-item">
60
- ${this.text[i] || this.value[i]}
61
- <div
62
- @click="${() => {
63
- this.select(this.value[i]);
64
- }}"
65
- >
66
- ${svgX()}
67
- </div>
68
- </i>`);
69
- }
70
- }
71
- return itemTemplates;
72
- }
73
- _focusCheck() {
74
- if (this.autofocus) {
75
- this._input?.focus();
76
- this.open = true;
77
- }
78
- }
79
- focus(options) {
80
- this._input?.focus(options);
81
- this.open = true;
82
- }
83
- connectedCallback() {
84
- GodownElement.prototype.connectedCallback.call(this);
85
- }
86
- getOptionValue(option) {
87
- return option.value || option.getAttribute("value");
88
- }
89
54
  firstUpdated() {
90
- const defs = this.def.split(";");
91
- defs
92
- .filter((i) => i.trim())
93
- .forEach((i) => {
94
- this.select(i);
95
- });
96
- this._focusCheck();
97
- const CLICK = "click";
98
- this.assigned.forEach((option) => {
99
- if (this.getOptionValue(option)) {
100
- this.addEvent(option, CLICK, () => {
101
- this.select(this.getOptionValue(option), option.textContent);
102
- });
103
- }
104
- else if (option.children) {
105
- [...option.children].forEach((option) => {
106
- this.addEvent(option, CLICK, () => {
107
- this.select(this.getOptionValue(option), option.textContent);
108
- });
109
- });
110
- }
111
- });
112
- this.addEvent(this, "change", () => {
113
- this.open = !this.only;
114
- });
115
- this.addEvent(document, CLICK, (e) => {
55
+ super.firstUpdated();
56
+ this.addEvent(document, "click", (e) => {
57
+ const target = e.target;
116
58
  if (!this.contains(e.target)) {
117
59
  this.open = false;
118
60
  }
61
+ else if (target !== this) {
62
+ const value = this.getOptionValue(target);
63
+ if (value) {
64
+ this.select(value, target.textContent);
65
+ }
66
+ }
119
67
  });
120
68
  }
121
69
  select(value, text) {
122
- if (text === undefined || text === null) {
123
- this.assigned.some((option) => {
124
- const optionValue = this.getOptionValue(option);
125
- if (optionValue) {
126
- if (optionValue === value) {
127
- text = option.textContent;
128
- return true;
129
- }
130
- }
131
- else if (option.children) {
132
- return [...option.children].some((subOption) => {
133
- const subOptionValue = this.getOptionValue(subOption);
134
- if (subOptionValue === value) {
135
- text = subOption.textContent;
136
- return true;
137
- }
138
- return false;
139
- });
140
- }
141
- return false;
142
- });
143
- }
144
- if (this.value.includes(value)) {
145
- if (!this.only) {
146
- this.value = this.value.filter((v) => v !== value);
147
- this.text = this.text.filter((v) => v !== text);
148
- }
149
- else {
150
- this.value = [];
151
- this.text = [];
152
- }
153
- }
154
- else {
155
- if (!this.only) {
156
- this.value.push(value);
157
- this.text.push(text);
158
- }
159
- else {
160
- this.value = [value];
161
- this.text = [text];
162
- }
163
- }
70
+ this.value = value;
71
+ this.text = text || value;
164
72
  this._input.value = "";
73
+ this.filter();
165
74
  this.dispatchEvent(new CustomEvent("change", { detail: this.namevalue() }));
166
- this.requestUpdate();
167
75
  }
168
- _handleInput() {
169
- const BLOCK = "block";
170
- const NONE = "none";
171
- let value = this._input.value.trim();
172
- if (!this.only && value.includes(";")) {
173
- value = value.split(";").pop().trim();
174
- }
175
- this.assigned.forEach((option) => {
176
- if (this.getOptionValue(option)) {
177
- option.style.display = BLOCK;
76
+ filter(value) {
77
+ this.querySelectorAll("*").forEach((option) => {
78
+ const { style } = option;
79
+ if (!value) {
80
+ style.display = null;
81
+ return;
178
82
  }
179
- if (option.children) {
180
- option.style.display = BLOCK;
181
- [...option.children].forEach((subOption) => {
182
- subOption.style.display = BLOCK;
183
- });
83
+ const optionValue = this.getOptionValue(option);
84
+ if (includesIgnoreCase(optionValue, value) || includesIgnoreCase(option.textContent, value)) {
85
+ style.display = null;
86
+ }
87
+ else {
88
+ style.display = "none";
184
89
  }
185
90
  });
186
- if (value) {
187
- this.assigned.forEach((option) => {
188
- const optionValue = this.getOptionValue(option);
189
- if (optionValue) {
190
- const isMatch = includesIgnoreCase(optionValue, value) || includesIgnoreCase(option.innerText, value);
191
- option.style.display = isMatch ? BLOCK : NONE;
192
- }
193
- else if (option.children) {
194
- [...option.children].forEach((subOption) => {
195
- const subOptionValue = this.getOptionValue(subOption);
196
- const isSubMatch = includesIgnoreCase(subOptionValue, value) || includesIgnoreCase(subOption.innerText, value);
197
- subOption.style.display = isSubMatch ? BLOCK : NONE;
198
- });
199
- if ([...option.children].filter((option) => option.style.display === BLOCK).length === 0) {
200
- option.style.display = NONE;
201
- }
202
- }
203
- });
91
+ }
92
+ reset() {
93
+ if (this.default) {
94
+ this.select(this.default, this.defaultText || this.default);
204
95
  }
96
+ }
97
+ _handleInput() {
98
+ this.filter(this._input.value.trim());
205
99
  this.dispatchEvent(new CustomEvent("input", { detail: this.namevalue() }));
206
100
  }
207
- namevalue() {
208
- return [this.name, this.only ? this.value[0] : this.value];
101
+ focus(options) {
102
+ this._input?.focus(options);
103
+ this.open = true;
209
104
  }
210
- reset() {
211
- this.value = [];
212
- this.text = [];
213
- this._input.value = "";
214
- if (this.def) {
215
- const defs = this.def.split(";");
216
- const defToSelect = this.only ? [defs[0]] : defs;
217
- defToSelect
218
- .filter((def) => def.trim())
219
- .forEach((def) => {
220
- this.select(def.trim(), null);
221
- });
222
- }
105
+ getOptionValue(option) {
106
+ return option.value || option.getAttribute("value") || "";
223
107
  }
224
108
  };
225
- SelectInput.styles = [
226
- GodownInput.styles,
227
- css `
228
- :host {
229
- background: var(${cssvarValues.input}--background);
230
- margin: var(${cssvarValues.input}--outline-width);
231
- outline: var(${cssvarValues.input}--outline-width) solid transparent;
232
- height: var(${cssvarValues.input}--height);
233
- width: var(${cssvarValues.input}--width);
234
- border-radius: var(${cssvarValues.input}--radius);
235
- }
236
-
237
- :host([open]) {
238
- outline-color: var(${cssvarValues.input}--outline-color);
239
- }
240
-
241
- input {
242
- padding: 0 0 0 0.25em;
243
- background: none;
244
- cursor: inherit;
245
- height: 100%;
246
- width: 100%;
247
- box-sizing: border-box;
248
- border: inherit;
249
- outline: none;
250
- border-radius: inherit;
251
- flex: 1;
252
- }
253
-
254
- div {
255
- display: inline-flex;
256
- position: relative;
257
- width: 100%;
258
- border-radius: inherit;
259
- z-index: inherit;
260
- }
261
-
262
- label svg {
263
- height: 100%;
264
- }
265
-
266
- aside {
267
- margin-top: 1px;
268
- position: absolute;
269
- top: 100%;
270
- width: 100%;
271
- visibility: hidden;
272
- z-index: 1;
273
- border-radius: inherit;
274
- }
275
-
276
- section {
277
- max-width: calc(100% - 1.2em);
278
- height: 100%;
279
- overflow: hidden;
280
- pointer-events: none;
281
- border-radius: inherit;
282
- z-index: inherit;
283
- }
284
-
285
- i.selected-item {
286
- background: var(${cssvarValues.input}--true);
287
- border-radius: inherit;
288
- height: 100%;
289
- float: left;
290
- display: inline-flex;
291
- font-style: normal;
292
- align-items: center;
293
- padding-left: 0.1em;
294
- margin-left: 0.065em;
295
- }
296
-
297
- i:first-child {
298
- margin-left: 0;
299
- }
300
-
301
- i.selected-item svg {
302
- width: 1em;
303
- padding: 0 0.12em;
304
- height: 0.8em;
305
- pointer-events: all;
306
- }
307
-
308
- aside[open] {
309
- visibility: visible;
310
- }
311
- `,
312
- ];
313
109
  __decorate([
314
110
  property({ type: Boolean, reflect: true })
315
111
  ], SelectInput.prototype, "open", void 0);
316
- __decorate([
317
- property({ type: Boolean, reflect: true })
318
- ], SelectInput.prototype, "only", void 0);
319
- __decorate([
320
- property({ type: Array })
321
- ], SelectInput.prototype, "value", void 0);
322
112
  __decorate([
323
113
  property()
324
- ], SelectInput.prototype, "name", void 0);
325
- __decorate([
326
- property({ type: Array })
327
114
  ], SelectInput.prototype, "text", void 0);
328
115
  __decorate([
329
- query("input")
330
- ], SelectInput.prototype, "_input", void 0);
331
- __decorate([
332
- query("aside")
333
- ], SelectInput.prototype, "_aside", void 0);
116
+ property({
117
+ attribute: "default-text",
118
+ })
119
+ ], SelectInput.prototype, "defaultText", void 0);
334
120
  SelectInput = __decorate([
335
- define(defineName)
121
+ godown(protoName),
122
+ styles([
123
+ inputStyle,
124
+ fieldStyle,
125
+ css `
126
+ :host {
127
+ background: var(--${cssGlobalVars.input}--background);
128
+ margin: var(--${cssGlobalVars.input}--outline-width);
129
+ outline: var(--${cssGlobalVars.input}--outline-width) solid transparent;
130
+ border-radius: var(--${cssGlobalVars.input}--radius);
131
+ height: var(--${cssGlobalVars.input}--height);
132
+ width: var(--${cssGlobalVars.input}--width);
133
+ display: block;
134
+ }
135
+
136
+ :host([open]) {
137
+ outline-color: var(--${cssGlobalVars.input}--outline-color);
138
+ }
139
+
140
+ input {
141
+ flex: 1;
142
+ width: 100%;
143
+ height: 100%;
144
+ cursor: inherit;
145
+ border: inherit;
146
+ background: none;
147
+ padding: 0 0 0 0.25em;
148
+ box-sizing: border-box;
149
+ border-radius: inherit;
150
+ }
151
+
152
+ section {
153
+ height: 100%;
154
+ overflow: hidden;
155
+ z-index: inherit;
156
+ border-radius: inherit;
157
+ max-width: calc(100% - 1.2em);
158
+ }
159
+
160
+ [part="root"] {
161
+ width: 100%;
162
+ z-index: inherit;
163
+ position: relative;
164
+ display: inline-flex;
165
+ align-items: center;
166
+ border-radius: inherit;
167
+ }
168
+
169
+ .content {
170
+ top: 100%;
171
+ position: absolute;
172
+ width: 100%;
173
+ z-index: 1;
174
+ margin-top: 1px;
175
+ visibility: hidden;
176
+ border-radius: inherit;
177
+ }
178
+
179
+ :host([open]) .content {
180
+ visibility: visible;
181
+ }
182
+ `,
183
+ css `
184
+ .selected-item {
185
+ background: var(--${cssGlobalVars.input}--true);
186
+ border-radius: inherit;
187
+ height: 100%;
188
+ float: left;
189
+ display: inline-flex;
190
+ font-style: normal;
191
+ align-items: center;
192
+ padding: 0 0.1em 0 0.2em;
193
+ }
194
+
195
+ .selected-item i {
196
+ height: -moz-fit-content;
197
+ height: fit-content;
198
+ }
199
+ `,
200
+ ])
336
201
  ], SelectInput);
337
202
  export { SelectInput };
338
203
  export default SelectInput;
339
204
  function includesIgnoreCase(a, b) {
205
+ if (!a || !b) {
206
+ return false;
207
+ }
340
208
  return a.toLowerCase().includes(b.toLowerCase());
341
209
  }
342
210
  //# sourceMappingURL=select-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/select-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAqB,QAAQ,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,WAAW;IAArC;;QACL;;WAEG;QACyC,SAAI,GAAG,KAAK,CAAC;QACzD;;WAEG;QACyC,SAAI,GAAG,KAAK,CAAC;QACzD;;WAEG;QACwB,UAAK,GAAG,EAAE,CAAC;QACtC;;WAEG;QACS,SAAI,GAAG,QAAQ,CAAC;QAC5B;;WAEG;QACwB,SAAI,GAAa,EAAE,CAAC;IAiSjD,CAAC;IAtMC,IAAI,QAAQ;QACV,OAAO,KAAK,CAAC,QAAe,CAAC;IAC/B,CAAC;IAKS,MAAM;QACd,OAAO,IAAI,CAAA;iBACE,IAAI,CAAC,UAAU,EAAE;;sBAEZ,IAAI,CAAC,SAAS;;kBAElB,GAAG,EAAE;YACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;kBACS,IAAI,CAAC,YAAY;uBACZ,IAAI,CAAC,GAAG;;4BAEH,OAAO,CAA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CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { ifValue } from \"../../lib/directives.js\";\nimport { htmlSlot, type HTMLTemplate, svgDelta, svgX } from \"../../lib/templates.js\";\nimport { GodownInput } from \"../../supers/input.js\";\nimport { cssvarValues, GodownElement } from \"../../supers/root.js\";\n\nconst defineName = \"select-input\";\n\n/**\n * {@linkcode SelectInput} select matched elements.\n */\n@define(defineName)\nexport class SelectInput extends GodownInput {\n /**\n * Open content.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n /**\n * Only a single option is allowed.\n */\n @property({ type: Boolean, reflect: true }) only = false;\n /**\n * Selected values.\n */\n @property({ type: Array }) value = [];\n /**\n * Input name.\n */\n @property() name = \"select\";\n /**\n * Selected texts.\n */\n @property({ type: Array }) text: string[] = [];\n\n static styles = [\n GodownInput.styles,\n css`\n :host {\n background: var(${cssvarValues.input}--background);\n margin: var(${cssvarValues.input}--outline-width);\n outline: var(${cssvarValues.input}--outline-width) solid transparent;\n height: var(${cssvarValues.input}--height);\n width: var(${cssvarValues.input}--width);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n :host([open]) {\n outline-color: var(${cssvarValues.input}--outline-color);\n }\n\n input {\n padding: 0 0 0 0.25em;\n background: none;\n cursor: inherit;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n border: inherit;\n outline: none;\n border-radius: inherit;\n flex: 1;\n }\n\n div {\n display: inline-flex;\n position: relative;\n width: 100%;\n border-radius: inherit;\n z-index: inherit;\n }\n\n label svg {\n height: 100%;\n }\n\n aside {\n margin-top: 1px;\n position: absolute;\n top: 100%;\n width: 100%;\n visibility: hidden;\n z-index: 1;\n border-radius: inherit;\n }\n\n section {\n max-width: calc(100% - 1.2em);\n height: 100%;\n overflow: hidden;\n pointer-events: none;\n border-radius: inherit;\n z-index: inherit;\n }\n\n i.selected-item {\n background: var(${cssvarValues.input}--true);\n border-radius: inherit;\n height: 100%;\n float: left;\n display: inline-flex;\n font-style: normal;\n align-items: center;\n padding-left: 0.1em;\n margin-left: 0.065em;\n }\n\n i:first-child {\n margin-left: 0;\n }\n\n i.selected-item svg {\n width: 1em;\n padding: 0 0.12em;\n height: 0.8em;\n pointer-events: all;\n }\n\n aside[open] {\n visibility: visible;\n }\n `,\n ] as CSSResultGroup;\n\n get assigned() {\n return super.assigned as any;\n }\n\n @query(\"input\") _input: HTMLInputElement;\n @query(\"aside\") _aside: HTMLInputElement;\n\n protected render(): HTMLTemplate {\n return html` <div>\n <section>${this.renderList()}</section>\n <input\n ?autofocus=\"${this.autofocus}\"\n id=\"input\"\n @focus=\"${() => {\n this.open = true;\n }}\"\n @input=\"${this._handleInput}\"\n placeholder=\"${this.pla}\"\n />\n <label for=\"input\"> ${ifValue(this.children.length > 0, svgDelta())}</label>\n <aside ?open=\"${this.open}\">${htmlSlot()}</aside>\n </div>`;\n }\n\n private renderList(): HTMLTemplate[] {\n const itemTemplates = [];\n if (this.value.length) {\n for (const i in this.value) {\n itemTemplates.push(\n html`<i class=\"selected-item\">\n ${this.text[i] || this.value[i]}\n <div\n @click=\"${() => {\n this.select(this.value[i]);\n }}\"\n >\n ${svgX()}\n </div>\n </i>`,\n );\n }\n }\n return itemTemplates;\n }\n\n protected _focusCheck() {\n if (this.autofocus) {\n this._input?.focus();\n this.open = true;\n }\n }\n\n focus(options?: FocusOptions) {\n this._input?.focus(options);\n this.open = true;\n }\n\n connectedCallback() {\n GodownElement.prototype.connectedCallback.call(this);\n }\n\n getOptionValue(option: Element) {\n return (option as HTMLOptionElement).value || option.getAttribute(\"value\");\n }\n\n protected firstUpdated() {\n const defs = this.def.split(\";\");\n defs\n .filter((i) => i.trim())\n .forEach((i) => {\n this.select(i);\n });\n this._focusCheck();\n const CLICK = \"click\";\n (this.assigned as HTMLElement[]).forEach((option: HTMLElement) => {\n if (this.getOptionValue(option)) {\n this.addEvent(option, CLICK, () => {\n this.select(this.getOptionValue(option), option.textContent);\n });\n } else if (option.children) {\n [...option.children].forEach((option: HTMLElement) => {\n this.addEvent(option, CLICK, () => {\n this.select(this.getOptionValue(option), option.textContent);\n });\n });\n }\n });\n this.addEvent(this, \"change\", () => {\n this.open = !this.only;\n });\n this.addEvent(document, CLICK, (e) => {\n if (!this.contains(e.target as Node)) {\n this.open = false;\n }\n });\n }\n\n select(value: string, text?: string) {\n if (text === undefined || text === null) {\n this.assigned.some((option: HTMLElement) => {\n const optionValue = this.getOptionValue(option);\n if (optionValue) {\n if (optionValue === value) {\n text = option.textContent;\n return true;\n }\n } else if (option.children) {\n return [...option.children].some((subOption) => {\n const subOptionValue = this.getOptionValue(subOption);\n if (subOptionValue === value) {\n text = subOption.textContent;\n return true;\n }\n return false;\n });\n }\n return false;\n });\n }\n if (this.value.includes(value)) {\n if (!this.only) {\n this.value = this.value.filter((v) => v !== value);\n this.text = this.text.filter((v) => v !== text);\n } else {\n this.value = [];\n this.text = [];\n }\n } else {\n if (!this.only) {\n this.value.push(value);\n this.text.push(text);\n } else {\n this.value = [value];\n this.text = [text];\n }\n }\n this._input.value = \"\";\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.namevalue() }));\n this.requestUpdate();\n }\n\n protected _handleInput() {\n const BLOCK = \"block\";\n const NONE = \"none\";\n let value = this._input.value.trim();\n if (!this.only && value.includes(\";\")) {\n value = value.split(\";\").pop().trim();\n }\n this.assigned.forEach((option) => {\n if (this.getOptionValue(option)) {\n option.style.display = BLOCK;\n }\n if (option.children) {\n option.style.display = BLOCK;\n [...option.children].forEach((subOption) => {\n subOption.style.display = BLOCK;\n });\n }\n });\n if (value) {\n this.assigned.forEach((option) => {\n const optionValue = this.getOptionValue(option);\n if (optionValue) {\n const isMatch = includesIgnoreCase(optionValue, value) || includesIgnoreCase(option.innerText, value);\n option.style.display = isMatch ? BLOCK : NONE;\n } else if (option.children) {\n [...option.children].forEach((subOption) => {\n const subOptionValue = this.getOptionValue(subOption);\n const isSubMatch = includesIgnoreCase(subOptionValue, value) || includesIgnoreCase(subOption.innerText, value);\n subOption.style.display = isSubMatch ? BLOCK : NONE;\n });\n if ([...option.children].filter((option) => option.style.display === BLOCK).length === 0) {\n option.style.display = NONE;\n }\n }\n });\n }\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.namevalue() }));\n }\n\n namevalue(): [string, any[]] | [string, any] {\n return [this.name, this.only ? this.value[0] : this.value];\n }\n\n reset() {\n this.value = [];\n this.text = [];\n this._input.value = \"\";\n if (this.def) {\n const defs = this.def.split(\";\");\n const defToSelect = this.only ? [defs[0]] : defs;\n defToSelect\n .filter((def) => def.trim())\n .forEach((def) => {\n this.select(def.trim(), null);\n });\n }\n }\n}\n\nexport default SelectInput;\n\nfunction includesIgnoreCase(a: string, b: string): boolean {\n return a.toLowerCase().includes(b.toLowerCase());\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"select-input\": SelectInput;\n \"g-select-input\": SelectInput;\n }\n}\n"]}
1
+ {"version":3,"file":"select-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/select-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC;;;;;;GA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,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { svgDelta, svgX } from \"../../lib/icons.js\";\nimport GodownInput from \"../../proto/super-input.js\";\nimport { cssGlobalVars } from \"../../styles/global.js\";\nimport { fieldStyle, inputStyle } from \"../../styles/inputStyle.js\";\n\nconst protoName = \"select-input\";\n\n/**\n * {@linkcode SelectInput} select matched elements.\n *\n * This will not support multi-selection operations.\n *\n * @slot - Options.\n */\n@godown(protoName)\n@styles([\n inputStyle,\n fieldStyle,\n css`\n :host {\n background: var(--${cssGlobalVars.input}--background);\n margin: var(--${cssGlobalVars.input}--outline-width);\n outline: var(--${cssGlobalVars.input}--outline-width) solid transparent;\n border-radius: var(--${cssGlobalVars.input}--radius);\n height: var(--${cssGlobalVars.input}--height);\n width: var(--${cssGlobalVars.input}--width);\n display: block;\n }\n\n :host([open]) {\n outline-color: var(--${cssGlobalVars.input}--outline-color);\n }\n\n input {\n flex: 1;\n width: 100%;\n height: 100%;\n cursor: inherit;\n border: inherit;\n background: none;\n padding: 0 0 0 0.25em;\n box-sizing: border-box;\n border-radius: inherit;\n }\n\n section {\n height: 100%;\n overflow: hidden;\n z-index: inherit;\n border-radius: inherit;\n max-width: calc(100% - 1.2em);\n }\n\n [part=\"root\"] {\n width: 100%;\n z-index: inherit;\n position: relative;\n display: inline-flex;\n align-items: center;\n border-radius: inherit;\n }\n\n .content {\n top: 100%;\n position: absolute;\n width: 100%;\n z-index: 1;\n margin-top: 1px;\n visibility: hidden;\n border-radius: inherit;\n }\n\n :host([open]) .content {\n visibility: visible;\n }\n `,\n css`\n .selected-item {\n background: var(--${cssGlobalVars.input}--true);\n border-radius: inherit;\n height: 100%;\n float: left;\n display: inline-flex;\n font-style: normal;\n align-items: center;\n padding: 0 0.1em 0 0.2em;\n }\n\n .selected-item i {\n height: -moz-fit-content;\n height: fit-content;\n }\n `,\n])\nexport class SelectInput extends GodownInput {\n /**\n * Open content.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /**\n * Selected texts.\n */\n @property() text: string;\n /**\n * Selected texts.\n */\n @property({\n attribute: \"default-text\",\n })\n defaultText: string;\n\n protected render() {\n return html`<div part=\"root\" class=\"input-field\">\n <section part=\"selected\">\n ${this.value &&\n html`<div class=\"selected-item\">\n ${this.value}\n <i\n @click=\"${() => {\n this.value = \"\";\n }}\"\n >${svgX()}</i\n >\n </div>`}\n </section>\n <input\n part=\"input\"\n ?autofocus=\"${this.autofocus}\"\n id=\"${this.makeId}\"\n @focus=\"${() => {\n this.open = true;\n }}\"\n @input=\"${this._handleInput}\"\n placeholder=\"${this.placeholder}\"\n />\n <label for=\"${this.makeId}\"> <i>${svgDelta()}</i></label>\n <div class=\"content\" part=\"slot\">${htmlSlot()}</div>\n </div>`;\n }\n\n protected firstUpdated() {\n super.firstUpdated();\n this.addEvent(document, \"click\", (e) => {\n const target = e.target as HTMLElement;\n if (!this.contains(e.target as Node)) {\n this.open = false;\n } else if (target !== this) {\n const value = this.getOptionValue(target);\n if (value) {\n this.select(value, target.textContent);\n }\n }\n });\n }\n\n select(value: string, text?: string) {\n this.value = value;\n this.text = text || value;\n this._input.value = \"\";\n this.filter();\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.namevalue() }));\n }\n\n filter(value?: string) {\n this.querySelectorAll(\"*\").forEach((option: HTMLElement) => {\n const { style } = option;\n if (!value) {\n style.display = null;\n return;\n }\n const optionValue = this.getOptionValue(option);\n if (includesIgnoreCase(optionValue, value) || includesIgnoreCase(option.textContent, value)) {\n style.display = null;\n } else {\n style.display = \"none\";\n }\n });\n }\n\n reset() {\n if (this.default) {\n this.select(this.default, this.defaultText || this.default);\n }\n }\n\n protected _handleInput() {\n this.filter(this._input.value.trim());\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.namevalue() }));\n }\n\n focus(options?: FocusOptions) {\n this._input?.focus(options);\n this.open = true;\n }\n\n getOptionValue(option: Element) {\n return (option as HTMLOptionElement).value || option.getAttribute(\"value\") || \"\";\n }\n /**\n * @deprecated\n */\n only: boolean;\n}\n\nexport default SelectInput;\n\nfunction includesIgnoreCase(a: string, b: string): boolean {\n if (!a || !b) {\n return false;\n }\n return a.toLowerCase().includes(b.toLowerCase());\n}\n"]}
@@ -1,10 +1,9 @@
1
- import { type CSSResultGroup } from "../../.deps.js";
2
- import { type HTMLTemplate } from "../../lib/templates.js";
3
- import { GodownInput } from "../../supers/input.js";
1
+ import { type HTMLEvent } from "../../proto/godown-element";
2
+ import GodownSuperInput from "../../proto/super-input.js";
4
3
  /**
5
4
  * {@linkcode SplitInput } renders multiple inputs.
6
5
  */
7
- export declare class SplitInput extends GodownInput {
6
+ export declare class SplitInput extends GodownSuperInput {
8
7
  /**
9
8
  * The number of simulated input boxes.
10
9
  */
@@ -17,20 +16,14 @@ export declare class SplitInput extends GodownInput {
17
16
  _spans: NodeListOf<HTMLSpanElement>;
18
17
  current: number;
19
18
  currentValue: (string | null)[];
20
- static styles: CSSResultGroup;
21
- protected render(): HTMLTemplate;
19
+ protected render(): import("lit").TemplateResult<1>;
22
20
  protected firstUpdated(): void;
23
- protected _handleInput(e: InputEvent): void;
21
+ protected _handleInput(e: HTMLEvent<HTMLInputElement>): void;
24
22
  focus(): void;
25
- focusAt(i?: number): void;
26
- blur(i?: number): void;
23
+ focusAt(i: number): void;
24
+ blur(): void;
25
+ blurAt(i: number): void;
27
26
  reset(): void;
28
27
  }
29
28
  export default SplitInput;
30
- declare global {
31
- interface HTMLElementTagNameMap {
32
- "split-input": SplitInput;
33
- "g-split-input": SplitInput;
34
- }
35
- }
36
29
  //# sourceMappingURL=split-input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"split-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/split-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAmC,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD;;GAEG;AACH,qBACa,UAAW,SAAQ,WAAW;IACzC;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,KAAK,SAAM;IAEvB,MAAM,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IACtD,OAAO,SAAK;IACZ,YAAY,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAM;IAErC,MAAM,CAAC,MAAM,iBAkDO;IAEpB,SAAS,CAAC,MAAM,IAAI,YAAY;IAWhC,SAAS,CAAC,YAAY;IAiBtB,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU;IA4BpC,KAAK;IAIL,OAAO,CAAC,CAAC,SAAe;IAQxB,IAAI,CAAC,CAAC,SAAe;IAKrB,KAAK;CASN;AAED,eAAe,UAAU,CAAC;AAE1B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;QAC1B,eAAe,EAAE,UAAU,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"split-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/split-input.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAU1D;;GAEG;AACH,qBAuDa,UAAW,SAAQ,gBAAgB;IAC9C;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,KAAK,SAAM;IAEvB,MAAM,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IACtD,OAAO,SAAK;IACZ,YAAY,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAM;IAErC,SAAS,CAAC,MAAM;IAkBhB,SAAS,CAAC,YAAY;IAYtB,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC;IA4BrD,KAAK;IAIL,OAAO,CAAC,CAAC,EAAE,MAAM;IAQjB,IAAI;IAIJ,MAAM,CAAC,CAAC,EAAE,MAAM;IAKhB,KAAK;CASN;AAED,eAAe,UAAU,CAAC"}