@omegagrid/commands 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 +43 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -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 +20 -0
- package/dist/index.js.map +1 -0
- package/dist/model/adapter.d.ts +7 -0
- package/dist/model/adapter.d.ts.map +1 -0
- package/dist/model/adapter.js +8 -0
- package/dist/model/adapter.js.map +1 -0
- package/dist/model/commands.d.ts +33 -0
- package/dist/model/commands.d.ts.map +1 -0
- package/dist/model/commands.js +105 -0
- package/dist/model/commands.js.map +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +19 -0
- package/dist/model/index.js.map +1 -0
- package/dist/ui/commandWindow.d.ts +47 -0
- package/dist/ui/commandWindow.d.ts.map +1 -0
- package/dist/ui/commandWindow.js +287 -0
- package/dist/ui/commandWindow.js.map +1 -0
- package/dist/ui/commandWindow.style.d.ts +3 -0
- package/dist/ui/commandWindow.style.d.ts.map +1 -0
- package/dist/ui/commandWindow.style.js +88 -0
- package/dist/ui/commandWindow.style.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +18 -0
- package/dist/ui/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
LOCALE: string;
|
|
3
|
+
PREFIX: string;
|
|
4
|
+
DEFAULT_ACCENT_COLOR: string;
|
|
5
|
+
DEFAULT_ACCENT_COLOR_2: import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<string | number | ArrayLike<number> | import("color")<any> | {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}> | {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}> | {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}> | {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}> | {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}> | {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}> | {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}> | {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}> | {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}> | {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}> | {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>;
|
|
28
|
+
SIZER_SIZE: number;
|
|
29
|
+
SLIDER_SIZE: number;
|
|
30
|
+
SLIDER_MIN_LENGTH: number;
|
|
31
|
+
EXPANDER_SIZE: number;
|
|
32
|
+
LIST_ITEM_HEIGHT: number;
|
|
33
|
+
LIST_RENDERING_TRESHOLD: number;
|
|
34
|
+
LIST_AUTOSCROLL_TRESHOLD: number;
|
|
35
|
+
LIST_AUTOSCROLL_DELAY: number;
|
|
36
|
+
DEFAULT_TEXT_HIGHLIGHT_COLOR: string;
|
|
37
|
+
TOOLTIP_MARGIN: number;
|
|
38
|
+
MENU_ITEM_HEIGHT: number;
|
|
39
|
+
COLORPICKER_COLOR_SIZE: number;
|
|
40
|
+
COMMAND_WINDOW_MAX_WIDTH: number;
|
|
41
|
+
};
|
|
42
|
+
export default _default;
|
|
43
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;AAAA,0CAA6D;AAE7D,kBAAe;IACd,wBAAwB,EAAE,GAAG;IAC7B,GAAG,gBAAa;CAChB,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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("./ui"), exports);
|
|
18
|
+
__exportStar(require("./model"), exports);
|
|
19
|
+
// export * from './types';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,0CAAwB;AACxB,2BAA2B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentAdapter } from "@omegagrid/core";
|
|
2
|
+
import { Command, CommandSection } from "./commands";
|
|
3
|
+
export declare abstract class CommandsAdapter extends ComponentAdapter {
|
|
4
|
+
abstract getSections(filter?: string): CommandSection[] | Promise<CommandSection[]>;
|
|
5
|
+
abstract getCommands(sectionId: string, filter?: string): Command[] | Promise<Command[]>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/model/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAErD,8BAAsB,eAAgB,SAAQ,gBAAgB;IAE7D,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,GAAC,OAAO,CAAC,cAAc,EAAE,CAAC;IACjF,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,GAAC,OAAO,CAAC,OAAO,EAAE,CAAC;CAEtF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandsAdapter = void 0;
|
|
4
|
+
const core_1 = require("@omegagrid/core");
|
|
5
|
+
class CommandsAdapter extends core_1.ComponentAdapter {
|
|
6
|
+
}
|
|
7
|
+
exports.CommandsAdapter = CommandsAdapter;
|
|
8
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/model/adapter.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAGnD,MAAsB,eAAgB,SAAQ,uBAAgB;CAK7D;AALD,0CAKC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type CommandFunction = (...params: string[]) => void;
|
|
2
|
+
export declare class CommandSection {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly commands: Map<string, Command>;
|
|
6
|
+
open: boolean;
|
|
7
|
+
constructor(id: string, name: string);
|
|
8
|
+
addCommand(command: Command): void;
|
|
9
|
+
}
|
|
10
|
+
export declare class Command {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly section: string;
|
|
14
|
+
readonly fn: CommandFunction;
|
|
15
|
+
readonly requiredParams: number;
|
|
16
|
+
constructor(options: Partial<Command>);
|
|
17
|
+
exec(...params: string[]): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class Commands {
|
|
20
|
+
readonly sections: Map<string, CommandSection>;
|
|
21
|
+
get count(): number;
|
|
22
|
+
constructor(commands?: Partial<Command>[]);
|
|
23
|
+
clear(): this;
|
|
24
|
+
registerSection(section: Partial<CommandSection>, append?: boolean): CommandSection;
|
|
25
|
+
removeSection(sectionId: string): void;
|
|
26
|
+
register(command: Partial<Command>): void;
|
|
27
|
+
remove(name: string): void;
|
|
28
|
+
get(name: string): Command;
|
|
29
|
+
exec(command: string, ...params: string[]): void;
|
|
30
|
+
filter(term?: string, includeSections?: boolean, emptySections?: boolean): (CommandSection | Command)[];
|
|
31
|
+
merge(commands: Commands): Commands;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/model/commands.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,KAAK,IA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Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Commands = exports.Command = exports.CommandSection = void 0;
|
|
4
|
+
const core_1 = require("@omegagrid/core");
|
|
5
|
+
class CommandSection {
|
|
6
|
+
constructor(id, name) {
|
|
7
|
+
this.id = id;
|
|
8
|
+
this.name = name;
|
|
9
|
+
this.commands = new Map();
|
|
10
|
+
this.open = true;
|
|
11
|
+
}
|
|
12
|
+
addCommand(command) {
|
|
13
|
+
this.commands.set(command.id, command);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CommandSection = CommandSection;
|
|
17
|
+
class Command {
|
|
18
|
+
constructor(options) {
|
|
19
|
+
Object.assign(this, options);
|
|
20
|
+
this.id = options.id || options.name;
|
|
21
|
+
this.name = options.name || options.id;
|
|
22
|
+
}
|
|
23
|
+
exec(...params) {
|
|
24
|
+
if (this.fn)
|
|
25
|
+
this.fn(...params);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Command = Command;
|
|
29
|
+
class Commands {
|
|
30
|
+
get count() {
|
|
31
|
+
let cnt = 0;
|
|
32
|
+
this.sections.forEach(section => cnt += section.commands.size);
|
|
33
|
+
return cnt;
|
|
34
|
+
}
|
|
35
|
+
constructor(commands) {
|
|
36
|
+
this.sections = new Map();
|
|
37
|
+
if (commands)
|
|
38
|
+
commands.forEach(c => this.register(c));
|
|
39
|
+
}
|
|
40
|
+
clear() {
|
|
41
|
+
this.sections.clear();
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
registerSection(section, append = true) {
|
|
45
|
+
var _a;
|
|
46
|
+
const s = append && this.sections.has(section.id) ? this.sections.get(section.id) : new CommandSection(section.id, section.name);
|
|
47
|
+
(_a = section.commands) === null || _a === void 0 ? void 0 : _a.forEach(c => s.commands.set(c.id, c));
|
|
48
|
+
this.sections.set(s.id, s);
|
|
49
|
+
return s;
|
|
50
|
+
}
|
|
51
|
+
removeSection(sectionId) {
|
|
52
|
+
this.sections.delete(sectionId);
|
|
53
|
+
}
|
|
54
|
+
register(command) {
|
|
55
|
+
const sectionId = command.section || 'default';
|
|
56
|
+
const section = this.sections.get(sectionId) || this.registerSection({ id: sectionId, name: sectionId });
|
|
57
|
+
section.addCommand(new Command(command));
|
|
58
|
+
}
|
|
59
|
+
remove(name) {
|
|
60
|
+
this.sections.forEach(section => section.commands.delete(name));
|
|
61
|
+
}
|
|
62
|
+
get(name) {
|
|
63
|
+
for (const section of this.sections.values()) {
|
|
64
|
+
if (section.commands.has(name))
|
|
65
|
+
return section.commands.get(name);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
exec(command, ...params) {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = this.get(command)) === null || _a === void 0 ? void 0 : _a.exec(...params);
|
|
72
|
+
}
|
|
73
|
+
filter(term, includeSections = false, emptySections = false) {
|
|
74
|
+
const items = [];
|
|
75
|
+
const regex = term == null ? null : new RegExp(core_1.utils.escapeRegExp(term), 'ig');
|
|
76
|
+
for (const section of this.sections.values()) {
|
|
77
|
+
let sectionIcluded = false;
|
|
78
|
+
const sectionMatch = regex ? regex.test(section.name) : true;
|
|
79
|
+
if (sectionMatch && emptySections) {
|
|
80
|
+
items.push(section);
|
|
81
|
+
sectionIcluded = true;
|
|
82
|
+
}
|
|
83
|
+
if (section.open) {
|
|
84
|
+
section.commands.forEach(command => {
|
|
85
|
+
if (sectionMatch || regex.test(command.name)) {
|
|
86
|
+
if (includeSections && !sectionIcluded) {
|
|
87
|
+
items.push(section);
|
|
88
|
+
sectionIcluded = true;
|
|
89
|
+
}
|
|
90
|
+
items.push(command);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return items;
|
|
96
|
+
}
|
|
97
|
+
merge(commands) {
|
|
98
|
+
const mergedCommands = new Commands();
|
|
99
|
+
this.sections.forEach(s => mergedCommands.registerSection(s));
|
|
100
|
+
commands.sections.forEach(s => mergedCommands.registerSection(s));
|
|
101
|
+
return mergedCommands;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.Commands = Commands;
|
|
105
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/model/commands.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AAIxC,MAAa,cAAc;IAK1B,YACiB,EAAU,EACV,IAAY;QADZ,OAAE,GAAF,EAAE,CAAQ;QACV,SAAI,GAAJ,IAAI,CAAQ;QALb,aAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC/C,SAAI,GAAG,IAAI,CAAC;IAKf,CAAC;IAEL,UAAU,CAAC,OAAgB;QAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CAED;AAdD,wCAcC;AAED,MAAa,OAAO;IAQnB,YAAY,OAAyB;QACpC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,GAAG,MAAgB;QACvB,IAAI,IAAI,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;IACjC,CAAC;CAED;AAlBD,0BAkBC;AAED,MAAa,QAAQ;IAIpB,IAAI,KAAK;QACR,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/D,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,YAAY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AE,CAAC;gBACnC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpB,cAAc,GAAG,IAAI,CAAC;YACvB,CAAC;YAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBAClC,IAAI,YAAY,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC9C,IAAI,eAAe,IAAI,CAAC,cAAc,EAAE,CAAC;4BACxC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;4BACpB,cAAc,GAAG,IAAI,CAAC;wBACvB,CAAC;wBACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACrB,CAAC;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,KAAK,CAAC,QAAkB;QACvB,MAAM,cAAc,GAAG,IAAI,QAAQ,EAAE,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AApFD,4BAoFC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
@@ -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("./commands"), exports);
|
|
18
|
+
__exportStar(require("./adapter"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,4CAA0B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Commands, Command, CommandsAdapter, CommandSection } from "../model";
|
|
2
|
+
import { List, ListItemRenderer, ListSelectEvent } from "@omegagrid/core";
|
|
3
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
4
|
+
export declare class CommandEvent extends Event {
|
|
5
|
+
readonly command?: Command;
|
|
6
|
+
constructor(type: string, command?: Command);
|
|
7
|
+
}
|
|
8
|
+
export type CommandRenderer = (div: HTMLDivElement, command: Command) => string | TemplateResult<1> | null;
|
|
9
|
+
export type SectionRenderer = (div: HTMLDivElement, section: CommandSection) => string | TemplateResult<1> | null;
|
|
10
|
+
export declare class CommandWindow extends LitElement {
|
|
11
|
+
static styles: import("lit").CSSResult[];
|
|
12
|
+
private inputRef;
|
|
13
|
+
get input(): HTMLInputElement;
|
|
14
|
+
private listRef;
|
|
15
|
+
get list(): List;
|
|
16
|
+
private visibleItems;
|
|
17
|
+
text: string;
|
|
18
|
+
commands: Commands;
|
|
19
|
+
adapter: CommandsAdapter;
|
|
20
|
+
target: HTMLElement;
|
|
21
|
+
triggerKey: string;
|
|
22
|
+
showSections: boolean;
|
|
23
|
+
requireUpdateCommands: boolean;
|
|
24
|
+
commandRenderer: CommandRenderer;
|
|
25
|
+
sectionRenderer: SectionRenderer;
|
|
26
|
+
get filterValue(): string;
|
|
27
|
+
exec(dispatchEvent?: boolean): void;
|
|
28
|
+
_onKeyDown: (e: KeyboardEvent) => void;
|
|
29
|
+
_onKeyUp: {
|
|
30
|
+
(this: unknown, ...args: [e: any] & any[]): Promise<void>;
|
|
31
|
+
cancel: (reason?: any) => void;
|
|
32
|
+
};
|
|
33
|
+
constructor();
|
|
34
|
+
open(dispatchEvent?: boolean): Promise<void>;
|
|
35
|
+
close(dispatchEvent?: boolean): void;
|
|
36
|
+
connectedCallback(): void;
|
|
37
|
+
_onTargetKeyDown: (e: KeyboardEvent) => void;
|
|
38
|
+
updated(properties: Map<PropertyKey, unknown>): Promise<void>;
|
|
39
|
+
_onSelect: (e: ListSelectEvent) => void;
|
|
40
|
+
_itemRenderer: ListItemRenderer;
|
|
41
|
+
firstUpdated(): void;
|
|
42
|
+
updateCommands(): Promise<void>;
|
|
43
|
+
toggleSection(sectionId: string): Promise<void>;
|
|
44
|
+
updatePosition(): void;
|
|
45
|
+
render: () => TemplateResult<1>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=commandWindow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandWindow.d.ts","sourceRoot":"","sources":["../../src/ui/commandWindow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAO,IAAI,EAAE,gBAAgB,EA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AW,EAAE,OAAO,CAAC;IAWnD,SAAS,MAAO,eAAe,UAe9B;IAED,aAAa,EAAE,gBAAgB,CAI9B;IAED,YAAY;IAKN,cAAc;IAgBd,aAAa,CAAC,SAAS,EAAE,MAAM;IAsBrC,cAAc;IAUd,MAAM,0BAcJ;CAEF"}
|
|
@@ -0,0 +1,287 @@
|
|
|
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.CommandWindow = exports.CommandEvent = void 0;
|
|
13
|
+
const model_1 = require("../model");
|
|
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/directives/ref.js");
|
|
18
|
+
const ts_debounce_1 = require("ts-debounce");
|
|
19
|
+
const commandWindow_style_1 = require("./commandWindow.style");
|
|
20
|
+
const constants_1 = __importDefault(require("../constants"));
|
|
21
|
+
class CommandEvent extends Event {
|
|
22
|
+
constructor(type, command) {
|
|
23
|
+
super(`command.${type}`, { bubbles: true, composed: true });
|
|
24
|
+
this.command = command;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.CommandEvent = CommandEvent;
|
|
28
|
+
let CommandWindow = class CommandWindow extends lit_1.LitElement {
|
|
29
|
+
get input() { var _a; return (_a = this.inputRef) === null || _a === void 0 ? void 0 : _a.value; }
|
|
30
|
+
get list() { var _a; return (_a = this.listRef) === null || _a === void 0 ? void 0 : _a.value; }
|
|
31
|
+
get filterValue() { return this.input.value; }
|
|
32
|
+
exec(dispatchEvent = true) {
|
|
33
|
+
var _a;
|
|
34
|
+
const tokens = this.input.value.split('>').map(t => t.trim());
|
|
35
|
+
if (tokens[0].length == 0) {
|
|
36
|
+
if (this.list.selectedIndex > -1 && this.list.selectedIndex < this.visibleItems.length) {
|
|
37
|
+
tokens[0] = this.visibleItems[this.list.selectedIndex].name;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const command = (_a = this.commands.get(tokens[0])) !== null && _a !== void 0 ? _a : this.visibleItems.find(item => item instanceof model_1.Command && item.name == tokens[0]);
|
|
41
|
+
if (command) {
|
|
42
|
+
if (tokens.length - 1 < command.requiredParams) {
|
|
43
|
+
tokens.push('');
|
|
44
|
+
this.input.value = tokens.join(' > ');
|
|
45
|
+
this.input.focus();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
tokens.shift();
|
|
49
|
+
command.exec(...tokens);
|
|
50
|
+
if (dispatchEvent)
|
|
51
|
+
this.dispatchEvent(new CommandEvent('exec', command));
|
|
52
|
+
this.close();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
this.inputRef = (0, ref_js_1.createRef)();
|
|
59
|
+
this.listRef = (0, ref_js_1.createRef)();
|
|
60
|
+
this.commands = new model_1.Commands();
|
|
61
|
+
this.triggerKey = 'F1';
|
|
62
|
+
this.showSections = false;
|
|
63
|
+
this.requireUpdateCommands = true;
|
|
64
|
+
this.commandRenderer = (div, command) => {
|
|
65
|
+
return (0, lit_1.html) `
|
|
66
|
+
<div class="command">
|
|
67
|
+
${command.name}
|
|
68
|
+
</div>
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
this.sectionRenderer = (div, section) => {
|
|
72
|
+
return (0, lit_1.html) `
|
|
73
|
+
<div class="section" @mousedown="${(e) => e.preventDefault()}">
|
|
74
|
+
<div class="section-toggle">
|
|
75
|
+
<og-fa-icon icon="angle-${section.open ? 'down' : 'right'}"></og-fa-icon>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="section-text">
|
|
78
|
+
${section.name}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
};
|
|
83
|
+
this._onKeyDown = (e) => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
switch (e.key) {
|
|
86
|
+
case 'ArrowDown':
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
this.list.moveDown();
|
|
89
|
+
break;
|
|
90
|
+
case 'ArrowUp':
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
this.list.moveUp();
|
|
93
|
+
break;
|
|
94
|
+
case 'Enter':
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
if (this.visibleItems[this.list.selectedIndex] instanceof model_1.CommandSection)
|
|
97
|
+
this.toggleSection(this.visibleItems[this.list.selectedIndex].id);
|
|
98
|
+
else
|
|
99
|
+
this.exec();
|
|
100
|
+
break;
|
|
101
|
+
case 'Escape':
|
|
102
|
+
case this.triggerKey:
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
this.close();
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
this._onKeyUp = (0, ts_debounce_1.debounce)(e => {
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
const excludedKeys = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Shift', 'Enter', this.triggerKey];
|
|
111
|
+
if (excludedKeys.indexOf(e.key) == -1) {
|
|
112
|
+
this.updateCommands();
|
|
113
|
+
this.list.size = this.visibleItems.length;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
this._onTargetKeyDown = (e) => {
|
|
117
|
+
if (e.key == this.triggerKey) {
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
this.open();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this._onSelect = (e) => {
|
|
124
|
+
const item = this.visibleItems[e.index];
|
|
125
|
+
if (item instanceof model_1.Command) {
|
|
126
|
+
this.input.value = item.name;
|
|
127
|
+
if (e.trigger == core_1.ListSelectTrigger.Click || e.trigger == core_1.ListSelectTrigger.Enter) {
|
|
128
|
+
this.exec();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
this.input.value = '';
|
|
133
|
+
if (e.trigger == core_1.ListSelectTrigger.Click || e.trigger == core_1.ListSelectTrigger.Enter) {
|
|
134
|
+
this.toggleSection(item.id);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
setTimeout(() => this.input.focus());
|
|
138
|
+
};
|
|
139
|
+
this._itemRenderer = (div, index) => {
|
|
140
|
+
return this.visibleItems[index] instanceof model_1.CommandSection
|
|
141
|
+
? this.sectionRenderer(div, this.visibleItems[index])
|
|
142
|
+
: this.commandRenderer(div, this.visibleItems[index]);
|
|
143
|
+
};
|
|
144
|
+
this.render = () => (0, lit_1.html) `
|
|
145
|
+
<div class="input">
|
|
146
|
+
<input type="text" ${(0, ref_js_1.ref)(this.inputRef)}>
|
|
147
|
+
</div>
|
|
148
|
+
${this.text != null ? (0, lit_1.html) `<div class="text">${this.text}</div>` : ''}
|
|
149
|
+
<div class="list">
|
|
150
|
+
<og-list ${(0, ref_js_1.ref)(this.listRef)}
|
|
151
|
+
maxHeight="300"
|
|
152
|
+
.customStyle="${commandWindow_style_1.itemStyle}"
|
|
153
|
+
itemHeight="22"
|
|
154
|
+
lineHeight="20"
|
|
155
|
+
arrowEvents>
|
|
156
|
+
</og-list>
|
|
157
|
+
</div>
|
|
158
|
+
`;
|
|
159
|
+
this.addEventListener('click', e => e.stopPropagation());
|
|
160
|
+
this.addEventListener('keyup', this._onKeyUp);
|
|
161
|
+
this.addEventListener('keydown', this._onKeyDown);
|
|
162
|
+
this.addEventListener('blur', () => this.close());
|
|
163
|
+
}
|
|
164
|
+
async open(dispatchEvent = true) {
|
|
165
|
+
if (!this.target)
|
|
166
|
+
throw new Error('target element not set');
|
|
167
|
+
core_1.dom.showElement(this);
|
|
168
|
+
this.input.value = '';
|
|
169
|
+
if (this.requireUpdateCommands) {
|
|
170
|
+
this.requireUpdateCommands = false;
|
|
171
|
+
await this.updateCommands();
|
|
172
|
+
}
|
|
173
|
+
this.input.focus();
|
|
174
|
+
this.visibleItems = this.commands.filter(null, this.showSections);
|
|
175
|
+
this.updatePosition();
|
|
176
|
+
if (dispatchEvent)
|
|
177
|
+
this.dispatchEvent(new CommandEvent('open'));
|
|
178
|
+
}
|
|
179
|
+
close(dispatchEvent = true) {
|
|
180
|
+
if (this.target) {
|
|
181
|
+
core_1.dom.hideElement(this);
|
|
182
|
+
this.target.focus();
|
|
183
|
+
if (dispatchEvent)
|
|
184
|
+
this.dispatchEvent(new CommandEvent('close'));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
connectedCallback() {
|
|
188
|
+
super.connectedCallback();
|
|
189
|
+
this.tabIndex = 0;
|
|
190
|
+
}
|
|
191
|
+
async updated(properties) {
|
|
192
|
+
if (properties.has('target')) {
|
|
193
|
+
const oldTarget = properties.get('target');
|
|
194
|
+
if (oldTarget)
|
|
195
|
+
oldTarget.removeEventListener('keydown', this._onTargetKeyDown);
|
|
196
|
+
if (this.target)
|
|
197
|
+
this.target.addEventListener('keydown', this._onTargetKeyDown);
|
|
198
|
+
}
|
|
199
|
+
if (properties.has('adapter'))
|
|
200
|
+
this.requireUpdateCommands = true;
|
|
201
|
+
if (properties.has('commands'))
|
|
202
|
+
await this.updateCommands();
|
|
203
|
+
this.updatePosition();
|
|
204
|
+
}
|
|
205
|
+
firstUpdated() {
|
|
206
|
+
this.list.itemRenderer = this._itemRenderer;
|
|
207
|
+
this.list.addEventListener('select', this._onSelect);
|
|
208
|
+
}
|
|
209
|
+
async updateCommands() {
|
|
210
|
+
if (this.adapter) {
|
|
211
|
+
this.commands.clear();
|
|
212
|
+
const sections = (await Promise.all([this.adapter.getSections(this.filterValue)]))[0];
|
|
213
|
+
sections.forEach(section => this.commands.registerSection(section, false));
|
|
214
|
+
this.visibleItems = this.commands.filter(null, this.showSections, true);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
this.visibleItems = this.commands.filter(this.filterValue, this.showSections);
|
|
218
|
+
}
|
|
219
|
+
this.list.size = this.visibleItems.length;
|
|
220
|
+
this.list.selectedIndex = this.list.size > 0 ? 0 : -1;
|
|
221
|
+
this.list.renderItems(true);
|
|
222
|
+
await this.list.updateComplete;
|
|
223
|
+
}
|
|
224
|
+
async toggleSection(sectionId) {
|
|
225
|
+
const section = this.commands.sections.get(sectionId);
|
|
226
|
+
if (section.open) {
|
|
227
|
+
section.open = false;
|
|
228
|
+
this.visibleItems = this.commands.filter(this.filterValue, this.showSections, true);
|
|
229
|
+
this.list.size = this.visibleItems.length;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
section.open = true;
|
|
233
|
+
if (this.adapter) {
|
|
234
|
+
const commands = (await Promise.all([this.adapter.getCommands(sectionId, this.filterValue)]))[0];
|
|
235
|
+
if (commands.length > 0) {
|
|
236
|
+
section.commands.clear();
|
|
237
|
+
commands.forEach(c => section.addCommand(c));
|
|
238
|
+
}
|
|
239
|
+
this.visibleItems = this.commands.filter(null, this.showSections, true);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.visibleItems = this.commands.filter(this.filterValue, this.showSections, true);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
this.list.size = this.visibleItems.length;
|
|
246
|
+
}
|
|
247
|
+
updatePosition() {
|
|
248
|
+
if (this.target) {
|
|
249
|
+
core_1.dom.setSize(this, {
|
|
250
|
+
w: Math.min(constants_1.default.COMMAND_WINDOW_MAX_WIDTH, 0.9 * this.target.clientWidth)
|
|
251
|
+
});
|
|
252
|
+
core_1.dom.setCenterPosition(this, this.target, { horizontal: true, vertical: false });
|
|
253
|
+
core_1.dom.setPosition(this, { t: 100 });
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
exports.CommandWindow = CommandWindow;
|
|
258
|
+
CommandWindow.styles = [commandWindow_style_1.style];
|
|
259
|
+
__decorate([
|
|
260
|
+
(0, decorators_js_1.property)({ type: String })
|
|
261
|
+
], CommandWindow.prototype, "text", void 0);
|
|
262
|
+
__decorate([
|
|
263
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
264
|
+
], CommandWindow.prototype, "commands", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
267
|
+
], CommandWindow.prototype, "adapter", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
270
|
+
], CommandWindow.prototype, "target", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
(0, decorators_js_1.property)({ type: String })
|
|
273
|
+
], CommandWindow.prototype, "triggerKey", void 0);
|
|
274
|
+
__decorate([
|
|
275
|
+
(0, decorators_js_1.property)({ type: Boolean })
|
|
276
|
+
], CommandWindow.prototype, "showSections", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
279
|
+
], CommandWindow.prototype, "commandRenderer", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
282
|
+
], CommandWindow.prototype, "sectionRenderer", void 0);
|
|
283
|
+
exports.CommandWindow = CommandWindow = __decorate([
|
|
284
|
+
(0, decorators_js_1.customElement)('og-commands'),
|
|
285
|
+
(0, core_1.stylable)({ vars: ['accent-*', 'commands-*', 'font-*'] })
|
|
286
|
+
], CommandWindow);
|
|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xB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACb;AAGZ;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;+CACC;AAG1B;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8CACA;AAGzB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACL;AAGpB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;iDACP;AAGlB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;mDACN;AAKpB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sDAOvB;AAGF;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sDAYvB;wBArDU,aAAa;IAFzB,IAAA,6BAAa,EAAC,aAAa,CAAC;IAC5B,IAAA,eAAQ,EAAC,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAC,CAAC;GAC1C,aAAa,CA0QzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandWindow.style.d.ts","sourceRoot":"","sources":["../../src/ui/commandWindow.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAiDjB,CAAC;AAEF,eAAO,MAAM,SAAS,yBAgCrB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.itemStyle = exports.style = void 0;
|
|
4
|
+
const lit_1 = require("lit");
|
|
5
|
+
exports.style = (0, lit_1.css) `
|
|
6
|
+
* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
background: var(--commands-background);
|
|
12
|
+
color: var(--commands-color);
|
|
13
|
+
z-index: 200;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
box-shadow: 0px 0px 6px 1px var(--commands-shadow);
|
|
17
|
+
border: 1px solid var(--border);
|
|
18
|
+
font-family: var(--font-family);
|
|
19
|
+
font-size: var(--font-size);
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.text {
|
|
24
|
+
padding: 4px 4px 8px 4px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.input {
|
|
28
|
+
width: 100%;
|
|
29
|
+
padding: 6px;
|
|
30
|
+
//border-bottom: 2px solid var(--bg-color);
|
|
31
|
+
background: var(--background-color-2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.input>input {
|
|
35
|
+
width: 100%;
|
|
36
|
+
font-size: 16px;
|
|
37
|
+
padding: 4px;
|
|
38
|
+
border: 1px solid var(--accent-color);
|
|
39
|
+
background-color: var(--commands-input-background);
|
|
40
|
+
color: var(--commands-color);
|
|
41
|
+
outline: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.list {
|
|
45
|
+
flex: 1;
|
|
46
|
+
position: relative;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
height: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
og-list {
|
|
52
|
+
height: 250px;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
exports.itemStyle = (0, lit_1.css) `
|
|
56
|
+
.item {
|
|
57
|
+
border: 1px solid transparent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.item.selected {
|
|
61
|
+
border: 1px solid var(--accent-color);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.item>div {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
|
|
68
|
+
height: 100%;
|
|
69
|
+
padding: 0 5px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.item .section {
|
|
73
|
+
background-color: var(--commands-header-background);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.item .section-toggle {
|
|
77
|
+
width: 15px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.item .section og-fa-icon {
|
|
81
|
+
line-height: 20px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.item .command {
|
|
85
|
+
margin-left: 10px;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
//# sourceMappingURL=commandWindow.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandWindow.style.js","sourceRoot":"","sources":["../../src/ui/commandWindow.style.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAEb,QAAA,KAAK,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDvB,CAAC;AAEW,QAAA,SAAS,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./commandWindow"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@omegagrid/commands",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"description": "Command window",
|
|
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
|
+
"lit": "^3.1.1",
|
|
33
|
+
"lit-html": "^3.1.1",
|
|
34
|
+
"ts-debounce": "^4.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/core": "^7.18.13",
|
|
38
|
+
"@types/jest": "^29.5.11",
|
|
39
|
+
"@types/node": "^20.11.5",
|
|
40
|
+
"@types/webpack": "^5.28.0",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
42
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
43
|
+
"astroturf": "^1.2.0",
|
|
44
|
+
"babel-jest": "^29.7.0",
|
|
45
|
+
"babel-loader": "^9.1.3",
|
|
46
|
+
"eslint": "^8.56.0",
|
|
47
|
+
"jest": "^29.7.0",
|
|
48
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
49
|
+
"ts-jest": "^29.1.1",
|
|
50
|
+
"ts-loader": "^9.5.1",
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
52
|
+
"typescript": "5.3.2",
|
|
53
|
+
"webpack": "^5.89.0",
|
|
54
|
+
"webpack-cli": "^5.1.4",
|
|
55
|
+
"webpack-dev-server": "^4.15.1",
|
|
56
|
+
"webpack-merge": "^5.10.0"
|
|
57
|
+
}
|
|
58
|
+
}
|