kempo-ui 0.0.2 → 0.0.4

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 (278) hide show
  1. package/.github/copilot-instructions.md +149 -149
  2. package/.github/workflows/publish-major.yml +39 -0
  3. package/.github/workflows/publish-minor.yml +39 -0
  4. package/.github/workflows/{publish-npm.yml → publish-patch.yml} +44 -44
  5. package/.vscode/settings.json +2 -0
  6. package/CONTRIBUTING.md +149 -149
  7. package/README.md +0 -0
  8. package/dist/kempo-hljs.css +1 -0
  9. package/dist/kempo-vars.css +0 -0
  10. package/dist/src/components/Accordion.js +36 -0
  11. package/dist/src/components/Card.js +37 -0
  12. package/dist/src/components/Collapsible.js +41 -0
  13. package/dist/src/components/ContentSlider.js +44 -0
  14. package/dist/src/components/Dialog.js +113 -0
  15. package/dist/src/components/FocusCapture.js +7 -0
  16. package/dist/src/components/Icon.js +10 -0
  17. package/dist/src/components/Import.js +1 -0
  18. package/dist/src/components/PersistantCollapsible.js +1 -0
  19. package/dist/src/components/PhotoViewer.js +135 -0
  20. package/dist/src/components/Resize.js +96 -0
  21. package/dist/src/components/ShadowComponent.js +1 -0
  22. package/dist/src/components/ShowMore.js +42 -0
  23. package/dist/src/components/SideMenu.js +97 -0
  24. package/dist/src/components/Split.js +84 -0
  25. package/dist/src/components/Tabs.js +155 -0
  26. package/dist/src/components/Tags.js +69 -0
  27. package/dist/src/components/ThemeSwitcher.js +23 -0
  28. package/dist/src/components/Timestamp.js +1 -0
  29. package/dist/src/lit-all.min.js +120 -0
  30. package/dist/src/utils/debounce.js +1 -0
  31. package/dist/src/utils/drag.js +1 -0
  32. package/dist/src/utils/formatTimestamp.js +1 -0
  33. package/dist/src/utils/propConverters.js +1 -0
  34. package/dist/src/utils/watchWindowSize.js +1 -0
  35. package/docs/components/accordion.html +166 -0
  36. package/docs/components/card.html +92 -0
  37. package/docs/components/collapsible.html +198 -0
  38. package/docs/components/content-slider.html +223 -0
  39. package/docs/components/dialog.html +251 -0
  40. package/docs/components/focus-capture.html +67 -0
  41. package/docs/components/icon.html +158 -0
  42. package/docs/components/import.html +73 -0
  43. package/docs/components/persistant-collapsible.html +123 -0
  44. package/docs/components/photo-viewer.html +226 -0
  45. package/docs/components/resize.html +178 -0
  46. package/docs/components/show-more.html +129 -0
  47. package/docs/components/side-menu.html +159 -0
  48. package/docs/components/split.html +147 -0
  49. package/docs/components/table.html +312 -0
  50. package/docs/components/tableControls.html +77 -0
  51. package/docs/components/tableCustomFields.html +113 -0
  52. package/docs/components/tableFetchRecords.html +114 -0
  53. package/docs/components/tableFieldSortHide.html +75 -0
  54. package/docs/components/tablePagination.html +100 -0
  55. package/docs/components/tableRecordEditing.html +144 -0
  56. package/docs/components/tableRecordFiltering.html +88 -0
  57. package/docs/components/tableRecordHiding.html +80 -0
  58. package/docs/components/tableRecordSearching.html +75 -0
  59. package/docs/components/tableRecordSelection.html +75 -0
  60. package/docs/components/tableRowControls.html +78 -0
  61. package/docs/components/tableSorting.html +73 -0
  62. package/docs/components/tabs.html +180 -0
  63. package/docs/components/tags.html +110 -0
  64. package/docs/components/theme-switcher.html +126 -0
  65. package/docs/components/timestamp.html +82 -0
  66. package/docs/components/toast.html +319 -0
  67. package/docs/components/toggle.html +156 -0
  68. package/docs/dev.config.json +20 -0
  69. package/docs/icons/add.svg +1 -0
  70. package/docs/icons/arrow-back.svg +1 -0
  71. package/docs/icons/arrow-down-double.svg +1 -0
  72. package/docs/icons/arrow-down.svg +1 -0
  73. package/docs/icons/arrow-forward.svg +1 -0
  74. package/docs/icons/arrow-up-double.svg +1 -0
  75. package/docs/icons/arrow-up.svg +1 -0
  76. package/docs/icons/cards.svg +1 -0
  77. package/docs/icons/check.svg +1 -0
  78. package/docs/icons/chevron-left.svg +1 -0
  79. package/docs/icons/chevron-right.svg +1 -0
  80. package/docs/icons/close.svg +2 -0
  81. package/docs/icons/compare.svg +1 -0
  82. package/docs/icons/delete.svg +1 -0
  83. package/docs/icons/drag-handle.svg +1 -0
  84. package/docs/icons/drawing2.svg +124 -0
  85. package/docs/icons/edit.svg +1 -0
  86. package/docs/icons/error.svg +1 -0
  87. package/docs/icons/export-file.svg +1 -0
  88. package/docs/icons/file-text.svg +1 -0
  89. package/docs/icons/file.svg +1 -0
  90. package/docs/icons/filter-off.svg +1 -0
  91. package/docs/icons/filter.svg +1 -0
  92. package/docs/icons/first.svg +1 -0
  93. package/docs/icons/folder-clear.svg +1 -0
  94. package/docs/icons/folder-create.svg +1 -0
  95. package/docs/icons/folder-open.svg +1 -0
  96. package/docs/icons/folder.svg +1 -0
  97. package/docs/icons/hide.svg +1 -0
  98. package/docs/icons/image.svg +1 -0
  99. package/docs/icons/label-add.svg +1 -0
  100. package/docs/icons/label.svg +1 -0
  101. package/docs/icons/last.svg +1 -0
  102. package/docs/icons/menu.svg +1 -0
  103. package/docs/icons/mode-auto.svg +1 -0
  104. package/docs/icons/mode-dark.svg +1 -0
  105. package/docs/icons/mode-light.svg +1 -0
  106. package/docs/icons/open-in-browser.svg +1 -0
  107. package/docs/icons/pause.svg +1 -0
  108. package/docs/icons/play.svg +1 -0
  109. package/docs/icons/refresh.svg +1 -0
  110. package/docs/icons/remove.svg +1 -0
  111. package/docs/icons/save.svg +1 -0
  112. package/docs/icons/search.svg +1 -0
  113. package/docs/icons/settings.svg +1 -0
  114. package/docs/icons/show.svg +1 -0
  115. package/docs/icons/storage.svg +1 -0
  116. package/docs/icons/table-visibility.svg +1 -0
  117. package/docs/icons/tag.svg +1 -0
  118. package/docs/icons/tools.svg +1 -0
  119. package/docs/icons/trash-x.svg +1 -0
  120. package/docs/icons/warning.svg +1 -0
  121. package/docs/index.html +28 -21
  122. package/docs/kempo-hljs.css +1 -0
  123. package/docs/media/civic.jpg +0 -0
  124. package/docs/media/corvette.jpg +0 -0
  125. package/docs/media/evo.jpg +0 -0
  126. package/docs/media/gtr.jpg +0 -0
  127. package/docs/media/nsx.jpg +0 -0
  128. package/docs/nav.inc.html +67 -0
  129. package/docs/nav.inc.js +4 -0
  130. package/{config/production.json → docs/prod.config.json} +20 -16
  131. package/docs/src/components/Accordion.js +36 -0
  132. package/docs/src/components/Card.js +37 -0
  133. package/docs/src/components/Collapsible.js +41 -0
  134. package/docs/src/components/ContentSlider.js +44 -0
  135. package/docs/src/components/Dialog.js +113 -0
  136. package/docs/src/components/FocusCapture.js +7 -0
  137. package/docs/src/components/HybridComponent.js +1 -0
  138. package/docs/src/components/Icon.js +10 -0
  139. package/docs/src/components/Import.js +1 -0
  140. package/docs/src/components/LightComponent.js +1 -0
  141. package/docs/src/components/PersistantCollapsible.js +1 -0
  142. package/docs/src/components/PhotoViewer.js +135 -0
  143. package/docs/src/components/Resize.js +96 -0
  144. package/docs/src/components/ShadowComponent.js +1 -0
  145. package/docs/src/components/ShowMore.js +42 -0
  146. package/docs/src/components/SideMenu.js +97 -0
  147. package/docs/src/components/Split.js +84 -0
  148. package/docs/src/components/Tabs.js +155 -0
  149. package/docs/src/components/Tags.js +69 -0
  150. package/docs/src/components/ThemeSwitcher.js +23 -0
  151. package/docs/src/components/Timestamp.js +1 -0
  152. package/docs/src/lit-all.min.js +120 -0
  153. package/docs/src/utils/debounce.js +1 -0
  154. package/docs/src/utils/drag.js +1 -0
  155. package/docs/src/utils/formatTimestamp.js +1 -0
  156. package/docs/src/utils/propConverters.js +1 -0
  157. package/docs/src/utils/watchWindowSize.js +1 -0
  158. package/docs/styles.css +6 -0
  159. package/docs/utils/debounce.html +78 -0
  160. package/docs/utils/drag.html +104 -0
  161. package/docs/utils/formatTimestamp.html +114 -0
  162. package/docs/utils/propConverters.html +132 -0
  163. package/docs/utils/watchWindowSize.html +166 -0
  164. package/icons/add.svg +1 -0
  165. package/icons/arrow-back.svg +1 -0
  166. package/icons/arrow-down-double.svg +1 -0
  167. package/icons/arrow-down.svg +1 -0
  168. package/icons/arrow-forward.svg +1 -0
  169. package/icons/arrow-up-double.svg +1 -0
  170. package/icons/arrow-up.svg +1 -0
  171. package/icons/cards.svg +1 -0
  172. package/icons/check.svg +1 -0
  173. package/icons/chevron-left.svg +1 -0
  174. package/icons/chevron-right.svg +1 -0
  175. package/icons/close.svg +2 -0
  176. package/icons/compare.svg +1 -0
  177. package/icons/delete.svg +1 -0
  178. package/icons/drag-handle.svg +1 -0
  179. package/icons/drawing2.svg +124 -0
  180. package/icons/edit.svg +1 -0
  181. package/icons/error.svg +1 -0
  182. package/icons/export-file.svg +1 -0
  183. package/icons/file-text.svg +1 -0
  184. package/icons/file.svg +1 -0
  185. package/icons/filter-off.svg +1 -0
  186. package/icons/filter.svg +1 -0
  187. package/icons/first.svg +1 -0
  188. package/icons/folder-clear.svg +1 -0
  189. package/icons/folder-create.svg +1 -0
  190. package/icons/folder-open.svg +1 -0
  191. package/icons/folder.svg +1 -0
  192. package/icons/hide.svg +1 -0
  193. package/icons/image.svg +1 -0
  194. package/icons/label-add.svg +1 -0
  195. package/icons/label.svg +1 -0
  196. package/icons/last.svg +1 -0
  197. package/icons/menu.svg +1 -0
  198. package/icons/mode-auto.svg +1 -0
  199. package/icons/mode-dark.svg +1 -0
  200. package/icons/mode-light.svg +1 -0
  201. package/icons/open-in-browser.svg +1 -0
  202. package/icons/pause.svg +1 -0
  203. package/icons/play.svg +1 -0
  204. package/icons/refresh.svg +1 -0
  205. package/icons/remove.svg +1 -0
  206. package/icons/save.svg +1 -0
  207. package/icons/search.svg +1 -0
  208. package/icons/settings.svg +1 -0
  209. package/icons/show.svg +1 -0
  210. package/icons/storage.svg +1 -0
  211. package/icons/table-visibility.svg +1 -0
  212. package/icons/tag.svg +1 -0
  213. package/icons/tools.svg +1 -0
  214. package/icons/trash-x.svg +1 -0
  215. package/icons/warning.svg +1 -0
  216. package/package.json +2 -2
  217. package/scripts/build.js +109 -138
  218. package/scripts/docs.js +62 -60
  219. package/src/components/Accordion.js +229 -0
  220. package/src/components/Card.js +66 -0
  221. package/src/components/Collapsible.js +109 -0
  222. package/src/components/ContentSlider.js +205 -0
  223. package/src/components/Dialog.js +368 -0
  224. package/src/components/FocusCapture.js +23 -0
  225. package/src/components/HybridComponent.js +40 -40
  226. package/src/components/Icon.js +155 -0
  227. package/src/components/Import.js +104 -0
  228. package/src/components/LightComponent.js +32 -32
  229. package/src/components/PersistantCollapsible.js +69 -0
  230. package/src/components/PhotoViewer.js +368 -0
  231. package/src/components/Resize.js +210 -0
  232. package/src/components/ShadowComponent.js +32 -17
  233. package/src/components/ShowMore.js +109 -0
  234. package/src/components/SideMenu.js +167 -0
  235. package/src/components/Sortable.js +193 -0
  236. package/src/components/Split.js +192 -0
  237. package/src/components/Table.js +1202 -0
  238. package/src/components/Tabs.js +428 -0
  239. package/src/components/Tags.js +253 -0
  240. package/src/components/ThemeSwitcher.js +108 -0
  241. package/src/components/Timestamp.js +31 -0
  242. package/src/components/Toast.js +454 -0
  243. package/src/components/Toggle.js +173 -0
  244. package/src/components/tableControls/DeleteRecord.js +29 -0
  245. package/src/components/tableControls/Edit.js +88 -0
  246. package/src/components/tableControls/ExportCSV.js +71 -0
  247. package/src/components/tableControls/ExportJson.js +55 -0
  248. package/src/components/tableControls/FieldSortHide.js +76 -0
  249. package/src/components/tableControls/Filters.js +114 -0
  250. package/src/components/tableControls/FirstPage.js +65 -0
  251. package/src/components/tableControls/HiddenCount.js +45 -0
  252. package/src/components/tableControls/Hide.js +34 -0
  253. package/src/components/tableControls/LastPage.js +65 -0
  254. package/src/components/tableControls/NextPage.js +65 -0
  255. package/src/components/tableControls/PageSelect.js +109 -0
  256. package/src/components/tableControls/PageSize.js +68 -0
  257. package/src/components/tableControls/PrevPage.js +65 -0
  258. package/src/components/tableControls/Search.js +58 -0
  259. package/src/components/tableControls/ShowAll.js +34 -0
  260. package/src/components/tableControls/TableControl.js +105 -0
  261. package/src/kempo-hljs.css +146 -0
  262. package/src/utils/debounce.js +9 -0
  263. package/src/utils/drag.js +80 -0
  264. package/src/utils/formatTimestamp.js +27 -0
  265. package/src/utils/propConverters.js +11 -0
  266. package/src/utils/toTitleCase.js +9 -0
  267. package/src/utils/watchWindowSize.js +16 -0
  268. package/tests/HybridComponent.browser-test.js +214 -214
  269. package/tests/LightComponent.browser-test.js +169 -169
  270. package/tests/ShadowComponent.browser-test.js +130 -130
  271. package/config/development.json +0 -14
  272. package/docs/components/ShadowComponent.js +0 -1
  273. package/src/utils/cli.js +0 -43
  274. package/src/utils/fs-utils.js +0 -41
  275. /package/{docs → dist/src}/components/HybridComponent.js +0 -0
  276. /package/{docs → dist/src}/components/LightComponent.js +0 -0
  277. /package/docs/{utils → src/utils}/cli.js +0 -0
  278. /package/docs/{utils → src/utils}/fs-utils.js +0 -0
