From 75a9cfdabeb3319bead2193816f0f7528ef24c6d Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 3 Mar 2023 10:22:50 -0800 Subject: [PATCH 1/3] Remove leftover log --- styles/src/themes/common/syntax.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/styles/src/themes/common/syntax.ts b/styles/src/themes/common/syntax.ts index 11d16eea16..763141cea8 100644 --- a/styles/src/themes/common/syntax.ts +++ b/styles/src/themes/common/syntax.ts @@ -120,7 +120,7 @@ export interface Syntax { // HACK: "constructor" as a key in the syntax interface returns an error when a theme tries to use it. // For now hack around it by omiting constructor as a valid key for overrides. -export type ThemeSyntax = Partial> +export type ThemeSyntax = Partial const defaultSyntaxHighlightStyle: Omit = { weight: fontWeights.normal, @@ -312,8 +312,6 @@ function buildDefaultSyntax(colorScheme: ColorScheme): Syntax { }, } - console.log(JSON.stringify(defaultSyntax, null, 2)) - return defaultSyntax } From ad4201f76813382d56e9f1a3b0224db6b0c95b24 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 3 Mar 2023 10:58:25 -0800 Subject: [PATCH 2/3] Hack to fix `syntax.constructor` causing TS error --- styles/src/themes/common/syntax.ts | 4 +++- styles/src/themes/one-dark.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/styles/src/themes/common/syntax.ts b/styles/src/themes/common/syntax.ts index 763141cea8..57710b365f 100644 --- a/styles/src/themes/common/syntax.ts +++ b/styles/src/themes/common/syntax.ts @@ -56,7 +56,8 @@ export interface Syntax { "string.regex": SyntaxHighlightStyle // == Types ====== / - constructor: SyntaxHighlightStyle + // We allow Function here because all JS objects literals have this property + constructor: SyntaxHighlightStyle | Function variant: SyntaxHighlightStyle type: SyntaxHighlightStyle // js: predefined_type @@ -120,6 +121,7 @@ export interface Syntax { // HACK: "constructor" as a key in the syntax interface returns an error when a theme tries to use it. // For now hack around it by omiting constructor as a valid key for overrides. +// export type ThemeSyntax = Partial> export type ThemeSyntax = Partial const defaultSyntaxHighlightStyle: Omit = { diff --git a/styles/src/themes/one-dark.ts b/styles/src/themes/one-dark.ts index 48305e5bd9..2b2e87fa12 100644 --- a/styles/src/themes/one-dark.ts +++ b/styles/src/themes/one-dark.ts @@ -41,6 +41,8 @@ const ramps = { magenta: colorRamp(chroma("#be5046")), } + + const syntax: ThemeSyntax = { boolean: { color: color.orange }, comment: { color: color.grey }, @@ -63,6 +65,7 @@ const syntax: ThemeSyntax = { type: { color: color.teal }, "variable.special": { color: color.orange }, variant: { color: color.blue }, + constructor: { color: color.blue } } export const dark = createColorScheme(name, false, ramps, syntax) From f1b5bf051a0966e6d17d5f4c8db8755f568bf5c1 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 3 Mar 2023 10:58:43 -0800 Subject: [PATCH 3/3] Fornat --- styles/src/styleTree/feedback.ts | 10 ++++++++-- styles/src/themes/common/syntax.ts | 4 +--- styles/src/themes/one-dark.ts | 4 +--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/styles/src/styleTree/feedback.ts b/styles/src/styleTree/feedback.ts index d794674439..ba688d1e2e 100644 --- a/styles/src/styleTree/feedback.ts +++ b/styles/src/styleTree/feedback.ts @@ -32,7 +32,13 @@ export default function feedback(colorScheme: ColorScheme) { }, button_margin: 8, info_text_default: text(layer, "sans", "default", { size: "xs" }), - link_text_default: text(layer, "sans", "default", { size: "xs", underline: true }), - link_text_hover: text(layer, "sans", "hovered", { size: "xs", underline: true }) + link_text_default: text(layer, "sans", "default", { + size: "xs", + underline: true, + }), + link_text_hover: text(layer, "sans", "hovered", { + size: "xs", + underline: true, + }), } } diff --git a/styles/src/themes/common/syntax.ts b/styles/src/themes/common/syntax.ts index 57710b365f..7295a5432e 100644 --- a/styles/src/themes/common/syntax.ts +++ b/styles/src/themes/common/syntax.ts @@ -1,8 +1,6 @@ import deepmerge from "deepmerge" import { FontWeight, fontWeights } from "../../common" -import { - ColorScheme, -} from "./colorScheme" +import { ColorScheme } from "./colorScheme" export interface SyntaxHighlightStyle { color: string diff --git a/styles/src/themes/one-dark.ts b/styles/src/themes/one-dark.ts index 2b2e87fa12..2803cab572 100644 --- a/styles/src/themes/one-dark.ts +++ b/styles/src/themes/one-dark.ts @@ -41,8 +41,6 @@ const ramps = { magenta: colorRamp(chroma("#be5046")), } - - const syntax: ThemeSyntax = { boolean: { color: color.orange }, comment: { color: color.grey }, @@ -65,7 +63,7 @@ const syntax: ThemeSyntax = { type: { color: color.teal }, "variable.special": { color: color.orange }, variant: { color: color.blue }, - constructor: { color: color.blue } + constructor: { color: color.blue }, } export const dark = createColorScheme(name, false, ramps, syntax)