corpushub-design-system 0.1.3 → 0.1.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.
Files changed (27) hide show
  1. package/dist/configs/localization/TreeTexts.d.ts +15 -0
  2. package/dist/configs/localization/TreeTexts.js +15 -0
  3. package/dist/features/CytoscapeMenu/CytoscapeMenuCanvas.d.ts +1 -1
  4. package/dist/features/CytoscapeMenu/CytoscapeMenuConstants.d.ts +66 -0
  5. package/dist/features/CytoscapeMenu/{constants.js → CytoscapeMenuConstants.js} +2 -0
  6. package/dist/features/CytoscapeMenu/{utils.d.ts → CytoscapeMenuUtils.d.ts} +5 -0
  7. package/dist/features/CytoscapeMenu/{utils.js → CytoscapeMenuUtils.js} +21 -0
  8. package/dist/features/CytoscapeMenu/context-menu.d.ts +2 -2
  9. package/dist/features/CytoscapeMenu/context-menu.js +17 -15
  10. package/dist/features/CytoscapeMenu/cytoscape-context-menus.d.ts +1 -1
  11. package/dist/features/CytoscapeMenu/cytoscape-context-menus.js +225 -38
  12. package/dist/features/CytoscapeMenu/favorites.d.ts +12 -0
  13. package/dist/features/CytoscapeMenu/favorites.js +77 -0
  14. package/dist/features/CytoscapeMenu/index.d.ts +1 -1
  15. package/dist/features/CytoscapeMenu/phrase-picker.d.ts +90 -0
  16. package/dist/features/CytoscapeMenu/phrase-picker.js +538 -0
  17. package/dist/features/CytoscapeMenu/style.scss +462 -19
  18. package/dist/features/TreeView/TreeView.d.ts +7 -1
  19. package/dist/features/TreeView/TreeView.js +40 -11
  20. package/dist/features/TreeView/TreeViewImportPenn/TreeViewImportPenn.d.ts +7 -0
  21. package/dist/features/TreeView/TreeViewImportPenn/TreeViewImportPenn.js +26 -0
  22. package/dist/features/TreeView/TreeViewImportPenn/index.d.ts +2 -0
  23. package/dist/features/TreeView/TreeViewImportPenn/index.js +2 -0
  24. package/dist/features/TreeView/TreeViewImportPenn/style.scss +22 -0
  25. package/dist/features/index.d.ts +1 -1
  26. package/package.json +4 -3
  27. package/dist/features/CytoscapeMenu/constants.d.ts +0 -38
