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.

feat(app): corner and getter settings (#299)

Fake-Userc26ac670e1e7
diff --git a/js/app/packages/app/component/GlobalHotkeys.tsx b/js/app/packages/app/component/GlobalHotkeys.tsx
index 29f6581625..994ae79b94 100644
--- a/js/app/packages/app/component/GlobalHotkeys.tsx
+++ b/js/app/packages/app/component/GlobalHotkeys.tsx
@@ -10,13 +10,16 @@ import { AiInstructionsIcon } from '@service-storage/instructionsMd';
import { registerHotkey } from 'core/hotkey/hotkeys';
import { createMemo } from 'solid-js';
import {
+ beveledCorners,
monochromeIcons,
+ setBeveledCorners,
setDarkModeTheme,
setLightModeTheme,
setMonochromeIcons,
setThemeShouldMatchSystem,
themeShouldMatchSystem,
themes,
+ toggleGutterSize,
} from '../../block-theme/signals/themeSignals';
import { applyTheme } from '../../block-theme/utils/themeUtils';
@@ -302,5 +305,25 @@ export default function GlobalShortcuts() {
runWithInputFocused: true,
});
+ registerHotkey({
+ scopeId: 'global',
+ description: 'Toggle beveled corners',
+ keyDownHandler: () => {
+ setBeveledCorners(!beveledCorners());
+ return true;
+ },
+ runWithInputFocused: true,
+ });
+
+ registerHotkey({
+ scopeId: 'global',
+ description: 'Toggle gutter size',
+ keyDownHandler: () => {
+ toggleGutterSize();
+ return true;
+ },
+ runWithInputFocused: true,
+ });
+
return '';
}
diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsx
index 54cf07e04c..6d23eec2f0 100644
--- a/js/app/packages/app/component/Layout.tsx
+++ b/js/app/packages/app/component/Layout.tsx
@@ -130,7 +130,7 @@ export function Layout(props: RouteSectionProps) {
<Show when={paywallOpen()}>
<Paywall />
</Show>
- <div class="p-2 grow-1">
+ <div class="p-[var(--gutter-size)] grow-1">
<Resize.Zone
gutter={8}
direction="horizontal"
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 f171a7152b..18b7878f3d 100644
--- a/js/app/packages/app/component/custom-cursor/custom-cursor.ts
+++ b/js/app/packages/app/component/custom-cursor/custom-cursor.ts
@@ -52,7 +52,7 @@ import customCursorCSSFileRaw from './custom-cursor.css?raw';
let defaultCursor: string = '';
let hexColor: string = '';
let cursorCache: Record<string, string> = {};
-let currentCursorType: string | null = 'auto';
+let _currentCursorType: string | null = 'auto';
const styleElements = new Set<HTMLStyleElement>();
export const [customCursorEnabled, setCustomCursorEnabled] = createSignal(true);
@@ -315,7 +315,7 @@ const cursorClassPrefix = createUniqueId();
const getCursorClassFromKey = (key: string) => {
return `${cursorClassPrefix}-${key}`;
};
-const allCustomCursorClasses = Object.keys(cursorSvgMap).map((key) =>
+const _allCustomCursorClasses = Object.keys(cursorSvgMap).map((key) =>
getCursorClassFromKey(key)
);
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
index 4eb6c99fbd..153092af31 100644
--- 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
@@ -90,7 +90,7 @@ function transformCssContent(css: string): string {
// This regex matches: cursor: <value> [ !important];
const cursorRegex = /cursor\s*:\s*([^;!]+?)(\s+!important)?\s*;/gi;
- return css.replace(cursorRegex, (match, value, important = '') => {
+ return css.replace(cursorRegex, (_match, value, important = '') => {
const transformedValue = transformCursorValue(value.trim());
return `cursor: ${transformedValue}${important};`;
});
diff --git a/js/app/packages/app/component/dock/Dock.tsx b/js/app/packages/app/component/dock/Dock.tsx
index e09069eb7b..e490d48268 100644
--- a/js/app/packages/app/component/dock/Dock.tsx
+++ b/js/app/packages/app/component/dock/Dock.tsx
@@ -152,8 +152,8 @@ export function Dock() {
<div
style={{
- 'padding': '0 0.5rem 0.5rem 0.5rem',
- 'height': 'calc(40px + 0.5rem)',
+ 'padding': '0 var(--gutter-size) var(--gutter-size) var(--gutter-size)',
+ 'height': 'calc(40px + var(--gutter-size))',
'box-sizing': 'border-box',
'width': '100vw'
}}
diff --git a/js/app/packages/app/component/split-layout/SplitLayout.tsx b/js/app/packages/app/component/split-layout/SplitLayout.tsx
index 807348b0cf..e36969058d 100644
--- a/js/app/packages/app/component/split-layout/SplitLayout.tsx
+++ b/js/app/packages/app/component/split-layout/SplitLayout.tsx
@@ -18,6 +18,7 @@ import {
type Setter,
} from 'solid-js';
import { Dynamic } from 'solid-js/web';
+import { gutterSize } from '../../../block-theme/signals/themeSignals';
import {
createNavigationEntityListShortcut,
createSoupContext,
@@ -311,7 +312,7 @@ export function SplitLayoutContainer(props: SplitLayoutContainerProps) {
return (
<SplitLayoutContext.Provider value={{ manager: splitManager }}>
- <Resize.Zone direction="horizontal" gutter={8}>
+ <Resize.Zone direction="horizontal" gutter={gutterSize()}>
<For each={ids()}>
{(id, index) => (
<Resize.Panel id={id} minSize={400}>
diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.css
index f756b91a2c..60ca4952a0 100644
--- a/js/app/packages/app/index.css
+++ b/js/app/packages/app/index.css
@@ -100,6 +100,9 @@
--theme-pdf: oklch(from var(--a0) l c 25deg);
--theme-comment: oklch(from var(--a0) l c 90deg);
+ --gutter-size: 8px;
+ --transition: 0.2s;
+
/* Semantic Color names, use these when writing tailwind */
/* text */
diff --git a/js/app/packages/block-theme/constants.ts b/js/app/packages/block-theme/constants.ts
index 3ca08ea492..8a7f2b953b 100644
--- a/js/app/packages/block-theme/constants.ts
+++ b/js/app/packages/block-theme/constants.ts
@@ -1,7 +1,9 @@
import type { ThemeV1 } from './types/themeTypes';
-export const DEFAULT_DARK_THEME: DefaultTheme = 'Macro Dark';
export const DEFAULT_LIGHT_THEME: DefaultTheme = 'Macro Light';
+export const DEFAULT_DARK_THEME: DefaultTheme = 'Macro Dark';
+export const BEVELED_CORNERS: boolean = false;
+
export const DEFAULT_THEMES = [
{
diff --git a/js/app/packages/block-theme/signals/themeSignals.ts b/js/app/packages/block-theme/signals/themeSignals.ts
index fa72f807b1..75b3330ccb 100644
--- a/js/app/packages/block-theme/signals/themeSignals.ts
+++ b/js/app/packages/block-theme/signals/themeSignals.ts
@@ -1,12 +1,8 @@
-import { makePersisted } from '@solid-primitives/storage';
+import { DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_THEMES, BEVELED_CORNERS } from '../constants';
import { createEffect, createMemo, createSignal } from 'solid-js';
-import {
- DEFAULT_DARK_THEME,
- DEFAULT_LIGHT_THEME,
- DEFAULT_THEMES,
-} from '../constants';
import type { ThemeV0, ThemeV1 } from '../types/themeTypes';
import { convertThemev0v1 } from '../utils/themeMigrations';
+import { makePersisted } from '@solid-primitives/storage';
export const [isThemeSaved, setIsThemeSaved] = createSignal<boolean>(true);
@@ -78,6 +74,28 @@ export const [monochromeIcons, setMonochromeIcons] = makePersisted(
{name: 'enable-monochrome-icons'}
);
+export const [beveledCorners, setBeveledCorners] = makePersisted(
+ createSignal<boolean>(BEVELED_CORNERS),
+ {name: 'macro-beveled-corners'}
+);
+
+export const [gutterSize, setGutterSize] = makePersisted(
+ createSignal<number>(8),
+ {name: 'macro-gutter-size'}
+);
+createEffect(() => {
+ document.documentElement.style.setProperty('--gutter-size', `${gutterSize()}px`);
+});
+/*
+ this should be a slider in a theme block
+ for now its only reachable via GlobalHotkeys.tsx
+ so this will do
+*/
+export function toggleGutterSize(){
+ if(gutterSize() === 8){setGutterSize(5)}
+ else(setGutterSize(8));
+}
+
createEffect(() => {
if(monochromeIcons()){
document.documentElement.style.setProperty('--theme-contact', 'var(--c0)');
diff --git a/js/app/packages/core/component/ClippedPanel.tsx b/js/app/packages/core/component/ClippedPanel.tsx
index bec6878a1b..909ba008e0 100644
--- a/js/app/packages/core/component/ClippedPanel.tsx
+++ b/js/app/packages/core/component/ClippedPanel.tsx
@@ -1,5 +1,6 @@
import { cornerClip } from '@core/util/clipPath';
import type { JSXElement } from 'solid-js';
+import { beveledCorners } from '../../block-theme/signals/themeSignals';
interface PanelProps {
children?: JSXElement;
@@ -15,33 +16,45 @@ export function ClippedPanel(props: PanelProps) {
<div
style={{
'background-image': `linear-gradient(var(--color-accent), var(--color-edge-muted) ${props.active ? '80%' : '0%'})`,
- transition: 'background-image var(--transition)',
- 'box-sizing': 'border-box',
- 'clip-path': cornerClip(
- props.tl ? '0.5rem' : 0,
- props.tr ? '0.5rem' : 0,
- props.br ? '0.5rem' : 0,
- props.bl ? '0.5rem' : 0
- ),
- padding: '1px',
- height: '100%',
- width: '100%',
+ 'clip-path': !beveledCorners()
+ ? cornerClip(
+ props.tl ? '0.5rem' : 0,
+ props.tr ? '0.5rem' : 0,
+ props.br ? '0.5rem' : 0,
+ props.bl ? '0.5rem' : 0
+ )
+ : '',
+ 'border-radius': beveledCorners()
+ ? `
+ ${props.tl ? '16px' : '4px'}
+ ${props.tr ? '16px' : '4px'}
+ ${props.br ? '16px' : '4px'}
+ ${props.bl ? '16px' : '4px'}
+ `
+ : '0',
}}
+ class="p-px h-full w-full box-border"
>
<div
style={{
- 'background-color': 'var(--color-panel)',
- 'box-sizing': 'border-box',
- 'clip-path': cornerClip(
- props.tl ? 'calc(0.5rem - 0.5px)' : 0,
- props.tr ? 'calc(0.5rem - 0.5px)' : 0,
- props.br ? 'calc(0.5rem - 0.5px)' : 0,
- props.bl ? 'calc(0.5rem - 0.5px)' : 0
- ),
- overflow: 'hidden',
- height: '100%',
- width: '100%',
+ 'clip-path': !beveledCorners()
+ ? cornerClip(
+ props.tl ? 'calc(0.5rem - 0.5px)' : 0,
+ props.tr ? 'calc(0.5rem - 0.5px)' : 0,
+ props.br ? 'calc(0.5rem - 0.5px)' : 0,
+ props.bl ? 'calc(0.5rem - 0.5px)' : 0
+ )
+ : '',
+ 'border-radius': beveledCorners()
+ ? `
+ ${props.tl ? '15.5px' : '3.3px'}
+ ${props.tr ? '15.5px' : '3.3px'}
+ ${props.br ? '15.5px' : '3.3px'}
+ ${props.bl ? '15.5px' : '3.3px'}
+ `
+ : '0',
}}
+ class="h-full w-full box-border overflow-hidden bg-panel"
>
{props.children}
</div>
diff --git a/js/app/packages/core/component/Tooltip.tsx b/js/app/packages/core/component/Tooltip.tsx
index c69fea79ea..679a36cb3e 100644
--- a/js/app/packages/core/component/Tooltip.tsx
+++ b/js/app/packages/core/component/Tooltip.tsx
@@ -1,4 +1,5 @@
import type { HotkeyToken } from '@core/hotkey/tokens';
+import { cornerClip } from '@core/util/clipPath';
import CorvuTooltip, { type FloatingOptions } from '@corvu/tooltip';
import type { Placement } from '@floating-ui/dom';
import { type JSX, mergeProps, type ParentProps, Show } from 'solid-js';
@@ -78,7 +79,10 @@ export function Tooltip(props: TooltipProps) {
'max-width': `calc(100vw - ${2 * padding()}px)`,
}}
>
- <div class="flex items-center justify-center bg-ink p-1.5 text-panel rounded-sm text-xs wrap-break-word">
+ <div
+ class="flex items-center justify-center bg-ink p-1.5 text-panel text-xs wrap-break-word"
+ style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
+ >
{props.tooltip}
</div>
{/* Note disabling arrows for now. I think its more on-brand - seamus */}
@@ -113,7 +117,7 @@ export function LabelAndHotKey(props: LabelAndHotKeyProps) {
>
<div class="text-xs capitalize">{props.label}</div>
<Show when={props.hotkeyToken || props.shortcut}>
- <div class="text-[0.625rem] text-page ml-auto border border-edge-muted/30 px-1.5 py-0.25 rounded-xs">
+ <div class="text-[0.625rem] text-page ml-auto border border-edge-muted/30 px-1.5 py-0.25">
{props.hotkeyToken
? Hotkey({ token: props.hotkeyToken, class: 'flex gap-1' })
: Hotkey({ shortcut: props.shortcut, class: 'flex gap-1' })}
diff --git a/js/app/packages/macro-entity/src/queries/dss.ts b/js/app/packages/macro-entity/src/queries/dss.ts
index cd9809c1bc..9dd50fcb71 100644
--- a/js/app/packages/macro-entity/src/queries/dss.ts
+++ b/js/app/packages/macro-entity/src/queries/dss.ts
@@ -1,15 +1,15 @@
import { deleteItem } from '@core/component/FileList/itemOperations';
import { useItemOperations } from '@core/component/FileList/useItemOperations';
import type { ItemType } from '@service-storage/client';
-import {
+import type {
PostItemsSoupParams,
PostSoupRequest,
SoupApiSort,
} from '@service-storage/generated/schemas';
import {
hashKey,
- InfiniteData,
- UseQueryResult,
+ type InfiniteData,
+ type UseQueryResult,
useInfiniteQuery,
useMutation,
} from '@tanstack/solid-query';
@@ -19,7 +19,7 @@ import type { GetItemsSoupParams } from 'service-storage/generated/schemas/getIt
import type { SoupPage } from 'service-storage/generated/schemas/soupPage';
import { useInstructionsMdIdQuery } from 'service-storage/instructionsMd';
import { syncServiceClient } from 'service-sync/client';
-import { type Accessor } from 'solid-js';
+import type { Accessor } from 'solid-js';
import type {
ChatEntity,
DocumentEntity,
@@ -143,7 +143,7 @@ export function createDssInfiniteQueryPost(
const params = () => {
const argParams = _params?.();
let limit = 100;
- let sort_method = undefined;
+ let sort_method;
const requestBody = options?.requestBody;
if (requestBody) {