@api-client/ui 0.5.39 → 0.5.41

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 (292) hide show
  1. package/build/src/elements/contextual-menu/{internals/ContextualMenu.d.ts → ContextualMenu.d.ts} +11 -6
  2. package/build/src/elements/contextual-menu/ContextualMenu.d.ts.map +1 -0
  3. package/build/src/elements/contextual-menu/{internals/ContextualMenu.js → ContextualMenu.js} +25 -3
  4. package/build/src/elements/contextual-menu/ContextualMenu.js.map +1 -0
  5. package/build/src/elements/contextual-menu/internals/types.d.ts +16 -7
  6. package/build/src/elements/contextual-menu/internals/types.d.ts.map +1 -1
  7. package/build/src/elements/contextual-menu/internals/types.js.map +1 -1
  8. package/build/tsconfig.tsbuildinfo +1 -0
  9. package/package.json +1 -1
  10. package/src/elements/contextual-menu/{internals/ContextualMenu.ts → ContextualMenu.ts} +31 -7
  11. package/src/elements/contextual-menu/internals/types.ts +17 -7
  12. package/.aiexclude +0 -3
  13. package/.cursor/rules/html-and-css-best-practices.mdc +0 -63
  14. package/.cursor/rules/lit-best-practices.mdc +0 -89
  15. package/.editorconfig +0 -29
  16. package/.github/CONTRIBUTING.md +0 -24
  17. package/.github/instructions/html-and-css-best-practices.instructions.md +0 -70
  18. package/.github/instructions/lit-best-practices.instructions.md +0 -90
  19. package/.github/release.yml +0 -14
  20. package/.github/stale.yml +0 -23
  21. package/.github/workflows/auto-release.yml +0 -182
  22. package/.github/workflows/release.yml +0 -82
  23. package/.prettierrc.js +0 -14
  24. package/.vscode/settings.json +0 -18
  25. package/RELEASE.md +0 -163
  26. package/RELEASE_SETUP.md +0 -235
  27. package/build/src/demo/DemoPage.d.ts +0 -81
  28. package/build/src/demo/DemoPage.d.ts.map +0 -1
  29. package/build/src/demo/DemoPage.js +0 -175
  30. package/build/src/demo/DemoPage.js.map +0 -1
  31. package/build/src/demo/DemoStyles.d.ts +0 -3
  32. package/build/src/demo/DemoStyles.d.ts.map +0 -1
  33. package/build/src/demo/DemoStyles.js +0 -60
  34. package/build/src/demo/DemoStyles.js.map +0 -1
  35. package/build/src/elements/contextual-menu/internals/ContextualMenu.d.ts.map +0 -1
  36. package/build/src/elements/contextual-menu/internals/ContextualMenu.js.map +0 -1
  37. package/build/test/elements/navigation/Navigation.test.d.ts +0 -3
  38. package/build/test/elements/navigation/Navigation.test.d.ts.map +0 -1
  39. package/build/test/elements/navigation/Navigation.test.js +0 -113
  40. package/build/test/elements/navigation/Navigation.test.js.map +0 -1
  41. package/commitlint.config.cjs +0 -2
  42. package/demo/elements/authorization/AuthPlugin.js +0 -57
  43. package/demo/elements/authorization/AuthProxy.js +0 -215
  44. package/demo/elements/authorization/api-key.html +0 -27
  45. package/demo/elements/authorization/api-key.ts +0 -44
  46. package/demo/elements/authorization/basic.html +0 -27
  47. package/demo/elements/authorization/basic.ts +0 -43
  48. package/demo/elements/authorization/bearer.html +0 -27
  49. package/demo/elements/authorization/bearer.ts +0 -43
  50. package/demo/elements/authorization/env.js +0 -8
  51. package/demo/elements/authorization/index.html +0 -44
  52. package/demo/elements/authorization/ntlm.html +0 -27
  53. package/demo/elements/authorization/ntlm.ts +0 -43
  54. package/demo/elements/authorization/oauth-authorize.html +0 -75
  55. package/demo/elements/authorization/oauth-authorize.ts +0 -40
  56. package/demo/elements/authorization/oauth-error.html +0 -18
  57. package/demo/elements/authorization/oauth-error.ts +0 -10
  58. package/demo/elements/authorization/oauth-popup.html +0 -36
  59. package/demo/elements/authorization/oauth2.html +0 -27
  60. package/demo/elements/authorization/oauth2.ts +0 -100
  61. package/demo/elements/authorization/oidc.html +0 -27
  62. package/demo/elements/authorization/oidc.ts +0 -139
  63. package/demo/elements/authorization/private.crt +0 -31
  64. package/demo/elements/authorization/private.csr +0 -28
  65. package/demo/elements/authorization/private.key +0 -51
  66. package/demo/elements/authorization/private.pem +0 -31
  67. package/demo/elements/authorization/redirect.html +0 -20
  68. package/demo/elements/authorization/ssl-commands.sh +0 -30
  69. package/demo/elements/authorization/ssl.conf +0 -24
  70. package/demo/elements/autocomplete/index.html +0 -64
  71. package/demo/elements/autocomplete/index.ts +0 -171
  72. package/demo/elements/code-editor/CodeEditorDemo.ts +0 -173
  73. package/demo/elements/code-editor/index.html +0 -19
  74. package/demo/elements/context-menu/DemoIcons.ts +0 -21
  75. package/demo/elements/context-menu/basic.html +0 -25
  76. package/demo/elements/context-menu/basic.ts +0 -119
  77. package/demo/elements/context-menu/custom-data.html +0 -25
  78. package/demo/elements/context-menu/custom-data.ts +0 -62
  79. package/demo/elements/context-menu/demo.css +0 -28
  80. package/demo/elements/context-menu/enabled-state.html +0 -25
  81. package/demo/elements/context-menu/enabled-state.ts +0 -73
  82. package/demo/elements/context-menu/icons.html +0 -25
  83. package/demo/elements/context-menu/icons.ts +0 -64
  84. package/demo/elements/context-menu/index.html +0 -43
  85. package/demo/elements/context-menu/nested.html +0 -25
  86. package/demo/elements/context-menu/nestedt.ts +0 -152
  87. package/demo/elements/context-menu/no-execute.html +0 -25
  88. package/demo/elements/context-menu/no-execute.ts +0 -134
  89. package/demo/elements/context-menu/radio-menu.html +0 -25
  90. package/demo/elements/context-menu/radio-menu.ts +0 -83
  91. package/demo/elements/context-menu/separators.html +0 -25
  92. package/demo/elements/context-menu/separators.ts +0 -172
  93. package/demo/elements/currency/index.html +0 -91
  94. package/demo/elements/currency/index.ts +0 -352
  95. package/demo/elements/environment/environment-editor.html +0 -20
  96. package/demo/elements/environment/environment-editor.ts +0 -49
  97. package/demo/elements/environment/index.html +0 -33
  98. package/demo/elements/environment/server-editor.html +0 -20
  99. package/demo/elements/environment/server-editor.ts +0 -67
  100. package/demo/elements/environment/variables-editor.html +0 -20
  101. package/demo/elements/environment/variables-editor.ts +0 -94
  102. package/demo/elements/har/har-viewer.html +0 -20
  103. package/demo/elements/har/har-viewer.ts +0 -76
  104. package/demo/elements/har/har1.har +0 -3044
  105. package/demo/elements/har/har2.json +0 -439
  106. package/demo/elements/har/index.html +0 -26
  107. package/demo/elements/highlight/example.md +0 -27
  108. package/demo/elements/highlight/index.html +0 -31
  109. package/demo/elements/highlight/marked-highlight.html +0 -132
  110. package/demo/elements/highlight/marked-highlight.ts +0 -22
  111. package/demo/elements/highlight/prism-highlight.html +0 -62
  112. package/demo/elements/highlight/prism-highlight.ts +0 -17
  113. package/demo/elements/http/body-editor.html +0 -17
  114. package/demo/elements/http/body-editor.ts +0 -115
  115. package/demo/elements/http/headers.html +0 -17
  116. package/demo/elements/http/headers.ts +0 -59
  117. package/demo/elements/http/http-assertions.html +0 -20
  118. package/demo/elements/http/http-assertions.ts +0 -89
  119. package/demo/elements/http/http-flows.html +0 -23
  120. package/demo/elements/http/http-flows.ts +0 -89
  121. package/demo/elements/http/index.html +0 -45
  122. package/demo/elements/http/request-editor.html +0 -26
  123. package/demo/elements/http/request-editor.ts +0 -197
  124. package/demo/elements/http/request-log.html +0 -16
  125. package/demo/elements/http/request-log.ts +0 -136
  126. package/demo/elements/http/url-editing.html +0 -17
  127. package/demo/elements/http/url-editing.ts +0 -112
  128. package/demo/elements/icons/index.html +0 -81
  129. package/demo/elements/icons/index.ts +0 -52
  130. package/demo/elements/index.html +0 -72
  131. package/demo/elements/mention-textarea/index.html +0 -19
  132. package/demo/elements/mention-textarea/index.ts +0 -205
  133. package/demo/elements/navigation/navigation-item.html +0 -49
  134. package/demo/elements/navigation/navigation-item.ts +0 -131
  135. package/demo/elements/navigation/navigation.html +0 -20
  136. package/demo/elements/navigation/navigation.ts +0 -45
  137. package/demo/elements/project/index.html +0 -29
  138. package/demo/elements/project/project-run-report.html +0 -20
  139. package/demo/elements/project/project-run-report.ts +0 -132
  140. package/demo/elements/project/request-editor.html +0 -23
  141. package/demo/elements/project/request-editor.ts +0 -232
  142. package/demo/elements/user/user-avatar.html +0 -17
  143. package/demo/elements/user/user-avatar.ts +0 -60
  144. package/demo/env.js +0 -4
  145. package/demo/index.html +0 -34
  146. package/demo/layout/index.html +0 -94
  147. package/demo/layout/index.ts +0 -190
  148. package/demo/md/DemoStyles.ts +0 -61
  149. package/demo/md/UiDemoPage.ts +0 -6
  150. package/demo/md/buttons/button.html +0 -121
  151. package/demo/md/buttons/button.ts +0 -246
  152. package/demo/md/buttons/group.html +0 -36
  153. package/demo/md/buttons/group.ts +0 -171
  154. package/demo/md/checkbox/index.html +0 -39
  155. package/demo/md/checkbox/index.ts +0 -220
  156. package/demo/md/chip/chip.html +0 -70
  157. package/demo/md/chip/chip.ts +0 -219
  158. package/demo/md/chip/pawel6c9a.jpg +0 -0
  159. package/demo/md/collapse/CustomDetail.ts +0 -89
  160. package/demo/md/collapse/collapse.html +0 -21
  161. package/demo/md/collapse/collapse.ts +0 -78
  162. package/demo/md/date-picker/date-picker.ts +0 -336
  163. package/demo/md/date-picker/index.html +0 -171
  164. package/demo/md/dialog/confirm-dialog.html +0 -49
  165. package/demo/md/dialog/confirm-dialog.ts +0 -121
  166. package/demo/md/dialog/dialog.html +0 -25
  167. package/demo/md/dialog/dialog.ts +0 -468
  168. package/demo/md/dropdown-list/index.html +0 -31
  169. package/demo/md/dropdown-list/index.ts +0 -158
  170. package/demo/md/icon-button/index.html +0 -122
  171. package/demo/md/icon-button/index.ts +0 -132
  172. package/demo/md/index.html +0 -73
  173. package/demo/md/inputs/input.html +0 -73
  174. package/demo/md/inputs/input.ts +0 -278
  175. package/demo/md/inputs/radio.html +0 -39
  176. package/demo/md/inputs/radio.ts +0 -156
  177. package/demo/md/inputs/switch.html +0 -45
  178. package/demo/md/inputs/switch.ts +0 -144
  179. package/demo/md/list/list.html +0 -65
  180. package/demo/md/list/list.ts +0 -204
  181. package/demo/md/listbox/listbox.html +0 -31
  182. package/demo/md/listbox/listbox.ts +0 -27
  183. package/demo/md/menu/index.html +0 -19
  184. package/demo/md/menu/index.ts +0 -514
  185. package/demo/md/notification/snack.html +0 -21
  186. package/demo/md/notification/snack.ts +0 -70
  187. package/demo/md/progress/progress.html +0 -46
  188. package/demo/md/progress/progress.ts +0 -161
  189. package/demo/md/segmented-button/index.html +0 -21
  190. package/demo/md/segmented-button/index.ts +0 -55
  191. package/demo/md/select/index.html +0 -16
  192. package/demo/md/select/index.ts +0 -217
  193. package/demo/md/tabs/tabs.html +0 -40
  194. package/demo/md/tabs/tabs.ts +0 -214
  195. package/demo/oauth-popup.html +0 -36
  196. package/demo/page.css +0 -8
  197. package/demo/resources/calendar-month.png +0 -0
  198. package/demo/resources/favorite.png +0 -0
  199. package/demo/resources/fingerprint.png +0 -0
  200. package/demo/resources/home-work.png +0 -0
  201. package/demo/resources/mood.png +0 -0
  202. package/demo/resources/print.png +0 -0
  203. package/demo/resources/stars.png +0 -0
  204. package/demo/resources/theaters.png +0 -0
  205. package/demo/tsconfig.json +0 -4
  206. package/eslint.config.js +0 -97
  207. package/scripts/copy-assets.js +0 -21
  208. package/scripts/release.js +0 -66
  209. package/src/demo/DemoPage.ts +0 -169
  210. package/src/demo/DemoStyles.ts +0 -60
  211. package/test/README.md +0 -375
  212. package/test/contextual-menu/ContextMenu.test.ts +0 -760
  213. package/test/contextual-menu/ContextMenuElement.test.ts +0 -569
  214. package/test/core/activity.spec.ts +0 -413
  215. package/test/core/activity_manager.spec.ts +0 -544
  216. package/test/core/application.spec.ts +0 -218
  217. package/test/core/fragment.spec.ts +0 -565
  218. package/test/core/fragment_manager.spec.ts +0 -404
  219. package/test/core/live_data.spec.ts +0 -558
  220. package/test/core/renderer.spec.ts +0 -113
  221. package/test/dom-assertions.test.ts +0 -182
  222. package/test/elements/MonacoSetup.ts +0 -65
  223. package/test/elements/authorization/basic-method.test.ts +0 -177
  224. package/test/elements/authorization/bearer-method.test.ts +0 -143
  225. package/test/elements/authorization/ntlm-method.test.ts +0 -219
  226. package/test/elements/authorization/oauth2-client-credentials-method.test.ts +0 -334
  227. package/test/elements/authorization/oauth2-code-method.test.ts +0 -320
  228. package/test/elements/authorization/oauth2-custom-grant-method.test.ts +0 -255
  229. package/test/elements/authorization/oauth2-device-code-method.test.ts +0 -371
  230. package/test/elements/authorization/oauth2-implicit-method.test.ts +0 -407
  231. package/test/elements/authorization/oauth2-jwt-method.test.ts +0 -217
  232. package/test/elements/authorization/oauth2-password-method.test.ts +0 -275
  233. package/test/elements/authorization/openid-method.test.ts +0 -591
  234. package/test/elements/autocomplete/autocomplete-input.spec.ts +0 -646
  235. package/test/elements/code-editor/code-editor.accessibility.test.ts +0 -298
  236. package/test/elements/code-editor/code-editor.test.ts +0 -574
  237. package/test/elements/currency/CurrencyPicker.accessibility.test.ts +0 -328
  238. package/test/elements/currency/CurrencyPicker.core.test.ts +0 -318
  239. package/test/elements/currency/CurrencyPicker.integration.test.ts +0 -482
  240. package/test/elements/currency/CurrencyPicker.test.ts +0 -486
  241. package/test/elements/data-table/DataTable.browser.test.ts +0 -649
  242. package/test/elements/har/HarUtils.test.ts +0 -45
  243. package/test/elements/har/HarViewerElement.test.ts +0 -687
  244. package/test/elements/har/test-data/har1.har +0 -3044
  245. package/test/elements/highlight/MarkedHighlightElement.test.ts +0 -452
  246. package/test/elements/highlight/PrismHighlightElement.test.ts +0 -79
  247. package/test/elements/highlight/PrismHighlighter.test.ts +0 -94
  248. package/test/elements/highlight/remoteSanitization.md +0 -1
  249. package/test/elements/highlight/test.md +0 -3
  250. package/test/elements/highlight/test1.md +0 -3
  251. package/test/elements/highlight/test2.md +0 -1
  252. package/test/elements/http/BodyFormdataEditorElement.test.ts +0 -482
  253. package/test/elements/http/BodyMultipartEditorElement.test.ts +0 -658
  254. package/test/elements/http/BodyRawEditorElement.test.ts +0 -90
  255. package/test/elements/http/CertificateAdd.test.ts +0 -457
  256. package/test/elements/http/HttpAssertions.test.ts +0 -994
  257. package/test/elements/http/HttpFlows.test.ts +0 -502
  258. package/test/elements/http/UrlEncodeUtils.test.ts +0 -202
  259. package/test/elements/layout/SplitItem.test.ts +0 -440
  260. package/test/elements/layout/SplitLayoutManager.test.ts +0 -1501
  261. package/test/elements/layout/SplitPanel.test.ts +0 -1109
  262. package/test/elements/mention-textarea/MentionTextArea.basic.test.ts +0 -114
  263. package/test/elements/mention-textarea/MentionTextArea.test.ts +0 -613
  264. package/test/elements/navigation/Navigation.test.ts +0 -120
  265. package/test/env.ts +0 -15
  266. package/test/events/EventTypes.test.ts +0 -363
  267. package/test/events/EventsTestHelpers.ts +0 -16
  268. package/test/helpers/TestUtils.ts +0 -243
  269. package/test/helpers/UiMock.ts +0 -185
  270. package/test/lib/Dom.test.ts +0 -231
  271. package/test/md/button/UiButton.test.ts +0 -347
  272. package/test/md/button/UiIconButton.test.ts +0 -155
  273. package/test/md/chip/UiChip.test.ts +0 -219
  274. package/test/md/collapse/UiCollapse.test.ts +0 -250
  275. package/test/md/collapse/flex-layout.test.ts +0 -105
  276. package/test/md/date-time/DateTime.test.ts +0 -348
  277. package/test/md/dialog/UiConfirmDialog.test.ts +0 -131
  278. package/test/md/dialog/UiDialog.test.ts +0 -759
  279. package/test/md/menu/Menu.test.ts +0 -855
  280. package/test/md/menu/MenuIntegration.test.ts +0 -426
  281. package/test/md/menu/MenuItem.test.ts +0 -652
  282. package/test/md/menu/SubMenu.test.ts +0 -410
  283. package/test/md/progress/UiCircularProgressElement.test.ts +0 -481
  284. package/test/md/progress/UiProgressElement.test.ts +0 -117
  285. package/test/md/progress/UiRangeElement.test.ts +0 -156
  286. package/test/md/select/Select.test.ts +0 -925
  287. package/test/plugins/takeScreenshotPlugin.js +0 -35
  288. package/test/setup.test.ts +0 -217
  289. package/test/setup.ts +0 -117
  290. package/test/tsconfig.json +0 -7
  291. package/web-dev-server.config.js +0 -21
  292. package/web-test-runner.config.js +0 -90
