godown 2.7.4 → 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 +20 -25
  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 +1 @@
1
- {"version":3,"file":"typewriter.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/text/typewriter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAyB,KAAK,EAAE,KA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BlC;CACF,AA/BY,CA+BX;AAvEU;IAAX,QAAQ,EAAE;wCAAW;AAIO;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAiB;AAIhB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAe;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAU;AAIT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAW;AAI7B;IAAR,KAAK,EAAE;2CAAc;AAGV;IAAX,KAAK,CAAC,GAAG,CAAC;sCAAiB;AAnCjB,UAAU;IADtB,MAAM,CAAC,UAAU,CAAC;GACN,UAAU,CAmHtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property, type PropertyValueMap, query, state } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { random } from \"../../lib/utils.js\";\nimport { createScope, GodownElement } from \"../../supers/root.js\";\n\nconst defineName = \"typewriter\";\nconst cssvarScope = createScope(defineName);\n\n/**\n * {@linkcode Typewriter} renders a typewriter effect to text.\n */\n@define(defineName)\nexport class Typewriter extends GodownElement {\n /**\n * Raw text.\n */\n @property() text = \"\";\n /**\n * Start immediately after {@linkcode Typewriter.firstUpdated}.\n */\n @property({ type: Boolean }) stopped = false;\n /**\n * If true, hide the cursor\n */\n @property({ type: Boolean }) ended = false;\n /**\n * Maximum random time.\n */\n @property({ type: Number }) max = 100;\n /**\n * Minimum random time.\n */\n @property({ type: Number }) min = 50;\n /**\n * Fixed time.\n */\n @property({ type: Number }) delay = 0;\n /**\n * The index at the beginning.\n */\n @property({ type: Number }) index = 0;\n /**\n * Internal text.\n */\n @state() content = \"\";\n\n timeoutID: number;\n @query(\"i\") _i: HTMLElement;\n\n /**\n * {@linkcode Typewriter.text} length.\n */\n get len() {\n return this.text.length;\n }\n\n static styles = [\n css`\n :host {\n ${cssvarScope}--cursor-width: .05em;\n font-family: monospace;\n white-space: nowrap;\n }\n\n i {\n border-right: var(${cssvarScope}--cursor-width) solid;\n margin-left: 0.02em;\n animation: s 1.5s steps(1) infinite;\n }\n\n @keyframes s {\n 0% {\n border-color: currentColor;\n }\n 50% {\n border-color: transparent;\n }\n }\n\n slot {\n display: none;\n }\n\n .hidden {\n visibility: hidden;\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n return html`${htmlSlot()}${this.content}<i class=\"${(this.ended && \"hidden\") || \"\"}\"></i>`;\n }\n\n protected firstUpdated() {\n if (!this.text) {\n this.text = this.assignedNodes[0]?.textContent.trim() || \"\";\n }\n if (!this.stopped && this.len) {\n this.write();\n }\n }\n\n protected updated(changedProperties: PropertyValueMap<this>) {\n if (changedProperties.has(\"index\")) {\n this.dispatchEvent(new CustomEvent(this.index === this.len ? \"done\" : \"write\", { detail: this.content }));\n }\n }\n\n write(at = this.index) {\n this.content = this.text.slice(0, at + 1);\n const timeout = this.delay || random(this.max, this.min);\n this.timeoutID = setTimeout(() => {\n const nx = at + 1;\n if (nx <= this.len) {\n this.index = nx;\n this.write();\n }\n }, timeout);\n }\n\n stop() {\n clearTimeout(this.timeoutID);\n }\n\n end() {\n this.ended = true;\n }\n}\n\nexport default Typewriter;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"typewriter-text\": Typewriter;\n \"g-typewriter\": Typewriter;\n }\n}\n"]}
1
+ {"version":3,"file":"typewriter.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/text/typewriter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAyB,KAAK,EAAE,KAAK,EAAE,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ea;IAAX,QAAQ,EAAE;wCAAW;AAIO;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAiB;AAIhB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAe;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAU;AAIT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAW;AAI7B;IAAR,KAAK,EAAE;2CAAc;AAGV;IAAX,KAAK,CAAC,GAAG,CAAC;sCAAiB;AAnCjB,UAAU;IAjCtB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,GAAG,CAAA;;UAEK,QAAQ;;;;;;4BAMU,QAAQ;;;;;;;;;;;;;;;;;;;;;GAqBjC;KACF,CAAC;GACW,UAAU,CAkFtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property, type PropertyValueMap, query, state } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { random } from \"../../lib/utils.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\nimport { createScope } from \"../../styles/global.js\";\n\nconst protoName = \"typewriter\";\nconst cssScope = createScope(protoName);\n\n/**\n * {@linkcode Typewriter} renders a typewriter effect to text.\n */\n@godown(protoName)\n@styles([\n css`\n :host {\n --${cssScope}--cursor-width: .05em;\n font-family: monospace;\n white-space: nowrap;\n }\n\n i {\n border-right: var(--${cssScope}--cursor-width) solid;\n margin-left: 0.02em;\n animation: s 1.5s steps(1) infinite;\n }\n\n @keyframes s {\n 0% {\n border-color: currentColor;\n }\n 50% {\n border-color: transparent;\n }\n }\n\n slot {\n display: none;\n }\n\n .hidden {\n visibility: hidden;\n }\n `,\n])\nexport class Typewriter extends GodownElement {\n /**\n * Raw text.\n */\n @property() text = \"\";\n /**\n * Start immediately after {@linkcode Typewriter.firstUpdated}.\n */\n @property({ type: Boolean }) stopped = false;\n /**\n * If true, hide the cursor\n */\n @property({ type: Boolean }) ended = false;\n /**\n * Maximum random time.\n */\n @property({ type: Number }) max = 100;\n /**\n * Minimum random time.\n */\n @property({ type: Number }) min = 50;\n /**\n * Fixed time.\n */\n @property({ type: Number }) delay = 0;\n /**\n * The index at the beginning.\n */\n @property({ type: Number }) index = 0;\n /**\n * Internal text.\n */\n @state() content = \"\";\n\n timeoutID: number;\n @query(\"i\") _i: HTMLElement;\n\n /**\n * {@linkcode Typewriter.text} length.\n */\n get len() {\n return this.text.length;\n }\n\n protected render() {\n return html`${htmlSlot()}${this.content}<i part=\"cursor\" class=\"${(this.ended && \"hidden\") || \"\"}\"></i>`;\n }\n\n protected firstUpdated() {\n if (!this.text) {\n this.text = this.assignedNodes[0]?.textContent.trim() || \"\";\n }\n if (!this.stopped && this.len) {\n this.write();\n }\n }\n\n protected updated(changedProperties: PropertyValueMap<this>) {\n if (changedProperties.has(\"index\")) {\n this.dispatchEvent(new CustomEvent(this.index === this.len ? \"done\" : \"write\", { detail: this.content }));\n }\n }\n\n write(at = this.index) {\n this.content = this.text.slice(0, at + 1);\n const timeout = this.delay || random(this.max, this.min);\n this.timeoutID = setTimeout(() => {\n const nx = at + 1;\n if (nx <= this.len) {\n this.index = nx;\n this.write();\n }\n }, timeout);\n }\n\n stop() {\n clearTimeout(this.timeoutID);\n }\n\n end() {\n this.ended = true;\n }\n}\n\nexport default Typewriter;\n"]}
@@ -1,26 +1,30 @@
1
- import { CSSResultGroup } from "../../.deps.js";
2
- import { type HTMLTemplate } from "../../lib/templates.js";
3
- import { type Direction8, GodownOpenable } from "../../supers/openable.js";
1
+ import GodownSuperOpenable, { type Direction8 } from "../../proto/super-openable.js";
4
2
  /**
5
- * {@linkcode Tooltip} provide tooltip for slot elements, summary as the tips content.
3
+ * {@linkcode Tooltip} provide tooltip for slot elements.
6
4
  *
7
5
  * Content can be opened in 8 directions.
6
+ *
7
+ * @slot tooltip - Tooltip element.
8
+ * @slot - Tooltip trigger.
9
+ *
8
10
  */