@@ -0,0 +1,538 @@
1
+ import { stopOverlayPointerEvents } from './CytoscapeMenuUtils';
2
+ import { DEFAULT_STORAGE_KEY, loadFavoriteIds, toggleFavoriteId, } from './favorites';
3
+ function isFavoritable(item) {
4
+ if (typeof item.favoritable === 'boolean')
5
+ return item.favoritable;
6
+ return Boolean(item.onClickFunction);
7
+ }
8
+ function toLeaf(item, categoryId, categoryTitle) {
9
+ if (!item.onClickFunction && item.submenu?.length)
10
+ return null;
11
+ if (item.show === false)
12
+ return null;
13
+ if (!item.onClickFunction)
14
+ return null;
15
+ return {
16
+ id: item.id,
17
+ content: item.content,
18
+ tooltipText: item.tooltipText,
19
+ disabled: item.disabled,
20
+ favoritable: isFavoritable(item),
21
+ onClickFunction: item.onClickFunction,
22
+ categoryId,
23
+ categoryTitle,
24
+ };
25
+ }
26
+ function toCategory(item) {
27
+ if (!item.submenu?.length || item.show === false)
28
+ return null;
29
+ const leaves = item.submenu
30
+ .map((child) => toLeaf(child, item.id, item.content))
31
+ .filter((leaf) => leaf !== null);
32
+ if (leaves.length === 0)
33
+ return null;
34
+ return {
35
+ id: item.id,
36
+ content: item.content,
37
+ disabled: item.disabled,
38
+ leaves,
39
+ };
40
+ }
41
+ function itemMatchesTarget(item, cy, target) {
42
+ if (target === cy) {
43
+ return Boolean(item.coreAsWell);
44
+ }
45
+ if (!item.selector)
46
+ return false;
47
+ try {
48
+ return target.is?.(item.selector) ?? false;
49
+ }
50
+ catch {
51
+ return false;
52
+ }
53
+ }
54
+ function childrenAreCategories(children) {
55
+ return (children.length > 0 &&
56
+ children.every((child) => Array.isArray(child.submenu) && child.submenu.length > 0));
57
+ }
58
+ function childrenAreLeaves(children) {
59
+ return (children.length > 0 &&
60
+ children.every((child) => !child.submenu?.length && Boolean(child.onClickFunction)));
61
+ }
62
+ function primarySelectFromAction(item) {
63
+ if (!item.onClickFunction)
64
+ return null;
65
+ const option = {
66
+ id: item.id,
67
+ content: item.content,
68
+ tooltipText: item.tooltipText,
69
+ disabled: item.disabled,
70
+ favoritable: isFavoritable(item),
71
+ onClickFunction: item.onClickFunction,
72
+ categoryId: item.id,
73
+ categoryTitle: item.content,
74
+ };
75
+ return {
76
+ kind: 'select',
77
+ id: item.id,
78
+ content: item.content,
79
+ disabled: item.disabled,
80
+ options: [option],
81
+ };
82
+ }
83
+ /** Split root menu items into peer primaries (utilities ignored). */
84
+ export function partitionMenuItems(items, cy, target) {
85
+ const visible = items.filter((item) => item.show !== false && itemMatchesTarget(item, cy, target));
86
+ const primaries = [];
87
+ for (const item of visible) {
88
+ if (!item.submenu?.length) {
89
+ // Only primary-role actions belong in this menu; utilities are excluded.
90
+ if (item.pickerRole === 'primary') {
91
+ const select = primarySelectFromAction(item);
92
+ if (select)
93
+ primaries.push(select);
94
+ }
95
+ continue;
96
+ }
97
+ const children = item.submenu;
98
+ if (childrenAreCategories(children)) {
99
+ const categories = [];
100
+ for (const child of children) {
101
+ if (child.show === false)
102
+ continue;
103
+ if (!itemMatchesTarget({
104
+ selector: child.selector || item.selector,
105
+ coreAsWell: child.coreAsWell ?? item.coreAsWell,
106
+ }, cy, target)) {
107
+ continue;
108
+ }
109
+ const category = toCategory(child);
110
+ if (category)
111
+ categories.push(category);
112
+ }
113
+ if (categories.length > 0) {
114
+ primaries.push({
115
+ kind: 'catalog',
116
+ id: item.id,
117
+ content: item.content,
118
+ disabled: item.disabled,
119
+ categories,
120
+ });
121
+ }
122
+ continue;
123
+ }
124
+ if (childrenAreLeaves(children)) {
125
+ const options = children
126
+ .map((child) => toLeaf(child, item.id, item.content))
127
+ .filter((leaf) => leaf !== null);
128
+ if (item.pickerRole === 'primary' && options.length > 0) {
129
+ primaries.push({
130
+ kind: 'select',
131
+ id: item.id,
132
+ content: item.content,
133
+ disabled: item.disabled,
134
+ options,
135
+ });
136
+ }
137
+ }
138
+ }
139
+ return { primaries };
140
+ }
141
+ function starSvg(filled) {
142
+ const fill = filled ? 'currentColor' : 'none';
143
+ const stroke = 'currentColor';
144
+ return `<svg class="cy-phrase-picker__star-icon" viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" focusable="false"><path d="M12 3.6l2.4 4.86 5.36.78-3.88 3.78.92 5.34L12 15.9l-4.8 2.46.92-5.34-3.88-3.78 5.36-.78L12 3.6z" fill="${fill}" stroke="${stroke}" stroke-width="1.5" stroke-linejoin="round"/></svg>`;
145
+ }
146
+ function backArrowSvg() {
147
+ return `<svg class="cy-phrase-picker__back-icon" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false"><path d="M15 5 L8 12 L15 19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
148
+ }
149
+ export class PhrasePickerController {
150
+ constructor(root, options) {
151
+ /** Isolated host so cascade MenuItem siblings survive clear/render. */
152
+ this.host = null;
153
+ this.primaries = [];
154
+ this.activePrimaryId = null;
155
+ this.activeCategoryId = null;
156
+ /** Selected option id inside an active PrimarySelect. */
157
+ this.selectedOptionId = null;
158
+ this.favoriteIdsByBranch = new Map();
159
+ this.favoriteIndex = new Map();
160
+ this.root = root;
161
+ this.options = options;
162
+ }
163
+ ensureHost() {
164
+ if (!this.host || !this.host.isConnected) {
165
+ this.host = document.createElement('div');
166
+ this.host.className = 'cy-phrase-picker__host';
167
+ stopOverlayPointerEvents(this.host);
168
+ this.root.appendChild(this.host);
169
+ }
170
+ return this.host;
171
+ }
172
+ clear() {
173
+ if (this.host) {
174
+ this.host.remove();
175
+ this.host = null;
176
+ }
177
+ this.root.classList.remove('cy-phrase-picker');
178
+ this.primaries = [];
179
+ this.activePrimaryId = null;
180
+ this.activeCategoryId = null;
181
+ this.selectedOptionId = null;
182
+ this.favoriteIdsByBranch.clear();
183
+ this.favoriteIndex.clear();
184
+ }
185
+ render(partition) {
186
+ this.primaries = partition.primaries;
187
+ this.rebuildFavoriteIndex();
188
+ if (this.primaries.length === 0) {
189
+ this.clear();
190
+ return false;
191
+ }
192
+ if (!this.activePrimaryId ||
193
+ !this.primaries.some((p) => p.id === this.activePrimaryId)) {
194
+ this.activePrimaryId = null;
195
+ this.activeCategoryId = null;
196
+ this.selectedOptionId = null;
197
+ }
198
+ this.root.classList.add('cy-phrase-picker');
199
+ const host = this.ensureHost();
200
+ host.replaceChildren();
201
+ host.appendChild(this.build());
202
+ return true;
203
+ }
204
+ storageKey() {
205
+ return this.options.favoritesStorageKey ?? DEFAULT_STORAGE_KEY;
206
+ }
207
+ favoritesAdapter() {
208
+ return this.options.favoritesAdapter;
209
+ }
210
+ rebuildFavoriteIndex() {
211
+ this.favoriteIdsByBranch.clear();
212
+ this.favoriteIndex.clear();
213
+ const indexLeaves = (branchId, leaves) => {
214
+ this.favoriteIdsByBranch.set(branchId, loadFavoriteIds(branchId, this.storageKey(), this.favoritesAdapter()));
215
+ for (const leaf of leaves) {
216
+ this.favoriteIndex.set(`${branchId}:${leaf.id}`, { leaf, branchId });
217
+ }
218
+ };
219
+ const indexCatalog = (branchId, categories) => {
220
+ const leaves = categories.flatMap((c) => c.leaves);
221
+ indexLeaves(branchId, leaves);
222
+ };
223
+ for (const primary of this.primaries) {
224
+ if (primary.kind === 'catalog') {
225
+ indexCatalog(primary.id, primary.categories);
226
+ }
227
+ else {
228
+ indexLeaves(primary.id, primary.options);
229
+ }
230
+ }
231
+ }
232
+ activeCatalogCategories() {
233
+ const primary = this.primaries.find((p) => p.id === this.activePrimaryId);
234
+ if (primary?.kind === 'catalog')
235
+ return primary.categories;
236
+ return [];
237
+ }
238
+ activeSelect() {
239
+ const primary = this.primaries.find((p) => p.id === this.activePrimaryId);
240
+ return primary?.kind === 'select' ? primary : null;
241
+ }
242
+ activeBranchId() {
243
+ return this.activePrimaryId;
244
+ }
245
+ build() {
246
+ const frag = document.createDocumentFragment();
247
+ const activePrimary = this.primaries.find((p) => p.id === this.activePrimaryId);
248
+ if (!activePrimary) {
249
+ frag.appendChild(this.buildPrimaries());
250
+ return frag;
251
+ }
252
+ frag.appendChild(this.buildSelectedHeader(activePrimary));
253
+ const selectPrimary = this.activeSelect();
254
+ if (selectPrimary) {
255
+ frag.appendChild(this.buildSelectPanel(selectPrimary));
256
+ }
257
+ else if (this.activeCatalogCategories().length > 0) {
258
+ frag.appendChild(this.buildBody(this.activeCatalogCategories()));
259
+ }
260
+ return frag;
261
+ }
262
+ buildPrimaries() {
263
+ const list = document.createElement('div');
264
+ list.className = 'cy-phrase-picker__primaries';
265
+ list.setAttribute('role', 'listbox');
266
+ list.setAttribute('aria-label', 'Add options');
267
+ for (const primary of this.primaries) {
268
+ const row = document.createElement('div');
269
+ row.className = 'cy-phrase-picker__primary';
270
+ if (primary.id === this.activePrimaryId) {
271
+ row.classList.add('is-active');
272
+ }
273
+ const selectBtn = document.createElement('button');
274
+ selectBtn.type = 'button';
275
+ selectBtn.className = 'cy-phrase-picker__primary-select';
276
+ selectBtn.setAttribute('role', 'option');
277
+ selectBtn.setAttribute('aria-selected', primary.id === this.activePrimaryId ? 'true' : 'false');
278
+ selectBtn.textContent = primary.content;
279
+ selectBtn.disabled = Boolean(primary.disabled);
280
+ const chevron = document.createElement('span');
281
+ chevron.className = 'cy-phrase-picker__primary-chevron';
282
+ chevron.setAttribute('aria-hidden', 'true');
283
+ chevron.textContent = '›';
284
+ selectBtn.appendChild(chevron);
285
+ selectBtn.addEventListener('click', (event) => {
286
+ event.preventDefault();
287
+ event.stopPropagation();
288
+ this.activePrimaryId = primary.id;
289
+ if (primary.kind === 'catalog') {
290
+ this.activeCategoryId = primary.categories[0]?.id ?? null;
291
+ this.selectedOptionId = null;
292
+ }
293
+ else {
294
+ this.activeCategoryId = null;
295
+ this.selectedOptionId = primary.options[0]?.id ?? null;
296
+ }
297
+ this.rerender();
298
+ });
299
+ row.appendChild(selectBtn);
300
+ list.appendChild(row);
301
+ }
302
+ return list;
303
+ }
304
+ buildSelectPanel(primary) {
305
+ const panel = document.createElement('div');
306
+ panel.className = 'cy-phrase-picker__select-panel';
307
+ if (!this.selectedOptionId ||
308
+ !primary.options.some((o) => o.id === this.selectedOptionId)) {
309
+ this.selectedOptionId = primary.options[0]?.id ?? null;
310
+ }
311
+ const selected = primary.options.find((o) => o.id === this.selectedOptionId) ??
312
+ primary.options[0];
313
+ const row = document.createElement('div');
314
+ row.className = 'cy-phrase-picker__select-row';
315
+ const select = document.createElement('select');
316
+ select.className = 'cy-phrase-picker__select';
317
+ select.setAttribute('aria-label', primary.content);
318
+ select.disabled = Boolean(primary.disabled) || primary.options.length === 0;
319
+ for (const option of primary.options) {
320
+ const opt = document.createElement('option');
321
+ opt.value = option.id;
322
+ opt.textContent = option.content;
323
+ opt.disabled = Boolean(option.disabled);
324
+ if (option.id === this.selectedOptionId)
325
+ opt.selected = true;
326
+ select.appendChild(opt);
327
+ }
328
+ select.addEventListener('change', (event) => {
329
+ event.stopPropagation();
330
+ this.selectedOptionId = select.value;
331
+ this.rerender();
332
+ });
333
+ // Keep menu open when interacting with native select
334
+ select.addEventListener('mousedown', (event) => event.stopPropagation());
335
+ select.addEventListener('mouseup', (event) => event.stopPropagation());
336
+ select.addEventListener('click', (event) => event.stopPropagation());
337
+ row.appendChild(select);
338
+ if (selected?.favoritable) {
339
+ row.appendChild(this.buildStarButton(primary.id, selected.id, selected.content));
340
+ }
341
+ panel.appendChild(row);
342
+ const confirm = document.createElement('button');
343
+ confirm.type = 'button';
344
+ confirm.className = 'cy-phrase-picker__confirm';
345
+ confirm.textContent = 'Confirm';
346
+ confirm.disabled = Boolean(primary.disabled) || !selected || Boolean(selected.disabled);
347
+ confirm.addEventListener('click', (event) => {
348
+ event.preventDefault();
349
+ event.stopPropagation();
350
+ if (selected)
351
+ this.applyLeaf(selected);
352
+ });
353
+ panel.appendChild(confirm);
354
+ return panel;
355
+ }
356
+ goBackToPrimaries() {
357
+ this.activePrimaryId = null;
358
+ this.activeCategoryId = null;
359
+ this.selectedOptionId = null;
360
+ this.rerender();
361
+ }
362
+ favoriteTargetsForBranch(branchId) {
363
+ const targets = [];
364
+ for (const id of this.favoriteIdsByBranch.get(branchId) ?? []) {
365
+ const hit = this.favoriteIndex.get(`${branchId}:${id}`);
366
+ if (hit)
367
+ targets.push(hit);
368
+ }
369
+ return targets;
370
+ }
371
+ /**
372
+ * Selected-branch chrome: heading (back + title), then Favorites only when
373
+ * that branch has starred items. Navigation handlers unchanged.
374
+ */
375
+ buildSelectedHeader(primary) {
376
+ const section = document.createElement('div');
377
+ section.className = 'cy-phrase-picker__selected-header';
378
+ const heading = document.createElement('div');
379
+ heading.className = 'cy-phrase-picker__selected-heading';
380
+ const backBtn = document.createElement('button');
381
+ backBtn.type = 'button';
382
+ backBtn.className = 'cy-phrase-picker__back';
383
+ backBtn.setAttribute('aria-label', 'Back');
384
+ backBtn.innerHTML = backArrowSvg();
385
+ backBtn.addEventListener('click', (event) => {
386
+ event.preventDefault();
387
+ event.stopPropagation();
388
+ this.goBackToPrimaries();
389
+ });
390
+ heading.appendChild(backBtn);
391
+ const title = document.createElement('span');
392
+ title.className = 'cy-phrase-picker__selected-title';
393
+ title.textContent = primary.content;
394
+ heading.appendChild(title);
395
+ section.appendChild(heading);
396
+ const targets = this.favoriteTargetsForBranch(primary.id);
397
+ if (targets.length > 0) {
398
+ const favorites = document.createElement('div');
399
+ favorites.className = 'cy-phrase-picker__favorites';
400
+ const favoritesLabel = document.createElement('span');
401
+ favoritesLabel.className = 'cy-phrase-picker__favorites-heading';
402
+ favoritesLabel.textContent =
403
+ this.options.labels?.favorites ?? 'Favorites';
404
+ favorites.appendChild(favoritesLabel);
405
+ const list = document.createElement('div');
406
+ list.className = 'cy-phrase-picker__favorites-list';
407
+ for (const target of targets) {
408
+ list.appendChild(this.buildFavoriteChip(target));
409
+ }
410
+ favorites.appendChild(list);
411
+ section.appendChild(favorites);
412
+ }
413
+ return section;
414
+ }
415
+ /** Catalog favorites include the category (e.g. NP-SBJ/*); select favorites stay as the option label. */
416
+ favoriteLabel(leaf, branchId) {
417
+ const primary = this.primaries.find((p) => p.id === branchId);
418
+ if (primary?.kind === 'catalog') {
419
+ return `${leaf.categoryTitle}/${leaf.content}`;
420
+ }
421
+ return leaf.content;
422
+ }
423
+ buildFavoriteChip(target) {
424
+ const btn = document.createElement('button');
425
+ btn.type = 'button';
426
+ btn.className = 'cy-phrase-picker__favorite-chip';
427
+ btn.textContent = this.favoriteLabel(target.leaf, target.branchId);
428
+ if (target.leaf.tooltipText)
429
+ btn.title = target.leaf.tooltipText;
430
+ btn.disabled = Boolean(target.leaf.disabled);
431
+ btn.addEventListener('click', (event) => {
432
+ event.preventDefault();
433
+ event.stopPropagation();
434
+ this.applyLeaf(target.leaf);
435
+ });
436
+ return btn;
437
+ }
438
+ buildBody(categories) {
439
+ const body = document.createElement('div');
440
+ body.className = 'cy-phrase-picker__body';
441
+ const categoryList = document.createElement('div');
442
+ categoryList.className = 'cy-phrase-picker__categories';
443
+ categoryList.setAttribute('role', 'listbox');
444
+ categoryList.setAttribute('aria-label', 'Phrase categories');
445
+ if (!this.activeCategoryId ||
446
+ !categories.some((c) => c.id === this.activeCategoryId)) {
447
+ this.activeCategoryId = categories[0]?.id ?? null;
448
+ }
449
+ for (const category of categories) {
450
+ const btn = document.createElement('button');
451
+ btn.type = 'button';
452
+ btn.className = 'cy-phrase-picker__category';
453
+ btn.setAttribute('role', 'option');
454
+ btn.textContent = category.content;
455
+ btn.disabled = Boolean(category.disabled);
456
+ if (category.id === this.activeCategoryId) {
457
+ btn.classList.add('is-active');
458
+ btn.setAttribute('aria-selected', 'true');
459
+ }
460
+ else {
461
+ btn.setAttribute('aria-selected', 'false');
462
+ }
463
+ btn.addEventListener('click', (event) => {
464
+ event.preventDefault();
465
+ event.stopPropagation();
466
+ this.activeCategoryId = category.id;
467
+ this.rerender();
468
+ });
469
+ categoryList.appendChild(btn);
470
+ }
471
+ const leaves = document.createElement('div');
472
+ leaves.className = 'cy-phrase-picker__leaves';
473
+ leaves.setAttribute('role', 'listbox');
474
+ leaves.setAttribute('aria-label', 'Phrase labels');
475
+ const active = categories.find((c) => c.id === this.activeCategoryId);
476
+ const branchId = this.activeBranchId();
477
+ if (branchId != null) {
478
+ for (const leaf of active?.leaves ?? []) {
479
+ leaves.appendChild(this.buildLeafRow(leaf, branchId));
480
+ }
481
+ }
482
+ body.appendChild(categoryList);
483
+ body.appendChild(leaves);
484
+ return body;
485
+ }
486
+ buildLeafRow(leaf, branchId) {
487
+ const row = document.createElement('div');
488
+ row.className = 'cy-phrase-picker__leaf';
489
+ const applyBtn = document.createElement('button');
490
+ applyBtn.type = 'button';
491
+ applyBtn.className = 'cy-phrase-picker__leaf-apply';
492
+ applyBtn.textContent = leaf.content;
493
+ if (leaf.tooltipText)
494
+ applyBtn.title = leaf.tooltipText;
495
+ applyBtn.disabled = Boolean(leaf.disabled);
496
+ applyBtn.addEventListener('click', (event) => {
497
+ event.preventDefault();
498
+ event.stopPropagation();
499
+ this.applyLeaf(leaf);
500
+ });
501
+ row.appendChild(applyBtn);
502
+ if (leaf.favoritable) {
503
+ row.appendChild(this.buildStarButton(branchId, leaf.id, this.favoriteLabel(leaf, branchId)));
504
+ }
505
+ return row;
506
+ }
507
+ buildStarButton(branchId, itemId, label) {
508
+ const starred = (this.favoriteIdsByBranch.get(branchId) ?? []).includes(itemId);
509
+ const starBtn = document.createElement('button');
510
+ starBtn.type = 'button';
511
+ starBtn.className = 'cy-phrase-picker__star';
512
+ if (starred)
513
+ starBtn.classList.add('is-starred');
514
+ starBtn.setAttribute('aria-label', starred ? `Remove ${label} from favorites` : `Add ${label} to favorites`);
515
+ starBtn.setAttribute('aria-pressed', starred ? 'true' : 'false');
516
+ starBtn.innerHTML = starSvg(starred);
517
+ starBtn.addEventListener('click', (event) => {
518
+ event.preventDefault();
519
+ event.stopPropagation();
520
+ const next = toggleFavoriteId(branchId, itemId, this.storageKey(), this.favoritesAdapter());
521
+ this.favoriteIdsByBranch.set(branchId, next);
522
+ this.rerender();
523
+ });
524
+ return starBtn;
525
+ }
526
+ rerender() {
527
+ const host = this.ensureHost();
528
+ host.replaceChildren();
529
+ host.appendChild(this.build());
530
+ }
531
+ applyLeaf(leaf) {
532
+ const cyEvent = this.options.getCurrentEvent();
533
+ if (cyEvent && leaf.onClickFunction) {
534
+ leaf.onClickFunction(cyEvent);
535
+ }
536
+ this.options.onApply();
537
+ }
538
+ }