@omegagrid/toolbar 0.2.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.
- package/dist/constants.d.ts +45 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/controls/index.d.ts +7 -0
- package/dist/ui/controls/index.d.ts.map +1 -0
- package/dist/ui/controls/index.js +23 -0
- package/dist/ui/controls/index.js.map +1 -0
- package/dist/ui/controls/renderers.d.ts +4 -0
- package/dist/ui/controls/renderers.d.ts.map +1 -0
- package/dist/ui/controls/renderers.js +83 -0
- package/dist/ui/controls/renderers.js.map +1 -0
- package/dist/ui/controls/toolbarButton.d.ts +10 -0
- package/dist/ui/controls/toolbarButton.d.ts.map +1 -0
- package/dist/ui/controls/toolbarButton.js +62 -0
- package/dist/ui/controls/toolbarButton.js.map +1 -0
- package/dist/ui/controls/toolbarColorPicker.d.ts +15 -0
- package/dist/ui/controls/toolbarColorPicker.d.ts.map +1 -0
- package/dist/ui/controls/toolbarColorPicker.js +99 -0
- package/dist/ui/controls/toolbarColorPicker.js.map +1 -0
- package/dist/ui/controls/toolbarDropdown.d.ts +13 -0
- package/dist/ui/controls/toolbarDropdown.d.ts.map +1 -0
- package/dist/ui/controls/toolbarDropdown.js +74 -0
- package/dist/ui/controls/toolbarDropdown.js.map +1 -0
- package/dist/ui/controls/toolbarDropdownButton.d.ts +19 -0
- package/dist/ui/controls/toolbarDropdownButton.d.ts.map +1 -0
- package/dist/ui/controls/toolbarDropdownButton.js +112 -0
- package/dist/ui/controls/toolbarDropdownButton.js.map +1 -0
- package/dist/ui/controls/toolbarGrid.d.ts +8 -0
- package/dist/ui/controls/toolbarGrid.d.ts.map +1 -0
- package/dist/ui/controls/toolbarGrid.js +43 -0
- package/dist/ui/controls/toolbarGrid.js.map +1 -0
- package/dist/ui/controls/toolbarText.d.ts +19 -0
- package/dist/ui/controls/toolbarText.d.ts.map +1 -0
- package/dist/ui/controls/toolbarText.js +112 -0
- package/dist/ui/controls/toolbarText.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +19 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/toolbar.d.ts +19 -0
- package/dist/ui/toolbar.d.ts.map +1 -0
- package/dist/ui/toolbar.js +85 -0
- package/dist/ui/toolbar.js.map +1 -0
- package/dist/ui/toolbar.style.d.ts +2 -0
- package/dist/ui/toolbar.style.d.ts.map +1 -0
- package/dist/ui/toolbar.style.js +71 -0
- package/dist/ui/toolbar.style.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ToolbarDropdownButton = void 0;
|
|
13
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
14
|
+
const core_1 = require("@omegagrid/core");
|
|
15
|
+
const lit_1 = require("lit");
|
|
16
|
+
const decorators_js_1 = require("lit/decorators.js");
|
|
17
|
+
const ref_js_1 = require("lit-html/directives/ref.js");
|
|
18
|
+
const core_2 = require("@omegagrid/core");
|
|
19
|
+
let ToolbarDropdownButton = class ToolbarDropdownButton extends lit_1.LitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.gridRef = (0, ref_js_1.createRef)();
|
|
23
|
+
this.dropdownRef = (0, ref_js_1.createRef)();
|
|
24
|
+
this.render = () => (0, lit_1.html) `
|
|
25
|
+
<og-toolbar-button
|
|
26
|
+
mode="toggle"
|
|
27
|
+
style="min-width: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px; flex: 0"
|
|
28
|
+
color="gray"
|
|
29
|
+
.item="${this.currentItem}">
|
|
30
|
+
</og-toolbar-button>
|
|
31
|
+
<og-dropdown ${(0, ref_js_1.ref)(this.dropdownRef)}
|
|
32
|
+
style="min-width: 14px; flex: 0"
|
|
33
|
+
color="gray"
|
|
34
|
+
alignment="left"
|
|
35
|
+
positionOffset="${-constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}">
|
|
36
|
+
<og-toolbar-grid ${(0, ref_js_1.ref)(this.gridRef)}
|
|
37
|
+
slot="content"
|
|
38
|
+
.items="${this.item.items}">
|
|
39
|
+
</og-toolbar-grid>
|
|
40
|
+
</og-dropdown>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
get grid() { return this.gridRef.value; }
|
|
44
|
+
get dropdown() { return this.dropdownRef.value; }
|
|
45
|
+
willUpdate() {
|
|
46
|
+
var _a;
|
|
47
|
+
if (!this.currentItem && ((_a = this.item) === null || _a === void 0 ? void 0 : _a.items)) {
|
|
48
|
+
const items = this.item.items;
|
|
49
|
+
this.currentItem = items.flatMap(row => row).find(item => item.default);
|
|
50
|
+
if (!this.currentItem)
|
|
51
|
+
this.currentItem = items[0][0];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
firstUpdated() {
|
|
55
|
+
core_1.dom.on(this.grid, 'click', 'og-toolbar-button', (e, elm) => {
|
|
56
|
+
this.currentItem = elm.item;
|
|
57
|
+
this.dropdown.close();
|
|
58
|
+
});
|
|
59
|
+
let previewId = null;
|
|
60
|
+
core_1.dom.on(this.grid, 'mousemove', 'og-toolbar-button', (_e, elm) => {
|
|
61
|
+
if (previewId != elm.item.id) {
|
|
62
|
+
previewId = elm.item.id;
|
|
63
|
+
core_2.actions.dispatchActionEvent(this, 'toolbar', { type: 'preview', key: elm.item.id, value: elm.item.value });
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.grid.addEventListener('mouseleave', () => {
|
|
67
|
+
core_2.actions.dispatchActionEvent(this, 'toolbar', { type: 'previewEnd', key: previewId, value: null });
|
|
68
|
+
previewId = null;
|
|
69
|
+
});
|
|
70
|
+
this.grid.addEventListener('toolbar.action', (e) => {
|
|
71
|
+
core_2.actions.dispatchActionEvent(this, 'toolbar', e.action);
|
|
72
|
+
});
|
|
73
|
+
this.button.addEventListener('click', () => {
|
|
74
|
+
core_2.actions.dispatchActionEvent(this, 'toolbar', { type: 'select', key: this.currentItem.id, value: this.currentItem.value });
|
|
75
|
+
});
|
|
76
|
+
this.dropdown.addEventListener('mousedown', e => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.ToolbarDropdownButton = ToolbarDropdownButton;
|
|
82
|
+
ToolbarDropdownButton.styles = [(0, lit_1.css) `
|
|
83
|
+
:host {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
max-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
og-button {
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
display: block;
|
|
92
|
+
width: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
93
|
+
height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
94
|
+
max-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
95
|
+
line-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
96
|
+
padding: 0;
|
|
97
|
+
}
|
|
98
|
+
`];
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, decorators_js_1.query)('og-toolbar-button')
|
|
101
|
+
], ToolbarDropdownButton.prototype, "button", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
104
|
+
], ToolbarDropdownButton.prototype, "item", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
107
|
+
], ToolbarDropdownButton.prototype, "currentItem", void 0);
|
|
108
|
+
exports.ToolbarDropdownButton = ToolbarDropdownButton = __decorate([
|
|
109
|
+
(0, decorators_js_1.customElement)('og-toolbar-dropdownbutton'),
|
|
110
|
+
(0, core_1.stylable)({ vars: ['background-color-2'] })
|
|
111
|
+
], ToolbarDropdownButton);
|
|
112
|
+
//# sourceMappingURL=toolbarDropdownButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarDropdownButton.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdownButton.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAwC;AACxC,0CAA0D;AAC1D,6BAA4C;AAC5C,qDAAmE;AAGnE,uDAA4D;AAE5D,0CAA0C;AAInC,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,gBAAU;IAA9C;;QAoBN,YAAO,GAAG,IAAA,kBAAS,GAAe,CAAC;QAGnC,gBAAW,GAAG,IAAA,kBAAS,GAAY,CAAC;QAqDpC,WAAM,GAAG,GAAG,EAAE,CAAC,IAAA,UAAI,EAAA;;;uBAGG,mBAAS,CAAC,2BAA2B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E;YAC/C,CAAC,CAAC,eAAe,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC;;AA1EW,sDAAqB;AAE1B,4BAAM,GAAG,CAAC,IAAA,SAAG,EAAA;;;;iBAIJ,mBAAS,CAAC,2BAA2B;;;;;;YAM1C,mBAAS,CAAC,2BAA2B;aACpC,mBAAS,CAAC,2BAA2B;iBACjC,mBAAS,CAAC,2BAA2B;kBACpC,mBAAS,CAAC,2BAA2B;;;EAGrD,CAAC,AAhBW,CAgBV;AASH;IADC,IAAA,qBAAK,EAAC,mBAAmB,CAAC;qDACL;AAGtB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACP;AAGlB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0DACA;gCAjCb,qBAAqB;IAFjC,IAAA,6BAAa,EAAC,2BAA2B,CAAC;IAC1C,IAAA,eAAQ,EAAC,EAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,EAAC,CAAC;GAC5B,qBAAqB,CA+FjC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { ToolbarItem } from '../../types';
|
|
3
|
+
export declare class ToolbarGrid extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
items: ToolbarItem[][];
|
|
6
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=toolbarGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarGrid.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBACa,WAAY,SAAQ,UAAU;IAE1C,MAAM,CAAC,MAAM,4BAMV;IAGH,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC;IAEvB,MAAM,6CAQJ;CAEF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ToolbarGrid = void 0;
|
|
10
|
+
const lit_1 = require("lit");
|
|
11
|
+
const decorators_js_1 = require("lit/decorators.js");
|
|
12
|
+
const map_js_1 = require("lit/directives/map.js");
|
|
13
|
+
const renderers_1 = require("./renderers");
|
|
14
|
+
const if_defined_js_1 = require("lit/directives/if-defined.js");
|
|
15
|
+
let ToolbarGrid = class ToolbarGrid extends lit_1.LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.render = () => (0, lit_1.html) `
|
|
19
|
+
<table>
|
|
20
|
+
${(0, map_js_1.map)(this.items, row => (0, lit_1.html) `
|
|
21
|
+
<tr>
|
|
22
|
+
${(0, map_js_1.map)(row, item => (0, lit_1.html) `<td colspan=${(0, if_defined_js_1.ifDefined)(item.colspan)}>${renderers_1.renderers.get(item.type)(item)}</td>`)}
|
|
23
|
+
</tr>
|
|
24
|
+
`)}
|
|
25
|
+
</table>
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.ToolbarGrid = ToolbarGrid;
|
|
30
|
+
ToolbarGrid.styles = [(0, lit_1.css) `
|
|
31
|
+
:host {
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
display: block;
|
|
34
|
+
background-color: var(--background-color);
|
|
35
|
+
}
|
|
36
|
+
`];
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, decorators_js_1.property)({ type: Array })
|
|
39
|
+
], ToolbarGrid.prototype, "items", void 0);
|
|
40
|
+
exports.ToolbarGrid = ToolbarGrid = __decorate([
|
|
41
|
+
(0, decorators_js_1.customElement)('og-toolbar-grid')
|
|
42
|
+
], ToolbarGrid);
|
|
43
|
+
//# sourceMappingURL=toolbarGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarGrid.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarGrid.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6BAA4C;AAC5C,qDAA4D;AAE5D,kDAA4C;AAC5C,2CAAwC;AACxC,gEAAyD;AAGlD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,gBAAU;IAApC;;QAaN,WAAM,GAAG,GAAG,EAAE,CAAC,IAAA,UAAI,EAAA;;KAEf,IAAA,YAAG,EAAC,IAAI,CAAC,KAAwB,EAAE,GAAG,CAAC,EAAE,CAAC,IAAA,UAAI,EAAA;;OAE5C,IAAA,YAAG,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,IAAA,UAAI,EAAA,eAAe,IAAA,yBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,qBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;;IAExG,CAAC;;EAEH,CAAC;IAEH,CAAC;;AAvBY,kCAAW;AAEhB,kBAAM,GAAG,CAAC,IAAA,SAAG,EAAA;;;;;;EAMnB,CAAC,AANW,CAMV;AAGH;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;0CACD;sBAXX,WAAW;IADvB,IAAA,6BAAa,EAAC,iBAAiB,CAAC;GACpB,WAAW,CAuBvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Dropdown, List, ListSelectEvent } from '@omegagrid/core';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { ToolbarItem } from '../../types';
|
|
4
|
+
export declare class ToolbarText extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
color: string;
|
|
7
|
+
item: ToolbarItem;
|
|
8
|
+
value: string;
|
|
9
|
+
input: HTMLInputElement;
|
|
10
|
+
dropdownRef: import("lit-html/directives/ref.js").Ref<Dropdown>;
|
|
11
|
+
get dropdown(): Dropdown;
|
|
12
|
+
listRef: import("lit-html/directives/ref.js").Ref<List>;
|
|
13
|
+
get list(): List;
|
|
14
|
+
updated(): void;
|
|
15
|
+
_onSelect: (e: ListSelectEvent) => void;
|
|
16
|
+
_onKeyUp: () => void;
|
|
17
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=toolbarText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarText.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAY,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBAEa,WAAY,SAAQ,UAAU;IAE1C,MAAM,CAAC,MAAM,4BAaV;IAGH,KAAK,SAAU;IAGf,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,gBAAgB,CAAC;IAExB,WAAW,qDAAyB;IACpC,IAAI,QAAQ,aAAoC;IAEhD,OAAO,iDAAqB;IAC5B,IAAI,IAAI,SAAgC;IAExC,OAAO;IAUP,SAAS,MAAO,eAAe,UAQ9B;IAED,QAAQ,aAUP;IAED,MAAM,6CAmBJ;CAEF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ToolbarText = void 0;
|
|
13
|
+
const core_1 = require("@omegagrid/core");
|
|
14
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
15
|
+
const lit_1 = require("lit");
|
|
16
|
+
const decorators_js_1 = require("lit/decorators.js");
|
|
17
|
+
const core_2 = require("@omegagrid/core");
|
|
18
|
+
const ref_js_1 = require("lit-html/directives/ref.js");
|
|
19
|
+
let ToolbarText = class ToolbarText extends lit_1.LitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.color = 'gray';
|
|
23
|
+
this.dropdownRef = (0, ref_js_1.createRef)();
|
|
24
|
+
this.listRef = (0, ref_js_1.createRef)();
|
|
25
|
+
this._onSelect = (e) => {
|
|
26
|
+
this.dropdown.close();
|
|
27
|
+
this.value = this.item.items[e.index].k;
|
|
28
|
+
core_2.actions.dispatchActionEvent(this, 'toolbar', {
|
|
29
|
+
type: 'change',
|
|
30
|
+
key: this.item.id,
|
|
31
|
+
value: this.value
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
this._onKeyUp = () => {
|
|
35
|
+
if (this.value != this.input.value) {
|
|
36
|
+
this.value = this.input.value;
|
|
37
|
+
core_2.actions.dispatchActionEvent(this, 'toolbar', {
|
|
38
|
+
type: 'change',
|
|
39
|
+
key: this.item.id,
|
|
40
|
+
value: this.value
|
|
41
|
+
});
|
|
42
|
+
this.input.focus();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
this.render = () => {
|
|
46
|
+
var _a;
|
|
47
|
+
return (0, lit_1.html) `
|
|
48
|
+
<input
|
|
49
|
+
type="text"
|
|
50
|
+
.value="${(_a = this.value) !== null && _a !== void 0 ? _a : ''}"
|
|
51
|
+
placeholder="${this.item.placeholder}"
|
|
52
|
+
@keyup="${this._onKeyUp}">
|
|
53
|
+
${this.item.items && this.item.items.length > 0 ? (0, lit_1.html) `
|
|
54
|
+
<og-dropdown ${(0, ref_js_1.ref)(this.dropdownRef)}
|
|
55
|
+
style="min-width: 14px; flex: 0"
|
|
56
|
+
color="gray"
|
|
57
|
+
alignment="right">
|
|
58
|
+
<og-list ${(0, ref_js_1.ref)(this.listRef)}
|
|
59
|
+
slot="content"
|
|
60
|
+
size="${this.item.items.length}"
|
|
61
|
+
maxHeight="220"
|
|
62
|
+
@select="${this._onSelect}">
|
|
63
|
+
</og-list>
|
|
64
|
+
</og-dropdown>
|
|
65
|
+
` : ``}
|
|
66
|
+
`;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
get dropdown() { return this.dropdownRef.value; }
|
|
70
|
+
get list() { return this.listRef.value; }
|
|
71
|
+
updated() {
|
|
72
|
+
if (this.list) {
|
|
73
|
+
this.list.itemRenderer = (div, index) => {
|
|
74
|
+
div.style.paddingLeft = core_1.dom.numToPixels(5);
|
|
75
|
+
return this.item.items[index].v;
|
|
76
|
+
};
|
|
77
|
+
core_1.dom.setSize(this.list, { w: this.clientWidth });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.ToolbarText = ToolbarText;
|
|
82
|
+
ToolbarText.styles = [(0, lit_1.css) `
|
|
83
|
+
:host {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
87
|
+
font-size: var(--font-size);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
input {
|
|
91
|
+
flex: 1;
|
|
92
|
+
min-width: 40px;
|
|
93
|
+
outline: none;
|
|
94
|
+
}
|
|
95
|
+
`];
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, decorators_js_1.property)({ type: String, reflect: true })
|
|
98
|
+
], ToolbarText.prototype, "color", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
101
|
+
], ToolbarText.prototype, "item", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, decorators_js_1.property)({ type: String })
|
|
104
|
+
], ToolbarText.prototype, "value", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, decorators_js_1.query)('input')
|
|
107
|
+
], ToolbarText.prototype, "input", void 0);
|
|
108
|
+
exports.ToolbarText = ToolbarText = __decorate([
|
|
109
|
+
(0, decorators_js_1.customElement)('og-toolbar-text'),
|
|
110
|
+
(0, core_1.stylable)({ vars: ['background-color-2', 'font-'], colorType: ['color', 'background', 'border'], colorTypeSelector: 'input' })
|
|
111
|
+
], ToolbarText);
|
|
112
|
+
//# sourceMappingURL=toolbarText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarText.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarText.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAiF;AACjF,gEAAwC;AACxC,6BAA4C;AAC5C,qDAAmE;AAGnE,0CAA0C;AAC1C,uDAA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EAAE,MAAM,EAAC,CAAC;yCACP;AAGlB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACX;AAGd;IADC,IAAA,qBAAK,EAAC,OAAO,CAAC;0CACS;sBA3BZ,WAAW;IAFvB,IAAA,6BAAa,EAAC,iBAAiB,CAAC;IAChC,IAAA,eAAQ,EAAC,EAAC,IAAI,EAAE,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAC,CAAC;GAC/G,WAAW,CAwFvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./toolbar"), exports);
|
|
18
|
+
__exportStar(require("./controls"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Layout, Tooltip } from '@omegagrid/core';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { ToolbarItem } from '../types';
|
|
4
|
+
export declare class Toolbar extends LitElement implements Layout {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
items: ToolbarItem[];
|
|
7
|
+
values: Record<string, unknown>;
|
|
8
|
+
readonly controls: Map<string, HTMLElement>;
|
|
9
|
+
tooltipRef: import("lit-html/directives/ref").Ref<Tooltip>;
|
|
10
|
+
get tooltip(): Tooltip;
|
|
11
|
+
_tooltipTimeout: number;
|
|
12
|
+
constructor();
|
|
13
|
+
layout(): void;
|
|
14
|
+
_onItemMouseEnter: (e: MouseEvent) => void;
|
|
15
|
+
_onItemMouseLeave: () => void;
|
|
16
|
+
updated(): void;
|
|
17
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../src/ui/toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMvC,qBAEa,OAAQ,SAAQ,UAAW,YAAW,MAAM;IAExD,MAAM,CAAC,MAAM,4BAAW;IAGxB,KAAK,EAAE,WAAW,EAAE,CAAC;IAGrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAErC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAa;IAExD,UAAU,iDAAwB;IAClC,IAAI,OAAO,YAAmC;IAE9C,eAAe,EAAE,MAAM,CAAC;;IAYxB,MAAM;IAIN,iBAAiB,MAAO,UAAU,UAMjC;IAED,iBAAiB,aAGhB;IAED,OAAO;IAOP,MAAM,6CAeJ;CAEF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Toolbar = void 0;
|
|
13
|
+
const core_1 = require("@omegagrid/core");
|
|
14
|
+
const lit_1 = require("lit");
|
|
15
|
+
const decorators_js_1 = require("lit/decorators.js");
|
|
16
|
+
const map_js_1 = require("lit/directives/map.js");
|
|
17
|
+
const renderers_1 = require("./controls/renderers");
|
|
18
|
+
const toolbar_style_1 = require("./toolbar.style");
|
|
19
|
+
const ref_js_1 = require("lit/directives/ref.js");
|
|
20
|
+
const constants_1 = __importDefault(require("../constants"));
|
|
21
|
+
let Toolbar = class Toolbar extends lit_1.LitElement {
|
|
22
|
+
get tooltip() { return this.tooltipRef.value; }
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.values = {};
|
|
26
|
+
this.controls = new Map();
|
|
27
|
+
this.tooltipRef = (0, ref_js_1.createRef)();
|
|
28
|
+
this._onItemMouseEnter = (e) => {
|
|
29
|
+
const target = e.target;
|
|
30
|
+
if (target.dataset.tooltip) {
|
|
31
|
+
this.tooltip.content = target.dataset.tooltip;
|
|
32
|
+
this._tooltipTimeout = window.setTimeout(() => this.tooltip.attachTo(target, 'bottom'), constants_1.default.TOOLBAR_TOOLTIP_DELAY);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this._onItemMouseLeave = () => {
|
|
36
|
+
this.tooltip.hide();
|
|
37
|
+
window.clearTimeout(this._tooltipTimeout);
|
|
38
|
+
};
|
|
39
|
+
this.render = () => (0, lit_1.html) `
|
|
40
|
+
<div class="inner">
|
|
41
|
+
${(0, map_js_1.map)(this.items, item => {
|
|
42
|
+
var _a;
|
|
43
|
+
return (0, lit_1.html) `
|
|
44
|
+
<div
|
|
45
|
+
class="item"
|
|
46
|
+
data-tooltip="${item.title}"
|
|
47
|
+
@mouseenter="${this._onItemMouseEnter}"
|
|
48
|
+
@mouseleave="${this._onItemMouseLeave}">
|
|
49
|
+
${renderers_1.renderers.get(item.type)(item, (_a = (this.values ? this.values[item.id] : undefined)) !== null && _a !== void 0 ? _a : item.value)}
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
52
|
+
})}
|
|
53
|
+
|
|
54
|
+
<og-tooltip id="tooltip" style="display: none" color="accent" ${(0, ref_js_1.ref)(this.tooltipRef)}></og-tooltip>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="empty"> </div>
|
|
57
|
+
`;
|
|
58
|
+
this.addEventListener('toolbar.action', (e) => {
|
|
59
|
+
if (e.action.type == 'change') {
|
|
60
|
+
this.values = this.values || {};
|
|
61
|
+
this.values[e.action.key] = e.action.value;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
layout() {
|
|
66
|
+
//empty
|
|
67
|
+
}
|
|
68
|
+
updated() {
|
|
69
|
+
this.controls.clear();
|
|
70
|
+
this.shadowRoot.querySelectorAll('.control').forEach((control) => this.controls.set(control.dataset.id, control));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.Toolbar = Toolbar;
|
|
74
|
+
Toolbar.styles = [toolbar_style_1.style];
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, decorators_js_1.property)({ type: Array })
|
|
77
|
+
], Toolbar.prototype, "items", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
80
|
+
], Toolbar.prototype, "values", void 0);
|
|
81
|
+
exports.Toolbar = Toolbar = __decorate([
|
|
82
|
+
(0, decorators_js_1.customElement)('og-toolbar'),
|
|
83
|
+
(0, core_1.stylable)({ vars: ['background-color-2', 'font-*'] })
|
|
84
|
+
], Toolbar);
|
|
85
|
+
//# sourceMappingURL=toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../../src/ui/toolbar.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAqE;AACrE,6BAAuC;AACvC,qDAA4D;AAC5D,kDAA4C;AAE5C,oDAAiD;AACjD,mDAAwC;AACxC,kDAAuD;AACvD,6DAAqC;AAI9B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,gBAAU;IAatC,IAAI,OAAO,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAA,CAAC,CAAC;IAI9C;QACC,KAAK,EAAE,CAAC;QAVT,WAAM,GAA4B,EAAE,CAAC;QAE5B,aAAQ,GAA6B,IAAI,GAAG,EAAE,CAAC;QAExD,eAAU,GAAG,IAAA,kBAAS,GAAW,CAAC;QAmBlC,sBAAiB,GAAG,CAAC,CAAa,EAAE,EAAE;YACrC,MAAM,MAAM,GA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AC/B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5C,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,MAAM;QACL,OAAO;IACR,CAAC;IAeD,OAAO;QACN,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,OAAoB,EAAE,EAAE,CAC7E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAC9C,CAAC;IACH,CAAC;;AAjDW,0BAAO;AAEZ,cAAM,GAAG,CAAC,qBAAK,CAAC,AAAV,CAAW;AAGxB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;sCACH;AAGrB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCACY;kBARzB,OAAO;IAFnB,IAAA,6BAAa,EAAC,YAAY,CAAC;IAC3B,IAAA,eAAQ,EAAC,EAAC,IAAI,EAAE,CAAC,oBAAoB,EAAE,QAAQ,CAAC,EAAC,CAAC;GACtC,OAAO,CAoEnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.style.d.ts","sourceRoot":"","sources":["../../src/ui/toolbar.style.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,yBA4DjB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.style = void 0;
|
|
7
|
+
const lit_1 = require("lit");
|
|
8
|
+
const constants_1 = __importDefault(require("../constants"));
|
|
9
|
+
const gap = (constants_1.default.TOOLBAR_HEIGHT - constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE) / 2;
|
|
10
|
+
exports.style = (0, lit_1.css) `
|
|
11
|
+
* {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
height: ${constants_1.default.TOOLBAR_HEIGHT}px;
|
|
18
|
+
background-color: var(--background-color-2);
|
|
19
|
+
display: flex;
|
|
20
|
+
font-size: var(--font-size);
|
|
21
|
+
font-family: var(--font-family);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.inner {
|
|
25
|
+
height: 100%;
|
|
26
|
+
position: relative;
|
|
27
|
+
flex: 0;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: ${gap}px;
|
|
32
|
+
padding-left: ${gap}px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.inner>* {
|
|
36
|
+
flex: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.empty {
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
og-button {
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
display: block;
|
|
46
|
+
width: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
47
|
+
height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
48
|
+
max-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
49
|
+
line-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
50
|
+
min-width: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
51
|
+
padding: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
og-toolbar-dropdownbutton, og-toolbar-colorpicker {
|
|
55
|
+
min-width: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE + 14}px;
|
|
56
|
+
height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
57
|
+
max-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
og-dropdown {
|
|
61
|
+
min-width: 100px;
|
|
62
|
+
height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
63
|
+
max-height: ${constants_1.default.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
label {
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
`;
|
|
71
|
+
//# sourceMappingURL=toolbar.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.style.js","sourceRoot":"","sources":["../../src/ui/toolbar.style.ts"],"names":[],"mappings":";;;;;;AAAA,6BAA0B;AAC1B,6DAAqC;AAErC,MAAM,GAAG,GAAG,CAAC,mBAAS,CAAC,cAAc,GAAG,mBAAS,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;AAEtE,QAAA,KAAK,GAAG,IAAA,SAAG,EAAA;;;;;;;YAOZ,mBAAS,CAAC,cAAc;;;;;;;;;;;;;;SAc3B,GAAG;kBACM,GAAG;;;;;;;;;;;;;;WAcV,mBAAS,CAAC,2BAA2B;YACpC,mBAAS,CAAC,2BAA2B;gBACjC,mBAAS,CAAC,2BAA2B;iBACpC,mBAAS,CAAC,2BAA2B;eACvC,mBAAS,CAAC,2BAA2B;;;;;eAKrC,mBAAS,CAAC,2BAA2B,GAAG,EAAE;YAC7C,mBAAS,CAAC,2BAA2B;gBACjC,mBAAS,CAAC,2BAA2B;;;;;YAKzC,mBAAS,CAAC,2BAA2B;gBACjC,mBAAS,CAAC,2BAA2B;;;;;;;CAOpD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@omegagrid/toolbar",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"description": "Toolbar component",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"./dist/**/*"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/cechi/omegagrid.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": "https://github.com/cechi/omegagrid/issues",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Petr Čechura",
|
|
18
|
+
"email": "p.cechura@gmail.com",
|
|
19
|
+
"url": "https://cechura.eu"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"watch": "tsc --watch",
|
|
23
|
+
"build": "tsc --project tsconfig.json",
|
|
24
|
+
"test": "jest --passWithNoTests",
|
|
25
|
+
"lint": "eslint **/src/**/*.ts",
|
|
26
|
+
"_prepack": "yarn build",
|
|
27
|
+
"_prepublish": "yarn test && yarn lint"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@lit/localize": "^0.12.1",
|
|
31
|
+
"@omegagrid/core": "^0.2.5",
|
|
32
|
+
"@omegagrid/tree": "^0.2.5",
|
|
33
|
+
"lit": "^3.1.1",
|
|
34
|
+
"lit-html": "^3.1.1",
|
|
35
|
+
"ts-debounce": "^4.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@babel/core": "^7.18.13",
|
|
39
|
+
"@types/jest": "^29.5.11",
|
|
40
|
+
"@types/node": "^20.11.5",
|
|
41
|
+
"@types/webpack": "^5.28.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
43
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
44
|
+
"astroturf": "^1.2.0",
|
|
45
|
+
"babel-jest": "^29.7.0",
|
|
46
|
+
"babel-loader": "^9.1.3",
|
|
47
|
+
"eslint": "^8.56.0",
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
50
|
+
"ts-jest": "^29.1.1",
|
|
51
|
+
"ts-loader": "^9.5.1",
|
|
52
|
+
"ts-node": "^10.9.2",
|
|
53
|
+
"typescript": "5.3.2",
|
|
54
|
+
"webpack": "^5.89.0",
|
|
55
|
+
"webpack-cli": "^5.1.4",
|
|
56
|
+
"webpack-dev-server": "^4.15.1",
|
|
57
|
+
"webpack-merge": "^5.10.0"
|
|
58
|
+
}
|
|
59
|
+
}
|