@omegagrid/commands 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/adapters/adapter.d.ts +19 -0
  2. package/dist/adapters/adapter.d.ts.map +1 -0
  3. package/dist/adapters/adapter.js +23 -0
  4. package/dist/adapters/adapter.js.map +1 -0
  5. package/dist/adapters/commandsFlowAdapter.d.ts +25 -0
  6. package/dist/adapters/commandsFlowAdapter.d.ts.map +1 -0
  7. package/dist/adapters/commandsFlowAdapter.js +61 -0
  8. package/dist/adapters/commandsFlowAdapter.js.map +1 -0
  9. package/dist/adapters/index.d.ts +3 -0
  10. package/dist/adapters/index.d.ts.map +1 -0
  11. package/dist/adapters/index.js +3 -0
  12. package/dist/adapters/index.js.map +1 -0
  13. package/dist/commandManager.d.ts +34 -0
  14. package/dist/commandManager.d.ts.map +1 -0
  15. package/dist/commandManager.js +101 -0
  16. package/dist/commandManager.js.map +1 -0
  17. package/dist/common.d.ts +5 -0
  18. package/dist/common.d.ts.map +1 -0
  19. package/dist/common.js +18 -0
  20. package/dist/common.js.map +1 -0
  21. package/dist/constants.d.ts +2 -0
  22. package/dist/constants.d.ts.map +1 -1
  23. package/dist/constants.js +1 -0
  24. package/dist/constants.js.map +1 -1
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +3 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/model/commands.d.ts +54 -22
  30. package/dist/model/commands.d.ts.map +1 -1
  31. package/dist/model/commands.js +71 -52
  32. package/dist/model/commands.js.map +1 -1
  33. package/dist/model/index.d.ts +0 -1
  34. package/dist/model/index.d.ts.map +1 -1
  35. package/dist/model/index.js +0 -1
  36. package/dist/model/index.js.map +1 -1
  37. package/dist/model/options.d.ts +6 -2
  38. package/dist/model/options.d.ts.map +1 -1
  39. package/dist/model/options.js +5 -1
  40. package/dist/model/options.js.map +1 -1
  41. package/dist/ui/commandWindow.d.ts +40 -27
  42. package/dist/ui/commandWindow.d.ts.map +1 -1
  43. package/dist/ui/commandWindow.js +249 -170
  44. package/dist/ui/commandWindow.js.map +1 -1
  45. package/dist/ui/commandWindow.style.d.ts.map +1 -1
  46. package/dist/ui/commandWindow.style.js +71 -9
  47. package/dist/ui/commandWindow.style.js.map +1 -1
  48. package/dist/ui/floatingCommandWindow.d.ts +7 -0
  49. package/dist/ui/floatingCommandWindow.d.ts.map +1 -0
  50. package/dist/ui/floatingCommandWindow.js +41 -0
  51. package/dist/ui/floatingCommandWindow.js.map +1 -0
  52. package/package.json +4 -2
  53. package/dist/model/adapter.d.ts +0 -9
  54. package/dist/model/adapter.d.ts.map +0 -1
  55. package/dist/model/adapter.js +0 -7
  56. package/dist/model/adapter.js.map +0 -1
@@ -1,84 +1,109 @@
1
1
  import { utils } from "@omegagrid/core";
