@perspective-dev/viewer-datagrid 4.0.1 → 4.1.1
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.
- package/dist/cdn/perspective-viewer-datagrid.js +4 -17
- package/dist/cdn/perspective-viewer-datagrid.js.map +4 -4
- package/dist/css/perspective-viewer-datagrid.css +1 -1
- package/dist/esm/color_utils.d.ts +9 -0
- package/dist/esm/custom_elements/datagrid.d.ts +52 -0
- package/dist/esm/custom_elements/toolbar.d.ts +10 -0
- package/dist/esm/data_listener/format_cell.d.ts +8 -0
- package/dist/esm/data_listener/format_tree_header.d.ts +13 -0
- package/dist/esm/data_listener/formatter_cache.d.ts +16 -0
- package/dist/esm/data_listener/index.d.ts +10 -0
- package/dist/esm/event_handlers/click/edit_click.d.ts +3 -0
- package/dist/esm/event_handlers/click.d.ts +7 -0
- package/dist/esm/event_handlers/deselect_all.d.ts +5 -0
- package/dist/esm/event_handlers/dispatch_click.d.ts +3 -0
- package/dist/esm/event_handlers/expand_collapse.d.ts +2 -0
- package/dist/esm/event_handlers/focus.d.ts +5 -0
- package/dist/esm/event_handlers/header_click.d.ts +3 -0
- package/dist/esm/event_handlers/keydown/edit_keydown.d.ts +4 -0
- package/dist/esm/event_handlers/row_select_click.d.ts +4 -0
- package/dist/esm/event_handlers/select_region.d.ts +9 -0
- package/dist/esm/event_handlers/sort.d.ts +7 -0
- package/dist/esm/get_cell_config.d.ts +8 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/model/column_overrides.d.ts +23 -0
- package/dist/esm/model/create.d.ts +3 -0
- package/dist/esm/model/index.d.ts +4 -0
- package/dist/esm/model/toolbar.d.ts +4 -0
- package/dist/esm/perspective-viewer-datagrid.js +3 -3
- package/dist/esm/perspective-viewer-datagrid.js.map +4 -4
- package/dist/esm/plugin/activate.d.ts +6 -0
- package/dist/esm/plugin/column_style_controls.d.ts +28 -0
- package/dist/esm/plugin/draw.d.ts +7 -0
- package/dist/esm/plugin/restore.d.ts +10 -0
- package/dist/esm/plugin/save.d.ts +2 -0
- package/dist/esm/style_handlers/body.d.ts +7 -0
- package/dist/esm/style_handlers/column_header.d.ts +13 -0
- package/dist/esm/style_handlers/consolidated.d.ts +57 -0
- package/dist/esm/style_handlers/editable.d.ts +7 -0
- package/dist/esm/style_handlers/focus.d.ts +16 -0
- package/dist/esm/style_handlers/group_header.d.ts +7 -0
- package/dist/esm/style_handlers/table_cell/boolean.d.ts +7 -0
- package/dist/esm/style_handlers/table_cell/cell_flash.d.ts +3 -0
- package/dist/esm/style_handlers/table_cell/datetime.d.ts +7 -0
- package/dist/esm/style_handlers/table_cell/numeric.d.ts +15 -0
- package/dist/esm/style_handlers/table_cell/row_header.d.ts +4 -0
- package/dist/esm/style_handlers/table_cell/string.d.ts +11 -0
- package/dist/esm/style_handlers/types.d.ts +20 -0
- package/dist/esm/types.d.ts +193 -0
- package/package.json +10 -5
- package/src/less/mitered-headers.less +65 -0
- package/src/less/pro.less +196 -0
- package/src/less/regular_table.less +509 -0
- package/src/less/row-hover.less +88 -0
- package/{index.d.ts → src/less/scrollbar.less} +18 -19
- package/src/less/sub-cell-scroll.less +82 -0
- package/src/less/toolbar.less +201 -0
- package/src/ts/color_utils.ts +70 -0
- package/src/ts/custom_elements/datagrid.ts +250 -0
- package/src/ts/custom_elements/toolbar.ts +75 -0
- package/src/ts/data_listener/format_cell.ts +84 -0
- package/src/ts/data_listener/format_tree_header.ts +82 -0
- package/src/ts/data_listener/formatter_cache.ts +191 -0
- package/src/ts/data_listener/index.ts +242 -0
- package/src/ts/event_handlers/click/edit_click.ts +73 -0
- package/src/ts/event_handlers/click.ts +92 -0
- package/src/ts/event_handlers/deselect_all.ts +28 -0
- package/src/ts/event_handlers/dispatch_click.ts +44 -0
- package/src/ts/event_handlers/expand_collapse.ts +44 -0
- package/src/ts/event_handlers/focus.ts +63 -0
- package/src/ts/event_handlers/header_click.ts +85 -0
- package/src/ts/event_handlers/keydown/edit_keydown.ts +213 -0
- package/src/ts/event_handlers/row_select_click.ts +87 -0
- package/src/ts/event_handlers/select_region.ts +427 -0
- package/src/ts/event_handlers/sort.ts +118 -0
- package/src/ts/get_cell_config.ts +68 -0
- package/src/ts/index.ts +49 -0
- package/src/ts/model/column_overrides.ts +112 -0
- package/src/ts/model/create.ts +247 -0
- package/src/ts/model/index.ts +19 -0
- package/src/ts/model/toolbar.ts +64 -0
- package/src/ts/plugin/activate.ts +235 -0
- package/src/ts/plugin/column_style_controls.ts +76 -0
- package/src/ts/plugin/draw.ts +69 -0
- package/src/ts/plugin/restore.ts +110 -0
- package/src/ts/plugin/save.ts +45 -0
- package/src/ts/style_handlers/body.ts +228 -0
- package/src/ts/style_handlers/column_header.ts +183 -0
- package/src/ts/style_handlers/consolidated.ts +223 -0
- package/src/ts/style_handlers/editable.ts +94 -0
- package/src/ts/style_handlers/focus.ts +106 -0
- package/src/ts/style_handlers/group_header.ts +78 -0
- package/src/ts/style_handlers/table_cell/boolean.ts +39 -0
- package/src/ts/style_handlers/table_cell/cell_flash.ts +75 -0
- package/src/ts/style_handlers/table_cell/datetime.ts +64 -0
- package/src/ts/style_handlers/table_cell/numeric.ts +186 -0
- package/src/ts/style_handlers/table_cell/row_header.ts +53 -0
- package/src/ts/style_handlers/table_cell/string.ts +102 -0
- package/src/ts/style_handlers/types.ts +41 -0
- package/src/ts/types.ts +279 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
regular-table {
|
|
14
|
+
tbody {
|
|
15
|
+
tr:hover
|
|
16
|
+
th.psp-tree-leaf:not(.psp-row-selected):not(.psp-row-subselected),
|
|
17
|
+
tr:hover
|
|
18
|
+
th.psp-tree-label:not(.psp-row-selected):not(.psp-row-subselected),
|
|
19
|
+
tr:hover td:not(.psp-row-selected):not(.psp-row-subselected),
|
|
20
|
+
tr:hover:after {
|
|
21
|
+
border-color: var(--rt-hover--border-color, #c5c9d080) !important;
|
|
22
|
+
box-shadow: 0px 1px 0px var(--rt-hover--border-color, #c5c9d080);
|
|
23
|
+
|
|
24
|
+
&.psp-menu-open {
|
|
25
|
+
box-shadow:
|
|
26
|
+
inset -2px 0px 0px var(--icon--color),
|
|
27
|
+
inset 2px 0px 0px var(--icon--color),
|
|
28
|
+
0px 1px 0px var(--rt-hover--border-color, #c5c9d080);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
tr:last-child:hover
|
|
33
|
+
td:not(.psp-row-selected):not(.psp-row-subselected).psp-menu-open {
|
|
34
|
+
box-shadow:
|
|
35
|
+
inset -2px 0px 0px var(--icon--color),
|
|
36
|
+
inset 2px 0px 0px var(--icon--color),
|
|
37
|
+
inset 0px -2px 0px var(--icon--color),
|
|
38
|
+
0px 1px 0px var(--rt-hover--border-color, #c5c9d080);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
tr:hover
|
|
42
|
+
+ tr
|
|
43
|
+
th.psp-tree-leaf:not(.psp-row-selected):not(.psp-row-subselected),
|
|
44
|
+
tr:hover
|
|
45
|
+
+ tr
|
|
46
|
+
th.psp-tree-label:not(.psp-row-selected):not(.psp-row-subselected),
|
|
47
|
+
tr:hover + tr td:not(.psp-row-selected):not(.psp-row-subselected) {
|
|
48
|
+
border-top-color: transparent;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
tr {
|
|
52
|
+
th:first-child:not(:empty),
|
|
53
|
+
th:first-child:empty + th:not(:empty),
|
|
54
|
+
th:first-child:empty ~ th:empty + th:not(:empty),
|
|
55
|
+
td:first-child {
|
|
56
|
+
border-left-width: 1px;
|
|
57
|
+
border-left-color: transparent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
th:last-child,
|
|
61
|
+
td:last-child {
|
|
62
|
+
border-right-width: 0px;
|
|
63
|
+
border-right-color: transparent;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
tr:hover {
|
|
68
|
+
color: inherit;
|
|
69
|
+
th:first-child:not(:empty),
|
|
70
|
+
th:first-child:empty + th:not(:empty),
|
|
71
|
+
th:first-child:empty ~ th:empty + th:not(:empty),
|
|
72
|
+
td:first-child {
|
|
73
|
+
border-left-color: var(
|
|
74
|
+
--rt-hover--border-color,
|
|
75
|
+
#c5c9d080
|
|
76
|
+
) !important;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
th:last-child,
|
|
80
|
+
td:last-child {
|
|
81
|
+
border-right-color: var(
|
|
82
|
+
--rt-hover--border-color,
|
|
83
|
+
#c5c9d080
|
|
84
|
+
) !important;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -10,26 +10,25 @@
|
|
|
10
10
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Scrollbar styling
|
|
14
|
+
regular-table {
|
|
15
|
+
outline: none;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// TODO is this needed?
|
|
22
|
-
whenDefined(tagName: "perspective-viewer-datagrid"): Promise<void>;
|
|
17
|
+
// webkit (chrome, safari, etc) scrollbar styling
|
|
18
|
+
&::-webkit-scrollbar,
|
|
19
|
+
&::-webkit-scrollbar-corner {
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
height: 12px;
|
|
22
|
+
width: 12px;
|
|
23
23
|
}
|
|
24
|
-
}
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
&::-webkit-scrollbar-thumb {
|
|
26
|
+
background-clip: content-box;
|
|
27
|
+
background: var(--icon--color);
|
|
28
|
+
border: 5.5px solid var(--plugin--background);
|
|
29
|
+
max-height: 50%;
|
|
30
|
+
max-width: 50%;
|
|
31
|
+
min-width: 10%;
|
|
32
|
+
min-height: 10%;
|
|
33
|
+
}
|
|
35
34
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
// Handles sub-cell scrolling via CSS transform offset by variables set during
|
|
14
|
+
// rendering.
|
|
15
|
+
perspective-viewer-datagrid:not(.sub-cell-scroll-disabled) regular-table table,
|
|
16
|
+
:host(:not(.sub-cell-scroll-disabled)) regular-table table {
|
|
17
|
+
tbody td,
|
|
18
|
+
thead th:not(.rt-group-corner) {
|
|
19
|
+
transform: translate(var(--regular-table--transform-x, 0px));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
tbody {
|
|
23
|
+
transform: translate(0, var(--regular-table--transform-y, 0px));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
tbody tr:first-child {
|
|
27
|
+
td,
|
|
28
|
+
th,
|
|
29
|
+
&:after {
|
|
30
|
+
clip-path: polygon(
|
|
31
|
+
0 var(--regular-table--clip-y, 0),
|
|
32
|
+
0 200%,
|
|
33
|
+
200% 200%,
|
|
34
|
+
200% var(--regular-table--clip-y, 0)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
tbody tr td:first-of-type {
|
|
40
|
+
clip-path: polygon(
|
|
41
|
+
var(--regular-table--clip-x, 0) 0,
|
|
42
|
+
var(--regular-table--clip-x, 0) 200%,
|
|
43
|
+
200% 200%,
|
|
44
|
+
200% 0
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
tbody tr:first-child td:first-of-type {
|
|
49
|
+
clip-path: polygon(
|
|
50
|
+
var(--regular-table--clip-x, 0) var(--regular-table--clip-y, 0),
|
|
51
|
+
var(--regular-table--clip-x, 0) 200%,
|
|
52
|
+
200% 200%,
|
|
53
|
+
200% var(--regular-table--clip-y, 0)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
thead tr:last-child:after {
|
|
58
|
+
transform: translate(var(--regular-table--transform-x, 0px));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
tbody tr:not(:first-child):after {
|
|
62
|
+
transform: translate(var(--regular-table--transform-x, 0px));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
tbody tr:hover:first-child:after {
|
|
66
|
+
clip-path: polygon(
|
|
67
|
+
0 var(--regular-table--clip-y, 0),
|
|
68
|
+
0 200%,
|
|
69
|
+
200% 200%,
|
|
70
|
+
200% var(--regular-table--clip-y, 0)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
thead tr th.rt-group-corner + th:not(.rt-group-corner) {
|
|
75
|
+
clip-path: polygon(
|
|
76
|
+
var(--regular-table--clip-x, 0) 0,
|
|
77
|
+
var(--regular-table--clip-x, 0) 200%,
|
|
78
|
+
200% 200%,
|
|
79
|
+
200% 0
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
:host {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: block;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host #container {
|
|
20
|
+
position: absolute;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
justify-content: stretch;
|
|
24
|
+
align-items: stretch;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host #toolbar {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: stretch;
|
|
34
|
+
height: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host #toolbar .hover-target {
|
|
38
|
+
margin: 0;
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
&:hover {
|
|
44
|
+
box-shadow:
|
|
45
|
+
-4px 0 0 var(--icon--color),
|
|
46
|
+
4px 0 0 var(--icon--color);
|
|
47
|
+
background-color: var(--icon--color);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host #slot-container {
|
|
52
|
+
flex: 1;
|
|
53
|
+
position: relative;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#scroll_lock.lock-scroll:before {
|
|
57
|
+
-webkit-mask-image: var(--toolbar-scroll-lock-active--content);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#scroll_lock:before {
|
|
61
|
+
-webkit-mask-image: var(--toolbar-scroll-lock--content);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#select_mode:before {
|
|
65
|
+
content: "highlight_alt";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#edit_mode:before {
|
|
69
|
+
-webkit-mask-image: "";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#edit_mode[data-edit-mode="READ_ONLY"]:before {
|
|
73
|
+
-webkit-mask-image: var(--toolbar-edit-mode--read-only--content);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#edit_mode[data-edit-mode="EDIT"]:before {
|
|
77
|
+
-webkit-mask-image: var(--toolbar-edit-mode--edit--content);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host(.aggregated) #toolbar #edit_mode[data-edit-mode="EDIT"]:before {
|
|
81
|
+
-webkit-mask-image: var(--toolbar-edit-mode--read-only--content);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#edit_mode[data-edit-mode="SELECT_ROW"]:before {
|
|
85
|
+
-webkit-mask-image: var(--toolbar-edit-mode--select-row--content);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#edit_mode[data-edit-mode="SELECT_COLUMN"]:before {
|
|
89
|
+
-webkit-mask-image: var(--toolbar-edit-mode--select-column--content);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#edit_mode[data-edit-mode="SELECT_REGION"]:before {
|
|
93
|
+
-webkit-mask-image: var(--toolbar-edit-mode--select-region--content);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// #edit_mode span:before {
|
|
97
|
+
// content: var(--edit-mode-toggle--content, "N/A");
|
|
98
|
+
// }
|
|
99
|
+
|
|
100
|
+
#edit_mode[data-edit-mode="READ_ONLY"] span:before {
|
|
101
|
+
content: var(--edit-mode--read-only--content, "Read Only");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
#edit_mode[data-edit-mode="EDIT"] span:before {
|
|
105
|
+
content: var(--edit-mode--edit--content, "Editable");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#edit_mode[data-edit-mode="SELECT_ROW"] span:before {
|
|
109
|
+
content: var(--edit-mode--select-row--content, "Row Select");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
#edit_mode[data-edit-mode="SELECT_COLUMN"] span:before {
|
|
113
|
+
content: var(--edit-mode--select-column--content, "Column Select");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
#edit_mode[data-edit-mode="SELECT_REGION"] span:before {
|
|
117
|
+
content: var(--edit-mode--select-region--content, "Region Select");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#scroll_lock span:before {
|
|
121
|
+
content: var(--scroll-lock-toggle--content, "Free Scroll");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#scroll_lock.lock-scroll span:before {
|
|
125
|
+
content: var(--scroll-lock-alt-toggle--content, "Align Scroll");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// The icon.
|
|
129
|
+
.button:before {
|
|
130
|
+
width: 21px;
|
|
131
|
+
height: 21px;
|
|
132
|
+
content: "";
|
|
133
|
+
-webkit-mask-size: cover;
|
|
134
|
+
mask-size: cover;
|
|
135
|
+
background-color: var(--icon--color);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.button.editable:before,
|
|
139
|
+
.button.lock-scroll:before {
|
|
140
|
+
color: inherit;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.button {
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
align-items: center;
|
|
147
|
+
user-select: none;
|
|
148
|
+
padding: 0 5px;
|
|
149
|
+
border: 1px solid transparent;
|
|
150
|
+
border-radius: 3px;
|
|
151
|
+
border: 1px solid transparent;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
display: inline-flex;
|
|
154
|
+
font-size: var(--label--font-size, 0.75em);
|
|
155
|
+
height: 22px;
|
|
156
|
+
user-select: none;
|
|
157
|
+
white-space: nowrap;
|
|
158
|
+
width: 37px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.button > span {
|
|
162
|
+
display: none;
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.hover-target:focus-within .button,
|
|
168
|
+
.hover-target:hover .button {
|
|
169
|
+
position: relative;
|
|
170
|
+
background-color: var(--icon--color);
|
|
171
|
+
color: var(--plugin--background);
|
|
172
|
+
opacity: 1;
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.hover-target:focus-within .button:before,
|
|
179
|
+
.hover-target:hover .button:before {
|
|
180
|
+
background-color: var(--plugin--background);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// The label.
|
|
184
|
+
.hover-target:focus-within .button > span,
|
|
185
|
+
.hover-target:hover .button > span {
|
|
186
|
+
display: block;
|
|
187
|
+
position: absolute;
|
|
188
|
+
top: calc(100% + 3px);
|
|
189
|
+
left: 50%;
|
|
190
|
+
translate: -50%;
|
|
191
|
+
margin: 0;
|
|
192
|
+
padding: 5px;
|
|
193
|
+
height: auto;
|
|
194
|
+
white-space: pre-wrap;
|
|
195
|
+
line-height: 1;
|
|
196
|
+
font-size: 9px;
|
|
197
|
+
background-color: var(--icon--color);
|
|
198
|
+
width: 35px;
|
|
199
|
+
text-align: center;
|
|
200
|
+
border-radius: 0 0 3px 3px;
|
|
201
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
import chroma from "chroma-js";
|
|
14
|
+
import type { ColorRecord } from "./types.js";
|
|
15
|
+
|
|
16
|
+
export function blend(a: string, b: number[]): string {
|
|
17
|
+
return chroma.mix(a, `rgb(${b[0]},${b[1]},${b[2]})`, 0.5).hex();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// AFAICT `chroma-js` has no alpha-aware blending? So we need a function to get
|
|
21
|
+
// the color of a heatmap cell over the background.
|
|
22
|
+
export function rgbaToRgb(
|
|
23
|
+
[r, g, b, a]: [number, number, number, number],
|
|
24
|
+
source: [number, number, number] = [255, 255, 255],
|
|
25
|
+
): [number, number, number] {
|
|
26
|
+
function f(i: number, c: number): number {
|
|
27
|
+
return ((1 - a) * (source[i] / 255) + a * (c / 255)) * 255;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return [f(0, r), f(1, g), f(2, b)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Chroma does this but why bother?
|
|
34
|
+
export function infer_foreground_from_background([r, g, b]: [
|
|
35
|
+
number,
|
|
36
|
+
number,
|
|
37
|
+
number,
|
|
38
|
+
]): string {
|
|
39
|
+
// TODO Implement dark/light themes.
|
|
40
|
+
return Math.sqrt(r * r * 0.299 + g * g * 0.587 + b * b * 0.114) > 130
|
|
41
|
+
? "#161616"
|
|
42
|
+
: "#ffffff";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function make_gradient(chromahex: chroma.Color): string {
|
|
46
|
+
const [r, g, b] = chromahex.rgb();
|
|
47
|
+
const [r1, g1, b1] = chromahex
|
|
48
|
+
.set("hsl.h", (chromahex.get("hsl.h") - 15) % 360)
|
|
49
|
+
.rgb();
|
|
50
|
+
const [r2, g2, b2] = chromahex
|
|
51
|
+
.set("hsl.h", (chromahex.get("hsl.h") + 15) % 360)
|
|
52
|
+
.rgb();
|
|
53
|
+
return `linear-gradient(to right top,rgb(${r1},${g1},${b1}),rgb(${r},${g},${b}) 50%,rgb(${r2},${g2},${b2}))`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function make_color_record(color: string): ColorRecord {
|
|
57
|
+
const chroma_neg = chroma(color);
|
|
58
|
+
const _neg_grad = make_gradient(chroma_neg);
|
|
59
|
+
const rgb = chroma_neg.rgb();
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
color,
|
|
63
|
+
rgb[0],
|
|
64
|
+
rgb[1],
|
|
65
|
+
rgb[2],
|
|
66
|
+
_neg_grad,
|
|
67
|
+
`rgba(${rgb[0]},${rgb[1]},${rgb[2]},1)`,
|
|
68
|
+
`rgba(${rgb[0]},${rgb[1]},${rgb[2]},0)`,
|
|
69
|
+
];
|
|
70
|
+
}
|