@@ -1,8 +1,9 @@
1
- import { MenuItem } from './MenuItem.js';
2
- import type { CommandBase, ContextMenuCommand, CustomMenuEventDetail, MenuOptions, MenuPoint, MenuTriggerInfo } from './types.js';
3
- import type ContextMenuElement from './ContextualMenuElement.js';
1
+ import { MenuItem } from './internals/MenuItem.js';
2
+ import type { CommandBase, ContextMenuCommand, CustomMenuEventDetail, MenuOptions, MenuPoint, MenuTriggerInfo } from './internals/types.js';
3
+ import type ContextMenuElement from './internals/ContextualMenuElement.js';
4
4
  import { Logger, ILogObj } from 'tslog';
5
- import '../contextual-menu.js';
5
+ export type * from './internals/types.js';
6
+ import './contextual-menu.js';
6
7
  /**
7
8
  * The base class for the context menu. It can be used as is but in some specific cases
8
9
  * you may want to extend this class to be able to find command target accurately.
@@ -92,11 +93,11 @@ export declare class ContextualMenu<S = unknown> extends EventTarget {
92
93
  * Register a list of commands to be rendered in the menu when triggered.
93
94
  * This overrides previously registered commands.
94
95
  */
95
- registerCommands(commands: CommandBase<S>[]): void;
96
+ registerCommands(commands: (CommandBase<S> | ContextMenuCommand<S>)[]): void;
96
97
  /**
97
98
  * Adds a single command to the menu.
98
99
  */