2
- export class CommandSection {
3
- constructor(id, name) {
4
- this.id = id;
5
- this.name = name;
2
+ export class Command {
3
+ constructor(source) {
4
+ if (source)
5
+ this.populate(source);
6
+ }
7
+ populate(source) {
8
+ this.id = source.id || source.name;
9
+ this.name = source.name || source.id;
10
+ this.group = source.group || 'default';
11
+ this._exec = source.exec;
12
+ this.props = source.props;
13
+ }
14
+ getSourceData() {
15
+ return {
16
+ id: this.id,
17
+ name: this.name,
18
+ group: this.group,
19
+ props: this.props,
20
+ exec: this._exec,
21
+ };
22
+ }
23
+ exec(value) {
24
+ return this._exec ? this._exec(this, value) : null;
25
+ }
26
+ }
27
+ export class CommandGroup {
28
+ constructor(source) {
6
29
  this.commands = new Map();
7
30
  this.open = true;
31
+ this.id = source.id || source.name;
32
+ this.name = source.name || source.id;
33
+ source.commands?.forEach(c => this.addCommand(c));
8
34
  }
9
35
  addCommand(command) {
10
- this.commands.set(command.id, command);
36
+ const cmd = command instanceof Command ? command : new Command(command);
37
+ this.commands.set(cmd.id, cmd);
11
38
  }
12
- }
13
- export class Command {
14
- constructor(options) {
15
- Object.assign(this, options);
16
- this.id = options.id || options.name;
17
- this.name = options.name || options.id;
18
- }
19
- exec(...params) {
20
- if (this.fn)
21
- this.fn(...params);
39
+ getSourceData() {
40
+ return {
41
+ id: this.id,
42
+ name: this.name,
43
+ commands: Array.from([...this.commands].map(([_, c]) => c.getSourceData())),
44
+ };
22
45
  }
23
46
  }
24
47
  export class Commands {
25
48
  get count() {
26
49
  let cnt = 0;
27
- this.sections.forEach(section => cnt += section.commands.size);
50
+ this.groups.forEach(group => cnt += group.commands.size);
28
51
  return cnt;
29
52
  }
30
53
  constructor(commands) {
31
- this.sections = new Map();
54
+ this.groups = new Map();
32
55
  if (commands)
33
56
  commands.forEach(c => this.register(c));
34
57
  }
35
58
  clear() {
36
- this.sections.clear();
59
+ this.groups.clear();
37
60
  return this;
38
61
  }
39
- registerSection(section, append = true) {
40
- const s = append && this.sections.has(section.id) ? this.sections.get(section.id) : new CommandSection(section.id, section.name);
41
- section.commands?.forEach(c => s.commands.set(c.id, c));
42
- this.sections.set(s.id, s);
43
- return s;
62
+ registerGroup(group) {
63
+ const g = this.groups.has(group.id) ? this.groups.get(group.id) : new CommandGroup(group);
64
+ group.commands?.forEach(c => g.commands.set(c.id, new Command(c)));
65
+ this.groups.set(g.id, g);
66
+ return g;
44
67
  }
45
68
  removeSection(sectionId) {
46
- this.sections.delete(sectionId);
69
+ this.groups.delete(sectionId);
47
70
  }
48
71
  register(command) {
49
- const sectionId = command.section || 'default';
50
- const section = this.sections.get(sectionId) || this.registerSection({ id: sectionId, name: sectionId });
51
- section.addCommand(new Command(command));
72
+ const groupId = command.group || 'default';
73
+ const group = this.groups.get(groupId) || this.registerGroup({ id: groupId, name: groupId });
74
+ group.addCommand(command);
52
75
  }
53
76
  remove(name) {
54
- this.sections.forEach(section => section.commands.delete(name));
77
+ this.groups.forEach(group => group.commands.delete(name));
55
78
  }
56
79
  get(name) {
57
- for (const section of this.sections.values()) {
58
- if (section.commands.has(name))
59
- return section.commands.get(name);
80
+ for (const group of this.groups.values()) {
81
+ if (group.commands.has(name))
82
+ return group.commands.get(name);
60
83
  }
61
84
  return null;
62
85
  }
63
- exec(command, ...params) {
64
- this.get(command)?.exec(...params);
86
+ exec(id, value) {
87
+ return this.get(id)?.exec(value);
65
88
  }
66
- filter(term, includeSections = false, emptySections = false) {
89
+ filter(term, includeGroups = false, emptyGroups = false) {
67
90
  const items = [];
68
91
  const regex = term == null ? null : new RegExp(utils.escapeRegExp(term), 'ig');
69
- for (const section of this.sections.values()) {
70
- let sectionIcluded = false;
71
- const sectionMatch = regex ? regex.test(section.name) : true;
72
- if (sectionMatch && emptySections) {
73
- items.push(section);
74
- sectionIcluded = true;
92
+ for (const group of this.groups.values()) {
93
+ let groupIncluded = false;
94
+ const groupMatch = regex ? regex.test(group.name) : true;
95
+ if (groupMatch && emptyGroups) {
96
+ if (includeGroups) {
97
+ items.push(group);
98
+ }
99
+ groupIncluded = true;
75
100
  }
76
- if (section.open) {
77
- section.commands.forEach(command => {
78
- if (sectionMatch || regex.test(command.name)) {
79
- if (includeSections && !sectionIcluded) {
80
- items.push(section);
81
- sectionIcluded = true;
101
+ if (group.open) {
102
+ group.commands.forEach(command => {
103
+ if (groupMatch || regex.test(command.name)) {
104
+ if (includeGroups && !groupIncluded) {
105
+ items.push(group);
106
+ groupIncluded = true;
82
107
  }
83
108
  items.push(command);
84
109
  }
@@ -87,11 +112,5 @@ export class Commands {
87
112
  }
88
113
  return items;
89
114
  }
90
- merge(commands) {
91
- const mergedCommands = new Commands();
92
- this.sections.forEach(s => mergedCommands.registerSection(s));
93
- commands.sections.forEach(s => mergedCommands.registerSection(s));
94
- return mergedCommands;
95
- }
96
115
  }
97
116
  //# sourceMappingURL=commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/model/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC,MAAM,OAAO,cAAc;IAK1B,YACiB,EAAU,EACV,IA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,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","sourcesContent":["import { utils } from \"@omegagrid/core\";\n\nexport type CommandFunction = (...params: string[]) => void;\n\nexport class CommandSection {\n\n\tpublic readonly commands = new Map<string, Command>();\n\tpublic open = true;\n\n\tconstructor(\n\t\tpublic readonly id: string,\n\t\tpublic readonly name: string\n\t) { }\n\n\taddCommand(command: Command) {\n\t\tthis.commands.set(command.id, command);\n\t}\n\n}\n\nexport class Command {\n\n\tpublic readonly id: string;\n\tpublic readonly name: string;\n\tpublic readonly value: string;\n\tpublic readonly section: string;\n\tpublic readonly fn: CommandFunction;\n\tpublic readonly requiredParams: number;\n\n\tconstructor(options: Partial<Command>) {\n\t\tObject.assign(this, options);\n\t\tthis.id = options.id || options.name;\n\t\tthis.name = options.name || options.id;\n\t}\n\n\texec(...params: string[]) {\n\t\tif (this.fn) this.fn(...params);\n\t}\n\n}\n\nexport class Commands {\n\t\n\tpublic readonly sections = new Map<string, CommandSection>();\n\n\tget count() {\n\t\tlet cnt = 0;\n\t\tthis.sections.forEach(section => cnt += section.commands.size);\n\t\treturn cnt;\n\t}\n\n\tconstructor(commands?: Partial<Command>[]) {\n\t\tif (commands) commands.forEach(c => this.register(c));\n\t}\n\n\tclear() {\n\t\tthis.sections.clear();\n\t\treturn this;\n\t}\n\n\tregisterSection(section: Partial<CommandSection>, append = true) {\n\t\tconst s = append && this.sections.has(section.id) ? this.sections.get(section.id) : new CommandSection(section.id, section.name);\n\t\tsection.commands?.forEach(c => s.commands.set(c.id, c));\n\t\tthis.sections.set(s.id, s);\n\t\treturn s;\n\t}\n\n\tremoveSection(sectionId: string) {\n\t\tthis.sections.delete(sectionId);\n\t}\n\t\n\tregister(command: Partial<Command>) {\n\t\tconst sectionId = command.section || 'default';\n\t\tconst section = this.sections.get(sectionId) || this.registerSection({id: sectionId, name: sectionId});\n\t\tsection.addCommand(new Command(command));\n\t}\n\n\tremove(name: string) {\n\t\tthis.sections.forEach(section => section.commands.delete(name));\n\t}\n\n\tget(name: string) {\n\t\tfor (const section of this.sections.values()) {\n\t\t\tif (section.commands.has(name)) return section.commands.get(name);\n\t\t}\n\t\treturn null;\n\t}\n\n\texec(command: string, ...params: string[]) {\n\t\tthis.get(command)?.exec(...params);\n\t}\n\n\tfilter(term?: string, includeSections = false, emptySections = false): (CommandSection|Command)[] {\n\t\tconst items: (CommandSection|Command)[] = [];\n\t\tconst regex = term == null ? null : new RegExp(utils.escapeRegExp(term), 'ig');\n\t\tfor (const section of this.sections.values()) {\n\t\t\tlet sectionIcluded = false;\n\t\t\tconst sectionMatch = regex ? regex.test(section.name) : true;\n\t\t\tif (sectionMatch && emptySections) {\n\t\t\t\titems.push(section);\n\t\t\t\tsectionIcluded = true;\n\t\t\t}\n\n\t\t\tif (section.open) {\n\t\t\t\tsection.commands.forEach(command => {\n\t\t\t\t\tif (sectionMatch || regex.test(command.name)) {\n\t\t\t\t\t\tif (includeSections && !sectionIcluded) {\n\t\t\t\t\t\t\titems.push(section);\n\t\t\t\t\t\t\tsectionIcluded = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\titems.push(command);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn items;\n\t}\n\n\tmerge(commands: Commands): Commands {\n\t\tconst mergedCommands = new Commands();\n\t\tthis.sections.forEach(s => mergedCommands.registerSection(s));\n\t\tcommands.sections.forEach(s => mergedCommands.registerSection(s));\n\t\treturn mergedCommands;\n\t}\n\n}"]}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/model/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA6BpE,MAAM,OAAO,OAAO;IASnB,YAAY,MAAsB;QACjC,IAAI,MAAM;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,MAAqB;QAC7B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,SAAS,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,aAAa;QACZ,OAAO;YACN,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,KAAK;SAChB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,KAAc;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI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aAAa,GAAG,IAAI,CAAC;YACtB,CAAC;YAED,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;gBAChB,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBAChC,IAAI,UAAU,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC5C,IAAI,aAAa,IAAI,CAAC,aAAa,EAAE,CAAC;4BACrC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClB,aAAa,GAAG,IAAI,CAAC;wBACtB,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;CASD","sourcesContent":["import { CustomProperties, IconSpec, utils } from \"@omegagrid/core\";\nimport { TabItem } from \"@omegagrid/tabs\";\n\nexport type CommandSectionSwitch = {\n\tkey: string,\n\tvalue: string,\n\tchecked?: boolean,\n\ticon?: IconSpec|string,\n}\n\nexport type CommandsSection = TabItem & {\n\tplaceholder?: string,\n\ttriggerCommand?: string,\n\tswitches?: CommandSectionSwitch[],\n}\n\nexport type CommandMode = 'search' | 'input' | 'none';\nexport type CommandInput = {id: string, value?: string};\nexport type CommandFunction = (command: Command, value?: string) => void|Promise<void>;\n\t\nexport type CommandSource = {\n\tid?: string;\n\tname?: string;\n\tvalue?: string;\n\tgroup?: string;\n\texec?: CommandFunction;\n\tprops?: CustomProperties;\n}\n\nexport class Command {\n\n\tid: string;\n\tname: string;\n\tgroup: string;\n\tprops: CustomProperties;\n\n\tprivate _exec: CommandFunction;\n\n\tconstructor(source?: CommandSource) {\n\t\tif (source) this.populate(source);\n\t}\n\n\tpopulate(source: CommandSource) {\n\t\tthis.id = source.id || source.name;\n\t\tthis.name = source.name || source.id;\n\t\tthis.group = source.group || 'default';\n\t\tthis._exec = source.exec;\n\t\tthis.props = source.props;\n\t}\n\n\tgetSourceData(): CommandSource {\n\t\treturn {\n\t\t\tid: this.id,\n\t\t\tname: this.name,\n\t\t\tgroup: this.group,\n\t\t\tprops: this.props,\n\t\t\texec: this._exec,\n\t\t};\n\t}\n\n\texec(value?: string) {\n\t\treturn this._exec ? this._exec(this, value) : null;\n\t}\n\n}\n\nexport type CommandGroupSource = {\n\tid: string,\n\tname?: string\n\tcommands?: CommandSource[];\n}\n\nexport class CommandGroup {\n\n\tpublic readonly commands = new Map<string, Command>();\n\tpublic readonly id: string;\n\tpublic readonly name: string;\n\tpublic open = true;\n\n\tconstructor(source: CommandGroupSource) {\n\t\tthis.id = source.id || source.name;\n\t\tthis.name = source.name || source.id;\n\t\tsource.commands?.forEach(c => this.addCommand(c));\n\t}\n\n\taddCommand(command: Command|CommandSource) {\n\t\tconst cmd = command instanceof Command ? command : new Command(command);\n\t\tthis.commands.set(cmd.id, cmd);\n\t}\n\n\tgetSourceData(): CommandGroupSource {\n\t\treturn {\n\t\t\tid: this.id,\n\t\t\tname: this.name,\n\t\t\tcommands: Array.from([...this.commands].map(([_, c]) => c.getSourceData())),\n\t\t};\n\t}\n\n}\n\nexport class Commands {\n\t\n\tpublic readonly groups = new Map<string, CommandGroup>();\n\n\tget count() {\n\t\tlet cnt = 0;\n\t\tthis.groups.forEach(group => cnt += group.commands.size);\n\t\treturn cnt;\n\t}\n\n\tconstructor(commands?: CommandSource[]) {\n\t\tif (commands) commands.forEach(c => this.register(c));\n\t}\n\n\tclear() {\n\t\tthis.groups.clear();\n\t\treturn this;\n\t}\n\n\tregisterGroup(group: CommandGroupSource) {\n\t\tconst g = this.groups.has(group.id) ? this.groups.get(group.id) : new CommandGroup(group);\n\t\tgroup.commands?.forEach(c => g.commands.set(c.id, new Command(c)));\n\t\tthis.groups.set(g.id, g);\n\t\treturn g;\n\t}\n\n\tremoveSection(sectionId: string) {\n\t\tthis.groups.delete(sectionId);\n\t}\n\t\n\tregister(command: Command|CommandSource) {\n\t\tconst groupId = command.group || 'default';\n\t\tconst group = this.groups.get(groupId) || this.registerGroup({id: groupId, name: groupId});\n\t\tgroup.addCommand(command);\n\t}\n\n\tremove(name: string) {\n\t\tthis.groups.forEach(group => group.commands.delete(name));\n\t}\n\n\tget(name: string) {\n\t\tfor (const group of this.groups.values()) {\n\t\t\tif (group.commands.has(name)) return group.commands.get(name);\n\t\t}\n\t\treturn null;\n\t}\n\n\texec(id: string, value?: string) {\n\t\treturn this.get(id)?.exec(value);\n\t}\n\n\tfilter(term?: string, includeGroups = false, emptyGroups = false): (CommandGroup|Command)[] {\n\t\tconst items: (CommandGroup|Command)[] = [];\n\t\tconst regex = term == null ? null : new RegExp(utils.escapeRegExp(term), 'ig');\n\t\tfor (const group of this.groups.values()) {\n\t\t\tlet groupIncluded = false;\n\t\t\tconst groupMatch = regex ? regex.test(group.name) : true;\n\t\t\tif (groupMatch && emptyGroups) {\n\t\t\t\tif (includeGroups) {\n\t\t\t\t\titems.push(group);\n\t\t\t\t}\n\t\t\t\tgroupIncluded = true;\n\t\t\t}\n\n\t\t\tif (group.open) {\n\t\t\t\tgroup.commands.forEach(command => {\n\t\t\t\t\tif (groupMatch || regex.test(command.name)) {\n\t\t\t\t\t\tif (includeGroups && !groupIncluded) {\n\t\t\t\t\t\t\titems.push(group);\n\t\t\t\t\t\t\tgroupIncluded = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\titems.push(command);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn items;\n\t}\n\n\t// merge(commands: Commands): Commands {\n\t// \tconst mergedCommands = new Commands();\n\t// \tthis.groups.forEach(g => mergedCommands.registerGroup(g.getSourceData()));\n\t// \tcommands.groups.forEach(g => mergedCommands.registerGroup(g.getSourceData()));\n\t// \treturn mergedCommands;\n\t// }\n\n}"]}
@@ -1,4 +1,3 @@
1
1
  export * from './commands';
2
- export * from './adapter';
3
2
  export * from './options';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export * from './commands';
2
- export * from './adapter';
3
2
  export * from './options';
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC","sourcesContent":["export * from './commands';\nexport * from './adapter';\nexport * from './options';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC","sourcesContent":["export * from './commands';\nexport * from './options';\n"]}
@@ -1,8 +1,12 @@
1
1
  import { CommonOptions } from "@omegagrid/core";
2
- import { CommandRenderer, SectionRenderer } from "../ui";
2
+ import { CommandRenderer, GroupRenderer } from "../ui";
3
+ import { CSSResultOrNative } from "lit";
3
4
  export type Options = {
4
5
  commandRenderer?: CommandRenderer;
5
- sectionRenderer?: SectionRenderer;
6
+ groupRenderer?: GroupRenderer;
7
+ commandDelimiter?: string;
8
+ itemStyle?: CSSResultOrNative | string | (CSSResultOrNative | string)[];
9
+ itemHeight?: number;
6
10
  } & CommonOptions;
7
11
  export declare function initOptions(options?: Partial<Options>, origOptions?: Options): Options;
8
12
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/model/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;CAClC,GAAG,aAAa,CAAC;AAIlB,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAS5F"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/model/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAC;AAGxC,MAAM,MAAM,OAAO,GAAG;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,iBAAiB,GAAC,MAAM,GAAC,CAAC,iBAAiB,GAAC,MAAM,CAAC,EAAE,CAAC;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,aAAa,CAAC;AAOlB,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAS5F"}
@@ -1,5 +1,9 @@
1
1
  import { initCommonOptions } from "@omegagrid/core";
2
- const DEFAULT_OPTIONS = {};
2
+ import constants from "../constants";
3
+ const DEFAULT_OPTIONS = {
4
+ commandDelimiter: '>',
5
+ itemHeight: constants.COMMAND_ITEM_HEIGHT,
6
+ };
3
7
  export function initOptions(options, origOptions = null) {
4
8
  const opts = {
5
9
  ...initCommonOptions(options, origOptions),
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/model/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAQnE,MAAM,eAAe,GAAqB,EAAE,CAAC;AAE7C,MAAM,UAAU,WAAW,CAAC,OAA0B,EAAE,cAAuB,IAAI;IAClF,MAAM,IAAI,GAAG;QACZ,GAAG,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC;QAC1C,GAAG,eAAe;QAClB,GAAG,WAAW;QACd,GAAG,OAAO;KACV,CAAC;IAEF,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { initCommonOptions, CommonOptions } from \"@omegagrid/core\";\nimport { CommandRenderer, SectionRenderer } from \"../ui\";\n\nexport type Options = {\n\tcommandRenderer?: CommandRenderer,\n\tsectionRenderer?: SectionRenderer,\n} & CommonOptions;\n\nconst DEFAULT_OPTIONS: Partial<Options> = {};\n\nexport function initOptions(options?: Partial<Options>, origOptions: Options = null): Options {\n\tconst opts = {\n\t\t...initCommonOptions(options, origOptions),\n\t\t...DEFAULT_OPTIONS,\n\t\t...origOptions,\n\t\t...options,\n\t};\n\n\treturn opts;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/model/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAGnE,OAAO,SAAS,MAAM,cAAc,CAAC;AAUrC,MAAM,eAAe,GAAqB;IACzC,gBAAgB,EAAE,GAAG;IACrB,UAAU,EAAE,SAAS,CAAC,mBAAmB;CACzC,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,OAA0B,EAAE,cAAuB,IAAI;IAClF,MAAM,IAAI,GAAG;QACZ,GAAG,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC;QAC1C,GAAG,eAAe;QAClB,GAAG,WAAW;QACd,GAAG,OAAO;KACV,CAAC;IAEF,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { initCommonOptions, CommonOptions } from \"@omegagrid/core\";\nimport { CommandRenderer, GroupRenderer } from \"../ui\";\nimport { CSSResultOrNative } from \"lit\";\nimport constants from \"../constants\";\n\nexport type Options = {\n\tcommandRenderer?: CommandRenderer,\n\tgroupRenderer?: GroupRenderer,\n\tcommandDelimiter?: string,\n\titemStyle?: CSSResultOrNative|string|(CSSResultOrNative|string)[],\n\titemHeight?: number,\n} & CommonOptions;\n\nconst DEFAULT_OPTIONS: Partial<Options> = {\n\tcommandDelimiter: '>',\n\titemHeight: constants.COMMAND_ITEM_HEIGHT,\n};\n\nexport function initOptions(options?: Partial<Options>, origOptions: Options = null): Options {\n\tconst opts = {\n\t\t...initCommonOptions(options, origOptions),\n\t\t...DEFAULT_OPTIONS,\n\t\t...origOptions,\n\t\t...options,\n\t};\n\n\treturn opts;\n}\n"]}
@@ -1,60 +1,73 @@
1
- import { Commands, Command, CommandsAdapter, CommandSection } from "../model";
2
- import { List, ListItemRenderer, ListSelectEvent } from "@omegagrid/core";
1
+ import { Commands, Command, CommandGroup, CommandsSection, CommandMode, CommandSource } from "../model";
2
+ import { CommandsAdapter } from "../adapters";
3
+ import { DropdownList, events, List, ListItemRenderer, ListItemRendererOptions, ListSelectEvent } from "@omegagrid/core";
3
4
  import { LitElement, TemplateResult, PropertyValues } from 'lit';
4
- import { Options } from "../model";
5
+ import { TabEvent } from "@omegagrid/tabs";
5
6
  export declare class CommandEvent extends Event {
6
7
  readonly command?: Command;
7
8
  readonly value?: string;
9
+ readonly section?: CommandsSection;
8
10
  constructor(type: string, args?: Partial<CommandEvent>);
9
11
  }
10
- export type CommandRenderer = (div: HTMLDivElement, command: Command) => string | TemplateResult<1> | null;
11
- export type SectionRenderer = (div: HTMLDivElement, section: CommandSection) => string | TemplateResult<1> | null;
12
+ export type CommandRenderer = (div: HTMLDivElement, command: Command, opts?: ListItemRendererOptions) => string | void | TemplateResult<1> | null;
13
+ export type GroupRenderer = (div: HTMLDivElement, group: CommandGroup, opts?: ListItemRendererOptions) => string | void | TemplateResult<1> | null;
12
14
  export declare class CommandWindow extends LitElement {
13
15
  static styles: import("lit").CSSResult[];
14
- private inputRef;
15
- get input(): HTMLInputElement;
16
- get inputValue(): string;
17
- private listRef;
18
- get list(): List;
19
16
  private visibleItems;
20
- options: Options;
17
+ options: import("../model").Options;
21
18
  /**
22
19
  * search = commands are filtered by input value
23
20
  * input = commands are not filtered, input is used to enter custom value
24
21
  * none = no input, only command list is shown
25
22
  */
26
- mode: 'search' | 'input' | 'none';
23
+ mode: CommandMode;
27
24
  value: string;
25
+ sectionPosition: 'top' | 'bottom' | 'left' | 'right';
28
26
  text: string;
29
- commands: Commands;
27
+ commands: CommandSource[];
30
28
  adapter: CommandsAdapter;
31
29
  target: HTMLElement;
32
- triggerKey: string;
33
30
  placeholder: string;
34
- showSections: boolean;
35
- requireUpdateCommands: boolean;
36
- _commandRenderer: CommandRenderer;
37
- _sectionRenderer: SectionRenderer;
31
+ showGroups: boolean;
32
+ model: Commands;
33
+ sections: CommandsSection[];
34
+ activeSectionIndex: number;
35
+ noResults: boolean;
36
+ list: List;
37
+ input: HTMLInputElement;
38
+ dropdown: DropdownList;
39
+ get activeSection(): CommandsSection;
40
+ get inputValue(): string;
41
+ get parsedInput(): {
42
+ section: number;
43
+ value: string;
44
+ };
38
45
  get filterValue(): string;
39
- exec(dispatchEvent?: boolean): void;
46
+ _commandRenderer: CommandRenderer;
47
+ _groupRenderer: GroupRenderer;
48
+ exec(dispatchEvent?: boolean): Promise<void>;
40
49
  _onKeyDown: (e: KeyboardEvent) => void;
41
- _onKeyUp: {
42
- (this: unknown, ...args: [e: any] & any[]): Promise<void>;
50
+ _debounceInput: {
51
+ (this: unknown, ...args: [] & any[]): Promise<void>;
43
52
  cancel: (reason?: any) => void;
44
53
  };
54
+ _onInput: (e: InputEvent) => void;
55
+ _onSectionSelect: (e: TabEvent) => void;
56
+ _onDropdownChange: (e: events.ChangeEvent) => void;
45
57
  constructor();
46
- open(dispatchEvent?: boolean): Promise<void>;
47
- close(dispatchEvent?: boolean): void;
48
58
  connectedCallback(): void;
49
- _onTargetKeyDown: (e: KeyboardEvent) => void;
59
+ focus(): void;
60
+ clearFilter(updateCommands?: boolean): void;
50
61
  willUpdate(props: PropertyValues): Promise<void>;
51
62
  updated(props: Map<PropertyKey, unknown>): Promise<void>;
52
63
  _onSelect: (e: ListSelectEvent) => void;
53
64
  _itemRenderer: ListItemRenderer;
54
- firstUpdated(): void;
55
65
  updateCommands(): Promise<void>;
56
- toggleSection(sectionId: string): Promise<void>;
57
- updatePosition(): void;
66
+ toggleGroup(groupId: string): Promise<void>;
67
+ private getSectionTitle;
68
+ renderTabs: () => "" | TemplateResult<1>;
69
+ renderDropdown: () => "" | TemplateResult<1>;
70
+ renderSwitches: () => "" | TemplateResult<1>;
58
71
  render: () => TemplateResult<1>;
59
72
  }
60
73
  //# sourceMappingURL=commandWindow.d.ts.map
@@ -1 +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,EAAE,eAAe,EAAqB,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAQ,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAMvE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBAAa,YAAa,SAAQ,KAAK;IAEtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;CAItD;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAA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