@lvce-editor/title-bar-worker 2.17.0 → 2.19.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.
@@ -1149,10 +1149,11 @@ const {
1149
1149
  set: set$3,
1150
1150
  getCommandIds,
1151
1151
  registerCommands,
1152
- wrapCommand
1152
+ wrapCommand,
1153
+ wrapGetter
1153
1154
  } = create$2();
1154
1155
 
1155
- const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled, titleBarStyleCustom) => {
1156
+ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled, titleBarStyleCustom, assetDir) => {
1156
1157
  const titleBarButtons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
1157
1158
  const state = {
1158
1159
  ...createDefaultState(),
@@ -1175,10 +1176,10 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
1175
1176
  platform,
1176
1177
  controlsOverlayEnabled,
1177
1178
  titleBarStyleCustom,
1178
- titleBarButtons
1179
+ titleBarButtons,
1180
+ assetDir
1179
1181
  };
1180
1182
  set$3(id, state, state);
1181
- return state;
1182
1183
  };
1183
1184
 
1184
1185
  const RenderEntries = 1;
@@ -1189,12 +1190,10 @@ const isEqual$3 = (oldState, newState) => {
1189
1190
  return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
1190
1191
  };
1191
1192
 
1192
- const diffType$2 = RenderFocusedIndex;
1193
1193
  const isEqual$2 = (oldState, newState) => {
1194
1194
  return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
1195
1195
  };
1196
1196
 
1197
- const diffType$1 = RenderMenus;
1198
1197
  const isEqual$1 = (oldState, newState) => {
1199
1198
  return oldState.menus === newState.menus;
1200
1199
  };
@@ -1221,13 +1220,12 @@ const diff2 = uid => {
1221
1220
  return diff(oldState, newState);
1222
1221
  };
1223
1222
 
1224
- const diffType = RenderEntries;
1225
1223
  const isEqual = (oldState, newState) => {
1226
1224
  return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.assetDir === newState.assetDir && oldState.titleBarIconEnabled === newState.titleBarIconEnabled && oldState.title === newState.title && oldState.titleBarTitleEnabled === newState.titleBarTitleEnabled && oldState.platform === newState.platform && oldState.controlsOverlayEnabled === newState.controlsOverlayEnabled && oldState.titleBarStyleCustom === newState.titleBarStyleCustom && oldState.titleBarButtonsEnabled === newState.titleBarButtonsEnabled && oldState.titleBarButtons === newState.titleBarButtons;
1227
1225
  };
1228
1226
 
1229
1227
  const modules = [isEqual, isEqual$2, isEqual$1];
1230
- const numbers = [diffType, diffType$2, diffType$1];
1228
+ const numbers = [RenderEntries, RenderFocusedIndex, RenderMenus];
1231
1229
 