99
- addCommand(command: CommandBase<S>): void;
100
+ addCommand(command: CommandBase<S> | ContextMenuCommand<S>): void;
100
101
  /**
101
102
  * Prepares incoming commands for the internal use.
102
103
  * @param commands - The commands to process.
@@ -113,6 +114,10 @@ export declare class ContextualMenu<S = unknown> extends EventTarget {
113
114
  * @param customData Any data to set on the instance to pass to the `execute` and `enabled` functions.
114
115
  */
115
116
  build(target: HTMLElement | SVGElement, name: string, placementPoint: MenuPoint, targetPoint: MenuPoint, customData?: unknown): boolean;
117
+ /**
118
+ * A lifecycle method called before the `render()` method.
119
+ */
120
+ protected beforeRender(): void;
116
121
  /**
117
122
  * @param placementPoint The workspace position of where to place the menu.
118
123
  * @param commands The commands render
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextualMenu.d.ts","sourceRoot":"","sources":["../../../../src/elements/contextual-menu/ContextualMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElD,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAElB,qBAAqB,EAErB,WAAW,EACX,SAAS,EACT,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,kBAAkB,MAAM,sCAAsC,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,O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Item.js';
2
- import { genId } from './IdGenerator.js';
1
+ import { MenuItem } from './internals/MenuItem.js';
2
+ import { genId } from './internals/IdGenerator.js';
3
3
  import { Logger } from 'tslog';
4
- import '../contextual-menu.js';
4
+ import './contextual-menu.js';
5
5
  function cancelEvent(e) {
6
6
  e.preventDefault();
7
7
  e.stopPropagation();
@@ -292,10 +292,32 @@ export class ContextualMenu extends EventTarget {
292
292
  customData,
293
293
  target,
294
294
  };
295
+ this.beforeRender();
295
296
  this.render(placementPoint, commands);
296
297
  target.setAttribute('active', '');
297
298
  return true;
298
299
  }
300
+ /**
301
+ * A lifecycle method called before the `render()` method.
302
+ */
303
+ beforeRender() {
304
+ const { beforeRender } = this.options;
305
+ if (!beforeRender) {
306
+ return;
307
+ }
308
+ const context = {
309
+ store: this.store,
310
+ target: this.triggerInfo?.target || this.workspace,
311
+ root: this.workspace,
312
+ customData: this.triggerInfo?.customData,
313
+ };
314
+ try {
315
+ beforeRender(context);
316
+ }
317
+ catch {
318
+ // ...
319
+ }
320
+ }
299
321
  /**
300
322
  * @param placementPoint The workspace position of where to place the menu.
301
323
  * @param commands The commands render
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextualMenu.js","sourceRoot":"","sources":["../../../../src/elements/contextual-menu/ContextualMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAYlD,OAAO,EAAE,MAAM,EAAW,MAAM,OAAO,CAAA;AAGvC,OAAO,sBAAsB,CAAA;AAE7B,SAAS,WAAW,CAAC,CAAQ;IAC3B,CAAC,CAAC,cAAc,EAAE,CAAA;IAClB,CAAC,CAAC,eAAe,EAAE,CAAA;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,cAA4B,SAAQ,WAAW;IAuDjD;IAtDT,eAAe,GAAG,KAAK,CAAA;IAEvB;;OAEG;IACH,IAAI,SAAS;QACX,O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G,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;QAC/E,CAAC;aAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YACvB,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;QAC/D,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAA6B;gBACvC,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,KAAK;gBACL,MAAM;gBACN,IAAI,EAAE,SAAS;gBACf,UAAU,EAAE,KAAK;gBACjB,UAAU;gBACV,kBAAkB,EAAE,IAAI;gBACxB,IAAI,EAAE,GAAG;aACV,CAAA;YACD,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,SAAS,EAAE;gBACzB,MAAM;aACP,CAAC,CACH,CAAA;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { MenuItem } from './internals/MenuItem.js'\nimport { genId } from './internals/IdGenerator.js'\nimport type {\n CommandBase,\n ContextMenuCommand,\n ContextMenuExecuteDetail,\n CustomMenuEventDetail,\n MenuContext,\n MenuOptions,\n MenuPoint,\n MenuTriggerInfo,\n} from './internals/types.js'\nimport type ContextMenuElement from './internals/ContextualMenuElement.js'\nimport { Logger, ILogObj } from 'tslog'\nexport type * from './internals/types.js'\n\nimport './contextual-menu.js'\n\nfunction cancelEvent(e: Event): void {\n e.preventDefault()\n e.stopPropagation()\n}\n\n/**\n * The base class for the context menu. It can be used as is but in some specific cases\n * you may want to extend this class to be able to find command target accurately.\n *\n * @template S - The definition of the store passed to commands.\n */\nexport class ContextualMenu<S = unknown> extends EventTarget {\n #connectedValue = false\n\n /**\n * @returns true when the menu is connected to the `workspace`.\n */\n get connected(): boolean {\n return this.#connectedValue\n }\n\n /**\n * The store initialized with this context menu. Passed to the lifecycle functions.\n */\n store: S = {} as S\n\n /**\n * The root level menu commands\n */\n commands: MenuItem<S>[] = []\n\n /**\n * An information about the trigger that initialized this menu.\n */\n triggerInfo?: MenuTriggerInfo\n\n /**\n * The Menu configuration options.\n */\n options: MenuOptions\n\n currentMenu?: ContextMenuElement<S>\n\n #debug = false\n\n get debug(): boolean {\n return this.#debug\n }\n\n set debug(value: boolean) {\n if (this.#debug === value) {\n return\n }\n this.#debug = value\n if (this.logger) {\n this.logger.settings.minLevel = value ? 0 : 4\n }\n }\n\n protected logger: Logger<ILogObj>\n\n /**\n * @param workspace The root element that is the click handler\n * @param opts The Menu configuration options.\n */\n constructor(\n public workspace: HTMLElement,\n opts: MenuOptions = {}\n ) {\n super()\n\n this.options = { ...opts }\n\n this.logger = new Logger({ minLevel: this.debug ? 0 : 4, name: 'context-menu', hideLogPositionForProduction: true })\n\n this.contextHandler = this.contextHandler.bind(this)\n this.clickHandler = this.clickHandler.bind(this)\n this.keydownHandler = this.keydownHandler.bind(this)\n this.customMenuHandler = this.customMenuHandler.bind(this)\n this.menuTriggerHandler = this.menuTriggerHandler.bind(this)\n }\n\n /**\n * Starts listening on user events\n */\n connect(): void {\n this.logger.debug('Connecting contextual menu...')\n this.workspace.addEventListener('contextmenu', this.contextHandler)\n this.workspace.addEventListener('custommenu', this.customMenuHandler as EventListener)\n window.addEventListener('click', this.clickHandler)\n window.addEventListener('keydown', this.keydownHandler)\n this.#connectedValue = true\n }\n\n /**\n * Cleans up the listeners\n */\n disconnect(): void {\n this.logger.debug('Disconnecting contextual menu...')\n this.workspace.removeEventListener('contextmenu', this.contextHandler)\n this.workspace.removeEventListener('custommenu', this.customMenuHandler as EventListener)\n window.removeEventListener('click', this.clickHandler)\n window.removeEventListener('keydown', this.keydownHandler)\n this.#connectedValue = false\n }\n\n /**\n * Reads {x,y} point of the click from the pointer event.\n *\n * Override this method to customize position reading.\n */\n readTargetClickPosition(e: MouseEvent): MenuPoint {\n const result: MenuPoint = {\n x: e.clientX,\n y: e.clientY,\n }\n this.logger.debug('readTargetClickPosition result:', result)\n return result\n }\n\n /**\n * Override this method to customize finding event click target.\n * @param e Finds the click target from the event\n */\n findTarget(e: MouseEvent): HTMLElement | SVGElement | undefined {\n this.logger.debug('findTarget results with \"e.target\"')\n return e.target as HTMLElement | SVGElement | undefined\n }\n\n /**\n * Maps an element to the target name used by the commands.\n * By default it returns `root` when the click target element is the `workspace` or\n * a combination of element name and list of all classes otherwise.\n *\n * Override this method to customize target name reading.\n *\n * @param element The context click target\n * @returns The target name.\n */\n elementToTarget(element: HTMLElement | SVGElement): string | undefined {\n if (element === this.workspace) {\n this.logger.debug('elementToTarget result:', 'root')\n return 'root'\n }\n if (!element.localName) {\n this.logger.debug('elementToTarget result:', undefined)\n return undefined\n }\n let name = element.localName\n const cls = Array.from(element.classList).join('.')\n if (cls) {\n name += `.${cls}`\n }\n this.logger.debug('elementToTarget result:', name)\n return name\n }\n\n /**\n * Handler for the context menu event.\n */\n protected contextHandler(e: MouseEvent): void {\n // if (!this.options.cancelNativeWhenHandled) {\n // cancelEvent(e);\n // }\n this.destroy()\n const target = this.findTarget(e)\n if (!target) {\n return\n }\n const name = this.elementToTarget(target)\n this.logger.debug('contextHandler', 'target:', target.localName, 'name:', name)\n if (!name) {\n return\n }\n // since the context menu has fixed position it doesn't matter what the context\n // is as the menu is rendered over all elements.\n // The `readTargetClickPosition()` is used to determine click target for the commands.\n const clickPoint = {\n x: e.clientX,\n y: e.clientY,\n }\n const targetPoint = this.readTargetClickPosition(e)\n const rendered = this.build(target, name, clickPoint, targetPoint)\n if (rendered) {\n cancelEvent(e)\n } else if (this.options.cancelNativeWhenHandled) {\n cancelEvent(e)\n }\n }\n\n /**\n * A handler for the `custommenu` event handler to trigger the menu without the user interaction.\n */\n protected customMenuHandler(e: CustomEvent<CustomMenuEventDetail>): void {\n cancelEvent(e)\n const { name, x = 0, y = 0, actionTarget = this.workspace, clickEvent, customData } = e.detail\n const clickPoint = {\n x,\n y,\n }\n const targetPoint = clickEvent ? this.readTargetClickPosition(clickEvent) : clickPoint\n this.build(actionTarget, name, clickPoint, targetPoint, customData)\n }\n\n /**\n * Handles the click event on the document to close the menu is the click\n * is outside the menu.\n */\n protected clickHandler(e: MouseEvent): void {\n if (!this.currentMenu || e.defaultPrevented) {\n return\n }\n const elm = e.target as Element\n const inside = this.currentMenu.contains(elm)\n if (!inside) {\n this.logger.debug('Click outside the menu. Destroing...')\n this.destroy()\n }\n }\n\n /**\n * Closes the menu when ESC is pressed\n */\n protected keydownHandler(e: KeyboardEvent): void {\n if (e.key === 'Escape' && this.currentMenu) {\n this.logger.debug('Escape key detected. Destroing the menu...')\n this.destroy()\n }\n }\n\n /**\n * Register a list of commands to be rendered in the menu when triggered.\n * This overrides previously registered commands.\n */\n registerCommands(commands: (CommandBase<S> | ContextMenuCommand<S>)[]): void {\n if (!Array.isArray(commands) || !commands.length) {\n this.logger.warn('registerCommands called with empty array')\n return\n }\n this.commands = this.prepareCommands(commands)\n }\n\n /**\n * Adds a single command to the menu.\n */\n addCommand(command: CommandBase<S> | ContextMenuCommand<S>): void {\n if (!this.commands) {\n this.commands = []\n }\n const item = this.prepareCommands([command])[0]\n this.commands.push(item)\n }\n\n /**\n * Prepares incoming commands for the internal use.\n * @param commands - The commands to process.\n */\n protected prepareCommands(commands: CommandBase<S>[]): MenuItem<S>[] {\n const result: MenuItem<S>[] = []\n commands.forEach((item) => {\n if (!item) {\n return\n }\n const { type = 'normal' } = item\n switch (type) {\n case 'separator':\n result.push(new MenuItem(item))\n break\n case 'label':\n result.push(new MenuItem(item))\n break\n case 'normal':\n case 'radio':\n {\n const normalized = this.normalizeMenuItem(item as ContextMenuCommand<S>)\n result.push(new MenuItem(normalized))\n }\n break\n default:\n }\n })\n return result\n }\n\n protected normalizeMenuItem(item: ContextMenuCommand<S>): ContextMenuCommand<S> {\n const cp = { ...item }\n if (!cp.id) {\n cp.id = genId()\n }\n if (Array.isArray(cp.children) && cp.children.length) {\n cp.children = this.prepareCommands(cp.children)\n } else if (cp.children) {\n cp.children = undefined\n }\n return cp\n }\n\n /**\n * Builds the menu for the target.\n *\n * @param target The element that triggered the menu\n * @param name The `target` name declared in the commands.\n * @param placementPoint The workspace position of where to place the menu.\n * @param targetPoint The workspace position of the click target\n * @param customData Any data to set on the instance to pass to the `execute` and `enabled` functions.\n */\n build(\n target: HTMLElement | SVGElement,\n name: string,\n placementPoint: MenuPoint,\n targetPoint: MenuPoint,\n customData?: unknown\n ): boolean {\n this.triggerInfo = undefined\n const commands = this.listCommands(name, target)\n this.logger.debug('build', 'commands discovered', commands.length)\n if (!commands.length) {\n return false\n }\n this.triggerInfo = {\n point: targetPoint,\n customData,\n target,\n }\n this.beforeRender()\n this.render(placementPoint, commands)\n target.setAttribute('active', '')\n return true\n }\n\n /**\n * A lifecycle method called before the `render()` method.\n */\n protected beforeRender(): void {\n const { beforeRender } = this.options\n if (!beforeRender) {\n return\n }\n const context: MenuContext = {\n store: this.store,\n target: this.triggerInfo?.target || this.workspace,\n root: this.workspace,\n customData: this.triggerInfo?.customData,\n }\n try {\n beforeRender(context)\n } catch {\n // ...\n }\n }\n\n /**\n * @param placementPoint The workspace position of where to place the menu.\n * @param commands The commands render\n */\n render(placementPoint: MenuPoint, commands: MenuItem<S>[]): void {\n const { workspace } = this\n const menu = document.createElement('contextual-menu') as unknown as ContextMenuElement<S>\n menu.store = this.store\n menu.target = this.triggerInfo?.target\n menu.customData = this.triggerInfo?.customData\n menu.workspace = workspace\n menu.classList.add('context-menu')\n menu.commands = commands\n menu.style.top = `${placementPoint.y}px`\n menu.style.left = `${placementPoint.x}px`\n menu.setAttribute('tabindex', '0')\n\n if (workspace.shadowRoot) {\n workspace.shadowRoot.append(menu)\n } else {\n this.workspace.append(menu)\n }\n this.currentMenu = menu\n menu.focus()\n menu.addEventListener('trigger', this.menuTriggerHandler as EventListener)\n }\n\n /**\n * Lists all commands that matches the target.\n *\n * @param targetName The build target name\n * @param targetElement The element that triggered the menu\n */\n listCommands(targetName: string, targetElement: HTMLElement | SVGElement): MenuItem<S>[] {\n this.logger.debug('listCommands')\n const { commands = [] } = this\n const result: MenuItem<S>[] = []\n const filter = ['all', targetName]\n this.logger.debug('listCommands', 'filter:', filter)\n commands.forEach((cmd) => {\n this.logger.silly('listCommands', 'matching tharget', cmd.target)\n if (Array.isArray(cmd.target)) {\n const hasTarget = cmd.target.some((item) => filter.includes(item))\n if (hasTarget) {\n result.push(cmd)\n }\n } else if (filter.includes(cmd.target || '')) {\n result.push(cmd)\n } else {\n try {\n if (targetElement.matches(cmd.target || '')) {\n result.push(cmd)\n }\n } catch {\n //\n }\n }\n })\n return result\n }\n\n /**\n * Removes the currently rendered menu.\n */\n destroy(): void {\n if (!this.currentMenu) {\n return\n }\n ;(this.triggerInfo as MenuTriggerInfo).target.removeAttribute('active')\n this.triggerInfo = undefined\n const { workspace } = this\n if (workspace.shadowRoot) {\n workspace.shadowRoot.removeChild(this.currentMenu)\n } else {\n workspace.removeChild(this.currentMenu)\n }\n this.currentMenu.removeEventListener('trigger', this.menuTriggerHandler as EventListener)\n this.currentMenu = undefined\n }\n\n /**\n * Handler for the `trigger` event dispatched by the menu\n */\n protected menuTriggerHandler(e: CustomEvent): void {\n const { item, command, parent } = e.detail\n const cmd = command as MenuItem\n const parentCommand = parent as MenuItem\n const { triggerInfo, workspace, store } = this\n const { point, target, customData } = triggerInfo as MenuTriggerInfo\n this.destroy()\n if (parentCommand && parentCommand.execute && !cmd.execute) {\n parentCommand.trigger(cmd, store, target, workspace, point, customData, item)\n } else if (cmd.execute) {\n cmd.trigger(cmd, store, target, workspace, point, customData)\n } else {\n const detail: ContextMenuExecuteDetail = {\n id: cmd.id,\n store,\n target,\n root: workspace,\n clickPoint: point,\n customData,\n selectedSubcommand: item,\n item: cmd,\n }\n this.dispatchEvent(\n new CustomEvent('execute', {\n detail,\n })\n )\n }\n }\n}\n"]}
@@ -12,16 +12,19 @@ export interface MenuOptions {
12
12
  * would render this context menu and in another system's & browser context menu.
13
13
  */
14
14
  cancelNativeWhenHandled?: boolean;
15
+ /**
16
+ * Called before the menu is rendered.
17
+ * Specifically, it is called right before the internal `render()` method is called.
18
+ * It doesn't allow you to modify the menu items, but you can perform any setup
19
+ * before the menu is rendered.
20
+ */
21
+ beforeRender?: (ctx: MenuContext) => void;
15
22
  }
16
23
  export interface MenuPoint {
17
24
  x: number;
18
25
  y: number;
19
26
  }
20
- interface LifecycleContext<S> {
21
- /**
22
- * The id of the command.
23
- */
24
- id: string;
27
+ export interface MenuContext<S = unknown> {
25
28
  /**
26
29
  * The object store to be used to store menu item data.
27
30
  */
@@ -39,14 +42,20 @@ interface LifecycleContext<S> {
39
42
  */
40
43
  customData?: unknown;
41
44
  }
45
+ interface LifecycleContext<S = unknown> extends MenuContext<S> {
46
+ /**
47
+ * The id of the command.
48
+ */
49
+ id: string;
50
+ }
42
51
  export interface EnabledMenuOptions<S = unknown> extends LifecycleContext<S> {
43
52
  }
44
- export interface CheckedMenuOptions<S> extends LifecycleContext<S> {
53
+ export interface CheckedMenuOptions<S = unknown> extends LifecycleContext<S> {
45
54
  }
46
55
  /**
47
56
  * Options passed to the `visible()` callback function.
48
57
  */
49
- export type VisibleOptions<S> = EnabledMenuOptions<S>;
58
+ export type VisibleOptions<S = unknown> = EnabledMenuOptions<S>;
50
59
  export interface CommandExecuteOptions<S = unknown> extends LifecycleContext<S> {
51
60
  /**
52
61
  * The point of the original click.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/contextual-menu/internals/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAA;AAErE,MAAM,WAAW,WAAW;IAC1B;;;;;;;;OAQG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED,MAAM,WAAW,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OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;IACvC;;OAEG;IACH,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,OAAO;IACnD;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,KAAK,EAAE,CAAC,CAAA;IACR;;OAEG;IACH,MAAM,EAAE,WAAW,GAAG,UAAU,CAAA;IAChC;;OAEG;IACH,IAAI,EAAE,WAAW,CAAA;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,SAAS,CAAA;IACrB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAClB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/contextual-menu/internals/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAA;AAErE,MAAM,WAAW,WAAW;IAC1B;;;;;;;;OAQG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;CAC1C;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,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AqB;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;IACvC;;OAEG;IACH,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,OAAO;IACnD;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,KAAK,EAAE,CAAC,CAAA;IACR;;OAEG;IACH,MAAM,EAAE,WAAW,GAAG,UAAU,CAAA;IAChC;;OAEG;IACH,IAAI,EAAE,WAAW,CAAA;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,SAAS,CAAA;IACrB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/contextual-menu/internals/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport type { SVGTemplateResult } from 'lit'\nimport type { MenuItem } from './MenuItem.js'\n\nexport type MenuItemType = 'normal' | 'separator' | 'label' | 'radio'\n\nexport interface MenuOptions {\n /**\n * By default the `contextmenu` event is always cancelled by the library\n * whether the command is actually handled or not.\n * When this is set the event is cancelled only when the context menu can be rendered\n * in the current context.\n *\n * Note, this may cause a disjoint experience to the user as in one situation the right click\n * would render this context menu and in another system's & browser context menu.\n */\n cancelNativeWhenHandled?: boolean\n}\n\nexport interface MenuPoint {\n x: number\n y: number\n}\n\ninterface LifecycleContext<S> {\n /**\n * The id of the command.\n */\n id: string\n /**\n * The object store to be used to store menu item data.\n */\n store: S\n /**\n * An instance of the element that triggered the command.\n */\n target: HTMLElement | SVGElement\n /**\n * The element with which this context menu was initialized with.\n */\n root: HTMLElement\n /**\n * Any data passed to the command through a custom event.\n */\n customData?: unknown\n}\n\nexport interface EnabledMenuOptions<S = unknown> extends LifecycleContext<S> {}\n\nexport interface CheckedMenuOptions<S> extends LifecycleContext<S> {}\n\n/**\n * Options passed to the `visible()` callback function.\n */\nexport type VisibleOptions<S> = EnabledMenuOptions<S>\n\nexport interface CommandExecuteOptions<S = unknown> extends LifecycleContext<S> {\n /**\n * The point of the original click.\n */\n clickPoint: MenuPoint\n /**\n * This is only passed to the execute function when a sub-menu has triggered a menu item\n * that has no `execute` function defined. This is the index of the command.\n * Note, the index includes separators.\n */\n selectedSubcommand?: number\n /**\n * The menu item that triggered the selection.\n */\n item: MenuItem<S>\n}\n\nexport interface BeforeRenderOptions<S = unknown> extends LifecycleContext<S> {\n /**\n * The menu item that triggered the selection. Changing this item will affects the rendering of it.\n */\n menu: MenuItem<S>\n}\n\nexport interface CommandBase<S = unknown> {\n /**\n * The identifier of the command. Can be used to ids manually. The command is passed\n * to the lifecycle callbacks so you can use it to identify a command.\n * When not set the Menu generates a random value.\n */\n id?: string\n /**\n * The type of the command. By default the command is `normal`. `separator` draws a line between menu items.\n * The `label` renders a title over other list items.\n *\n * The radio type renders a \"check\" mark on the right of the label instead of image (it is ignored when set).\n * To mark the checkbox as checked use the `checked` property. Use the lifecycle methods to set the checked state.\n */\n type?: MenuItemType\n /**\n * The target object that activates this item.\n * The `ContextMenu` class uses `findTarget(mouseEvent)` to find the event target and `elementToTarget(targetElement)`\n * to find the target. By default the \"elementTarget\" is the event's target, and the target is the elementTarget's\n * `localName` with list of class names (period separated).\n * When the target is the same as the `workspace` then the target is `root`.\n * Override this two methods to customize this behavior and support custom use cases.\n *\n * By default the constructed target from an element is something like this: `div.item.target-item`.\n *\n * This must be provided for the top level menu items only. This is ignored in sub-menus.\n */\n target?: string | string[] | 'all' | 'root'\n /**\n * Determines whether the menu item is visible in the rendered menu.\n * The item is always inserted into the DOM but when this value is false or the result of calling the function\n * is false then the item is hidden. You can still access the menu item via DOM apis.\n */\n visible?: boolean | ((args: VisibleOptions<S>) => boolean)\n}\n\nexport interface ContextMenuCommand<S = unknown> extends CommandBase<S> {\n /**\n * The label to render.\n */\n label?: string\n /**\n * Optional title of the element. Do not use it for elements that represent a sub-menu.\n */\n title?: string\n /**\n * The icon to render. It should be full definition of an SVG image wrapped into\n * the svg`...` template, from the `lit-html` library.\n */\n icon?: SVGTemplateResult\n /**\n * A children of this command. When set and not empty then it renders a nested sub-menu\n * for this entry. In this case the `execute()` lifecycle method won't be executed and a new menu is rendered\n * positioned relative to this entry.\n *\n * Note, sub entries of the menu are not rendered until the user hover over the menu. When the user hover over\n * another menu entry the child menu is destroyed.\n */\n children?: (ContextMenuCommand<S> | CommandBase<S>)[]\n /**\n * Whether the command is enabled or not.\n * When set to a boolean value, this value is used to determine whether the item should be rendered.\n * When set to a function, it must return a value indicating whether the command is enabled.\n */\n enabled?: boolean | ((args: EnabledMenuOptions<S>) => boolean)\n /**\n * Only used when the `type` is set to `radio` and indicated that the element is in the checked state.\n * When this is true then the UI renders the check mark in the image are.\n * Note, you cannot use the `image` with this property as the image is ignored and the selection state\n * is indicated in this place.\n */\n checked?: boolean | ((args: CheckedMenuOptions<S>) => boolean)\n /**\n * The action to be executed when this command is activated.\n * This is ignored when the command has children. When the command has no children then\n * when this is set to a function, this function is called when a menu item is triggered.\n * You may not set this value and use the `activate` event to listen for command activation.\n */\n execute?: (args: CommandExecuteOptions<S>) => void\n /**\n * A function that is executed before the item is rendered.\n * This way you can customize the rendered values like the icon, label, or title.\n */\n beforeRender?: (ctx: BeforeRenderOptions<S>) => void\n}\n\nexport interface MenuTriggerInfo {\n /**\n * The element that triggered the context menu.\n */\n target: HTMLElement | SVGElement\n /**\n * The location where the click relative position is.\n * This can be customized by overriding the `readTargetClickPosition()`.\n */\n point: MenuPoint\n /**\n * A custom data to be passed to the lifecycle methods.\n */\n customData?: unknown\n}\n\nexport interface CustomMenuEventDetail {\n /**\n * The name of the command target. It is used to render commands group. It corresponds to ContextMenuCommand.target.\n */\n name: string\n /**\n * The x coordinate of the click. Default to 0.\n */\n x?: number\n /**\n * The y coordinate of the click. Default to 0.\n */\n y?: number\n /**\n * The click target passed back to the command execute function. Default to the workspace.\n */\n actionTarget?: HTMLElement | SVGElement\n /**\n * The original click event associated with the action. Optional.\n */\n clickEvent?: PointerEvent\n /**\n * Any data to be passed to the enabled and execute function.\n */\n customData?: unknown\n}\n\nexport interface ContextMenuExecuteDetail<S = unknown> {\n /**\n * The id of the executed command.\n * When not set by the command definition this is auto generated\n * when registering a command.\n */\n id: string\n /**\n * The object store to be used to store menu item data.\n */\n store: S\n /**\n * An instance of the element that triggered the command.\n */\n target: HTMLElement | SVGElement\n /**\n * The element with which this context menu was initialized with.\n */\n root: HTMLElement\n /**\n * Any data passed to the command through a custom event.\n */\n customData?: unknown\n /**\n * The point of the original click.\n */\n clickPoint: MenuPoint\n /**\n * The index of the clicked subcommand\n */\n selectedSubcommand?: number\n /**\n * The selected me nu item.\n */\n item: MenuItem<S>\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/contextual-menu/internals/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport type { SVGTemplateResult } from 'lit'\nimport type { MenuItem } from './MenuItem.js'\n\nexport type MenuItemType = 'normal' | 'separator' | 'label' | 'radio'\n\nexport interface MenuOptions {\n /**\n * By default the `contextmenu` event is always cancelled by the library\n * whether the command is actually handled or not.\n * When this is set the event is cancelled only when the context menu can be rendered\n * in the current context.\n *\n * Note, this may cause a disjoint experience to the user as in one situation the right click\n * would render this context menu and in another system's & browser context menu.\n */\n cancelNativeWhenHandled?: boolean\n /**\n * Called before the menu is rendered.\n * Specifically, it is called right before the internal `render()` method is called.\n * It doesn't allow you to modify the menu items, but you can perform any setup\n * before the menu is rendered.\n */\n beforeRender?: (ctx: MenuContext) => void\n}\n\nexport interface MenuPoint {\n x: number\n y: number\n}\n\nexport interface MenuContext<S = unknown> {\n /**\n * The object store to be used to store menu item data.\n */\n store: S\n /**\n * An instance of the element that triggered the command.\n */\n target: HTMLElement | SVGElement\n /**\n * The element with which this context menu was initialized with.\n */\n root: HTMLElement\n /**\n * Any data passed to the command through a custom event.\n */\n customData?: unknown\n}\n\ninterface LifecycleContext<S = unknown> extends MenuContext<S> {\n /**\n * The id of the command.\n */\n id: string\n}\n\nexport interface EnabledMenuOptions<S = unknown> extends LifecycleContext<S> {}\n\nexport interface CheckedMenuOptions<S = unknown> extends LifecycleContext<S> {}\n\n/**\n * Options passed to the `visible()` callback function.\n */\nexport type VisibleOptions<S = unknown> = EnabledMenuOptions<S>\n\nexport interface CommandExecuteOptions<S = unknown> extends LifecycleContext<S> {\n /**\n * The point of the original click.\n */\n clickPoint: MenuPoint\n /**\n * This is only passed to the execute function when a sub-menu has triggered a menu item\n * that has no `execute` function defined. This is the index of the command.\n * Note, the index includes separators.\n */\n selectedSubcommand?: number\n /**\n * The menu item that triggered the selection.\n */\n item: MenuItem<S>\n}\n\nexport interface BeforeRenderOptions<S = unknown> extends LifecycleContext<S> {\n /**\n * The menu item that triggered the selection. Changing this item will affects the rendering of it.\n */\n menu: MenuItem<S>\n}\n\nexport interface CommandBase<S = unknown> {\n /**\n * The identifier of the command. Can be used to ids manually. The command is passed\n * to the lifecycle callbacks so you can use it to identify a command.\n * When not set the Menu generates a random value.\n */\n id?: string\n /**\n * The type of the command. By default the command is `normal`. `separator` draws a line between menu items.\n * The `label` renders a title over other list items.\n *\n * The radio type renders a \"check\" mark on the right of the label instead of image (it is ignored when set).\n * To mark the checkbox as checked use the `checked` property. Use the lifecycle methods to set the checked state.\n */\n type?: MenuItemType\n /**\n * The target object that activates this item.\n * The `ContextMenu` class uses `findTarget(mouseEvent)` to find the event target and `elementToTarget(targetElement)`\n * to find the target. By default the \"elementTarget\" is the event's target, and the target is the elementTarget's\n * `localName` with list of class names (period separated).\n * When the target is the same as the `workspace` then the target is `root`.\n * Override this two methods to customize this behavior and support custom use cases.\n *\n * By default the constructed target from an element is something like this: `div.item.target-item`.\n *\n * This must be provided for the top level menu items only. This is ignored in sub-menus.\n */\n target?: string | string[] | 'all' | 'root'\n /**\n * Determines whether the menu item is visible in the rendered menu.\n * The item is always inserted into the DOM but when this value is false or the result of calling the function\n * is false then the item is hidden. You can still access the menu item via DOM apis.\n */\n visible?: boolean | ((args: VisibleOptions<S>) => boolean)\n}\n\nexport interface ContextMenuCommand<S = unknown> extends CommandBase<S> {\n /**\n * The label to render.\n */\n label?: string\n /**\n * Optional title of the element. Do not use it for elements that represent a sub-menu.\n */\n title?: string\n /**\n * The icon to render. It should be full definition of an SVG image wrapped into\n * the svg`...` template, from the `lit-html` library.\n */\n icon?: SVGTemplateResult\n /**\n * A children of this command. When set and not empty then it renders a nested sub-menu\n * for this entry. In this case the `execute()` lifecycle method won't be executed and a new menu is rendered\n * positioned relative to this entry.\n *\n * Note, sub entries of the menu are not rendered until the user hover over the menu. When the user hover over\n * another menu entry the child menu is destroyed.\n */\n children?: (ContextMenuCommand<S> | CommandBase<S>)[]\n /**\n * Whether the command is enabled or not.\n * When set to a boolean value, this value is used to determine whether the item should be rendered.\n * When set to a function, it must return a value indicating whether the command is enabled.\n */\n enabled?: boolean | ((args: EnabledMenuOptions<S>) => boolean)\n /**\n * Only used when the `type` is set to `radio` and indicated that the element is in the checked state.\n * When this is true then the UI renders the check mark in the image are.\n * Note, you cannot use the `image` with this property as the image is ignored and the selection state\n * is indicated in this place.\n */\n checked?: boolean | ((args: CheckedMenuOptions<S>) => boolean)\n /**\n * The action to be executed when this command is activated.\n * This is ignored when the command has children. When the command has no children then\n * when this is set to a function, this function is called when a menu item is triggered.\n * You may not set this value and use the `activate` event to listen for command activation.\n */\n execute?: (args: CommandExecuteOptions<S>) => void\n /**\n * A function that is executed before the item is rendered.\n * This way you can customize the rendered values like the icon, label, or title.\n */\n beforeRender?: (ctx: BeforeRenderOptions<S>) => void\n}\n\nexport interface MenuTriggerInfo {\n /**\n * The element that triggered the context menu.\n */\n target: HTMLElement | SVGElement\n /**\n * The location where the click relative position is.\n * This can be customized by overriding the `readTargetClickPosition()`.\n */\n point: MenuPoint\n /**\n * A custom data to be passed to the lifecycle methods.\n */\n customData?: unknown\n}\n\nexport interface CustomMenuEventDetail {\n /**\n * The name of the command target. It is used to render commands group. It corresponds to ContextMenuCommand.target.\n */\n name: string\n /**\n * The x coordinate of the click. Default to 0.\n */\n x?: number\n /**\n * The y coordinate of the click. Default to 0.\n */\n y?: number\n /**\n * The click target passed back to the command execute function. Default to the workspace.\n */\n actionTarget?: HTMLElement | SVGElement\n /**\n * The original click event associated with the action. Optional.\n */\n clickEvent?: PointerEvent\n /**\n * Any data to be passed to the enabled and execute function.\n */\n customData?: unknown\n}\n\nexport interface ContextMenuExecuteDetail<S = unknown> {\n /**\n * The id of the executed command.\n * When not set by the command definition this is auto generated\n * when registering a command.\n */\n id: string\n /**\n * The object store to be used to store menu item data.\n */\n store: S\n /**\n * An instance of the element that triggered the command.\n */\n target: HTMLElement | SVGElement\n /**\n * The element with which this context menu was initialized with.\n */\n root: HTMLElement\n /**\n * Any data passed to the command through a custom event.\n */\n customData?: unknown\n /**\n * The point of the original click.\n */\n clickPoint: MenuPoint\n /**\n * The index of the clicked subcommand\n */\n selectedSubcommand?: number\n /**\n * The selected me nu item.\n */\n item: MenuItem<S>\n}\n"]}