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,15 +1,17 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, property, query, queryAll } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { GodownInput } from "../../supers/input.js";
5
- import { createScope, cssvarValues } from "../../supers/root.js";
2
+ import { css, html, property, query, queryAll } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { styles } from "../../decorators/styles.js";
5
+ import GodownSuperInput from "../../proto/super-input.js";
6
+ import { createScope, cssGlobalVars } from "../../styles/global.js";
7
+ import { inputStyle } from "../../styles/inputStyle.js";
6
8
  const FOCUS = "focus";
7
- const defineName = "split-input";
8
- const cssScope = createScope(defineName);
9
+ const protoName = "split-input";
10
+ const cssScope = createScope(protoName);
9
11
  /**
10
12
  * {@linkcode SplitInput } renders multiple inputs.
11
13
  */
12
- let SplitInput = class SplitInput extends GodownInput {
14
+ let SplitInput = class SplitInput extends GodownSuperInput {
13
15
  constructor() {
14
16
  super(...arguments);
15
17
  /**
@@ -25,11 +27,18 @@ let SplitInput = class SplitInput extends GodownInput {
25
27
  }
26
28
  render() {
27
29
  return html `
28
- <div>
30
+ <div part="root">
29
31
  ${Array(this.max)
30
32
  .fill(0)
31
- .map(() => html `<span><i></i></span>`)}
32
- <input @input="${this._handleInput}" />
33
+ .map(() => html `<span part="outline"><i part="inside"></i></span>`)}
34
+ <input
35
+ part="input"
36
+ id="${this.makeId}"
37
+ @blur=${() => {
38
+ this.blurAt(this.current);
39
+ }}
40
+ @input="${this._handleInput}"
41
+ />
33
42
  </div>
34
43
  `;
35
44
  }
@@ -39,15 +48,10 @@ let SplitInput = class SplitInput extends GodownInput {
39
48
  this._spans.forEach((span, index) => {
40
49
  this.addEvent(span, "click", () => {
41
50
  this.current = index;
42
- this.focusAt();
51
+ this.focusAt(this.current);
43
52
  this._input.focus();
44
53
  });
45
54
  });
46
- this.addEvent(document, "click", (e) => {
47
- if (!this.contains(e.target)) {
48
- this.blur();
49
- }
50
- });
51
55
  }
52
56
  _handleInput(e) {
53
57
  if (e.data === null) {
@@ -64,7 +68,7 @@ let SplitInput = class SplitInput extends GodownInput {
64
68
  if (this.current + 1 >= this.max) {
65
69
  this.current = this.currentValue.indexOf(null);
66
70
  if (this.current === -1) {
67
- this.blur();
71
+ this.blurAt(this.current);
68
72
  }
69
73
  }
70
74
  else {
@@ -80,16 +84,19 @@ let SplitInput = class SplitInput extends GodownInput {
80
84
  this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
81
85
  }
82
86
  focus() {
83
- this.focusAt();
87
+ this.focusAt(this.current);
84
88
  }
85
- focusAt(i = this.current) {
89
+ focusAt(i) {
86
90
  this._spans.forEach((span) => {
87
91
  span.classList.remove(FOCUS);
88
92
  });
89
93
  this._spans[i]?.classList.add(FOCUS);
90
94
  this._input.value = "";
91
95
  }
92
- blur(i = this.current) {
96
+ blur() {
97
+ this.blurAt(this.current);
98
+ }
99
+ blurAt(i) {
93
100
  this._spans[i]?.classList.remove(FOCUS);
94
101
  this._input.blur();
95
102
  }
@@ -103,57 +110,6 @@ let SplitInput = class SplitInput extends GodownInput {
103
110
  this.dispatchEvent(new CustomEvent("change", { detail: this.value }));
104
111
  }
105
112
  };
106
- SplitInput.styles = [
107
- GodownInput.styles,
108
- css `
109
- :host {
110
- ${cssScope}--outline: .15em solid var( ${cssvarValues.input}--outline-color);
111
- margin: var(${cssvarValues.input}--outline-width);
112
- width: fit-content;
113
- border-radius: 1px;
114
- }
115
-
116
- * {
117
- font-size: 1em;
118
- border-radius: inherit;
119
- }
120
-
121
- div {
122
- vertical-align: top;
123
- position: relative;
124
- display: inline-flex;
125
- gap: 0.25em;
126
- }
127
-
128
- span {
129
- box-sizing: content-box;
130
- vertical-align: top;
131
- display: inline-flex;
132
- width: 1.45em;
133
- height: 1.45em;
134
- pointer-events: all;
135
- }
136
-
137
- i {
138
- height: inherit;
139
- width: 100%;
140
- z-index: 1;
141
- background-color: var(${cssvarValues.input}--false);
142
- text-align: center;
143
- }
144
-
145
- input {
146
- position: absolute;
147
- opacity: 0;
148
- left: 0;
149
- top: 0;
150
- }
151
-
152
- .focus i {
153
- outline: var(${cssScope}--outline);
154
- }
155
- `,
156
- ];
157
113
  __decorate([
158
114
  property({ type: Number })
159
115
  ], SplitInput.prototype, "max", void 0);
@@ -167,7 +123,61 @@ __decorate([
167
123
  queryAll("span")
168
124
  ], SplitInput.prototype, "_spans", void 0);
169
125
  SplitInput = __decorate([
170
- define(defineName)
126
+ godown(protoName),
127
+ styles([
128
+ inputStyle,
129
+ css `
130
+ :host {
131
+ --${cssScope}--outline: .15em solid var( --${cssGlobalVars.input}--outline-color);
132
+ margin: var(--${cssGlobalVars.input}--outline-width);
133
+ color: var(--${cssGlobalVars.foreground});
134
+ display: inline-block;
135
+ width: -moz-fit-content;
136
+ width: fit-content;
137
+ border-radius: 1px;
138
+ }
139
+
140
+ * {
141
+ font-size: 1em;
142
+ border-radius: inherit;
143
+ }
144
+
145
+ div {
146
+ gap: 0.25em;
147
+ position: relative;
148
+ vertical-align: top;
149
+ display: inline-flex;
150
+ }
151
+
152
+ span {
153
+ width: 1.45em;
154
+ height: 1.45em;
155
+ vertical-align: top;
156
+ display: inline-flex;
157
+ box-sizing: content-box;
158
+ }
159
+
160
+ i {
161
+ z-index: 1;
162
+ width: 100%;
163
+ height: inherit;
164
+ text-align: center;
165
+ background-color: var(--${cssGlobalVars.input}--background);
166
+ }
167
+
168
+ input {
169
+ width: 100%;
170
+ height: 100%;
171
+ opacity: 0;
172
+ background: none;
173
+ position: absolute;
174
+ }
175
+
176
+ .focus i {
177
+ outline: var(--${cssScope}--outline);
178
+ }
179
+ `,
180
+ ])
171
181
  ], SplitInput);
172
182
  export { SplitInput };
173
183
  export default SplitInput;
@@ -1 +1 @@
1
- {"version":3,"file":"split-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/split-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,YA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AAU,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query, queryAll } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { type HTMLTemplate } from \"../../lib/templates.js\";\nimport { GodownInput } from \"../../supers/input.js\";\nimport { createScope, cssvarValues } from \"../../supers/root.js\";\n\nconst FOCUS = \"focus\";\n\nconst defineName = \"split-input\";\n\nconst cssScope = createScope(defineName);\n\n/**\n * {@linkcode SplitInput } renders multiple inputs.\n */\n@define(defineName)\nexport class SplitInput extends GodownInput {\n /**\n * The number of simulated input boxes.\n */\n @property({ type: Number }) max = 6;\n /**\n * Active index.\n */\n @property({ type: Number }) index = -1;\n\n @query(\"input\") _input: HTMLInputElement;\n @queryAll(\"span\") _spans: NodeListOf<HTMLSpanElement>;\n current = 0;\n currentValue: (string | null)[] = [];\n\n static styles = [\n GodownInput.styles,\n css`\n :host {\n ${cssScope}--outline: .15em solid var( ${cssvarValues.input}--outline-color);\n margin: var(${cssvarValues.input}--outline-width);\n width: fit-content;\n border-radius: 1px;\n }\n\n * {\n font-size: 1em;\n border-radius: inherit;\n }\n\n div {\n vertical-align: top;\n position: relative;\n display: inline-flex;\n gap: 0.25em;\n }\n\n span {\n box-sizing: content-box;\n vertical-align: top;\n display: inline-flex;\n width: 1.45em;\n height: 1.45em;\n pointer-events: all;\n }\n\n i {\n height: inherit;\n width: 100%;\n z-index: 1;\n background-color: var(${cssvarValues.input}--false);\n text-align: center;\n }\n\n input {\n position: absolute;\n opacity: 0;\n left: 0;\n top: 0;\n }\n\n .focus i {\n outline: var(${cssScope}--outline);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n return html`\n <div>\n ${Array(this.max)\n .fill(0)\n .map(() => html`<span><i></i></span>`)}\n <input @input=\"${this._handleInput}\" />\n </div>\n `;\n }\n\n protected firstUpdated() {\n this.currentValue = this.value.split(\"\").concat(Array(this.max - this.value.length).fill(null));\n this.current = this.index < 0 || this.index > this.max ? this.currentValue.indexOf(null) : this.index;\n this._spans.forEach((span, index) => {\n this.addEvent(span, \"click\", () => {\n this.current = index;\n this.focusAt();\n this._input.focus();\n });\n });\n this.addEvent(document, \"click\", (e) => {\n if (!this.contains(e.target as Node)) {\n this.blur();\n }\n });\n }\n\n protected _handleInput(e: InputEvent) {\n if (e.data === null) {\n if (this.currentValue[this.current] !== null) {\n this.currentValue[this.current] = null;\n } else {\n this.currentValue[this.current - 1] = null;\n this.current = this.current - 1 < 0 ? 0 : this.current - 1;\n }\n } else {\n this.currentValue[this.current] = e.data;\n if (this.current + 1 >= this.max) {\n this.current = this.currentValue.indexOf(null);\n if (this.current === -1) {\n this.blur();\n }\n } else {\n this.current += 1;\n }\n }\n this.focus();\n this._spans.forEach((span, index) => {\n span.querySelector(\"i\").innerText = this.currentValue[index] || \"\";\n });\n this.value = this.currentValue.join(\"\");\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n focus() {\n this.focusAt();\n }\n\n focusAt(i = this.current) {\n this._spans.forEach((span) => {\n span.classList.remove(FOCUS);\n });\n this._spans[i]?.classList.add(FOCUS);\n this._input.value = \"\";\n }\n\n blur(i = this.current) {\n this._spans[i]?.classList.remove(FOCUS);\n this._input.blur();\n }\n\n reset() {\n this.currentValue = Array(this.max).fill(null);\n this.current = 0;\n this._spans.forEach((span) => {\n span.querySelector(\"i\").innerText = \"\";\n });\n this.value = \"\";\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n}\n\nexport default SplitInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"split-input\": SplitInput;\n \"g-split-input\": SplitInput;\n }\n}\n"]}
1
+ {"version":3,"file":"split-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/split-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE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IACjB,MAAM,CAAC;QACN,UAAU;QACV,GAAG,CAAA;;UAEK,QAAQ,iCAAiC,aAAa,CAAC,KAAK;sBAChD,aAAa,CAAC,KAAK;qBACpB,aAAa,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAgCb,aAAa,CAAC,KAAK;;;;;;;;;;;;uBAY5B,QAAQ;;GAE5B;KACF,CAAC;GACW,UAAU,CAuGtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property, query, queryAll } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { type HTMLEvent } from \"../../proto/godown-element\";\nimport GodownSuperInput from \"../../proto/super-input.js\";\nimport { createScope, cssGlobalVars } from \"../../styles/global.js\";\nimport { inputStyle } from \"../../styles/inputStyle.js\";\n\nconst FOCUS = \"focus\";\n\nconst protoName = \"split-input\";\n\nconst cssScope = createScope(protoName);\n\n/**\n * {@linkcode SplitInput } renders multiple inputs.\n */\n@godown(protoName)\n@styles([\n inputStyle,\n css`\n :host {\n --${cssScope}--outline: .15em solid var( --${cssGlobalVars.input}--outline-color);\n margin: var(--${cssGlobalVars.input}--outline-width);\n color: var(--${cssGlobalVars.foreground});\n display: inline-block;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 1px;\n }\n\n * {\n font-size: 1em;\n border-radius: inherit;\n }\n\n div {\n gap: 0.25em;\n position: relative;\n vertical-align: top;\n display: inline-flex;\n }\n\n span {\n width: 1.45em;\n height: 1.45em;\n vertical-align: top;\n display: inline-flex;\n box-sizing: content-box;\n }\n\n i {\n z-index: 1;\n width: 100%;\n height: inherit;\n text-align: center;\n background-color: var(--${cssGlobalVars.input}--background);\n }\n\n input {\n width: 100%;\n height: 100%;\n opacity: 0;\n background: none;\n position: absolute;\n }\n\n .focus i {\n outline: var(--${cssScope}--outline);\n }\n `,\n])\nexport class SplitInput extends GodownSuperInput {\n /**\n * The number of simulated input boxes.\n */\n @property({ type: Number }) max = 6;\n /**\n * Active index.\n */\n @property({ type: Number }) index = -1;\n\n @query(\"input\") _input: HTMLInputElement;\n @queryAll(\"span\") _spans: NodeListOf<HTMLSpanElement>;\n current = 0;\n currentValue: (string | null)[] = [];\n\n protected render() {\n return html`\n <div part=\"root\">\n ${Array(this.max)\n .fill(0)\n .map(() => html`<span part=\"outline\"><i part=\"inside\"></i></span>`)}\n <input\n part=\"input\"\n id=\"${this.makeId}\"\n @blur=${() => {\n this.blurAt(this.current);\n }}\n @input=\"${this._handleInput}\"\n />\n </div>\n `;\n }\n\n protected firstUpdated() {\n this.currentValue = this.value.split(\"\").concat(Array(this.max - this.value.length).fill(null));\n this.current = this.index < 0 || this.index > this.max ? this.currentValue.indexOf(null) : this.index;\n this._spans.forEach((span, index) => {\n this.addEvent(span, \"click\", () => {\n this.current = index;\n this.focusAt(this.current);\n this._input.focus();\n });\n });\n }\n\n protected _handleInput(e: HTMLEvent<HTMLInputElement>) {\n if (e.data === null) {\n if (this.currentValue[this.current] !== null) {\n this.currentValue[this.current] = null;\n } else {\n this.currentValue[this.current - 1] = null;\n this.current = this.current - 1 < 0 ? 0 : this.current - 1;\n }\n } else {\n this.currentValue[this.current] = e.data as string;\n if (this.current + 1 >= this.max) {\n this.current = this.currentValue.indexOf(null);\n if (this.current === -1) {\n this.blurAt(this.current);\n }\n } else {\n this.current += 1;\n }\n }\n this.focus();\n this._spans.forEach((span, index) => {\n span.querySelector(\"i\").innerText = this.currentValue[index] || \"\";\n });\n this.value = this.currentValue.join(\"\");\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n focus() {\n this.focusAt(this.current);\n }\n\n focusAt(i: number) {\n this._spans.forEach((span) => {\n span.classList.remove(FOCUS);\n });\n this._spans[i]?.classList.add(FOCUS);\n this._input.value = \"\";\n }\n\n blur() {\n this.blurAt(this.current);\n }\n\n blurAt(i: number) {\n this._spans[i]?.classList.remove(FOCUS);\n this._input.blur();\n }\n\n reset() {\n this.currentValue = Array(this.max).fill(null);\n this.current = 0;\n this._spans.forEach((span) => {\n span.querySelector(\"i\").innerText = \"\";\n });\n this.value = \"\";\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n}\n\nexport default SplitInput;\n"]}
@@ -1,6 +1,4 @@
1
- import { type CSSResultGroup } from "../../.deps.js";
2
- import { type HTMLTemplate } from "../../lib/templates.js";
3
- import { GodownInput } from "../../supers/input.js";
1
+ import GodownInput from "../../proto/super-input.js";
4
2
  /**
5
3
  * {@linkcode SwitchInput } renders a switch.
6
4
  *
@@ -8,9 +6,13 @@ import { GodownInput } from "../../supers/input.js";
8
6
  */
9
7
  export declare class SwitchInput extends GodownInput {
10
8
  /**
11
- * Border style.
9
+ * @deprecated
12
10
  */
13
11
  base: "fat" | "rect";
12
+ /**
13
+ * Border style.
14
+ */
15
+ round: boolean;
14
16
  /**
15
17
  * Whether this element is selected or not.
16
18
  */
@@ -22,28 +24,17 @@ export declare class SwitchInput extends GodownInput {
22
24
  /**
23
25
  * Parsed by JSON.parse to checked.
24
26
  */
25
- def: string;
26
- /**
27
- * Input name.
28
- */
29
- name: string;
27
+ default: string;
30
28
  /**
31
29
  * Input value.
32
30
  */
33
31
  value: string;
34
32
  _input: HTMLInputElement;
35
- static styles: CSSResultGroup;
36
- protected render(): HTMLTemplate;
33
+ protected render(): import("lit").TemplateResult<1>;
37
34
  reset(): void;
38
35
  connectedCallback(): void;
39
36
  protected _handleChange(): void;
40
37
  namevalue(): [string, boolean];
41
38
  }
42
39
  export default SwitchInput;
43
- declare global {
44
- interface HTMLElementTagNameMap {
45
- "switch-input": SwitchInput;
46
- "g-switch-input": SwitchInput;
47
- }
48
- }
49
40
  //# sourceMappingURL=switch-input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/switch-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAyB,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD;;;;GAIG;AACH,qBACa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACS,IAAI,EAAE,KAAK,GAAG,MAAM,CAAU;IAC1C;;OAEG;IAC0B,OAAO,UAAS;IAC7C;;OAEG;IAC0B,QAAQ,UAAS;IAC9C;;OAEG;IACS,GAAG,SAAW;IAC1B;;OAEG;IACS,IAAI,SAAc;IAC9B;;OAEG;IACS,KAAK,SAAQ;IAET,MAAM,EAAE,gBAAgB,CAAC;IAEzC,MAAM,CAAC,MAAM,iBA4HO;IAEpB,SAAS,CAAC,MAAM,IAAI,YAAY;IAWhC,KAAK;IAKL,iBAAiB;IASjB,SAAS,CAAC,aAAa;IAMvB,SAAS,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;CAG/B;AAED,eAAe,WAAW,CAAC;AAE3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;QAC5B,gBAAgB,EAAE,WAAW,CAAC;KAC/B;CACF"}
1
+ {"version":3,"file":"switch-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/switch-input.ts"],"names":[],"mappings":"AAGA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD;;;;GAIG;AACH,qBA0Fa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB;;OAEG;IAEyC,KAAK,UAAS;IAC1D;;OAEG;IACyC,OAAO,UAAS;IAC5D;;OAEG;IACyC,QAAQ,UAAS;IAC7D;;OAEG;IACS,OAAO,SAAW;IAC9B;;OAEG;IACS,KAAK,SAAQ;IAET,MAAM,EAAE,gBAAgB,CAAC;IAEzC,SAAS,CAAC,MAAM;IAiBhB,KAAK;IAKL,iBAAiB;IAUjB,SAAS,CAAC,aAAa;IAMvB,SAAS,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;CAG/B;AAED,eAAe,WAAW,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, property, query } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { htmlSlot } from "../../lib/templates.js";
5
- import { GodownInput } from "../../supers/input.js";
6
- import { createScope, cssvarValues } from "../../supers/root.js";
7
- const defineName = "switch-input";
8
- const cssScope = createScope(defineName);
2
+ import { css, html, property, query } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { styles } from "../../decorators/styles.js";
5
+ import GodownInput from "../../proto/super-input.js";
6
+ import { cssGlobalVars } from "../../styles/global.js";
7
+ import { inputStyle } from "../../styles/inputStyle.js";
8
+ const protoName = "switch-input";
9
9
  /**
10
10
  * {@linkcode SwitchInput } renders a switch.
11
11
  *
@@ -17,7 +17,8 @@ let SwitchInput = class SwitchInput extends GodownInput {
17
17
  /**
18
18
  * Border style.
19
19
  */
20
- this.base = "rect";
20
+ // @property() variant: "fat" | "rect" = "rect";
21
+ this.round = false;
21
22
  /**
22
23
  * Whether this element is selected or not.
23
24
  */
@@ -29,36 +30,38 @@ let SwitchInput = class SwitchInput extends GodownInput {
29
30
  /**
30
31
  * Parsed by JSON.parse to checked.
31
32
  */
32
- this.def = "false";
33
- /**
34
- * Input name.
35
- */
36
- this.name = "checkbox";
33
+ this.default = "false";
37
34
  /**
38
35
  * Input value.
39
36
  */
40
37
  this.value = "on";
41
38
  }
42
39
  render() {
43
- return html `<span class="${this.base}">
44
- <input @change="${this._handleChange}" ?disabled="${this.disabled}" ?checked="${this.checked}" name="${this.name}" type="checkbox" />
45
- <aside>
46
- <div class="false"><slot name="false"></slot></div>
47
- <div class="always">${htmlSlot()}<slot name="always"></slot></div>
48
- <div class="true"><slot name="true"></slot></div>
49
- </aside>
50
- </span>`;
40
+ return html `<div part="root" class="${this.round ? "round" : "rect"}">
41
+ <input
42
+ part="input"
43
+ @change="${this._handleChange}"
44
+ ?disabled="${this.disabled}"
45
+ ?checked="${this.checked}"
46
+ name="${this.name}"
47
+ id="${this.makeId}"
48
+ type="checkbox"
49
+ />
50
+ <span>
51
+ <i class="${this.checked}"><i></i></i>
52
+ </span>
53
+ </div>`;
51
54
  }
52
55
  reset() {
53
- this.checked = this.def === "true";
56
+ this.checked = this.default === "true";
54
57
  this._input.checked = this.checked;
55
58
  }
56
59
  connectedCallback() {
57
60
  super.connectedCallback();
58
61
  if (this.checked) {
59
- this.def = "true";
62
+ this.default = "true";
60
63
  }
61
- else if (this.def === "true") {
64
+ if (this.default === "true") {
62
65
  this.checked = true;
63
66
  }
64
67
  }
@@ -71,146 +74,18 @@ let SwitchInput = class SwitchInput extends GodownInput {
71
74
  return [this.name, this.checked];
72
75
  }
73
76
  };
74
- SwitchInput.styles = [
75
- GodownInput.styles,
76
- css `
77
- :host {
78
- ${cssScope}--width: 3em;
79
- ${cssScope}--height: calc(var(${cssScope}--width) / 2);
80
- width: var(${cssScope}--width);
81
- height: var(${cssScope}--height);
82
- }
83
-
84
- :host,
85
- span {
86
- display: inline-flex;
87
- font-size: inherit;
88
- position: relative;
89
- align-items: center;
90
- border-radius: inherit;
91
- }
92
-
93
- span {
94
- width: inherit;
95
- height: inherit;
96
- }
97
-
98
- input {
99
- width: inherit;
100
- height: inherit;
101
- margin: 0;
102
- outline: none;
103
- appearance: none;
104
- -webkit-appearance: none;
105
- -moz-appearance: none;
106
- position: relative;
107
- font-size: inherit;
108
- background: var(${cssvarValues.input}--false);
109
- border-radius: inherit;
110
- transition: all 0.3s;
111
- }
112
-
113
- aside {
114
- pointer-events: none;
115
- transition: 0.3s;
116
- display: inline-flex;
117
- align-items: center;
118
- justify-content: center;
119
- position: absolute;
120
- font-size: inherit;
121
- overflow: hidden;
122
- border-radius: inherit;
123
- }
124
-
125
- aside div {
126
- height: 100%;
127
- }
128
-
129
- input[disabled] ~ aside {
130
- filter: brightness(0.87);
131
- }
132
-
133
- .rect div.always {
134
- display: none;
135
- }
136
-
137
- .always {
138
- position: absolute;
139
- }
140
-
141
- .rect aside {
142
- height: 100%;
143
- width: 100%;
144
- left: 0;
145
- }
146
-
147
- .rect .true,
148
- .rect .false {
149
- width: 50%;
150
- text-align: center;
151
- transition: all 0.3s;
152
- }
153
-
154
- .rect input:checked ~ aside div.true,
155
- .rect .false {
156
- background-color: var(${cssvarValues.input}--true);
157
- }
158
-
159
- .rect input:checked ~ aside div.false,
160
- .rect .true {
161
- background: var(${cssvarValues.input}--false);
162
- }
163
-
164
- .fat aside {
165
- width: 1.2em;
166
- height: 1.2em;
167
- border-radius: 50%;
168
- background: var(${cssvarValues.input}--control);
169
- transition: 0.3s;
170
- left: 0.15em;
171
- top: 0.15em;
172
- bottom: 0.15em;
173
- }
174
-
175
- .fat {
176
- border-radius: 0.75em;
177
- }
178
-
179
- .fat input:checked {
180
- background: var(${cssvarValues.input}--true);
181
- }
182
-
183
- .fat input:checked ~ aside {
184
- left: calc(100% - 0.15em - 1.2em);
185
- right: 0.15em;
186
- }
187
-
188
- .fat input:checked ~ aside div.true,
189
- .fat div.false {
190
- display: block;
191
- }
192
-
193
- .fat input:checked ~ aside div.false,
194
- .fat div.true {
195
- display: none;
196
- }
197
- `,
198
- ];
199
77
  __decorate([
200
- property()
201
- ], SwitchInput.prototype, "base", void 0);
78
+ property({ type: Boolean, reflect: true })
79
+ ], SwitchInput.prototype, "round", void 0);
202
80
  __decorate([
203
- property({ type: Boolean })
81
+ property({ type: Boolean, reflect: true })
204
82
  ], SwitchInput.prototype, "checked", void 0);
205
83
  __decorate([
206
- property({ type: Boolean })
84
+ property({ type: Boolean, reflect: true })
207
85
  ], SwitchInput.prototype, "disabled", void 0);
208
86
  __decorate([
209
87
  property()
210
- ], SwitchInput.prototype, "def", void 0);
211
- __decorate([
212
- property()
213
- ], SwitchInput.prototype, "name", void 0);
88
+ ], SwitchInput.prototype, "default", void 0);
214
89
  __decorate([
215
90
  property()
216
91
  ], SwitchInput.prototype, "value", void 0);