9
- export declare class Tooltip extends GodownOpenable {
10
- direction: Direction8 | "";
11
+ export declare class Tooltip extends GodownSuperOpenable {
11
12
  /**
12
- * Tip content align.
13
+ * Open direction.
13
14
  */
14
- align: "center" | "flex-star" | "flex-end" | "";
15
- static styles: CSSResultGroup;
16
- protected render(): HTMLTemplate;
15
+ direction: Direction8;
16
+ /**
17
+ * Content align.
18
+ */
19
+ align: keyof typeof Tooltip.aligns | "inherit";
20
+ static aligns: {
21
+ start: string;
22
+ end: string;
23
+ center: string;
24
+ "flex-start": string;
25
+ "flex-end": string;
26
+ };
27
+ protected render(): import("lit").TemplateResult<1>;
17
28
  }
18
29
  export default Tooltip;
19
- declare global {
20
- interface HTMLElementTagNameMap {
21
- "open-tooltip": Tooltip;
22
- "tool-tip": Tooltip;
23
- "g-tooltip": Tooltip;
24
- }
25
- }
26
30
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,KAAK,UAAU,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK3E;;;;GAIG;AACH,qBACa,OAAQ,SAAQ,cAAc;IACzC,SAAS,EAAE,UAAU,GAAG,EAAE,CAAC;IAC3B;;OAEG;IACS,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,EAAE,CAAM;IAEjE,MAAM,CAAC,MAAM,EAAE,cAAc,CAgD3B;IAEF,SAAS,CAAC,MAAM,IAAI,YAAY;CAMjC;AAED,eAAe,OAAO,CAAC;AAEvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,OAAO,CAAC;QACxB,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,OAAO,CAAC;KACtB;CACF"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/tooltip/tooltip.ts"],"names":[],"mappings":"AAIA,OAAO,mBAAmB,EAAE,EAAE,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAMrF;;;;;;;;GAQG;AACH,qBAkEa,OAAQ,SAAQ,mBAAmB;IAC9C;;OAEG;IACS,SAAS,EAAE,UAAU,CAAS;IAC1C;;OAEG;IACS,KAAK,EAAE,MAAM,OAAO,OAAO,CAAC,MAAM,GAAG,SAAS,CAAY;IAEtE,MAAM,CAAC,MAAM;;;;;;MAMX;IAEF,SAAS,CAAC,MAAM;CAOjB;AAED,eAAe,OAAO,CAAC"}
@@ -1,84 +1,122 @@
1
+ var Tooltip_1;
1
2
  import { __decorate } from "tslib";
2
- import { css, html, property } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { htmlSlot } from "../../lib/templates.js";
5
- import { GodownOpenable } from "../../supers/openable.js";
6
- import { cssvarValues } from "../../supers/root.js";
7
- const defineName = "tooltip";
3
+ import { css, html, property } from "../../_deps.js";
4
+ import { godown } from "../../decorators/godown.js";
5
+ import { styles } from "../../decorators/styles.js";
6
+ import { htmlSlot } from "../../lib/directives.js";
7
+ import GodownSuperOpenable from "../../proto/super-openable.js";
8
+ import { createScope } from "../../styles/global.js";
9
+ const protoName = "tooltip";
10
+ const cssScope = createScope(protoName);
8
11
  /**
9
- * {@linkcode Tooltip} provide tooltip for slot elements, summary as the tips content.
12
+ * {@linkcode Tooltip} provide tooltip for slot elements.
10
13
  *
11
14
  * Content can be opened in 8 directions.
15
+ *
16
+ * @slot tooltip - Tooltip element.
17
+ * @slot - Tooltip trigger.
18
+ *
12
19
  */
