Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

custom cursor pure css based (#289)

Caleb Taylorad3a5afa46fa
diff --git a/js/app/packages/app/component/CustomCursorTest.tsx b/js/app/packages/app/component/CustomCursorTest.tsx
index 5bc0c9f691..e1f63ef9ee 100644
--- a/js/app/packages/app/component/CustomCursorTest.tsx
+++ b/js/app/packages/app/component/CustomCursorTest.tsx
@@ -35,10 +35,10 @@ const ShadowDOMTest = () => {
margin: 0 0.25rem;
}
button.cursor-pointer {
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
</style>
- <div class="pt-16">
+ <div class="" style="padding: 0px;">
<p>
By creating a
<a href="/en-US/docs/Web/API/BroadcastChannel" class="text-accent underline">
@@ -157,7 +157,7 @@ const CustomCursorTest = () => {
<button
class={`px-4 py-2 rounded border transition-colors ${
useClass() && !useStyle()
- ? 'bg-[var(--color-accent)] text-white border-[var(--color-accent)]'
+ ? 'bg-[var(--color-accent)] text-page border-[var(--color-accent)]'
: 'bg-transparent border-[var(--color-edge)] text-[var(--color-text)] hover:bg-[var(--color-surface-hover)]'
}`}
onClick={() => {
@@ -170,7 +170,7 @@ const CustomCursorTest = () => {
<button
class={`px-4 py-2 rounded border transition-colors ${
!useClass() && useStyle()
- ? 'bg-[var(--color-accent)] text-white border-[var(--color-accent)]'
+ ? 'bg-[var(--color-accent)] text-page border-[var(--color-accent)]'
: 'bg-transparent border-[var(--color-edge)] text-[var(--color-text)] hover:bg-[var(--color-surface-hover)]'
}`}
onClick={() => {
@@ -179,11 +179,12 @@ const CustomCursorTest = () => {
}}
>
Style Only
+ <div>*by using css variable `--cursor-*`</div>
</button>
<button
class={`px-4 py-2 rounded border transition-colors ${
useClass() && useStyle()
- ? 'bg-[var(--color-accent)] text-white border-[var(--color-accent)]'
+ ? 'bg-[var(--color-accent)] text-page border-[var(--color-accent)]'
: 'bg-transparent border-[var(--color-edge)] text-[var(--color-text)] hover:bg-[var(--color-surface-hover)]'
}`}
onClick={() => {
@@ -198,13 +199,13 @@ const CustomCursorTest = () => {
<For each={cursorTypes}>
{({ name, cursor, tw }) => (
<div
- class="border border-[var(--color-edge)] p-4 rounded hover:bg-[var(--color-surface-hover)] transition-colors"
+ class="flex items-center justify-center border border-[var(--color-edge)] p-2 rounded hover:bg-[var(--color-surface-hover)] transition-colors"
classList={{ [`${tw}`]: !!tw && useClass() }}
style={{
- cursor: useStyle() ? cursor : undefined,
+ cursor: useStyle() ? `var(--cursor-${cursor})` : undefined,
}}
>
- {name}
+ <div class="py-2">{name}</div>
</div>
)}
</For>
@@ -254,22 +255,25 @@ const CustomCursorTest = () => {
with the same name, and have bi-directional communication between all
of them.
</p>
- <p>
+ <div>
+ <div />
The API doesn't associate any semantics to messages,
- <button class="text-accent p-2 border-accent border">
- clicky button
- </button>
- bar
- <button class="text-accent p-2 border-accent border">
- <span>clicky button 2</span>
- </button>
- foo
- <button class="text-accent p-2 border-accent border cursor-pointer">
- <span>clicky button 3</span>
- </button>
- so it is up to the code to know what kind of messages to expect and
- what to do with them.
- </p>
+ <span>
+ <button class="text-accent p-2 border-accent border">
+ clicky button
+ </button>
+ bar
+ <button class="text-accent p-2 border-accent border">
+ <span>clicky button 2</span>
+ </button>
+ foo
+ <button class="text-accent p-2 border-accent border cursor-pointer">
+ <span>clicky button 3</span>
+ </button>
+ so it is up to the code to know what kind of messages to expect and
+ what to do with them.
+ </span>
+ </div>
</div>
<h2 class="pt-16 text-2xl font-bold">Shadow DOM Demo</h2>
diff --git a/js/app/packages/app/component/custom-cursor/README.md b/js/app/packages/app/component/custom-cursor/README.md
index 7eda70872c..b5ef89798d 100644
--- a/js/app/packages/app/component/custom-cursor/README.md
+++ b/js/app/packages/app/component/custom-cursor/README.md
@@ -1,16 +1,20 @@
# Custom Cursor
-## Adding Cursor styling
+## ATTENTION use Tailind cursor-\* variant or css variable --cursor-\*
-If you adding cursor styling, as long as you use tailwind cursor variant, such as `cursor-pointer`, or inline style, the custom cursor logic will automatically determine cursor property.
+Using default tailwind cursor variant, such as `cursor-pointer`, works because it is overriden by the vite plugin that replaces value to use custom cursor css variable.
-But if you're adding an arbritrary class with cursor property, make sure to add custom cursor variable inside that declaration.
+Otherwise use custom cursor variable `--cursor-<value-of-cursor>`, instead of default value.
```css
.pointer-on-img {
- /* keep native as fallback when custom cursor is disabled */
- cursor: pointer;
- /* add custom cursor variable */
- --custom-cursor: pointer;
+ cursor: pointer /* <--- DONT DO THIS otherwise it will show default cursor instead of custom */
+
+ /* replace with custom cursor variable, variable uses native value as fallback */
+ cursor: var(--cursor-pointer);
}
```
+
+```html
+<div style="cursor: var(--cursor-not-allowed)"></div>
+```
diff --git a/js/app/packages/app/component/custom-cursor/custom-cursor.css b/js/app/packages/app/component/custom-cursor/custom-cursor.css
index a38ea26bdb..fa38885ec7 100644
--- a/js/app/packages/app/component/custom-cursor/custom-cursor.css
+++ b/js/app/packages/app/component/custom-cursor/custom-cursor.css
@@ -1,27 +1,71 @@
-/* This sheet is injected into style element appended into document.head and shadowRoots */
+/* This sheet is imported into base layer in index.css and during runtime injected into shadowRoot style element */
+
+:root {
+ /* custom cursor fallback */
+ --cursor-auto: auto;
+ --cursor-default: default;
+ --cursor-none: none;
+ --cursor-context-menu: context-menu;
+ --cursor-help: help;
+ --cursor-pointer: pointer;
+ --cursor-progress: progress;
+ --cursor-wait: wait;
+ --cursor-cell: cell;
+ --cursor-crosshair: crosshair;
+ --cursor-text: text;
+ --cursor-vertical-text: vertical-text;
+ --cursor-alias: alias;
+ --cursor-copy: copy;
+ --cursor-move: move;
+ --cursor-no-drop: no-drop;
+ --cursor-not-allowed: not-allowed;
+ --cursor-grab: grab;
+ --cursor-grabbing: grabbing;
+ --cursor-all-scroll: all-scroll;
+ --cursor-col-resize: col-resize;
+ --cursor-row-resize: row-resize;
+ --cursor-n-resize: n-resize;
+ --cursor-s-resize: s-resize;
+ --cursor-e-resize: e-resize;
+ --cursor-w-resize: w-resize;
+ --cursor-ne-resize: ne-resize;
+ --cursor-nw-resize: nw-resize;
+ --cursor-se-resize: se-resize;
+ --cursor-sw-resize: sw-resize;
+ --cursor-ew-resize: ew-resize;
+ --cursor-ns-resize: ns-resize;
+ --cursor-nesw-resize: nesw-resize;
+ --cursor-nwse-resize: nwse-resize;
+ --cursor-zoom-in: zoom-in;
+ --cursor-zoom-out: zoom-out;
+}
a[href] {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
+}
+button,
+[role="button"] {
+ cursor: var(--cursor-default);
}
summary {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
} /* collapsible <details> */
label {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
} /* when linked to a control */
input[type="button"],
input[type="submit"],
input[type="reset"] {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
}
select {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
}
option {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
} /* some browsers */
optgroup {
- --custom-cursor: pointer;
+ cursor: var(--cursor-pointer);
}
input[type=text],
@@ -34,121 +78,12 @@ input[type=url],
input[type=number], /* on the text area, not the spin box */
textarea,
[contenteditable] {
- --custom-cursor: text;
+ cursor: var(--cursor-text);
}
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
- --custom-cursor: not-allowed;
-}
-
-.cursor-auto {
- --custom-cursor: auto;
-}
-.cursor-default {
- --custom-cursor: default;
-}
-.cursor-pointer {
- --custom-cursor: pointer;
-}
-.cursor-wait {
- --custom-cursor: wait;
-}
-.cursor-text {
- --custom-cursor: text;
-}
-.cursor-move {
- --custom-cursor: move;
-}
-.cursor-help {
- --custom-cursor: help;
-}
-.cursor-not-allowed {
- --custom-cursor: not-allowed;
-}
-.cursor-none {
- --custom-cursor: none;
-}
-.cursor-grab {
- --custom-cursor: grab;
-}
-.cursor-grabbing {
- --custom-cursor: grabbing;
-}
-.cursor-zoom-in {
- --custom-cursor: zoom-in;
-}
-.cursor-zoom-out {
- --custom-cursor: zoom-out;
-}
-.cursor-progress {
- --custom-cursor: progress;
-}
-.cursor-alias {
- --custom-cursor: alias;
-}
-.cursor-context-menu {
- --custom-cursor: context-menu;
-}
-.cursor-cell {
- --custom-cursor: cell;
-}
-.cursor-crosshair {
- --custom-cursor: crosshair;
-}
-.cursor-copy {
- --custom-cursor: copy;
-}
-.cursor-no-drop {
- --custom-cursor: no-drop;
-}
-.cursor-all-scroll {
- --custom-cursor: all-scroll;
-}
-.cursor-vertical-text {
- --custom-cursor: vertical-text;
-}
-.cursor-col-resize {
- --custom-cursor: col-resize;
-}
-.cursor-row-resize {
- --custom-cursor: row-resize;
-}
-.cursor-ew-resize {
- --custom-cursor: ew-resize;
-}
-.cursor-nesw-resize {
- --custom-cursor: nesw-resize;
-}
-.cursor-ns-resize {
- --custom-cursor: ns-resize;
-}
-.cursor-nwse-resize {
- --custom-cursor: nwse-resize;
-}
-.cursor-e-resize {
- --custom-cursor: e-resize;
-}
-.cursor-n-resize {
- --custom-cursor: n-resize;
-}
-.cursor-ne-resize {
- --custom-cursor: ne-resize;
-}
-.cursor-nw-resize {
- --custom-cursor: nw-resize;
-}
-.cursor-s-resize {
- --custom-cursor: s-resize;
-}
-.cursor-se-resize {
- --custom-cursor: se-resize;
-}
-.cursor-sw-resize {
- --custom-cursor: sw-resize;
-}
-.cursor-w-resize {
- --custom-cursor: w-resize;
+ cursor: var(--cursor-not-allowed);
}
diff --git a/js/app/packages/app/component/custom-cursor/custom-cursor.ts b/js/app/packages/app/component/custom-cursor/custom-cursor.ts
index ad2bcdf199..f171a7152b 100644
--- a/js/app/packages/app/component/custom-cursor/custom-cursor.ts
+++ b/js/app/packages/app/component/custom-cursor/custom-cursor.ts
@@ -1,5 +1,9 @@
-import { ENABLE_CUSTOM_CURSOR } from '@core/constant/featureFlags';
+import {
+ ENABLE_CUSTOM_CURSOR,
+ ENABLE_CUSTOM_CURSOR_TEXT_GLYPH_DETECTION,
+} from '@core/constant/featureFlags';
import { isMobile } from '@solid-primitives/platform';
+import { throttle } from '@solid-primitives/scheduled';
import {
createEffect,
createRoot,
@@ -173,7 +177,7 @@ const cursorSvgMap: Record<
> = {
// general cursors
auto: { svg: defaultSvgRaw, fallback: 'auto', position: '11 9' },
- default: { svg: defaultSvgRaw, fallback: 'auto', position: '11 9' }, // Will be set dynamically
+ default: { svg: defaultSvgRaw, fallback: 'default', position: '11 9' }, // Will be set dynamically
none: { svg: '', fallback: 'none', position: '11 9' },
// link and status cursors
'context-menu': {
@@ -315,24 +319,38 @@ const allCustomCursorClasses = Object.keys(cursorSvgMap).map((key) =>
getCursorClassFromKey(key)
);
-function generateCustomCursorStyleTextContent() {
- let styleTextContent = customCursorCSSFileRaw;
- styleTextContent += `${'*'} { cursor: ${getCursor('default')} !important; }`;
+function generateCustomCursorStyleTextContent(isRoot?: boolean) {
+ let styleTextContent = !isRoot ? customCursorCSSFileRaw : '';
+ styleTextContent += `html { cursor: ${getCursor('auto')} }`;
+ styleTextContent += `:root { `;
+ styleTextContent += Object.keys(cursorSvgMap)
+ .map((key) => {
+ return `
+ --cursor-${key}: ${getCursor(key)};
+ `;
+ })
+ .join('');
+ styleTextContent += ` }`;
styleTextContent += Object.keys(cursorSvgMap)
.map((key) => {
return `
.${getCursorClassFromKey(key)} {
- cursor: ${getCursor(key)} !important;
- --custom-cursor: ${key};
+ cursor: ${getCursor(key)};
}`;
})
.join('');
return styleTextContent;
}
-function createCustomCursorStylesheetEl(element: HTMLElement | ShadowRoot) {
+function createCustomCursorStylesheetEl(
+ element: HTMLElement | ShadowRoot,
+ isRoot?: boolean
+) {
const styleEl = document.createElement('style');
+ if (isRoot) {
+ rootStyleSheet = styleEl;
+ }
styleElements.add(styleEl);
- styleEl.textContent = generateCustomCursorStyleTextContent();
+ styleEl.textContent = generateCustomCursorStyleTextContent(isRoot);
element.appendChild(styleEl);
}
@@ -342,7 +360,8 @@ function updateAllCustomCursorStylesheetEls() {
styleElements.delete(styleEl);
return;
}
- styleEl.textContent = generateCustomCursorStyleTextContent();
+ const isRoot = styleEl === rootStyleSheet;
+ styleEl.textContent = generateCustomCursorStyleTextContent(isRoot);
});
}
@@ -387,82 +406,93 @@ function updateCustomCursor() {
cursorMap.default = defaultCursor;
}
+const textNodeMap = new WeakMap<Element, (e: MouseEvent) => void>();
+
+let rootStyleSheet!: HTMLStyleElement;
// Initialize cursor
function initCursor() {
if (!ENABLE_CUSTOM_CURSOR) return;
if (isMobile) return;
updateCustomCursor();
- createCustomCursorStylesheetEl(document.head);
- // Add mousemove listener to handle cursor states and text glyph detection
- const onMouseMove = (e: MouseEvent) => {
- if (!customCursorEnabled()) {
- clearAllCustomCursorStylesheetEls();
- return;
- }
+ const isRoot = true;
+ createCustomCursorStylesheetEl(document.head, isRoot);
+ const holdsDirectTextNode = (target: HTMLElement) => {
+ const childNodes = target.childNodes;
- const target = e.target as Element;
+ for (let i = 0; i < childNodes.length; i++) {
+ const node = childNodes[i];
- if (target.shadowRoot) {
- createCustomCursorStylesheetEl(target.shadowRoot);
-
- [...target.shadowRoot.children].forEach((child) => {
- child.addEventListener('mousemove', onMouseMove);
- });
- return;
+ if (node.nodeValue && node.nodeName === '#text') return true;
}
- target.classList.remove(...allCustomCursorClasses);
-
- const getCursorValueFromTargetEl = (target: Element) => {
- const run = () => {
- if (target instanceof HTMLElement && target.style.cursor) {
- return target.style.cursor;
- }
- const targetComputedStyle = getComputedStyle(target);
- const customCursorCSSVariableValue =
- targetComputedStyle.getPropertyValue('--custom-cursor');
- if (customCursorCSSVariableValue) {
- return customCursorCSSVariableValue;
- }
+ return false;
+ };
- return targetComputedStyle.cursor;
- };
- return run().replace('!important', '');
- };
+ const ifTextNodeThenAddMouseMoveToTarget = (target: HTMLElement) => {
+ if (!holdsDirectTextNode(target)) return;
- const computedCursor = getCursorValueFromTargetEl(target);
- const computedUserSelect = getComputedStyle(target).userSelect;
- // target.classList.add(getCursorClassFromKey(currentCursorType!));
+ const onMouseMove =
+ textNodeMap.get(target) ||
+ ((e: MouseEvent) => {
+ // left mouse held down, such as dragging column or scrollbar
+ if (e.buttons === 1) {
+ return;
+ }
- // Extract fallback cursor if computed cursor is a custom cursor string
- const baseCursor = extractFallbackCursor(computedCursor);
+ if (!customCursorEnabled()) {
+ return;
+ }
- let inferredCursorType: string | null = null;
+ const computedStyle = getComputedStyle(e.target as HTMLElement);
+ const currentTarget = e.currentTarget as HTMLElement;
+ const cursor = extractFallbackCursor(computedStyle.cursor);
- // Use inferred cursor type if available, otherwise use extracted fallback cursor
- let cs = inferredCursorType || baseCursor;
+ if (computedStyle.userSelect === 'none') {
+ currentTarget.removeEventListener('mousemove', onMouseMove);
+ return;
+ }
+ if (cursor !== 'auto' && cursor !== 'text') {
+ currentTarget.removeEventListener('mousemove', onMouseMove);
+ return;
+ }
- // Only use text glyph detection when cursor is 'auto' and not 'text'
- if (cs !== 'text') {
- if (cs === 'auto' && isOverTextGlyph(e.clientX, e.clientY)) {
- if (computedUserSelect === 'none') {
- cs = 'default';
+ if (isOverTextGlyph(e.clientX, e.clientY)) {
+ currentTarget.classList.add(getCursorClassFromKey('text'));
} else {
- cs = 'text';
- }
- if (target.tagName === 'BUTTON' || target.closest('button')) {
- cs = 'default';
+ target.classList.remove(getCursorClassFromKey('text'));
}
- }
+ });
+ textNodeMap.set(target, onMouseMove);
+ target.addEventListener('mousemove', onMouseMove, { passive: true });
+ };
+
+ // Add mouseover listener to handle text glyph detection
+ // The mouseover event should be computationally cheap, just checks if node has as text nodes
+ // If it does then that node adds mousemove event that determines the boundary box of the text glyph, that could be expensive
+ const onMouseOver = (e: MouseEvent) => {
+ if (!customCursorEnabled()) {
+ return;
}
- currentCursorType = cs;
- target.classList.add(getCursorClassFromKey(currentCursorType));
+ const target = e.target as HTMLElement;
+
+ if (target.shadowRoot) {
+ createCustomCursorStylesheetEl(target.shadowRoot);
+
+ [...target.shadowRoot.children].forEach((child) => {
+ ifTextNodeThenAddMouseMoveToTarget(child as HTMLElement);
+ child.addEventListener('mouseover', onMouseOver, { passive: true });
+ });
+ return;
+ }
+ ifTextNodeThenAddMouseMoveToTarget(target);
};
- document.addEventListener('mousemove', onMouseMove);
+ if (ENABLE_CUSTOM_CURSOR_TEXT_GLYPH_DETECTION) {
+ document.addEventListener('mouseover', onMouseOver, { passive: true });
+ }
}
if (document.readyState === 'loading') {
@@ -474,6 +504,8 @@ if (document.readyState === 'loading') {
createRoot(() => {
if (!ENABLE_CUSTOM_CURSOR) return;
+ const throttledUpdateCursor = throttle(updateCursor, 250);
+
createEffect(() => {
const { l, c, h } = themeReactive.a0;
const _col = `oklch(${l[0]()} ${c[0]()} ${h[0]()}deg)`;
@@ -481,6 +513,6 @@ createRoot(() => {
clearAllCustomCursorStylesheetEls();
return;
}
- updateCursor();
+ throttledUpdateCursor();
});
});
diff --git a/js/app/packages/app/component/custom-cursor/vite-plugin-cursor-override.ts b/js/app/packages/app/component/custom-cursor/vite-plugin-cursor-override.ts
new file mode 100644
index 0000000000..4eb6c99fbd
--- /dev/null
+++ b/js/app/packages/app/component/custom-cursor/vite-plugin-cursor-override.ts
@@ -0,0 +1,133 @@
+import type { Plugin } from 'vite';
+
+/**
+ * Vite plugin that transforms cursor declarations to use CSS variables
+ *
+ * Transforms: cursor: grab; → cursor: var(--cursor-grab, grab);
+ *
+ * Runs after lightningcss processes CSS, so it works with lightningcss transformer
+ */
+
+// List of all standard cursor values that should be transformed
+const cursorValues = new Set([
+ 'auto',
+ 'default',
+ 'none',
+ 'context-menu',
+ 'help',
+ 'pointer',
+ 'progress',
+ 'wait',
+ 'cell',
+ 'crosshair',
+ 'text',
+ 'vertical-text',
+ 'alias',
+ 'copy',
+ 'move',
+ 'no-drop',
+ 'not-allowed',
+ 'grab',
+ 'grabbing',
+ 'all-scroll',
+ 'col-resize',
+ 'row-resize',
+ 'n-resize',
+ 's-resize',
+ 'e-resize',
+ 'w-resize',
+ 'ne-resize',
+ 'nw-resize',
+ 'se-resize',
+ 'sw-resize',
+ 'ew-resize',
+ 'ns-resize',
+ 'nesw-resize',
+ 'nwse-resize',
+ 'zoom-in',
+ 'zoom-out',
+]);
+
+/**
+ * Transform a cursor value to use CSS variable if it's a standard cursor value
+ */
+function transformCursorValue(value: string): string {
+ // Skip if already using CSS variables
+ if (value.includes('var(')) {
+ return value;
+ }
+
+ // Skip complex values like url(...) or other function calls
+ if (value.includes('(') && !value.startsWith('var(')) {
+ return value;
+ }
+
+ // Handle multiple cursor values (fallback chain)
+ const values = value
+ .split(',')
+ .map((v) => v.trim())
+ .filter(Boolean);
+ const transformedValues = values.map((v) => {
+ if (cursorValues.has(v)) {
+ const varName = `--cursor-${v}`;
+ return `var(${varName})`;
+ }
+ return v;
+ });
+
+ if (transformedValues.some((tv, i) => tv !== values[i])) {
+ return transformedValues.join(', ');
+ }
+
+ return value;
+}
+
+/**
+ * Transform cursor declarations in CSS content
+ */
+function transformCssContent(css: string): string {
+ // Match cursor declarations with !important support
+ // This regex matches: cursor: <value> [ !important];
+ const cursorRegex = /cursor\s*:\s*([^;!]+?)(\s+!important)?\s*;/gi;
+
+ return css.replace(cursorRegex, (match, value, important = '') => {
+ const transformedValue = transformCursorValue(value.trim());
+ return `cursor: ${transformedValue}${important};`;
+ });
+}
+
+export function vitePluginCursorOverride(): Plugin {
+ return {
+ name: 'vite-plugin-cursor-override',
+ enforce: 'post', // Run after lightningcss processes CSS
+
+ // Transform CSS after lightningcss is done
+ transform(code, id) {
+ // Only process CSS files
+ if (!id.match(/\.(css|scss|sass|less|styl)$/)) {
+ return null;
+ }
+
+ // Debug: log when we process a CSS file
+ if (process.env.DEBUG_CURSOR_PLUGIN) {
+ console.log(`[cursor-override] Transforming CSS file: ${id}`);
+ }
+
+ // Transform cursor declarations
+ const transformed = transformCssContent(code);
+
+ // Only return if something changed
+ if (transformed !== code) {
+ if (process.env.DEBUG_CURSOR_PLUGIN) {
+ console.log(`[cursor-override] Transformed cursor values in: ${id}`);
+ }
+ return {
+ code: transformed,
+ map: null,
+ };
+ }
+
+ return null;
+ },
+ };
+}
diff --git a/js/app/packages/app/component/dock/Debug.tsx b/js/app/packages/app/component/dock/Debug.tsx
index 25d86e99f9..25e4ddf39a 100644
--- a/js/app/packages/app/component/dock/Debug.tsx
+++ b/js/app/packages/app/component/dock/Debug.tsx
@@ -20,7 +20,7 @@ export function Debug() {
transition: 'all 500ms',
'font-size': '0.75rem',
'line-height': '1rem',
- cursor: 'pointer',
+ cursor: 'var(--cursor-pointer)',
right: '-0.5rem',
bottom: '100%',
top: '300px',
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsx
index 4ff09de185..dc2f815ca3 100644
--- a/js/app/packages/app/component/settings/Appearance.tsx
+++ b/js/app/packages/app/component/settings/Appearance.tsx
@@ -9,10 +9,6 @@ import { ThemeEditorAdvanced } from '../../../block-theme/components/ThemeEditor
import { ThemeEditorBasic } from '../../../block-theme/components/ThemeEditorBasic';
import ThemeList from '../../../block-theme/components/ThemeList';
import ThemeTools from '../../../block-theme/components/ThemeTools';
-// import {
-// getCustomCursorEnabled,
-// setCustomCursorEnabled,
-// } from '../../util/cursor';
import {
getSoundEffectsEnabled,
getSoundEffectsVolume,
@@ -159,7 +155,7 @@ export function Appearance() {
position: 'absolute',
background: 'transparent',
appearance: 'none',
- cursor: 'pointer',
+ cursor: 'var(--cursor-pointer)',
outline: 'none',
height: '100%',
margin: 0,
@@ -182,7 +178,7 @@ export function Appearance() {
background-color: var(--b0);
border: 1px solid var(--b4);
border-radius: 0px;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
.sound-volume-slider::-moz-range-thumb {
width: 18px;
@@ -190,7 +186,7 @@ export function Appearance() {
background-color: var(--b0);
border: 1px solid var(--b4);
border-radius: 0px;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
.sound-volume-slider::-webkit-slider-runnable-track {
width: 100%;
diff --git a/js/app/packages/app/component/settings/Organization/InactiveTable/InactiveTable.tsx b/js/app/packages/app/component/settings/Organization/InactiveTable/InactiveTable.tsx
index 24fb24bf6e..767d90c169 100644
--- a/js/app/packages/app/component/settings/Organization/InactiveTable/InactiveTable.tsx
+++ b/js/app/packages/app/component/settings/Organization/InactiveTable/InactiveTable.tsx
@@ -86,7 +86,7 @@ const InactiveTable = () => {
class="ml-2 px-4 font-semibold text-xs text-md text-accent-ink ring-1 ring-accent/50 bg-accent/10 hover:bg-accent/20 rounded-md transition-none hover:transition ease-in-out"
style={{
opacity: !email() || loading() ? '50%' : '100%',
- cursor: !email() || loading() ? 'not-allowed' : 'pointer',
+ cursor: !email() || loading() ? 'var(--cursor-not-allowed)' : 'var(--cursor-pointer)',
}}
disabled={!email() || loading()}
>
diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.css
index cf2afd8cc8..f756b91a2c 100644
--- a/js/app/packages/app/index.css
+++ b/js/app/packages/app/index.css
@@ -4,6 +4,12 @@
@source '../../packages/core/component/LexicalMarkdown/theme.ts';
@config '../../tailwind.config.ts';
+/* custom cursor */
+/* must be imported inside base layer to prevent tag element default properties overriding TW cursor utility */
+@layer base {
+ @import "./component/custom-cursor/custom-cursor.css";
+}
+
@property --a0l { syntax: "<number>"; inherits: false; initial-value: 0.88; }
@property --a0c { syntax: "<number>"; inherits: false; initial-value: 0.20; }
@property --a0h { syntax: "<angle>"; inherits: false; initial-value: 145deg; }
diff --git a/js/app/packages/app/vite.config.ts b/js/app/packages/app/vite.config.ts
index 4efe8a2f0f..6029b2610b 100644
--- a/js/app/packages/app/vite.config.ts
+++ b/js/app/packages/app/vite.config.ts
@@ -9,6 +9,7 @@ import solid from 'vite-plugin-solid';
import solidSvg from 'vite-plugin-solid-svg';
import wasm from 'vite-plugin-wasm';
import tsconfigpaths from 'vite-tsconfig-paths';
+import { vitePluginCursorOverride } from './component/custom-cursor/vite-plugin-cursor-override';
// @ts-ignore
import { version } from './package.json';
@@ -30,6 +31,7 @@ export default defineConfig(({ command, mode }) => {
},
plugins: [
// solidDevtools({ autoname: true }),
+ vitePluginCursorOverride(), // Transform cursor values before lightningcss
solid(),
wasm(),
tailwind(),
diff --git a/js/app/packages/block-canvas/component/SelectionRenderer.tsx b/js/app/packages/block-canvas/component/SelectionRenderer.tsx
index 0f93b188c0..63defddc8b 100644
--- a/js/app/packages/block-canvas/component/SelectionRenderer.tsx
+++ b/js/app/packages/block-canvas/component/SelectionRenderer.tsx
@@ -49,13 +49,13 @@ function cornerToCursor(corner: Corner) {
if (activeTool() === Tools.Grab) return 'grab';
switch (corner) {
case Corners.TopLeft:
- return 'nwse-resize';
+ return 'var(--cursor-nwse-resize)';
case Corners.TopRight:
- return 'nesw-resize';
+ return 'var(--cursor-nesw-resize)';
case Corners.BottomRight:
- return 'nwse-resize';
+ return 'var(--cursor-nwse-resize)';
case Corners.BottomLeft:
- return 'nesw-resize';
+ return 'var(--cursor-nesw-resize)';
}
}
@@ -139,13 +139,13 @@ export function edgeToCursor(edge: Edge) {
switch (edge) {
case Edges.Top:
- return 'ns-resize';
+ return 'var(--cursor-ns-resize)';
case Edges.Right:
- return 'ew-resize';
+ return 'var(--cursor-ew-resize)';
case Edges.Bottom:
- return 'ns-resize';
+ return 'var(--cursor-ns-resize)';
case Edges.Left:
- return 'ew-resize';
+ return 'var(--cursor-ew-resize)';
}
}
diff --git a/js/app/packages/block-email/component/EmailMessageBody.tsx b/js/app/packages/block-email/component/EmailMessageBody.tsx
index 466b9544d6..6eb5b4bbe5 100644
--- a/js/app/packages/block-email/component/EmailMessageBody.tsx
+++ b/js/app/packages/block-email/component/EmailMessageBody.tsx
@@ -101,7 +101,7 @@ export function EmailMessageBody(props: EmailMessageBodyProps) {
const messageDiv = document.createElement('div');
messageDiv.innerHTML = parsedHTML().mainContent;
messageDiv.style.userSelect = 'text';
- messageDiv.style.cursor = 'auto';
+ messageDiv.style.cursor = 'var(--cursor-auto)';
messageDiv.style.overflow = 'auto';
shadow.appendChild(messageDiv);
return hostContainer;
diff --git a/js/app/packages/block-pdf/PdfViewer/InternalPDFViewer.ts b/js/app/packages/block-pdf/PdfViewer/InternalPDFViewer.ts
index 00eddc897b..25a2635b6f 100644
--- a/js/app/packages/block-pdf/PdfViewer/InternalPDFViewer.ts
+++ b/js/app/packages/block-pdf/PdfViewer/InternalPDFViewer.ts
@@ -1460,7 +1460,7 @@ export class InternalPDFViewer {
overlayElement.style.width = `${rect.width * 1.05}%`;
overlayElement.style.height = `${rect.height * 1.1}%`;
overlayElement.style.mixBlendMode = 'lighten';
- overlayElement.style.cursor = 'pointer';
+ overlayElement.style.cursor = 'var(--cursor-pointer)';
overlayElement.style.transition = 'all 0.3s ease-in-out';
overlayElement.style.pointerEvents = 'auto';
overlayElement.addEventListener('mouseenter', () => {
diff --git a/js/app/packages/block-pdf/PdfViewer/overlay.css b/js/app/packages/block-pdf/PdfViewer/overlay.css
index dfd2275022..a839da79b9 100644
--- a/js/app/packages/block-pdf/PdfViewer/overlay.css
+++ b/js/app/packages/block-pdf/PdfViewer/overlay.css
@@ -6,7 +6,7 @@
position: absolute;
opacity: 1;
pointer-events: all;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
.overouter .overlay div.section,
@@ -14,7 +14,7 @@
/* opacity is used so that the intersection observer can pick it up */
opacity: 0;
pointer-events: none;
- cursor: auto;
+ cursor: var(--cursor-auto);
}
.noShowParse .overouter .overlay div div {
@@ -30,7 +30,7 @@
.overouter {
position: absolute;
pointer-events: none;
- cursor: auto;
+ cursor: var(--cursor-auto);
top: 0;
left: 0;
width: 100%;
diff --git a/js/app/packages/block-pdf/PdfViewer/pdf_viewer.css b/js/app/packages/block-pdf/PdfViewer/pdf_viewer.css
index 24c7740428..134b26d269 100644
--- a/js/app/packages/block-pdf/PdfViewer/pdf_viewer.css
+++ b/js/app/packages/block-pdf/PdfViewer/pdf_viewer.css
@@ -59,7 +59,7 @@
}
.pageOverlayInner *:not(.pointer-events-none),
-.pageOverLayInner *:not(.pdf-pointer-event-reset *){
+.pageOverLayInner *:not(.pdf-pointer-event-reset *) {
pointer-events: all;
}
@@ -122,7 +122,7 @@
}
.pdfPopupInner div.openInNewTab svg {
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
:root {
@@ -298,7 +298,7 @@
.pdfViewer.enablePermissions .textLayer span {
user-select: none !important;
- cursor: not-allowed;
+ cursor: var(--cursor-not-allowed);
}
.pdfPresentationMode .pdfViewer {
diff --git a/js/app/packages/block-pdf/component/DefinitionLookup/DefinitionsAccordion.tsx b/js/app/packages/block-pdf/component/DefinitionLookup/DefinitionsAccordion.tsx
index 3a746c2279..a2dffec3ba 100644
--- a/js/app/packages/block-pdf/component/DefinitionLookup/DefinitionsAccordion.tsx
+++ b/js/app/packages/block-pdf/component/DefinitionLookup/DefinitionsAccordion.tsx
@@ -48,7 +48,7 @@ const DefinitionText = styled.p<{ truncated: boolean }>`
font-family: Helvetica;
font-style: normal;
font-weight: normal;
- cursor: text;
+ cursor: var(--cursor-text);
user-select: text;
font-size: ${FONT_SIZE.toString()}px;
line-height: ${LINE_HEIGHT.toString()};
@@ -66,7 +66,7 @@ const HoverText = styled.span<{
class: string;
}>`
color: ${(props) => props.color};
- cursor: pointer;
+ cursor: var(--cursor-pointer);
`;
const SECTION_MAX_CHARS = 80;
diff --git a/js/app/packages/block-pdf/component/DefinitionLookup/OpenRefInNewTabIcon.tsx b/js/app/packages/block-pdf/component/DefinitionLookup/OpenRefInNewTabIcon.tsx
index fa21e01943..b16c122877 100644
--- a/js/app/packages/block-pdf/component/DefinitionLookup/OpenRefInNewTabIcon.tsx
+++ b/js/app/packages/block-pdf/component/DefinitionLookup/OpenRefInNewTabIcon.tsx
@@ -34,7 +34,7 @@ export function OpenRefInNewTabIcon(props: IProps) {
});
}}
style={{
- cursor: 'pointer',
+ cursor: 'var(--cursor-pointer)',
'margin-left': '5px',
width: '1.5em',
height: '1.5em',
diff --git a/js/app/packages/block-pdf/component/DefinitionLookup/index.tsx b/js/app/packages/block-pdf/component/DefinitionLookup/index.tsx
index fb76c08133..1915a11fde 100644
--- a/js/app/packages/block-pdf/component/DefinitionLookup/index.tsx
+++ b/js/app/packages/block-pdf/component/DefinitionLookup/index.tsx
@@ -41,7 +41,7 @@ import { parseDefinitionMetadata } from './shared';
const iconStyles: JSX.CSSProperties = {
'margin-right': '8px',
'margin-top': '8px',
- cursor: 'pointer',
+ cursor: 'var(--cursor-pointer)',
};
const DefinitionLabelWrapper = styled.div`
diff --git a/js/app/packages/block-theme/components/ComputeTokens.tsx b/js/app/packages/block-theme/components/ComputeTokens.tsx
index 5835724911..5b8f67a3df 100644
--- a/js/app/packages/block-theme/components/ComputeTokens.tsx
+++ b/js/app/packages/block-theme/components/ComputeTokens.tsx
@@ -89,7 +89,7 @@
// padding: 0px 20px;
// user-select: none;
// color: var(--b0);
-// cursor: copy;
+// cursor: var(--cursor-copy);
// left: 100%;
// top: 20px;
// }
diff --git a/js/app/packages/block-theme/components/ThemeEditorBasic.tsx b/js/app/packages/block-theme/components/ThemeEditorBasic.tsx
index 164e8464ab..448b87ca59 100644
--- a/js/app/packages/block-theme/components/ThemeEditorBasic.tsx
+++ b/js/app/packages/block-theme/components/ThemeEditorBasic.tsx
@@ -393,7 +393,7 @@ export function ThemeEditorBasic(){
position: absolute;
background: #0000;
appearance: none;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
outline: none;
height: 100%;
left: -9px;
@@ -483,7 +483,7 @@ export function ThemeEditorBasic(){
position: absolute;
background: #0000;
appearance: none;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
outline: none;
height: 100%;
left: -9px;
@@ -579,7 +579,7 @@ export function ThemeEditorBasic(){
position: absolute;
background: #0000;
appearance: none;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
outline: none;
height: 100%;
left: -9px;
diff --git a/js/app/packages/block-theme/components/ThemeList.tsx b/js/app/packages/block-theme/components/ThemeList.tsx
index 056f8865aa..4ea1080cae 100644
--- a/js/app/packages/block-theme/components/ThemeList.tsx
+++ b/js/app/packages/block-theme/components/ThemeList.tsx
@@ -80,7 +80,7 @@ export function ThemeList() {
background-color: var(--b0);
align-items: center;
padding: 10px 20px;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
display: grid;
gap: 20px;
"
diff --git a/js/app/packages/core/component/ImageGalleryPreview.tsx b/js/app/packages/core/component/ImageGalleryPreview.tsx
index fe0fd395cf..f06f2d2555 100644
--- a/js/app/packages/core/component/ImageGalleryPreview.tsx
+++ b/js/app/packages/core/component/ImageGalleryPreview.tsx
@@ -317,7 +317,7 @@ export const ImageGalleryPreview: Component<ImageGalleryPreviewProps> = (
maxScale: 5,
contain: 'outside',
startScale: 1,
- cursor: 'default',
+ cursor: 'var(--cursor-default)',
});
setPanzoomInstance(panzoom);
@@ -325,9 +325,9 @@ export const ImageGalleryPreview: Component<ImageGalleryPreviewProps> = (
const updateCursor = () => {
const scale = panzoom.getScale();
if (scale <= 1.01) {
- image.style.cursor = 'default';
+ image.style.cursor = 'var(--cursor-default)';
} else {
- image.style.cursor = 'grab';
+ image.style.cursor = 'var(--cursor-grab)';
}
};
diff --git a/js/app/packages/core/component/ImagePreview.tsx b/js/app/packages/core/component/ImagePreview.tsx
index 4cb08e0741..88ce61b4e4 100644
--- a/js/app/packages/core/component/ImagePreview.tsx
+++ b/js/app/packages/core/component/ImagePreview.tsx
@@ -234,15 +234,15 @@ export function ImagePreview(props: ImagePreviewProps) {
maxScale: 5,
contain: 'outside',
startScale: 1,
- cursor: 'default',
+ cursor: 'var(--cursor-default)',
});
const updateCursor = () => {
const scale = panzoom.getScale();
if (scale <= 1.01) {
- image.style.cursor = 'default';
+ image.style.cursor = 'var(--cursor-default)';
} else {
- image.style.cursor = 'grab';
+ image.style.cursor = 'var(--cursor-grab)';
}
};
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx b/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx
index 0ec17e0113..4502849b3a 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx
@@ -333,7 +333,7 @@ export function TableCellResizer() {
const styles: Record<string, JSX.CSSProperties> = {
bottom: {
'background-color': 'transparent',
- cursor: 'row-resize',
+ cursor: 'var(--cursor-row-resize)',
height: `${zoneWidth}px`,
left: `${cellRect.left}px`,
top: `${cellRect.top + cellRect.height - zoneWidth / 2}px`,
@@ -342,7 +342,7 @@ export function TableCellResizer() {
},
right: {
'background-color': 'transparent',
- cursor: 'col-resize',
+ cursor: 'var(--cursor-col-resize)',
height: `${cellRect.height}px`,
left: `${cellRect.left + cellRect.width - zoneWidth / 2}px`,
top: `${cellRect.top}px`,
diff --git a/js/app/packages/core/component/LexicalMarkdown/styles.css b/js/app/packages/core/component/LexicalMarkdown/styles.css
index e701ae92c6..bce06065ac 100644
--- a/js/app/packages/core/component/LexicalMarkdown/styles.css
+++ b/js/app/packages/core/component/LexicalMarkdown/styles.css
@@ -9,7 +9,7 @@
* There will always be a div in between the portal mount point and the actual
* mounted component. We want to let the components render transparently.
*/
-.__decorator-mount-ref>div:first-child {
+.__decorator-mount-ref > div:first-child {
display: contents;
}
@@ -40,7 +40,7 @@
padding-right: 0.15em;
}
-.md-list.md-number>li::marker {
+.md-list.md-number > li::marker {
font-variant-numeric: normal;
}
@@ -48,15 +48,15 @@
list-style: none;
}
-.md-list>li {
+.md-list > li {
position: relative;
}
-.md-list>li:empty {
+.md-list > li:empty {
min-height: 1.5em;
}
-.md-list.md-bullet>li::before {
+.md-list.md-bullet > li::before {
content: " ";
width: 0.4em;
height: 0.4em;
@@ -69,7 +69,7 @@
background-color: currentcolor;
}
-.md-list.md-check>li::before {
+.md-list.md-check > li::before {
content: " ";
width: 0.8em;
height: 0.8em;
@@ -80,20 +80,22 @@
outline: 2px solid currentcolor;
background-color: transparent;
border-radius: 0;
- transition: background-color 0.2s ease, outline 0.1s ease;
+ transition:
+ background-color 0.2s ease,
+ outline 0.1s ease;
}
-.md-list.md-check>li.checked::before {
+.md-list.md-check > li.checked::before {
background-color: var(--color-accent);
outline: 2px solid var(--color-accent);
}
-.md-list.md-check>li.checked.chat-blue::before {
+.md-list.md-check > li.checked.chat-blue::before {
background-color: var(--color-accent);
outline: 2px solid var(--color-accent);
}
-.md-list.md-check>li.checked::after {
+.md-list.md-check > li.checked::after {
border-bottom: 2px solid var(--color-panel);
border-left: 2px solid var(--color-panel);
content: " ";
@@ -103,10 +105,12 @@
left: -1.2em;
top: 0.45em;
transform: rotate(-45deg);
- transition: background-color 0.2s ease, outline 0.1s ease;
+ transition:
+ background-color 0.2s ease,
+ outline 0.1s ease;
}
-.md-list>li.nested::before {
+.md-list > li.nested::before {
content: none;
display: none;
}
@@ -117,11 +121,11 @@ ol.static-md {
list-style: none;
}
-ol.static-md>li {
+ol.static-md > li {
position: relative;
}
-ol.static-md>li:not(.list-none)::before {
+ol.static-md > li:not(.list-none)::before {
position: absolute;
left: -1.5rem;
text-align: right;
@@ -129,51 +133,51 @@ ol.static-md>li:not(.list-none)::before {
padding-right: 0.25rem;
}
-ol.static-md.depth-1>li:not(.list-none) {
+ol.static-md.depth-1 > li:not(.list-none) {
counter-increment: static-md-counter-1;
}
-ol.static-md.depth-1>li:not(.list-none)::before {
+ol.static-md.depth-1 > li:not(.list-none)::before {
content: counter(static-md-counter-1) ". ";
}
-ol.static-md.depth-2>li:not(.list-none) {
+ol.static-md.depth-2 > li:not(.list-none) {
counter-increment: static-md-counter-2;
}
-ol.static-md.depth-2>li:not(.list-none)::before {
+ol.static-md.depth-2 > li:not(.list-none)::before {
content: counter(static-md-counter-2) ". ";
}
-ol.static-md.depth-3>li:not(.list-none) {
+ol.static-md.depth-3 > li:not(.list-none) {
counter-increment: static-md-counter-3;
}
-ol.static-md.depth-3>li:not(.list-none)::before {
+ol.static-md.depth-3 > li:not(.list-none)::before {
content: counter(static-md-counter-3) ". ";
}
-ol.static-md.depth-4>li:not(.list-none) {
+ol.static-md.depth-4 > li:not(.list-none) {
counter-increment: static-md-counter-4;
}
-ol.static-md.depth-4>li:not(.list-none)::before {
+ol.static-md.depth-4 > li:not(.list-none)::before {
content: counter(static-md-counter-4) ". ";
}
-ol.static-md.depth-5>li:not(.list-none) {
+ol.static-md.depth-5 > li:not(.list-none) {
counter-increment: static-md-counter-5;
}
-ol.static-md.depth-5>li:not(.list-none)::before {
+ol.static-md.depth-5 > li:not(.list-none)::before {
content: counter(static-md-counter-5) ". ";
}
-ol.static-md.depth-6>li:not(.list-none) {
+ol.static-md.depth-6 > li:not(.list-none) {
counter-increment: static-md-counter-6;
}
-ol.static-md.depth-6>li:not(.list-none)::before {
+ol.static-md.depth-6 > li:not(.list-none)::before {
content: counter(static-md-counter-6) ". ";
}
@@ -196,7 +200,7 @@ ol.static-md.depth-6>li:not(.list-none)::before {
text-decoration-thickness: max(0.1em, 1px);
}
-.md-inline-mention>div {
+.md-inline-mention > div {
display: contents;
}
@@ -242,7 +246,7 @@ ol.static-md.depth-6>li:not(.list-none)::before {
height: 400px;
overflow: hidden;
- >* {
+ > * {
display: none;
}
}
@@ -291,14 +295,14 @@ ol.static-md.depth-6>li:not(.list-none)::before {
margin: 0;
}
-.md-table-frozen-row tr:nth-of-type(1)>td {
+.md-table-frozen-row tr:nth-of-type(1) > td {
overflow: clip;
position: sticky;
z-index: 2;
top: 44px;
}
-.md-table-frozen-row tr:nth-of-type(1)>th {
+.md-table-frozen-row tr:nth-of-type(1) > th {
overflow: clip;
background-color: #f2f3f5;
position: sticky;
@@ -306,8 +310,8 @@ ol.static-md.depth-6>li:not(.list-none)::before {
top: 44px;
}
-.md-table-frozen-row tr:nth-of-type(1)>th:after,
-.md-table-frozen-row tr:nth-of-type(1)>td:after {
+.md-table-frozen-row tr:nth-of-type(1) > th:after,
+.md-table-frozen-row tr:nth-of-type(1) > td:after {
content: "";
position: absolute;
left: 0;
@@ -315,19 +319,19 @@ ol.static-md.depth-6>li:not(.list-none)::before {
width: 100%;
}
-.md-table-frozen-column tr>td:first-child {
+.md-table-frozen-column tr > td:first-child {
position: sticky;
z-index: 2;
left: 0;
}
-.md-table-frozen-column tr>th:first-child {
+.md-table-frozen-column tr > th:first-child {
position: sticky;
z-index: 2;
left: 0;
}
-.md-table-frozen-column tr> :first-child::after {
+.md-table-frozen-column tr > :first-child::after {
content: "";
position: absolute;
left: 0;
@@ -363,7 +367,7 @@ ol.static-md.depth-6>li:not(.list-none)::before {
A firefox workaround to allow scrolling of overflowing table cell
ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
*/
-.md-table-cell>* {
+.md-table-cell > * {
overflow: inherit;
}
@@ -372,7 +376,7 @@ ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
right: -4px;
height: 100%;
width: 8px;
- cursor: ew-resize;
+ cursor: var(--cursor-ew-resize);
z-index: 10;
top: 0;
}
@@ -402,7 +406,7 @@ ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
height: 100%;
animation: table-controls 0.2s ease;
border: 0;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
.md-table-add-columns:after {
@@ -429,7 +433,7 @@ ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
width: calc(100% - 25px);
animation: table-controls 0.2s ease;
border: 0;
- cursor: pointer;
+ cursor: var(--cursor-pointer);
}
.md-table-add-columns:after {
@@ -482,7 +486,7 @@ ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
width: 20px;
height: 20px;
color: var(--color-ink-muted);
- cursor: pointer;
+ cursor: var(--cursor-pointer);
background-color: transparent;
}
@@ -491,7 +495,7 @@ ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
}
.md-editor-equation {
- cursor: pointer;
+ cursor: var(--cursor-pointer);
user-select: none;
}
@@ -499,7 +503,7 @@ ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
outline: 2px solid rgb(60, 132, 244);
}
-.md-quote+.md-quote {
+.md-quote + .md-quote {
margin-top: -1rem;
}
@@ -510,7 +514,7 @@ mark {
.md-mark {
/* add a subtle bg to "default" marks and save comment styling for semantic comments */
- background-color: oklch(from var(--color-ink-extra-muted) l c h /0.1);
+ background-color: oklch(from var(--color-ink-extra-muted) l c h / 0.1);
}
.md-mark.comment {
@@ -572,12 +576,12 @@ mark {
padding: 0 2rem 0 4rem;
background: rgb(from var(--color-failure-bg) r g b / 0.25);
- >* {
+ > * {
position: relative;
}
*::before {
- content: '-';
+ content: "-";
position: absolute;
left: -2rem;
}
@@ -588,12 +592,12 @@ mark {
background: rgb(from var(--color-success-bg) r g b / 0.25);
}
-.md-diff-insert>* {
+.md-diff-insert > * {
position: relative;
}
-.md-diff-insert>*::before {
- content: '+';
+.md-diff-insert > *::before {
+ content: "+";
position: absolute;
left: -2rem;
}
diff --git a/js/app/packages/core/component/Resize/Resize.tsx b/js/app/packages/core/component/Resize/Resize.tsx
index 18998e4b78..2e0b9d02a1 100644
--- a/js/app/packages/core/component/Resize/Resize.tsx
+++ b/js/app/packages/core/component/Resize/Resize.tsx
@@ -371,7 +371,10 @@ function Gutter(props: GutterProps) {
aria-label={`resize at ${props.index}`}
style={{
position: 'absolute',
- cursor: ctx.direction === 'horizontal' ? 'col-resize' : 'row-resize',
+ cursor:
+ ctx.direction === 'horizontal'
+ ? 'var(--cursor-col-resize)'
+ : 'var(--cursor-row-resize)',
...styles(),
}}
onPointerDown={onPointerDown}
diff --git a/js/app/packages/core/component/WebsocketDebugger.tsx b/js/app/packages/core/component/WebsocketDebugger.tsx
index fd642385bf..cc39ec8910 100644
--- a/js/app/packages/core/component/WebsocketDebugger.tsx
+++ b/js/app/packages/core/component/WebsocketDebugger.tsx
@@ -84,7 +84,9 @@ export function WebsocketDebugger() {
style={{
left: `${position().x}px`,
top: `${position().y}px`,
- cursor: isDragging() ? 'grabbing' : 'default',
+ cursor: isDragging()
+ ? 'var(--cursor-grabbing)'
+ : 'var(--cursor-default)',
}}
onMouseDown={handleMouseDown}
>
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index c2abd79908..7d7b47e584 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -124,8 +124,10 @@ export const ENABLE_PREVIEW = true;
export const ENABLE_DOCK_NOTITIFCATIONS = DEV_MODE_ENV;
export const ENABLE_TTFT = DEV_MODE_ENV;
-export const ENABLE_CUSTOM_CURSOR = false;
-
export const ENABLE_SOUND = false;
-
export const ENABLE_JACK_IN = false;
+
+// pure css based custom cursor
+export const ENABLE_CUSTOM_CURSOR = true;
+// uses javascript to detect selectable text to switch to "text" cursor type (ibeam)
+export const ENABLE_CUSTOM_CURSOR_TEXT_GLYPH_DETECTION = true;