Skip to content

Commit f395f02

Browse files
jpan8866nang-devHimanshu-Singh-ChauhanFryingpannnMaxFSP
authored
highlight cmd i onboarding (#105)
* WIP: Walkthrough changes (#236) * Added walkthrough progress * Added progress for walkthrough * Added todo * enable editorInsets for inline chat (#253) * Fix .gitmodules * Update code.sh * update submodule to latest tip (#260) * fix: #262 prioritize pearai commands (#264) * fix: #262 prioritize pearai commands * fix: update priority order and change test case default chord * fix: use keymode.shift * Fixed code version * feat: docs and newchat shortcut on titlebar (#266) * feat: docs and newchat shortcut on titlebar * typo * Update README.md (#276) * Shortcut change to resize chat on the app side (#279) * Shortcut change to resize chat on the app side * Removed test related console log * Updated splitEditor shortcut * update icon and watermark (#278) * watermarks update * add shortcuts to watermark * titlebar icon change * fix walkthrough * Added product (microsoft#285) Co-authored-by: Nathan A <[email protected]> * set quality:stable (#267) * update MacOS example in CONTRIBUTING.md file: Packaging step 3 - integrate the submodule (#228) * update MacOS example in CONTRIBUTING.md file: Packaging step 3 - integrate the submodule * fix constants CAP * PearAI main app welcome page gif fixed (microsoft#286) * Update media paths for welcome page GIFs and GIF themselves. * upload two gifs first * upload one gif first * push again * Fixed walk through (microsoft#288) * Added imports for gif * Added png * Added typo fix * Added png --------- Co-authored-by: Nathan A <[email protected]> * Added to readme (microsoft#295) Co-authored-by: Nathan A <[email protected]> * add hacker theme to pearai (microsoft#300) * Update README.md * Set default theme to PearAI Dark/Light (microsoft#322) * Set default theme to PearAI Dark/Light * Undo not needed solarized file changes * Added auto-updating working client-side (microsoft#340) * Added updating working * Removed configs --------- Co-authored-by: Nathan A <[email protected]> Co-authored-by: Nathan A <[email protected]> * Updated wording (microsoft#341) * Added updating working * Removed configs * Added pearAI online services * Added pearAI online services --------- Co-authored-by: Nathan A <[email protected]> Co-authored-by: Nathan A <[email protected]> * Setup Environment with Space in Path (microsoft#335) * Added v1.1.0 (microsoft#344) Co-authored-by: Nathan A <[email protected]> * Bumped to v1.2.0 * Update README.md * patch-wsl (add vscode commit) (microsoft#348) * Update README.md * If you are looking for commit history, read this please * Updated to v1.3.0 * add pear version in about * Update CONTRIBUTING.md update packaging guide * Update CONTRIBUTING.md update packaging info * Update CONTRIBUTING.md * Git submodule commit update (#66) * Bumped to v1.4.0 * PearAI Overlay (#67) * PearAI Overlay * Uncomment layout * Remove comment * Prevent overlay open on every startup + background default color * Fix overlay bug * Border radius * Bumped to v1.4.1 * Fix overlay popping up for half a second at startup (#77) * Console logs for debugging trace of overlay startup * Revert "Console logs for debugging trace of overlay startup" This reverts commit 70fa3bc. * Fix overlay appearing for half a second on startup * Bumped versions (#80) Co-authored-by: nang-dev <[email protected]> * Handle overlay integration shortcuts (#84) * feat: new window watermark (#87) * Added darken and click outside overlay. todo for not closing * Added min for the auxbar (#94) Co-authored-by: nang-dev <[email protected]> * feat: overlay-lock (#92) * Added remove release notes (#96) Co-authored-by: nang-dev <[email protected]> * remove unused vars (#97) * Bumped to v1.4.4 * Default close sidebar for new window (#98) * Add highlight of quickinput during cmd+i step * clean up * package.json * remove transition --------- Co-authored-by: Nang <[email protected]> Co-authored-by: Himanshu <[email protected]> Co-authored-by: Duke Pan <[email protected]> Co-authored-by: Maximiliano Farfan <[email protected]> Co-authored-by: Nathan A <[email protected]> Co-authored-by: Brian <[email protected]> Co-authored-by: Andrew Hopkins <[email protected]> Co-authored-by: Nathan A <[email protected]> Co-authored-by: Ashvin Nihalani <[email protected]> Co-authored-by: nang-dev <[email protected]>
1 parent 5d555dc commit f395f02

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
2+
import { registerSingleton, InstantiationType } from 'vs/platform/instantiation/common/extensions';
3+
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
4+
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
5+
6+
export const IShadowOverlayService = createDecorator<IShadowOverlayService>('shadowOverlayService');
7+
8+
export interface IShadowOverlayService extends IDisposable {
9+
readonly _serviceBrand: undefined;
10+
11+
highlight(elements: string[]): void;
12+
restoreStyles(elements: string[]): void;
13+
}
14+
15+
16+
export class ShadowOverlayService extends Disposable implements IShadowOverlayService {
17+
declare readonly _serviceBrand: undefined;
18+
private highlightedElements: Map<string, {
19+
position: string;
20+
zIndex: string;
21+
isolation: string;
22+
pointerEvents: string;
23+
backgroundColor: string;
24+
boxShadow: string;
25+
}> = new Map();
26+
27+
constructor(
28+
) {
29+
super();
30+
this.registerCommands();
31+
}
32+
33+
private registerCommands(): void {
34+
CommandsRegistry.registerCommand('pearai.highlightElements', (accessor, ...args) => {
35+
36+
const selectors = args[0] as string[]; // array of CSS selectors
37+
this.highlight(selectors);
38+
});
39+
40+
CommandsRegistry.registerCommand('pearai.removeHighlight', (accessor, ...args) => {
41+
const selectors = args[0] as string[]; // array of CSS selectors
42+
// Convert selectors to elements
43+
this.restoreStyles(selectors);
44+
});
45+
}
46+
47+
restoreStyles(selectors: string[]): void {
48+
selectors.forEach(selector => {
49+
const originalStyles = this.highlightedElements.get(selector);
50+
51+
const element = document.querySelector(selector) as HTMLElement
52+
53+
if (originalStyles) {
54+
element.style.position = originalStyles.position;
55+
element.style.zIndex = originalStyles.zIndex;
56+
element.style.isolation = originalStyles.isolation;
57+
element.style.pointerEvents = originalStyles.pointerEvents;
58+
element.style.backgroundColor = originalStyles.backgroundColor;
59+
element.style.boxShadow = originalStyles.boxShadow;
60+
61+
// Remove this element from the tracked elements
62+
this.highlightedElements.delete(selector);
63+
}
64+
});
65+
}
66+
67+
highlight(selectors: string[]): void {
68+
selectors.forEach(selector => {
69+
if (selector) {
70+
const element = document.querySelector(selector) as HTMLElement
71+
72+
// save original styles
73+
if (!this.highlightedElements.has(selector)) {
74+
this.highlightedElements.set(selector, {
75+
position: element.style.position,
76+
zIndex: element.style.zIndex,
77+
isolation: element.style.isolation,
78+
pointerEvents: element.style.pointerEvents,
79+
backgroundColor: element.style.backgroundColor,
80+
boxShadow: element.style.boxShadow,
81+
});
82+
}
83+
element.style.position = 'absolute';
84+
element.style.zIndex = '3000';
85+
element.style.isolation = 'isolate';
86+
element.style.pointerEvents = 'auto';
87+
element.style.backgroundColor = 'transparent';
88+
element.style.boxShadow = '0 0 0 9999px rgba(0, 0, 0, 0.6)';
89+
}
90+
});
91+
}
92+
}
93+
94+
registerSingleton(IShadowOverlayService, ShadowOverlayService, InstantiationType.Eager,);

src/vs/workbench/browser/workbench.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { setProgressAcccessibilitySignalScheduler } from 'vs/base/browser/ui/pro
5151
import { AccessibleViewRegistry } from 'vs/platform/accessibility/browser/accessibleViewRegistry';
5252
import { NotificationAccessibleView } from 'vs/workbench/browser/parts/notifications/notificationAccessibleView';
5353
import { IPearOverlayService } from 'vs/workbench/browser/parts/overlay/pearOverlayService';
54+
import { IShadowOverlayService } from 'vs/workbench/browser/parts/overlay/onboardingShadow/shadowOverlayService';
5455

5556
export interface IWorkbenchOptions {
5657

@@ -380,6 +381,11 @@ export class Workbench extends Layout {
380381
});
381382
}
382383

384+
// instantiate highlighting
385+
instantiationService.invokeFunction(accessor => {
386+
accessor.get(IShadowOverlayService);
387+
});
388+
383389
mark(`code/willCreatePart/${id}`);
384390
this.getPart(id).create(partContainer, options);
385391
mark(`code/didCreatePart/${id}`);

0 commit comments

Comments
 (0)