13
- let Tooltip = class Tooltip extends GodownOpenable {
20
+ let Tooltip = Tooltip_1 = class Tooltip extends GodownSuperOpenable {
14
21
  constructor() {
15
22
  super(...arguments);
16
23
  /**
17
- * Tip content align.
24
+ * Open direction.
25
+ */
26
+ this.direction = "top";
27
+ /**
28
+ * Content align.
18
29
  */
19
- this.align = "";
30
+ this.align = "center";
20
31
  }
21
32
  render() {
22
- return html `<main style="justify-content:${this.align || "inherit"}">
33
+ const align = Tooltip_1.aligns[this.align] || "inherit";
34
+ return html `<div part="root" class="root" style="justify-content:${align};align-items:${align}">
23
35
  ${htmlSlot()}
24
- <aside class="${this.direction || "top"}">${this.summary || htmlSlot("summary")}</aside>
25
- </main>`;
36
+ <div part="tooltip" direction="${this.direction}">${htmlSlot("tooltip")}</div>
37
+ </div>`;
26
38
  }
27
39
  };
28
- Tooltip.styles = [
29
- GodownOpenable.styles,
30
- css `
31
- :host {
32
- color: var(${cssvarValues.text});
33
- display: inline-flex;
34
- transition: 0.3s ease-in-out;
35
- justify-content: center;
36
- }
40
+ Tooltip.aligns = {
41
+ start: "flex-start",
42
+ end: "flex-end",
43
+ center: "center",
44
+ "flex-start": "flex-start",
45
+ "flex-end": "flex-end",
46
+ };
47
+ __decorate([
48
+ property()
49
+ ], Tooltip.prototype, "direction", void 0);
50
+ __decorate([
51
+ property()
52
+ ], Tooltip.prototype, "align", void 0);
53
+ Tooltip = Tooltip_1 = __decorate([
54
+ godown(protoName),
55
+ styles([
56
+ css `
57
+ :host {
58
+ --${cssScope}--tooltip-gap: .15em;
59
+ transition: 0.3s ease-in-out;
60
+ border-radius: 0.25em;
61
+ display: block;
62
+ height: 100%;
63
+ }
37
64
 
38
- main {
39
- display: inline-flex;
40
- align-items: center;
41
- position: relative;
42
- transition: inherit;
43
- }
65
+ [part="root"] {
66
+ display: flex;
67
+ position: relative;
68
+ transition: inherit;
69
+ border-radius: inherit;
70
+ }
44
71
 
45
- main,
46
- aside {
47
- transition: inherit;
48
- white-space: nowrap;
49
- }
72
+ [part="tooltip"] {
73
+ z-index: 1;
74
+ opacity: 0;
75
+ width: -moz-fit-content;
76
+ width: fit-content;
77
+ height: -moz-fit-content;
78
+ height: fit-content;
79
+ position: absolute;
80
+ visibility: hidden;
81
+ transition: inherit;
82
+ pointer-events: none;
83
+ border-radius: inherit;
84
+ transition-property:opacity;
85
+ }
50
86
 
51
- aside {
87
+ :host(:hover) [part="tooltip"],
88
+ :host([open]) [part="tooltip"] {
89
+ visibility: visible;
90
+ animation: open .8s forwards;
91
+ }
92
+ @keyframes open {
93
+ 50% {
52
94
  opacity: 0;
53
- position: absolute;
54
- transition-property: opacity;
55
95
  }
56
-
57
- :host(:hover) aside,
58
- :host([open]) aside {
96
+ 100% {
59
97
  opacity: 1;
60
98
  }
61
- `,
62
- css `
63
- aside[class^="top"] {
64
- bottom: 100%;
65
- }
66
- aside[class^="bottom"] {
67
- top: 100%;
68
- }
69
- aside[class$="right"] {
70
- left: 100%;
71
- }
72
- aside[class$="left"] {
73
- right: 100%;
74
- }
75
- `,
76
- ];
77
- __decorate([
78
- property()
79
- ], Tooltip.prototype, "align", void 0);
80
- Tooltip = __decorate([
81
- define(defineName)
99
+ }
100
+ `,
101
+ css `
102
+ [direction^="top"] {
103
+ bottom: 100%;
104
+ padding-bottom: var(--${cssScope}--tooltip-gap);
105
+ }
106
+ [direction^="bottom"] {
107
+ top: 100%;
108
+ padding-top: var(--${cssScope}--tooltip-gap);
109
+ }
110
+ [direction$="right"] {
111
+ left: 100%;
112
+ padding-left: var(--${cssScope}--tooltip-gap);
113
+ }
114
+ [direction$="left"] {
115
+ right: 100%;
116
+ padding-right: var(--${cssScope}--tooltip-gap);
117
+ }
118
+ `,
119
+ ])
82
120
  ], Tooltip);
83
121
  export { Tooltip };
84
122
  export default Tooltip;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/tooltip/tooltip.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAmB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;;;GAIG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,cAAc;IAApC;;QAEL;;WAEG;QACS,UAAK,GAA6C,EAAE,CAAC;IA0DnE,CAAC;IANW,MAAM;QACd,OAAO,IAAI,CAAA,gCAAgC,IAAI,CAAC,KAAK,IAAI,SAAS;QAC9D,QAAQ,EAAE;sBACI,IAAI,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC;YACzE,CAAC;IACX,CAAC;;AAvDM,cAAM,GAAmB;IAC9B,cAAc,CAAC,MAAM;IACrB,GAAG,CAAA;;qBAEc,YAAY,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BjC;IACD,GAAG,CAAA;;;;;;;;;;;;;KAaF;CACF,AAhDY,CAgDX;AAlDU;IAAX,QAAQ,EAAE;sCAAsD;AALtD,OAAO;IADnB,MAAM,CAAC,UAAU,CAAC;GACN,OAAO,CA+DnB;;AAED,eAAe,OAAO,CAAC","sourcesContent":["import { css, CSSResultGroup, html, property } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { type Direction8, GodownOpenable } from \"../../supers/openable.js\";\nimport { cssvarValues } from \"../../supers/root.js\";\n\nconst defineName = \"tooltip\";\n\n/**\n * {@linkcode Tooltip} provide tooltip for slot elements, summary as the tips content.\n *\n * Content can be opened in 8 directions.\n */\n@define(defineName)\nexport class Tooltip extends GodownOpenable {\n direction: Direction8 | \"\";\n /**\n * Tip content align.\n */\n @property() align: \"center\" | \"flex-star\" | \"flex-end\" | \"\" = \"\";\n\n static styles: CSSResultGroup = [\n GodownOpenable.styles,\n css`\n :host {\n color: var(${cssvarValues.text});\n display: inline-flex;\n transition: 0.3s ease-in-out;\n justify-content: center;\n }\n\n main {\n display: inline-flex;\n align-items: center;\n position: relative;\n transition: inherit;\n }\n\n main,\n aside {\n transition: inherit;\n white-space: nowrap;\n }\n\n aside {\n opacity: 0;\n position: absolute;\n transition-property: opacity;\n }\n\n :host(:hover) aside,\n :host([open]) aside {\n opacity: 1;\n }\n `,\n css`\n aside[class^=\"top\"] {\n bottom: 100%;\n }\n aside[class^=\"bottom\"] {\n top: 100%;\n }\n aside[class$=\"right\"] {\n left: 100%;\n }\n aside[class$=\"left\"] {\n right: 100%;\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n return html`<main style=\"justify-content:${this.align || \"inherit\"}\">\n ${htmlSlot()}\n <aside class=\"${this.direction || \"top\"}\">${this.summary || htmlSlot(\"summary\")}</aside>\n </main>`;\n }\n}\n\nexport default Tooltip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"open-tooltip\": Tooltip;\n \"tool-tip\": Tooltip;\n \"g-tooltip\": Tooltip;\n }\n}\n"]}
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/tooltip/tooltip.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,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property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport GodownSuperOpenable, { type Direction8 } from \"../../proto/super-openable.js\";\nimport { createScope } from \"../../styles/global.js\";\n\nconst protoName = \"tooltip\";\nconst cssScope = createScope(protoName);\n\n/**\n * {@linkcode Tooltip} provide tooltip for slot elements.\n *\n * Content can be opened in 8 directions.\n *\n * @slot tooltip - Tooltip element.\n * @slot - Tooltip trigger.\n *\n */\n@godown(protoName)\n@styles([\n css`\n :host {\n --${cssScope}--tooltip-gap: .15em;\n transition: 0.3s ease-in-out;\n border-radius: 0.25em;\n display: block;\n height: 100%;\n }\n\n [part=\"root\"] {\n display: flex;\n position: relative;\n transition: inherit;\n border-radius: inherit;\n }\n\n [part=\"tooltip\"] {\n z-index: 1;\n opacity: 0;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n position: absolute;\n visibility: hidden;\n transition: inherit;\n pointer-events: none;\n border-radius: inherit;\n transition-property:opacity;\n }\n\n :host(:hover) [part=\"tooltip\"],\n :host([open]) [part=\"tooltip\"] {\n visibility: visible;\n animation: open .8s forwards;\n }\n @keyframes open {\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n `,\n css`\n [direction^=\"top\"] {\n bottom: 100%;\n padding-bottom: var(--${cssScope}--tooltip-gap);\n }\n [direction^=\"bottom\"] {\n top: 100%;\n padding-top: var(--${cssScope}--tooltip-gap);\n }\n [direction$=\"right\"] {\n left: 100%;\n padding-left: var(--${cssScope}--tooltip-gap);\n }\n [direction$=\"left\"] {\n right: 100%;\n padding-right: var(--${cssScope}--tooltip-gap);\n }\n `,\n])\nexport class Tooltip extends GodownSuperOpenable {\n /**\n * Open direction.\n */\n @property() direction: Direction8 = \"top\";\n /**\n * Content align.\n */\n @property() align: keyof typeof Tooltip.aligns | \"inherit\" = \"center\";\n\n static aligns = {\n start: \"flex-start\",\n end: \"flex-end\",\n center: \"center\",\n \"flex-start\": \"flex-start\",\n \"flex-end\": \"flex-end\",\n };\n\n protected render() {\n const align = Tooltip.aligns[this.align] || \"inherit\";\n return html`<div part=\"root\" class=\"root\" style=\"justify-content:${align};align-items:${align}\">\n ${htmlSlot()}\n <div part=\"tooltip\" direction=\"${this.direction}\">${htmlSlot(\"tooltip\")}</div>\n </div>`;\n }\n}\n\nexport default Tooltip;\n"]}
@@ -1,5 +1,5 @@
1
- import { type HTMLTemplate } from "../../lib/templates.js";
2
- import { GodownElement } from "../../supers/root.js";
1
+ import { ListenerFunc } from "../../lib/event-coll.js";
2
+ import { GodownElement } from "../../proto/godown-element.js";
3
3
  /**
4
4
  * {@linkcode Dragbox} does not extend beyond the range of {@linkcode Dragbox.offsetsWidth} and {@linkcode Dragbox.offsetsHeight}.
5
5
  */