@@ -0,0 +1,193 @@
1
+ import { LitElement, html, css } from '../lit-all.min.js';
2
+ import drag from '../utils/drag.js';
3
+
4
+ /*
5
+ Sortable Container Component
6
+ */
7
+ export class Sortable extends LitElement {
8
+ getCursorElement(){
9
+ const items = Array.from(this.children).filter(child =>
10
+ child.tagName === 'K-SORTABLE-ITEM' && !child.hasAttribute('sorting')
11
+ );
12
+ if(items.length === 0) return null;
13
+
14
+ const cursorY = event.clientY;
15
+ if(cursorY < items[0].getBoundingClientRect().top){
16
+ return [items[0], 'before'];
17
+ }
18
+ if(cursorY > items[items.length - 1].getBoundingClientRect().bottom){
19
+ return [items[items.length - 1], 'after'];
20
+ }
21
+
22
+ for(const item of items){
23
+ const rect = item.getBoundingClientRect();
24
+ const middleY = rect.top + rect.height / 2;
25
+ if(cursorY < middleY){
26
+ return [item, 'before'];
27
+ } else if(cursorY < rect.bottom){
28
+ return [item, 'after'];
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+
34
+ render(){
35
+ return html`<slot></slot>`;
36
+ }
37
+
38
+ static styles = css`
39
+ :host {
40
+ display: block;
41
+ }
42
+ `;
43
+ }
44
+ customElements.define('k-sortable', Sortable);
45
+
46
+ /*
47
+ Sortable Item Component
48
+ */
49
+ export class SortableItem extends LitElement {
50
+ static properties = {
51
+ sorting: { type: Boolean, reflect: true }
52
+ };
53
+
54
+ constructor(){
55
+ super();
56
+ this.cleanupDrag = null;
57
+ }
58
+
59
+ /*
60
+ Lifecycle Callbacks
61
+ */
62
+ firstUpdated(){
63
+ this.setupDrag();
64
+ }
65
+
66
+ updated(changedProperties){
67
+ super.updated(changedProperties);
68
+ if(changedProperties.has('sorting') && !this.sorting){
69
+ // Re-setup drag after sorting completes
70
+ this.setupDrag();
71
+ }
72
+ }
73
+
74
+ disconnectedCallback(){
75
+ super.disconnectedCallback();
76
+ if(this.cleanupDrag){
77
+ this.cleanupDrag();
78
+ this.cleanupDrag = null;
79
+ }
80
+ }
81
+
82
+ /*
83
+ Methods
84
+ */
85
+ setupDrag(){
86
+ if(this.cleanupDrag){
87
+ this.cleanupDrag();
88
+ }
89
+ const handle = this.shadowRoot.getElementById('handle');
90
+ if(handle){
91
+ this.cleanupDrag = drag({
92
+ element: handle,
93
+ startCallback: this.handleDragStart,
94
+ moveCallback: this.handleDragMove,
95
+ endCallback: this.handleDragEnd
96
+ });
97
+ }
98
+ }
99
+
100
+ /*
101
+ Event Handlers
102
+ */
103
+ handleDragStart = () => {
104
+ this.sorting = true;
105
+ };
106
+
107
+ handleDragMove = ({y}) => {
108
+ this.style.transform = `translateY(${y}px)`;
109
+ this.style.zIndex = '9999';
110
+ const [target, position] = this.sortable.getCursorElement();
111
+ Array.from(this.sortable.children).forEach(child => {
112
+ child.classList.remove('target-before', 'target-after');
113
+ });
114
+ if(target){
115
+ target.classList.add(`target-${position}`);
116
+ }
117
+ };
118
+
119
+ handleDragEnd = () => {
120
+ this.sorting = false;
121
+ this.style.transform = '';
122
+ this.style.zIndex = '';
123
+ const [target, position] = this.sortable.getCursorElement();
124
+ Array.from(this.sortable.children).forEach(child => {
125
+ child.classList.remove('target-before', 'target-after');
126
+ });
127
+ if(target){
128
+ if(position === 'before'){
129
+ this.sortable.insertBefore(this, target);
130
+ } else if(position === 'after'){
131
+ this.sortable.insertBefore(this, target.nextSibling);
132
+ }
133
+ this.sortable.dispatchEvent(new CustomEvent('sort', { bubbles: true }));
134
+ }
135
+ };
136
+
137
+ /*
138
+ Getters
139
+ */
140
+ get sortable(){
141
+ return this.closest('k-sortable');
142
+ }
143
+
144
+ /*
145
+ Rendering
146
+ */
147
+ render(){
148
+ return html`
149
+ <div id="handle">
150
+ <k-icon name="drag-handle"></k-icon>
151
+ </div>
152
+ <div id="content" class="p pl0">
153
+ <slot></slot>
154
+ </div>
155
+ `;
156
+ }
157
+
158
+ static styles = css`
159
+ :host {
160
+ display: block;
161
+ border: 1px solid var(--c_border);
162
+ user-select: none;
163
+ position: relative;
164
+ }
165
+ :host([sorting]){
166
+ opacity: 0.8;
167
+ }
168
+ #handle {
169
+ display: inline-block;
170
+ cursor: pointer;
171
+ padding: var(--spacer);
172
+ }
173
+ #content {
174
+ display: inline-block;
175
+ }
176
+ :host(.target-before)::before,
177
+ :host(.target-after)::after {
178
+ content: '';
179
+ position: absolute;
180
+ left: 0;
181
+ right: 0;
182
+ height: 4px;
183
+ background-color: var(--c_primary);
184
+ }
185
+ :host(.target-before)::before {
186
+ top: -2px;
187
+ }
188
+ :host(.target-after)::after {
189
+ bottom: -2px;
190
+ }
191
+ `;
192
+ }
193
+ customElements.define('k-sortable-item', SortableItem);
@@ -0,0 +1,192 @@
1
+ import { html, css } from '../lit-all.min.js';
2
+ import ShadowComponent from './ShadowComponent.js';
3
+ import drag from '../utils/drag.js';
4
+ import { watchWindowSize, unwatchWindowSize } from '../utils/watchWindowSize.js';
5
+
6
+ export default class Split extends ShadowComponent {
7
+ static properties = {
8
+ resizing: { type: Boolean, reflect: true },
9
+ stacked: { type: Boolean, reflect: true },
10
+ stackWidth: { type: Number, attribute: 'stack-width' }
11
+ };
12
+
13
+ constructor() {
14
+ super();
15
+
16
+ this.resizing = false;
17
+ this.stacked = false;
18
+ this.stackWidth = 0;
19
+
20
+ // Private state
21
+ this.dragStartWidth = 0;
22
+ this.dragCleanup = () => {};
23
+ this.windowResizeHandler = this.handleWindowResize.bind(this);
24
+ }
25
+
26
+ /*
27
+ Lifecycle Callbacks
28
+ */
29
+ firstUpdated() {
30
+ super.firstUpdated();
31
+ this.setupDragHandler();
32
+ this.stacked = watchWindowSize(this.windowResizeHandler) <= this.stackWidth;
33
+ }
34
+
35
+ disconnectedCallback() {
36
+ super.disconnectedCallback();
37
+ this.dragCleanup();
38
+ unwatchWindowSize(this.windowResizeHandler);
39
+ }
40
+
41
+ /*
42
+ Event Handlers
43
+ */
44
+ handleWindowResize = (width) => {
45
+ this.stacked = width <= this.stackWidth;
46
+ };
47
+
48
+ handleDragStart = () => {
49
+ this.resizing = true;
50
+ this.dragStartWidth = Math.round(this.shadowRoot.getElementById('left').getBoundingClientRect().width);
51
+ this.dispatchEvent(new CustomEvent('resizestart', {
52
+ detail: { startSize: this.dragStartWidth },
53
+ bubbles: true
54
+ }));
55
+ };
56
+
57
+ handleDrag = ({ x }) => {
58
+ const size = `${this.dragStartWidth + x}px`;
59
+ this.setSize(size);
60
+ this.dispatchEvent(new CustomEvent('resize', {
61
+ detail: { size },
62
+ bubbles: true
63
+ }));
64
+ };
65
+
66
+ handleDragEnd = ({ x }) => {
67
+ this.resizing = false;
68
+ const width = this.dragStartWidth + x;
69
+ const size = `${width}px`;
70
+ this.setSize(size);
71
+ this.dispatchEvent(new CustomEvent('resizeend', {
72
+ detail: { size },
73
+ bubbles: true
74
+ }));
75
+ };
76
+
77
+ /*
78
+ Public Methods
79
+ */
80
+ setSize(size) {
81
+ this.style.setProperty('--left_width', size);
82
+ }
83
+
84
+ setupDragHandler() {
85
+ const handle = this.shadowRoot.getElementById('divider-handle');
86
+ if(handle) {
87
+ this.dragCleanup = drag({
88
+ element: handle,
89
+ callback: this.handleDrag,
90
+ startCallback: this.handleDragStart,
91
+ endCallback: this.handleDragEnd
92
+ });
93
+ }
94
+ }
95
+
96
+ /*
97
+ Styles
98
+ */
99
+ static styles = css`
100
+ :host {
101
+ --left_width: calc((100% - var(--handle_width)) / 2);
102
+ --handle_width: 0.5rem;
103
+ --min_pane_width: 6rem;
104
+
105
+ height: 100%;
106
+ display: flex;
107
+ align-items: stretch;
108
+ flex: 1 1 auto;
109
+ overflow: hidden;
110
+ }
111
+
112
+ .pane, #divider-handle {
113
+ display: inline-block;
114
+ }
115
+
116
+ .pane {
117
+ min-width: var(--min_pane_width);
118
+ max-width: calc(100% - var(--min_pane_width));
119
+ max-height: 100%;
120
+ overflow: hidden;
121
+ }
122
+
123
+ #left {
124
+ flex: 0 0 var(--left_width);
125
+ }
126
+
127
+ #divider-handle {
128
+ display: flex;
129
+ justify-content: center;
130
+ width: var(--handle_width);
131
+ cursor: ew-resize;
132
+ }
133
+
134
+ :host([resizing]) #divider-handle {
135
+ background-color: var(--tc_primary);
136
+ }
137
+
138
+ :host([resizing]) .pane {
139
+ pointer-events: none;
140
+ user-select: none;
141
+ }
142
+
143
+ #divider-border {
144
+ width: 1px;
145
+ height: 100%;
146
+ border-left: 1px solid var(--c_border);
147
+ }
148
+
149
+ #right {
150
+ flex: 1 1;
151
+ }
152
+
153
+ :host([stacked]) #left,
154
+ :host([stacked]) #right {
155
+ display: block;
156
+ }
157
+
158
+ :host([stacked]) #divider-handle {
159
+ display: none;
160
+ }
161
+
162
+ :host([stacked]) .pane {
163
+ min-width: 0;
164
+ max-width: 100%;
165
+ max-height: none;
166
+ overflow: auto;
167
+ }
168
+
169
+ :host([stacked]) {
170
+ display: block;
171
+ }
172
+ `;
173
+
174
+ /*
175
+ Rendering
176
+ */
177
+ render() {
178
+ return html`
179
+ <div id="left" class="pane">
180
+ <slot></slot>
181
+ </div>
182
+ <div id="divider-handle">
183
+ <div id="divider-border"></div>
184
+ </div>
185
+ <div id="right" class="pane">
186
+ <slot name="right"></slot>
187
+ </div>
188
+ `;
189
+ }
190
+ }
191
+
192
+ customElements.define('k-split', Split);