@@ -218,7 +93,96 @@ __decorate([
218
93
  query("input")
219
94
  ], SwitchInput.prototype, "_input", void 0);
220
95
  SwitchInput = __decorate([
221
- define(defineName)
96
+ godown(protoName),
97
+ styles([
98
+ inputStyle,
99
+ css `
100
+ :host {
101
+ --${cssGlobalVars.input}--width: 3em;
102
+ --${cssGlobalVars.input}--height: calc(var(--${cssGlobalVars.input}--width) / 2);
103
+ --${cssGlobalVars.input}--gap: calc(var(--${cssGlobalVars.input}--width) / 25);
104
+ --${cssGlobalVars.input}--transition: all .25s ease-in-out;
105
+ background: var(--${cssGlobalVars.input}--background);
106
+ width: var(--${cssGlobalVars.input}--width);
107
+ height: var(--${cssGlobalVars.input}--height);
108
+ display: inline-block;
109
+ vertical-align: bottom;
110
+ }
111
+
112
+ [part="root"],
113
+ span,
114
+ i {
115
+ transition: var(--${cssGlobalVars.input}--transition);
116
+ }
117
+
118
+ [part="root"] {
119
+ border-radius: inherit;
120
+ position: relative;
121
+ height: inherit;
122
+ }
123
+
124
+ [part="root"],
125
+ input,
126
+ i {
127
+ width: 100%;
128
+ }
129
+
130
+ input {
131
+ margin: 0;
132
+ height: 100%;
133
+ outline: none;
134
+ appearance: none;
135
+ -webkit-appearance: none;
136
+ -moz-appearance: none;
137
+ }
138
+
139
+ span {
140
+ height: 100%;
141
+ display: inline-flex;
142
+ position: absolute;
143
+ left: 0;
144
+ width: 50%;
145
+ pointer-events: none;
146
+ border-radius: inherit;
147
+ }
148
+
149
+ :host([round]) {
150
+ border-radius: calc(var(--${cssGlobalVars.input}--height) / 2);
151
+ }
152
+
153
+ :host([checked]) span {
154
+ transform: translateX(100%);
155
+ }
156
+
157
+ .rect * {
158
+ border-radius: inherit;
159
+ }
160
+
161
+ .rect .true {
162
+ background: var(--${cssGlobalVars.input}--true);
163
+ }
164
+
165
+ .rect .false {
166
+ background: var(--${cssGlobalVars.input}--false);
167
+ }
168
+
169
+ .round i {
170
+ border-radius: 100%;
171
+ margin: var(--${cssGlobalVars.input}--gap);
172
+ background: var(--${cssGlobalVars.input}--control);
173
+ width: calc(var(--${cssGlobalVars.input}--height) - var(--${cssGlobalVars.input}--gap) * 2);
174
+ height: calc(var(--${cssGlobalVars.input}--height) - var(--${cssGlobalVars.input}--gap) * 2);
175
+ }
176
+
177
+ .round {
178
+ background: var(--${cssGlobalVars.input}--false);
179
+ }
180
+
181
+ :host([checked]) .round {
182
+ background: var(--${cssGlobalVars.input}--true);
183
+ }
184
+ `,
185
+ ])
222
186
  ], SwitchInput);
223
187
  export { SwitchInput };
224
188
  export default SwitchInput;