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
fix: source resolver broken opening blocks + deprecate start/html/color blocks (#269)
gbirman3be79ae94603
diff --git a/js/app/bun.lock b/js/app/bun.lockindex ac74a98e99..80d93237b7 100644--- a/js/app/bun.lock+++ b/js/app/bun.lock@@ -1,6 +1,5 @@{"lockfileVersion": 1,- "configVersion": 0,"workspaces": {"": {"name": "@coparse/monorepo",@@ -205,10 +204,6 @@"packages/block-code": {"name": "block-code",},- "packages/block-color": {- "name": "block-color",- "version": "0.0.1",- },"packages/block-contact": {"name": "block-contact",},@@ -1742,8 +1737,6 @@"block-code": ["block-code@workspace:packages/block-code"],- "block-color": ["block-color@workspace:packages/block-color"],-"block-contact": ["block-contact@workspace:packages/block-contact"],"block-image": ["block-image@workspace:packages/block-image"],diff --git a/js/app/packages/block-color/colorBlockData.ts b/js/app/packages/block-color/colorBlockData.tsdeleted file mode 100644index 8e01abfc40..0000000000--- a/js/app/packages/block-color/colorBlockData.ts+++ /dev/null@@ -1,4 +0,0 @@-import { blockDataSignalAs } from '@core/block';-import type { ColorBlockData } from './definition';--export const colorBlockDataSignal = blockDataSignalAs<ColorBlockData>('color');diff --git a/js/app/packages/block-color/component/Block.tsx b/js/app/packages/block-color/component/Block.tsxdeleted file mode 100644index 70e7eed3c1..0000000000--- a/js/app/packages/block-color/component/Block.tsx+++ /dev/null@@ -1,418 +0,0 @@-import type { ColorBlock, ColorDocument } from '@block-color/type/ColorBlock';-import { generateRandomThemeBlock } from '@block-color/util/generateRandomThemeBlock';-import { getRandomOklch } from '@block-color/util/getRandomOklch';-import {- applyConstraints,- formatOklch,- parseOklch,-} from '@block-color/util/oklch';-import { DocumentBlockContainer } from '@core/component/DocumentBlockContainer';-import { IconButton } from '@core/component/IconButton';-import { TextButton } from '@core/component/TextButton';-import XIcon from '@icon/regular/x.svg?component-solid';-import { makePersisted } from '@solid-primitives/storage';-import { useSearchParams } from '@solidjs/router';-import { createEffect, createMemo, For, Show } from 'solid-js';-import { createStore } from 'solid-js/store';-import { colorBlockDataSignal } from '../colorBlockData';-import TopBar from './TopBar';--function serialize(data: ColorBlock): string {- return encodeURIComponent(JSON.stringify(data));-}--export default function Block() {- const blockData = colorBlockDataSignal.get;- const [, setParams] = useSearchParams();-- const [colorStore, setColorStore] = makePersisted(- createStore<Record<string, ColorDocument>>({}),- { name: 'block-color.store' }- );-- // Initialize local store with a ColorDocument and sync URL state- createEffect(() => {- const data = blockData();- if (!data) return;- const id = data.id as string;- const existing = colorStore[id];- const doc: ColorDocument =- existing ??- (() => {- const now = Date.now();- return {- id,- data: data.colorBlock as ColorBlock,- createdAt: now,- updatedAt: now,- type: 'color',- };- })();- setColorStore(id, doc);- setParams({ state: serialize(doc.data) }, { replace: true });- });-- const id = createMemo(() => {- return blockData()?.id ?? '';- });-- const currentBlock = createMemo<ColorBlock | undefined>(() => {- const currentId = id();- return colorStore[currentId]?.data;- });-- const onGenerateRandom = () => {- const currentId = id();- if (!currentId) return;-- // Generate a valid theme layout first- const baseBlock = generateRandomThemeBlock();-- // Apply constraints per column and normalize rows to respect row 1- const adjustedColumns = baseBlock.columns.map((col, ci) => {- const base = parseOklch(col.colors[0]?.color);- const constraints =- ci === 0- ? { lockL: true, lockC: true, lockH: false }- : { lockL: false, lockC: true, lockH: true };-- if (!base) {- return { ...col, constraints } as typeof col;- }-- const colors = col.colors.map((sw, idx) => {- if (idx === 0) return sw;- const parsed = parseOklch(sw.color);- if (!parsed) return sw;- const constrained = applyConstraints(base, parsed, constraints);- return { ...sw, color: formatOklch(constrained) };- });-- return { ...col, colors, constraints } as typeof col;- });-- const randomBlock: ColorBlock = {- ...baseBlock,- columns: adjustedColumns,- };-- const now = Date.now();- setColorStore(currentId, (prev) => ({- id: currentId,- data: randomBlock,- createdAt: prev?.createdAt ?? now,- updatedAt: now,- fileType: 'color',- }));- setParams({ state: serialize(randomBlock) }, { replace: true });- };-- const insertColumnAt = (insertIndex: number) => {- const currentId = id();- if (!currentId) return;- const baseData = currentBlock();- if (!baseData) return;-- const newColumn = {- colors: [{ color: getRandomOklch() }],- constraints: { lockL: false, lockC: false, lockH: false },- } as ColorBlock['columns'][number];-- const newColumns = [- ...baseData.columns.slice(0, insertIndex),- newColumn,- ...baseData.columns.slice(insertIndex),- ];-- const updatedAt = Date.now();- setColorStore(currentId, 'data', 'columns', newColumns);- setColorStore(currentId, 'updatedAt', updatedAt);- setParams(- { state: serialize({ ...baseData, columns: newColumns }) },- { replace: true }- );- };-- const insertRowAt = (columnIndex: number, insertIndex: number) => {- const currentId = id();- if (!currentId) return console.log('no id');- const baseData = currentBlock();- if (!baseData) return console.log('no base data');-- const targetColumn = baseData.columns[columnIndex];- if (!targetColumn) return console.log('no target column');-- const baseOklch = parseOklch(targetColumn.colors[0]?.color);- const candidate = parseOklch(getRandomOklch());- if (!baseOklch || !candidate) return console.log('no base or candidate');-- const constrained = applyConstraints(- baseOklch,- candidate,- targetColumn.constraints- );- const newSwatch = { color: formatOklch(constrained) };- const newColors = [- ...targetColumn.colors.slice(0, insertIndex),- newSwatch,- ...targetColumn.colors.slice(insertIndex),- ];-- const updatedAt = Date.now();- setColorStore(- currentId,- 'data',- 'columns',- columnIndex,- 'colors',- newColors- );- setColorStore(currentId, 'updatedAt', updatedAt);- setParams(- {- state: serialize({- ...baseData,- columns: baseData.columns.map((c, i) =>- i === columnIndex ? { ...c, colors: newColors } : c- ),- }),- },- { replace: true }- );- };-- const toggleConstraint = (- columnIndex: number,- key: 'lockL' | 'lockC' | 'lockH'- ) => {- const currentId = id();- if (!currentId) return;- const baseData = currentBlock();- if (!baseData) return;-- const col = baseData.columns[columnIndex];- const constraints = {- lockL: col.constraints?.lockL ?? false,- lockC: col.constraints?.lockC ?? false,- lockH: col.constraints?.lockH ?? false,- [key]: !(col.constraints?.[key] ?? false),- } as NonNullable<ColorBlock['columns'][number]['constraints']>;-- const baseOklch = parseOklch(col.colors[0]?.color);- if (!baseOklch) return;-- const updatedColors = col.colors.map((sw, i) => {- if (i === 0) return sw; // keep base as-is- const parsed = parseOklch(sw.color);- if (!parsed) return sw;- const constrained = applyConstraints(baseOklch, parsed, constraints);- return { ...sw, color: formatOklch(constrained) };- });-- const updatedAt = Date.now();- setColorStore(- currentId,- 'data',- 'columns',- columnIndex,- 'constraints',- constraints- );- setColorStore(- currentId,- 'data',- 'columns',- columnIndex,- 'colors',- updatedColors- );- setColorStore(currentId, 'updatedAt', updatedAt);-- setParams(- {- state: serialize({- ...baseData,- columns: baseData.columns.map((c, i) =>- i === columnIndex ? { ...c, colors: updatedColors, constraints } : c- ),- }),- },- { replace: true }- );- };-- const deleteRowAt = (columnIndex: number, rowIndex: number) => {- const currentId = id();- if (!currentId) return;- const baseData = currentBlock();- if (!baseData) return;-- const targetColumn = baseData.columns[columnIndex];- if (!targetColumn) return;-- // Prevent deleting the last remaining swatch in the last column- if (baseData.columns.length <= 1 && targetColumn.colors.length <= 1) return;-- const newColors = targetColumn.colors.filter((_, i) => i !== rowIndex);-- const updatedAt = Date.now();- if (newColors.length === 0) {- // Remove the entire column if no swatches remain- const filteredColumns = baseData.columns.filter(- (_, i) => i !== columnIndex- );- setColorStore(currentId, 'data', 'columns', filteredColumns);- setColorStore(currentId, 'updatedAt', updatedAt);- setParams(- { state: serialize({ ...baseData, columns: filteredColumns }) },- { replace: true }- );- return;- }-- // Otherwise just update the colors in the target column- setColorStore(- currentId,- 'data',- 'columns',- columnIndex,- 'colors',- newColors- );- setColorStore(currentId, 'updatedAt', updatedAt);- setParams(- {- state: serialize({- ...baseData,- columns: baseData.columns.map((c, i) =>- i === columnIndex ? { ...c, colors: newColors } : c- ),- }),- },- { replace: true }- );- };-- return (- <DocumentBlockContainer title={currentBlock()?.name ?? 'Color Block'}>- <div class="w-full h-full bg-panel flex flex-col relative">- <TopBar- colorBlock={currentBlock}- id={id()}- onGenerateRandom={onGenerateRandom}- />- <div class="flex w-full h-full overflow-auto">- <For each={currentBlock()?.columns ?? []}>- {(col, index) => (- <div class="relative group flex flex-col flex-1">- {/* Floating column constraint controls (show on hover) */}- <div class="absolute top-0 left-0 right-0 z-10 flex justify-center items-center gap-1 p-1 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">- Constrain- <TextButton- theme={col.constraints?.lockL ? 'accent' : 'clear'}- text="L"- class="pointer-events-auto"- onClick={(e) => {- e.stopPropagation();- toggleConstraint(index(), 'lockL');- }}- />- <TextButton- theme={col.constraints?.lockC ? 'accent' : 'clear'}- text="C"- class="pointer-events-auto"- onClick={(e) => {- e.stopPropagation();- toggleConstraint(index(), 'lockC');- }}- />- <TextButton- theme={col.constraints?.lockH ? 'accent' : 'clear'}- text="H"- class="pointer-events-auto"- onClick={(e) => {- e.stopPropagation();- toggleConstraint(index(), 'lockH');- }}- />- </div>-- {/* Left insert hotspot */}- <div- class="absolute inset-y-0 left-0 w-2 cursor-pointer opacity-0 hover:opacity-100 hover:bg-accent hover-transition-bg"- onClick={(e) => {- e.stopPropagation();- insertColumnAt(index());- }}- />-- {/* Column contents */}- <For each={col.colors}>- {(swatch, rowIndex) => (- <div class="relative group flex-1">- {/* Top insert hotspot for rows */}- <div- class="absolute inset-x-0 top-0 h-2 cursor-pointer opacity-0 hover:opacity-100 hover:bg-accent hover-transition-bg"- onClick={(e) => {- e.stopPropagation();- insertRowAt(index(), rowIndex());- }}- />-- {/* The swatch fill */}- <div- class="w-full h-full"- style={{ 'background-color': swatch.color }}- />-- {/* Delete swatch (X) */}- <Show- when={- (currentBlock()?.columns.length ?? 0) > 1 ||- (col.colors.length ?? 0) > 1- }- >- <div class="absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity">- <IconButton- icon={XIcon}- theme="clear"- iconSize={14}- class="p-0.5"- onClick={(e) => {- e.stopPropagation();- deleteRowAt(index(), rowIndex());- }}- aria-label="Delete swatch"- tooltip={{ label: 'Delete swatch' }}- />- </div>- </Show>-- {/* Bottom insert hotspot for rows */}- <div- class="absolute inset-x-0 bottom-0 h-2 cursor-pointer opacity-0 hover:opacity-100 hover:bg-accent hover-transition-bg"- onClick={(e) => {- e.stopPropagation();- insertRowAt(index(), rowIndex() + 1);- }}- />- </div>- )}- </For>-- {/* Right insert hotspot */}- <div- class="absolute inset-y-0 right-0 w-2 cursor-pointer opacity-0 hover:opacity-100 hover:bg-accent hover-transition-bg"- onClick={(e) => {- e.stopPropagation();- insertColumnAt(index() + 1);- }}- />- </div>- )}- </For>- </div>- </div>- </DocumentBlockContainer>- );-}diff --git a/js/app/packages/block-color/component/TopBar.tsx b/js/app/packages/block-color/component/TopBar.tsxdeleted file mode 100644index 03c0ac1d1a..0000000000--- a/js/app/packages/block-color/component/TopBar.tsx+++ /dev/null@@ -1,75 +0,0 @@-import type { ColorBlock } from '@block-color/type/ColorBlock';-// import { validateColorBlockAsTheme } from '@block-color/util/validateTheme';-import { IconButton } from '@core/component/IconButton';-import { TextButton } from '@core/component/TextButton';-import { toast } from '@core/component/Toast/Toast';-import { Bar } from '@core/component/TopBar/Bar';-import { buildSimpleEntityUrl } from '@core/util/url';-import ClipboardIcon from '@icon/regular/clipboard.svg?component-solid';-import { DropdownMenu } from '@kobalte/core/dropdown-menu';-import { createCallback } from '@solid-primitives/rootless';-import type { Accessor } from 'solid-js';-import { createMemo, Show } from 'solid-js';--export default function TopBar(props: {- colorBlock: Accessor<ColorBlock | undefined>;- id: string;- onGenerateRandom: () => void;-}) {- const themeDetected = createMemo(() => {- const cb = props.colorBlock();- if (!cb) return false;- /* THEME SPEC HAS CHANGED */- /* NEW THEME SPEC IS IN themeUtil.ts */- // const result = validateColorBlockAsTheme(cb);- return false;- });-- const copyLink = createCallback(() => {- navigator.clipboard.writeText(- buildSimpleEntityUrl(- {- type: 'color',- id: props.id,- },- {}- )- );- toast.success('Link copied to clipboard.');- });-- return (- <Bar- suppressPop- left={- <DropdownMenu sameWidth>- <DropdownMenu.Trigger- as={TextButton}- theme="clear"- text={props.colorBlock()?.name ?? 'Colors'}- />- </DropdownMenu>- }- center={- <div class="flex items-center gap-2">- <Show when={themeDetected()}>- <div class="text-xs opacity-70">Theme Detected</div>- </Show>- <TextButton- theme="clear"- text="Randomize Theme"- onClick={props.onGenerateRandom}- />- </div>- }- right={- <IconButton- icon={ClipboardIcon}- theme="clear"- tooltip={{ label: 'Copy theme' }}- onClick={copyLink}- />- }- />- );-}diff --git a/js/app/packages/block-color/component/index.ts b/js/app/packages/block-color/component/index.tsdeleted file mode 100644index 48ad03212b..0000000000--- a/js/app/packages/block-color/component/index.ts+++ /dev/null@@ -1 +0,0 @@-export { default } from './Block';diff --git a/js/app/packages/block-color/definition.ts b/js/app/packages/block-color/definition.tsdeleted file mode 100644index 920322249c..0000000000--- a/js/app/packages/block-color/definition.ts+++ /dev/null@@ -1,63 +0,0 @@-import { defineBlock, type ExtractLoadType, LoadErrors } from '@core/block';-import type { Source } from '@core/source';-import { ok } from '@core/util/maybeResult';-import BlockColor from './component/Block';-import { type ColorBlock, parseColorBlock } from './type/ColorBlock';-import { getRandomOklch } from './util/getRandomOklch';--export const definition = defineBlock({- name: 'color',- description:- 'Displays a grid of colors, when the spec matches our theme spec, can be used as a Theme Primitive',- accepted: {},- component: BlockColor,- async load(source: Source, intent) {- if (source.type === 'dss') {- if (intent === 'preload') {- return ok({- type: 'preload',- origin: source,- });- }-- const parseFromUrl = (): ColorBlock | undefined => {- try {- const search =- typeof window !== 'undefined' ? window.location.search : '';- const params = new URLSearchParams(search);- const raw = params.get('state');- if (!raw) return undefined;- const decoded = decodeURIComponent(raw);- const obj = JSON.parse(decoded);- return parseColorBlock(obj);- } catch {}- return undefined;- };-- const initial: ColorBlock = {- name: 'New Colors',- columns: [- {- colors: [{ color: getRandomOklch() }],- },- {- colors: [{ color: getRandomOklch() }],- },- {- colors: [{ color: getRandomOklch() }],- },- ],- };-- const colorBlock = parseFromUrl() ?? initial;-- return ok({- id: source.id,- colorBlock,- } as const);- }- return LoadErrors.INVALID;- },-});--export type ColorBlockData = ExtractLoadType<(typeof definition)['load']>;diff --git a/js/app/packages/block-color/package.json b/js/app/packages/block-color/package.jsondeleted file mode 100644index 0c047abbec..0000000000--- a/js/app/packages/block-color/package.json+++ /dev/null@@ -1,9 +0,0 @@-{- "name": "block-color",- "private": true,- "version": "0.0.1",- "type": "module",- "scripts": {},- "dependencies": {}-}-diff --git a/js/app/packages/block-color/tsconfig.json b/js/app/packages/block-color/tsconfig.jsondeleted file mode 100644index 2ed72477a3..0000000000--- a/js/app/packages/block-color/tsconfig.json+++ /dev/null@@ -1,14 +0,0 @@-{- "extends": "../../tsconfig.json",- "compilerOptions": {- "jsx": "preserve",- "jsxImportSource": "solid-js",- "verbatimModuleSyntax": true,- "declaration": true,- "composite": true- },- "exclude": [- "node_modules"- ]-}-diff --git a/js/app/packages/block-color/type/ColorBlock.ts b/js/app/packages/block-color/type/ColorBlock.tsdeleted file mode 100644index 40d99c72e0..0000000000--- a/js/app/packages/block-color/type/ColorBlock.ts+++ /dev/null@@ -1,77 +0,0 @@-export type Swatch = {- color: string;-};--export type ColumnConstraints = {- lockL?: boolean;- lockC?: boolean;- lockH?: boolean;-};--export type ColorColumn = {- colors: Swatch[];- constraints?: ColumnConstraints;-};--export type ColorBlock = {- name: string;- columns: ColorColumn[];-};--export type ColorDocument = {- id: string;- data: ColorBlock;- createdAt: number;- updatedAt: number;- fileType: string;- owner?: string;- projectId?: string;-};--// Runtime validation-import { z } from 'zod';--export const SwatchSchema = z.object({- color: z.string().min(1),-});--export const ColumnConstraintsSchema = z- .object({- lockL: z.boolean().optional(),- lockC: z.boolean().optional(),- lockH: z.boolean().optional(),- })- .partial()- .optional();--export const ColorColumnSchema = z.object({- colors: z.array(SwatchSchema),- constraints: ColumnConstraintsSchema,-});--export const ColorBlockSchema = z.object({- name: z.string().min(1),- columns: z.array(ColorColumnSchema),-});--export function parseColorBlock(value: unknown): ColorBlock | undefined {- const res = ColorBlockSchema.safeParse(value);- if (!res.success) return undefined;- return res.data;-}--export const ColorDocumentSchema = z.object({- id: z.string().min(1),- data: ColorBlockSchema,- createdAt: z.number().finite().nonnegative(),- updatedAt: z.number().finite().nonnegative(),- fileType: z.string().min(1),- owner: z.string().optional(),- projectId: z.string().optional(),-});--export function parseColorDocument(value: unknown): ColorDocument | undefined {- const res = ColorDocumentSchema.safeParse(value);- if (!res.success) return undefined;- return res.data;-}diff --git a/js/app/packages/block-color/util/generateRandomThemeBlock.ts b/js/app/packages/block-color/util/generateRandomThemeBlock.tsdeleted file mode 100644index 37ada147ba..0000000000--- a/js/app/packages/block-color/util/generateRandomThemeBlock.ts+++ /dev/null@@ -1,94 +0,0 @@-import type {- ColorBlock,- ColorColumn,- Swatch,-} from '@block-color/type/ColorBlock';--function rand(): number {- return Math.random();-}--function clamp(v: number, min: number, max: number): number {- return Math.max(min, Math.min(max, v));-}--function mod360(h: number): number {- let x = h % 360;- if (x < 0) x += 360;- return x;-}--function sigmoid(x: number, b: number): number {- const s = 1 / (1 + Math.pow(Math.E, b * x));- return clamp(s, 0, 1);-}--function parabola(t: number): number {- return Math.pow(t, 4) / 20;-}--function toSwatch(l: number, c: number, h: number): Swatch {- const L = clamp(l, 0, 1);- const C = clamp(c, 0, 0.4);- const H = mod360(h);- return {- color: `oklch(${L.toFixed(3)} ${C.toFixed(3)} ${H.toFixed(3)})`,- };-}--/**- * Generate a ColorBlock matching the Theme spec layout:- * - 3 columns (Accent, Contrast, Surface)- * - 5 rows each- * - Accent rows 2..5 vary H only- * - Contrast rows 2..5 vary L only (C and H locked)- * - Surface rows 2..5 vary L only (C and H locked)- */-export function generateRandomThemeBlock(): ColorBlock {- const hue = rand() * 360;- const polarity = rand() > 0.5 ? 1 : -1;- const b = polarity * (rand() * 9 + 1);-- // Accent- const accentL = 0.5 + rand() * 0.5;- const accentC = 0.25 + rand() * 0.12;- const accentH = hue;- const accentHOffsets = [72, -72, 144, -144];- const accentColumn: ColorColumn = {- colors: [- toSwatch(accentL, accentC, accentH),- ...accentHOffsets.map((d) => toSwatch(accentL, accentC, accentH + d)),- ],- };-- // Contrast- const contrastC = parabola(rand());- const contrastH = hue; // keep consistent hue family- const contrastL = sigmoid(0.5, b);- const contrastLs = [0.4, 0.3, 0.2, 0.1].map((x) => sigmoid(x, b));- const contrastColumn: ColorColumn = {- colors: [- toSwatch(contrastL, contrastC, contrastH),- ...contrastLs.map((L) => toSwatch(L, contrastC, contrastH)),- ],- };-- // Surface- const surfaceC = parabola(rand());- const surfaceH = hue;- const surfaceL = sigmoid(-0.5, b);- const surfaceLs = [-0.4, -0.3, -0.2, -0.1].map((x) => sigmoid(x, b));- const surfaceColumn: ColorColumn = {- colors: [- toSwatch(surfaceL, surfaceC, surfaceH),- ...surfaceLs.map((L) => toSwatch(L, surfaceC, surfaceH)),- ],- };-- const block: ColorBlock = {- name: 'Random Theme',- columns: [accentColumn, contrastColumn, surfaceColumn],- };-- return block;-}diff --git a/js/app/packages/block-color/util/getRandomOklch.ts b/js/app/packages/block-color/util/getRandomOklch.tsdeleted file mode 100644index c3b7277434..0000000000--- a/js/app/packages/block-color/util/getRandomOklch.ts+++ /dev/null@@ -1,22 +0,0 @@-export function getRandomOklch(- minL = 0,- maxL = 100,- minC = 0,- maxC = 0.4,- minH = 0,- maxH = 360,- minA = 1,- maxA = 1-) {- const lightness = Math.random() * (maxL - minL) + minL;- const chroma = Math.random() * (maxC - minC) + minC;- const hue = Math.random() * (maxH - minH) + minH;- const alpha = Math.random() * (maxA - minA) + minA;-- // Format the output string for CSS- if (alpha === 1) {- return `oklch(${lightness.toFixed(2)}% ${chroma.toFixed(3)} ${hue.toFixed(2)}deg)`;- } else {- return `oklch(${lightness.toFixed(2)}% ${chroma.toFixed(3)} ${hue.toFixed(2)}deg / ${alpha.toFixed(2)})`;- }-}diff --git a/js/app/packages/block-color/util/oklch.ts b/js/app/packages/block-color/util/oklch.tsdeleted file mode 100644index 6d86077d0a..0000000000--- a/js/app/packages/block-color/util/oklch.ts+++ /dev/null@@ -1,56 +0,0 @@-export type Oklch = { l: number; c: number; h: number };--export function parseOklch(input: string): Oklch | undefined {- // Accept formats like: oklch(0.7 0.15 30), oklch(70% 0.15 30deg)- const m = input- .trim()- .match(/^oklch\(\s*([^\s]+)\s+([^\s]+)\s+([^\s]+)\s*\)$/i);- if (!m) return undefined;- let [lRaw, cRaw, hRaw] = m.slice(1);-- // Handle % for lightness- let l: number;- if (lRaw.endsWith('%')) {- const v = Number(lRaw.slice(0, -1));- if (Number.isNaN(v)) return undefined;- l = v / 100;- } else {- const v = Number(lRaw);- if (Number.isNaN(v)) return undefined;- l = v;- }-- // Chroma (unitless in our usage)- const c = Number(cRaw);- if (Number.isNaN(c)) return undefined;-- // Hue can have deg suffix- let h: number;- if (hRaw.toLowerCase().endsWith('deg')) {- const v = Number(hRaw.slice(0, -3));- if (Number.isNaN(v)) return undefined;- h = v;- } else {- const v = Number(hRaw);- if (Number.isNaN(v)) return undefined;- h = v;- }-- return { l, c, h };-}--export function formatOklch({ l, c, h }: Oklch): string {- return `oklch(${l.toFixed(3)} ${c.toFixed(3)} ${((h % 360) + 360) % 360})`;-}--export function applyConstraints(- base: Oklch,- candidate: Oklch,- constraints?: { lockL?: boolean; lockC?: boolean; lockH?: boolean }-): Oklch {- return {- l: constraints?.lockL ? base.l : candidate.l,- c: constraints?.lockC ? base.c : candidate.c,- h: constraints?.lockH ? base.h : candidate.h,- };-}diff --git a/js/app/packages/block-color/util/validateTheme.ts b/js/app/packages/block-color/util/validateTheme.tsdeleted file mode 100644index c1db10c343..0000000000--- a/js/app/packages/block-color/util/validateTheme.ts+++ /dev/null@@ -1,149 +0,0 @@-import type { ColorBlock } from '@block-color/type/ColorBlock';-// import { parseOklch } from '@block-color/util/oklch';--/* -------------------------------------------------- */-/* PETER I HAD TO CHANG THE THEME SPEC */-/* VERY SORRY FOR BREAKING COLOR BLOCK */-/* NEW THEME SPEC IS IN themeUtil.ts */-/* IT LOOKS LIKE: */--// export type ThemeV1Tokens = {-// a0: { l: number; c: number; h: number };-// a1: { l: number; c: number; h: number };-// a2: { l: number; c: number; h: number };-// a3: { l: number; c: number; h: number };-// a4: { l: number; c: number; h: number };-// b0: { l: number; c: number; h: number };-// b1: { l: number; c: number; h: number };-// b2: { l: number; c: number; h: number };-// b3: { l: number; c: number; h: number };-// b4: { l: number; c: number; h: number };-// c0: { l: number; c: number; h: number };-// c1: { l: number; c: number; h: number };-// c2: { l: number; c: number; h: number };-// c3: { l: number; c: number; h: number };-// c4: { l: number; c: number; h: number };-// }--// export type ThemeV1 = {-// id: string;-// name: string;-// version: number;-// tokens: ThemeV1Tokens;-// };-/* -------------------------------------------------- */--// type ValidationResult =-// | { valid: true; spec: ThemeSpecification }-// | { valid: false; errors: string[] };--// const EPS = 1e-3;-// const approxEq = (a: number, b: number) => Math.abs(a - b) <= EPS;--/**- * Validate a ColorBlock against the ThemeSpecification layout.- * Columns: [Accent, Contrast, Surface]- * Rows per column: 5- * - Accent: row1 => (accent-l, accent-c, accent-h); rows 2-5 => accent-h-1..4 with L and C locked- * - Contrast: row1 => (contrast-l, contrast-c, contrast-h); rows 2-5 => contrast-l-1..4 with C and H locked- * - Surface: row1 => (surface-l, surface-c, surface-h); rows 2-5 => surface-l-1..4 with C and H locked- */-export function validateColorBlockAsTheme(_block: ColorBlock): boolean {- // const errors: string[] = [];-- // if (block.columns.length !== 3) {- // errors.push(- // `Expected 3 columns (Accent, Contrast, Surface); received ${block.columns.length}`- // );- // }-- // block.columns.forEach((col, ci) => {- // if (col.colors.length !== 5) {- // errors.push(- // `Column ${ci + 1}: expected 5 rows; received ${col.colors.length}`- // );- // }- // col.colors.forEach((sw, ri) => {- // if (!parseOklch(sw.color)) {- // errors.push(- // `Column ${ci + 1} Row ${ri + 1}: invalid OKLCH color '${sw.color}'`- // );- // }- // });- // });-- // if (errors.length > 0) {- // return { valid: false, errors };- // }-- // // Safe to parse everything now- // const accent = block.columns[0].colors.map((s) => parseOklch(s.color)!);- // const contrast = block.columns[1].colors.map((s) => parseOklch(s.color)!);- // const surface = block.columns[2].colors.map((s) => parseOklch(s.color)!);-- // // Accent: rows 2-5 must lock L and C to row1- // for (let i = 1; i < 5; i++) {- // if (- // !approxEq(accent[i].l, accent[0].l) ||- // !approxEq(accent[i].c, accent[0].c)- // ) {- // errors.push(- // `Accent row ${i + 1}: expected same L (${accent[0].l}) and C (${accent[0].c}) as row 1`- // );- // }- // }-- // // Contrast: rows 2-5 must lock C and H to row1- // for (let i = 1; i < 5; i++) {- // if (- // !approxEq(contrast[i].c, contrast[0].c) ||- // !approxEq(contrast[i].h, contrast[0].h)- // ) {- // errors.push(- // `Contrast row ${i + 1}: expected same C (${contrast[0].c}) and H (${contrast[0].h}) as row 1`- // );- // }- // }-- // // Surface: rows 2-5 must lock C and H to row1- // for (let i = 1; i < 5; i++) {- // if (- // !approxEq(surface[i].c, surface[0].c) ||- // !approxEq(surface[i].h, surface[0].h)- // ) {- // errors.push(- // `Surface row ${i + 1}: expected same C (${surface[0].c}) and H (${surface[0].h}) as row 1`- // );- // }- // }-- // if (errors.length > 0) {- // return { valid: false, errors };- // }-- // const spec: ThemeSpecification = {- // '--accent-l': accent[0].l,- // '--accent-c': accent[0].c,- // '--accent-h': accent[0].h,- // '--accent-h-1': accent[1].h,- // '--accent-h-2': accent[2].h,- // '--accent-h-3': accent[3].h,- // '--accent-h-4': accent[4].h,- // '--contrast-l': contrast[0].l,- // '--contrast-l-1': contrast[1].l,- // '--contrast-l-2': contrast[2].l,- // '--contrast-l-3': contrast[3].l,- // '--contrast-l-4': contrast[4].l,- // '--contrast-c': contrast[0].c,- // '--contrast-h': contrast[0].h,- // '--surface-l': surface[0].l,- // '--surface-l-1': surface[1].l,- // '--surface-l-2': surface[2].l,- // '--surface-l-3': surface[3].l,- // '--surface-l-4': surface[4].l,- // '--surface-c': surface[0].c,- // '--surface-h': surface[0].h,- // } as ThemeSpecification;-- return false;-}diff --git a/js/app/packages/core/block.ts b/js/app/packages/core/block.tsindex 7248a748e2..4bb8af22d3 100644--- a/js/app/packages/core/block.ts+++ b/js/app/packages/core/block.ts@@ -47,19 +47,16 @@ export const BlockRegistry = ['chat','write','pdf',- 'html','md','code','image','canvas','channel','project',- 'start','unknown','video','email','contact',- 'color',] as const;type BlockNameKeys = keyof typeof BlockRegistry & number;@@ -73,13 +70,11 @@ export type BlockName = (typeof BlockRegistry)[BlockNameKeys];* Represents the block types that do not correspond to a document type.*/export const NonDocumentBlockTypes = [- 'start','chat','channel','project','email','contact',- 'color',] as BlockName[];/**@@ -121,17 +116,14 @@ export const ValidBlockCombinations: BlockCombinationRules = {write: exclude(['write']),md: allBlockNames,code: exclude(['code']),- html: new Set([]),image: allBlockNames,channel: allBlockNames,email: allBlockNames,canvas: allBlockNames,- start: new Set([]),project: allBlockNames,unknown: allBlockNames,video: allBlockNames,contact: allBlockNames,- color: allBlockNames,} as const;// maps block name to valid parents@@ -142,16 +134,13 @@ export const ValidNestingCombinations: BlockCombinationRules = {write: new Set([]),md: new Set([]),code: new Set(['md']),- html: new Set([]),image: new Set([]),channel: new Set([]),email: new Set([]),- start: new Set([]),project: new Set([]),unknown: new Set([]),video: new Set([]),contact: new Set([]),- color: new Set([]),};export const LoadErrors = {diff --git a/js/app/packages/core/component/AI/constant/fileType.ts b/js/app/packages/core/component/AI/constant/fileType.tsindex 208d39c874..083600a92b 100644--- a/js/app/packages/core/component/AI/constant/fileType.ts+++ b/js/app/packages/core/component/AI/constant/fileType.ts@@ -325,7 +325,6 @@ export const SUPPORTED_CHAT_ATTACHMENT_BLOCKS: BlockName[] = ['channel','write','pdf',- 'html','md','code','canvas',diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsxindex ba19f6a5b3..bca4085518 100644--- a/js/app/packages/core/component/EntityIcon.tsx+++ b/js/app/packages/core/component/EntityIcon.tsx@@ -18,14 +18,11 @@ import FilePdf from '@icon/duotone/file-pdf-duotone.svg';import FileVideo from '@icon/duotone/file-video-duotone.svg';import Channel from '@icon/duotone/hash-duotone.svg';import FileImage from '@icon/duotone/image-duotone.svg';-import Color from '@icon/duotone/palette-duotone.svg';import Canvas from '@icon/duotone/pencil-circle-duotone.svg';-import Plus from '@icon/duotone/plus-circle-duotone.svg';import User from '@icon/duotone/user-duotone.svg';import Users from '@icon/duotone/users-duotone.svg';import Folder from '@icon/fill/folder-simple-fill.svg';import FolderUser from '@icon/fill/folder-user-fill.svg';-import PixelPlus from '@macro-icons/pixel/add.svg';import PixelChat from '@macro-icons/pixel/ai.svg';import PixelBuilding from '@macro-icons/pixel/building.svg';import PixelCanvas from '@macro-icons/pixel/canvas.svg';@@ -34,7 +31,6 @@ import PixelCode from '@macro-icons/pixel/code.svg';import PixelEmail from '@macro-icons/pixel/email.svg';import PixelEmailRead from '@macro-icons/pixel/email-read.svg';import PixelFile from '@macro-icons/pixel/file.svg';-import PixelColor from '@macro-icons/pixel/flower.svg';import PixelFolder from '@macro-icons/pixel/folder-alt.svg';import PixelHtml from '@macro-icons/pixel/html.svg';import PixelImage from '@macro-icons/pixel/image.svg';@@ -65,7 +61,8 @@ export type EntityWithValidIcon =| 'user'| 'directMessage'| 'emailRead'- | 'archive';+ | 'archive'+ | 'html';const ARCHIVE_EXTENSIONS = new Set(Object.values(FileTypeMap)@@ -98,12 +95,6 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {background: 'bg-default-bg',prettyName: 'Company',},- color: {- icon: Color,- foreground: 'text-default',- background: 'bg-default-bg',- prettyName: 'Color',- },email: {icon: Email,foreground: 'text-email',@@ -146,12 +137,6 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {background: 'bg-chat-bg',prettyName: 'Chat',},- start: {- icon: Plus,- foreground: 'text-default',- background: 'bg-default-bg',- prettyName: 'Start',- },project: {icon: Folder,foreground: 'text-folder',@@ -242,7 +227,6 @@ export const PIXEL_ICONS: Record<EntityWithValidIcon, Component> = {html: PixelHtml,channel: PixelChannel,company: PixelBuilding,- color: PixelColor,email: PixelEmail,code: PixelCode,pdf: PixelPdf,@@ -250,7 +234,6 @@ export const PIXEL_ICONS: Record<EntityWithValidIcon, Component> = {image: PixelImage,write: PixelWord,chat: PixelChat,- start: PixelPlus,project: PixelFolder,sharedProject: PixelFolder,unknown: PixelUnknown,diff --git a/js/app/packages/core/component/FileList/constants.tsx b/js/app/packages/core/component/FileList/constants.tsxindex dce97fd66c..079c0098e8 100644--- a/js/app/packages/core/component/FileList/constants.tsx+++ b/js/app/packages/core/component/FileList/constants.tsx@@ -64,14 +64,11 @@ export const fileTypeColors: Record<BlockName | 'default', string> = {image: 'bg-image/20 group/item',canvas: 'bg-canvas/20 group/item',video: 'bg-video/20 group/item',- color: 'bg-color/20 group/item',contact: defaultFileColor,default: defaultFileColor,chat: defaultFileColor,- html: defaultFileColor,channel: defaultFileColor,email: defaultFileColor,- start: defaultFileColor,project: defaultFileColor,unknown: defaultFileColor,};diff --git a/js/app/packages/core/component/FileList/itemOperations.ts b/js/app/packages/core/component/FileList/itemOperations.tsindex 207331e566..8d2d4b18bc 100644--- a/js/app/packages/core/component/FileList/itemOperations.ts+++ b/js/app/packages/core/component/FileList/itemOperations.ts@@ -145,7 +145,6 @@ export async function deleteItem(args: {}} else {if (itemType === 'channel') return false;- if (itemType === 'color') return false;if (itemType === 'email') return false;const removed = await removeHistoryItem(itemType, id);if (!removed) return false;diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsxindex 0c919a2c80..037920a223 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx@@ -16,7 +16,6 @@ import { canNestBlock } from '@core/orchestrator';import {isAccessiblePreviewItem,type PreviewChannelAccess,- type PreviewColorAccess,type PreviewDocumentAccess,type PreviewItem,type PreviewItemAccess,@@ -98,6 +97,16 @@ function Loading(props: { collapsed?: boolean }) {);}+type AccessiblePreviewItem =+ | PreviewItemAccess+ | PreviewProjectAccess+ | PreviewDocumentAccess+ | PreviewChannelAccess;++function isAccessible(item: PreviewItem): item is AccessiblePreviewItem {+ return isAccessiblePreviewItem(item);+}+function InlinePreview(props: {item: () => PreviewItem;blockName: BlockName;@@ -105,16 +114,6 @@ function InlinePreview(props: {theme?: EditorThemeClasses;collapsed?: boolean;}) {- type AccessiblePreviewItem =- | PreviewItemAccess- | PreviewProjectAccess- | PreviewDocumentAccess- | PreviewChannelAccess- | PreviewColorAccess;-- function isAccessible(item: PreviewItem): item is AccessiblePreviewItem {- return isAccessiblePreviewItem(item);- }return (<Switch><Match when={props.item().loading}>diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/mentions/mentionsPlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/mentions/mentionsPlugin.tsindex 0f13d3e313..7097544ac0 100644--- a/js/app/packages/core/component/LexicalMarkdown/plugins/mentions/mentionsPlugin.ts+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/mentions/mentionsPlugin.ts@@ -214,7 +214,6 @@ const getDocumentMentionItemType = (case 'chat':case 'channel':case 'project':- case 'color':case 'email':return itemType;default:diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.tsindex bc541d024c..5bc8ef20f5 100644--- a/js/app/packages/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.ts+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.ts@@ -76,7 +76,6 @@ export function parseMacroAppUrl(text: string): MacroAppUrlParsed {'canvas','channel','project',- 'color',];const _block: string = pathParts[1];if (!validTypes.includes(_block as any)) {diff --git a/js/app/packages/core/constant/allBlocks.ts b/js/app/packages/core/constant/allBlocks.tsindex 2e0aa320f3..5115fb46aa 100644--- a/js/app/packages/core/constant/allBlocks.ts+++ b/js/app/packages/core/constant/allBlocks.ts@@ -124,6 +124,7 @@ export function fileTypeToBlockName(if (BlockRegistry.includes(blockOrFiletype as any)) {return blockOrFiletype as BlockName;}+return fileTypeToBlockName_[blockOrFiletype] ?? 'unknown';}diff --git a/js/app/packages/core/orchestrator.tsx b/js/app/packages/core/orchestrator.tsxindex 52d755b236..a8bab40b12 100644--- a/js/app/packages/core/orchestrator.tsx+++ b/js/app/packages/core/orchestrator.tsx@@ -438,7 +438,10 @@ function defaultSourceResolver(location?: DefaultLocation): Source {const def = BLOCK_REGISTRY[type];- if (def.syncServiceEnabled) return { type: 'sync-service', id };+ if (!def) {+ console.warn(`Block definition not found for type: ${type} with id: ${id}`);+ }+ if (def?.syncServiceEnabled) return { type: 'sync-service', id };return {type: 'dss',id,diff --git a/js/app/packages/core/signal/preview.ts b/js/app/packages/core/signal/preview.tsindex 2a4eb32592..c61b2586ac 100644--- a/js/app/packages/core/signal/preview.ts+++ b/js/app/packages/core/signal/preview.ts@@ -46,14 +46,6 @@ export type PreviewProjectAccess = {channelType?: never;} & BasePreviewItem<'project'>;-export type PreviewColorAccess = {- access: Extract<AccessType, 'access'>;- loading: false;- name: string;- fileType?: never;- channelType?: never;-} & BasePreviewItem<'color'>;-export type PreviewDocumentAccess = {access: Extract<AccessType, 'access'>;loading: false;@@ -76,8 +68,7 @@ export type PreviewItem =| PreviewItemAccess| PreviewProjectAccess| PreviewDocumentAccess- | PreviewChannelAccess- | PreviewColorAccess;+ | PreviewChannelAccess;export interface ItemEntity {id: string;@@ -125,28 +116,6 @@ function defaultNameTransform(item: PreviewItem): PreviewItem {return item;}-/** TODO YANK THIS when we move color doc to backend. */-function getLocalColorNameById(id: string): string | undefined {- try {- if (typeof window === 'undefined') return undefined;- const raw = window.localStorage?.getItem('block-color.store');- if (!raw) return undefined;- const parsed = JSON.parse(raw) as unknown;- if (- parsed &&- typeof parsed === 'object' &&- id in (parsed as Record<string, unknown>)- ) {- const entry = (parsed as Record<string, any>)[id];- const name = entry?.data?.name;- if (typeof name === 'string' && name.length > 0) return name;- }- } catch (_err) {- // ignore and fall back to empty name- }- return undefined;-}-const processFetchQueue = debounce(async () => {const items = previewFetchQueue();if (items.length === 0) return;@@ -176,9 +145,6 @@ async function batchFetchPreviews(items: ItemEntity[]) {.filter((i) => i.type === 'email' || !i.type).map((i) => i.id);- // TODO YANK THIS when we move color doc to backend.- const colorItems = items.filter((i) => i.type === 'color').map((i) => i.id);-const [chatResults,documentResults,@@ -201,16 +167,6 @@ async function batchFetchPreviews(items: ItemEntity[]) {: Promise.resolve([]),]);- // TODO YANK THIS when we move color doc to backend.- const colorResults = colorItems.map((id) => ({- _createdAt: new Date(),- id,- type: 'color' as const,- access: 'access' as const,- loading: false as const,- name: getLocalColorNameById(id) ?? '',- }));-const updates: ItemPreviewStore = {};[@@ -219,7 +175,6 @@ async function batchFetchPreviews(items: ItemEntity[]) {...channelResults,...projectResults,...emailResults,- ...colorResults,].forEach((result) => {updates[result.id] = result;});diff --git a/js/app/packages/service-storage/client.ts b/js/app/packages/service-storage/client.tsindex e8ce9629b2..dc66bef68c 100644--- a/js/app/packages/service-storage/client.ts+++ b/js/app/packages/service-storage/client.ts@@ -129,12 +129,11 @@ export type Success = {};type SuccessResponse = { data: Success };-export type ItemType = CloudStorageItemType | 'channel' | 'color' | 'email';+export type ItemType = CloudStorageItemType | 'channel' | 'email';const _itemTypeSet = new Set(['document','channel',- 'color','email','chat','project',@@ -186,8 +185,6 @@ export function blockNameToItemType(return 'channel';case 'project':return 'project';- case 'color':- return 'color';case 'email':return 'email';default:@@ -201,7 +198,6 @@ export function stringToItemType(str: string): ItemType | undefined {case 'document':case 'project':case 'channel':- case 'color':return str;default:return undefined;diff --git a/js/app/tsconfig.json b/js/app/tsconfig.jsonindex 7d366c11a6..628267170c 100644--- a/js/app/tsconfig.json+++ b/js/app/tsconfig.json@@ -136,12 +136,6 @@"@block-image/*": ["./packages/block-image/*"],- "@block-color/*": [- "./packages/block-color/*"- ],- "@block-start/*": [- "./packages/block-start/*"- ],"@block-unknown/*": ["./packages/block-unknown/*"],