@@ -17,19 +17,14 @@ export declare class Dragbox extends GodownElement {
17
17
  * Position y.
18
18
  */
19
19
  y: string;
20
- static styles: import("lit").CSSResult[];
21
- protected render(): HTMLTemplate;
20
+ protected render(): import("lit").TemplateResult<1>;
22
21
  protected firstUpdated(): void;
23
22
  protected _handleDragStart(e: MouseEvent): void;
23
+ mouseMoveEvent: ListenerFunc;
24
+ mouseLeaveEvent: ListenerFunc;
24
25
  protected _handleDragEnd(): void;
25
26
  protected _handleDrag(e: MouseEvent): void;
26
27
  reset(): void;
27
28
  }
28
29
  export default Dragbox;
29
- declare global {
30
- interface HTMLElementTagNameMap {
31
- "drag-box": Dragbox;
32
- "g-dragbox": Dragbox;
33
- }
34
- }
35
30
  //# sourceMappingURL=dragbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dragbox.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/wrapper/dragbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD;;GAEG;AACH,qBACa,OAAQ,SAAQ,aAAa;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACS,CAAC,SAAU;IACvB;;OAEG;IACS,CAAC,SAAU;IAEvB,MAAM,CAAC,MAAM,4BAOX;IAEF,SAAS,CAAC,MAAM,IAAI,YAAY;IAIhC,SAAS,CAAC,YAAY;IAKtB,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU;IASxC,SAAS,CAAC,cAAc;IAKxB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,UAAU;IAsBnC,KAAK;CAUN;AAED,eAAe,OAAO,CAAC;AACvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,OAAO,CAAC;KACtB;CACF"}
