@omegagrid/core 0.10.2 → 0.10.5

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 (317) hide show
  1. package/dist/common/actions.d.ts +16 -0
  2. package/dist/common/actions.d.ts.map +1 -0
  3. package/dist/common/actions.js +14 -0
  4. package/dist/common/actions.js.map +1 -0
  5. package/dist/common/colors.d.ts +39 -0
  6. package/dist/common/colors.d.ts.map +1 -0
  7. package/dist/common/colors.js +59 -0
  8. package/dist/common/colors.js.map +1 -0
  9. package/dist/common/csv.d.ts +23 -0
  10. package/dist/common/csv.d.ts.map +1 -0
  11. package/dist/common/csv.js +93 -0
  12. package/dist/common/csv.js.map +1 -0
  13. package/dist/common/dates.d.ts +32 -0
  14. package/dist/common/dates.d.ts.map +1 -0
  15. package/dist/common/dates.js +172 -0
  16. package/dist/common/dates.js.map +1 -0
  17. package/dist/common/device.d.ts +2 -0
  18. package/dist/common/device.d.ts.map +1 -0
  19. package/dist/common/device.js +13 -0
  20. package/dist/common/device.js.map +1 -0
  21. package/dist/common/dom.d.ts +90 -0
  22. package/dist/common/dom.d.ts.map +1 -0
  23. package/dist/common/dom.js +308 -0
  24. package/dist/common/dom.js.map +1 -0
  25. package/dist/common/events.d.ts +15 -0
  26. package/dist/common/events.d.ts.map +1 -0
  27. package/dist/common/events.js +33 -0
  28. package/dist/common/events.js.map +1 -0
  29. package/dist/common/html.d.ts +3 -0
  30. package/dist/common/html.d.ts.map +1 -0
  31. package/dist/common/html.js +25 -0
  32. package/dist/common/html.js.map +1 -0
  33. package/dist/common/index.d.ts +19 -0
  34. package/dist/common/index.d.ts.map +1 -0
  35. package/dist/common/index.js +19 -0
  36. package/dist/common/index.js.map +1 -0
  37. package/dist/common/linkedList.d.ts +24 -0
  38. package/dist/common/linkedList.d.ts.map +1 -0
  39. package/dist/common/linkedList.js +65 -0
  40. package/dist/common/linkedList.js.map +1 -0
  41. package/dist/common/loaders.d.ts +17 -0
  42. package/dist/common/loaders.d.ts.map +1 -0
  43. package/dist/common/loaders.js +54 -0
  44. package/dist/common/loaders.js.map +1 -0
  45. package/dist/common/logger.d.ts +25 -0
  46. package/dist/common/logger.d.ts.map +1 -0
  47. package/dist/common/logger.js +57 -0
  48. package/dist/common/logger.js.map +1 -0
  49. package/dist/common/matrix.d.ts +6 -0
  50. package/dist/common/matrix.d.ts.map +1 -0
  51. package/dist/common/matrix.js +17 -0
  52. package/dist/common/matrix.js.map +1 -0
  53. package/dist/common/numbers.d.ts +26 -0
  54. package/dist/common/numbers.d.ts.map +1 -0
  55. package/dist/common/numbers.js +239 -0
  56. package/dist/common/numbers.js.map +1 -0
  57. package/dist/common/options.d.ts +17 -0
  58. package/dist/common/options.d.ts.map +1 -0
  59. package/dist/common/options.js +29 -0
  60. package/dist/common/options.js.map +1 -0
  61. package/dist/common/paper.d.ts +8 -0
  62. package/dist/common/paper.d.ts.map +1 -0
  63. package/dist/common/paper.js +17 -0
  64. package/dist/common/paper.js.map +1 -0
  65. package/dist/common/shortcutManager.d.ts +17 -0
  66. package/dist/common/shortcutManager.d.ts.map +1 -0
  67. package/dist/common/shortcutManager.js +49 -0
  68. package/dist/common/shortcutManager.js.map +1 -0
  69. package/dist/common/tree.d.ts +87 -0
  70. package/dist/common/tree.d.ts.map +1 -0
  71. package/dist/common/tree.js +204 -0
  72. package/dist/common/tree.js.map +1 -0
  73. package/dist/common/utils.d.ts +30 -0
  74. package/dist/common/utils.d.ts.map +1 -0
  75. package/dist/common/utils.js +136 -0
  76. package/dist/common/utils.js.map +1 -0
  77. package/dist/constants.d.ts +48 -0
  78. package/dist/constants.d.ts.map +1 -0
  79. package/dist/constants.js +24 -0
  80. package/dist/constants.js.map +1 -0
  81. package/dist/index.d.ts +8 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +8 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/model/adapter.d.ts +8 -0
  86. package/dist/model/adapter.d.ts.map +1 -0
  87. package/dist/model/adapter.js +13 -0
  88. package/dist/model/adapter.js.map +1 -0
  89. package/dist/model/component.d.ts +19 -0
  90. package/dist/model/component.d.ts.map +1 -0
  91. package/dist/model/component.js +84 -0
  92. package/dist/model/component.js.map +1 -0
  93. package/dist/model/componentSlice.d.ts +8 -0
  94. package/dist/model/componentSlice.d.ts.map +1 -0
  95. package/dist/model/componentSlice.js +10 -0
  96. package/dist/model/componentSlice.js.map +1 -0
  97. package/dist/model/componentStore.d.ts +12 -0
  98. package/dist/model/componentStore.d.ts.map +1 -0
  99. package/dist/model/componentStore.js +26 -0
  100. package/dist/model/componentStore.js.map +1 -0
  101. package/dist/model/index.d.ts +6 -0
  102. package/dist/model/index.d.ts.map +1 -0
  103. package/dist/model/index.js +6 -0
  104. package/dist/model/index.js.map +1 -0
  105. package/dist/model/plugins.d.ts +13 -0
  106. package/dist/model/plugins.d.ts.map +1 -0
  107. package/dist/model/plugins.js +27 -0
  108. package/dist/model/plugins.js.map +1 -0
  109. package/dist/themes/definitions/tmDark.d.ts +4 -0
  110. package/dist/themes/definitions/tmDark.d.ts.map +1 -0
  111. package/dist/themes/definitions/tmDark.js +83 -0
  112. package/dist/themes/definitions/tmDark.js.map +1 -0
  113. package/dist/themes/definitions/tmLight.d.ts +4 -0
  114. package/dist/themes/definitions/tmLight.d.ts.map +1 -0
  115. package/dist/themes/definitions/tmLight.js +83 -0
  116. package/dist/themes/definitions/tmLight.js.map +1 -0
  117. package/dist/themes/helpers.d.ts +7 -0
  118. package/dist/themes/helpers.d.ts.map +1 -0
  119. package/dist/themes/helpers.js +34 -0
  120. package/dist/themes/helpers.js.map +1 -0
  121. package/dist/themes/index.d.ts +18 -0
  122. package/dist/themes/index.d.ts.map +1 -0
  123. package/dist/themes/index.js +48 -0
  124. package/dist/themes/index.js.map +1 -0
  125. package/dist/themes/mixins.d.ts +10 -0
  126. package/dist/themes/mixins.d.ts.map +1 -0
  127. package/dist/themes/mixins.js +39 -0
  128. package/dist/themes/mixins.js.map +1 -0
  129. package/dist/themes/transformations.d.ts +9 -0
  130. package/dist/themes/transformations.d.ts.map +1 -0
  131. package/dist/themes/transformations.js +48 -0
  132. package/dist/themes/transformations.js.map +1 -0
  133. package/dist/types.d.ts +130 -0
  134. package/dist/types.d.ts.map +1 -0
  135. package/dist/types.js +12 -0
  136. package/dist/types.js.map +1 -0
  137. package/dist/ui/accordion.d.ts +16 -0
  138. package/dist/ui/accordion.d.ts.map +1 -0
  139. package/dist/ui/accordion.js +209 -0
  140. package/dist/ui/accordion.js.map +1 -0
  141. package/dist/ui/alert.d.ts +15 -0
  142. package/dist/ui/alert.d.ts.map +1 -0
  143. package/dist/ui/alert.js +101 -0
  144. package/dist/ui/alert.js.map +1 -0
  145. package/dist/ui/baseElement.d.ts +7 -0
  146. package/dist/ui/baseElement.d.ts.map +1 -0
  147. package/dist/ui/baseElement.js +10 -0
  148. package/dist/ui/baseElement.js.map +1 -0
  149. package/dist/ui/button.d.ts +21 -0
  150. package/dist/ui/button.d.ts.map +1 -0
  151. package/dist/ui/button.js +100 -0
  152. package/dist/ui/button.js.map +1 -0
  153. package/dist/ui/button.style.d.ts +2 -0
  154. package/dist/ui/button.style.d.ts.map +1 -0
  155. package/dist/ui/button.style.js +60 -0
  156. package/dist/ui/button.style.js.map +1 -0
  157. package/dist/ui/checkbox.d.ts +14 -0
  158. package/dist/ui/checkbox.d.ts.map +1 -0
  159. package/dist/ui/checkbox.js +47 -0
  160. package/dist/ui/checkbox.js.map +1 -0
  161. package/dist/ui/close.d.ts +6 -0
  162. package/dist/ui/close.d.ts.map +1 -0
  163. package/dist/ui/close.js +33 -0
  164. package/dist/ui/close.js.map +1 -0
  165. package/dist/ui/colorpicker.d.ts +24 -0
  166. package/dist/ui/colorpicker.d.ts.map +1 -0
  167. package/dist/ui/colorpicker.js +228 -0
  168. package/dist/ui/colorpicker.js.map +1 -0
  169. package/dist/ui/container.d.ts +39 -0
  170. package/dist/ui/container.d.ts.map +1 -0
  171. package/dist/ui/container.js +313 -0
  172. package/dist/ui/container.js.map +1 -0
  173. package/dist/ui/dropdown.d.ts +48 -0
  174. package/dist/ui/dropdown.d.ts.map +1 -0
  175. package/dist/ui/dropdown.js +300 -0
  176. package/dist/ui/dropdown.js.map +1 -0
  177. package/dist/ui/dropdownColorPicker.d.ts +12 -0
  178. package/dist/ui/dropdownColorPicker.d.ts.map +1 -0
  179. package/dist/ui/dropdownColorPicker.js +60 -0
  180. package/dist/ui/dropdownColorPicker.js.map +1 -0
  181. package/dist/ui/dropdownList.d.ts +8 -0
  182. package/dist/ui/dropdownList.d.ts.map +1 -0
  183. package/dist/ui/dropdownList.js +48 -0
  184. package/dist/ui/dropdownList.js.map +1 -0
  185. package/dist/ui/dropdownMenu.d.ts +11 -0
  186. package/dist/ui/dropdownMenu.d.ts.map +1 -0
  187. package/dist/ui/dropdownMenu.js +61 -0
  188. package/dist/ui/dropdownMenu.js.map +1 -0
  189. package/dist/ui/expander.d.ts +28 -0
  190. package/dist/ui/expander.d.ts.map +1 -0
  191. package/dist/ui/expander.js +144 -0
  192. package/dist/ui/expander.js.map +1 -0
  193. package/dist/ui/fileInput.d.ts +24 -0
  194. package/dist/ui/fileInput.d.ts.map +1 -0
  195. package/dist/ui/fileInput.js +130 -0
  196. package/dist/ui/fileInput.js.map +1 -0
  197. package/dist/ui/fileInput.style.d.ts +2 -0
  198. package/dist/ui/fileInput.style.d.ts.map +1 -0
  199. package/dist/ui/fileInput.style.js +73 -0
  200. package/dist/ui/fileInput.style.js.map +1 -0
  201. package/dist/ui/floatingWindow.d.ts +19 -0
  202. package/dist/ui/floatingWindow.d.ts.map +1 -0
  203. package/dist/ui/floatingWindow.js +87 -0
  204. package/dist/ui/floatingWindow.js.map +1 -0
  205. package/dist/ui/icon.d.ts +46 -0
  206. package/dist/ui/icon.d.ts.map +1 -0
  207. package/dist/ui/icon.js +189 -0
  208. package/dist/ui/icon.js.map +1 -0
  209. package/dist/ui/icon.style.d.ts +2 -0
  210. package/dist/ui/icon.style.d.ts.map +1 -0
  211. package/dist/ui/icon.style.js +556 -0
  212. package/dist/ui/icon.style.js.map +1 -0
  213. package/dist/ui/images.d.ts +2 -0
  214. package/dist/ui/images.d.ts.map +1 -0
  215. package/dist/ui/images.js +14 -0
  216. package/dist/ui/images.js.map +1 -0
  217. package/dist/ui/index.d.ts +32 -0
  218. package/dist/ui/index.d.ts.map +1 -0
  219. package/dist/ui/index.js +32 -0
  220. package/dist/ui/index.js.map +1 -0
  221. package/dist/ui/input.d.ts +12 -0
  222. package/dist/ui/input.d.ts.map +1 -0
  223. package/dist/ui/input.js +45 -0
  224. package/dist/ui/input.js.map +1 -0
  225. package/dist/ui/input.style.d.ts +2 -0
  226. package/dist/ui/input.style.d.ts.map +1 -0
  227. package/dist/ui/input.style.js +36 -0
  228. package/dist/ui/input.style.js.map +1 -0
  229. package/dist/ui/label.d.ts +16 -0
  230. package/dist/ui/label.d.ts.map +1 -0
  231. package/dist/ui/label.js +90 -0
  232. package/dist/ui/label.js.map +1 -0
  233. package/dist/ui/list.d.ts +87 -0
  234. package/dist/ui/list.d.ts.map +1 -0
  235. package/dist/ui/list.js +427 -0
  236. package/dist/ui/list.js.map +1 -0
  237. package/dist/ui/list.style.d.ts +2 -0
  238. package/dist/ui/list.style.d.ts.map +1 -0
  239. package/dist/ui/list.style.js +35 -0
  240. package/dist/ui/list.style.js.map +1 -0
  241. package/dist/ui/loader.d.ts +6 -0
  242. package/dist/ui/loader.d.ts.map +1 -0
  243. package/dist/ui/loader.js +25 -0
  244. package/dist/ui/loader.js.map +1 -0
  245. package/dist/ui/menu.d.ts +41 -0
  246. package/dist/ui/menu.d.ts.map +1 -0
  247. package/dist/ui/menu.js +154 -0
  248. package/dist/ui/menu.js.map +1 -0
  249. package/dist/ui/menu.style.d.ts +3 -0
  250. package/dist/ui/menu.style.d.ts.map +1 -0
  251. package/dist/ui/menu.style.js +50 -0
  252. package/dist/ui/menu.style.js.map +1 -0
  253. package/dist/ui/numericInput.d.ts +37 -0
  254. package/dist/ui/numericInput.d.ts.map +1 -0
  255. package/dist/ui/numericInput.js +175 -0
  256. package/dist/ui/numericInput.js.map +1 -0
  257. package/dist/ui/numericInput.style.d.ts +2 -0
  258. package/dist/ui/numericInput.style.d.ts.map +1 -0
  259. package/dist/ui/numericInput.style.js +29 -0
  260. package/dist/ui/numericInput.style.js.map +1 -0
  261. package/dist/ui/overlay.d.ts +17 -0
  262. package/dist/ui/overlay.d.ts.map +1 -0
  263. package/dist/ui/overlay.js +87 -0
  264. package/dist/ui/overlay.js.map +1 -0
  265. package/dist/ui/overlay.style.d.ts +2 -0
  266. package/dist/ui/overlay.style.d.ts.map +1 -0
  267. package/dist/ui/overlay.style.js +46 -0
  268. package/dist/ui/overlay.style.js.map +1 -0
  269. package/dist/ui/panel.d.ts +25 -0
  270. package/dist/ui/panel.d.ts.map +1 -0
  271. package/dist/ui/panel.js +151 -0
  272. package/dist/ui/panel.js.map +1 -0
  273. package/dist/ui/panel.style.d.ts +2 -0
  274. package/dist/ui/panel.style.d.ts.map +1 -0
  275. package/dist/ui/panel.style.js +73 -0
  276. package/dist/ui/panel.style.js.map +1 -0
  277. package/dist/ui/sizer.d.ts +57 -0
  278. package/dist/ui/sizer.d.ts.map +1 -0
  279. package/dist/ui/sizer.js +224 -0
  280. package/dist/ui/sizer.js.map +1 -0
  281. package/dist/ui/slider.d.ts +52 -0
  282. package/dist/ui/slider.d.ts.map +1 -0
  283. package/dist/ui/slider.js +213 -0
  284. package/dist/ui/slider.js.map +1 -0
  285. package/dist/ui/slider.style.d.ts +2 -0
  286. package/dist/ui/slider.style.d.ts.map +1 -0
  287. package/dist/ui/slider.style.js +61 -0
  288. package/dist/ui/slider.style.js.map +1 -0
  289. package/dist/ui/sortableList.d.ts +39 -0
  290. package/dist/ui/sortableList.d.ts.map +1 -0
  291. package/dist/ui/sortableList.js +167 -0
  292. package/dist/ui/sortableList.js.map +1 -0
  293. package/dist/ui/splitContainer.d.ts +52 -0
  294. package/dist/ui/splitContainer.d.ts.map +1 -0
  295. package/dist/ui/splitContainer.js +252 -0
  296. package/dist/ui/splitContainer.js.map +1 -0
  297. package/dist/ui/splitContainer.style.d.ts +2 -0
  298. package/dist/ui/splitContainer.style.d.ts.map +1 -0
  299. package/dist/ui/splitContainer.style.js +62 -0
  300. package/dist/ui/splitContainer.style.js.map +1 -0
  301. package/dist/ui/switch.d.ts +22 -0
  302. package/dist/ui/switch.d.ts.map +1 -0
  303. package/dist/ui/switch.js +83 -0
  304. package/dist/ui/switch.js.map +1 -0
  305. package/dist/ui/switch.style.d.ts +2 -0
  306. package/dist/ui/switch.style.d.ts.map +1 -0
  307. package/dist/ui/switch.style.js +149 -0
  308. package/dist/ui/switch.style.js.map +1 -0
  309. package/dist/ui/tooltip.d.ts +24 -0
  310. package/dist/ui/tooltip.d.ts.map +1 -0
  311. package/dist/ui/tooltip.js +143 -0
  312. package/dist/ui/tooltip.js.map +1 -0
  313. package/dist/ui/tooltip.style.d.ts +2 -0
  314. package/dist/ui/tooltip.style.d.ts.map +1 -0
  315. package/dist/ui/tooltip.style.js +112 -0
  316. package/dist/ui/tooltip.style.js.map +1 -0
  317. package/package.json +2 -2
