Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Russell/hex (#108)
Fake-Usercdce48752bff
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsxindex 4174ed47be..2ab1ecee24 100644--- a/js/app/packages/app/component/settings/Appearance.tsx+++ b/js/app/packages/app/component/settings/Appearance.tsx@@ -12,7 +12,7 @@ export function Appearance() {<TabContent title="Appearance"><divstyle={{- 'grid-template-rows': `min-content min-content ${isMobileWidth() ? '269px' : '205px'}`,+ 'grid-template-rows': `min-content min-content ${isMobileWidth() ? '205px' : '269px'}`,display: 'grid',gap: '8px',}}diff --git a/js/app/packages/block-theme/components/ColorSwatch.tsx b/js/app/packages/block-theme/components/ColorSwatch.tsxindex 2cec877027..4060437bea 100644--- a/js/app/packages/block-theme/components/ColorSwatch.tsx+++ b/js/app/packages/block-theme/components/ColorSwatch.tsx@@ -1,38 +1,20 @@export function ColorSwatch(props: { width: string; color: string }) {- // async function copyColor(){- // await navigator.clipboard.writeText(props.color);- // }-return (- <>- <style>{`- .swatch-border{- transition: border-color var(--transition);- border: 1px solid var(--b4);- padding: 3px;- /* cursor: copy; */- }- @media(hover){- .swatch-border:hover{- /* border: 1px solid var(--a0); */- transition: none;- }- }- `}</style>-+ <div+ class="theme-color-swatch"+ style="+ transition: border-color var(--transition);+ border: 1px solid var(--b4);+ padding: 3px;+ "+ ><div- // onPointerDown={copyColor}- class="swatch-border"- >- <div- class="advanced-theme-swatch"- style={{- 'background-color': props.color,- width: props.width,- height: '10px',- }}- />- </div>- </>+ style={{+ 'background-color': props.color,+ 'width': props.width,+ 'height': '10px',+ }}+ />+ </div>);}diff --git a/js/app/packages/block-theme/components/ThemeEditorAdvanced.tsx b/js/app/packages/block-theme/components/ThemeEditorAdvanced.tsxindex 71d55d6472..e01ed9e9de 100644--- a/js/app/packages/block-theme/components/ThemeEditorAdvanced.tsx+++ b/js/app/packages/block-theme/components/ThemeEditorAdvanced.tsx@@ -1,32 +1,58 @@-import { For } from 'solid-js';+import { createSignal, For, createEffect, type Setter, batch, untrack} from 'solid-js';+import { SegmentedControl } from '@core/component/FormControls/SegmentControls';+import type { ThemeReactiveColor } from '../types/themeTypes';+import { getOklch, validateColor } from '../utils/colorUtil';import { themeReactive } from '../signals/themeReactive';+import { convertOklchTo } from '../utils/colorUtil';import { ColorSwatch } from './ColorSwatch';-// function setInput(){-// get content colorValue-// check if value is a valid css color-// if not valid, console.log(`${color} not valid`) and early return-// convert color to oklch-// console.log(converted color);-// }+const formatArray = ['hex', 'rgb', 'hsl', 'oklch'];+const [ displayType, setDisplayType ] = createSignal(formatArray[0]);++function setColor(colorValue: ThemeReactiveColor, colorString: string, inputElement: HTMLInputElement, setIsSetByInput: Setter<boolean>) {+ if (!colorString || colorString.trim() === '' || colorString.length < 6 || !validateColor(colorString)) {+ inputElement.classList.add('invalid');+ return+ }+ try {+ let oklch = getOklch(colorString);+ batch(() => {+ setIsSetByInput(true);+ colorValue.l[1](oklch.l ? oklch.l : 0);+ colorValue.c[1](oklch.c ? oklch.c : 0);+ colorValue.h[1](oklch.h ? oklch.h : 0);+ });+ inputElement.classList.remove('invalid');+ }+ catch(error){+ console.error(`Error processing color "${colorString}":`, error);+ }+}export function ThemeEditorAdvanced() {return (- <div class="advanced-theme-host">+ <><style>{`- .advanced-theme-host {- font-family: "Forma DJR Mono";- scrollbar-width: none;- overflow: hidden;- font-size: 14px;- display: block;- height: 100%;- }- .advanced-theme-host *::selection {+ .theme-editor-advanced-input::selection {background-color: var(--a0);color: var(--b0);}- .advanced-theme-wrapper {++ .theme-editor-advanced-input.invalid {+ color: var(--a0) !important;+ }+ `}</style>++ <div style="+ font-family: 'Forma DJR Mono';+ scrollbar-width: none;+ position: relative;+ overflow: hidden;+ font-size: 14px;+ display: block;+ height: 100%;+ ">+ <div style="border: 1px solid var(--b4);overscroll-behavior: none;box-sizing: border-box;@@ -34,135 +60,120 @@ export function ThemeEditorAdvanced() {overflow-y: scroll;height: 100%;width: 100%;- }- .advanced-theme-color-grid {- background-color: var(--b4);- box-sizing: border-box;- overflow-x: hidden;- display: grid;- gap: 1px;- }- .advanced-theme-color-wrapper {- background-color: var(--b0);- }- .advanced-theme-color {- grid-template-columns: min-content min-content 1fr min-content;- align-items: center;- display: grid;- padding: 10px 20px;- gap: 20px;- }- .advanced-theme-color div {- white-space: nowrap;- }- .advanced-theme-color hr {- border: none;- border-top: 1px dashed var(--b4);- width: 100%;- }- .advanced-theme-list {- border-top: 1px dashed var(--b4);- padding: 10px;- }- .advanced-theme-color-editable {- word-wrap: nowrap;- width: min-content;- min-width: 10px;- outline: none;- }- .advanced-theme-color-editable.invalid {- color: var(--a0);- }- .advanced-theme-color-editable.valid {- color: var(--c0);- }- .input{- border: none;- outline: none;- display: block;- }- .input-group {- display: grid;- grid-template-columns: repeat(5, min-content);- width: min- gap: 2px;- }+ ">+ <div style="+ background-color: var(--b4);+ box-sizing: border-box;+ overflow-x: hidden;+ display: grid;+ gap: 1px;+ ">+ <div style="+ border-bottom: 1px solid var(--b4);+ background-color: var(--b0);+ width: calc(100% - 2px);+ align-items: center;+ position: absolute;+ padding: 0 20px;+ display: grid;+ height: 42px;+ z-index: 1;+ left: 1px;+ top: 1px;+ ">+ <SegmentedControl+ onChange={setDisplayType}+ value={displayType()}+ list={formatArray}+ label="format:"+ size="SM"+ />+ </div>+ <div style="height: 41px;"/>- `}</style>+ <For each={Object.entries(themeReactive)}>+ {([colorKey, colorValue]) => {- <div class="advanced-theme-wrapper">- <div class="advanced-theme-color-grid">- <For each={Object.entries(themeReactive)}>- {([colorKey, colorValue]) => (- <div class="advanced-theme-color-wrapper">- <div class="advanced-theme-color">- <ColorSwatch- width={'100px'}- color={`oklch(${colorValue.l[0]()} ${colorValue.c[0]()} ${colorValue.h[0]()}deg)`}- />+ const [isSetByInput, setIsSetByInput] = createSignal(false);+ const [inputValue, setInputValue] = createSignal('');- <div class="input-group">- <div>oklch(</div>- <input- type="number"- step="0.01"- min="0"- max="1"- value={colorValue.l[0]().toFixed(2)}- onInput={(e) =>- colorValue.l[1](- Math.max(- Math.min(parseFloat(e.target.value), 1),- 0- ) || 0- )- }- class="input number-input"- />- <input- type="number"- step="0.01"- min="0"- max="0.37"- value={colorValue.c[0]().toFixed(2)}- onInput={(e) =>- colorValue.c[1](- Math.max(- Math.min(parseFloat(e.target.value), 0.37),- 0- ) || 0- )- }- class="input number-input"- />- <input- type="number"- step="0.5"- min="0"- max="360"- value={colorValue.h[0]().toFixed(1)}- onInput={(e) =>- colorValue.h[1](- Math.max(- Math.min(parseFloat(e.target.value), 360),- 0- ) || 0- )- }- class="input number-input"- />- <div>deg)</div>- </div>+ createEffect(() => {+ const newValue = convertOklchTo(colorValue.l[0](), colorValue.c[0](), colorValue.h[0](), displayType());+ if(untrack(isSetByInput)){+ setIsSetByInput(false);+ // console.log('blocked!!!!!!!!!!!!');+ }+ else{setInputValue(newValue)}+ });++ return (+ <div style="background-color: var(--b0);">+ <div style="+ grid-template-columns: min-content 1fr min-content;+ background-color: var(--b4);+ align-items: center;+ display: grid;+ height: 41px;+ gap: 1px;+ ">+ <div style="+ background-color: var(--b0);+ box-sizing: border-box;+ align-items: center;+ padding: 0 20px;+ display: grid;+ height: 100%;+ width: 100%;+ ">+ <ColorSwatch+ color={`oklch(${colorValue.l[0]()} ${colorValue.c[0]()} ${colorValue.h[0]()}deg)`}+ width={'100px'}+ />+ </div>- <hr />+ <div style="+ background-color: var(--b0);+ box-sizing: border-box;+ align-items: center;+ white-space: nowrap;+ padding: 0 20px;+ display: grid;+ height: 100%;+ width: 100%;+ ">+ <input+ onInput={e => {setColor(colorValue, e.target.value, e.target, setIsSetByInput)}}+ class="theme-editor-advanced-input"+ value={inputValue()}+ type="text"+ style="+ outline: none;+ border: none;+ width: 100%;+ "+ />+ </div>- <div>--{colorKey}</div>- </div>- </div>- )}- </For>+ <div style="+ background-color: var(--b0);+ box-sizing: border-box;+ white-space: nowrap;+ align-items: center;+ padding: 0 20px;+ display: grid;+ height: 100%;+ width: 100%;+ ">+ --{colorKey}+ </div>+ </div>+ </div>+ )+ }}+ </For>+ </div></div></div>- </div>+ </>);}diff --git a/js/app/packages/block-theme/components/ThemeEditorBasic.tsx b/js/app/packages/block-theme/components/ThemeEditorBasic.tsxindex 5e2dbc0b96..57421d260a 100644--- a/js/app/packages/block-theme/components/ThemeEditorBasic.tsx+++ b/js/app/packages/block-theme/components/ThemeEditorBasic.tsx@@ -233,10 +233,8 @@ export function ThemeEditorBasic() {function setCanvasColor(e: PointerEvent) {const rect = canvasContainerRef.getBoundingClientRect();- const x =- Math.min(Math.max(e.clientX - rect.left, 0), rect.width) / rect.width;- const y =- Math.min(Math.max(e.clientY - rect.top, 0), rect.height) / rect.height;+ const x = Math.min(Math.max(e.clientX - rect.left, 0), rect.width) / rect.width;+ const y = Math.min(Math.max(e.clientY - rect.top, 0), rect.height) / rect.height;batch(() => {setLightness(1 - y);setHue(x * 360);@@ -259,7 +257,6 @@ export function ThemeEditorBasic() {}function handleChromaChange(e: Event) {- console.log('handleSaturationChange');setChroma(parseFloat((e.target as HTMLInputElement).value),parseFloat(sliderSaturationRef.value)@@ -267,12 +264,10 @@ export function ThemeEditorBasic() {}function handleSaturationChange(e: Event) {- console.log('handleSaturationChange');setSaturation(parseFloat((e.target as HTMLInputElement).value));}function handleContrastChange(e: Event) {- console.log('handleContrastChange');setContrast(parseFloat((e.target as HTMLInputElement).value));}@@ -289,10 +284,8 @@ export function ThemeEditorBasic() {canvasThumbRef.style.top = `${(1 - themeReactive.a0.l[0]()) * 100}%`;});- document.addEventListener('pointermove', handlePointerMove, {- passive: true,- });- document.addEventListener('pointerup', handlePointerUp);+ document.addEventListener('pointermove', handlePointerMove, {passive: true});+ document.addEventListener('pointerup', handlePointerUp, {passive: true});});onCleanup(() => {@@ -301,45 +294,87 @@ export function ThemeEditorBasic() {});return (- <div class="wrapper">+ <><style>{`- .wrapper {- border: 1px solid var(--b4);- box-sizing: border-box;- display: grid;- padding: 20px;- gap: 20px;- height: min-content;+ .theme-editor-basdic-slider::-webkit-slider-thumb {+ opacity: 0;+ }+ .theme-editor-basdic-slider::-moz-range-thumb {+ opacity: 0;}- .canvas-container {+ `}</style>++ <div style="+ font-family: 'Forma DJR Mono';+ border: 1px solid var(--b4);+ box-sizing: border-box;+ height: min-content;+ font-weight: 500;+ font-size: 12px;+ display: grid;+ padding: 20px;+ gap: 20px;+ ">+ <div+ onPointerDown={handleCanvasPointerDown}+ ref={canvasContainerRef}+ style="border: 1px solid var(--b4);position: relative;height: 250px;width: 100%;- }- .canvas {- user-select: none;- touch-action: none;- display: block;- height: 100%;- width: 100%;- }- .canvas-thumb {- border: 1px solid var(--b4);- background-color: var(--a0);- transform: translate(-50%, -50%);- box-sizing: border-box;+ "+ >+ <canvas+ ref={canvasRef}+ style="+ touch-action: none;+ user-select: none;+ display: block;+ height: 100%;+ width: 100%;+ "+ />+ <div+ ref={canvasThumbRef}+ style="+ transform: translate(-50%, -50%);+ background-color: var(--a0);+ border: 1px solid var(--b4);+ box-sizing: border-box;+ position: absolute;+ height: 18px;+ width: 18px;+ "+ />+ </div>++ <div style="+ grid-template-columns: 11ch 1fr;+ height: min-content;+ display: grid;+ width: 100%;+ gap: 20px 10px;+ ">++ <div style="position: relative;">+ <div style="+ transform: translateY(-50%);position: absolute;- height: 18px;- width: 18px;- }- .slider-container {- box-sizing: border-box;- position: relative;- height: 10px;- width: 100%;- }- .slider-track {+ top: 50%;+ left: 0;+ ">+ chroma:+ </div>+ </div>+ <div style="+ box-sizing: border-box;+ position: relative;+ height: 10px;+ width: 100%;+ ">+ <div style="+ background: linear-gradient(to right, oklch(from var(--a0) l 0.0 h), oklch(from var(--a0) l 0.37 h));transform: translate(-50%, -50%);border: 1px solid var(--b4);box-sizing: border-box;@@ -348,99 +383,40 @@ export function ThemeEditorBasic() {width: 100%;left: 50%;top: 50%;- }- .thumb{- background-color: var(--b0);- transform: translate(-50%, -50%);- border: 1px solid var(--b4);- box-sizing: border-box;- border-radius: 0px;- position: absolute;- height: 18px;- width: 18px;- top: 50%;- }- .tick{- transform: translate(-50%, -50%);- position: absolute;- height: 8px;- width: 2px;- top: 50%;- }- .base{- background-color: var(--a1);- }- .contrast{- background-color: var(--a2);- }- .slider {- -webkit-appearance: none;- width: calc(100% + 18px);- box-sizing: border-box;- border-radius: 0px;- position: absolute;- background: #0000;- appearance: none;- cursor: pointer;- outline: none;- height: 100%;- left: -9px;- margin: 0;- top: 0;- }- .slider::-webkit-slider-thumb {- opacity: 0;- }- .slider::-moz-range-thumb {- opacity: 0;- }- .wrapper-saturation, .wrapper-contrast {- background-color: var(--b4);- display: grid;- gap: 1px;- }- .wrapper-saturation > div, .wrapper-contrast > div {- background-color: var(--b0);- height: 100%;- width: 100%;- }- .wrapper-saturation {- grid-template-columns: 50fr 40.5fr 32fr 24.5fr 18fr 12.5fr 8fr 5fr 2fr 0.5fr;- }- .wrapper-contrast {- grid-template-columns: 0.5fr 2fr 5fr 8fr 12.5fr 18fr 50fr 50fr 18fr 12.5fr 8fr 5fr 2fr 0.5fr;- }- `}</style>-- <div- class="canvas-container"- ref={canvasContainerRef}- onPointerDown={handleCanvasPointerDown}- >- <canvas class="canvas" ref={canvasRef}></canvas>- <div class="canvas-thumb" ref={canvasThumbRef}></div>- </div>-- <div class="slider-container">- <div- style="background: linear-gradient(to right, oklch(from var(--a0) l 0.0 h), oklch(from var(--a0) l 0.37 h))"- class="slider-track"- ></div>-- <div- style={{- left: `${themeReactive.a0.c[0]() * (100 / 0.37)}%`,- 'background-color': 'var(--a0)',- }}- class="thumb"- />+ "/>++ <div style={{+ 'left': `${themeReactive.a0.c[0]() * (100 / 0.37)}%`,+ 'transform': 'translate(-50%, -50%)',+ 'background-color': 'var(--a0)',+ 'border': '1px solid var(--b4)',+ 'box-sizing': 'border-box',+ 'border-radius': '0px',+ 'position': 'absolute',+ 'height': '18px',+ 'width': '18px',+ 'top': '50%',+ }}/><inputvalue={themeReactive.a0.c[0]().toString()}- onInput={(e) => {- handleChromaChange(e);- }}- class="slider"+ onInput={(e) => {handleChromaChange(e)}}+ class="theme-editor-basdic-slider"+ style="+ -webkit-appearance: none;+ width: calc(100% + 18px);+ box-sizing: border-box;+ border-radius: 0px;+ position: absolute;+ background: #0000;+ appearance: none;+ cursor: pointer;+ outline: none;+ height: 100%;+ left: -9px;+ margin: 0;+ top: 0;+ "step="0.001"type="range"max="0.37"@@ -448,106 +424,176 @@ export function ThemeEditorBasic() {/></div>- <div class="slider-container">- <div class="slider-track wrapper-saturation">- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />+ <div style="position: relative;">+ <div style="+ transform: translateY(-50%);+ position: absolute;+ top: 50%;+ left: 0;+ ">+ saturation:+ </div>+ </div>+ <div style="+ box-sizing: border-box;+ position: relative;+ height: 10px;+ width: 100%;+ ">+ <div style="+ grid-template-columns: 50fr 40.5fr 32fr 24.5fr 18fr 12.5fr 8fr 5fr 2fr 0.5fr;+ transform: translate(-50%, -50%);+ background-color: var(--b4);+ border: 1px solid var(--b4);+ box-sizing: border-box;+ position: absolute;+ display: grid;+ height: 10px;+ width: 100%;+ left: 50%;+ top: 50%;+ gap: 1px;+ ">+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/></div>- <div- style={{- left: `${(themeReactive.b0.c[0]() / (themeReactive.a0.c[0]() * 0.8) / 0.37) * 100}%`,- }}- class="thumb"- />-- {/*- <div class="tick contrast" style={{'left': '17.3554%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '33.0579%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '47.1074%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '59.5041%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '70.2479%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '79.3388%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '86.7769%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '92.5620%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '96.6942%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': '99.1736%', 'background-color': 'oklch(from var(--a2) l c h / 0.4)'}}/>- */}+ <div style={{+ 'left': `${(themeReactive.b0.c[0]() / (themeReactive.a0.c[0]() * 0.8) / 0.37) * 100}%`,+ 'transform': 'translate(-50%, -50%)',+ 'background-color': 'var(--b0)',+ 'border': '1px solid var(--b4)',+ 'box-sizing': 'border-box',+ 'border-radius': '0px',+ 'position': 'absolute',+ 'height': '18px',+ 'width': '18px',+ 'top': '50%',+ }}/><input- onInput={(e) => {- handleSaturationChange(e);- }}+ onInput={(e) => {handleSaturationChange(e)}}+ class="theme-editor-basdic-slider"+ style="+ -webkit-appearance: none;+ width: calc(100% + 18px);+ box-sizing: border-box;+ border-radius: 0px;+ position: absolute;+ background: #0000;+ appearance: none;+ cursor: pointer;+ outline: none;+ height: 100%;+ left: -9px;+ margin: 0;+ top: 0;+ "ref={sliderSaturationRef}- class="slider"step="0.001"type="range"+ value="0"max="1.0"min="0.0"- value="0"/></div>- <div class="slider-container">- <div class="slider-track wrapper-contrast">- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />- <div />+ <div style="position: relative;">+ <div style="+ transform: translateY(-50%);+ position: absolute;+ top: 50%;+ left: 0;+ ">+ contrast:+ </div>+ </div>+ <div style="+ box-sizing: border-box;+ position: relative;+ height: 10px;+ width: 100%;+ ">+ <div style="+ grid-template-columns: 0.5fr 2fr 5fr 8fr 12.5fr 18fr 50fr 50fr 18fr 12.5fr 8fr 5fr 2fr 0.5fr;+ transform: translate(-50%, -50%);+ background-color: var(--b4);+ border: 1px solid var(--b4);+ box-sizing: border-box;+ position: absolute;+ display: grid;+ height: 10px;+ width: 100%;+ left: 50%;+ top: 50%;+ gap: 1px;+ ">+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/>+ <div style="background-color: var(--b0); height: 100%; width: 100%;"/></div>- <div- style={{- left: `${getContrastFromY(themeReactive.b0.l[0]()) * 100}%`,- }}- class="thumb"- />-- {/*- <div class="tick base" style={{'left': `${themeReactive.b0.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a0) l c h / 0.6)'}}/>- <div class="tick base" style={{'left': `${themeReactive.b1.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a0) l c h / 0.85)'}}/>- <div class="tick base" style={{'left': `${themeReactive.b2.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a0) l c h / 0.7)'}}/>- <div class="tick base" style={{'left': `${themeReactive.b3.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a0) l c h / 0.55)'}}/>- <div class="tick base" style={{'left': `${themeReactive.b4.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a0) l c h / 0.4)'}}/>-- <div class="tick contrast" style={{'left': `${themeReactive.c4.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a4) l c h / 0.4)'}}/>- <div class="tick contrast" style={{'left': `${themeReactive.c3.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a4) l c h / 0.55)'}}/>- <div class="tick contrast" style={{'left': `${themeReactive.c2.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a4) l c h / 0.7)'}}/>- <div class="tick contrast" style={{'left': `${themeReactive.c1.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a4) l c h / 0.85)'}}/>- <div class="tick contrast" style={{'left': `${themeReactive.c0.l[0]() * 100}%`, 'background-color': 'oklch(from var(--a4) l c h / 1)'}}/>- */}+ <div style={{+ 'left': `${getContrastFromY(themeReactive.b0.l[0]()) * 100}%`,+ 'transform': 'translate(-50%, -50%)',+ 'background-color': 'var(--b0)',+ 'border': '1px solid var(--b4)',+ 'box-sizing': 'border-box',+ 'border-radius': '0px',+ 'position': 'absolute',+ 'height': '18px',+ 'width': '18px',+ 'top': '50%',+ }}/><input- onInput={(e) => {- handleContrastChange(e);- }}+ onInput={(e) => {handleContrastChange(e)}}+ class="theme-editor-basdic-slider"+ style="+ -webkit-appearance: none;+ width: calc(100% + 18px);+ box-sizing: border-box;+ border-radius: 0px;+ position: absolute;+ background: #0000;+ appearance: none;+ cursor: pointer;+ outline: none;+ height: 100%;+ left: -9px;+ margin: 0;+ top: 0;+ "ref={sliderContrastRef}- class="slider"type="range"step="0.001"+ value="0"max="1.0"min="0.0"- value="0"/></div>++ </div></div>+ </>);}diff --git a/js/app/packages/block-theme/components/ThemeList.tsx b/js/app/packages/block-theme/components/ThemeList.tsxindex a4743bd552..294b4068af 100644--- a/js/app/packages/block-theme/components/ThemeList.tsx+++ b/js/app/packages/block-theme/components/ThemeList.tsx@@ -7,91 +7,85 @@ export function ThemeList() {return (<><style>{`- .theme-list-wrapper {- font-family: "Forma DJR Mono";- border: 1px solid var(--b4);- overscoll-behavior: none;- scrollbar-width: none;- overflow-y: scroll;- font-size: 14px;- }- .theme-list-grid {- background-color: var(--b4);- overscroll-behavior: none;- box-sizing: border-box;- overflow-x: hidden;- display: grid;- gap: 1px;- }- .theme-item {- grid-template-columns: min-content 1fr;- background-color: var(--b0);- align-items: center;- padding: 10px 20px;- display: grid;- gap: 20px;- }- .theme-select{- grid-template-columns: 1fr min-content;- transition: color var(--transition);- align-items: center;- user-select: none;- cursor: pointer;- display: grid;- gap: 20px;- }- .theme-select.current-theme{- transition: none;- color: var(--a0);+ .theme-list-item.current-theme{+ transition: none !important;+ color: var(--a0) !important;++ .theme-list-item-name{+ transition: none !important;+ color: var(--a0) !important;+ }++ .theme-color-swatch{+ border-color: var(--a0) !important;+ transition: none !important;+ }hr{- border-color: var(--a0);- transition: none;+ border-color: var(--a0) !important;+ transition: none !important;}}- .swatches{- grid-template-columns: repeat(3, min-content);- display: grid;- gap: 5px;- }- .theme-item div {- white-space: nowrap;- }- hr {- borde: none;- border-top: 1px dashed var(--b4);- transition: border-color var(--transition);- box-sizing: border-box;- width: 100%;- }- .theme-list-list {- border-top: 1px dashed var(--b4);- padding: 10px;- }+@media(hover){- .theme-select:hover{+ .theme-list-item:hover{transition: none;color: var(--a0);+ .theme-list-item-name{+ transition: none !important;+ color: var(--a0) !important;+ }++ .theme-color-swatch{+ border-color: var(--a0) !important;+ transition: none !important;+ }+hr{- border-color: var(--a0);- transition: none;+ border-color: var(--a0) !important;+ transition: none !important;}}}`}</style>- <div class="theme-list-wrapper">- <div class="theme-list-grid">+ <div style="+ font-family: 'Forma DJR Mono';+ border: 1px solid var(--b4);+ overscoll-behavior: none;+ scrollbar-width: none;+ overflow-y: scroll;+ font-size: 14px;+ ">+ <div style="+ background-color: var(--b4);+ overscroll-behavior: none;+ box-sizing: border-box;+ overflow-x: hidden;+ display: grid;+ gap: 1px;+ "><For each={themes()}>{(theme) => (- <div class="theme-item">- <div class="swatches">- {/*<For each={Object.entries(theme.tokens)}>- {([tokenName, tokenValue]) => (- <Swatch width={"10px"} color={`oklch(${tokenValue.l} ${tokenValue.c} ${tokenValue.h}deg)`}/>- )}- </For>*/}+ <div+ class={`theme-list-item ${theme.id === currentThemeId() && isThemeSaved() ? 'current-theme' : ''}`}+ onPointerDown={() => {applyTheme(theme.id)}}+ style="+ grid-template-columns: min-content 1fr min-content;+ background-color: var(--b0);+ align-items: center;+ padding: 10px 20px;+ cursor: pointer;+ display: grid;+ gap: 20px;+ "+ >+ <div style="+ grid-template-columns: repeat(3, min-content);+ display: grid;+ gap: 5px;+ "><ColorSwatchwidth={'10px'}color={`oklch(${theme.tokens.a0.l} ${theme.tokens.a0.c} ${theme.tokens.a0.h}deg)`}@@ -106,16 +100,23 @@ export function ThemeList() {/></div>+ <hr style="+ border: none;+ transition: border-color var(--transition);+ border-top: 1px dashed var(--b4);+ box-sizing: border-box;+ width: 100%;+ "/>+<div- class={`theme-select ${theme.id === currentThemeId() && isThemeSaved() ? 'current-theme' : ''}`}- onPointerDown={() => {- applyTheme(theme.id);- }}- >- <hr />- <div>{theme.name}</div>+ class="theme-list-item-name"+ style="+ transition: color var(--transition);+ white-space: nowrap;+ ">+ {theme.name}</div>- </div>+ </div>)}</For></div>diff --git a/js/app/packages/block-theme/components/ThemeTools.tsx b/js/app/packages/block-theme/components/ThemeTools.tsxindex 62f091ad8e..c564c3ea26 100644--- a/js/app/packages/block-theme/components/ThemeTools.tsx+++ b/js/app/packages/block-theme/components/ThemeTools.tsx@@ -78,13 +78,17 @@ export function ThemeTools() {{currentThemeName()}</div>- <hr />+ <hr style="+ border: none;+ border-top: 1px dashed var(--b4);+ box-sizing: border-box;+ width: 100%;+ "/><Show when={showTrash()}><IconButton- onPointerDown={() => {- deleteTheme(currentThemeId());- }}+ onPointerDown={() => { deleteTheme(currentThemeId()) }}+ // tooltip={{label: "Delete Theme"}}icon={IconTrash}theme="base"/>@@ -92,20 +96,25 @@ export function ThemeTools() {<Show when={!isThemeSaved()}><IconButton- onPointerDown={() => {- saveTheme(themeName.innerText);- }}+ onPointerDown={() => { saveTheme(themeName.innerText) }}+ // tooltip={{label: "Save Theme"}}icon={IconSave}theme="base"/></Show>{/*<Show when={DEV_MODE_ENV}>- <IconButton onPointerDown={copyTokens} icon={IconFigma} theme="base" />+ <IconButton+ tooltip={{label: "Copy Tokens"}}+ onPointerDown={copyTokens}+ icon={IconFigma}+ theme="base"+ /></Show>*/}<Show when={DEV_MODE_ENV}><IconButton+ // tooltip={{label: "Copy To Clipboard"}}onPointerDown={exportTheme}icon={IconClipboard}theme="base"@@ -113,12 +122,18 @@ export function ThemeTools() {</Show><IconButton+ // tooltip={{label: "Toggle Light / Dark"}}onPointerDown={invertTheme}icon={IconLightDark}theme="base"/>- <IconButton onPointerDown={randomizeTheme} icon={IconDice} theme="base" />+ <IconButton+ // tooltip={{label: "Randomize Theme"}}+ onPointerDown={randomizeTheme}+ icon={IconDice}+ theme="base"+ /></div>);}diff --git a/js/app/packages/block-theme/types/themeTypes.ts b/js/app/packages/block-theme/types/themeTypes.tsindex a907c2e0df..fa6f3c2105 100644--- a/js/app/packages/block-theme/types/themeTypes.ts+++ b/js/app/packages/block-theme/types/themeTypes.ts@@ -18,6 +18,8 @@ export type ThemeReactive = {c4: { l: Signal<number>; c: Signal<number>; h: Signal<number> };};+export type ThemeReactiveColor = ThemeReactive[keyof ThemeReactive];+export type ThemePrevious = {a0: { l: number; c: number; h: number };a1: { l: number; c: number; h: number };diff --git a/js/app/packages/block-theme/utils/colorUtil.ts b/js/app/packages/block-theme/utils/colorUtil.tsindex 94bd7021b1..bf469af1ab 100644--- a/js/app/packages/block-theme/utils/colorUtil.ts+++ b/js/app/packages/block-theme/utils/colorUtil.ts@@ -1,26 +1,26 @@import Color from 'colorjs.io';-const testColorDiv = document.createElement('canvas');-testColorDiv.style.display = 'none';-testColorDiv.style.height = '1px';-testColorDiv.style.width = '1px';-document.body.appendChild(testColorDiv);-const ctx = testColorDiv.getContext('2d')!;-testColorDiv.height = 1;-testColorDiv.width = 1;--export function computeToken(token: string) {- ctx.clearRect(0, 0, 1, 1);- ctx.fillStyle = token;- ctx.fillRect(0, 0, 1, 1);- let imageData = ctx?.getImageData(0, 0, 1, 1);- const color = new Color(- 'srgb',- [imageData.data[0] / 255, imageData.data[1] / 255, imageData.data[2] / 255],- imageData.data[3] / 255- );- return color.toString({ format: 'hex' }).substring(0, 7);-}+// const testColorDiv = document.createElement('canvas');+// testColorDiv.style.display = 'none';+// testColorDiv.style.height = '1px';+// testColorDiv.style.width = '1px';+// document.body.appendChild(testColorDiv);+// const ctx = testColorDiv.getContext('2d')!;+// testColorDiv.height = 1;+// testColorDiv.width = 1;++// export function computeToken(token: string) {+// ctx.clearRect(0, 0, 1, 1);+// ctx.fillStyle = token;+// ctx.fillRect(0, 0, 1, 1);+// let imageData = ctx?.getImageData(0, 0, 1, 1);+// const color = new Color(+// 'srgb',+// [imageData.data[0] / 255, imageData.data[1] / 255, imageData.data[2] / 255],+// imageData.data[3] / 255+// );+// return color.toString({ format: 'hex' }).substring(0, 7);+// }export function validateColor(color: string): boolean {return CSS.supports('color', color);@@ -29,5 +29,35 @@ export function validateColor(color: string): boolean {export function getOklch(cssColor: string) {const color = new Color(cssColor);const convert = color.to('oklch');- return { l: convert.coords[0], c: convert.coords[1], h: convert.coords[2] };++ let l = convert.coords[0] ? convert.coords[0] : 0;+ let c = convert.coords[1] ? convert.coords[1] : 0;+ let h = convert.coords[2] ? convert.coords[2] : 0;++ let returnColor = { l: l, c: c, h: h }+ return returnColor;+}++export function convertOklchTo(l: number, c: number, h: number, type: string) {+ // console.log(`oklch values: L=${l}, C=${c}, H=${h} | type: ${type}`);+ try{+ const lightness = Math.max(0, Math.min(1, l));+ const chroma = Math.max(0, c < 1e-10 ? 0 : c);+ const hue = h;++ const color = new Color('oklch', [lightness, chroma, hue]);++ switch(type){+ case 'hex': return color.to('srgb').toString({ format: 'hex', precision: 4 });+ case 'rgb': return color.to('srgb').toString({ format: 'rgb', precision: 4 });+ case 'oklab': return color.to('oklab').toString({ precision: 4 });+ case 'hsl': return color.to('hsl').toString({ precision: 4 });+ case 'oklch': return color.toString({ precision: 4 });+ default: return color.to('srgb').toString({ format: 'hex' });+ }+ }+ catch(error){+ console.error(error);+ return '#000000';+ }}