1232
1230
  const diff3 = uid => {
1233
1231
  const {
@@ -1548,6 +1546,8 @@ const parseKey = rawKey => {
1548
1546
  const DebugWorker = 55;
1549
1547
  const RendererWorker$1 = 1;
1550
1548
 
1549
+ const FocusTitleBarMenuBar = 26;
1550
+
1551
1551
  const mergeClassNames = (...classNames) => {
1552
1552
  return classNames.filter(Boolean).join(' ');
1553
1553
  };
@@ -1564,8 +1564,6 @@ const text = data => {
1564
1564
  };
1565
1565
  };
1566
1566
 
1567
- const FocusTitleBarMenuBar = 26;
1568
-
1569
1567
  const getKeyBindings$1 = () => {
1570
1568
  return [{
1571
1569
  key: DownArrow$1,
@@ -2293,7 +2291,7 @@ const getRecentlyOpened = () => {
2293
2291
 
2294
2292
  const File = 'file://';
2295
2293
 
2296
- const getTitle = (homeDir, uri) => {
2294
+ const getTitle$1 = (homeDir, uri) => {
2297
2295
  if (!uri) {
2298
2296
  return '';
2299
2297
  }
@@ -2317,7 +2315,7 @@ const getHomeDir = () => {
2317
2315
  const MAX_MENU_RECENT_ENTRIES = 10;
2318
2316
  const toMenuItem = folder => {
2319
2317
  const homeDir = getHomeDir();
2320
- const label = getTitle(homeDir, folder);
2318
+ const label = getTitle$1(homeDir, folder);
2321
2319
  return {
2322
2320
  label,
2323
2321
  flags: None,
@@ -2528,153 +2526,6 @@ const getMenuEntries$1 = async (id, platform) => {
2528
2526
  return menu.getMenuEntries(platform);
2529
2527
  };
2530
2528
 
2531
- const MaskIconCheck = 'MaskIconCheck';
2532
- const Menu = 'Menu';
2533
- const MenuItem = 'MenuItem';
2534
- const MenuItemCheckMark = 'MenuItemCheckMark';
2535
- const MenuItemCheckmarkIcon = 'MenuItemCheckmarkIcon';
2536
- const MenuItemFocused = 'MenuItemFocused';
2537
- const MenuItemKeyBinding = 'MenuItemKeyBinding';
2538
- const MenuItemSeparator = 'MenuItemSeparator';
2539
- const MenuItemSeparatorLine = 'MenuItemSeparatorLine';
2540
- const MenuItemSubMenu = 'MenuItemSubMenu';
2541
- const MenuItemSubMenuArrowRight = 'MenuItemSubMenuArrowRight';
2542
- const TitleBarButtons = 'TitleBarButtons';
2543
- const TitleBarEntryActive = 'TitleBarEntryActive';
2544
- const TitleBarIcon = 'TitleBarIcon';
2545
- const TitleBarIconIcon = 'TitleBarIconIcon';
2546
- const TitleBarMenuBar$1 = 'TitleBarMenuBar';
2547
- const TitleBarTopLevelEntry = 'TitleBarTopLevelEntry';
2548
- const TitleBarTopLevelEntryLabel = 'TitleBarTopLevelEntryLabel';
2549
- const Viewlet = 'Viewlet';
2550
-
2551
- const getIconVirtualDom = (icon, type = Div) => {
2552
- return {
2553
- type,
2554
- className: `MaskIcon MaskIcon${icon}`,
2555
- role: None$1,
2556
- childCount: 0
2557
- };
2558
- };
2559
-
2560
- const createTitleBarButton = button => {
2561
- const {
2562
- id,
2563
- icon,
2564
- label,
2565
- onClick
2566
- } = button;
2567
- const dom = [{
2568
- type: Button$1,
2569
- className: `TitleBarButton TitleBarButton${id}`,
2570
- ariaLabel: label,
2571
- childCount: 1,
2572
- onClick
2573
- }, getIconVirtualDom(icon, I)];
2574
- return dom;
2575
- };
2576
-
2577
- const getTitleBarButtonsVirtualDom = buttons => {
2578
- return [{
2579
- type: Div,
2580
- className: mergeClassNames(Viewlet, TitleBarButtons),
2581
- childCount: buttons.length
2582
- }, ...buttons.flatMap(createTitleBarButton)];
2583
- };
2584
-
2585
- const parentNode$1 = {
2586
- type: Div,
2587
- className: mergeClassNames(Viewlet, TitleBarIcon),
2588
- childCount: 1
2589
- };
2590
- const getTitleBarIconVirtualDom = iconSrc => {
2591
- return [parentNode$1, {
2592
- type: Img,
2593
- className: TitleBarIconIcon,
2594
- src: iconSrc,
2595
- alt: '',
2596
- childCount: 0
2597
- }];
2598
- };
2599
-
2600
- const HandleClick = 1;
2601
- const HandleClickMinimize = 2;
2602
- const HandleClickToggleClose = 3;
2603
- const HandleClickToggleMaximize = 4;
2604
- const HandleFocusIn = 5;
2605
- const HandleFocusOut = 6;
2606
- const HandlePointerOut = 7;
2607
- const HandlePointerOver = 8;
2608
- const HandleMenuClick = 9;
2609
- const HandleMenuMouseOver = 10;
2610
-
2611
- const getItemVirtualDom = item => {
2612
- // @ts-ignore
2613
- const {
2614
- keyboardShortCut,
2615
- label,
2616
- isOpen,
2617
- isFocused
2618
- } = item;
2619
- // TODO avoid mutation
2620
- const dom = [];
2621
- dom.push({
2622
- type: Div,
2623
- className: TitleBarTopLevelEntry,
2624
- ariaHasPopup: true,
2625
- ariaExpanded: isOpen,
2626
- role: MenuItem$1,
2627
- childCount: 1,
2628
- ariaKeyShortcuts: keyboardShortCut
2629
- });
2630
- if (isOpen) {
2631
- // @ts-ignore
2632
- dom[0].ariaOwns = 'Menu-0';
2633
- }
2634
- if (isFocused) {
2635
- dom[0].className += ' ' + TitleBarEntryActive;
2636
- // @ts-ignore
2637
- dom[0].id = 'TitleBarEntryActive';
2638
- dom.push({
2639
- type: Div,
2640
- className: TitleBarTopLevelEntryLabel,
2641
- childCount: 1
2642
- });
2643
- }
2644
- dom.push(text(label));
2645
- return dom;
2646
- };
2647
- const getTitleBarMenuBarItemsVirtualDom = visibleItems => {
2648
- const dom = visibleItems.flatMap(getItemVirtualDom);
2649
- return dom;
2650
- };
2651
-
2652
- const activeId = 'TitleBarEntryActive';
2653
- const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
2654
- return [{
2655
- type: Div,
2656
- className: mergeClassNames(Viewlet, TitleBarMenuBar$1),
2657
- role: MenuBar,
2658
- tabIndex: 0,
2659
- childCount: visibleItems.length,
2660
- onMouseDown: HandleClick,
2661
- onFocusOut: HandleFocusOut,
2662
- onFocusIn: HandleFocusIn,
2663
- onPointerOver: HandlePointerOver,
2664
- onPointerOut: HandlePointerOut,
2665
- ariaActivedescendant: focusedIndex === -1 ? '' : activeId
2666
- }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
2667
- };
2668
-
2669
- const parentNode = {
2670
- type: Div,
2671
- className: 'TitleBarTitle',
2672
- childCount: 1
2673
- };
2674
- const getTitleVirtualDom = title => {
2675
- return [parentNode, text(title)];
2676
- };
2677
-
2678
2529
  const maximize = async () => {
2679
2530
  await invoke('ElectronWindow.maximize');
2680
2531
  };
@@ -3030,6 +2881,15 @@ const addWidths = (entries, labelPadding, fontWeight, fontSize, fontFamily, lett
3030
2881
  return withWidths;
3031
2882
  };
3032
2883
 
2884
+ const getTitle = workspaceUri => {
2885
+ if (!workspaceUri) {
2886
+ return '';
2887
+ }
2888
+ const slashIndex = workspaceUri.lastIndexOf('/');
2889
+ const baseName = workspaceUri.slice(slashIndex);
2890
+ return baseName;
2891
+ };
2892
+
3033
2893
  const loadContent2 = async state => {
3034
2894
  const {
3035
2895
  platform,
@@ -3044,7 +2904,9 @@ const loadContent2 = async state => {
3044
2904
  const titleBarEntries = await getMenuEntries(TitleBar$1);
3045
2905
  const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
3046
2906
  const buttons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
3047
- const title = 'test';
2907
+ // @ts-ignore
2908
+ const workspaceUri = await invoke('Workspace.getUri');
2909
+ const title = getTitle(workspaceUri);
3048
2910
  const iconWidth = 30;
3049
2911
  return {
3050
2912
  ...state,
@@ -3055,74 +2917,6 @@ const loadContent2 = async state => {
3055
2917
  };
3056
2918
  };
3057
2919
 
3058
- const loadContent = async (state, titleBarEntries) => {
3059
- const {
3060
- platform,
3061
- controlsOverlayEnabled,
3062
- titleBarStyleCustom,
3063
- labelFontFamily,
3064
- labelFontSize,
3065
- labelFontWeight,
3066
- labelLetterSpacing,
3067
- labelPadding
3068
- } = state;
3069
- const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
3070
- const buttons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
3071
- const title = 'test';
3072
- return {
3073
- ...state,
3074
- titleBarEntries: withWidths,
3075
- buttons,
3076
- title
3077
- };
3078
- };
3079
-
3080
- const Ellipsis = 'Ellipsis';
3081
-
3082
- const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) => {
3083
- array(entries);
3084
- number(width);
3085
- let total = 0;
3086
- const visible = [];
3087
- for (let i = 0; i < entries.length; i++) {
3088
- const entry = entries[i];
3089
- total += entry.width;
3090
- if (total >= width) {
3091
- break;
3092
- }
3093
- const isOpen = i === focusedIndex && isMenuOpen;
3094
- const isFocused = i === focusedIndex;
3095
- visible.push({
3096
- ...entry,
3097
- isOpen,
3098
- isFocused
3099
- });
3100
- }
3101
- const hasOverflow = visible.length < entries.length;
3102
- if (hasOverflow) {
3103
- const padding = 8;
3104
- const moreIconWidth = 22;
3105
- const totalPadding = padding * 2;
3106
- const hasStillOverflow = total + moreIconWidth + totalPadding > width;
3107
- if (hasStillOverflow) {
3108
- visible.pop();
3109
- }
3110
- visible.push({
3111
- ariaLabel: moreDot(),
3112
- icon: Ellipsis,
3113
- label: '',
3114
- width: moreIconWidth + totalPadding
3115
- });
3116
- }
3117
- return visible;
3118
- };
3119
-
3120
- const renderEntries = (oldState, newState) => {
3121
- const visibleEntries = getVisibleTitleBarEntries(newState.titleBarEntries, newState.width, newState.focusedIndex, newState.isMenuOpen);
3122
- const dom = getTitleBarMenuBarVirtualDom(visibleEntries, newState.focusedIndex);
3123
- return ['Viewlet.setDom2', newState.uid, dom];
3124
- };
3125
-
3126
2920
  const renderFocusedIndex = (oldState, newState) => {
3127
2921
  if (newState.focusedIndex === -1) {
3128
2922
  return [];
@@ -3130,6 +2924,26 @@ const renderFocusedIndex = (oldState, newState) => {
3130
2924
  return ['Viewlet.focusSelector', '.ViewletTitleBarMenuBar'];
3131
2925
  };
3132
2926
 
2927
+ const MaskIconCheck = 'MaskIconCheck';
2928
+ const Menu = 'Menu';
2929
+ const MenuItem = 'MenuItem';
2930
+ const MenuItemCheckMark = 'MenuItemCheckMark';
2931
+ const MenuItemCheckmarkIcon = 'MenuItemCheckmarkIcon';
2932
+ const MenuItemFocused = 'MenuItemFocused';
2933
+ const MenuItemKeyBinding = 'MenuItemKeyBinding';
2934
+ const MenuItemSeparator = 'MenuItemSeparator';
2935
+ const MenuItemSeparatorLine = 'MenuItemSeparatorLine';
2936
+ const MenuItemSubMenu = 'MenuItemSubMenu';
2937
+ const MenuItemSubMenuArrowRight = 'MenuItemSubMenuArrowRight';
2938
+ const TitleBarButtons = 'TitleBarButtons';
2939
+ const TitleBarEntryActive = 'TitleBarEntryActive';
2940
+ const TitleBarIcon = 'TitleBarIcon';
2941
+ const TitleBarIconIcon = 'TitleBarIconIcon';
2942
+ const TitleBarMenuBar = 'TitleBarMenuBar';
2943
+ const TitleBarTopLevelEntry = 'TitleBarTopLevelEntry';
2944
+ const TitleBarTopLevelEntryLabel = 'TitleBarTopLevelEntryLabel';
2945
+ const Viewlet = 'Viewlet';
2946
+
3133
2947
  const checkboxChecked = {
3134
2948
  type: Div,
3135
2949
  className: mergeClassNames(MenuItem, MenuItemCheckMark),
@@ -3361,43 +3175,175 @@ const renderMenus = (oldState, newState) => {
3361
3175
  return ['Viewlet.send', newState.uid, /* method */SetMenus, /* changes */changes, newState.uid];
3362
3176
  };
3363
3177
 
3364
- const getRenderer = diffType => {
3365
- switch (diffType) {
3366
- case RenderEntries:
3367
- return renderEntries;
3368
- case RenderFocusedIndex:
3369
- return renderFocusedIndex;
3370
- case RenderMenus:
3371
- return renderMenus;
3372
- default:
3373
- throw new Error('unknown renderer');
3374
- }
3178
+ const getIcon = assetDir => {
3179
+ return `${assetDir}/icons/icon.svg`;
3375
3180
  };
3376
3181
 
3377
- const applyRender = (oldState, newState, diffResult) => {
3378
- const commands = [];
3379
- for (const item of diffResult) {
3380
- const fn = getRenderer(item);
3381
- const result = fn(oldState, newState);
3382
- if (result.length > 0) {
3383
- commands.push(result);
3384
- }
3385
- }
3386
- return commands;
3182
+ const getIconVirtualDom = (icon, type = Div) => {
3183
+ return {
3184
+ type,
3185
+ className: `MaskIcon MaskIcon${icon}`,
3186
+ role: None$1,
3187
+ childCount: 0
3188
+ };
3387
3189
  };
3388
3190
 
3389
- const render2 = async (uid, diffResult) => {
3191
+ const createTitleBarButton = button => {
3390
3192
  const {
3391
- oldState,
3392
- newState
3393
- } = get$1(uid);
3394
- set$3(uid, newState, newState);
3395
- const commands = applyRender(oldState, newState, diffResult);
3396
- return commands;
3193
+ id,
3194
+ icon,
3195
+ label,
3196
+ onClick
3197
+ } = button;
3198
+ const dom = [{
3199
+ type: Button$1,
3200
+ className: `TitleBarButton TitleBarButton${id}`,
3201
+ ariaLabel: label,
3202
+ childCount: 1,
3203
+ onClick
3204
+ }, getIconVirtualDom(icon, I)];
3205
+ return dom;
3397
3206
  };
3398
3207
 
3399
- const getIcon = assetDir => {
3400
- return `${assetDir}/icons/icon.svg`;
3208
+ const getTitleBarButtonsVirtualDom = buttons => {
3209
+ return [{
3210
+ type: Div,
3211
+ className: mergeClassNames(Viewlet, TitleBarButtons),
3212
+ childCount: buttons.length
3213
+ }, ...buttons.flatMap(createTitleBarButton)];
3214
+ };
3215
+
3216
+ const parentNode$1 = {
3217
+ type: Div,
3218
+ className: mergeClassNames(Viewlet, TitleBarIcon),
3219
+ childCount: 1
3220
+ };
3221
+ const getTitleBarIconVirtualDom = iconSrc => {
3222
+ return [parentNode$1, {
3223
+ type: Img,
3224
+ className: TitleBarIconIcon,
3225
+ src: iconSrc,
3226
+ alt: '',
3227
+ childCount: 0
3228
+ }];
3229
+ };
3230
+
3231
+ const HandleClick = 1;
3232
+ const HandleClickMinimize = 2;
3233
+ const HandleClickToggleClose = 3;
3234
+ const HandleClickToggleMaximize = 4;
3235
+ const HandleFocusIn = 5;
3236
+ const HandleFocusOut = 6;
3237
+ const HandlePointerOut = 7;
3238
+ const HandlePointerOver = 8;
3239
+ const HandleMenuClick = 9;
3240
+ const HandleMenuMouseOver = 10;
3241
+
3242
+ const getItemVirtualDom = item => {
3243
+ // @ts-ignore
3244
+ const {
3245
+ keyboardShortCut,
3246
+ label,
3247
+ isOpen,
3248
+ isFocused
3249
+ } = item;
3250
+ // TODO avoid mutation
3251
+ const dom = [];
3252
+ dom.push({
3253
+ type: Div,
3254
+ className: TitleBarTopLevelEntry,
3255
+ ariaHasPopup: true,
3256
+ ariaExpanded: isOpen,
3257
+ role: MenuItem$1,
3258
+ childCount: 1,
3259
+ ariaKeyShortcuts: keyboardShortCut
3260
+ });
3261
+ if (isOpen) {
3262
+ // @ts-ignore
3263
+ dom[0].ariaOwns = 'Menu-0';
3264
+ }
3265
+ if (isFocused) {
3266
+ dom[0].className += ' ' + TitleBarEntryActive;
3267
+ // @ts-ignore
3268
+ dom[0].id = 'TitleBarEntryActive';
3269
+ dom.push({
3270
+ type: Div,
3271
+ className: TitleBarTopLevelEntryLabel,
3272
+ childCount: 1
3273
+ });
3274
+ }
3275
+ dom.push(text(label));
3276
+ return dom;
3277
+ };
3278
+ const getTitleBarMenuBarItemsVirtualDom = visibleItems => {
3279
+ const dom = visibleItems.flatMap(getItemVirtualDom);
3280
+ return dom;
3281
+ };
3282
+
3283
+ const activeId = 'TitleBarEntryActive';
3284
+ const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
3285
+ return [{
3286
+ type: Div,
3287
+ className: mergeClassNames(Viewlet, TitleBarMenuBar),
3288
+ role: MenuBar,
3289
+ tabIndex: 0,
3290
+ childCount: visibleItems.length,
3291
+ onMouseDown: HandleClick,
3292
+ onFocusOut: HandleFocusOut,
3293
+ onFocusIn: HandleFocusIn,
3294
+ onPointerOver: HandlePointerOver,
3295
+ onPointerOut: HandlePointerOut,
3296
+ ariaActivedescendant: focusedIndex === -1 ? '' : activeId
3297
+ }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
3298
+ };
3299
+
3300
+ const parentNode = {
3301
+ type: Div,
3302
+ className: 'TitleBarTitle',
3303
+ childCount: 1
3304
+ };
3305
+ const getTitleVirtualDom = title => {
3306
+ return [parentNode, text(title)];
3307
+ };
3308
+
3309
+ const Ellipsis = 'Ellipsis';
3310
+
3311
+ const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) => {
3312
+ array(entries);
3313
+ number(width);
3314
+ let total = 0;
3315
+ const visible = [];
3316
+ for (let i = 0; i < entries.length; i++) {
3317
+ const entry = entries[i];
3318
+ total += entry.width;
3319
+ if (total >= width) {
3320
+ break;
3321
+ }
3322
+ const isOpen = i === focusedIndex && isMenuOpen;
3323
+ const isFocused = i === focusedIndex;
3324
+ visible.push({
3325
+ ...entry,
3326
+ isOpen,
3327
+ isFocused
3328
+ });
3329
+ }
3330
+ const hasOverflow = visible.length < entries.length;
3331
+ if (hasOverflow) {
3332
+ const padding = 8;
3333
+ const moreIconWidth = 22;
3334
+ const totalPadding = padding * 2;
3335
+ const hasStillOverflow = total + moreIconWidth + totalPadding > width;
3336
+ if (hasStillOverflow) {
3337
+ visible.pop();
3338
+ }
3339
+ visible.push({
3340
+ ariaLabel: moreDot(),
3341
+ icon: Ellipsis,
3342
+ label: '',
3343
+ width: moreIconWidth + totalPadding
3344
+ });
3345
+ }
3346
+ return visible;
3401
3347
  };
3402
3348
 
3403
3349
  const getTitleBarVirtualDom = state => {
@@ -3540,9 +3486,12 @@ const resize = async (state, dimensions) => {
3540
3486
  };
3541
3487
  };
3542
3488
 
3543
- const saveState = uid => {
3489
+ const saveState = state => {
3490
+ const {
3491
+ focusedIndex
3492
+ } = state;
3544
3493
  return {
3545
- x: 1
3494
+ focusedIndex
3546
3495
  };
3547
3496
  };
3548
3497
 
@@ -3675,11 +3624,8 @@ const setFocus = async focusKey => {
3675
3624
  await invoke('Focus.setFocus', focusKey);
3676
3625
  };
3677
3626
 
3678
- // TODO remove this file and merge with whenExpressions
3679
- const TitleBarMenuBar = FocusTitleBarMenuBar;
3680
-
3681
3627
  const handleFocus = async state => {
3682
- await setFocus(TitleBarMenuBar);
3628
+ await setFocus(FocusTitleBarMenuBar);
3683
3629
  return state;
3684
3630
  };
3685
3631
 
@@ -4068,17 +4014,12 @@ const commandMap = {
4068
4014
  'TitleBar.focusLast': wrapCommand(focusIndex),
4069
4015
  'TitleBar.focusNext': wrapCommand(focusNext),
4070
4016
  'TitleBar.focusPrevious': wrapCommand(focusPrevious),
4071
- 'TitleBar.getButtonsVirtualDom': getTitleBarButtonsVirtualDom,
4072
4017
  'TitleBar.getCommandIds': getCommandIds,
4073
4018
  'TitleBar.getCommands': getCommandIds,
4074
- 'TitleBar.getIconVirtualDom': getTitleBarIconVirtualDom,
4075
4019
  'TitleBar.getKeyBindings': getKeyBindings$1,
4076
4020
  'TitleBar.getMenuEntries': getMenuEntries$1,
4077
4021
  'TitleBar.getMenuIds': getMenuIds,
4078
4022
  'TitleBar.getMenus': getMenus,
4079
- 'TitleBar.getTitleBarButtons': getTitleBarButtons,
4080
- 'TitleBar.getTitleVirtualDom': getTitleVirtualDom,
4081
- 'TitleBar.getVirtualDom': getTitleBarMenuBarVirtualDom,
4082
4023
  'TitleBar.handleButtonsClick': handleClick$1,
4083
4024
  'TitleBar.handleClick': wrapCommand(handleClick),
4084
4025
  'TitleBar.handleClickAt': wrapCommand(handleClickAt),
@@ -4103,13 +4044,11 @@ const commandMap = {
4103
4044
  'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
4104
4045
  'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
4105
4046
  'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
4106
- 'TitleBar.loadContent': wrapCommand(loadContent),
4107
4047
  'TitleBar.loadContent2': wrapCommand(loadContent2),
4108
- 'TitleBar.render2': render2,
4109
4048
  'TitleBar.render3': render3,
4110
4049
  'TitleBar.renderEventListeners': renderEventListeners,
4111
4050
  'TitleBar.resize': wrapCommand(resize),
4112
- 'TitleBar.saveState': saveState,
4051
+ 'TitleBar.saveState': wrapGetter(saveState),
4113
4052
  'TitleBar.terminate': terminate,
4114
4053
  'TitleBar.toggleIndex': wrapCommand(toggleIndex),
4115
4054
  'TitleBar.toggleMenu': wrapCommand(toggleMenu)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.17.0",
3
+ "version": "2.19.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",