@@ -0,0 +1,46 @@
1
+ import { css } from 'lit';
2
+ export const style = css `
3
+ :host {
4
+ display: none;
5
+ position: absolute;
6
+ z-index: 150;
7
+ }
8
+
9
+ #inner {
10
+ display: flex;
11
+ flex-direction: column;
12
+ justify-content: center;
13
+ position: relative;
14
+ width: 100%;
15
+ height: 100%;
16
+ background-color: var(--og-background-color);
17
+ opacity: 0.8;
18
+ }
19
+
20
+ :host([striped]) {
21
+ background-image: repeating-linear-gradient(45deg, var(--og-accent-color) 0, var(--og-accent-color) 2px, transparent 0, transparent 50%);
22
+ background-size: 10px 10px;
23
+ background-color: transparent;
24
+ opacity: 1;
25
+ }
26
+
27
+ #text {
28
+ font-size: 3em;
29
+ text-align: center;
30
+ }
31
+
32
+ #text span {
33
+ background-color: var(--og-background-color);
34
+ padding: 20px;
35
+ opacity: 0.8;
36
+ }
37
+
38
+ #loader {
39
+ text-align: center;
40
+ }
41
+
42
+ #loader img {
43
+ width: 50px;
44
+ }
45
+ `;
46
+ //# sourceMappingURL=overlay.style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.style.js","sourceRoot":"","sources":["../../src/ui/overlay.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CvB,CAAC","sourcesContent":["import { css } from 'lit';\nexport const style = css`\n\t:host {\n\t\tdisplay: none;\n\t\tposition: absolute;\n\t\tz-index: 150;\n\t}\n\n\t#inner {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tjustify-content: center;\n\t\tposition: relative;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tbackground-color: var(--og-background-color);\n\t\topacity: 0.8;\n\t}\n\n\t:host([striped]) {\n\t\tbackground-image: repeating-linear-gradient(45deg, var(--og-accent-color) 0, var(--og-accent-color) 2px, transparent 0, transparent 50%);\n\t\tbackground-size: 10px 10px;\n\t\tbackground-color: transparent;\n\t\topacity: 1;\n\t}\n\n\t#text {\n\t\tfont-size: 3em;\n\t\ttext-align: center;\n\t}\n\n\t#text span {\n\t\tbackground-color: var(--og-background-color);\n\t\tpadding: 20px;\n\t\topacity: 0.8;\n\t}\n\n\t#loader {\n\t\ttext-align: center;\n\t}\n\n\t#loader img {\n\t\twidth: 50px;\n\t}\n`;"]}
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ import { HorizontalPosition } from '../types';
3
+ import { IconSpec } from './icon';
4
+ export declare class Panel extends LitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ text: string;
7
+ icon: string | IconSpec;
8
+ scrollable: boolean;
9
+ closable: boolean;
10
+ collapsible: boolean;
11
+ collapsed: boolean;
12
+ arrowPosition: HorizontalPosition;
13
+ bodySlot: HTMLSlotElement;
14
+ body: HTMLDivElement;
15
+ header: HTMLDivElement;
16
+ private contentHeight;
17
+ private collapsing;
18
+ private interval;
19
+ _onHeaderClick: () => void;
20
+ animateCollapse(): void;
21
+ firstUpdated(): void;
22
+ render: () => import("lit-html").TemplateResult<1>;
23
+ layout(): void;
24
+ }
25
+ //# sourceMappingURL=panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/ui/panel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAE,kBAAkB,EAAU,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAKlC,qBACa,KAAM,SAAQ,UAAU;IAEpC,MAAM,CAAC,MAAM,4BAAW;IAGxB,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,GAAC,QAAQ,CAAC;IAGtB,UAAU,UAAS;IAGnB,QAAQ,UAAS;IAGjB,WAAW,UAAS;IAGpB,SAAS,UAAS;IAGlB,aAAa,EAAE,kBAAkB,CAAW;IAG5C,QAAQ,EAAE,eAAe,CAAC;IAG1B,IAAI,EAAE,cAAc,CAAC;IAGrB,MAAM,EAAE,cAAc,CAAC;IAGvB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAEzB,cAAc,aAOb;IAED,eAAe;IAkCf,YAAY;IAKZ,MAAM,6CA0BJ;IAEF,MAAM;CAkBN"}
@@ -0,0 +1,151 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { dom } from '../common';
8
+ import { LitElement, html } from 'lit';
9
+ import { customElement, property, query } from 'lit/decorators.js';
10
+ import { style } from './panel.style';
11
+ const ANIMATION_INTERVAL = 10;
12
+ const ANIMATION_LENGTH = 100;
13
+ let Panel = class Panel extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.scrollable = false;
17
+ this.closable = false;
18
+ this.collapsible = false;
19
+ this.collapsed = false;
20
+ this.arrowPosition = 'right';
21
+ this.collapsing = false;
22
+ this._onHeaderClick = () => {
23
+ if (this.collapsing)
24
+ return;
25
+ if (!this.collapsible)
26
+ return;
27
+ if (!this.collapsed)
28
+ this.contentHeight = this.body.offsetHeight;
29
+ this.collapsed = !this.collapsed;
30
+ this.collapsing = true;
31
+ this.animateCollapse();
32
+ };
33
+ this.render = () => html `
34
+ <div id="header" @click="${this._onHeaderClick}">
35
+ ${this.collapsible && this.arrowPosition == 'left' ? html `
36
+ <og-icon id="chevron-left" .icon="chevron-${this.collapsed ? 'right' : 'down'}" fixedWidth></og-icon>
37
+ ` : ``}
38
+
39
+ ${this.icon ? html `<og-icon id="icon" .icon="${this.icon}" fixedWidth></og-icon>` : ``}
40
+
41
+ <div id="title">
42
+ <slot name="header"></slot>
43
+ </div>
44
+
45
+ ${this.collapsible && this.arrowPosition == 'right' ? html `
46
+ <og-icon id="chevron-right" .icon="chevron-${this.collapsed ? 'right' : 'down'}" fixedWidth></og-icon>
47
+ ` : ``}
48
+ </div>
49
+
50
+ <div id="body">
51
+ ${this.scrollable ? html `
52
+ <og-container>
53
+ <slot name="body" slot="content"></slot>
54
+ </og-container>
55
+ ` : html `
56
+ <slot name="body"></slot>
57
+ `}
58
+ </div>
59
+ `;
60
+ }
61
+ animateCollapse() {
62
+ const step = this.contentHeight / (ANIMATION_LENGTH / ANIMATION_INTERVAL);
63
+ let height = this.collapsed ? this.contentHeight : 0;
64
+ const resizeEvent = new Event('resize', { bubbles: true, composed: true });
65
+ if (!this.collapsed) {
66
+ dom.setMaxSize(this.body, { h: 0 });
67
+ dom.showElement(this.body);
68
+ }
69
+ this.dispatchEvent(new Event('resizestart', { bubbles: true, composed: true }));
70
+ this.interval = window.setInterval(this.collapsed ? () => {
71
+ height = Math.max(0, height - step);
72
+ dom.setMaxSize(this.body, { h: height });
73
+ if (height == 0) {
74
+ dom.hideElement(this.body);
75
+ dom.setMaxSize(this.body, { h: 'none' });
76
+ window.clearInterval(this.interval);
77
+ this.collapsing = false;
78
+ this.dispatchEvent(new Event('resizestop', { bubbles: true, composed: true }));
79
+ }
80
+ this.dispatchEvent(resizeEvent);
81
+ } : () => {
82
+ height = Math.min(height + step, this.contentHeight);
83
+ dom.setMaxSize(this.body, { h: height });
84
+ if (height >= this.contentHeight) {
85
+ dom.setMaxSize(this.body, { h: 'none' });
86
+ window.clearInterval(this.interval);
87
+ this.collapsing = false;
88
+ this.dispatchEvent(new Event('resizestop', { bubbles: true, composed: true }));
89
+ }
90
+ this.dispatchEvent(resizeEvent);
91
+ }, ANIMATION_INTERVAL);
92
+ }
93
+ firstUpdated() {
94
+ this.contentHeight = this.body.offsetHeight;
95
+ if (this.collapsed)
96
+ dom.hideElement(this.body);
97
+ }
98
+ layout() {
99
+ const element = this.body?.firstElementChild;
100
+ if (element instanceof HTMLSlotElement) {
101
+ element.assignedElements().forEach((elm) => {
102
+ if (elm instanceof HTMLElement && elm.layout) {
103
+ elm.layout();
104
+ }
105
+ else if (elm instanceof HTMLElement && elm.firstElementChild
106
+ && elm.firstElementChild.layout) {
107
+ elm.firstElementChild.layout();
108
+ }
109
+ });
110
+ }
111
+ else if (element instanceof HTMLElement && element.layout) {
112
+ element.layout();
113
+ }
114
+ }
115
+ };
116
+ Panel.styles = [style];
117
+ __decorate([
118
+ property({ type: String })
119
+ ], Panel.prototype, "text", void 0);
120
+ __decorate([
121
+ property({ type: String })
122
+ ], Panel.prototype, "icon", void 0);
123
+ __decorate([
124
+ property({ type: Boolean })
125
+ ], Panel.prototype, "scrollable", void 0);
126
+ __decorate([
127
+ property({ type: Boolean })
128
+ ], Panel.prototype, "closable", void 0);
129
+ __decorate([
130
+ property({ type: Boolean, reflect: true })
131
+ ], Panel.prototype, "collapsible", void 0);
132
+ __decorate([
133
+ property({ type: Boolean, reflect: true })
134
+ ], Panel.prototype, "collapsed", void 0);
135
+ __decorate([
136
+ property({ type: String })
137
+ ], Panel.prototype, "arrowPosition", void 0);
138
+ __decorate([
139
+ query('slot[name="body"]')
140
+ ], Panel.prototype, "bodySlot", void 0);
141
+ __decorate([
142
+ query('#body')
143
+ ], Panel.prototype, "body", void 0);
144
+ __decorate([
145
+ query('#header')
146
+ ], Panel.prototype, "header", void 0);
147
+ Panel = __decorate([
148
+ customElement(`og-panel`)
149
+ ], Panel);
150
+ export { Panel };
151
+ //# sourceMappingURL=panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.js","sourceRoot":"","sources":["../../src/ui/panel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAItC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAGtB,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,UAAU;IAA9B;;QAWN,eAAU,GAAG,KAAK,CAAC;QAGnB,aAAQ,GAAG,KAAK,CAAC;QAGjB,gBAAW,GAAG,KAAK,CAAC;QAGpB,cAAS,GAAG,KAAK,CAAC;QAGlB,kBAAa,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,CAAC;GACb,KAAK,CAqIjB","sourcesContent":["import { dom } from '../common';\nimport { LitElement, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { style } from './panel.style';\nimport { HorizontalPosition, Layout } from '../types';\nimport { IconSpec } from './icon';\n\nconst ANIMATION_INTERVAL = 10;\nconst ANIMATION_LENGTH = 100;\n\n@customElement(`og-panel`)\nexport class Panel extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property({type: String})\n\ttext: string;\n\n\t@property({type: String})\n\ticon: string|IconSpec;\n\n\t@property({type: Boolean})\n\tscrollable = false;\n\n\t@property({type: Boolean})\n\tclosable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tcollapsible = false;\n\n\t@property({type: Boolean, reflect: true})\n\tcollapsed = false;\n\n\t@property({type: String})\n\tarrowPosition: HorizontalPosition = 'right';\n\n\t@query('slot[name=\"body\"]')\n\tbodySlot: HTMLSlotElement;\n\n\t@query('#body')\n\tbody: HTMLDivElement;\n\n\t@query('#header')\n\theader: HTMLDivElement;\n\t\n\n\tprivate contentHeight: number;\n\tprivate collapsing = false;\n\tprivate interval: number;\n\t\n\t_onHeaderClick = () => {\n\t\tif (this.collapsing) return;\n\t\tif (!this.collapsible) return;\n\t\tif (!this.collapsed) this.contentHeight = this.body.offsetHeight;\n\t\tthis.collapsed = !this.collapsed;\n\t\tthis.collapsing = true;\n\t\tthis.animateCollapse();\n\t}\n\n\tanimateCollapse() {\n\t\tconst step = this.contentHeight / (ANIMATION_LENGTH / ANIMATION_INTERVAL);\n\t\tlet height = this.collapsed ? this.contentHeight : 0;\n\t\t\n\t\tconst resizeEvent = new Event('resize', {bubbles: true, composed: true});\n\t\tif (!this.collapsed) {\n\t\t\tdom.setMaxSize(this.body, {h: 0});\n\t\t\tdom.showElement(this.body);\n\t\t}\n\t\tthis.dispatchEvent(new Event('resizestart', {bubbles: true, composed: true}));\n\t\tthis.interval = window.setInterval(this.collapsed ? () => {\n\t\t\theight = Math.max(0, height - step);\n\t\t\tdom.setMaxSize(this.body, {h: height});\n\t\t\tif (height == 0) {\n\t\t\t\tdom.hideElement(this.body);\n\t\t\t\tdom.setMaxSize(this.body, {h: 'none'});\n\t\t\t\twindow.clearInterval(this.interval);\n\t\t\t\tthis.collapsing = false;\n\t\t\t\tthis.dispatchEvent(new Event('resizestop', {bubbles: true, composed: true}));\n\t\t\t}\n\t\t\tthis.dispatchEvent(resizeEvent);\n\t\t} : () => {\n\t\t\theight = Math.min(height + step, this.contentHeight);\n\t\t\tdom.setMaxSize(this.body, {h: height});\n\t\t\tif (height >= this.contentHeight) {\n\t\t\t\tdom.setMaxSize(this.body, {h: 'none'});\n\t\t\t\twindow.clearInterval(this.interval);\n\t\t\t\tthis.collapsing = false;\n\t\t\t\tthis.dispatchEvent(new Event('resizestop', {bubbles: true, composed: true}));\n\t\t\t}\n\t\t\tthis.dispatchEvent(resizeEvent);\n\t\t}, ANIMATION_INTERVAL);\n\t}\n\n\tfirstUpdated() {\n\t\tthis.contentHeight = this.body.offsetHeight;\n\t\tif (this.collapsed) dom.hideElement(this.body);\n\t}\n\n\trender = () => html`\n\t\t<div id=\"header\" @click=\"${this._onHeaderClick}\">\n\t\t\t${this.collapsible && this.arrowPosition == 'left' ? html`\n\t\t\t\t<og-icon id=\"chevron-left\" .icon=\"chevron-${this.collapsed ? 'right' : 'down'}\" fixedWidth></og-icon>\n\t\t\t`: ``}\n\t\t\t\n\t\t\t${this.icon ? html`<og-icon id=\"icon\" .icon=\"${this.icon}\" fixedWidth></og-icon>` : ``}\n\t\t\t\n\t\t\t<div id=\"title\">\n\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t</div>\n\n\t\t\t${this.collapsible && this.arrowPosition == 'right' ? html`\n\t\t\t\t<og-icon id=\"chevron-right\" .icon=\"chevron-${this.collapsed ? 'right' : 'down'}\" fixedWidth></og-icon>\n\t\t\t`: ``}\n\t\t</div>\n\n\t\t<div id=\"body\">\n\t\t\t${this.scrollable ? html`\n\t\t\t\t<og-container>\n\t\t\t\t\t<slot name=\"body\" slot=\"content\"></slot>\n\t\t\t\t</og-container>\n\t\t\t`: html`\n\t\t\t\t<slot name=\"body\"></slot>\n\t\t\t`}\n\t\t</div>\n\t`;\n\n\tlayout() {\n\t\tconst element = this.body?.firstElementChild as HTMLElement & Layout;\n\t\tif (element instanceof HTMLSlotElement) {\n\t\t\telement.assignedElements().forEach((elm: HTMLElement & Layout) => {\n\t\t\t\tif (elm instanceof HTMLElement && elm.layout) {\n\t\t\t\t\t(elm as Layout).layout();\n\t\t\t\t} else if (\n\t\t\t\t\telm instanceof HTMLElement && elm.firstElementChild \n\t\t\t\t\t&& (elm.firstElementChild as HTMLElement & Layout).layout\n\t\t\t\t) {\n\t\t\t\t\t(elm.firstElementChild as HTMLElement & Layout).layout();\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (element instanceof HTMLElement && element.layout) {\n\t\t\telement.layout();\n\t\t}\n\t}\n\t\n}"]}
@@ -0,0 +1,2 @@
1
+ export declare const style: import("lit").CSSResult;
2
+ //# sourceMappingURL=panel.style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.style.d.ts","sourceRoot":"","sources":["../../src/ui/panel.style.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,yBAqEjB,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { css } from 'lit';
2
+ // TODO - remove top/bottom padding from header
3
+ export const style = css `
4
+ * {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ :host {
9
+ font-size: var(--og-font-size);
10
+ display: flex;
11
+ flex-direction: column;
12
+ border: 1px solid var(--og-border-color);
13
+ }
14
+
15
+ #header {
16
+ flex: 0;
17
+ color: var(--og-text-color);
18
+ display: flex;
19
+ flex-direction: row;
20
+ border-bottom: 1px solid var(--og-border-color);
21
+ align-items: center;
22
+ }
23
+
24
+ #title {
25
+ flex: 1;
26
+ margin-left: 5px;
27
+ }
28
+
29
+ #title > * {
30
+ line-height: 25px;
31
+ }
32
+
33
+ og-icon {
34
+ vertical-align: middle;
35
+ height: 12px;
36
+ }
37
+
38
+ #icon, #chevron-left {
39
+ margin-left: 5px;
40
+ }
41
+
42
+ #chevron-right {
43
+ margin-right: 5px;
44
+ }
45
+
46
+ #header > og-icon {
47
+ flex: 0;
48
+ text-align: center;
49
+ min-width: 12px;
50
+ }
51
+
52
+ :host([collapsible]) #header {
53
+ cursor: pointer;
54
+ }
55
+
56
+ :host([collapsible]) #header:hover {
57
+ background-color: var(--og-background-color-2);
58
+ }
59
+
60
+ #body {
61
+ flex: 1;
62
+ border-top-width: 0;
63
+ overflow: hidden;
64
+ max-height: 100%;
65
+ }
66
+
67
+ og-container {
68
+ width: 100%;
69
+ height: 100%;
70
+ overflow: hidden;
71
+ }
72
+ `;
73
+ //# sourceMappingURL=panel.style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.style.js","sourceRoot":"","sources":["../../src/ui/panel.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,GAAG,EAAE,MAAM,KAAK,CAAC;AAE3B,+CAA+C;AAE/C,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEvB,CAAC","sourcesContent":["import { css } from 'lit';\n\n// TODO - remove top/bottom padding from header\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host {\n\t\tfont-size: var(--og-font-size);\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tborder: 1px solid var(--og-border-color);\n\t}\n\n\t#header {\n\t\tflex: 0;\n\t\tcolor: var(--og-text-color);\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\tborder-bottom: 1px solid var(--og-border-color);\n\t\talign-items: center;\n\t}\n\n\t#title {\n\t\tflex: 1;\n\t\tmargin-left: 5px;\n\t}\n\n\t#title > * {\n\t\tline-height: 25px;\n\t}\n\n\tog-icon {\n\t\tvertical-align: middle;\n\t\theight: 12px;\n\t}\n\t\n\t#icon, #chevron-left {\n\t\tmargin-left: 5px;\n\t}\n\n\t#chevron-right {\n\t\tmargin-right: 5px;\n\t}\n\n\t#header > og-icon {\n\t\tflex: 0;\n\t\ttext-align: center;\n\t\tmin-width: 12px;\n\t}\n\n\t:host([collapsible]) #header {\n\t\tcursor: pointer;\n\t}\n\n\t:host([collapsible]) #header:hover {\n\t\tbackground-color: var(--og-background-color-2);\n\t}\n\n\t#body {\n\t\tflex: 1;\n\t\tborder-top-width: 0;\n\t\toverflow: hidden;\n\t\tmax-height: 100%;\n\t}\n\n\tog-container {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\toverflow: hidden;\n\t}\n`;"]}
@@ -0,0 +1,57 @@
1
+ import { LitElement } from 'lit';
2
+ import { Orientation } from "../types";
3
+ type ResizeEventArgs = {
4
+ offsetX?: number;
5
+ offsetY?: number;
6
+ clientX?: number;
7
+ clientY?: number;
8
+ mouseX?: number;
9
+ mouseY?: number;
10
+ deltaX?: number;
11
+ deltaY?: number;
12
+ };
13
+ export declare class ResizeEvent extends Event {
14
+ readonly resizeArgs: ResizeEventArgs;
15
+ readonly offsetX: number;
16
+ readonly offsetY: number;
17
+ readonly clientX: number;
18
+ readonly clientY: number;
19
+ readonly mouseX: number;
20
+ readonly mouseY: number;
21
+ readonly deltaX: number;
22
+ readonly deltaY: number;
23
+ constructor(type: string, resizeArgs: ResizeEventArgs);
24
+ }
25
+ export declare class Sizer extends LitElement {
26
+ private snappedTo;
27
+ private offsetElement;
28
+ private lineElm;
29
+ private _resizing;
30
+ private startX;
31
+ private startY;
32
+ private offset;
33
+ private startWidth;
34
+ private startHeight;
35
+ private startResize;
36
+ private mouseDownTime;
37
+ private hoverCheckTimer;
38
+ static styles: import("lit").CSSResult;
39
+ orientation: Orientation;
40
+ noGuideLine: boolean;
41
+ get resizing(): boolean;
42
+ private _visible;
43
+ constructor();
44
+ show: () => void;
45
+ hide: () => void;
46
+ private startHoverCheck;
47
+ private stopHoverCheck;
48
+ _onMouseLeave: () => void;
49
+ _onMouseDown: (e: MouseEvent) => void;
50
+ private startResizing;
51
+ _onMouseMove: (e: MouseEvent) => void;
52
+ _onMouseUp: (e: MouseEvent) => void;
53
+ render(): void;
54
+ snap(elm: HTMLElement, offsetElement?: HTMLElement): void;
55
+ }
56
+ export {};
57
+ //# sourceMappingURL=sizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizer.d.ts","sourceRoot":"","sources":["../../src/ui/sizer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAO,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,eAAe,GAAG;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,WAAY,SAAQ,KAAK;aAWK,UAAU,EAAE,eAAe;IATrE,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,IAAI,EAAE,MAAM,EAAkB,UAAU,EAAE,eAAe;CAYrE;AAED,qBACa,KAAM,SAAQ,UAAU;IAEpC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,eAAe,CAAiC;IAExD,MAAM,CAAC,MAAM,0BA6CX;IAGF,WAAW,EAAE,WAAW,CAAC;IAGzB,WAAW,UAAS;IAEpB,IAAW,QAAQ,YAA4B;IAE/C,OAAO,CAAC,QAAQ,CAAS;;IAQzB,IAAI,aAMH;IAED,IAAI,aAMH;IAED,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;IAQtB,aAAa,aAEZ;IAED,YAAY,GAAI,GAAG,UAAU,UAkB5B;IAED,OAAO,CAAC,aAAa;IA8BrB,YAAY,GAAI,GAAG,UAAU,UAe3B;IAEF,UAAU,GAAI,GAAG,UAAU,UAc1B;IAED,MAAM;IAON,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,cAAqB;CAezD"}
@@ -0,0 +1,224 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import * as dom from "../common/dom";
8
+ import constants from "../constants";
9
+ import { LitElement, css } from 'lit';
10
+ import { customElement, property } from 'lit/decorators.js';
11
+ export class ResizeEvent extends Event {
12
+ constructor(type, resizeArgs) {
13
+ super(type);
14
+ this.resizeArgs = resizeArgs;
15
+ resizeArgs = resizeArgs || {};
16
+ this.offsetX = resizeArgs.offsetX;
17
+ this.offsetY = resizeArgs.offsetY;
18
+ this.clientX = resizeArgs.clientX;
19
+ this.clientY = resizeArgs.clientY;
20
+ this.mouseX = resizeArgs.mouseX;
21
+ this.mouseY = resizeArgs.mouseY;
22
+ this.deltaX = resizeArgs.deltaX;
23
+ this.deltaY = resizeArgs.deltaY;
24
+ }
25
+ }
26
+ let Sizer = class Sizer extends LitElement {
27
+ get resizing() { return this._resizing; }
28
+ constructor() {
29
+ super();
30
+ this._resizing = false;
31
+ this.startX = 0;
32
+ this.startY = 0;
33
+ this.startResize = false;
34
+ this.mouseDownTime = 0;
35
+ this.noGuideLine = false;
36
+ this._visible = false;
37
+ this.show = () => {
38
+ if (this._visible)
39
+ return;
40
+ this._visible = true;
41
+ this.classList.add('visible');
42
+ dom.showElement(this);
43
+ this.startHoverCheck();
44
+ };
45
+ this.hide = () => {
46
+ this._visible = false;
47
+ this.stopHoverCheck();
48
+ this.classList.remove('visible');
49
+ dom.hideElement(this);
50
+ dom.hideElement(this.lineElm);
51
+ };
52
+ this._onMouseLeave = () => {
53
+ if (!this._resizing)
54
+ this.hide();
55
+ };
56
+ this._onMouseDown = (e) => {
57
+ e.stopPropagation();
58
+ const lastTime = this.mouseDownTime;
59
+ this.mouseDownTime = performance.now();
60
+ if (this.mouseDownTime - lastTime < 500) {
61
+ this.dispatchEvent(new Event('dblclick'));
62
+ return;
63
+ }
64
+ this.startX = e.pageX;
65
+ this.startY = e.pageY;
66
+ this._resizing = true;
67
+ this.startResize = true;
68
+ this.offset = dom.getElementOffset(this.snappedTo, this.offsetElement);
69
+ this.startWidth = this.snappedTo.clientWidth;
70
+ this.startHeight = this.snappedTo.clientHeight;
71
+ document.addEventListener('mousemove', this._onMouseMove);
72
+ document.addEventListener('mouseup', this._onMouseUp, { once: true });
73
+ };
74
+ this._onMouseMove = (e) => {
75
+ if (this.startResize)
76
+ this.startResizing();
77
+ dom.setPosition(this, this.orientation == 'horizontal' ? {
78
+ l: this.offset.left + this.startWidth - constants.SIZER_SIZE / 2 + e.pageX - this.startX
79
+ } : {
80
+ t: this.offset.top + this.startHeight - constants.SIZER_SIZE / 2 + e.pageY - this.startY
81
+ });
82
+ this.dispatchEvent(new ResizeEvent('resize', {
83
+ deltaX: e.pageX - this.startX,
84
+ deltaY: e.pageY - this.startY,
85
+ mouseX: e.pageX,
86
+ mouseY: e.pageY,
87
+ }));
88
+ };
89
+ this._onMouseUp = (e) => {
90
+ document.removeEventListener('mousemove', this._onMouseMove);
91
+ this._resizing = false;
92
+ if (this.startResize) {
93
+ this.startResize = false;
94
+ return;
95
+ }
96
+ this.hide();
97
+ this.dispatchEvent(new ResizeEvent('resizestop', {
98
+ deltaX: e.pageX - this.startX,
99
+ deltaY: e.pageY - this.startY,
100
+ mouseX: e.pageX,
101
+ mouseY: e.pageY,
102
+ }));
103
+ };
104
+ this.addEventListener('mouseleave', this._onMouseLeave);
105
+ this.addEventListener('mousedown', this._onMouseDown);
106
+ }
107
+ startHoverCheck() {
108
+ this.stopHoverCheck();
109
+ this.hoverCheckTimer = setInterval(() => {
110
+ if (!this._resizing && !this.matches(':hover'))
111
+ this.hide();
112
+ }, 500);
113
+ }
114
+ stopHoverCheck() {
115
+ if (this.hoverCheckTimer) {
116
+ console.log(this.hoverCheckTimer);
117
+ clearInterval(this.hoverCheckTimer);
118
+ this.hoverCheckTimer = null;
119
+ }
120
+ }
121
+ startResizing() {
122
+ this.dispatchEvent(new ResizeEvent('resizestart', {
123
+ deltaX: 0,
124
+ deltaY: 0,
125
+ mouseX: this.startX,
126
+ mouseY: this.startY,
127
+ }));
128
+ if (!this.noGuideLine) {
129
+ dom.showElement(this.lineElm);
130
+ dom.setSize(this.lineElm, this.orientation == 'horizontal' ? {
131
+ w: 1,
132
+ h: this.offsetElement.clientHeight
133
+ } : {
134
+ w: this.offsetElement.clientWidth,
135
+ h: 1
136
+ });
137
+ dom.setPosition(this.lineElm, this.orientation == 'horizontal' ? {
138
+ t: 0,
139
+ r: -1
140
+ } : {
141
+ b: -1,
142
+ l: 0
143
+ });
144
+ }
145
+ this.startResize = false;
146
+ }
147
+ render() {
148
+ this.shadowRoot.innerHTML = '';
149
+ this.lineElm = dom.createElement('div');
150
+ this.lineElm.className = 'sizer-line';
151
+ this.shadowRoot.appendChild(this.lineElm);
152
+ }
153
+ snap(elm, offsetElement = this.parentElement) {
154
+ this.snappedTo = elm;
155
+ this.offsetElement = offsetElement;
156
+ this.show();
157
+ const offset = dom.getElementOffset(elm, offsetElement);
158
+ if (this.orientation == 'horizontal') {
159
+ dom.setSize(this, { w: constants.SIZER_SIZE, h: elm.offsetHeight });
160
+ dom.setPosition(this, { l: offset.left + elm.offsetWidth - constants.SIZER_SIZE / 2, t: offset.top });
161
+ }
162
+ else {
163
+ dom.setSize(this, { w: elm.offsetWidth, h: constants.SIZER_SIZE });
164
+ dom.setPosition(this, { l: offset.left, t: offset.top + elm.offsetHeight - constants.SIZER_SIZE / 2 });
165
+ }
166
+ }
167
+ };
168
+ Sizer.styles = css `
169
+ :host {
170
+ z-index: 105;
171
+ position: relative;
172
+ opacity: 0;
173
+ background-color: var(--og-accent-color);
174
+ }
175
+
176
+ @keyframes show {
177
+ from { opacity: 0; }
178
+ to { opacity: 1; }
179
+ }
180
+
181
+ :host(.visible) {
182
+ animation: show 1s;
183
+ opacity: 1;
184
+ }
185
+
186
+ :host([orientation="vertical"]) {
187
+ cursor: row-resize;
188
+ }
189
+
190
+ :host([orientation="vertical"]) .sizer-line {
191
+ background: repeating-linear-gradient(
192
+ 90deg,
193
+ var(--og-accent-color),
194
+ var(--og-accent-color) 10px,
195
+ transparent 10px,
196
+ transparent 20px
197
+ );
198
+ }
199
+
200
+ :host([orientation="horizontal"]) {
201
+ cursor: col-resize;
202
+ }
203
+
204
+ :host([orientation="horizontal"]) .sizer-line {
205
+ background: repeating-linear-gradient(
206
+ 0deg,
207
+ var(--og-accent-color),
208
+ var(--og-accent-color) 10px,
209
+ transparent 10px,
210
+ transparent 20px
211
+ );
212
+ }
213
+ `;
214
+ __decorate([
215
+ property({ type: String, reflect: true })
216
+ ], Sizer.prototype, "orientation", void 0);
217
+ __decorate([
218
+ property({ type: Boolean, reflect: true })
219
+ ], Sizer.prototype, "noGuideLine", void 0);
220
+ Sizer = __decorate([
221
+ customElement('og-sizer')
222
+ ], Sizer);
223
+ export { Sizer };
224
+ //# sourceMappingURL=sizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizer.js","sourceRoot":"","sources":["../../src/ui/sizer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAc5D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAWrC,YAAY,IAAY,EAAkB,UAA2B;QACpE,KAAK,CAAC,IAAI,CAAC,CAAC;QAD6B,eAAU,GAAV,UAAU,CAAiB;QAEpE,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC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AC;YACP,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAC,CAAC,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,SAAS,CAAC,UAAU,EAAC,CAAC,CAAC;YACjE,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,EAAC,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,UAAU,GAAG,CAAC,EAAC,CAAC,CAAC;QACtG,CAAC;IACF,CAAC;;AAzMM,YAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6ClB,AA7CY,CA6CX;AAGF;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CACf;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CACrB;AAlER,KAAK;IADjB,aAAa,CAAC,UAAU,CAAC;GACb,KAAK,CA0NjB","sourcesContent":["import * as dom from \"../common/dom\";\nimport constants from \"../constants\";\nimport { LitElement, css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { Orientation } from \"../types\";\n\ntype ResizeEventArgs = {\n\toffsetX?: number,\n\toffsetY?: number,\n\tclientX?: number,\n\tclientY?: number,\n\tmouseX?: number,\n\tmouseY?: number,\n\tdeltaX?: number,\n\tdeltaY?: number,\n};\n\nexport class ResizeEvent extends Event {\n\n\tpublic readonly offsetX: number;\n\tpublic readonly offsetY: number;\n\tpublic readonly clientX: number;\n\tpublic readonly clientY: number;\n\tpublic readonly mouseX: number;\n\tpublic readonly mouseY: number;\n\tpublic readonly deltaX: number;\n\tpublic readonly deltaY: number;\n\n\tconstructor(type: string, public readonly resizeArgs: ResizeEventArgs) {\n\t\tsuper(type);\n\t\tresizeArgs = resizeArgs || {};\n\t\tthis.offsetX = resizeArgs.offsetX;\n\t\tthis.offsetY = resizeArgs.offsetY;\n\t\tthis.clientX = resizeArgs.clientX;\n\t\tthis.clientY = resizeArgs.clientY;\n\t\tthis.mouseX = resizeArgs.mouseX;\n\t\tthis.mouseY = resizeArgs.mouseY;\n\t\tthis.deltaX = resizeArgs.deltaX;\n\t\tthis.deltaY = resizeArgs.deltaY;\n\t}\n}\n\n@customElement('og-sizer')\nexport class Sizer extends LitElement {\n\n\tprivate snappedTo: HTMLElement;\n\tprivate offsetElement: HTMLElement;\n\tprivate lineElm: HTMLDivElement;\n\tprivate _resizing = false;\n\tprivate startX = 0;\n\tprivate startY = 0;\n\tprivate offset: {top: number, left: number};\n\tprivate startWidth: number;\n\tprivate startHeight: number;\n\tprivate startResize = false;\n\tprivate mouseDownTime = 0;\n\tprivate hoverCheckTimer: ReturnType<typeof setInterval>;\n\n\tstatic styles = css`\n\t\t:host {\n\t\t\tz-index: 105;\n\t\t\tposition: relative;\n\t\t\topacity: 0;\n\t\t\tbackground-color: var(--og-accent-color);\n\t\t}\n\n\t\t@keyframes show {\n\t\t\tfrom { opacity: 0; }\n\t\t\tto { opacity: 1; }\n\t\t}\n\n\t\t:host(.visible) {\n\t\t\tanimation: show 1s;\n\t\t\topacity: 1;\n\t\t}\n\n\t\t:host([orientation=\"vertical\"]) {\n\t\t\tcursor: row-resize;\n\t\t}\n\n\t\t:host([orientation=\"vertical\"]) .sizer-line {\n\t\t\tbackground: repeating-linear-gradient(\n\t\t\t\t90deg,\n\t\t\t\tvar(--og-accent-color),\n\t\t\t\tvar(--og-accent-color) 10px,\n\t\t\t\ttransparent 10px,\n\t\t\t\ttransparent 20px\n\t\t\t);\n\t\t}\n\n\t\t:host([orientation=\"horizontal\"]) {\n\t\t\tcursor: col-resize;\n\t\t}\n\n\t\t:host([orientation=\"horizontal\"]) .sizer-line {\n\t\t\tbackground: repeating-linear-gradient(\n\t\t\t\t0deg,\n\t\t\t\tvar(--og-accent-color),\n\t\t\t\tvar(--og-accent-color) 10px,\n\t\t\t\ttransparent 10px,\n\t\t\t\ttransparent 20px\n\t\t\t);\n\t\t}\n\t`;\n\n\t@property({type: String, reflect: true})\n\torientation: Orientation;\n\n\t@property({type: Boolean, reflect: true})\n\tnoGuideLine = false;\n\n\tpublic get resizing() { return this._resizing }\n\n\tprivate _visible = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('mouseleave', this._onMouseLeave);\n\t\tthis.addEventListener('mousedown', this._onMouseDown);\n\t}\n\n\tshow = () => {\n\t\tif (this._visible) return;\n\t\tthis._visible = true;\n\t\tthis.classList.add('visible');\n\t\tdom.showElement(this);\n\t\tthis.startHoverCheck();\n\t}\n\n\thide = () => {\n\t\tthis._visible = false;\n\t\tthis.stopHoverCheck();\n\t\tthis.classList.remove('visible');\n\t\tdom.hideElement(this);\n\t\tdom.hideElement(this.lineElm);\n\t}\n\n\tprivate startHoverCheck() {\n\t\tthis.stopHoverCheck();\n\t\tthis.hoverCheckTimer = setInterval(() => {\n\t\t\tif (!this._resizing && !this.matches(':hover')) this.hide();\n\t\t}, 500);\n\t}\n\n\tprivate stopHoverCheck() {\n\t\tif (this.hoverCheckTimer) {\n\t\t\tconsole.log(this.hoverCheckTimer);\n\t\t\tclearInterval(this.hoverCheckTimer);\n\t\t\tthis.hoverCheckTimer = null;\n\t\t}\n\t}\n\n\t_onMouseLeave = () => {\n\t\tif (!this._resizing) this.hide();\n\t}\n\n\t_onMouseDown = (e: MouseEvent) => {\n\t\te.stopPropagation();\n\t\tconst lastTime = this.mouseDownTime;\n\t\tthis.mouseDownTime = performance.now();\n\t\tif (this.mouseDownTime - lastTime < 500) {\n\t\t\tthis.dispatchEvent(new Event('dblclick'));\n\t\t\treturn;\n\t\t}\n\n\t\tthis.startX = e.pageX;\n\t\tthis.startY = e.pageY;\n\t\tthis._resizing = true;\n\t\tthis.startResize = true;\n\t\tthis.offset = dom.getElementOffset(this.snappedTo, this.offsetElement);\n\t\tthis.startWidth = this.snappedTo.clientWidth;\n\t\tthis.startHeight = this.snappedTo.clientHeight;\n\t\tdocument.addEventListener('mousemove', this._onMouseMove);\n\t\tdocument.addEventListener('mouseup', this._onMouseUp, {once: true});\n\t}\n\n\tprivate startResizing() {\n\t\tthis.dispatchEvent(new ResizeEvent('resizestart', {\n\t\t\tdeltaX: 0,\n\t\t\tdeltaY: 0,\n\t\t\tmouseX: this.startX,\n\t\t\tmouseY: this.startY,\n\t\t}));\n\n\t\tif (!this.noGuideLine) {\n\t\t\tdom.showElement(this.lineElm);\n\t\t\tdom.setSize(this.lineElm, this.orientation == 'horizontal' ? {\n\t\t\t\tw: 1,\n\t\t\t\th: this.offsetElement.clientHeight\n\t\t\t} : {\n\t\t\t\tw: this.offsetElement.clientWidth,\n\t\t\t\th: 1\n\t\t\t});\n\n\t\t\tdom.setPosition(this.lineElm, this.orientation == 'horizontal' ? {\n\t\t\t\tt: 0,\n\t\t\t\tr: -1\n\t\t\t} : {\n\t\t\t\tb: -1,\n\t\t\t\tl: 0\n\t\t\t});\n\t\t}\n\n\t\tthis.startResize = false;\n\t}\n\n\t_onMouseMove = (e: MouseEvent) => {\n\t\tif (this.startResize) this.startResizing();\n\n\t\tdom.setPosition(this, this.orientation == 'horizontal' ? {\n\t\t\tl: this.offset.left + this.startWidth - constants.SIZER_SIZE / 2 + e.pageX - this.startX\n\t\t} : {\n\t\t\tt: this.offset.top + this.startHeight - constants.SIZER_SIZE / 2 + e.pageY - this.startY\n\t\t});\n\n\t\tthis.dispatchEvent(new ResizeEvent('resize', {\n\t\t\tdeltaX: e.pageX - this.startX,\n\t\t\tdeltaY: e.pageY - this.startY,\n\t\t\tmouseX: e.pageX,\n\t\t\tmouseY: e.pageY,\n\t\t}));\n\t};\n\n\t_onMouseUp = (e: MouseEvent) => {\n\t\tdocument.removeEventListener('mousemove', this._onMouseMove);\n\t\tthis._resizing = false;\n\t\tif (this.startResize) {\n\t\t\tthis.startResize = false;\n\t\t\treturn;\n\t\t}\n\t\tthis.hide();\n\t\tthis.dispatchEvent(new ResizeEvent('resizestop', {\n\t\t\tdeltaX: e.pageX - this.startX,\n\t\t\tdeltaY: e.pageY - this.startY,\n\t\t\tmouseX: e.pageX,\n\t\t\tmouseY: e.pageY,\n\t\t}));\n\t}\n\n\trender() {\n\t\tthis.shadowRoot.innerHTML = '';\n\t\tthis.lineElm = dom.createElement('div');\n\t\tthis.lineElm.className = 'sizer-line';\n\t\tthis.shadowRoot.appendChild(this.lineElm);\n\t}\n\n\tsnap(elm: HTMLElement, offsetElement = this.parentElement) {\n\t\tthis.snappedTo = elm;\n\t\tthis.offsetElement = offsetElement;\n\t\tthis.show();\n\t\tconst offset = dom.getElementOffset(elm, offsetElement);\n\n\t\tif (this.orientation == 'horizontal') {\n\t\t\tdom.setSize(this, {w: constants.SIZER_SIZE, h: elm.offsetHeight});\n\t\t\tdom.setPosition(this, {l: offset.left + elm.offsetWidth - constants.SIZER_SIZE / 2, t: offset.top});\n\t\t} else {\n\t\t\tdom.setSize(this, {w: elm.offsetWidth, h: constants.SIZER_SIZE});\n\t\t\tdom.setPosition(this, {l: offset.left, t: offset.top + elm.offsetHeight - constants.SIZER_SIZE / 2});\n\t\t}\n\t}\n\n}\n"]}