1
+ {"version":3,"file":"dragbox.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/wrapper/dragbox.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D;;GAEG;AACH,qBAca,OAAQ,SAAQ,aAAa;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACS,CAAC,SAAU;IACvB;;OAEG;IACS,CAAC,SAAU;IAEvB,SAAS,CAAC,MAAM;IAIhB,SAAS,CAAC,YAAY;IAItB,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU;IAUxC,cAAc,EAAE,YAAY,CAAC;IAC7B,eAAe,EAAE,YAAY,CAAC;IAE9B,SAAS,CAAC,cAAc;IAMxB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,UAAU;IAuBnC,KAAK;CAWN;AAED,eAAe,OAAO,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, property } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { htmlSlot } from "../../lib/templates.js";
5
- import { GodownElement } from "../../supers/root.js";
6
- const defineName = "dragbox";
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 { GodownElement } from "../../proto/godown-element.js";
7
+ const protoName = "dragbox";
7
8
  /**
8
9
  * {@linkcode Dragbox} does not extend beyond the range of {@linkcode Dragbox.offsetsWidth} and {@linkcode Dragbox.offsetsHeight}.
9
10
  */
@@ -24,7 +25,6 @@ let Dragbox = class Dragbox extends GodownElement {
24
25
  }
25
26
  firstUpdated() {
26
27
  this.reset();
27
- this.addEvent(document, "mouseup", this._handleDragEnd.bind(this));
28
28
  }
29
29
  _handleDragStart(e) {
30
30
  this.cx = e.clientX;
@@ -32,11 +32,13 @@ let Dragbox = class Dragbox extends GodownElement {
32
32
  this.t = this.offsetTop;
33
33
  this.l = this.offsetLeft;
34
34
  this.drag = true;
35
- this.addEvent(document, "mousemove", this._handleDrag.bind(this), undefined, "0");
35
+ this.mouseMoveEvent = this.addEvent(document, "mousemove", this._handleDrag.bind(this));
36
+ this.mouseLeaveEvent = this.addEvent(document, "mouseleave", this._handleDragEnd.bind(this));
36
37
  }
37
38
  _handleDragEnd() {
38
39
  this.drag = false;
39
- this.removeEvent(document, "mousemove", "0");
40
+ this.removeEvent(document, "mousemove", this.mouseMoveEvent);
41
+ this.removeEvent(document, "mouseleave", this.mouseLeaveEvent);
40
42
  }
41
43
  _handleDrag(e) {
42
44
  if (!this.drag) {
@@ -44,44 +46,38 @@ let Dragbox = class Dragbox extends GodownElement {
44
46
  }
45
47
  const nl = e.clientX - (this.cx - this.l);
46
48
  const nt = e.clientY - (this.cy - this.t);
49
+ const { style, offsetsWidth, offsetsHeight, offsetWidth, offsetHeight } = this;
47
50
  if (nl < 0) {
48
- this.style.left = "0";
51
+ style.left = "0";
49
52
  }
50
- else if (nl < this.offsetsWidth - this.offsetWidth) {
51
- this.style.left = `${nl}px`;
53
+ else if (nl < offsetsWidth - offsetWidth) {
54
+ style.left = `${nl}px`;
52
55
  }
53
56
  else {
54
- this.style.left = `${this.offsetsWidth - this.offsetWidth}"px"`;
57
+ style.left = `${offsetsWidth - offsetWidth}"px"`;
55
58
  }
56
59
  if (nt < 0) {
57
- this.style.top = "0";
60
+ style.top = "0";
58
61
  }
59
- else if (nt < this.offsetsHeight - this.offsetHeight) {
60
- this.style.top = `${nt}px`;
62
+ else if (nt < offsetsHeight - offsetHeight) {
63
+ style.top = `${nt}px`;
61
64
  }
62
65
  else {
63
- this.style.top = `${this.offsetsHeight - this.offsetHeight}px`;
66
+ style.top = `${offsetsHeight - offsetHeight}px`;
64
67
  }
65
68
  }
66
69
  reset() {
67
- this.style.left = this.x || "0";
68
- this.style.top = this.y || "0";
69
- if (this.offsetLeft > this.offsetsWidth - this.offsetWidth) {
70
- this.style.left = `${this.offsetsWidth - this.offsetWidth}px`;
70
+ const { x, y, style, offsetsWidth, offsetsHeight, offsetWidth, offsetHeight, offsetLeft, offsetTop } = this;
71
+ style.left = x || "0";
72
+ style.top = y || "0";
73
+ if (offsetLeft > offsetsWidth - offsetWidth) {
74
+ style.left = `${offsetsWidth - offsetWidth}px`;
71
75
  }
72
- if (this.offsetTop > this.offsetsHeight - this.offsetHeight) {
73
- this.style.top = `${this.offsetsHeight - this.offsetHeight}px`;
76
+ if (offsetTop > offsetsHeight - offsetHeight) {
77
+ style.top = `${offsetsHeight - offsetHeight}px`;
74
78
  }
75
79
  }
76
80
  };
77
- Dragbox.styles = [
78
- css `
79
- :host {
80
- position: relative;
81
- display: inline-flex;
82
- }
83
- `,
84
- ];
85
81
  __decorate([
86
82
  property()
87
83
  ], Dragbox.prototype, "x", void 0);
@@ -89,7 +85,20 @@ __decorate([
89
85
  property()
90
86
  ], Dragbox.prototype, "y", void 0);
91
87
  Dragbox = __decorate([
92
- define(defineName)
88
+ godown(protoName),
89
+ styles([
90
+ css `
91
+ :host {
92
+ position: absolute;
93
+ display: block;
94
+ }
95
+
96
+ :host(:active) {
97
+ -webkit-user-select: none;
98
+ user-select: none;
99
+ }
100
+ `,
101
+ ])
93
102
  ], Dragbox);
94
103
  export { Dragbox };
95
104
  export default Dragbox;
@@ -1 +1 @@
1
- {"version":3,"file":"dragbox.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/wrapper/dragbox.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,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;GAEG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,aAAa;IAAnC;;QAOL;;WAEG;QACS,MAAC,GAAG,MAAM,CAAC;QACvB;;WAEG;QACS,MAAC,GAAG,MAAM,CAAC;IAkEzB,CAAC;IAvDW,MAAM;QACd,OAAO,IAAI,CAAA,oBAAoB,IAAI,CAAC,gBAAgB,eAAe,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE,QAAQ,CAAC;IAChH,CAAC;IAES,YAAY;QACpB,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,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AC;GACN,OAAO,CAgFnB;;AAED,eAAe,OAAO,CAAC","sourcesContent":["import { css, html, property } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { GodownElement } from \"../../supers/root.js\";\n\nconst defineName = \"dragbox\";\n\n/**\n * {@linkcode Dragbox} does not extend beyond the range of {@linkcode Dragbox.offsetsWidth} and {@linkcode Dragbox.offsetsHeight}.\n */\n@define(defineName)\nexport class Dragbox extends GodownElement {\n drag: boolean;\n t: number;\n l: number;\n cx: number;\n cy: number;\n\n /**\n * Position x.\n */\n @property() x = \"auto\";\n /**\n * Position y.\n */\n @property() y = \"auto\";\n\n static styles = [\n css`\n :host {\n position: relative;\n display: inline-flex;\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n return html`<div @mousedown=\"${this._handleDragStart}\" @mouseup=\"${this._handleDragEnd}\">${htmlSlot()}</div>`;\n }\n\n protected firstUpdated() {\n this.reset();\n this.addEvent(document, \"mouseup\", this._handleDragEnd.bind(this));\n }\n\n protected _handleDragStart(e: MouseEvent) {\n this.cx = e.clientX;\n this.cy = e.clientY;\n this.t = this.offsetTop;\n this.l = this.offsetLeft;\n this.drag = true;\n this.addEvent(document, \"mousemove\", this._handleDrag.bind(this), undefined, \"0\");\n }\n\n protected _handleDragEnd() {\n this.drag = false;\n this.removeEvent(document, \"mousemove\", \"0\");\n }\n\n protected _handleDrag(e: MouseEvent) {\n if (!this.drag) {\n return;\n }\n const nl = e.clientX - (this.cx - this.l);\n const nt = e.clientY - (this.cy - this.t);\n if (nl < 0) {\n this.style.left = \"0\";\n } else if (nl < this.offsetsWidth - this.offsetWidth) {\n this.style.left = `${nl}px`;\n } else {\n this.style.left = `${this.offsetsWidth - this.offsetWidth}\"px\"`;\n }\n if (nt < 0) {\n this.style.top = \"0\";\n } else if (nt < this.offsetsHeight - this.offsetHeight) {\n this.style.top = `${nt}px`;\n } else {\n this.style.top = `${this.offsetsHeight - this.offsetHeight}px`;\n }\n }\n\n reset() {\n this.style.left = this.x || \"0\";\n this.style.top = this.y || \"0\";\n if (this.offsetLeft > this.offsetsWidth - this.offsetWidth) {\n this.style.left = `${this.offsetsWidth - this.offsetWidth}px`;\n }\n if (this.offsetTop > this.offsetsHeight - this.offsetHeight) {\n this.style.top = `${this.offsetsHeight - this.offsetHeight}px`;\n }\n }\n}\n\nexport default Dragbox;\ndeclare global {\n interface HTMLElementTagNameMap {\n \"drag-box\": Dragbox;\n \"g-dragbox\": Dragbox;\n }\n}\n"]}
1
+ {"version":3,"file":"dragbox.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/wrapper/dragbox.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,MAAM,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B;;GAEG;AAeI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,aAAa;IAAnC;;QAOL;;WAEG;QACS,MAAC,GAAG,MAAM,CAAC;QACvB;;WAEG;QACS,MAAC,GAAG,MAAM,CAAC;IA+DzB,CAAC;IA7DW,MAAM;QACd,OAAO,IAAI,CAAA,oBAAoB,IAAI,CAAC,gBAAgB,eAAe,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE,QAAQ,CAAC;IAChH,CAAC;IAES,YAAY;QACpB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAES,gBAAgB,CAAC,CAAa;QACtC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC;QACpB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC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EnB;;AAED,eAAe,OAAO,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 { ListenerFunc } from \"../../lib/event-coll.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\n\nconst protoName = \"dragbox\";\n\n/**\n * {@linkcode Dragbox} does not extend beyond the range of {@linkcode Dragbox.offsetsWidth} and {@linkcode Dragbox.offsetsHeight}.\n */\n@godown(protoName)\n@styles([\n css`\n :host {\n position: absolute;\n display: block;\n }\n\n :host(:active) {\n -webkit-user-select: none;\n user-select: none;\n }\n `,\n])\nexport class Dragbox extends GodownElement {\n drag: boolean;\n t: number;\n l: number;\n cx: number;\n cy: number;\n\n /**\n * Position x.\n */\n @property() x = \"auto\";\n /**\n * Position y.\n */\n @property() y = \"auto\";\n\n protected render() {\n return html`<div @mousedown=\"${this._handleDragStart}\" @mouseup=\"${this._handleDragEnd}\">${htmlSlot()}</div>`;\n }\n\n protected firstUpdated() {\n this.reset();\n }\n\n protected _handleDragStart(e: MouseEvent) {\n this.cx = e.clientX;\n this.cy = e.clientY;\n this.t = this.offsetTop;\n this.l = this.offsetLeft;\n this.drag = true;\n this.mouseMoveEvent = this.addEvent(document, \"mousemove\", this._handleDrag.bind(this));\n this.mouseLeaveEvent = this.addEvent(document, \"mouseleave\", this._handleDragEnd.bind(this));\n }\n\n mouseMoveEvent: ListenerFunc;\n mouseLeaveEvent: ListenerFunc;\n\n protected _handleDragEnd() {\n this.drag = false;\n this.removeEvent(document, \"mousemove\", this.mouseMoveEvent);\n this.removeEvent(document, \"mouseleave\", this.mouseLeaveEvent);\n }\n\n protected _handleDrag(e: MouseEvent) {\n if (!this.drag) {\n return;\n }\n const nl = e.clientX - (this.cx - this.l);\n const nt = e.clientY - (this.cy - this.t);\n const { style, offsetsWidth, offsetsHeight, offsetWidth, offsetHeight } = this;\n if (nl < 0) {\n style.left = \"0\";\n } else if (nl < offsetsWidth - offsetWidth) {\n style.left = `${nl}px`;\n } else {\n style.left = `${offsetsWidth - offsetWidth}\"px\"`;\n }\n if (nt < 0) {\n style.top = \"0\";\n } else if (nt < offsetsHeight - offsetHeight) {\n style.top = `${nt}px`;\n } else {\n style.top = `${offsetsHeight - offsetHeight}px`;\n }\n }\n\n reset() {\n const { x, y, style, offsetsWidth, offsetsHeight, offsetWidth, offsetHeight, offsetLeft, offsetTop } = this;\n style.left = x || \"0\";\n style.top = y || \"0\";\n if (offsetLeft > offsetsWidth - offsetWidth) {\n style.left = `${offsetsWidth - offsetWidth}px`;\n }\n if (offsetTop > offsetsHeight - offsetHeight) {\n style.top = `${offsetsHeight - offsetHeight}px`;\n }\n }\n}\n\nexport default Dragbox;\n"]}
@@ -0,0 +1,30 @@
1
+ import { GodownElement } from "../../proto/godown-element.js";
2
+ /**
3
+ * {@linkcode Rotate} Make child elements rotate.
4
+ */
5
+ export declare class Rotate extends GodownElement {
6
+ _root: HTMLElement;
7
+ protected render(): import("lit").TemplateResult<1>;
8
+ /**
9
+ * Cancel the offset.
10
+ */
11
+ reset(): void;
12
+ /**
13
+ * Apply offset.
14
+ */
15
+ protected _handleRotate(e: MouseEvent): void;
16
+ /**
17
+ * Compute offset.
18
+ * ```
19
+ * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`
20
+ * ```
21
+ * @param e Mouse move event.
22
+ * @returns rotateX, rotateY
23
+ */
24
+ _computeOffset(e: MouseEvent): {
25
+ rotateX: number;
26
+ rotateY: number;
27
+ };
28
+ }
29
+ export default Rotate;
30
+ //# sourceMappingURL=rotate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotate.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/wrapper/rotate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D;;GAEG;AACH,qBA+Ba,MAAO,SAAQ,aAAa;IACzB,KAAK,EAAE,WAAW,CAAC;IAEjC,SAAS,CAAC,MAAM;IAOhB;;OAEG;IACH,KAAK;IAKL;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU;IAMrC;;;;;;;OAOG;IACH,cAAc,CAAC,CAAC,EAAE,UAAU;;;;CAU7B;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { part } from "../../decorators/part.js";
5
+ import { styles } from "../../decorators/styles.js";
6
+ import { htmlSlot } from "../../lib/directives.js";
7
+ import { GodownElement } from "../../proto/godown-element.js";
8
+ import { createScope } from "../../styles/global.js";
9
+ const protoName = "rotate";
10
+ const cssScope = createScope(protoName);
11
+ /**
12
+ * {@linkcode Rotate} Make child elements rotate.
13
+ */
14
+ let Rotate = class Rotate extends GodownElement {
15
+ render() {
16
+ return html `<div part="root">
17
+ <div part="slot" @mousemove="${this._handleRotate}">${htmlSlot()}</div>
18
+ <i @mouseleave="${this.reset}"></i>
19
+ </div>`;
20
+ }
21
+ /**
22
+ * Cancel the offset.
23
+ */
24
+ reset() {
25
+ this._root.style.removeProperty("transform");
26
+ this._root.style.removeProperty("transition");
27
+ }
28
+ /**
29
+ * Apply offset.
30
+ */
31
+ _handleRotate(e) {
32
+ const { rotateX, rotateY } = this._computeOffset(e);
33
+ this._root.style.setProperty("transform", `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`);
34
+ this._root.style.setProperty("transition", "0s");
35
+ }
36
+ /**
37
+ * Compute offset.
38
+ * ```
39
+ * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`
40
+ * ```
41
+ * @param e Mouse move event.
42
+ * @returns rotateX, rotateY
43
+ */
44
+ _computeOffset(e) {
45
+ const { left, top, width, height } = this._root.getBoundingClientRect();
46
+ const { clientX, clientY } = e;
47
+ const offsetX = clientX - left;
48
+ const offsetY = clientY - top;
49
+ const rotateX = -(offsetY - height / 2) / height / 2;
50
+ const rotateY = (offsetX - width / 2) / width / 2;
51
+ return { rotateX, rotateY };
52
+ }
53
+ };
54
+ __decorate([
55
+ part("root")
56
+ ], Rotate.prototype, "_root", void 0);
57
+ Rotate = __decorate([
58
+ godown(protoName),
59
+ styles(css `
60
+ :host {
61
+ display: block;
62
+ width: -moz-fit-content;
63
+ width: fit-content;
64
+ transition: all 0.5s ease-in-out;
65
+ --${cssScope}--padding: .75em;
66
+ --${cssScope}--offset: .5em;
67
+ }
68
+
69
+ div {
70
+ position: relative;
71
+ transition: inherit;
72
+ transition-property: transform;
73
+ }
74
+
75
+ i {
76
+ width: 100%;
77
+ height: 100%;
78
+ position: absolute;
79
+ top: 0;
80
+ box-sizing: content-box;
81
+ padding: var(--${cssScope}--offset);
82
+ margin: calc(-1 * var(--${cssScope}--offset));
83
+ }
84
+
85
+ [part="slot"]{
86
+ z-index: 2;
87
+ }
88
+ `)
89
+ ], Rotate);
90
+ export { Rotate };
91
+ export default Rotate;
92
+ //# sourceMappingURL=rotate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotate.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/wrapper/rotate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,SA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C,CAAC;QAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACF,CAAA;AA5Ce;IAAb,IAAI,CAAC,MAAM,CAAC;qCAAoB;AADtB,MAAM;IA/BlB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC,GAAG,CAAA;;;;;;QAMH,QAAQ;QACR,QAAQ;;;;;;;;;;;;;;;qBAeK,QAAQ;8BACC,QAAQ;;;;;;CAMrC,CAAC;GACW,MAAM,CA6ClB;;AAED,eAAe,MAAM,CAAC","sourcesContent":["import { css, html } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { part } from \"../../decorators/part.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\nimport { createScope } from \"../../styles/global.js\";\n\nconst protoName = \"rotate\";\nconst cssScope = createScope(protoName);\n\n/**\n * {@linkcode Rotate} Make child elements rotate.\n */\n@godown(protoName)\n@styles(css`\n :host {\n display: block;\n width: -moz-fit-content;\n width: fit-content;\n transition: all 0.5s ease-in-out;\n --${cssScope}--padding: .75em;\n --${cssScope}--offset: .5em;\n }\n\n div {\n position: relative;\n transition: inherit;\n transition-property: transform;\n }\n\n i {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n box-sizing: content-box;\n padding: var(--${cssScope}--offset);\n margin: calc(-1 * var(--${cssScope}--offset));\n }\n\n [part=\"slot\"]{\n z-index: 2;\n }\n`)\nexport class Rotate extends GodownElement {\n @part(\"root\") _root: HTMLElement;\n\n protected render() {\n return html`<div part=\"root\">\n <div part=\"slot\" @mousemove=\"${this._handleRotate}\">${htmlSlot()}</div>\n <i @mouseleave=\"${this.reset}\"></i>\n </div>`;\n }\n\n /**\n * Cancel the offset.\n */\n reset() {\n this._root.style.removeProperty(\"transform\");\n this._root.style.removeProperty(\"transition\");\n }\n\n /**\n * Apply offset.\n */\n protected _handleRotate(e: MouseEvent) {\n const { rotateX, rotateY } = this._computeOffset(e);\n this._root.style.setProperty(\"transform\", `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`);\n this._root.style.setProperty(\"transition\", \"0s\");\n }\n\n /**\n * Compute offset.\n * ```\n * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`\n * ```\n * @param e Mouse move event.\n * @returns rotateX, rotateY\n */\n _computeOffset(e: MouseEvent) {\n const { left, top, width, height } = this._root.getBoundingClientRect();\n const { clientX, clientY } = e;\n const offsetX = clientX - left;\n const offsetY = clientY - top;\n\n const rotateX = -(offsetY - height / 2) / height / 2;\n const rotateY = (offsetX - width / 2) / width / 2;\n return { rotateX, rotateY };\n }\n}\n\nexport default Rotate;\n"]}
package/.deps.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":".deps.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":[".deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAuB,OAAO,EAAyB,MAAM,KAAK,CAAC;AACrG,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { html, svg, css, unsafeCSS, type CSSResultGroup, nothing, type PropertyValueMap } from \"lit\";\nexport * from \"lit/decorators.js\";\nexport { ifDefined } from \"lit/directives/if-defined.js\";\nexport { classMap } from \"lit/directives/class-map.js\";\n"]}